diff --git a/CHANGELOG.md b/CHANGELOG.md index e254cc65..dd6d4e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.7.2](https://github.com/lunafromthemoon/RenJS-V2/compare/v2.7.1...v2.7.2) (2022-02-15) + + +### Bug Fixes + +* logChoices was not being used ([d5c541f](https://github.com/lunafromthemoon/RenJS-V2/commit/d5c541fa221f85a090d416978be097fc7f21c7e0)) + ## [2.7.1](https://github.com/lunafromthemoon/RenJS-V2/compare/v2.7.0...v2.7.1) (2022-01-08) diff --git a/dist/renjs.js b/dist/renjs.js index e063a9d0..c755b944 100644 --- a/dist/renjs.js +++ b/dist/renjs.js @@ -1,26 +1,4 @@ -var RenJS=function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=26)}([function(t,e,i){"use strict";var n=i(6),s=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];t.exports=function(t,e){var i,o;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===s.indexOf(e))throw new n('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(i=e.styleAliases||null,o={},null!==i&&Object.keys(i).forEach((function(t){i[t].forEach((function(e){o[String(e)]=t}))})),o),-1===r.indexOf(this.kind))throw new n('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e,i){this.game=t,this.actionType=e,this.properties=i,this.key=Object.keys(i)[0],this.keyParams=this.key.split(" "),this.body=i[this.key]}return t.prototype.resolve=function(t,e){var i=this;t&&!e?t.then((function(){return i.game.resolveAction()})):this.game.resolveAction()},t.prototype.execute=function(){},t.prototype.parseParams=function(t){return t?this.keyParams:(this.params||(this.params=this.body?this.body.split(" "):[]),this.params)},t.prototype.parseActor=function(){return this.keyParams[1]},t.prototype.parseParameter=function(t,e,i){void 0===e&&(e="boolean"),void 0===i&&(i=!1);var n=this.parseParams(i),s=n.indexOf(t);if("boolean"===e)return-1!==s;if(-1===s)return null;var r=n[s+1];if("coords"===e){if(r in this.game.storyConfig.positions)return this.game.storyConfig.positions[r];var o=r.split(",");return{x:parseInt(o[0],10),y:parseInt(o[1],10)}}return"number"===e?parseFloat(r):r},t}();e.default=n},function(t,e,i){var n=i(32),s=i(11);void 0===s.Phaser&&(s.Phaser=n),t.exports=n},function(t,e,i){"use strict";function n(t){return null==t}t.exports.isNothing=n,t.exports.isObject=function(t){return"object"==typeof t&&null!==t},t.exports.toArray=function(t){return Array.isArray(t)?t:n(t)?[]:[t]},t.exports.repeat=function(t,e){var i,n="";for(i=0;i0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&(this.loadingBarBg=this.loadingBar,this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar",1))}e.fade?t.add.tween(this.container).to({alpha:1},500).start():this.container.alpha=1}return t.prototype.setLoadingBar=function(t){if(this.loadingBar){var e=t.config.loadingScreen.loadingBar.direction?t.config.loadingScreen.loadingBar.direction:0;t.load.setPreloadSprite(this.loadingBar,e)}},t.prototype.waitingScreen=function(){this.loadingBar&&this.game.add.tween(this.loadingBar).to({alpha:1},600,null,!0,0,-1,!0)},t.prototype.destroy=function(t){var e=this;if(t.config.loadingScreen.fade){var i=t.add.tween(this.container).to({alpha:0},500);i.onComplete.addOnce((function(){e.container.destroy()})),i.start()}else this.container.destroy()},t}();e.default=n},function(t,e,i){"use strict";var n=i(48);t.exports=n},function(t,e,i){"use strict";var n=i(4);t.exports=new n({explicit:[i(51),i(52),i(53)]})},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e}(i(2).State);e.default=r},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(i,n){var s=t.call(this,i,n.x,n.y,n.asset,(function(){s.onClick()}))||this;return s.setFrames.apply(s,e.getButtonFrames(s.animations.frameTotal)),s.config=n,s.game=i,s}return s(e,t),e.getButtonFrames=function(t,e){void 0===e&&(e=!1);return{1:{normal:[0,0,0,0],pushed:[1,1,1,1]},2:{normal:[1,0,1,0],pushed:[3,2,3,2]},3:{normal:[1,0,2,0],pushed:[4,3,5,3]},4:{normal:[1,0,2,3],pushed:[5,4,6,7]}}[t][e?"pushed":"normal"]},e.prototype.onClick=function(){this.config.sfx&&"none"!==this.config.sfx&&this.game.managers.audio.playSFX(this.config.sfx),this.game.gui.bindingActions[this.config.binding](this.config,this)},e}(i(2).Button);e.default=r},function(t,e){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e=0;r--){var o=i[e.c];switch((e=this.execStack[r]).scope){case"interrupt":o=i[e.origin];var a=Object.keys(o.interrupt[e.index])[0];i=o.interrupt[e.index][a];break;case"choice":var h=Object.keys(o.choice[e.index])[0];i=o.choice[e.index][h];break;case"if":i=o[Object.keys(o)[0]]}s=i.slice(e.c).concat(s)}return s||[]},t}();e.default=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenizeTextStyle=void 0;var n=/\((?:color:(?:\w+|#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6})|italic|bold|end)\)/;e.tokenizeTextStyle=function(t){for(var e=[];;){var i=n.exec(t);if(!i)return e.push({text:t}),e;var s=i.index,r=i[0];e.push({text:t.substr(0,s)}),e.push({tag:r.slice(1,-1)}),t=t.substr(s+r.length)}}},function(t,e,i){"use strict";var n=i(4);t.exports=new n({include:[i(22)]})},function(t,e,i){"use strict";var n=i(4);t.exports=new n({include:[i(15)],implicit:[i(54),i(55),i(56),i(57)]})},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.dontHide=!1,s.boxId=s.parseParameter("IN","string",!0),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({message:e})}t=this.game.managers.text.display(this.body,this.boxId,null,this.dontHide),this.resolve(t)},e}(r(i(1)).default);e.default=o},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.initAssets=function(t){var e=function(t,e,i){return Object.keys(t).map((function(n){return{key:n,file:i+t[n].fileName,type:e,w:t[n].w,h:t[n].h}}))},i=e(t.assets.images,"image",t.assetsPath),n=e(t.assets.audio,"audio",t.assetsPath),s=e(t.assets.spritesheets,"spritesheet",t.assetsPath);this.assets=i.concat(n).concat(s),this.fonts=Object.keys(t.assets.fonts),this.config=t.config},e}(r(i(94)).default);e.default=o},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1] -* @copyright 2020 Photon Storm Ltd. -* @license {@link https://github.com/photonstorm/phaser-ce/blob/master/license.txt|MIT License} -* -* @overview -* -* Phaser CE - https://github.com/photonstorm/phaser-ce -* -* v2.16.0 "2020-06-01" - Built: Mon Jun 01 2020 11:17:52 -* -* By Richard Davey http://www.photonstorm.com @photonstorm and Phaser CE contributors -* -* Phaser - http://phaser.io -*/ -(function(){var i=i||{}; -/** - * @author Mat Groves http://matgroves.com @Doormat23 - * @author Richard Davey - * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */ -i.DisplayObject=function(){this.position=new i.Point(0,0),this.scale=new i.Point(1,1),this.pivot=new i.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.renderable=!1,this.parent=null,this.worldAlpha=1,this.worldTransform=new Phaser.Matrix,this.worldPosition=new i.Point(0,0),this.worldScale=new i.Point(1,1),this.worldRotation=0,this.filterArea=null,this._sr=0,this._cr=1,this._bounds=new i.Rectangle(0,0,0,0),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},i.DisplayObject.prototype={constructor:i.DisplayObject,destroy:function(){if(this.children){for(var t=this.children.length;t--;)this.children[t].destroy();this.children=[]}this.hitArea=null,this.parent=null,this.worldTransform=null,this.filterArea=null,this.renderable=!1,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture()},updateTransform:function(t){if(!t&&!this.parent&&!this.game)return this;var e=this.parent;t?e=t:this.parent||(e=this.game.world);var i,n,s,r,o,a,h=e.worldTransform,l=this.worldTransform;this.rotation%Phaser.Math.PI2?(this.rotation!==this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation)),i=this._cr*this.scale.x,n=this._sr*this.scale.x,s=-this._sr*this.scale.y,r=this._cr*this.scale.y,o=this.position.x,a=this.position.y,(this.pivot.x||this.pivot.y)&&(o-=this.pivot.x*i+this.pivot.y*s,a-=this.pivot.x*n+this.pivot.y*r),l.a=i*h.a+n*h.c,l.b=i*h.b+n*h.d,l.c=s*h.a+r*h.c,l.d=s*h.b+r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty):(i=this.scale.x,n=0,s=0,r=this.scale.y,o=this.position.x-this.pivot.x*i,a=this.position.y-this.pivot.y*r,l.a=i*h.a,l.b=i*h.b,l.c=r*h.c,l.d=r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty),i=l.a,n=l.b,s=l.c;var u=i*(r=l.d)-n*s;if(i||n){var c=Math.sqrt(i*i+n*n);this.worldRotation=n>0?Math.acos(i/c):-Math.acos(i/c),this.worldScale.x=c,this.worldScale.y=u/c}else if(s||r){var d=Math.sqrt(s*s+r*r);this.worldRotation=Phaser.Math.HALF_PI-(r>0?Math.acos(-s/d):-Math.acos(s/d)),this.worldScale.x=u/d,this.worldScale.y=d}else this.worldScale.x=0,this.worldScale.y=0;return this.worldAlpha=this.alpha*e.worldAlpha,this.worldPosition.x=l.tx,this.worldPosition.y=l.ty,this._currentBounds=null,this.transformCallback&&this.transformCallback.call(this.transformCallbackContext,l,h),this},preUpdate:function(){},generateTexture:function(t,e,n){var s=this.getLocalBounds(),r=new Phaser.RenderTexture(this.game,0|s.width,0|s.height,n,e,t);return i.DisplayObject._tempMatrix.tx=-s.x,i.DisplayObject._tempMatrix.ty=-s.y,r.render(this,i.DisplayObject._tempMatrix),r},updateCache:function(){return this._generateCachedSprite(),this},toGlobal:function(t){return this.updateTransform(),this.worldTransform.apply(t)},toLocal:function(t,e){return e&&(t=e.toGlobal(t)),this.updateTransform(),this.worldTransform.applyInverse(t)},_renderCachedSprite:function(t){this._cachedSprite.worldAlpha=this.worldAlpha,t.gl?i.Sprite.prototype._renderWebGL.call(this._cachedSprite,t):i.Sprite.prototype._renderCanvas.call(this._cachedSprite,t)},_generateCachedSprite:function(){this._cacheAsBitmap=!1;var t=this.getLocalBounds();if(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),this.updateTransform(),this._cachedSprite)this._cachedSprite.texture.resize(t.width,t.height);else{var e=0;this.texture&&this.texture.baseTexture&&i._enableMultiTextureToggle&&(e=this.texture.baseTexture.textureIndex);var n=new Phaser.RenderTexture(this.game,t.width,t.height,void 0,void 0,void 0,void 0,e);this._cachedSprite=new i.Sprite(n),this._cachedSprite.worldTransform=this.worldTransform}var s=this._filters;this._filters=null,this._cachedSprite.filters=s,i.DisplayObject._tempMatrix.tx=-t.x,i.DisplayObject._tempMatrix.ty=-t.y,this._cachedSprite.texture.render(this,i.DisplayObject._tempMatrix,!0),this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._filters=s,this._cacheAsBitmap=!0},_destroyCachedSprite:function(){this._cachedSprite&&(this._cachedSprite.texture.destroy(!0),this._cachedSprite=null)},_destroyTintedTexture:function(){this.tintedTexture&&(Phaser.CanvasPool.removeByCanvas(this.tintedTexture),this.tintedTexture=null)}},i.DisplayObject.prototype.displayObjectUpdateTransform=i.DisplayObject.prototype.updateTransform,Object.defineProperties(i.DisplayObject.prototype,{x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},worldVisible:{get:function(){if(this.visible){var t=this.parent;if(!t)return this.visible;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}return!1}},mask:{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,t&&(this._mask.isMask=!0)}},filters:{get:function(){return this._filters},set:function(t){if(Array.isArray(t)){for(var e=[],n=0;n=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},i.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);if(i<0||n<0)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[n]=t}},i.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},i.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},i.DisplayObjectContainer.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},i.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);if(-1!==e)return this.removeChildAt(e)},i.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(e.parent=void 0,this.children.splice(t,1)),e},i.DisplayObjectContainer.prototype.bringChildToTop=function(t){if(t.parent===this)return this.setChildIndex(t,this.children.length-1)},i.DisplayObjectContainer.prototype.sendChildToBack=function(t){if(t.parent===this)return this.setChildIndex(t,0)},i.DisplayObjectContainer.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i=e-t;if(i>0&&i<=e){for(var n=this.children.splice(t,i),s=0;s(a=o.width+o.x)?c:a,d=d>(h=o.height+o.y)?d:h)}var f=this._bounds;if(!p){var g=(f=new i.Rectangle).x,m=f.width+f.x,y=f.y,v=f.height+f.y,x=this.worldTransform,b=x.a,w=x.b,_=x.c,C=x.d,S=x.tx,T=x.ty,A=b*m+_*v+S,E=C*v+w*m+T,P=b*g+_*v+S,D=C*v+w*g+T,k=b*g+_*y+S,M=C*y+w*g+T,B=b*m+_*y+S,F=C*y+w*m+T;l=B<(l=k<(l=P<(l=A)?P:l)?k:l)?B:l,u=F<(u=M<(u=D<(u=E)?D:u)?M:u)?F:u,c=B>(c=k>(c=P>(c=A)?P:c)?k:c)?B:c,d=F>(d=M>(d=D>(d=E)?D:d)?M:d)?F:d}if(f.x=l,f.y=u,f.width=c-l,f.height=d-u,n)for(t.worldTransform=r,e=0;e(f=C>(f=w>(f=x>f?x:f)?w:f)?C:f)?T:f,g=A>(g=S>(g=_>(g=b>g?b:g)?_:g)?S:g)?A:g}var E=this._bounds;return E.x=m,E.width=f-m,E.y=y,E.height=g-y,this._currentBounds=E,E},i.Sprite.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=Phaser.identityMatrix;for(var e=0;e= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) { gl_FragColor = RED;return;}","}"];var s=i.compileProgram(t,this.vertexSrc||i.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(s),this.uSamplerArray=t.getUniformLocation(s,"uSamplerArray[0]"),this.projectionVector=t.getUniformLocation(s,"projectionVector"),this.offsetVector=t.getUniformLocation(s,"offsetVector"),this.dimensions=t.getUniformLocation(s,"dimensions"),this.aVertexPosition=t.getAttribLocation(s,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(s,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(s,"aColor"),this.aTextureIndex=t.getAttribLocation(s,"aTextureIndex");var r=[],o=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var a=0;a 0.0) gl_Position = vec4(0.0);"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);"," vTextureIndex = aTextureIndex;","}"],i.PixiFastShader=function(t){if(this._UID=Phaser._UID++,this.gl=t,this.program=null,i._enableMultiTextureToggle){t=this.gl;this.MAX_TEXTURES=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);for(var e="\tif (vTextureIndex == 0.0) { gl_FragColor = texture2D(uSamplerArray[0], vTextureCoord) * vColor;return;}\n",n=1;n= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["// PixiFastShader Fragment Shader.","precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;","}"];this.vertexSrc=["// PixiFastShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","attribute float aTextureIndex;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;"," vColor = aColor;","}"],this.textureCount=0,this.init()},i.PixiFastShader.prototype.constructor=i.PixiFastShader,i.PixiFastShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["//StripShader Fragment Shader.","precision mediump float;","varying vec2 vTextureCoord;","varying float vTextureIndex;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);","}"];this.vertexSrc=["//StripShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aTextureIndex;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying float vTextureIndex;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;","}"],this.init()},i.StripShader.prototype.constructor=i.StripShader,i.StripShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},n=this.gl,s=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),r=n.getParameter(n.MAX_TEXTURE_SIZE),o=this.game.cache._cache.image,a=null,h=0;h=this.size&&(this.flush(),this.currentBaseTexture=n.baseTexture);var a=n._uvs;if(a){var h,l,u,c,d=t.anchor.x,p=t.anchor.y;if(n.trim){var f=n.trim;h=(l=f.x-d*f.width)+n.crop.width,u=(c=f.y-p*f.height)+n.crop.height}else h=n.frame.width*(1-d),l=n.frame.width*-d,u=n.frame.height*(1-p),c=n.frame.height*-p;var g=this.currentBatchSize*this.vertexSize,m=n.baseTexture.resolution,y=n.baseTexture.textureIndex,v=o.a/m,x=o.b/m,b=o.c/m,w=o.d/m,_=o.tx,C=o.ty,S=n.crop.height;if(n.rotated){var T=o.a,A=o.b,E=o.c,P=o.d,D=l,k=h;_=o.c*S+_,C=o.d*S+C,v=6123233995736766e-32*T-E,x=6123233995736766e-32*A-P,b=T+6123233995736766e-32*E,w=A+6123233995736766e-32*P,n._updateUvsInverted(),h=u,l=c,u=k,c=D}var M=this.colors,B=this.positions,F=t.tint,I=(F>>16)+(65280&F)+((255&F)<<16)+(255*t.worldAlpha<<24);this.renderSession.roundPixels?(B[g++]=v*l+b*c+_|0,B[g++]=w*c+x*l+C|0,B[g++]=a.x0,B[g++]=a.y0,M[g++]=I,B[g++]=y,B[g++]=v*h+b*c+_|0,B[g++]=w*c+x*h+C|0,B[g++]=a.x1,B[g++]=a.y1,M[g++]=I,B[g++]=y,B[g++]=v*h+b*u+_|0,B[g++]=w*u+x*h+C|0,B[g++]=a.x2,B[g++]=a.y2,M[g++]=I,B[g++]=y,B[g++]=v*l+b*u+_|0,B[g++]=w*u+x*l+C|0,B[g++]=a.x3,B[g++]=a.y3,M[g++]=I,B[g++]=y):(B[g++]=v*l+b*c+_,B[g++]=w*c+x*l+C,B[g++]=a.x0,B[g++]=a.y0,M[g++]=I,B[g++]=y,B[g++]=v*h+b*c+_,B[g++]=w*c+x*h+C,B[g++]=a.x1,B[g++]=a.y1,M[g++]=I,B[g++]=y,B[g++]=v*h+b*u+_,B[g++]=w*u+x*h+C,B[g++]=a.x2,B[g++]=a.y2,M[g++]=I,B[g++]=y,B[g++]=v*l+b*u+_,B[g++]=w*u+x*l+C,B[g++]=a.x3,B[g++]=a.y3,M[g++]=I,B[g++]=y),this.sprites[this.currentBatchSize++]=t}},i.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var e=t.tilingTexture,n=e.baseTexture,s=this.gl,r=t.texture.baseTexture.textureIndex;i.WebGLRenderer.textureArray[r]!=n&&(this.flush(),s.activeTexture(s.TEXTURE0+r),s.bindTexture(s.TEXTURE_2D,n._glTextures[s.id]),i.WebGLRenderer.textureArray[r]=n),this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture),t._uvs||(t._uvs=new i.TextureUvs);var o=t._uvs,a=e.baseTexture.width,h=e.baseTexture.height;t.tilePosition.x%=a*t.tileScaleOffset.x,t.tilePosition.y%=h*t.tileScaleOffset.y;var l=t.tilePosition.x/(a*t.tileScaleOffset.x),u=t.tilePosition.y/(h*t.tileScaleOffset.y),c=t.width/a/(t.tileScale.x*t.tileScaleOffset.x),d=t.height/h/(t.tileScale.y*t.tileScaleOffset.y);o.x0=0-l,o.y0=0-u,o.x1=1*c-l,o.y1=0-u,o.x2=1*c-l,o.y2=1*d-u,o.x3=0-l,o.y3=1*d-u;var p=t.tint,f=(p>>16)+(65280&p)+((255&p)<<16)+(255*t.worldAlpha<<24),g=this.positions,m=this.colors,y=t.width,v=t.height,x=t.anchor.x,b=t.anchor.y,w=y*(1-x),_=y*-x,C=v*(1-b),S=v*-b,T=this.currentBatchSize*this.vertexSize,A=e.baseTexture.resolution,E=t.worldTransform,P=E.a/A,D=E.b/A,k=E.c/A,M=E.d/A,B=E.tx,F=E.ty;g[T++]=P*_+k*S+B,g[T++]=M*S+D*_+F,g[T++]=o.x0,g[T++]=o.y0,m[T++]=f,g[T++]=r,g[T++]=P*w+k*S+B,g[T++]=M*S+D*w+F,g[T++]=o.x1,g[T++]=o.y1,m[T++]=f,g[T++]=r,g[T++]=P*w+k*C+B,g[T++]=M*C+D*w+F,g[T++]=o.x2,g[T++]=o.y2,m[T++]=f,g[T++]=r,g[T++]=P*_+k*C+B,g[T++]=M*C+D*_+F,g[T++]=o.x3,g[T++]=o.y3,m[T++]=f,g[T++]=r,this.sprites[this.currentBatchSize++]=t},i.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e,n,s,r=this.gl;if(this.dirty){this.dirty=!1,t=this.defaultShader.shaders[r.id],r.activeTexture(r.TEXTURE0),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var o=this.vertexSize;r.vertexAttribPointer(t.aVertexPosition,2,r.FLOAT,!1,o,0),r.vertexAttribPointer(t.aTextureCoord,2,r.FLOAT,!1,o,8),r.vertexAttribPointer(t.colorAttribute,4,r.UNSIGNED_BYTE,!0,o,16),r.vertexAttribPointer(t.aTextureIndex,1,r.FLOAT,!1,o,20)}if(this.currentBatchSize>.5*this.size)r.bufferSubData(r.ARRAY_BUFFER,0,this.vertices);else{r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer);var a=this.positions.subarray(0,this.currentBatchSize*this.vertexSize);r.bufferSubData(r.ARRAY_BUFFER,0,a)}for(var h,l=0,u=0,c=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,y=this.currentBatchSize;m0&&(v=!1),(f||g)&&(this.renderBatch(c,l,u),u=m,l=0,c=e,f&&(d=n,this.renderSession.blendModeManager.setBlendMode(d)),g)){(t=(p=s).shaders[r.id])||((t=new i.PixiShader(r)).fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[r.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var x=this.renderSession.projection;r.uniform2f(t.projectionVector,x.x,x.y);var b=this.renderSession.offset;r.uniform2f(t.offsetVector,b.x,b.y)}l++}this.renderBatch(c,l,u),this.currentBatchSize=0}},i.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var n=this.gl;if(t._dirty[n.id]){if(!this.renderSession.renderer.updateTexture(t))return}else n.bindTexture(n.TEXTURE_2D,t._glTextures[n.id]);n.drawElements(n.TRIANGLES,6*e,n.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},i.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},i.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},i.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},i.WebGLFastSpriteBatch=function(t){this.vertSize=11,this.maxSize=6e3,this.size=this.maxSize;var e=4*this.size*this.vertSize,i=6*this.maxSize;this.vertices=new Float32Array(e),this.indices=new Uint16Array(i),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,s=0;n=this.size&&this.flush()}},i.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]){if(this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}else this.renderSession.renderer.updateTexture(this.currentBaseTexture,t)}},i.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},i.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36),t.vertexAttribPointer(this.shader.aTextureIndex,1,t.FLOAT,!1,i,40)},i.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},i.WebGLFilterManager.prototype.constructor=i.WebGLFilterManager,i.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},i.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},i.WebGLFilterManager.prototype.pushFilter=function(t){var e=this.gl,n=this.renderSession.projection,s=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),t._previous_stencil_mgr=this.renderSession.stencilManager,this.renderSession.stencilManager=new i.WebGLStencilManager,this.renderSession.stencilManager.setContext(e),e.disable(e.STENCIL_TEST),this.filterStack.push(t);var r=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var o=this.texturePool.pop();o?o.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution):o=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),e.bindTexture(e.TEXTURE_2D,o.texture);var a=t._filterArea,h=r.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),e.bindFramebuffer(e.FRAMEBUFFER,o.frameBuffer),e.viewport(0,0,a.width*this.renderSession.resolution,a.height*this.renderSession.resolution),n.x=a.width/2,n.y=-a.height/2,s.x=-a.x,s.y=-a.y,e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t._glFilterTexture=o},i.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,e=this.filterStack.pop(),n=e._filterArea,s=e._glFilterTexture,r=this.renderSession.projection,o=this.renderSession.offset;if(e.filterPasses.length>1){t.viewport(0,0,n.width*this.renderSession.resolution,n.height*this.renderSession.resolution),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=n.height,this.vertexArray[2]=n.width,this.vertexArray[3]=n.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=n.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=n.width/this.width,this.uvArray[5]=n.height/this.height,this.uvArray[6]=n.width/this.width,this.uvArray[7]=n.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=s,h=this.texturePool.pop();h||(h=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution)),h.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l0?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.applyFilterPass(d,n,p,f),this.texturePool.push(s),e._glFilterTexture=null},i.WebGLFilterManager.prototype.applyFilterPass=function(t,e,n,s){var r=this.gl,o=t.shaders[r.id];o||((o=new i.PixiShader(r)).fragmentSrc=t.fragmentSrc,o.uniforms=t.uniforms,o.init(!0),t.shaders[r.id]=o),this.renderSession.shaderManager.setShader(o),r.uniform2f(o.projectionVector,n/2,-s/2),r.uniform2f(o.offsetVector,0,0),t.uniforms.dimensions&&(t.uniforms.dimensions.value[0]=this.width,t.uniforms.dimensions.value[1]=this.height,t.uniforms.dimensions.value[2]=this.vertexArray[0],t.uniforms.dimensions.value[3]=this.vertexArray[5]),o.syncUniforms(),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.vertexAttribPointer(o.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.vertexAttribPointer(o.aTextureCoord,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.colorBuffer),r.vertexAttribPointer(o.colorAttribute,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),this.renderSession.drawCount++},i.WebGLFilterManager.prototype.initShaderBuffers=function(){var t=this.gl;this.vertexBuffer=t.createBuffer(),this.uvBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.vertexArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW),this.uvArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),t.bufferData(t.ARRAY_BUFFER,this.uvArray,t.STATIC_DRAW),this.colorArray=new Float32Array([1,16777215,1,16777215,1,16777215,1,16777215]),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,1,3,2]),t.STATIC_DRAW)},i.WebGLFilterManager.prototype.destroy=function(){var t=this.gl;this.filterStack=null,this.offsetX=0,this.offsetY=0;for(var e=0;e=0;t--){var e=this._glTextures[t],n=i.glContexts[t];n&&e&&n.deleteTexture(e)}this._glTextures.length=0,this.dirty()},i.BaseTexture.fromCanvas=function(t,e,n){return 0===t.width&&(t.width=1),0===t.height&&(t.height=1),n=n||1,new i.BaseTexture(t,e,n)},i.TextureSilentFail=!1,i.Texture=function(t,e,n,s){this.noFrame=!1,e||(this.noFrame=!0,e=new i.Rectangle(0,0,1,1)),t instanceof i.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=e,this.trim=s,this.valid=!1,this.isTiling=!1,this.requiresUpdate=!1,this.requiresReTint=!1,this._uvs=null,this.width=0,this.height=0,this.crop=n||new i.Rectangle(0,0,1,1),this.rotated=!1,t.hasLoaded&&(this.noFrame&&(e=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(e))},i.Texture.prototype.constructor=i.Texture,i.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;this.noFrame&&(this.frame=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame)},i.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},i.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,this.trim||!(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs();else{if(!i.TextureSilentFail)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=!1}},i.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.width)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.width)/e,this._uvs.y2=(t.y+t.height)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.height)/n},i.Texture.prototype._updateUvsInverted=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.height)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.height)/e,this._uvs.y2=(t.y+t.width)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.width)/n},i.Texture.fromCanvas=function(t,e){var n=i.BaseTexture.fromCanvas(t,e);return new i.Texture(n)},i.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},t.exports&&(e=t.exports=i),e.PIXI=i,i}).call(this)},function(t,e,i){var n=i(31),s=i(11);void 0===s.p2&&(s.p2=n),t.exports=n},function(t,e,i){t.exports=function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=i[o]={exports:{}};e[o][0].call(h.exports,(function(t){var i=e[o][1][t];return s(i||t)}),h,h.exports,t,e,i,n)}return i[o].exports}for(var r=!1,o=0;o=0&&h<=1&&l>=0&&l<=1}},{"./Scalar":4}],2:[function(t,e,i){function n(){}e.exports=n,n.area=function(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])},n.left=function(t,e,i){return n.area(t,e,i)>0},n.leftOn=function(t,e,i){return n.area(t,e,i)>=0},n.right=function(t,e,i){return n.area(t,e,i)<0},n.rightOn=function(t,e,i){return n.area(t,e,i)<=0};var s=[],r=[];n.collinear=function(t,e,i,o){if(o){var a=s,h=r;a[0]=e[0]-t[0],a[1]=e[1]-t[1],h[0]=i[0]-e[0],h[1]=i[1]-e[1];var l=a[0]*h[0]+a[1]*h[1],u=Math.sqrt(a[0]*a[0]+a[1]*a[1]),c=Math.sqrt(h[0]*h[0]+h[1]*h[1]);return Math.acos(l/(u*c))t.vertices.length)throw new Error("lol2");if(e<0)throw new Error("lol3");for(var n=e;ne[t][0])&&(t=i);s.left(this.at(t-1),this.at(t),this.at(t+1))||this.reverse()},o.prototype.reverse=function(){for(var t=[],e=0,i=this.vertices.length;e!==i;e++)t.push(this.vertices.pop());this.vertices=t},o.prototype.isReflex=function(t){return s.right(this.at(t-1),this.at(t),this.at(t+1))};var a=[],h=[];function l(t,e,i,n,s){s=s||0;var o=e[1]-t[1],a=t[0]-e[0],h=o*t[0]+a*t[1],l=n[1]-i[1],u=i[0]-n[0],c=l*i[0]+u*i[1],d=o*u-l*a;return r.eq(d,0,s)?[0,0]:[(u*h-a*c)/d,(o*c-l*h)/d]}o.prototype.canSee=function(t,e){var i,r,o=a,l=h;if(s.leftOn(this.at(t+1),this.at(t),this.at(e))&&s.rightOn(this.at(t-1),this.at(t),this.at(e)))return!1;r=s.sqdist(this.at(t),this.at(e));for(var u=0;u!==this.vertices.length;++u)if((u+1)%this.vertices.length!==t&&u!==t&&s.leftOn(this.at(t),this.at(e),this.at(u+1))&&s.rightOn(this.at(t),this.at(e),this.at(u))&&(o[0]=this.at(t),o[1]=this.at(e),l[0]=this.at(u),l[1]=this.at(u+1),i=n.lineInt(o,l),s.sqdist(this.at(t),i)0?this.slice(t):[this]},o.prototype.slice=function(t){if(0==t.length)return[this];if(t instanceof Array&&t.length&&t[0]instanceof Array&&2==t[0].length&&t[0][0]instanceof Array){for(var e=[this],i=0;ir)return console.warn("quickDecomp: max level ("+r+") reached."),t;for(var _=0;_m&&(m+=this.vertices.length),g=Number.MAX_VALUE,m3&&i>=0;--i)s.collinear(this.at(i-1),this.at(i),this.at(i+1),t)&&(this.vertices.splice(i%this.vertices.length,1),i--,e++);return e}},{"./Line":1,"./Point":2,"./Scalar":4}],4:[function(t,e,i){function n(){}e.exports=n,n.eq=function(t,e,i){return i=i||0,Math.abs(t-e) (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{grunt:"^0.4.5","grunt-contrib-jshint":"^0.11.2","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"~0.4.0","grunt-contrib-watch":"~0.5.0","grunt-browserify":"~2.0.1","grunt-contrib-concat":"^0.4.0"},dependencies:{"poly-decomp":"0.1.1"}}},{}],7:[function(t,e,i){var n=t("../math/vec2");function s(t){this.lowerBound=n.create(),t&&t.lowerBound&&n.copy(this.lowerBound,t.lowerBound),this.upperBound=n.create(),t&&t.upperBound&&n.copy(this.upperBound,t.upperBound)}t("../utils/Utils"),e.exports=s;var r=n.create();s.prototype.setFromPoints=function(t,e,i,s){var o=this.lowerBound,a=this.upperBound;"number"!=typeof i&&(i=0),0!==i?n.rotate(o,t[0],i):n.copy(o,t[0]),n.copy(a,o);for(var h=Math.cos(i),l=Math.sin(i),u=1;ua[f]&&(a[f]=c[f]),c[f]i&&(this.lowerBound[e]=i);var n=t.upperBound[e];this.upperBound[e]h?-1:a}},{"../math/vec2":30,"../utils/Utils":57}],8:[function(t,e,i){var n=t("../math/vec2"),s=t("../objects/Body");function r(t){this.type=t,this.result=[],this.world=null,this.boundingVolumeType=r.AABB}e.exports=r,r.AABB=1,r.BOUNDING_CIRCLE=2,r.prototype.setWorld=function(t){this.world=t},r.prototype.getCollisionPairs=function(t){};var o=n.create();r.boundingRadiusCheck=function(t,e){n.sub(o,t.position,e.position);var i=n.squaredLength(o),s=t.boundingRadius+e.boundingRadius;return i<=s*s},r.aabbCheck=function(t,e){return t.getAABB().overlaps(e.getAABB())},r.prototype.boundingVolumeCheck=function(t,e){var i;switch(this.boundingVolumeType){case r.BOUNDING_CIRCLE:i=r.boundingRadiusCheck(t,e);break;case r.AABB:i=r.aabbCheck(t,e);break;default:throw new Error("Bounding volume type not recognized: "+this.boundingVolumeType)}return i},r.canCollide=function(t,e){var i=s.KINEMATIC,n=s.STATIC;return!(t.type===n&&e.type===n||t.type===i&&e.type===n||t.type===n&&e.type===i||t.type===i&&e.type===i||t.sleepState===s.SLEEPING&&e.sleepState===s.SLEEPING||t.sleepState===s.SLEEPING&&e.type===n||e.sleepState===s.SLEEPING&&t.type===n)},r.NAIVE=1,r.SAP=2},{"../math/vec2":30,"../objects/Body":31}],9:[function(t,e,i){t("../shapes/Circle"),t("../shapes/Plane"),t("../shapes/Shape"),t("../shapes/Particle");var n=t("../collision/Broadphase");function s(){n.call(this,n.NAIVE)}t("../math/vec2"),e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.prototype.getCollisionPairs=function(t){var e=t.bodies,i=this.result;i.length=0;for(var s=0,r=e.length;s!==r;s++)for(var o=e[s],a=0;aq&&Y0)for(U=0;UMath.pow(g,2))return 0;if(c)return!0;var y=this.createContactEquation(t,a,e,h);return s(y.normalA,l,i),n.normalize(y.normalA,y.normalA),n.scale(y.contactPointA,y.normalA,d),n.scale(y.contactPointB,y.normalA,-p),r(y.contactPointA,y.contactPointA,i),s(y.contactPointA,y.contactPointA,t.position),r(y.contactPointB,y.contactPointB,l),s(y.contactPointB,y.contactPointB,a.position),this.contactEquations.push(y),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(y)),1},L.prototype[p.PLANE|p.CONVEX]=L.prototype[p.PLANE|p.BOX]=L.prototype.planeConvex=function(t,e,i,a,h,l,u,c,d){var p=m,f=y,x=v,b=0;n.rotate(f,g,a);for(var w=0;w!==l.vertices.length;w++){var _=l.vertices[w];if(n.rotate(p,_,c),r(p,p,u),s(x,p,i),o(x,f)<=0){if(d)return!0;b++;var C=this.createContactEquation(t,h,e,l);s(x,p,i),n.copy(C.normalA,f);var S=o(x,C.normalA);n.scale(x,C.normalA,S),s(C.contactPointB,p,h.position),s(C.contactPointA,p,x),s(C.contactPointA,C.contactPointA,t.position),this.contactEquations.push(C),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(C))}}return this.enableFrictionReduction&&this.enableFriction&&b&&this.frictionEquations.push(this.createFrictionFromAverage(b)),b},L.prototype[p.PARTICLE|p.PLANE]=L.prototype.particlePlane=function(t,e,i,r,a,h,l,u,c){var d=m,p=y;u=u||0,s(d,i,l),n.rotate(p,g,u);var f=o(d,p);if(f>0)return 0;if(c)return!0;var v=this.createContactEquation(a,t,h,e);return n.copy(v.normalA,p),n.scale(d,v.normalA,f),s(v.contactPointA,i,d),s(v.contactPointA,v.contactPointA,a.position),s(v.contactPointB,i,t.position),this.contactEquations.push(v),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(v)),1},L.prototype[p.CIRCLE|p.PARTICLE]=L.prototype.circleParticle=function(t,e,i,o,a,h,l,u,c){var d=m;if(s(d,l,i),n.squaredLength(d)>Math.pow(e.radius,2))return 0;if(c)return!0;var p=this.createContactEquation(t,a,e,h);return n.copy(p.normalA,d),n.normalize(p.normalA,p.normalA),n.scale(p.contactPointA,p.normalA,e.radius),r(p.contactPointA,p.contactPointA,i),s(p.contactPointA,p.contactPointA,t.position),s(p.contactPointB,l,a.position),this.contactEquations.push(p),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(p)),1};var K=new c({radius:1}),J=n.create(),Q=n.create();n.create(),L.prototype[p.PLANE|p.CAPSULE]=L.prototype.planeCapsule=function(t,e,i,s,o,a,h,l,u){var c,d=J,p=Q,f=K;n.set(d,-a.length/2,0),n.rotate(d,d,l),r(d,d,h),n.set(p,a.length/2,0),n.rotate(p,p,l),r(p,p,h),f.radius=a.radius,this.enableFrictionReduction&&(c=this.enableFriction,this.enableFriction=!1);var g=this.circlePlane(o,f,d,0,t,e,i,s,u),m=this.circlePlane(o,f,p,0,t,e,i,s,u);if(this.enableFrictionReduction&&(this.enableFriction=c),u)return g||m;var y=g+m;return this.enableFrictionReduction&&y&&this.frictionEquations.push(this.createFrictionFromAverage(y)),y},L.prototype[p.CIRCLE|p.PLANE]=L.prototype.circlePlane=function(t,e,i,a,h,l,u,c,d){var p=t,f=e,x=i,b=h,w=u,_=c;_=_||0;var C=m,S=y,T=v;s(C,x,w),n.rotate(S,g,_);var A=o(S,C);if(A>f.radius)return 0;if(d)return!0;var E=this.createContactEquation(b,p,l,e);return n.copy(E.normalA,S),n.scale(E.contactPointB,E.normalA,-f.radius),r(E.contactPointB,E.contactPointB,x),s(E.contactPointB,E.contactPointB,p.position),n.scale(T,E.normalA,A),s(E.contactPointA,C,T),r(E.contactPointA,E.contactPointA,w),s(E.contactPointA,E.contactPointA,b.position),this.contactEquations.push(E),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(E)),1},L.prototype[p.CONVEX]=L.prototype[p.CONVEX|p.BOX]=L.prototype[p.BOX]=L.prototype.convexConvex=function(t,e,i,a,h,l,u,c,d,p){var f=m,g=y,w=v,T=x,A=b,E=_,P=C,D=S,k=0;if(p="number"==typeof p?p:0,!L.findSeparatingAxis(e,i,a,l,u,c,f))return 0;s(P,u,i),o(f,P)>0&&n.scale(f,f,-1);var M=L.getClosestEdge(e,a,f,!0),B=L.getClosestEdge(l,c,f);if(-1===M||-1===B)return 0;for(var F=0;F<2;F++){var I,O=M,R=B,U=e,N=l,G=i,j=u,X=a,W=c,V=t,H=h;0===F&&(I=O,O=R,R=I,I=U,U=N,N=I,I=G,G=j,j=I,I=X,X=W,W=I,I=V,V=H,H=I);for(var z=R;z=3){if(d)return!0;var $=this.createContactEquation(V,H,U,N);k++,J=U.vertices[O%U.vertices.length],Q=U.vertices[(O+1)%U.vertices.length],n.rotate(w,J,X),n.rotate(T,Q,X),r(w,w,G),r(T,T,G),s(A,T,w),n.rotate90cw($.normalA,A),n.normalize($.normalA,$.normalA),s(P,g,w),Z=o($.normalA,P),n.scale(E,$.normalA,Z),s($.contactPointA,g,G),s($.contactPointA,$.contactPointA,E),r($.contactPointA,$.contactPointA,G),s($.contactPointA,$.contactPointA,V.position),s($.contactPointB,g,j),r($.contactPointB,$.contactPointB,j),s($.contactPointB,$.contactPointB,H.position),this.contactEquations.push($),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact($))}}}return this.enableFrictionReduction&&this.enableFriction&&k&&this.frictionEquations.push(this.createFrictionFromAverage(k)),k};var Z=n.fromValues(0,0);L.projectConvexOntoAxis=function(t,e,i,s,r){var a,h,l=null,u=null,c=Z;n.rotate(c,s,-i);for(var d=0;dl)&&(l=h),(null===u||hl){var p=u;u=l,l=p}var f=o(e,s);n.set(r,u+f,l+f)};var $=n.fromValues(0,0),tt=n.fromValues(0,0),et=n.fromValues(0,0),it=n.fromValues(0,0),nt=n.fromValues(0,0),st=n.fromValues(0,0);L.findSeparatingAxis=function(t,e,i,r,o,a,h){var l=null,u=!1,c=!1,d=$,p=tt,g=et,m=it,y=nt,v=st;if(t instanceof f&&r instanceof f)for(var x=0;2!==x;x++){var b=t,w=i;1===x&&(b=r,w=a);for(var _=0;2!==_;_++){0===_?n.set(m,0,1):1===_&&n.set(m,1,0),0!==w&&n.rotate(m,m,w),L.projectConvexOntoAxis(t,e,i,m,y),L.projectConvexOntoAxis(r,o,a,m,v);var C=y,S=v;y[0]>v[0]&&(S=y,C=v),u=(T=S[0]-C[1])<=0,(null===l||T>l)&&(n.copy(h,m),l=T,c=u)}}else for(x=0;2!==x;x++)for(b=t,w=i,1===x&&(b=r,w=a),_=0;_!==b.vertices.length;_++){var T;n.rotate(p,b.vertices[_],w),n.rotate(g,b.vertices[(_+1)%b.vertices.length],w),s(d,g,p),n.rotate90cw(m,d),n.normalize(m,m),L.projectConvexOntoAxis(t,e,i,m,y),L.projectConvexOntoAxis(r,o,a,m,v),C=y,S=v,y[0]>v[0]&&(S=y,C=v),u=(T=S[0]-C[1])<=0,(null===l||T>l)&&(n.copy(h,m),l=T,c=u)}return c};var rt=n.fromValues(0,0),ot=n.fromValues(0,0),at=n.fromValues(0,0);L.getClosestEdge=function(t,e,i,r){var a=rt,h=ot,l=at;n.rotate(a,i,-e),r&&n.scale(a,a,-1);for(var u=-1,c=t.vertices.length,d=-1,p=0;p!==c;p++){s(h,t.vertices[(p+1)%c],t.vertices[p%c]),n.rotate90cw(l,h),n.normalize(l,l);var f=o(l,a);(-1===u||f>d)&&(u=p%c,d=f)}return u};var ht=n.create(),lt=n.create(),ut=n.create(),ct=n.create(),dt=n.create(),pt=n.create(),ft=n.create();L.prototype[p.CIRCLE|p.HEIGHTFIELD]=L.prototype.circleHeightfield=function(t,e,i,o,a,h,l,u,c,d){var p=h.heights,f=(d=d||e.radius,h.elementWidth),g=lt,m=ht,y=dt,v=ft,x=pt,b=ut,w=ct,_=Math.floor((i[0]-d-l[0])/f),C=Math.ceil((i[0]+d-l[0])/f);_<0&&(_=0),C>=p.length&&(C=p.length-1);for(var S=p[_],T=p[C],A=_;AS&&(S=p[A]);if(i[1]-d>S)return!c&&0;var E=!1;for(A=_;A=b[0]&&m[0]0)for(A=_;A<=C;A++)if(n.set(b,A*f,p[A]),n.add(b,b,l),n.sub(g,i,b),n.squaredLength(g)=u.length&&(y=u.length-1);for(var v=u[m],x=u[y],b=m;bv&&(v=u[b]);if(t.aabb.lowerBound[1]>v)return!l&&0;var w=0;for(b=m;b=0||r.containsPoint(this.from))&&this.intersectBody(t,s)}};var r=n.create();s.prototype.intersectBody=function(t,e){var i=this.checkCollisionResponse;if(!i||e.collisionResponse)for(var s=r,o=0,a=e.shapes.length;oe.boundingRadius*e.boundingRadius||(this._currentBody=r,this._currentShape=e,e.raycast(t,this,s,i),this._currentBody=this._currentShape=null)},s.prototype.getAABB=function(t){var e=this.to,i=this.from;n.set(t.lowerBound,Math.min(e[0],i[0]),Math.min(e[1],i[1])),n.set(t.upperBound,Math.max(e[0],i[0]),Math.max(e[1],i[1]))},n.create(),s.prototype.reportIntersection=function(t,e,i,r){this.from,this.to;var o=this._currentShape,a=this._currentBody;if(!(this.skipBackfaces&&n.dot(i,this.direction)>0))switch(this.mode){case s.ALL:t.set(i,o,a,e,r),this.callback(t);break;case s.CLOSEST:(e=0&&!(t[r].aabb.lowerBound[e]<=s.aabb.lowerBound[e]);r--)t[r+1]=t[r];t[r+1]=s}return t},r.prototype.sortList=function(){var t=this.axisList,e=this.axisIndex;r.sortAxisList(t,e)},r.prototype.getCollisionPairs=function(t){var e=this.axisList,i=this.result,n=this.axisIndex;i.length=0;for(var r=e.length;r--;){var o=e[r];o.aabbNeedsUpdate&&o.updateAABB()}this.sortList();for(var a=0,h=0|e.length;a!==h;a++)for(var l=e[a],u=a+1;uthis.upperLimit&&(o.maxForce=0,o.minForce=-this.maxForce,this.distance=this.upperLimit,c=!0),this.lowerLimitEnabled&&this.positioni?(o.scale(s.normalA,l,-1),o.sub(s.contactPointA,u,a.position),o.sub(s.contactPointB,c,h.position),o.scale(f,l,i),o.add(s.contactPointA,s.contactPointA,f),-1===t.indexOf(s)&&t.push(s)):-1!==(v=t.indexOf(s))&&t.splice(v,1),this.lowerLimitEnabled&&xp?(g.angle=p,-1===r.indexOf(g)&&r.push(g)):-1!==(t=r.indexOf(g))&&r.splice(t,1),this.lowerLimitEnabled&&y>1;if(e<3)return[];for(var i=[],s=[],r=0;r3;){var a=s[(r+0)%o],h=s[(r+1)%o],l=s[(r+2)%o],u=t[2*a],c=t[2*a+1],d=t[2*h],p=t[2*h+1],f=t[2*l],g=t[2*l+1],m=!1;if(n._convex(u,c,d,p,f,g)){m=!0;for(var y=0;y3*o)break}return i.push(s[0],s[1],s[2]),i},_PointInTriangle:function(t,e,i,n,s,r,o,a){var h=o-i,l=a-n,u=s-i,c=r-n,d=t-i,p=e-n,f=h*h+l*l,g=h*u+l*c,m=h*d+l*p,y=u*u+c*c,v=u*d+c*p,x=1/(f*y-g*g),b=(y*m-g*v)*x,w=(f*v-g*m)*x;return b>=0&&w>=0&&b+w<1},_convex:function(t,e,i,n,s,r){return(e-n)*(s-i)+(i-t)*(r-n)>=0}};e.exports=n},{}],30:[function(t,e,i){var n=e.exports={},s=t("../utils/Utils");n.crossLength=function(t,e){return t[0]*e[1]-t[1]*e[0]},n.crossVZ=function(t,e,i){return n.rotate(t,e,-Math.PI/2),n.scale(t,t,i),t},n.crossZV=function(t,e,i){return n.rotate(t,i,Math.PI/2),n.scale(t,t,e),t},n.rotate=function(t,e,i){if(0!==i){var n=Math.cos(i),s=Math.sin(i),r=e[0],o=e[1];t[0]=n*r-s*o,t[1]=s*r+n*o}else t[0]=e[0],t[1]=e[1]},n.rotate90cw=function(t,e){var i=e[0],n=e[1];t[0]=n,t[1]=-i},n.toLocalFrame=function(t,e,i,s){n.copy(t,e),n.sub(t,t,i),n.rotate(t,t,-s)},n.toGlobalFrame=function(t,e,i,s){n.copy(t,e),n.rotate(t,t,s),n.add(t,t,i)},n.vectorToLocalFrame=function(t,e,i){n.rotate(t,e,-i)},n.vectorToGlobalFrame=function(t,e,i){n.rotate(t,e,i)},n.centroid=function(t,e,i,s){return n.add(t,e,i),n.add(t,t,s),n.scale(t,t,1/3),t},n.create=function(){var t=new s.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},n.clone=function(t){var e=new s.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},n.fromValues=function(t,e){var i=new s.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},n.set=function(t,e,i){return t[0]=e,t[1]=i,t},n.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},n.subtract=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},n.sub=n.subtract,n.multiply=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},n.mul=n.multiply,n.divide=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},n.div=n.divide,n.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},n.distance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(i*i+n*n)},n.dist=n.distance,n.squaredDistance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n},n.sqrDist=n.squaredDistance,n.length=function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},n.len=n.length,n.squaredLength=function(t){var e=t[0],i=t[1];return e*e+i*i},n.sqrLen=n.squaredLength,n.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},n.normalize=function(t,e){var i=e[0],n=e[1],s=i*i+n*n;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s),t},n.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},n.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},n.lerp=function(t,e,i,n){var s=e[0],r=e[1];return t[0]=s+n*(i[0]-s),t[1]=r+n*(i[1]-r),t},n.reflect=function(t,e,i){var n=e[0]*i[0]+e[1]*i[1];t[0]=e[0]-2*i[0]*n,t[1]=e[1]-2*i[1]*n},n.getLineSegmentsIntersection=function(t,e,i,s,r){var o=n.getLineSegmentsIntersectionFraction(e,i,s,r);return!(o<0||(t[0]=e[0]+o*(i[0]-e[0]),t[1]=e[1]+o*(i[1]-e[1]),0))},n.getLineSegmentsIntersectionFraction=function(t,e,i,n){var s,r,o=e[0]-t[0],a=e[1]-t[1],h=n[0]-i[0],l=n[1]-i[1];return s=(-a*(t[0]-i[0])+o*(t[1]-i[1]))/(-h*a+o*l),r=(h*(t[1]-i[1])-l*(t[0]-i[0]))/(-h*a+o*l),s>=0&&s<=1&&r>=0&&r<=1?r:-1}},{"../utils/Utils":57}],31:[function(t,e,i){var n=t("../math/vec2"),s=t("poly-decomp"),r=t("../shapes/Convex"),o=t("../collision/RaycastResult"),a=t("../collision/Ray"),h=t("../collision/AABB"),l=t("../events/EventEmitter");function u(t){t=t||{},l.call(this),this.id=t.id||++u._idCounter,this.world=null,this.shapes=[],this.mass=t.mass||0,this.invMass=0,this.inertia=0,this.invInertia=0,this.invMassSolve=0,this.invInertiaSolve=0,this.fixedRotation=!!t.fixedRotation,this.fixedX=!!t.fixedX,this.fixedY=!!t.fixedY,this.massMultiplier=n.create(),this.position=n.fromValues(0,0),t.position&&n.copy(this.position,t.position),this.interpolatedPosition=n.fromValues(0,0),this.interpolatedAngle=0,this.previousPosition=n.fromValues(0,0),this.previousAngle=0,this.velocity=n.fromValues(0,0),t.velocity&&n.copy(this.velocity,t.velocity),this.vlambda=n.fromValues(0,0),this.wlambda=0,this.angle=t.angle||0,this.angularVelocity=t.angularVelocity||0,this.force=n.create(),t.force&&n.copy(this.force,t.force),this.angularForce=t.angularForce||0,this.damping="number"==typeof t.damping?t.damping:.1,this.angularDamping="number"==typeof t.angularDamping?t.angularDamping:.1,this.type=u.STATIC,void 0!==t.type?this.type=t.type:t.mass?this.type=u.DYNAMIC:this.type=u.STATIC,this.boundingRadius=0,this.aabb=new h,this.aabbNeedsUpdate=!0,this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.wantsToSleep=!1,this.sleepState=u.AWAKE,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.2,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.gravityScale=void 0!==t.gravityScale?t.gravityScale:1,this.collisionResponse=void 0===t.collisionResponse||t.collisionResponse,this.idleTime=0,this.timeLastSleepy=0,this.ccdSpeedThreshold=void 0!==t.ccdSpeedThreshold?t.ccdSpeedThreshold:-1,this.ccdIterations=void 0!==t.ccdIterations?t.ccdIterations:10,this.concavePath=null,this._wakeUpAfterNarrowphase=!1,this.updateMassProperties()}e.exports=u,u.prototype=new l,u.prototype.constructor=u,u._idCounter=0,u.prototype.updateSolveMassProperties=function(){this.sleepState===u.SLEEPING||this.type===u.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve=0):(this.invMassSolve=this.invMass,this.invInertiaSolve=this.invInertia)},u.prototype.setDensity=function(t){var e=this.getArea();this.mass=e*t,this.updateMassProperties()},u.prototype.getArea=function(){for(var t=0,e=0;ei&&(i=o+a)}this.boundingRadius=i},u.prototype.addShape=function(t,e,i){if(t.body)throw new Error("A shape can only be added to one body.");t.body=this,e?n.copy(t.position,e):n.set(t.position,0,0),t.angle=i||0,this.shapes.push(t),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},u.prototype.removeShape=function(t){var e=this.shapes.indexOf(t);return-1!==e&&(this.shapes.splice(e,1),this.aabbNeedsUpdate=!0,t.body=null,!0)},u.prototype.updateMassProperties=function(){if(this.type===u.STATIC||this.type===u.KINEMATIC)this.mass=Number.MAX_VALUE,this.invMass=0,this.inertia=Number.MAX_VALUE,this.invInertia=0;else{var t=this.shapes,e=t.length,i=this.mass/e,s=0;if(this.fixedRotation)this.inertia=Number.MAX_VALUE,this.invInertia=0;else{for(var r=0;r0?1/s:0}this.invMass=1/this.mass,n.set(this.massMultiplier,this.fixedX?0:1,this.fixedY?0:1)}},n.create(),u.prototype.applyForce=function(t,e){if(n.add(this.force,this.force,t),e){var i=n.crossLength(e,t);this.angularForce+=i}};var p=n.create(),f=n.create(),g=n.create();u.prototype.applyForceLocal=function(t,e){e=e||g;var i=p,n=f;this.vectorToWorldFrame(i,t),this.vectorToWorldFrame(n,e),this.applyForce(i,n)};var m=n.create();u.prototype.applyImpulse=function(t,e){if(this.type===u.DYNAMIC){var i=m;if(n.scale(i,t,this.invMass),n.multiply(i,this.massMultiplier,i),n.add(this.velocity,i,this.velocity),e){var s=n.crossLength(e,t);s*=this.invInertia,this.angularVelocity+=s}}};var y=n.create(),v=n.create(),x=n.create();u.prototype.applyImpulseLocal=function(t,e){e=e||x;var i=y,n=v;this.vectorToWorldFrame(i,t),this.vectorToWorldFrame(n,e),this.applyImpulse(i,n)},u.prototype.toLocalFrame=function(t,e){n.toLocalFrame(t,e,this.position,this.angle)},u.prototype.toWorldFrame=function(t,e){n.toGlobalFrame(t,e,this.position,this.angle)},u.prototype.vectorToLocalFrame=function(t,e){n.vectorToLocalFrame(t,e,this.angle)},u.prototype.vectorToWorldFrame=function(t,e){n.vectorToGlobalFrame(t,e,this.angle)},u.prototype.fromPolygon=function(t,e){e=e||{};for(var i=this.shapes.length;i>=0;--i)this.removeShape(this.shapes[i]);var o,a=new s.Polygon;if(a.vertices=t,a.makeCCW(),"number"==typeof e.removeCollinearPoints&&a.removeCollinearPoints(e.removeCollinearPoints),void 0===e.skipSimpleCheck&&!a.isSimple())return!1;for(this.concavePath=a.vertices.slice(0),i=0;i=Math.pow(this.sleepSpeedLimit,2)?(this.idleTime=0,this.sleepState=u.AWAKE):(this.idleTime+=i,this.sleepState=u.SLEEPY),this.idleTime>this.sleepTimeLimit&&(e?this.wantsToSleep=!0:this.sleep()))},u.prototype.overlaps=function(t){return this.world.overlapKeeper.bodiesAreOverlapping(this,t)};var C=n.create(),S=n.create();u.prototype.integrate=function(t){var e=this.invMass,i=this.force,s=this.position,r=this.velocity;n.copy(this.previousPosition,this.position),this.previousAngle=this.angle,this.fixedRotation||(this.angularVelocity+=this.angularForce*this.invInertia*t),n.scale(C,i,t*e),n.multiply(C,this.massMultiplier,C),n.add(r,C,r),this.integrateToTimeOfImpact(t)||(n.scale(S,r,t),n.add(s,s,S),this.fixedRotation||(this.angle+=this.angularVelocity*t)),this.aabbNeedsUpdate=!0};var T=new o,A=new a({mode:a.ALL}),E=n.create(),P=n.create(),D=n.create(),k=n.create();u.prototype.integrateToTimeOfImpact=function(t){if(this.ccdSpeedThreshold<0||n.squaredLength(this.velocity)=l&&h=0&&(s.rotate(p,c,n),s.scale(p,p,2*y-1),e.reportIntersection(t,b,p,-1),t.shouldStop(e)))return}var x=Math.pow(this.radius,2)+Math.pow(m,2);for(y=0;y<2;y++){s.set(f,m*(2*y-1),0),s.toGlobalFrame(f,f,i,n);var b,w=Math.pow(o[0]-r[0],2)+Math.pow(o[1]-r[1],2),_=2*((o[0]-r[0])*(r[0]-f[0])+(o[1]-r[1])*(r[1]-f[1])),C=Math.pow(r[0]-f[0],2)+Math.pow(r[1]-f[1],2)-Math.pow(this.radius,2);if(!((b=Math.pow(_,2)-4*w*C)<0))if(0===b){if(s.lerp(d,r,o,b),s.squaredDistance(d,i)>x&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,b,p,-1),t.shouldStop(e)))return}else{var S=Math.sqrt(b),T=1/(2*w),A=(-_-S)*T,E=(-_+S)*T;if(A>=0&&A<=1&&(s.lerp(d,r,o,A),s.squaredDistance(d,i)>x&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,A,p,-1),t.shouldStop(e))))return;if(E>=0&&E<=1&&(s.lerp(d,r,o,E),s.squaredDistance(d,i)>x&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,E,p,-1),t.shouldStop(e))))return}}}},{"../math/vec2":30,"./Shape":45}],39:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){"number"==typeof arguments[0]&&(t={radius:arguments[0]},console.warn("The Circle constructor signature has changed. Please use the following format: new Circle({ radius: 1 })")),t=t||{},this.radius=t.radius||1,t.type=n.CIRCLE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){var e=this.radius;return t*e*e/2},r.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},r.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},r.prototype.computeAABB=function(t,e,i){var n=this.radius;s.set(t.upperBound,n,n),s.set(t.lowerBound,-n,-n),e&&(s.add(t.lowerBound,t.lowerBound,e),s.add(t.upperBound,t.upperBound,e))};var o=s.create(),a=s.create();r.prototype.raycast=function(t,e,i,n){var r=e.from,h=e.to,l=this.radius,u=Math.pow(h[0]-r[0],2)+Math.pow(h[1]-r[1],2),c=2*((h[0]-r[0])*(r[0]-i[0])+(h[1]-r[1])*(r[1]-i[1])),d=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2)-Math.pow(l,2),p=Math.pow(c,2)-4*u*d,f=o,g=a;if(!(p<0))if(0===p)s.lerp(f,r,h,p),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,p,g,-1);else{var m=Math.sqrt(p),y=1/(2*u),v=(-c-m)*y,x=(-c+m)*y;if(v>=0&&v<=1&&(s.lerp(f,r,h,v),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,v,g,-1),t.shouldStop(e)))return;x>=0&&x<=1&&(s.lerp(f,r,h,x),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,x,g,-1))}}},{"../math/vec2":30,"./Shape":45}],40:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2"),r=t("../math/polyk");function o(t){Array.isArray(arguments[0])&&(t={vertices:arguments[0],axes:arguments[1]},console.warn("The Convex constructor signature has changed. Please use the following format: new Convex({ vertices: [...], ... })")),t=t||{},this.vertices=[];for(var e=void 0!==t.vertices?t.vertices:[],i=0;ir)&&(r=n),(null===o||nr){var l=o;o=r,r=l}s.set(e,o,r)},o.prototype.projectOntoWorldAxis=function(t,e,i,n){var r=h;this.projectOntoLocalAxis(t,n),0!==i?s.rotate(r,t,i):r=t;var o=s.dot(e,r);s.set(n,n[0]+o,n[1]+o)},o.prototype.updateTriangles=function(){this.triangles.length=0;for(var t=[],e=0;ee&&(e=n)}this.boundingRadius=Math.sqrt(e)},o.triangleArea=function(t,e,i){return.5*((e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1]))},o.prototype.updateArea=function(){this.updateTriangles(),this.area=0;for(var t=this.triangles,e=this.vertices,i=0;i!==t.length;i++){var n=t[i],s=e[n[0]],r=e[n[1]],a=e[n[2]],h=o.triangleArea(s,r,a);this.area+=h}},o.prototype.computeAABB=function(t,e,i){t.setFromPoints(this.vertices,e,i,0)};var f=s.create(),g=s.create(),m=s.create();o.prototype.raycast=function(t,e,i,n){var r=f,o=g,a=m,h=this.vertices;s.toLocalFrame(r,e.from,i,n),s.toLocalFrame(o,e.to,i,n);for(var l=h.length,u=0;u=0&&(s.sub(a,d,c),s.rotate(a,a,-Math.PI/2+n),s.normalize(a,a),e.reportIntersection(t,p,a,u))}}},{"../math/polyk":29,"../math/vec2":30,"./Shape":45,"poly-decomp":5}],41:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){if(Array.isArray(arguments[0])){if(t={heights:arguments[0]},"object"==typeof arguments[1])for(var e in arguments[1])t[e]=arguments[1][e];console.warn("The Heightfield constructor signature has changed. Please use the following format: new Heightfield({ heights: [...], ... })")}t=t||{},this.heights=t.heights?t.heights.slice(0):[],this.maxValue=t.maxValue||null,this.minValue=t.minValue||null,this.elementWidth=t.elementWidth||.1,void 0!==t.maxValue&&void 0!==t.minValue||this.updateMaxMinValues(),t.type=n.HEIGHTFIELD,n.call(this,t)}t("../utils/Utils"),e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.updateMaxMinValues=function(){for(var t=this.heights,e=t[0],i=t[0],n=0;n!==t.length;n++){var s=t[n];s>e&&(e=s),sv){var x=y;y=v,v=x}for(var b=0;b=0&&(s.sub(d,f,p),s.rotate(d,d,n+Math.PI/2),s.normalize(d,d),e.reportIntersection(t,w,d,-1),t.shouldStop(e)))return}}},{"../math/vec2":30,"../utils/Utils":57,"./Shape":45}],42:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){"number"==typeof arguments[0]&&(t={length:arguments[0]},console.warn("The Line constructor signature has changed. Please use the following format: new Line({ length: 1, ... })")),t=t||{},this.length=t.length||1,t.type=n.LINE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return t*Math.pow(this.length,2)/12},r.prototype.updateBoundingRadius=function(){this.boundingRadius=this.length/2};var o=[s.create(),s.create()];r.prototype.computeAABB=function(t,e,i){var n=this.length/2;s.set(o[0],-n,0),s.set(o[1],n,0),t.setFromPoints(o,e,i,0)},s.create();var a=s.create(),h=s.create(),l=s.create(),u=s.fromValues(0,1);r.prototype.raycast=function(t,e,i,n){var r=e.from,o=e.to,c=h,d=l,p=this.length/2;s.set(c,-p,0),s.set(d,p,0),s.toGlobalFrame(c,c,i,n),s.toGlobalFrame(d,d,i,n);var f=s.getLineSegmentsIntersectionFraction(c,d,r,o);if(f>=0){var g=a;s.rotate(g,u,n),e.reportIntersection(t,f,g,-1)}}},{"../math/vec2":30,"./Shape":45}],43:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){(t=t||{}).type=n.PARTICLE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return 0},r.prototype.updateBoundingRadius=function(){this.boundingRadius=0},r.prototype.computeAABB=function(t,e,i){s.copy(t.lowerBound,e),s.copy(t.upperBound,e)}},{"../math/vec2":30,"./Shape":45}],44:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){(t=t||{}).type=n.PLANE,n.call(this,t)}t("../utils/Utils"),e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return 0},r.prototype.updateBoundingRadius=function(){this.boundingRadius=Number.MAX_VALUE},r.prototype.computeAABB=function(t,e,i){var n=i%(2*Math.PI),r=s.set,o=1e7,a=t.lowerBound,h=t.upperBound;r(a,-o,-o),r(h,o,o),0===n?h[1]=0:n===Math.PI/2?a[0]=0:n===Math.PI?a[1]=0:n===3*Math.PI/2&&(h[0]=0)},r.prototype.updateArea=function(){this.area=Number.MAX_VALUE};var o=s.create(),a=(s.create(),s.create(),s.create()),h=s.create();r.prototype.raycast=function(t,e,i,n){var r=e.from,l=e.to,u=e.direction,c=o,d=a,p=h;s.set(d,0,1),s.rotate(d,d,n),s.sub(p,r,i);var f=s.dot(p,d);if(s.sub(p,l,i),!(f*s.dot(p,d)>0||s.squaredDistance(r,l)p*a&&(g=p*a-c),r[t]+=g,e.addToWlambda(g),g}},{"../equations/FrictionEquation":23,"../math/vec2":30,"../utils/Utils":57,"./Solver":47}],47:[function(t,e,i){t("../utils/Utils");var n=t("../events/EventEmitter");function s(t,e){t=t||{},n.call(this),this.type=e,this.equations=[],this.equationSortFunction=t.equationSortFunction||!1}e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.prototype.solve=function(t,e){throw new Error("Solver.solve should be implemented by subclasses!")};var r={bodies:[]};s.prototype.solveIsland=function(t,e){this.removeAllEquations(),e.equations.length&&(this.addEquations(e.equations),r.bodies.length=0,e.getBodies(r.bodies),r.bodies.length&&this.solve(t,r))},s.prototype.sortEquations=function(){this.equationSortFunction&&this.equations.sort(this.equationSortFunction)},s.prototype.addEquation=function(t){t.enabled&&this.equations.push(t)},s.prototype.addEquations=function(t){for(var e=0,i=t.length;e!==i;e++){var n=t[e];n.enabled&&this.equations.push(n)}},s.prototype.removeEquation=function(t){var e=this.equations.indexOf(t);-1!==e&&this.equations.splice(e,1)},s.prototype.removeAllEquations=function(){this.equations.length=0},s.GS=1,s.ISLAND=2},{"../events/EventEmitter":26,"../utils/Utils":57}],48:[function(t,e,i){var n=t("../equations/ContactEquation"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=null,this}},{"../equations/ContactEquation":21,"./Pool":55}],49:[function(t,e,i){var n=t("../equations/FrictionEquation"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=null,this}},{"../equations/FrictionEquation":23,"./Pool":55}],50:[function(t,e,i){var n=t("../world/IslandNode"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.reset(),this}},{"../world/IslandNode":60,"./Pool":55}],51:[function(t,e,i){var n=t("../world/Island"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.reset(),this}},{"../world/Island":58,"./Pool":55}],52:[function(t,e,i){var n=t("./TupleDictionary"),s=(t("./OverlapKeeperRecord"),t("./OverlapKeeperRecordPool"));function r(){this.overlappingShapesLastState=new n,this.overlappingShapesCurrentState=new n,this.recordPool=new s({size:16}),this.tmpDict=new n,this.tmpArray1=[]}t("./Utils"),e.exports=r,r.prototype.tick=function(){for(var t=this.overlappingShapesLastState,e=this.overlappingShapesCurrentState,i=t.keys.length;i--;){var n=t.keys[i],s=t.getByKey(n);e.getByKey(n),s&&this.recordPool.release(s)}t.reset(),t.copy(e),e.reset()},r.prototype.setOverlapping=function(t,e,i,n){this.overlappingShapesLastState;var s=this.overlappingShapesCurrentState;if(!s.get(e.id,n.id)){var r=this.recordPool.get();r.set(t,e,i,n),s.set(e.id,n.id,r)}},r.prototype.getNewOverlaps=function(t){return this.getDiff(this.overlappingShapesLastState,this.overlappingShapesCurrentState,t)},r.prototype.getEndOverlaps=function(t){return this.getDiff(this.overlappingShapesCurrentState,this.overlappingShapesLastState,t)},r.prototype.bodiesAreOverlapping=function(t,e){for(var i=this.overlappingShapesCurrentState,n=i.keys.length;n--;){var s=i.keys[n],r=i.data[s];if(r.bodyA===t&&r.bodyB===e||r.bodyA===e&&r.bodyB===t)return!0}return!1},r.prototype.getDiff=function(t,e,i){var n=t,s=e;(i=i||[]).length=0;for(var r=s.keys.length;r--;){var o=s.keys[r],a=s.data[o];if(!a)throw new Error("Key "+o+" had no data!");n.data[o]||i.push(a)}return i},r.prototype.isNewOverlap=function(t,e){var i=0|t.id,n=0|e.id,s=this.overlappingShapesLastState,r=this.overlappingShapesCurrentState;return!s.get(i,n)&&!!r.get(i,n)},r.prototype.getNewBodyOverlaps=function(t){this.tmpArray1.length=0;var e=this.getNewOverlaps(this.tmpArray1);return this.getBodyDiff(e,t)},r.prototype.getEndBodyOverlaps=function(t){this.tmpArray1.length=0;var e=this.getEndOverlaps(this.tmpArray1);return this.getBodyDiff(e,t)},r.prototype.getBodyDiff=function(t,e){e=e||[];for(var i=this.tmpDict,n=t.length;n--;){var s=t[n];i.set(0|s.bodyA.id,0|s.bodyB.id,s)}for(n=i.keys.length;n--;)(s=i.getByKey(i.keys[n]))&&e.push(s.bodyA,s.bodyB);return i.reset(),e}},{"./OverlapKeeperRecord":53,"./OverlapKeeperRecordPool":54,"./TupleDictionary":56,"./Utils":57}],53:[function(t,e,i){function n(t,e,i,n){this.shapeA=e,this.shapeB=n,this.bodyA=t,this.bodyB=i}e.exports=n,n.prototype.set=function(t,e,i,s){n.call(this,t,e,i,s)}},{}],54:[function(t,e,i){var n=t("./OverlapKeeperRecord"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=t.shapeA=t.shapeB=null,this}},{"./OverlapKeeperRecord":53,"./Pool":55}],55:[function(t,e,i){function n(t){t=t||{},this.objects=[],void 0!==t.size&&this.resize(t.size)}e.exports=n,n.prototype.resize=function(t){for(var e=this.objects;e.length>t;)e.pop();for(;e.length(0|e)?t<<16|65535&e:e<<16|65535&t)},s.prototype.getByKey=function(t){return t|=0,this.data[t]},s.prototype.get=function(t,e){return this.data[this.getKey(t,e)]},s.prototype.set=function(t,e,i){if(!i)throw new Error("No data!");var n=this.getKey(t,e);return this.data[n]||this.keys.push(n),this.data[n]=i,n},s.prototype.reset=function(){for(var t=this.data,e=this.keys,i=e.length;i--;)delete t[e[i]];e.length=0},s.prototype.copy=function(t){this.reset(),n.appendArray(this.keys,t.keys);for(var e=t.keys.length;e--;){var i=t.keys[e];this.data[i]=t.data[i]}}},{"./Utils":57}],57:[function(t,e,i){function n(){}e.exports=n,n.appendArray=function(t,e){if(e.length<15e4)t.push.apply(t,e);else for(var i=0,n=e.length;i!==n;++i)t.push(e[i])},n.splice=function(t,e,i){i=i||1;for(var n=e,s=t.length-i;n=t&&n=0;m-=2)for(var T=_.length-2;T>=0;T-=2)(C[m]===_[T]&&C[m+1]===_[T+1]||C[m+1]===_[T]&&C[m]===_[T+1])&&_.splice(T,2);var A=u.length;for(m=0;m!==A;m++){var E=u[m];if(!E.collideConnected)for(T=_.length-2;T>=0;T-=2)(E.bodyA===_[T]&&E.bodyB===_[T+1]||E.bodyB===_[T]&&E.bodyA===_[T+1])&&_.splice(T,2)}this.postBroadphaseEvent.pairs=_,this.emit(this.postBroadphaseEvent),this.postBroadphaseEvent.pairs=null,l.reset(this),m=0;for(var P=_.length;m!==P;m+=2)for(var D=_[m],k=_[m+1],M=0,B=D.shapes.length;M!==B;M++)for(var F=D.shapes[M],I=F.position,L=F.angle,O=0,R=k.shapes.length;O!==R;O++){var U=k.shapes[O],N=U.position,G=U.angle,j=this.defaultContactMaterial;if(F.material&&U.material){var X=this.getContactMaterial(F.material,U.material);X&&(j=X)}this.runNarrowphase(l,D,F,I,L,k,U,N,G,j,this.frictionGravity)}for(m=0;m!==a;m++)(z=n[m])._wakeUpAfterNarrowphase&&(z.wakeUp(),z._wakeUpAfterNarrowphase=!1);if(this.has("endContact")){this.overlapKeeper.getEndOverlaps(S);var W=this.endContactEvent;for(O=S.length;O--;){var V=S[O];W.shapeA=V.shapeA,W.shapeB=V.shapeB,W.bodyA=V.bodyA,W.bodyB=V.bodyB,this.emit(W)}S.length=0}var H=this.preSolveEvent;for(H.contactEquations=l.contactEquations,H.frictionEquations=l.frictionEquations,this.emit(H),H.contactEquations=H.frictionEquations=null,A=u.length,m=0;m!==A;m++)u[m].update();if(l.contactEquations.length||l.frictionEquations.length||A)if(this.islandSplit){for(f.equations.length=0,y.appendArray(f.equations,l.contactEquations),y.appendArray(f.equations,l.frictionEquations),m=0;m!==A;m++)y.appendArray(f.equations,u[m].equations);for(f.split(this),m=0;m!==f.islands.length;m++)(K=f.islands[m]).equations.length&&o.solveIsland(t,K)}else{for(o.addEquations(l.contactEquations),o.addEquations(l.frictionEquations),m=0;m!==A;m++)o.addEquations(u[m].equations);this.solveConstraints&&o.solve(t,this),o.removeAllEquations()}for(m=0;m!==a;m++){var z;(z=n[m]).integrate(t)}for(m=0;m!==a;m++)n[m].setZeroForce();if(this.emitImpactEvent&&this.has("impact")){var Y=this.impactEvent;for(m=0;m!==l.contactEquations.length;m++){var q=l.contactEquations[m];q.firstImpact&&(Y.bodyA=q.bodyA,Y.bodyB=q.bodyB,Y.shapeA=q.shapeA,Y.shapeB=q.shapeB,Y.contactEquation=q,this.emit(Y))}}if(this.sleepMode===b.BODY_SLEEPING)for(m=0;m!==a;m++)n[m].sleepTick(this.time,!1,t);else if(this.sleepMode===b.ISLAND_SLEEPING&&this.islandSplit){for(m=0;m!==a;m++)n[m].sleepTick(this.time,!0,t);for(m=0;m0,t.frictionCoefficient=u.friction,p=e.type===c.STATIC||e.type===c.KINEMATIC?o.mass:o.type===c.STATIC||o.type===c.KINEMATIC?e.mass:e.mass*o.mass/(e.mass+o.mass),t.slipForce=u.friction*d*p,t.restitution=u.restitution,t.surfaceVelocity=u.surfaceVelocity,t.frictionStiffness=u.frictionStiffness,t.frictionRelaxation=u.frictionRelaxation,t.stiffness=u.stiffness,t.relaxation=u.relaxation,t.contactSkinSize=u.contactSkinSize,t.enabledEquations=e.collisionResponse&&o.collisionResponse&&i.collisionResponse&&a.collisionResponse;var m=t[i.type|a.type],y=0;if(m){var v=i.sensor||a.sensor,x=t.frictionEquations.length;y=i.type=2*Math.pow(o.sleepSpeedLimit,2)&&(e._wakeUpAfterNarrowphase=!0),o.allowSleep&&o.type===c.DYNAMIC&&o.sleepState===c.SLEEPING&&e.sleepState===c.AWAKE&&e.type!==c.STATIC&&s.squaredLength(e.velocity)+Math.pow(e.angularVelocity,2)>=2*Math.pow(e.sleepSpeedLimit,2)&&(o._wakeUpAfterNarrowphase=!0),this.overlapKeeper.setOverlapping(e,i,o,a),this.has("beginContact")&&this.overlapKeeper.isNewOverlap(i,a)){var w=this.beginContactEvent;if(w.shapeA=i,w.shapeB=a,w.bodyA=e,w.bodyB=o,w.contactEquations.length=0,"number"==typeof y)for(var S=t.contactEquations.length-y;S1)for(S=t.frictionEquations.length-b;S=0;e--)this.removeConstraint(t[e]);var i=this.bodies;for(e=i.length-1;e>=0;e--)this.removeBody(i[e]);var n=this.springs;for(e=n.length-1;e>=0;e--)this.removeSpring(n[e]);var s=this.contactMaterials;for(e=s.length-1;e>=0;e--)this.removeContactMaterial(s[e]);b.apply(this)};var T=s.create(),A=(s.fromValues(0,0),s.fromValues(0,0));b.prototype.hitTest=function(t,e,i){i=i||0;var n=new c({position:t}),u=new l,d=t,p=T,f=A;n.addShape(u);for(var g=this.narrowphase,m=[],y=0,v=e.length;y!==v;y++)for(var x=e[y],b=0,w=x.shapes.length;b!==w;b++){var _=x.shapes[b];s.rotate(p,_.position,x.angle),s.add(p,p,x.position);var C=_.angle+x.angle;(_ instanceof r&&g.circleParticle(x,_,p,C,n,u,d,0,!0)||_ instanceof o&&g.particleConvex(n,u,d,0,x,_,p,C,!0)||_ instanceof a&&g.particlePlane(n,u,d,0,x,_,p,C,!0)||_ instanceof h&&g.particleCapsule(n,u,d,0,x,_,p,C,!0)||_ instanceof l&&s.squaredLength(s.sub(f,p,t)){var __webpack_modules__={2288:(t,e,i)=>{var n=i(4674),s=i(7672);void 0===s.PIXI&&(s.PIXI=n),t.exports=n},9747:(t,e,i)=>{var n=i(6405),s=i(7672);void 0===s.Phaser&&(s.Phaser=n),t.exports=n},8279:(t,e,i)=>{var n=i(4969),s=i(7672);void 0===s.p2&&(s.p2=n),t.exports=n},7672:(t,e,i)=>{"use strict";t.exports=function(){if("object"==typeof globalThis)return globalThis;var t;try{t=this||new Function("return this")()}catch(t){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==i.g)return i.g}return t}()},7347:t=>{!function(){function e(t,e){document.addEventListener?t.addEventListener("scroll",e,!1):t.attachEvent("scroll",e)}function i(t){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(t)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function n(t,e){t.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+e+";"}function s(t){var e=t.a.offsetWidth,i=e+100;return t.f.style.width=i+"px",t.c.scrollLeft=i,t.b.scrollLeft=t.b.scrollWidth+100,t.g!==e&&(t.g=e,!0)}function r(t,i){function n(){var t=r;s(t)&&t.a.parentNode&&i(t.g)}var r=t;e(t.b,n),e(t.c,n),s(t)}function o(t,e){var i=e||{};this.family=t,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal"}var a=null,h=null,l=null,c=null;function u(){return null===c&&(c=!!document.fonts),c}function d(){if(null===l){var t=document.createElement("div");try{t.style.font="condensed 100px sans-serif"}catch(t){}l=""!==t.style.font}return l}function p(t,e){return[t.style,t.weight,d()?t.stretch:"","100px",e].join(" ")}o.prototype.load=function(t,e){var s=this,o=t||"BESbswy",l=0,c=e||3e3,d=(new Date).getTime();return new Promise((function(t,e){if(u()&&!function(){if(null===h)if(u()&&/Apple/.test(window.navigator.vendor)){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent);h=!!t&&603>parseInt(t[1],10)}else h=!1;return h}()){var f=new Promise((function(t,e){!function i(){(new Date).getTime()-d>=c?e(Error(c+"ms timeout exceeded")):document.fonts.load(p(s,'"'+s.family+'"'),o).then((function(e){1<=e.length?t():setTimeout(i,25)}),e)}()})),g=new Promise((function(t,e){l=setTimeout((function(){e(Error(c+"ms timeout exceeded"))}),c)}));Promise.race([g,f]).then((function(){clearTimeout(l),t(s)}),e)}else!function(t){document.body?t():document.addEventListener?document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e),t()})):document.attachEvent("onreadystatechange",(function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),t())}))}((function(){function h(){var e;(e=-1!=m&&-1!=y||-1!=m&&-1!=v||-1!=y&&-1!=v)&&((e=m!=y&&m!=v&&y!=v)||(null===a&&(e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),a=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))),e=a&&(m==b&&y==b&&v==b||m==x&&y==x&&v==x||m==w&&y==w&&v==w)),e=!e),e&&(_.parentNode&&_.parentNode.removeChild(_),clearTimeout(l),t(s))}var u=new i(o),f=new i(o),g=new i(o),m=-1,y=-1,v=-1,b=-1,x=-1,w=-1,_=document.createElement("div");_.dir="ltr",n(u,p(s,"sans-serif")),n(f,p(s,"serif")),n(g,p(s,"monospace")),_.appendChild(u.a),_.appendChild(f.a),_.appendChild(g.a),document.body.appendChild(_),b=u.a.offsetWidth,x=f.a.offsetWidth,w=g.a.offsetWidth,function t(){if((new Date).getTime()-d>=c)_.parentNode&&_.parentNode.removeChild(_),e(Error(c+"ms timeout exceeded"));else{var i=document.hidden;!0!==i&&void 0!==i||(m=u.a.offsetWidth,y=f.a.offsetWidth,v=g.a.offsetWidth,h()),l=setTimeout(t,50)}}(),r(u,(function(t){m=t,h()})),n(u,p(s,'"'+s.family+'",sans-serif')),r(f,(function(t){y=t,h()})),n(f,p(s,'"'+s.family+'",serif')),r(g,(function(t){v=t,h()})),n(g,p(s,'"'+s.family+'",monospace'))}))}))},t.exports=o}()},3320:(t,e,i)=>{"use strict";var n=i(7990),s=i(3150);function r(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}t.exports.Type=i(1364),t.exports.Schema=i(7657),t.exports.FAILSAFE_SCHEMA=i(4795),t.exports.JSON_SCHEMA=i(5966),t.exports.CORE_SCHEMA=i(9471),t.exports.DEFAULT_SCHEMA=i(6601),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.dump=s.dump,t.exports.YAMLException=i(8425),t.exports.types={binary:i(3531),float:i(5215),map:i(945),null:i(151),pairs:i(6879),set:i(4982),timestamp:i(2156),bool:i(8771),int:i(1518),merge:i(7452),omap:i(1605),seq:i(6451),str:i(48)},t.exports.safeLoad=r("safeLoad","load"),t.exports.safeLoadAll=r("safeLoadAll","loadAll"),t.exports.safeDump=r("safeDump","dump")},8347:t=>{"use strict";function e(t){return null==t}t.exports.isNothing=e,t.exports.isObject=function(t){return"object"==typeof t&&null!==t},t.exports.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},t.exports.repeat=function(t,e){var i,n="";for(i=0;i{"use strict";var n=i(8347),s=i(8425),r=i(6601),o=Object.prototype.toString,a=Object.prototype.hasOwnProperty,h=65279,l={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},c=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],u=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function d(t){var e,i,r;if(e=t.toString(16).toUpperCase(),t<=255)i="x",r=2;else if(t<=65535)i="u",r=4;else{if(!(t<=4294967295))throw new s("code point within a string may not be greater than 0xFFFFFFFF");i="U",r=8}return"\\"+i+n.repeat("0",r-e.length)+e}function p(t){this.schema=t.schema||r,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=n.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=function(t,e){var i,n,s,r,o,h,l;if(null===e)return{};for(i={},s=0,r=(n=Object.keys(e)).length;s=55296&&n<=56319&&e+1=56320&&i<=57343?1024*(n-55296)+i-56320+65536:n}function w(t){return/^\n* /.test(t)}function _(t,e,i,n,s,r,o,a){var l,c,u=0,d=null,p=!1,f=!1,g=-1!==n,v=-1,_=y(c=x(t,0))&&c!==h&&!m(c)&&45!==c&&63!==c&&58!==c&&44!==c&&91!==c&&93!==c&&123!==c&&125!==c&&35!==c&&38!==c&&42!==c&&33!==c&&124!==c&&61!==c&&62!==c&&39!==c&&34!==c&&37!==c&&64!==c&&96!==c&&function(t){return!m(t)&&58!==t}(x(t,t.length-1));if(e||o)for(l=0;l=65536?l+=2:l++){if(!y(u=x(t,l)))return 5;_=_&&b(u,d,a),d=u}else{for(l=0;l=65536?l+=2:l++){if(10===(u=x(t,l)))p=!0,g&&(f=f||l-v-1>n&&" "!==t[v+1],v=l);else if(!y(u))return 5;_=_&&b(u,d,a),d=u}f=f||g&&l-v-1>n&&" "!==t[v+1]}return p||f?i>9&&w(t)?5:o?2===r?5:2:f?4:3:!_||o||s(t)?2===r?5:2:1}function T(t,e,i,n,r){t.dump=function(){if(0===e.length)return 2===t.quotingType?'""':"''";if(!t.noCompatMode&&(-1!==c.indexOf(e)||u.test(e)))return 2===t.quotingType?'"'+e+'"':"'"+e+"'";var o=t.indent*Math.max(1,i),a=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),h=n||t.flowLevel>-1&&i>=t.flowLevel;switch(_(e,h,t.indent,a,(function(e){return function(t,e){var i,n;for(i=0,n=t.implicitTypes.length;i"+C(e,t.indent)+S(f(function(t,e){var i,n,s=/(\n+)([^\n]*)/g,r=(a=t.indexOf("\n"),a=-1!==a?a:t.length,s.lastIndex=a,P(t.slice(0,a),e)),o="\n"===t[0]||" "===t[0];var a;for(;n=s.exec(t);){var h=n[1],l=n[2];i=" "===l[0],r+=h+(o||i||""===l?"":"\n")+P(l,e),o=i}return r}(e,a),o));case 5:return'"'+function(t){for(var e,i="",n=0,s=0;s=65536?s+=2:s++)n=x(t,s),!(e=l[n])&&y(n)?(i+=t[s],n>=65536&&(i+=t[s+1])):i+=e||d(n);return i}(e)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function C(t,e){var i=w(t)?String(e):"",n="\n"===t[t.length-1];return i+(n&&("\n"===t[t.length-2]||"\n"===t)?"+":n?"":"-")+"\n"}function S(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function P(t,e){if(""===t||" "===t[0])return t;for(var i,n,s=/ [^ ]/g,r=0,o=0,a=0,h="";i=s.exec(t);)(a=i.index)-r>e&&(n=o>r?o:a,h+="\n"+t.slice(r,n),r=n+1),o=a;return h+="\n",t.length-r>e&&o>r?h+=t.slice(r,o)+"\n"+t.slice(o+1):h+=t.slice(r),h.slice(1)}function A(t,e,i,n){var s,r,o,a="",h=t.tag;for(s=0,r=i.length;s tag resolver accepts not "'+u+'" style');n=c.represent[u](e,u)}t.dump=n}return!0}return!1}function M(t,e,i,n,r,a,h){t.tag=null,t.dump=i,E(t,i,!1)||E(t,i,!0);var l,c=o.call(t.dump),u=n;n&&(n=t.flowLevel<0||t.flowLevel>e);var d,p,f="[object Object]"===c||"[object Array]"===c;if(f&&(p=-1!==(d=t.duplicates.indexOf(i))),(null!==t.tag&&"?"!==t.tag||p||2!==t.indent&&e>0)&&(r=!1),p&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(f&&p&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),"[object Object]"===c)n&&0!==Object.keys(t.dump).length?(!function(t,e,i,n){var r,o,a,h,l,c,u="",d=t.tag,p=Object.keys(i);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new s("sortKeys must be a boolean or a function");for(r=0,o=p.length;r1024)&&(t.dump&&10===t.dump.charCodeAt(0)?c+="?":c+="? "),c+=t.dump,l&&(c+=g(t,e)),M(t,e+1,h,!0,l)&&(t.dump&&10===t.dump.charCodeAt(0)?c+=":":c+=": ",u+=c+=t.dump));t.tag=d,t.dump=u||"{}"}(t,e,t.dump,r),p&&(t.dump="&ref_"+d+t.dump)):(!function(t,e,i){var n,s,r,o,a,h="",l=t.tag,c=Object.keys(i);for(n=0,s=c.length;n1024&&(a+="? "),a+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),M(t,e,o,!1,!1)&&(h+=a+=t.dump));t.tag=l,t.dump="{"+h+"}"}(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if("[object Array]"===c)n&&0!==t.dump.length?(t.noArrayIndent&&!h&&e>0?A(t,e-1,t.dump,r):A(t,e,t.dump,r),p&&(t.dump="&ref_"+d+t.dump)):(!function(t,e,i){var n,s,r,o="",a=t.tag;for(n=0,s=i.length;n",t.dump=l+" "+t.dump)}return!0}function k(t,e){var i,n,s=[],r=[];for(L(t,s,r),i=0,n=r.length;i{"use strict";function e(t,e){var i="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(i+='in "'+t.mark.name+'" '),i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(i+="\n\n"+t.mark.snippet),n+" "+i):n}function i(t,i){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=i,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){return this.name+": "+e(this,t)},t.exports=i},7990:(t,e,i)=>{"use strict";var n=i(8347),s=i(8425),r=i(192),o=i(6601),a=Object.prototype.hasOwnProperty,h=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,l=/[\x85\u2028\u2029]/,c=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,d=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function p(t){return Object.prototype.toString.call(t)}function f(t){return 10===t||13===t}function g(t){return 9===t||32===t}function m(t){return 9===t||32===t||10===t||13===t}function y(t){return 44===t||91===t||93===t||123===t||125===t}function v(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function b(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"…":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function x(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var w=new Array(256),_=new Array(256),T=0;T<256;T++)w[T]=b(T)?1:0,_[T]=b(T);function C(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||o,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function S(t,e){var i={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return i.snippet=r(i),new s(e,i)}function P(t,e){throw S(t,e)}function A(t,e){t.onWarning&&t.onWarning.call(null,S(t,e))}var E={YAML:function(t,e,i){var n,s,r;null!==t.version&&P(t,"duplication of %YAML directive"),1!==i.length&&P(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&P(t,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),r=parseInt(n[2],10),1!==s&&P(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=r<2,1!==r&&2!==r&&A(t,"unsupported YAML version of the document")},TAG:function(t,e,i){var n,s;2!==i.length&&P(t,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],u.test(n)||P(t,"ill-formed tag handle (first argument) of the TAG directive"),a.call(t.tagMap,n)&&P(t,'there is a previously declared suffix for "'+n+'" tag handle'),d.test(s)||P(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch(e){P(t,"tag prefix is malformed: "+s)}t.tagMap[n]=s}};function M(t,e,i,n){var s,r,o,a;if(e1&&(t.result+=n.repeat("\n",e-1))}function F(t,e){var i,n,s=t.tag,r=t.anchor,o=[],a=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=o),n=t.input.charCodeAt(t.position);0!==n&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,P(t,"tab characters must not be used in indentation")),45===n)&&m(t.input.charCodeAt(t.position+1));)if(a=!0,t.position++,I(t,!0,-1)&&t.lineIndent<=e)o.push(null),n=t.input.charCodeAt(t.position);else if(i=t.line,G(t,e,3,!1,!0),o.push(t.result),I(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>e)&&0!==n)P(t,"bad indentation of a sequence entry");else if(t.lineIndente?C=1:t.lineIndent===e?C=0:t.lineIndente?C=1:t.lineIndent===e?C=0:t.lineIndente)&&(b&&(o=t.line,a=t.lineStart,h=t.position),G(t,e,4,!0,s)&&(b?y=t.result:v=t.result),b||(L(t,d,p,f,y,v,o,a,h),f=y=v=null),I(t,!0,-1),l=t.input.charCodeAt(t.position)),(t.line===r||t.lineIndent>e)&&0!==l)P(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===r?P(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?P(t,"repeat of an indentation width identifier"):(u=e+r-1,c=!0)}if(g(o)){do{o=t.input.charCodeAt(++t.position)}while(g(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!f(o)&&0!==o)}for(;0!==o;){for(O(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!c||t.lineIndentu&&(u=t.lineIndent),f(o))d++;else{if(t.lineIndent0){for(s=o,r=0;s>0;s--)(o=v(a=t.input.charCodeAt(++t.position)))>=0?r=(r<<4)+o:P(t,"expected hexadecimal character");t.result+=x(r),t.position++}else P(t,"unknown escape sequence");i=n=t.position}else f(a)?(M(t,i,n,!0),R(t,I(t,!1,e)),i=n=t.position):t.position===t.lineStart&&B(t)?P(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}P(t,"unexpected end of the stream within a double quoted scalar")}(t,b)?A=!0:!function(t){var e,i,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!m(n)&&!y(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&P(t,"name of an alias node must contain at least one character"),i=t.input.slice(e,t.position),a.call(t.anchorMap,i)||P(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],I(t,!0,-1),!0}(t)?function(t,e,i){var n,s,r,o,a,h,l,c,u=t.kind,d=t.result;if(m(c=t.input.charCodeAt(t.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(m(n=t.input.charCodeAt(t.position+1))||i&&y(n)))return!1;for(t.kind="scalar",t.result="",s=r=t.position,o=!1;0!==c;){if(58===c){if(m(n=t.input.charCodeAt(t.position+1))||i&&y(n))break}else if(35===c){if(m(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&B(t)||i&&y(c))break;if(f(c)){if(a=t.line,h=t.lineStart,l=t.lineIndent,I(t,!1,-1),t.lineIndent>=e){o=!0,c=t.input.charCodeAt(t.position);continue}t.position=r,t.line=a,t.lineStart=h,t.lineIndent=l;break}}o&&(M(t,s,r,!1),R(t,t.line-a),s=r=t.position,o=!1),g(c)||(r=t.position+1),c=t.input.charCodeAt(++t.position)}return M(t,s,r,!1),!!t.result||(t.kind=u,t.result=d,!1)}(t,b,1===i)&&(A=!0,null===t.tag&&(t.tag="?")):(A=!0,null===t.tag&&null===t.anchor||P(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===C&&(A=l&&F(t,T))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&P(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),c=0,u=t.implicitTypes.length;c"),null!==t.result&&p.kind!==t.kind&&P(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+p.kind+'", not "'+t.kind+'"'),p.resolve(t.result,t.tag)?(t.result=p.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):P(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||A}function N(t){var e,i,n,s,r=t.position,o=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(s=t.input.charCodeAt(t.position))&&(I(t,!0,-1),s=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==s));){for(o=!0,s=t.input.charCodeAt(++t.position),e=t.position;0!==s&&!m(s);)s=t.input.charCodeAt(++t.position);for(n=[],(i=t.input.slice(e,t.position)).length<1&&P(t,"directive name must not be less than one character in length");0!==s;){for(;g(s);)s=t.input.charCodeAt(++t.position);if(35===s){do{s=t.input.charCodeAt(++t.position)}while(0!==s&&!f(s));break}if(f(s))break;for(e=t.position;0!==s&&!m(s);)s=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==s&&O(t),a.call(E,i)?E[i](t,i,n):A(t,'unknown document directive "'+i+'"')}I(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,I(t,!0,-1)):o&&P(t,"directives end mark is expected"),G(t,t.lineIndent-1,4,!1,!0),I(t,!0,-1),t.checkLineBreaks&&l.test(t.input.slice(r,t.position))&&A(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&B(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,I(t,!0,-1)):t.position{"use strict";var n=i(8425),s=i(1364);function r(t,e){var i=[];return t[e].forEach((function(t){var e=i.length;i.forEach((function(i,n){i.tag===t.tag&&i.kind===t.kind&&i.multi===t.multi&&(e=n)})),i[e]=t})),i}function o(t){return this.extend(t)}o.prototype.extend=function(t){var e=[],i=[];if(t instanceof s)i.push(t);else if(Array.isArray(t))i=i.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new n("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof s))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new n("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new n("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),i.forEach((function(t){if(!(t instanceof s))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(o.prototype);return a.implicit=(this.implicit||[]).concat(e),a.explicit=(this.explicit||[]).concat(i),a.compiledImplicit=r(a,"implicit"),a.compiledExplicit=r(a,"explicit"),a.compiledTypeMap=function(){var t,e,i={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function n(t){t.multi?(i.multi[t.kind].push(t),i.multi.fallback.push(t)):i[t.kind][t.tag]=i.fallback[t.tag]=t}for(t=0,e=arguments.length;t{"use strict";t.exports=i(5966)},6601:(t,e,i)=>{"use strict";t.exports=i(9471).extend({implicit:[i(2156),i(7452)],explicit:[i(3531),i(1605),i(6879),i(4982)]})},4795:(t,e,i)=>{"use strict";var n=i(7657);t.exports=new n({explicit:[i(48),i(6451),i(945)]})},5966:(t,e,i)=>{"use strict";t.exports=i(4795).extend({implicit:[i(151),i(8771),i(1518),i(5215)]})},192:(t,e,i)=>{"use strict";var n=i(8347);function s(t,e,i,n,s){var r="",o="",a=Math.floor(s/2)-1;return n-e>a&&(e=n-a+(r=" ... ").length),i-n>a&&(i=n+a-(o=" ...").length),{str:r+t.slice(e,i).replace(/\t/g,"→")+o,pos:n-e+r.length}}function r(t,e){return n.repeat(" ",e-t.length)+t}t.exports=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var i,o=/\r?\n|\r|\0/g,a=[0],h=[],l=-1;i=o.exec(t.buffer);)h.push(i.index),a.push(i.index+i[0].length),t.position<=i.index&&l<0&&(l=a.length-2);l<0&&(l=a.length-1);var c,u,d="",p=Math.min(t.line+e.linesAfter,h.length).toString().length,f=e.maxLength-(e.indent+p+3);for(c=1;c<=e.linesBefore&&!(l-c<0);c++)u=s(t.buffer,a[l-c],h[l-c],t.position-(a[l]-a[l-c]),f),d=n.repeat(" ",e.indent)+r((t.line-c+1).toString(),p)+" | "+u.str+"\n"+d;for(u=s(t.buffer,a[l],h[l],t.position,f),d+=n.repeat(" ",e.indent)+r((t.line+1).toString(),p)+" | "+u.str+"\n",d+=n.repeat("-",e.indent+p+3+u.pos)+"^\n",c=1;c<=e.linesAfter&&!(l+c>=h.length);c++)u=s(t.buffer,a[l+c],h[l+c],t.position-(a[l]-a[l+c]),f),d+=n.repeat(" ",e.indent)+r((t.line+c+1).toString(),p)+" | "+u.str+"\n";return d.replace(/\n$/,"")}},1364:(t,e,i)=>{"use strict";var n=i(8425),s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];t.exports=function(t,e){var i,o;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===s.indexOf(e))throw new n('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=(i=e.styleAliases||null,o={},null!==i&&Object.keys(i).forEach((function(t){i[t].forEach((function(e){o[String(e)]=t}))})),o),-1===r.indexOf(this.kind))throw new n('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},3531:(t,e,i)=>{"use strict";var n=i(1364),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new n("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,i,n=0,r=t.length,o=s;for(i=0;i64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,i,n=t.replace(/[\r\n=]/g,""),r=n.length,o=s,a=0,h=[];for(e=0;e>16&255),h.push(a>>8&255),h.push(255&a)),a=a<<6|o.indexOf(n.charAt(e));return 0===(i=r%4*6)?(h.push(a>>16&255),h.push(a>>8&255),h.push(255&a)):18===i?(h.push(a>>10&255),h.push(a>>2&255)):12===i&&h.push(a>>4&255),new Uint8Array(h)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,i,n="",r=0,o=t.length,a=s;for(e=0;e>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[63&r]),r=(r<<8)+t[e];return 0===(i=o%3)?(n+=a[r>>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[63&r]):2===i?(n+=a[r>>10&63],n+=a[r>>4&63],n+=a[r<<2&63],n+=a[64]):1===i&&(n+=a[r>>2&63],n+=a[r<<4&63],n+=a[64],n+=a[64]),n}})},8771:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)},construct:function(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})},5215:(t,e,i)=>{"use strict";var n=i(8347),s=i(1364),r=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var o=/^[-+]?[0-9]+e/;t.exports=new s("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!r.test(t)||"_"===t[t.length-1])},construct:function(t){var e,i;return i="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:i*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||n.isNegativeZero(t))},represent:function(t,e){var i;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(t))return"-0.0";return i=t.toString(10),o.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})},1518:(t,e,i)=>{"use strict";var n=i(8347),s=i(1364);function r(t){return 48<=t&&t<=55}function o(t){return 48<=t&&t<=57}t.exports=new s("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,i,n=t.length,s=0,a=!1;if(!n)return!1;if("-"!==(e=t[s])&&"+"!==e||(e=t[++s]),"0"===e){if(s+1===n)return!0;if("b"===(e=t[++s])){for(s++;s=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},945:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}})},7452:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}})},151:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)},construct:function(){return null},predicate:function(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})},1605:(t,e,i)=>{"use strict";var n=i(1364),s=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,i,n,o,a,h=[],l=t;for(e=0,i=l.length;e{"use strict";var n=i(1364),s=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,i,n,r,o,a=t;for(o=new Array(a.length),e=0,i=a.length;e{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}})},4982:(t,e,i)=>{"use strict";var n=i(1364),s=Object.prototype.hasOwnProperty;t.exports=new n("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(t){if(null===t)return!0;var e,i=t;for(e in i)if(s.call(i,e)&&null!==i[e])return!1;return!0},construct:function(t){return null!==t?t:{}}})},48:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}})},2156:(t,e,i)=>{"use strict";var n=i(1364),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),r=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new n("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==s.exec(t)||null!==r.exec(t))},construct:function(t){var e,i,n,o,a,h,l,c,u=0,d=null;if(null===(e=s.exec(t))&&(e=r.exec(t)),null===e)throw new Error("Date resolve error");if(i=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(i,n,o));if(a=+e[4],h=+e[5],l=+e[6],e[7]){for(u=e[7].slice(0,3);u.length<3;)u+="0";u=+u}return e[9]&&(d=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(d=-d)),c=new Date(Date.UTC(i,n,o,a,h,l,u)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(t){return t.toISOString()}})},705:t=>{t.exports=function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=i[o]={exports:{}};e[o][0].call(h.exports,(function(t){return s(e[o][1][t]||t)}),h,h.exports,t,e,i,n)}return i[o].exports}for(var r=void 0,o=0;o>16),c((65280&s)>>8),c(255&s);return 2==r?c(255&(s=l(t.charAt(i))<<2|l(t.charAt(i+1))>>4)):1==r&&(c((s=l(t.charAt(i))<<10|l(t.charAt(i+1))<<4|l(t.charAt(i+2))>>2)>>8&255),c(255&s)),o},t.fromByteArray=function(t){var e,i,n,s,r=t.length%3,o="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,n=t.length-r;e>18&63)+a(s>>12&63)+a(s>>6&63)+a(63&s);switch(r){case 1:o+=a((i=t[t.length-1])>>2),o+=a(i<<4&63),o+="==";break;case 2:o+=a((i=(t[t.length-2]<<8)+t[t.length-1])>>10),o+=a(i>>4&63),o+=a(i<<2&63),o+="="}return o}}(void 0===i?this.base64js={}:i)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,i){(function(e,n,s,r,o,a,h,l,c){var u=t("base64-js"),d=t("ieee754");function s(t,e,i){if(!(this instanceof s))return new s(t,e,i);var n,r,o,a,h,l=typeof t;if("base64"===e&&"string"==l)for(t=(n=t).trim?n.trim():n.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==l)r=k(t);else if("string"==l)r=s.byteLength(t,e);else{if("object"!=l)throw new Error("First argument needs to be a number, array or string.");r=k(t.length)}if(s._useTypedArrays?o=s._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),s._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(L(h=t)||s.isBuffer(h)||h&&"object"==typeof h&&"number"==typeof h.length)for(a=0;a>8,n=e%256,s.push(n),s.push(i);return s}(e),t,i,n)}function g(t,e,i){var n="";i=Math.min(t.length,i);for(var s=e;s>>0)):(e+1>>0),s}function v(t,e,i,n){if(n||(N("boolean"==typeof i,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+1>>8*(n?o:1-o)}function T(t,e,i,n,s){s||(N(null!=e,"missing value"),N("boolean"==typeof n,"missing or invalid endian"),N(null!=i,"missing offset"),N(i+3>>8*(n?o:3-o)&255}function C(t,e,i,n,s){s||(N(null!=e,"missing value"),N("boolean"==typeof n,"missing or invalid endian"),N(null!=i,"missing offset"),N(i+1this.length&&(n=this.length),t.length-e=this.length))return this[t]},s.prototype.readUInt16LE=function(t,e){return m(this,t,!0,e)},s.prototype.readUInt16BE=function(t,e){return m(this,t,!1,e)},s.prototype.readUInt32LE=function(t,e){return y(this,t,!0,e)},s.prototype.readUInt32BE=function(t,e){return y(this,t,!1,e)},s.prototype.readInt8=function(t,e){if(e||(N(null!=t,"missing offset"),N(t=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){return v(this,t,!0,e)},s.prototype.readInt16BE=function(t,e){return v(this,t,!1,e)},s.prototype.readInt32LE=function(t,e){return b(this,t,!0,e)},s.prototype.readInt32BE=function(t,e){return b(this,t,!1,e)},s.prototype.readFloatLE=function(t,e){return x(this,t,!0,e)},s.prototype.readFloatBE=function(t,e){return x(this,t,!1,e)},s.prototype.readDoubleLE=function(t,e){return w(this,t,!0,e)},s.prototype.readDoubleBE=function(t,e){return w(this,t,!1,e)},s.prototype.writeUInt8=function(t,e,i){i||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e=this.length||(this[e]=t)},s.prototype.writeUInt16LE=function(t,e,i){_(this,t,e,!0,i)},s.prototype.writeUInt16BE=function(t,e,i){_(this,t,e,!1,i)},s.prototype.writeUInt32LE=function(t,e,i){T(this,t,e,!0,i)},s.prototype.writeUInt32BE=function(t,e,i){T(this,t,e,!1,i)},s.prototype.writeInt8=function(t,e,i){i||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e=this.length||(0<=t?this.writeUInt8(t,e,i):this.writeUInt8(255+t+1,e,i))},s.prototype.writeInt16LE=function(t,e,i){C(this,t,e,!0,i)},s.prototype.writeInt16BE=function(t,e,i){C(this,t,e,!1,i)},s.prototype.writeInt32LE=function(t,e,i){S(this,t,e,!0,i)},s.prototype.writeInt32BE=function(t,e,i){S(this,t,e,!1,i)},s.prototype.writeFloatLE=function(t,e,i){P(this,t,e,!0,i)},s.prototype.writeFloatBE=function(t,e,i){P(this,t,e,!1,i)},s.prototype.writeDoubleLE=function(t,e,i){A(this,t,e,!0,i)},s.prototype.writeDoubleBE=function(t,e,i){A(this,t,e,!1,i)},s.prototype.fill=function(t,e,i){if(t=t||0,e=e||0,i=i||this.length,"string"==typeof t&&(t=t.charCodeAt(0)),N("number"==typeof t&&!isNaN(t),"value is not a number"),N(e<=i,"end < start"),i!==e&&0!==this.length){N(0<=e&&e"},s.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(s._useTypedArrays)return new s(this).buffer;for(var t=new Uint8Array(this.length),e=0,i=t.length;e=e.length||s>=t.length);s++)e[s+i]=t[s];return s}function F(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function D(t,e){N("number"==typeof t,"cannot write a non-number as a number"),N(0<=t,"specified a negative value for writing an unsigned value"),N(t<=e,"value is larger than maximum value for type"),N(Math.floor(t)===t,"value has a fractional component")}function U(t,e,i){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(i<=t,"value smaller than minimum allowed value"),N(Math.floor(t)===t,"value has a fractional component")}function G(t,e,i){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(i<=t,"value smaller than minimum allowed value")}function N(t,e){if(!t)throw new Error(e||"Failed assertion")}s._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=E.get,t.set=E.set,t.write=E.write,t.toString=E.toString,t.toLocaleString=E.toString,t.toJSON=E.toJSON,t.copy=E.copy,t.slice=E.slice,t.readUInt8=E.readUInt8,t.readUInt16LE=E.readUInt16LE,t.readUInt16BE=E.readUInt16BE,t.readUInt32LE=E.readUInt32LE,t.readUInt32BE=E.readUInt32BE,t.readInt8=E.readInt8,t.readInt16LE=E.readInt16LE,t.readInt16BE=E.readInt16BE,t.readInt32LE=E.readInt32LE,t.readInt32BE=E.readInt32BE,t.readFloatLE=E.readFloatLE,t.readFloatBE=E.readFloatBE,t.readDoubleLE=E.readDoubleLE,t.readDoubleBE=E.readDoubleBE,t.writeUInt8=E.writeUInt8,t.writeUInt16LE=E.writeUInt16LE,t.writeUInt16BE=E.writeUInt16BE,t.writeUInt32LE=E.writeUInt32LE,t.writeUInt32BE=E.writeUInt32BE,t.writeInt8=E.writeInt8,t.writeInt16LE=E.writeInt16LE,t.writeInt16BE=E.writeInt16BE,t.writeInt32LE=E.writeInt32LE,t.writeInt32BE=E.writeInt32BE,t.writeFloatLE=E.writeFloatLE,t.writeFloatBE=E.writeFloatBE,t.writeDoubleLE=E.writeDoubleLE,t.writeDoubleBE=E.writeDoubleBE,t.fill=E.fill,t.inspect=E.inspect,t.toArrayBuffer=E.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,i){(function(i,n,s,r,o,a,h,l,c){s=t("buffer").Buffer;var u=4,d=new s(u);d.fill(0),e.exports={hash:function(t,e,i,n){return s.isBuffer(t)||(t=new s(t)),function(t,e,i){for(var n=new s(e),r=i?n.writeInt32BE:n.writeInt32LE,o=0;og?e=t(e):e.length>5]|=128<>>9<<4)]=e;for(var i=1732584193,n=-271733879,s=-1732584194,r=271733878,o=0;o>>32-a,i);var o,a}function f(t,e,i,n,s,r,o){return p(e&i|~e&n,t,e,s,r,o)}function g(t,e,i,n,s,r,o){return p(e&n|i&~n,t,e,s,r,o)}function m(t,e,i,n,s,r,o){return p(e^i^n,t,e,s,r,o)}function y(t,e,i,n,s,r,o){return p(i^(e|~n),t,e,s,r,o)}function v(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}e.exports=function(t){return u.hash(t,d,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,i){(function(t,i,n,s,r,o,a,h,l){var c,u;c=function(t){for(var e,i=new Array(t),n=0;n>>((3&n)<<3)&255;return i},e.exports=u||c}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,i){(function(i,n,s,r,o,a,h,l,c){var u=t("./helpers");function d(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var i,n=Array(80),s=1732584193,r=-271733879,o=-1732584194,a=271733878,h=-1009589776,l=0;l>16)+(e>>16)+(i>>16)<<16|65535&i}function g(t,e){return t<>>32-e}e.exports=function(t){return u.hash(t,d,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,i){(function(i,n,s,r,o,a,h,l,c){function u(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function d(t,e){return t>>>e|t<<32-e}function p(t,e){return t>>>e}function f(t,e){var i,n,s,r,o,a,h,l,c,f,g,m,y,v,b,x,w,_,T=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),C=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),S=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var P=0;P>1,c=-7,u=i?s-1:0,d=i?-1:1,p=t[e+u];for(u+=d,r=p&(1<<-c)-1,p>>=-c,c+=a;0>=-c,c+=n;0>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),2<=(e+=1<=o+u?d/h:d*Math.pow(2,1-u))*h&&(o++,h/=2),c<=o+u?(a=0,o=c):1<=o+u?(a=(e*h-1)*Math.pow(2,s),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,s),o=0));8<=s;t[i+p]=255&a,p+=f,a/=256,s-=8);for(o=o<{t.exports=function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=i[o]={exports:{}};e[o][0].call(h.exports,(function(t){var i=e[o][1][t];return s(i||t)}),h,h.exports,t,e,i,n)}return i[o].exports}for(var r=void 0,o=0;o=0&&h<=1&&l>=0&&l<=1}},{"./Scalar":4}],2:[function(t,e,i){function n(){}e.exports=n,n.area=function(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])},n.left=function(t,e,i){return n.area(t,e,i)>0},n.leftOn=function(t,e,i){return n.area(t,e,i)>=0},n.right=function(t,e,i){return n.area(t,e,i)<0},n.rightOn=function(t,e,i){return n.area(t,e,i)<=0};var s=[],r=[];n.collinear=function(t,e,i,o){if(o){var a=s,h=r;a[0]=e[0]-t[0],a[1]=e[1]-t[1],h[0]=i[0]-e[0],h[1]=i[1]-e[1];var l=a[0]*h[0]+a[1]*h[1],c=Math.sqrt(a[0]*a[0]+a[1]*a[1]),u=Math.sqrt(h[0]*h[0]+h[1]*h[1]);return Math.acos(l/(c*u))t.vertices.length)throw new Error("lol2");if(e<0)throw new Error("lol3");for(var n=e;ne[t][0])&&(t=i);s.left(this.at(t-1),this.at(t),this.at(t+1))||this.reverse()},o.prototype.reverse=function(){for(var t=[],e=0,i=this.vertices.length;e!==i;e++)t.push(this.vertices.pop());this.vertices=t},o.prototype.isReflex=function(t){return s.right(this.at(t-1),this.at(t),this.at(t+1))};var a=[],h=[];function l(t,e,i,n,s){s=s||0;var o=e[1]-t[1],a=t[0]-e[0],h=o*t[0]+a*t[1],l=n[1]-i[1],c=i[0]-n[0],u=l*i[0]+c*i[1],d=o*c-l*a;return r.eq(d,0,s)?[0,0]:[(c*h-a*u)/d,(o*u-l*h)/d]}o.prototype.canSee=function(t,e){var i,r,o=a,l=h;if(s.leftOn(this.at(t+1),this.at(t),this.at(e))&&s.rightOn(this.at(t-1),this.at(t),this.at(e)))return!1;r=s.sqdist(this.at(t),this.at(e));for(var c=0;c!==this.vertices.length;++c)if((c+1)%this.vertices.length!==t&&c!==t&&s.leftOn(this.at(t),this.at(e),this.at(c+1))&&s.rightOn(this.at(t),this.at(e),this.at(c))&&(o[0]=this.at(t),o[1]=this.at(e),l[0]=this.at(c),l[1]=this.at(c+1),i=n.lineInt(o,l),s.sqdist(this.at(t),i)0?this.slice(t):[this]},o.prototype.slice=function(t){if(0==t.length)return[this];if(t instanceof Array&&t.length&&t[0]instanceof Array&&2==t[0].length&&t[0][0]instanceof Array){for(var e=[this],i=0;ir)return console.warn("quickDecomp: max level ("+r+") reached."),t;for(var T=0;Tm&&(m+=this.vertices.length),g=Number.MAX_VALUE,m3&&i>=0;--i)s.collinear(this.at(i-1),this.at(i),this.at(i+1),t)&&(this.vertices.splice(i%this.vertices.length,1),i--,e++);return e}},{"./Line":1,"./Point":2,"./Scalar":4}],4:[function(t,e,i){function n(){}e.exports=n,n.eq=function(t,e,i){return i=i||0,Math.abs(t-e) (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{grunt:"^0.4.5","grunt-contrib-jshint":"^0.11.2","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"~0.4.0","grunt-contrib-watch":"~0.5.0","grunt-browserify":"~2.0.1","grunt-contrib-concat":"^0.4.0"},dependencies:{"poly-decomp":"0.1.1"}}},{}],7:[function(t,e,i){var n=t("../math/vec2");function s(t){this.lowerBound=n.create(),t&&t.lowerBound&&n.copy(this.lowerBound,t.lowerBound),this.upperBound=n.create(),t&&t.upperBound&&n.copy(this.upperBound,t.upperBound)}t("../utils/Utils"),e.exports=s;var r=n.create();s.prototype.setFromPoints=function(t,e,i,s){var o=this.lowerBound,a=this.upperBound;"number"!=typeof i&&(i=0),0!==i?n.rotate(o,t[0],i):n.copy(o,t[0]),n.copy(a,o);for(var h=Math.cos(i),l=Math.sin(i),c=1;ca[f]&&(a[f]=u[f]),u[f]i&&(this.lowerBound[e]=i);var n=t.upperBound[e];this.upperBound[e]h?-1:a}},{"../math/vec2":30,"../utils/Utils":57}],8:[function(t,e,i){var n=t("../math/vec2"),s=t("../objects/Body");function r(t){this.type=t,this.result=[],this.world=null,this.boundingVolumeType=r.AABB}e.exports=r,r.AABB=1,r.BOUNDING_CIRCLE=2,r.prototype.setWorld=function(t){this.world=t},r.prototype.getCollisionPairs=function(t){};var o=n.create();r.boundingRadiusCheck=function(t,e){n.sub(o,t.position,e.position);var i=n.squaredLength(o),s=t.boundingRadius+e.boundingRadius;return i<=s*s},r.aabbCheck=function(t,e){return t.getAABB().overlaps(e.getAABB())},r.prototype.boundingVolumeCheck=function(t,e){var i;switch(this.boundingVolumeType){case r.BOUNDING_CIRCLE:i=r.boundingRadiusCheck(t,e);break;case r.AABB:i=r.aabbCheck(t,e);break;default:throw new Error("Bounding volume type not recognized: "+this.boundingVolumeType)}return i},r.canCollide=function(t,e){var i=s.KINEMATIC,n=s.STATIC;return!(t.type===n&&e.type===n||t.type===i&&e.type===n||t.type===n&&e.type===i||t.type===i&&e.type===i||t.sleepState===s.SLEEPING&&e.sleepState===s.SLEEPING||t.sleepState===s.SLEEPING&&e.type===n||e.sleepState===s.SLEEPING&&t.type===n)},r.NAIVE=1,r.SAP=2},{"../math/vec2":30,"../objects/Body":31}],9:[function(t,e,i){t("../shapes/Circle"),t("../shapes/Plane"),t("../shapes/Shape"),t("../shapes/Particle");var n=t("../collision/Broadphase");function s(){n.call(this,n.NAIVE)}t("../math/vec2"),e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.prototype.getCollisionPairs=function(t){var e=t.bodies,i=this.result;i.length=0;for(var s=0,r=e.length;s!==r;s++)for(var o=e[s],a=0;az&&Y0)for(U=0;UMath.pow(g,2))return 0;if(u)return!0;var y=this.createContactEquation(t,a,e,h);return s(y.normalA,l,i),n.normalize(y.normalA,y.normalA),n.scale(y.contactPointA,y.normalA,d),n.scale(y.contactPointB,y.normalA,-p),r(y.contactPointA,y.contactPointA,i),s(y.contactPointA,y.contactPointA,t.position),r(y.contactPointB,y.contactPointB,l),s(y.contactPointB,y.contactPointB,a.position),this.contactEquations.push(y),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(y)),1},R.prototype[p.PLANE|p.CONVEX]=R.prototype[p.PLANE|p.BOX]=R.prototype.planeConvex=function(t,e,i,a,h,l,c,u,d){var p=m,f=y,b=v,x=0;n.rotate(f,g,a);for(var w=0;w!==l.vertices.length;w++){var _=l.vertices[w];if(n.rotate(p,_,u),r(p,p,c),s(b,p,i),o(b,f)<=0){if(d)return!0;x++;var T=this.createContactEquation(t,h,e,l);s(b,p,i),n.copy(T.normalA,f);var C=o(b,T.normalA);n.scale(b,T.normalA,C),s(T.contactPointB,p,h.position),s(T.contactPointA,p,b),s(T.contactPointA,T.contactPointA,t.position),this.contactEquations.push(T),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(T))}}return this.enableFrictionReduction&&this.enableFriction&&x&&this.frictionEquations.push(this.createFrictionFromAverage(x)),x},R.prototype[p.PARTICLE|p.PLANE]=R.prototype.particlePlane=function(t,e,i,r,a,h,l,c,u){var d=m,p=y;c=c||0,s(d,i,l),n.rotate(p,g,c);var f=o(d,p);if(f>0)return 0;if(u)return!0;var v=this.createContactEquation(a,t,h,e);return n.copy(v.normalA,p),n.scale(d,v.normalA,f),s(v.contactPointA,i,d),s(v.contactPointA,v.contactPointA,a.position),s(v.contactPointB,i,t.position),this.contactEquations.push(v),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(v)),1},R.prototype[p.CIRCLE|p.PARTICLE]=R.prototype.circleParticle=function(t,e,i,o,a,h,l,c,u){var d=m;if(s(d,l,i),n.squaredLength(d)>Math.pow(e.radius,2))return 0;if(u)return!0;var p=this.createContactEquation(t,a,e,h);return n.copy(p.normalA,d),n.normalize(p.normalA,p.normalA),n.scale(p.contactPointA,p.normalA,e.radius),r(p.contactPointA,p.contactPointA,i),s(p.contactPointA,p.contactPointA,t.position),s(p.contactPointB,l,a.position),this.contactEquations.push(p),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(p)),1};var K=new u({radius:1}),J=n.create(),Q=n.create();n.create(),R.prototype[p.PLANE|p.CAPSULE]=R.prototype.planeCapsule=function(t,e,i,s,o,a,h,l,c){var u,d=J,p=Q,f=K;n.set(d,-a.length/2,0),n.rotate(d,d,l),r(d,d,h),n.set(p,a.length/2,0),n.rotate(p,p,l),r(p,p,h),f.radius=a.radius,this.enableFrictionReduction&&(u=this.enableFriction,this.enableFriction=!1);var g=this.circlePlane(o,f,d,0,t,e,i,s,c),m=this.circlePlane(o,f,p,0,t,e,i,s,c);if(this.enableFrictionReduction&&(this.enableFriction=u),c)return g||m;var y=g+m;return this.enableFrictionReduction&&y&&this.frictionEquations.push(this.createFrictionFromAverage(y)),y},R.prototype[p.CIRCLE|p.PLANE]=R.prototype.circlePlane=function(t,e,i,a,h,l,c,u,d){var p=t,f=e,b=i,x=h,w=c,_=u;_=_||0;var T=m,C=y,S=v;s(T,b,w),n.rotate(C,g,_);var P=o(C,T);if(P>f.radius)return 0;if(d)return!0;var A=this.createContactEquation(x,p,l,e);return n.copy(A.normalA,C),n.scale(A.contactPointB,A.normalA,-f.radius),r(A.contactPointB,A.contactPointB,b),s(A.contactPointB,A.contactPointB,p.position),n.scale(S,A.normalA,P),s(A.contactPointA,T,S),r(A.contactPointA,A.contactPointA,w),s(A.contactPointA,A.contactPointA,x.position),this.contactEquations.push(A),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(A)),1},R.prototype[p.CONVEX]=R.prototype[p.CONVEX|p.BOX]=R.prototype[p.BOX]=R.prototype.convexConvex=function(t,e,i,a,h,l,c,u,d,p){var f=m,g=y,w=v,S=b,P=x,A=_,E=T,M=C,k=0;if(p="number"==typeof p?p:0,!R.findSeparatingAxis(e,i,a,l,c,u,f))return 0;s(E,c,i),o(f,E)>0&&n.scale(f,f,-1);var L=R.getClosestEdge(e,a,f,!0),O=R.getClosestEdge(l,u,f);if(-1===L||-1===O)return 0;for(var I=0;I<2;I++){var B,F=L,D=O,U=e,G=l,N=i,j=c,W=a,X=u,V=t,H=h;0===I&&(B=F,F=D,D=B,B=U,U=G,G=B,B=N,N=j,j=B,B=W,W=X,X=B,B=V,V=H,H=B);for(var q=D;q=3){if(d)return!0;var $=this.createContactEquation(V,H,U,G);k++,J=U.vertices[F%U.vertices.length],Q=U.vertices[(F+1)%U.vertices.length],n.rotate(w,J,W),n.rotate(S,Q,W),r(w,w,N),r(S,S,N),s(P,S,w),n.rotate90cw($.normalA,P),n.normalize($.normalA,$.normalA),s(E,g,w),Z=o($.normalA,E),n.scale(A,$.normalA,Z),s($.contactPointA,g,N),s($.contactPointA,$.contactPointA,A),r($.contactPointA,$.contactPointA,N),s($.contactPointA,$.contactPointA,V.position),s($.contactPointB,g,j),r($.contactPointB,$.contactPointB,j),s($.contactPointB,$.contactPointB,H.position),this.contactEquations.push($),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact($))}}}return this.enableFrictionReduction&&this.enableFriction&&k&&this.frictionEquations.push(this.createFrictionFromAverage(k)),k};var Z=n.fromValues(0,0);R.projectConvexOntoAxis=function(t,e,i,s,r){var a,h,l=null,c=null,u=Z;n.rotate(u,s,-i);for(var d=0;dl)&&(l=h),(null===c||hl){var p=c;c=l,l=p}var f=o(e,s);n.set(r,c+f,l+f)};var $=n.fromValues(0,0),tt=n.fromValues(0,0),et=n.fromValues(0,0),it=n.fromValues(0,0),nt=n.fromValues(0,0),st=n.fromValues(0,0);R.findSeparatingAxis=function(t,e,i,r,o,a,h){var l=null,c=!1,u=!1,d=$,p=tt,g=et,m=it,y=nt,v=st;if(t instanceof f&&r instanceof f)for(var b=0;2!==b;b++){var x=t,w=i;1===b&&(x=r,w=a);for(var _=0;2!==_;_++){0===_?n.set(m,0,1):1===_&&n.set(m,1,0),0!==w&&n.rotate(m,m,w),R.projectConvexOntoAxis(t,e,i,m,y),R.projectConvexOntoAxis(r,o,a,m,v);var T=y,C=v;y[0]>v[0]&&(C=y,T=v),c=(S=C[0]-T[1])<=0,(null===l||S>l)&&(n.copy(h,m),l=S,u=c)}}else for(b=0;2!==b;b++)for(x=t,w=i,1===b&&(x=r,w=a),_=0;_!==x.vertices.length;_++){var S;n.rotate(p,x.vertices[_],w),n.rotate(g,x.vertices[(_+1)%x.vertices.length],w),s(d,g,p),n.rotate90cw(m,d),n.normalize(m,m),R.projectConvexOntoAxis(t,e,i,m,y),R.projectConvexOntoAxis(r,o,a,m,v),T=y,C=v,y[0]>v[0]&&(C=y,T=v),c=(S=C[0]-T[1])<=0,(null===l||S>l)&&(n.copy(h,m),l=S,u=c)}return u};var rt=n.fromValues(0,0),ot=n.fromValues(0,0),at=n.fromValues(0,0);R.getClosestEdge=function(t,e,i,r){var a=rt,h=ot,l=at;n.rotate(a,i,-e),r&&n.scale(a,a,-1);for(var c=-1,u=t.vertices.length,d=-1,p=0;p!==u;p++){s(h,t.vertices[(p+1)%u],t.vertices[p%u]),n.rotate90cw(l,h),n.normalize(l,l);var f=o(l,a);(-1===c||f>d)&&(c=p%u,d=f)}return c};var ht=n.create(),lt=n.create(),ct=n.create(),ut=n.create(),dt=n.create(),pt=n.create(),ft=n.create();R.prototype[p.CIRCLE|p.HEIGHTFIELD]=R.prototype.circleHeightfield=function(t,e,i,o,a,h,l,c,u,d){var p=h.heights,f=(d=d||e.radius,h.elementWidth),g=lt,m=ht,y=dt,v=ft,b=pt,x=ct,w=ut,_=Math.floor((i[0]-d-l[0])/f),T=Math.ceil((i[0]+d-l[0])/f);_<0&&(_=0),T>=p.length&&(T=p.length-1);for(var C=p[_],S=p[T],P=_;PC&&(C=p[P]);if(i[1]-d>C)return!u&&0;var A=!1;for(P=_;P=x[0]&&m[0]0)for(P=_;P<=T;P++)if(n.set(x,P*f,p[P]),n.add(x,x,l),n.sub(g,i,x),n.squaredLength(g)=c.length&&(y=c.length-1);for(var v=c[m],b=c[y],x=m;xv&&(v=c[x]);if(t.aabb.lowerBound[1]>v)return!l&&0;var w=0;for(x=m;x=0||r.containsPoint(this.from))&&this.intersectBody(t,s)}};var r=n.create();s.prototype.intersectBody=function(t,e){var i=this.checkCollisionResponse;if(!i||e.collisionResponse)for(var s=r,o=0,a=e.shapes.length;oe.boundingRadius*e.boundingRadius||(this._currentBody=s,this._currentShape=e,e.raycast(t,this,n,i),this._currentBody=this._currentShape=null)},s.prototype.getAABB=function(t){var e=this.to,i=this.from;n.set(t.lowerBound,Math.min(e[0],i[0]),Math.min(e[1],i[1])),n.set(t.upperBound,Math.max(e[0],i[0]),Math.max(e[1],i[1]))},n.create(),s.prototype.reportIntersection=function(t,e,i,r){this.from,this.to;var o=this._currentShape,a=this._currentBody;if(!(this.skipBackfaces&&n.dot(i,this.direction)>0))switch(this.mode){case s.ALL:t.set(i,o,a,e,r),this.callback(t);break;case s.CLOSEST:(e=0&&!(t[r].aabb.lowerBound[e]<=s.aabb.lowerBound[e]);r--)t[r+1]=t[r];t[r+1]=s}return t},r.prototype.sortList=function(){var t=this.axisList,e=this.axisIndex;r.sortAxisList(t,e)},r.prototype.getCollisionPairs=function(t){var e=this.axisList,i=this.result,n=this.axisIndex;i.length=0;for(var r=e.length;r--;){var o=e[r];o.aabbNeedsUpdate&&o.updateAABB()}this.sortList();for(var a=0,h=0|e.length;a!==h;a++)for(var l=e[a],c=a+1;cthis.upperLimit&&(o.maxForce=0,o.minForce=-this.maxForce,this.distance=this.upperLimit,u=!0),this.lowerLimitEnabled&&this.positioni?(o.scale(s.normalA,l,-1),o.sub(s.contactPointA,c,a.position),o.sub(s.contactPointB,u,h.position),o.scale(f,l,i),o.add(s.contactPointA,s.contactPointA,f),-1===t.indexOf(s)&&t.push(s)):-1!==(v=t.indexOf(s))&&t.splice(v,1),this.lowerLimitEnabled&&bp?(g.angle=p,-1===r.indexOf(g)&&r.push(g)):-1!==(t=r.indexOf(g))&&r.splice(t,1),this.lowerLimitEnabled&&y>1;if(e<3)return[];for(var i=[],s=[],r=0;r3;){var a=s[(r+0)%o],h=s[(r+1)%o],l=s[(r+2)%o],c=t[2*a],u=t[2*a+1],d=t[2*h],p=t[2*h+1],f=t[2*l],g=t[2*l+1],m=!1;if(n._convex(c,u,d,p,f,g)){m=!0;for(var y=0;y3*o)break}return i.push(s[0],s[1],s[2]),i},_PointInTriangle:function(t,e,i,n,s,r,o,a){var h=o-i,l=a-n,c=s-i,u=r-n,d=t-i,p=e-n,f=h*h+l*l,g=h*c+l*u,m=h*d+l*p,y=c*c+u*u,v=c*d+u*p,b=1/(f*y-g*g),x=(y*m-g*v)*b,w=(f*v-g*m)*b;return x>=0&&w>=0&&x+w<1},_convex:function(t,e,i,n,s,r){return(e-n)*(s-i)+(i-t)*(r-n)>=0}};e.exports=n},{}],30:[function(t,e,i){var n=e.exports={},s=t("../utils/Utils");n.crossLength=function(t,e){return t[0]*e[1]-t[1]*e[0]},n.crossVZ=function(t,e,i){return n.rotate(t,e,-Math.PI/2),n.scale(t,t,i),t},n.crossZV=function(t,e,i){return n.rotate(t,i,Math.PI/2),n.scale(t,t,e),t},n.rotate=function(t,e,i){if(0!==i){var n=Math.cos(i),s=Math.sin(i),r=e[0],o=e[1];t[0]=n*r-s*o,t[1]=s*r+n*o}else t[0]=e[0],t[1]=e[1]},n.rotate90cw=function(t,e){var i=e[0],n=e[1];t[0]=n,t[1]=-i},n.toLocalFrame=function(t,e,i,s){n.copy(t,e),n.sub(t,t,i),n.rotate(t,t,-s)},n.toGlobalFrame=function(t,e,i,s){n.copy(t,e),n.rotate(t,t,s),n.add(t,t,i)},n.vectorToLocalFrame=function(t,e,i){n.rotate(t,e,-i)},n.vectorToGlobalFrame=function(t,e,i){n.rotate(t,e,i)},n.centroid=function(t,e,i,s){return n.add(t,e,i),n.add(t,t,s),n.scale(t,t,1/3),t},n.create=function(){var t=new s.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},n.clone=function(t){var e=new s.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},n.fromValues=function(t,e){var i=new s.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},n.set=function(t,e,i){return t[0]=e,t[1]=i,t},n.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},n.subtract=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},n.sub=n.subtract,n.multiply=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},n.mul=n.multiply,n.divide=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},n.div=n.divide,n.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},n.distance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(i*i+n*n)},n.dist=n.distance,n.squaredDistance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n},n.sqrDist=n.squaredDistance,n.length=function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},n.len=n.length,n.squaredLength=function(t){var e=t[0],i=t[1];return e*e+i*i},n.sqrLen=n.squaredLength,n.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},n.normalize=function(t,e){var i=e[0],n=e[1],s=i*i+n*n;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s),t},n.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},n.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},n.lerp=function(t,e,i,n){var s=e[0],r=e[1];return t[0]=s+n*(i[0]-s),t[1]=r+n*(i[1]-r),t},n.reflect=function(t,e,i){var n=e[0]*i[0]+e[1]*i[1];t[0]=e[0]-2*i[0]*n,t[1]=e[1]-2*i[1]*n},n.getLineSegmentsIntersection=function(t,e,i,s,r){var o=n.getLineSegmentsIntersectionFraction(e,i,s,r);return!(o<0||(t[0]=e[0]+o*(i[0]-e[0]),t[1]=e[1]+o*(i[1]-e[1]),0))},n.getLineSegmentsIntersectionFraction=function(t,e,i,n){var s,r,o=e[0]-t[0],a=e[1]-t[1],h=n[0]-i[0],l=n[1]-i[1];return s=(-a*(t[0]-i[0])+o*(t[1]-i[1]))/(-h*a+o*l),r=(h*(t[1]-i[1])-l*(t[0]-i[0]))/(-h*a+o*l),s>=0&&s<=1&&r>=0&&r<=1?r:-1}},{"../utils/Utils":57}],31:[function(t,e,i){var n=t("../math/vec2"),s=t("poly-decomp"),r=t("../shapes/Convex"),o=t("../collision/RaycastResult"),a=t("../collision/Ray"),h=t("../collision/AABB"),l=t("../events/EventEmitter");function c(t){t=t||{},l.call(this),this.id=t.id||++c._idCounter,this.world=null,this.shapes=[],this.mass=t.mass||0,this.invMass=0,this.inertia=0,this.invInertia=0,this.invMassSolve=0,this.invInertiaSolve=0,this.fixedRotation=!!t.fixedRotation,this.fixedX=!!t.fixedX,this.fixedY=!!t.fixedY,this.massMultiplier=n.create(),this.position=n.fromValues(0,0),t.position&&n.copy(this.position,t.position),this.interpolatedPosition=n.fromValues(0,0),this.interpolatedAngle=0,this.previousPosition=n.fromValues(0,0),this.previousAngle=0,this.velocity=n.fromValues(0,0),t.velocity&&n.copy(this.velocity,t.velocity),this.vlambda=n.fromValues(0,0),this.wlambda=0,this.angle=t.angle||0,this.angularVelocity=t.angularVelocity||0,this.force=n.create(),t.force&&n.copy(this.force,t.force),this.angularForce=t.angularForce||0,this.damping="number"==typeof t.damping?t.damping:.1,this.angularDamping="number"==typeof t.angularDamping?t.angularDamping:.1,this.type=c.STATIC,void 0!==t.type?this.type=t.type:t.mass?this.type=c.DYNAMIC:this.type=c.STATIC,this.boundingRadius=0,this.aabb=new h,this.aabbNeedsUpdate=!0,this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.wantsToSleep=!1,this.sleepState=c.AWAKE,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.2,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.gravityScale=void 0!==t.gravityScale?t.gravityScale:1,this.collisionResponse=void 0===t.collisionResponse||t.collisionResponse,this.idleTime=0,this.timeLastSleepy=0,this.ccdSpeedThreshold=void 0!==t.ccdSpeedThreshold?t.ccdSpeedThreshold:-1,this.ccdIterations=void 0!==t.ccdIterations?t.ccdIterations:10,this.concavePath=null,this._wakeUpAfterNarrowphase=!1,this.updateMassProperties()}e.exports=c,c.prototype=new l,c.prototype.constructor=c,c._idCounter=0,c.prototype.updateSolveMassProperties=function(){this.sleepState===c.SLEEPING||this.type===c.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve=0):(this.invMassSolve=this.invMass,this.invInertiaSolve=this.invInertia)},c.prototype.setDensity=function(t){var e=this.getArea();this.mass=e*t,this.updateMassProperties()},c.prototype.getArea=function(){for(var t=0,e=0;ei&&(i=o+a)}this.boundingRadius=i},c.prototype.addShape=function(t,e,i){if(t.body)throw new Error("A shape can only be added to one body.");t.body=this,e?n.copy(t.position,e):n.set(t.position,0,0),t.angle=i||0,this.shapes.push(t),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},c.prototype.removeShape=function(t){var e=this.shapes.indexOf(t);return-1!==e&&(this.shapes.splice(e,1),this.aabbNeedsUpdate=!0,t.body=null,!0)},c.prototype.updateMassProperties=function(){if(this.type===c.STATIC||this.type===c.KINEMATIC)this.mass=Number.MAX_VALUE,this.invMass=0,this.inertia=Number.MAX_VALUE,this.invInertia=0;else{var t=this.shapes,e=t.length,i=this.mass/e,s=0;if(this.fixedRotation)this.inertia=Number.MAX_VALUE,this.invInertia=0;else{for(var r=0;r0?1/s:0}this.invMass=1/this.mass,n.set(this.massMultiplier,this.fixedX?0:1,this.fixedY?0:1)}},n.create(),c.prototype.applyForce=function(t,e){if(n.add(this.force,this.force,t),e){var i=n.crossLength(e,t);this.angularForce+=i}};var p=n.create(),f=n.create(),g=n.create();c.prototype.applyForceLocal=function(t,e){e=e||g;var i=p,n=f;this.vectorToWorldFrame(i,t),this.vectorToWorldFrame(n,e),this.applyForce(i,n)};var m=n.create();c.prototype.applyImpulse=function(t,e){if(this.type===c.DYNAMIC){var i=m;if(n.scale(i,t,this.invMass),n.multiply(i,this.massMultiplier,i),n.add(this.velocity,i,this.velocity),e){var s=n.crossLength(e,t);s*=this.invInertia,this.angularVelocity+=s}}};var y=n.create(),v=n.create(),b=n.create();c.prototype.applyImpulseLocal=function(t,e){e=e||b;var i=y,n=v;this.vectorToWorldFrame(i,t),this.vectorToWorldFrame(n,e),this.applyImpulse(i,n)},c.prototype.toLocalFrame=function(t,e){n.toLocalFrame(t,e,this.position,this.angle)},c.prototype.toWorldFrame=function(t,e){n.toGlobalFrame(t,e,this.position,this.angle)},c.prototype.vectorToLocalFrame=function(t,e){n.vectorToLocalFrame(t,e,this.angle)},c.prototype.vectorToWorldFrame=function(t,e){n.vectorToGlobalFrame(t,e,this.angle)},c.prototype.fromPolygon=function(t,e){e=e||{};for(var i=this.shapes.length;i>=0;--i)this.removeShape(this.shapes[i]);var o,a=new s.Polygon;if(a.vertices=t,a.makeCCW(),"number"==typeof e.removeCollinearPoints&&a.removeCollinearPoints(e.removeCollinearPoints),void 0===e.skipSimpleCheck&&!a.isSimple())return!1;for(this.concavePath=a.vertices.slice(0),i=0;i=Math.pow(this.sleepSpeedLimit,2)?(this.idleTime=0,this.sleepState=c.AWAKE):(this.idleTime+=i,this.sleepState=c.SLEEPY),this.idleTime>this.sleepTimeLimit&&(e?this.wantsToSleep=!0:this.sleep()))},c.prototype.overlaps=function(t){return this.world.overlapKeeper.bodiesAreOverlapping(this,t)};var T=n.create(),C=n.create();c.prototype.integrate=function(t){var e=this.invMass,i=this.force,s=this.position,r=this.velocity;n.copy(this.previousPosition,this.position),this.previousAngle=this.angle,this.fixedRotation||(this.angularVelocity+=this.angularForce*this.invInertia*t),n.scale(T,i,t*e),n.multiply(T,this.massMultiplier,T),n.add(r,T,r),this.integrateToTimeOfImpact(t)||(n.scale(C,r,t),n.add(s,s,C),this.fixedRotation||(this.angle+=this.angularVelocity*t)),this.aabbNeedsUpdate=!0};var S=new o,P=new a({mode:a.ALL}),A=n.create(),E=n.create(),M=n.create(),k=n.create();c.prototype.integrateToTimeOfImpact=function(t){if(this.ccdSpeedThreshold<0||n.squaredLength(this.velocity)=l&&h=0&&(s.rotate(p,u,n),s.scale(p,p,2*y-1),e.reportIntersection(t,x,p,-1),t.shouldStop(e)))return}var b=Math.pow(this.radius,2)+Math.pow(m,2);for(y=0;y<2;y++){s.set(f,m*(2*y-1),0),s.toGlobalFrame(f,f,i,n);var x,w=Math.pow(o[0]-r[0],2)+Math.pow(o[1]-r[1],2),_=2*((o[0]-r[0])*(r[0]-f[0])+(o[1]-r[1])*(r[1]-f[1])),T=Math.pow(r[0]-f[0],2)+Math.pow(r[1]-f[1],2)-Math.pow(this.radius,2);if(!((x=Math.pow(_,2)-4*w*T)<0))if(0===x){if(s.lerp(d,r,o,x),s.squaredDistance(d,i)>b&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,x,p,-1),t.shouldStop(e)))return}else{var C=Math.sqrt(x),S=1/(2*w),P=(-_-C)*S,A=(-_+C)*S;if(P>=0&&P<=1&&(s.lerp(d,r,o,P),s.squaredDistance(d,i)>b&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,P,p,-1),t.shouldStop(e))))return;if(A>=0&&A<=1&&(s.lerp(d,r,o,A),s.squaredDistance(d,i)>b&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,A,p,-1),t.shouldStop(e))))return}}}},{"../math/vec2":30,"./Shape":45}],39:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){"number"==typeof arguments[0]&&(t={radius:arguments[0]},console.warn("The Circle constructor signature has changed. Please use the following format: new Circle({ radius: 1 })")),t=t||{},this.radius=t.radius||1,t.type=n.CIRCLE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){var e=this.radius;return t*e*e/2},r.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},r.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},r.prototype.computeAABB=function(t,e,i){var n=this.radius;s.set(t.upperBound,n,n),s.set(t.lowerBound,-n,-n),e&&(s.add(t.lowerBound,t.lowerBound,e),s.add(t.upperBound,t.upperBound,e))};var o=s.create(),a=s.create();r.prototype.raycast=function(t,e,i,n){var r=e.from,h=e.to,l=this.radius,c=Math.pow(h[0]-r[0],2)+Math.pow(h[1]-r[1],2),u=2*((h[0]-r[0])*(r[0]-i[0])+(h[1]-r[1])*(r[1]-i[1])),d=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2)-Math.pow(l,2),p=Math.pow(u,2)-4*c*d,f=o,g=a;if(!(p<0))if(0===p)s.lerp(f,r,h,p),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,p,g,-1);else{var m=Math.sqrt(p),y=1/(2*c),v=(-u-m)*y,b=(-u+m)*y;if(v>=0&&v<=1&&(s.lerp(f,r,h,v),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,v,g,-1),t.shouldStop(e)))return;b>=0&&b<=1&&(s.lerp(f,r,h,b),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,b,g,-1))}}},{"../math/vec2":30,"./Shape":45}],40:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2"),r=t("../math/polyk");function o(t){Array.isArray(arguments[0])&&(t={vertices:arguments[0],axes:arguments[1]},console.warn("The Convex constructor signature has changed. Please use the following format: new Convex({ vertices: [...], ... })")),t=t||{},this.vertices=[];for(var e=void 0!==t.vertices?t.vertices:[],i=0;ir)&&(r=n),(null===o||nr){var l=o;o=r,r=l}s.set(e,o,r)},o.prototype.projectOntoWorldAxis=function(t,e,i,n){var r=h;this.projectOntoLocalAxis(t,n),0!==i?s.rotate(r,t,i):r=t;var o=s.dot(e,r);s.set(n,n[0]+o,n[1]+o)},o.prototype.updateTriangles=function(){this.triangles.length=0;for(var t=[],e=0;ee&&(e=n)}this.boundingRadius=Math.sqrt(e)},o.triangleArea=function(t,e,i){return.5*((e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1]))},o.prototype.updateArea=function(){this.updateTriangles(),this.area=0;for(var t=this.triangles,e=this.vertices,i=0;i!==t.length;i++){var n=t[i],s=e[n[0]],r=e[n[1]],a=e[n[2]],h=o.triangleArea(s,r,a);this.area+=h}},o.prototype.computeAABB=function(t,e,i){t.setFromPoints(this.vertices,e,i,0)};var f=s.create(),g=s.create(),m=s.create();o.prototype.raycast=function(t,e,i,n){var r=f,o=g,a=m,h=this.vertices;s.toLocalFrame(r,e.from,i,n),s.toLocalFrame(o,e.to,i,n);for(var l=h.length,c=0;c=0&&(s.sub(a,d,u),s.rotate(a,a,-Math.PI/2+n),s.normalize(a,a),e.reportIntersection(t,p,a,c))}}},{"../math/polyk":29,"../math/vec2":30,"./Shape":45,"poly-decomp":5}],41:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){if(Array.isArray(arguments[0])){if(t={heights:arguments[0]},"object"==typeof arguments[1])for(var e in arguments[1])t[e]=arguments[1][e];console.warn("The Heightfield constructor signature has changed. Please use the following format: new Heightfield({ heights: [...], ... })")}t=t||{},this.heights=t.heights?t.heights.slice(0):[],this.maxValue=t.maxValue||null,this.minValue=t.minValue||null,this.elementWidth=t.elementWidth||.1,void 0!==t.maxValue&&void 0!==t.minValue||this.updateMaxMinValues(),t.type=n.HEIGHTFIELD,n.call(this,t)}t("../utils/Utils"),e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.updateMaxMinValues=function(){for(var t=this.heights,e=t[0],i=t[0],n=0;n!==t.length;n++){var s=t[n];s>e&&(e=s),sv){var b=y;y=v,v=b}for(var x=0;x=0&&(s.sub(d,f,p),s.rotate(d,d,n+Math.PI/2),s.normalize(d,d),e.reportIntersection(t,w,d,-1),t.shouldStop(e)))return}}},{"../math/vec2":30,"../utils/Utils":57,"./Shape":45}],42:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){"number"==typeof arguments[0]&&(t={length:arguments[0]},console.warn("The Line constructor signature has changed. Please use the following format: new Line({ length: 1, ... })")),t=t||{},this.length=t.length||1,t.type=n.LINE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return t*Math.pow(this.length,2)/12},r.prototype.updateBoundingRadius=function(){this.boundingRadius=this.length/2};var o=[s.create(),s.create()];r.prototype.computeAABB=function(t,e,i){var n=this.length/2;s.set(o[0],-n,0),s.set(o[1],n,0),t.setFromPoints(o,e,i,0)},s.create();var a=s.create(),h=s.create(),l=s.create(),c=s.fromValues(0,1);r.prototype.raycast=function(t,e,i,n){var r=e.from,o=e.to,u=h,d=l,p=this.length/2;s.set(u,-p,0),s.set(d,p,0),s.toGlobalFrame(u,u,i,n),s.toGlobalFrame(d,d,i,n);var f=s.getLineSegmentsIntersectionFraction(u,d,r,o);if(f>=0){var g=a;s.rotate(g,c,n),e.reportIntersection(t,f,g,-1)}}},{"../math/vec2":30,"./Shape":45}],43:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){(t=t||{}).type=n.PARTICLE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return 0},r.prototype.updateBoundingRadius=function(){this.boundingRadius=0},r.prototype.computeAABB=function(t,e,i){s.copy(t.lowerBound,e),s.copy(t.upperBound,e)}},{"../math/vec2":30,"./Shape":45}],44:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){(t=t||{}).type=n.PLANE,n.call(this,t)}t("../utils/Utils"),e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return 0},r.prototype.updateBoundingRadius=function(){this.boundingRadius=Number.MAX_VALUE},r.prototype.computeAABB=function(t,e,i){var n=i%(2*Math.PI),r=s.set,o=1e7,a=t.lowerBound,h=t.upperBound;r(a,-o,-o),r(h,o,o),0===n?h[1]=0:n===Math.PI/2?a[0]=0:n===Math.PI?a[1]=0:n===3*Math.PI/2&&(h[0]=0)},r.prototype.updateArea=function(){this.area=Number.MAX_VALUE};var o=s.create(),a=(s.create(),s.create(),s.create()),h=s.create();r.prototype.raycast=function(t,e,i,n){var r=e.from,l=e.to,c=e.direction,u=o,d=a,p=h;s.set(d,0,1),s.rotate(d,d,n),s.sub(p,r,i);var f=s.dot(p,d);if(s.sub(p,l,i),!(f*s.dot(p,d)>0||s.squaredDistance(r,l)p*a&&(g=p*a-u),r[t]+=g,e.addToWlambda(g),g}},{"../equations/FrictionEquation":23,"../math/vec2":30,"../utils/Utils":57,"./Solver":47}],47:[function(t,e,i){t("../utils/Utils");var n=t("../events/EventEmitter");function s(t,e){t=t||{},n.call(this),this.type=e,this.equations=[],this.equationSortFunction=t.equationSortFunction||!1}e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.prototype.solve=function(t,e){throw new Error("Solver.solve should be implemented by subclasses!")};var r={bodies:[]};s.prototype.solveIsland=function(t,e){this.removeAllEquations(),e.equations.length&&(this.addEquations(e.equations),r.bodies.length=0,e.getBodies(r.bodies),r.bodies.length&&this.solve(t,r))},s.prototype.sortEquations=function(){this.equationSortFunction&&this.equations.sort(this.equationSortFunction)},s.prototype.addEquation=function(t){t.enabled&&this.equations.push(t)},s.prototype.addEquations=function(t){for(var e=0,i=t.length;e!==i;e++){var n=t[e];n.enabled&&this.equations.push(n)}},s.prototype.removeEquation=function(t){var e=this.equations.indexOf(t);-1!==e&&this.equations.splice(e,1)},s.prototype.removeAllEquations=function(){this.equations.length=0},s.GS=1,s.ISLAND=2},{"../events/EventEmitter":26,"../utils/Utils":57}],48:[function(t,e,i){var n=t("../equations/ContactEquation"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=null,this}},{"../equations/ContactEquation":21,"./Pool":55}],49:[function(t,e,i){var n=t("../equations/FrictionEquation"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=null,this}},{"../equations/FrictionEquation":23,"./Pool":55}],50:[function(t,e,i){var n=t("../world/IslandNode"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.reset(),this}},{"../world/IslandNode":60,"./Pool":55}],51:[function(t,e,i){var n=t("../world/Island"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.reset(),this}},{"../world/Island":58,"./Pool":55}],52:[function(t,e,i){var n=t("./TupleDictionary"),s=(t("./OverlapKeeperRecord"),t("./OverlapKeeperRecordPool"));function r(){this.overlappingShapesLastState=new n,this.overlappingShapesCurrentState=new n,this.recordPool=new s({size:16}),this.tmpDict=new n,this.tmpArray1=[]}t("./Utils"),e.exports=r,r.prototype.tick=function(){for(var t=this.overlappingShapesLastState,e=this.overlappingShapesCurrentState,i=t.keys.length;i--;){var n=t.keys[i],s=t.getByKey(n);e.getByKey(n),s&&this.recordPool.release(s)}t.reset(),t.copy(e),e.reset()},r.prototype.setOverlapping=function(t,e,i,n){this.overlappingShapesLastState;var s=this.overlappingShapesCurrentState;if(!s.get(e.id,n.id)){var r=this.recordPool.get();r.set(t,e,i,n),s.set(e.id,n.id,r)}},r.prototype.getNewOverlaps=function(t){return this.getDiff(this.overlappingShapesLastState,this.overlappingShapesCurrentState,t)},r.prototype.getEndOverlaps=function(t){return this.getDiff(this.overlappingShapesCurrentState,this.overlappingShapesLastState,t)},r.prototype.bodiesAreOverlapping=function(t,e){for(var i=this.overlappingShapesCurrentState,n=i.keys.length;n--;){var s=i.keys[n],r=i.data[s];if(r.bodyA===t&&r.bodyB===e||r.bodyA===e&&r.bodyB===t)return!0}return!1},r.prototype.getDiff=function(t,e,i){var n=t,s=e;(i=i||[]).length=0;for(var r=s.keys.length;r--;){var o=s.keys[r],a=s.data[o];if(!a)throw new Error("Key "+o+" had no data!");n.data[o]||i.push(a)}return i},r.prototype.isNewOverlap=function(t,e){var i=0|t.id,n=0|e.id,s=this.overlappingShapesLastState,r=this.overlappingShapesCurrentState;return!s.get(i,n)&&!!r.get(i,n)},r.prototype.getNewBodyOverlaps=function(t){this.tmpArray1.length=0;var e=this.getNewOverlaps(this.tmpArray1);return this.getBodyDiff(e,t)},r.prototype.getEndBodyOverlaps=function(t){this.tmpArray1.length=0;var e=this.getEndOverlaps(this.tmpArray1);return this.getBodyDiff(e,t)},r.prototype.getBodyDiff=function(t,e){e=e||[];for(var i=this.tmpDict,n=t.length;n--;){var s=t[n];i.set(0|s.bodyA.id,0|s.bodyB.id,s)}for(n=i.keys.length;n--;)(s=i.getByKey(i.keys[n]))&&e.push(s.bodyA,s.bodyB);return i.reset(),e}},{"./OverlapKeeperRecord":53,"./OverlapKeeperRecordPool":54,"./TupleDictionary":56,"./Utils":57}],53:[function(t,e,i){function n(t,e,i,n){this.shapeA=e,this.shapeB=n,this.bodyA=t,this.bodyB=i}e.exports=n,n.prototype.set=function(t,e,i,s){n.call(this,t,e,i,s)}},{}],54:[function(t,e,i){var n=t("./OverlapKeeperRecord"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=t.shapeA=t.shapeB=null,this}},{"./OverlapKeeperRecord":53,"./Pool":55}],55:[function(t,e,i){function n(t){t=t||{},this.objects=[],void 0!==t.size&&this.resize(t.size)}e.exports=n,n.prototype.resize=function(t){for(var e=this.objects;e.length>t;)e.pop();for(;e.length(0|e)?t<<16|65535&e:e<<16|65535&t)},s.prototype.getByKey=function(t){return t|=0,this.data[t]},s.prototype.get=function(t,e){return this.data[this.getKey(t,e)]},s.prototype.set=function(t,e,i){if(!i)throw new Error("No data!");var n=this.getKey(t,e);return this.data[n]||this.keys.push(n),this.data[n]=i,n},s.prototype.reset=function(){for(var t=this.data,e=this.keys,i=e.length;i--;)delete t[e[i]];e.length=0},s.prototype.copy=function(t){this.reset(),n.appendArray(this.keys,t.keys);for(var e=t.keys.length;e--;){var i=t.keys[e];this.data[i]=t.data[i]}}},{"./Utils":57}],57:[function(t,e,i){function n(){}e.exports=n,n.appendArray=function(t,e){if(e.length<15e4)t.push.apply(t,e);else for(var i=0,n=e.length;i!==n;++i)t.push(e[i])},n.splice=function(t,e,i){i=i||1;for(var n=e,s=t.length-i;n=t&&n=0;m-=2)for(var S=_.length-2;S>=0;S-=2)(T[m]===_[S]&&T[m+1]===_[S+1]||T[m+1]===_[S]&&T[m]===_[S+1])&&_.splice(S,2);var P=c.length;for(m=0;m!==P;m++){var A=c[m];if(!A.collideConnected)for(S=_.length-2;S>=0;S-=2)(A.bodyA===_[S]&&A.bodyB===_[S+1]||A.bodyB===_[S]&&A.bodyA===_[S+1])&&_.splice(S,2)}this.postBroadphaseEvent.pairs=_,this.emit(this.postBroadphaseEvent),this.postBroadphaseEvent.pairs=null,l.reset(this),m=0;for(var E=_.length;m!==E;m+=2)for(var M=_[m],k=_[m+1],L=0,O=M.shapes.length;L!==O;L++)for(var I=M.shapes[L],B=I.position,R=I.angle,F=0,D=k.shapes.length;F!==D;F++){var U=k.shapes[F],G=U.position,N=U.angle,j=this.defaultContactMaterial;if(I.material&&U.material){var W=this.getContactMaterial(I.material,U.material);W&&(j=W)}this.runNarrowphase(l,M,I,B,R,k,U,G,N,j,this.frictionGravity)}for(m=0;m!==a;m++)(q=n[m])._wakeUpAfterNarrowphase&&(q.wakeUp(),q._wakeUpAfterNarrowphase=!1);if(this.has("endContact")){this.overlapKeeper.getEndOverlaps(C);var X=this.endContactEvent;for(F=C.length;F--;){var V=C[F];X.shapeA=V.shapeA,X.shapeB=V.shapeB,X.bodyA=V.bodyA,X.bodyB=V.bodyB,this.emit(X)}C.length=0}var H=this.preSolveEvent;for(H.contactEquations=l.contactEquations,H.frictionEquations=l.frictionEquations,this.emit(H),H.contactEquations=H.frictionEquations=null,P=c.length,m=0;m!==P;m++)c[m].update();if(l.contactEquations.length||l.frictionEquations.length||P)if(this.islandSplit){for(f.equations.length=0,y.appendArray(f.equations,l.contactEquations),y.appendArray(f.equations,l.frictionEquations),m=0;m!==P;m++)y.appendArray(f.equations,c[m].equations);for(f.split(this),m=0;m!==f.islands.length;m++)(K=f.islands[m]).equations.length&&o.solveIsland(t,K)}else{for(o.addEquations(l.contactEquations),o.addEquations(l.frictionEquations),m=0;m!==P;m++)o.addEquations(c[m].equations);this.solveConstraints&&o.solve(t,this),o.removeAllEquations()}for(m=0;m!==a;m++){var q;(q=n[m]).integrate(t)}for(m=0;m!==a;m++)n[m].setZeroForce();if(this.emitImpactEvent&&this.has("impact")){var Y=this.impactEvent;for(m=0;m!==l.contactEquations.length;m++){var z=l.contactEquations[m];z.firstImpact&&(Y.bodyA=z.bodyA,Y.bodyB=z.bodyB,Y.shapeA=z.shapeA,Y.shapeB=z.shapeB,Y.contactEquation=z,this.emit(Y))}}if(this.sleepMode===x.BODY_SLEEPING)for(m=0;m!==a;m++)n[m].sleepTick(this.time,!1,t);else if(this.sleepMode===x.ISLAND_SLEEPING&&this.islandSplit){for(m=0;m!==a;m++)n[m].sleepTick(this.time,!0,t);for(m=0;m0,t.frictionCoefficient=c.friction,p=e.type===u.STATIC||e.type===u.KINEMATIC?o.mass:o.type===u.STATIC||o.type===u.KINEMATIC?e.mass:e.mass*o.mass/(e.mass+o.mass),t.slipForce=c.friction*d*p,t.restitution=c.restitution,t.surfaceVelocity=c.surfaceVelocity,t.frictionStiffness=c.frictionStiffness,t.frictionRelaxation=c.frictionRelaxation,t.stiffness=c.stiffness,t.relaxation=c.relaxation,t.contactSkinSize=c.contactSkinSize,t.enabledEquations=e.collisionResponse&&o.collisionResponse&&i.collisionResponse&&a.collisionResponse;var m=t[i.type|a.type],y=0;if(m){var v=i.sensor||a.sensor,b=t.frictionEquations.length;y=i.type=2*Math.pow(o.sleepSpeedLimit,2)&&(e._wakeUpAfterNarrowphase=!0),o.allowSleep&&o.type===u.DYNAMIC&&o.sleepState===u.SLEEPING&&e.sleepState===u.AWAKE&&e.type!==u.STATIC&&s.squaredLength(e.velocity)+Math.pow(e.angularVelocity,2)>=2*Math.pow(e.sleepSpeedLimit,2)&&(o._wakeUpAfterNarrowphase=!0),this.overlapKeeper.setOverlapping(e,i,o,a),this.has("beginContact")&&this.overlapKeeper.isNewOverlap(i,a)){var w=this.beginContactEvent;if(w.shapeA=i,w.shapeB=a,w.bodyA=e,w.bodyB=o,w.contactEquations.length=0,"number"==typeof y)for(var C=t.contactEquations.length-y;C1)for(C=t.frictionEquations.length-x;C=0;e--)this.removeConstraint(t[e]);var i=this.bodies;for(e=i.length-1;e>=0;e--)this.removeBody(i[e]);var n=this.springs;for(e=n.length-1;e>=0;e--)this.removeSpring(n[e]);var s=this.contactMaterials;for(e=s.length-1;e>=0;e--)this.removeContactMaterial(s[e]);x.apply(this)};var S=s.create(),P=(s.fromValues(0,0),s.fromValues(0,0));x.prototype.hitTest=function(t,e,i){i=i||0;var n=new u({position:t}),c=new l,d=t,p=0,f=S,g=P;n.addShape(c);for(var m=this.narrowphase,y=[],v=0,b=e.length;v!==b;v++)for(var x=e[v],w=0,_=x.shapes.length;w!==_;w++){var T=x.shapes[w];s.rotate(f,T.position,x.angle),s.add(f,f,x.position);var C=T.angle+x.angle;(T instanceof r&&m.circleParticle(x,T,f,C,n,c,d,p,!0)||T instanceof o&&m.particleConvex(n,c,d,p,x,T,f,C,!0)||T instanceof a&&m.particlePlane(n,c,d,p,x,T,f,C,!0)||T instanceof h&&m.particleCapsule(n,c,d,p,x,T,f,C,!0)||T instanceof l&&s.squaredLength(s.sub(g,f,t)) * @copyright 2020 Photon Storm Ltd. @@ -41,7 +19,7 @@ i.DisplayObject=function(){this.position=new i.Point(0,0),this.scale=new i.Point * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -(function(){var n,s=s||{VERSION:"2.16.0",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGL_MULTI:4,NONE:0,LEFT:1,RIGHT:2,UP:3,DOWN:4,SPRITE:0,BUTTON:1,IMAGE:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11,POLYGON:12,BITMAPDATA:13,CANVAS_FILTER:14,WEBGL_FILTER:15,ELLIPSE:16,SPRITEBATCH:17,RETROFONT:18,POINTER:19,ROPE:20,CIRCLE:21,RECTANGLE:22,LINE:23,MATRIX:24,POINT:25,ROUNDEDRECTANGLE:26,CREATURE:27,VIDEO:28,PENDING_ATLAS:-1,HORIZONTAL:0,VERTICAL:1,LANDSCAPE:0,PORTRAIT:1,ANGLE_UP:270,ANGLE_DOWN:90,ANGLE_LEFT:180,ANGLE_RIGHT:0,ANGLE_NORTH_EAST:315,ANGLE_NORTH_WEST:225,ANGLE_SOUTH_EAST:45,ANGLE_SOUTH_WEST:135,TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12,blendModes:{NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},scaleModes:{DEFAULT:0,LINEAR:0,NEAREST:1},PIXI:PIXI||{},_UID:0}; +(function(){var i,n=n||{VERSION:"2.16.0",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGL_MULTI:4,NONE:0,LEFT:1,RIGHT:2,UP:3,DOWN:4,SPRITE:0,BUTTON:1,IMAGE:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11,POLYGON:12,BITMAPDATA:13,CANVAS_FILTER:14,WEBGL_FILTER:15,ELLIPSE:16,SPRITEBATCH:17,RETROFONT:18,POINTER:19,ROPE:20,CIRCLE:21,RECTANGLE:22,LINE:23,MATRIX:24,POINT:25,ROUNDEDRECTANGLE:26,CREATURE:27,VIDEO:28,PENDING_ATLAS:-1,HORIZONTAL:0,VERTICAL:1,LANDSCAPE:0,PORTRAIT:1,ANGLE_UP:270,ANGLE_DOWN:90,ANGLE_LEFT:180,ANGLE_RIGHT:0,ANGLE_NORTH_EAST:315,ANGLE_NORTH_WEST:225,ANGLE_SOUTH_EAST:45,ANGLE_SOUTH_WEST:135,TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12,blendModes:{NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},scaleModes:{DEFAULT:0,LINEAR:0,NEAREST:1},PIXI:PIXI||{},_UID:0}; /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. @@ -51,415 +29,415 @@ i.DisplayObject=function(){this.position=new i.Point(0,0),this.scale=new i.Point * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -"undefined"!=typeof AudioBufferSourceNode&&(AudioBufferSourceNode.prototype.start||(AudioBufferSourceNode.prototype.start=AudioBufferSourceNode.prototype.noteGrainOn),AudioBufferSourceNode.prototype.stop||(AudioBufferSourceNode.prototype.stop=AudioBufferSourceNode.prototype.noteOff)),Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Function.prototype.bind||(Function.prototype.bind=(n=Array.prototype.slice,function(t){var e=this,i=n.call(arguments,1);if("function"!=typeof e)throw new TypeError;function s(){var r=i.concat(n.call(arguments));e.apply(this instanceof s?this:t,r)}return s.prototype=function t(e){if(e&&(t.prototype=e),!(this instanceof t))return new t}(e.prototype),s})),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t){"use strict";if(null==this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */,s.Utils={defaults:function(t,e){for(var i=Object.keys(e),n=0,s=i.length;n0&&100*Math.random()<=t},randomChoice:function(t,e){return Math.random()<.5?t:e},parseDimension:function(t,e){var i=0,n=0;return"string"==typeof t?"%"===t.substr(-1)?(i=parseInt(t,10)/100,n=0===e?window.innerWidth*i:window.innerHeight*i):n=parseInt(t,10):n=t,n},pad:function(t,e,i,n){if(void 0===e)e=0;if(void 0===i)i=" ";if(void 0===n)n=3;var s=0;if(e+1>=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t},isPlainObject:function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},extend:function(){var t,e,i,n,r,o,a=arguments[0]||{},h=1,l=arguments.length,u=!1;for("boolean"==typeof a&&(u=a,a=arguments[1]||{},h=2),l===h&&(a=this,--h);h0&&100*Math.random()<=t},randomChoice:function(t,e){return Math.random()<.5?t:e},parseDimension:function(t,e){var i=0,n=0;return"string"==typeof t?"%"===t.substr(-1)?(i=parseInt(t,10)/100,n=0===e?window.innerWidth*i:window.innerHeight*i):n=parseInt(t,10):n=t,n},pad:function(t,e,i,n){if(void 0===e)e=0;if(void 0===i)i=" ";if(void 0===n)n=3;var s=0;if(e+1>=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t},isPlainObject:function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},extend:function(){var t,e,i,s,r,o,a=arguments[0]||{},h=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},h=2),l===h&&(a=this,--h);h * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Circle=function(t,e,i){t=t||0,e=e||0,i=i||0,this.x=t,this.y=e,this._diameter=i,this._radius=0,i>0&&(this._radius=.5*i),this.type=s.CIRCLE},s.Circle.prototype={circumference:function(){return Math.PI*this._radius*2},random:function(t){void 0===t&&(t=new s.Point);var e=2*Math.PI*Math.random(),i=Math.random()+Math.random(),n=i>1?2-i:i,r=n*Math.cos(e),o=n*Math.sin(e);return t.x=this.x+r*this.radius,t.y=this.y+o*this.radius,t},getBounds:function(){return new s.Rectangle(this.x-this.radius,this.y-this.radius,this.diameter,this.diameter)},setTo:function(t,e,i){return this.x=t,this.y=e,this._diameter=i,this._radius=.5*i,this},copyFrom:function(t){return this.setTo(t.x,t.y,t.diameter)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.diameter=this._diameter,t},distance:function(t,e){var i=s.Math.distance(this.x,this.y,t.x,t.y);return e?Math.round(i):i},clone:function(t){return null==t?t=new s.Circle(this.x,this.y,this.diameter):t.setTo(this.x,this.y,this.diameter),t},contains:function(t,e){return s.Circle.contains(this,t,e)},circumferencePoint:function(t,e,i){return s.Circle.circumferencePoint(this,t,e,i)},sample:function(t,e,i,n,r){t||(t=60),null==e&&(e=0),null==i&&(i=s.Math.PI2),r||(r=[]);for(var o=0;o0&&(this._diameter=t,this._radius=.5*t)}}),Object.defineProperty(s.Circle.prototype,"radius",{get:function(){return this._radius},set:function(t){t>0&&(this._radius=t,this._diameter=2*t)}}),Object.defineProperty(s.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(t){t>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-t}}),Object.defineProperty(s.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(t){tthis.y?(this._radius=0,this._diameter=0):this.radius=this.y-t}}),Object.defineProperty(s.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(t){t0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(s.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(t){!0===t&&this.setTo(0,0,0)}}),s.Circle.contains=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius},s.Circle.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.diameter===e.diameter},s.Circle.intersects=function(t,e){return s.Math.distance(t.x,t.y,e.x,e.y)<=t.radius+e.radius},s.Circle.circumferencePoint=function(t,e,i,n){return void 0===i&&(i=!1),void 0===n&&(n=new s.Point),!0===i&&(e=s.Math.degToRad(e)),n.x=t.x+t.radius*Math.cos(e),n.y=t.y+t.radius*Math.sin(e),n},s.Circle.intersectsRectangle=function(t,e){var i=Math.abs(t.x-e.x-e.halfWidth);if(i>e.halfWidth+t.radius)return!1;var n=Math.abs(t.y-e.y-e.halfHeight);if(n>e.halfHeight+t.radius)return!1;if(i<=e.halfWidth||n<=e.halfHeight)return!0;var s=i-e.halfWidth,r=n-e.halfHeight;return s*s+r*r<=t.radius*t.radius},s.Circle.intersectsLine=function(t,e,i){var n=t.x,r=t.y,o=(e.end.y-e.start.y)/(e.end.x-e.start.x),a=e.end.y-o*e.end.x,h=t.radius,l=t.radius,u=a+o*n,c=(n*(l*l)-o*(h*h)*(a-r)+h*l*Math.sqrt(h*h*(o*o)+l*l-u*u-r*r+2*u*r))/(h*h*(o*o)+l*l),d=(n*(l*l)-o*(h*h)*(a-r)-h*l*Math.sqrt(h*h*(o*o)+l*l-u*u-r*r+2*u*r))/(h*h*(o*o)+l*l),p=o*c+a,f=o*d+a,g=new s.Point(c,p),m=new s.Point(d,f),y=e.pointOnSegment(g.x,g.y,.01),v=e.pointOnSegment(m.x,m.y,.01);return y&&v?!i||[g,m]:y?!i||[g]:v?!i||[m]:!!i&&[]},PIXI.Circle=s.Circle, +n.Circle=function(t,e,i){t=t||0,e=e||0,i=i||0,this.x=t,this.y=e,this._diameter=i,this._radius=0,i>0&&(this._radius=.5*i),this.type=n.CIRCLE},n.Circle.prototype={circumference:function(){return Math.PI*this._radius*2},random:function(t){void 0===t&&(t=new n.Point);var e=2*Math.PI*Math.random(),i=Math.random()+Math.random(),s=i>1?2-i:i,r=s*Math.cos(e),o=s*Math.sin(e);return t.x=this.x+r*this.radius,t.y=this.y+o*this.radius,t},getBounds:function(){return new n.Rectangle(this.x-this.radius,this.y-this.radius,this.diameter,this.diameter)},setTo:function(t,e,i){return this.x=t,this.y=e,this._diameter=i,this._radius=.5*i,this},copyFrom:function(t){return this.setTo(t.x,t.y,t.diameter)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.diameter=this._diameter,t},distance:function(t,e){var i=n.Math.distance(this.x,this.y,t.x,t.y);return e?Math.round(i):i},clone:function(t){return null==t?t=new n.Circle(this.x,this.y,this.diameter):t.setTo(this.x,this.y,this.diameter),t},contains:function(t,e){return n.Circle.contains(this,t,e)},circumferencePoint:function(t,e,i){return n.Circle.circumferencePoint(this,t,e,i)},sample:function(t,e,i,s,r){t||(t=60),null==e&&(e=0),null==i&&(i=n.Math.PI2),r||(r=[]);for(var o=0;o0&&(this._diameter=t,this._radius=.5*t)}}),Object.defineProperty(n.Circle.prototype,"radius",{get:function(){return this._radius},set:function(t){t>0&&(this._radius=t,this._diameter=2*t)}}),Object.defineProperty(n.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(t){t>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-t}}),Object.defineProperty(n.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(t){tthis.y?(this._radius=0,this._diameter=0):this.radius=this.y-t}}),Object.defineProperty(n.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(t){t0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(n.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(t){!0===t&&this.setTo(0,0,0)}}),n.Circle.contains=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius},n.Circle.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.diameter===e.diameter},n.Circle.intersects=function(t,e){return n.Math.distance(t.x,t.y,e.x,e.y)<=t.radius+e.radius},n.Circle.circumferencePoint=function(t,e,i,s){return void 0===i&&(i=!1),void 0===s&&(s=new n.Point),!0===i&&(e=n.Math.degToRad(e)),s.x=t.x+t.radius*Math.cos(e),s.y=t.y+t.radius*Math.sin(e),s},n.Circle.intersectsRectangle=function(t,e){var i=Math.abs(t.x-e.x-e.halfWidth);if(i>e.halfWidth+t.radius)return!1;var n=Math.abs(t.y-e.y-e.halfHeight);if(n>e.halfHeight+t.radius)return!1;if(i<=e.halfWidth||n<=e.halfHeight)return!0;var s=i-e.halfWidth,r=n-e.halfHeight;return s*s+r*r<=t.radius*t.radius},n.Circle.intersectsLine=function(t,e,i){var s=t.x,r=t.y,o=(e.end.y-e.start.y)/(e.end.x-e.start.x),a=e.end.y-o*e.end.x,h=t.radius,l=t.radius,c=a+o*s,u=(s*(l*l)-o*(h*h)*(a-r)+h*l*Math.sqrt(h*h*(o*o)+l*l-c*c-r*r+2*c*r))/(h*h*(o*o)+l*l),d=(s*(l*l)-o*(h*h)*(a-r)-h*l*Math.sqrt(h*h*(o*o)+l*l-c*c-r*r+2*c*r))/(h*h*(o*o)+l*l),p=o*u+a,f=o*d+a,g=new n.Point(u,p),m=new n.Point(d,f),y=e.pointOnSegment(g.x,g.y,.01),v=e.pointOnSegment(m.x,m.y,.01);return y&&v?!i||[g,m]:y?!i||[g]:v?!i||[m]:!!i&&[]},PIXI.Circle=n.Circle, /** * @author Richard Davey * @author Chad Engler * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Ellipse=function(t,e,i,n){t=t||0,e=e||0,i=i||0,n=n||0,this.x=t,this.y=e,this.width=i,this.height=n,this.type=s.ELLIPSE},s.Ellipse.prototype={setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},getBounds:function(){return new s.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},copyFrom:function(t){return this.setTo(t.x,t.y,t.width,t.height)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},clone:function(t){return null==t?t=new s.Ellipse(this.x,this.y,this.width,this.height):t.setTo(this.x,this.y,this.width,this.height),t},contains:function(t,e){return s.Ellipse.contains(this,t,e)},random:function(t){void 0===t&&(t=new s.Point);var e=Math.random()*Math.PI*2,i=Math.sqrt(Math.random());return t.x=this.centerX+.5*i*Math.cos(e)*this.width,t.y=this.centerY+.5*i*Math.sin(e)*this.height,t},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},s.Ellipse.prototype.constructor=s.Ellipse,Object.defineProperty(s.Ellipse.prototype,"left",{get:function(){return this.x},set:function(t){this.x=t}}),Object.defineProperty(s.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Line=function(t,e,i,n){t=t||0,e=e||0,i=i||0,n=n||0,this.start=new s.Point(t,e),this.end=new s.Point(i,n),this.type=s.LINE},s.Line.prototype={setTo:function(t,e,i,n){return this.start.setTo(t,e),this.end.setTo(i,n),this},fromPoints:function(t,e){return this.setTo(t.x,t.y,e.x,e.y),this},fromSprite:function(t,e,i){return void 0===i&&(i=!1),i?this.setTo(t.centerX,t.centerY,e.centerX,e.centerY):this.fromPoints(t,e)},fromAngle:function(t,e,i,n){return this.start.setTo(t,e),this.end.setTo(t+Math.cos(i)*n,e+Math.sin(i)*n),this},rotate:function(t,e){var i=(this.start.x+this.end.x)/2,n=(this.start.y+this.end.y)/2;return this.start.rotate(i,n,t,e),this.end.rotate(i,n,t,e),this},rotateAround:function(t,e,i,n){return this.start.rotate(t,e,i,n),this.end.rotate(t,e,i,n),this},intersects:function(t,e,i){return s.Line.intersectsPoints(this.start,this.end,t.start,t.end,e,i)},reflect:function(t){return s.Line.reflect(this,t)},midPoint:function(t){return void 0===t&&(t=new s.Point),t.x=(this.start.x+this.end.x)/2,t.y=(this.start.y+this.end.y)/2,t},centerOn:function(t,e){var i=t-(this.start.x+this.end.x)/2,n=e-(this.start.y+this.end.y)/2;this.start.add(i,n),this.end.add(i,n)},pointOnLine:function(t,e,i){return s.Math.fuzzyEqual((t-this.start.x)*(this.end.y-this.start.y),(this.end.x-this.start.x)*(e-this.start.y),i||0)},pointOnSegment:function(t,e,i){var n=Math.min(this.start.x,this.end.x),s=Math.max(this.start.x,this.end.x),r=Math.min(this.start.y,this.end.y),o=Math.max(this.start.y,this.end.y);return this.pointOnLine(t,e,i)&&t>=n&&t<=s&&e>=r&&e<=o},random:function(t){void 0===t&&(t=new s.Point);var e=Math.random();return t.x=this.start.x+e*(this.end.x-this.start.x),t.y=this.start.y+e*(this.end.y-this.start.y),t},coordinatesOnLine:function(t,e){void 0===t&&(t=1),void 0===e&&(e=[]);var i=Math.round(this.start.x),n=Math.round(this.start.y),s=Math.round(this.end.x),r=Math.round(this.end.y),o=Math.abs(s-i),a=Math.abs(r-n),h=i-a&&(u-=a,i+=h),d=0&&g<=1&&m>=0&&m<=1?o:null}return o},s.Line.intersects=function(t,e,i,n){return s.Line.intersectsPoints(t.start,t.end,e.start,e.end,i,n)},s.Line.intersectsRectangle=function(t,e){if(0===t.length||e.empty)return!1;var i=t.start.x,n=t.start.y,s=t.end.x,r=t.end.y,o=e.x,a=e.y,h=e.right,l=e.bottom,u=0;if(i>=o&&i<=h&&n>=a&&n<=l||s>=o&&s<=h&&r>=a&&r<=l)return!0;if(i=o){if((u=n+(r-n)*(o-i)/(s-i))>a&&u<=l)return!0}else if(i>h&&s<=h&&(u=n+(r-n)*(h-i)/(s-i))>=a&&u<=l)return!0;if(n=a){if((u=i+(s-i)*(a-n)/(r-n))>=o&&u<=h)return!0}else if(n>l&&r<=l&&(u=i+(s-i)*(l-n)/(r-n))>=o&&u<=h)return!0;return!1},s.Line.intersectionWithRectangle=function(t,e,i){var n=s.Line.intersectionWithRectangle;i||(i=new s.Point),n.edges||(n.edges=[new s.Line,new s.Line,new s.Line,new s.Line]),n.edgeIntersection||(n.edgeIntersection=new s.Point);var r=n.edges,o=n.edgeIntersection.set(0),a=e.x,h=e.y,l=e.right,u=e.bottom,c=1/0;r[0].setTo(a,h,l,h),r[1].setTo(a,u,l,u),r[2].setTo(a,h,a,u),r[3].setTo(l,h,l,u);for(var d,p=0;d=r[p];p++)if(t.intersects(d,!0,o)){var f=t.start.distance(o);f=n&&t<=s&&e>=r&&e<=o},random:function(t){void 0===t&&(t=new n.Point);var e=Math.random();return t.x=this.start.x+e*(this.end.x-this.start.x),t.y=this.start.y+e*(this.end.y-this.start.y),t},coordinatesOnLine:function(t,e){void 0===t&&(t=1),void 0===e&&(e=[]);var i=Math.round(this.start.x),n=Math.round(this.start.y),s=Math.round(this.end.x),r=Math.round(this.end.y),o=Math.abs(s-i),a=Math.abs(r-n),h=i-a&&(c-=a,i+=h),d=0&&g<=1&&m>=0&&m<=1?o:null}return o},n.Line.intersects=function(t,e,i,s){return n.Line.intersectsPoints(t.start,t.end,e.start,e.end,i,s)},n.Line.intersectsRectangle=function(t,e){if(0===t.length||e.empty)return!1;var i=t.start.x,n=t.start.y,s=t.end.x,r=t.end.y,o=e.x,a=e.y,h=e.right,l=e.bottom,c=0;if(i>=o&&i<=h&&n>=a&&n<=l||s>=o&&s<=h&&r>=a&&r<=l)return!0;if(i=o){if((c=n+(r-n)*(o-i)/(s-i))>a&&c<=l)return!0}else if(i>h&&s<=h&&(c=n+(r-n)*(h-i)/(s-i))>=a&&c<=l)return!0;if(n=a){if((c=i+(s-i)*(a-n)/(r-n))>=o&&c<=h)return!0}else if(n>l&&r<=l&&(c=i+(s-i)*(l-n)/(r-n))>=o&&c<=h)return!0;return!1},n.Line.intersectionWithRectangle=function(t,e,i){var s=n.Line.intersectionWithRectangle;i||(i=new n.Point),s.edges||(s.edges=[new n.Line,new n.Line,new n.Line,new n.Line]),s.edgeIntersection||(s.edgeIntersection=new n.Point);var r=s.edges,o=s.edgeIntersection.set(0),a=e.x,h=e.y,l=e.right,c=e.bottom,u=1/0;r[0].setTo(a,h,l,h),r[1].setTo(a,c,l,c),r[2].setTo(a,h,a,c),r[3].setTo(l,h,l,c);for(var d,p=0;d=r[p];p++)if(t.intersects(d,!0,o)){var f=t.start.distance(o);f * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Matrix=function(t,e,i,n,r,o){null==t&&(t=1),null==e&&(e=0),null==i&&(i=0),null==n&&(n=1),null==r&&(r=0),null==o&&(o=0),this.a=t,this.b=e,this.c=i,this.d=n,this.tx=r,this.ty=o,this.type=s.MATRIX},s.Matrix.prototype={fromArray:function(t){return this.setTo(t[0],t[1],t[3],t[4],t[2],t[5])},setTo:function(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=r,this},clone:function(t){return null==t?t=new s.Matrix(this.a,this.b,this.c,this.d,this.tx,this.ty):(t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty),t},copyTo:function(t){return t.copyFrom(this),t},copyFrom:function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},toArray:function(t,e){return void 0===e&&(e=new Float32Array(9)),t?(e[0]=this.a,e[1]=this.b,e[2]=0,e[3]=this.c,e[4]=this.d,e[5]=0,e[6]=this.tx,e[7]=this.ty,e[8]=1):(e[0]=this.a,e[1]=this.c,e[2]=this.tx,e[3]=this.b,e[4]=this.d,e[5]=this.ty,e[6]=0,e[7]=0,e[8]=1),e},apply:function(t,e){return void 0===e&&(e=new s.Point),e.x=this.a*t.x+this.c*t.y+this.tx,e.y=this.b*t.x+this.d*t.y+this.ty,e},applyInverse:function(t,e){void 0===e&&(e=new s.Point);var i=1/(this.a*this.d+this.c*-this.b),n=t.x,r=t.y;return e.x=this.d*i*n+-this.c*i*r+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*r+-this.b*i*n+(-this.ty*this.a+this.tx*this.b)*i,e},translate:function(t,e){return this.tx+=t,this.ty+=e,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.a,s=this.c,r=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=r*e-this.ty*i,this.ty=r*i+this.ty*e,this},append:function(t){var e=this.a,i=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this},identity:function(){return this.setTo(1,0,0,1,0,0)}},s.identityMatrix=new s.Matrix, +n.Matrix=function(t,e,i,s,r,o){null==t&&(t=1),null==e&&(e=0),null==i&&(i=0),null==s&&(s=1),null==r&&(r=0),null==o&&(o=0),this.a=t,this.b=e,this.c=i,this.d=s,this.tx=r,this.ty=o,this.type=n.MATRIX},n.Matrix.prototype={fromArray:function(t){return this.setTo(t[0],t[1],t[3],t[4],t[2],t[5])},setTo:function(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=r,this},clone:function(t){return null==t?t=new n.Matrix(this.a,this.b,this.c,this.d,this.tx,this.ty):(t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty),t},copyTo:function(t){return t.copyFrom(this),t},copyFrom:function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},toArray:function(t,e){return void 0===e&&(e=new Float32Array(9)),t?(e[0]=this.a,e[1]=this.b,e[2]=0,e[3]=this.c,e[4]=this.d,e[5]=0,e[6]=this.tx,e[7]=this.ty,e[8]=1):(e[0]=this.a,e[1]=this.c,e[2]=this.tx,e[3]=this.b,e[4]=this.d,e[5]=this.ty,e[6]=0,e[7]=0,e[8]=1),e},apply:function(t,e){return void 0===e&&(e=new n.Point),e.x=this.a*t.x+this.c*t.y+this.tx,e.y=this.b*t.x+this.d*t.y+this.ty,e},applyInverse:function(t,e){void 0===e&&(e=new n.Point);var i=1/(this.a*this.d+this.c*-this.b),s=t.x,r=t.y;return e.x=this.d*i*s+-this.c*i*r+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*r+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e},translate:function(t,e){return this.tx+=t,this.ty+=e,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.a,s=this.c,r=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=r*e-this.ty*i,this.ty=r*i+this.ty*e,this},append:function(t){var e=this.a,i=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this},identity:function(){return this.setTo(1,0,0,1,0,0)}},n.identityMatrix=new n.Matrix, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Point=function(t,e){t=t||0,e=e||0,this.x=t,this.y=e,this.type=s.POINT},s.Point.prototype={copyFrom:function(t){return this.setTo(t.x,t.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(t,e){return s.Point.set(this,t,e)},set:function(t,e){return s.Point.set(this,t,e)},setToPolar:function(t,e,i){return null==e&&(e=1),i&&(t=s.Math.degToRad(t)),this.setTo(Math.cos(t)*e,Math.sin(t)*e)},add:function(t,e){return this.x+=t,this.y+=e,this},subtract:function(t,e){return this.x-=t,this.y-=e,this},multiply:function(t,e){return this.x*=t,this.y*=e,this},divide:function(t,e){return this.x/=t,this.y/=e,this},clampX:function(t,e){return this.x=s.Math.clamp(this.x,t,e),this},clampY:function(t,e){return this.y=s.Math.clamp(this.y,t,e),this},clamp:function(t,e){return this.x=s.Math.clamp(this.x,t,e),this.y=s.Math.clamp(this.y,t,e),this},clip:function(t){var e=t.left,i=t.top,n=t.right,s=t.bottom;return this.xn&&(this.x=n),this.ys&&(this.y=s),this},clone:function(t){return null==t?t=new s.Point(this.x,this.y):t.setTo(this.x,this.y),t},copyTo:function(t){return t.x=this.x,t.y=this.y,t},distance:function(t,e){return s.Point.distance(this,t,e)},equals:function(t){return t.x===this.x&&t.y===this.y},equalsXY:function(t,e){return this.x===t&&this.y===e},fuzzyEquals:function(t,e){return s.Point.fuzzyEquals(this,t,e)},fuzzyEqualsXY:function(t,e,i){return s.Point.fuzzyEqualsXY(this,t,e,i)},angle:function(t,e){return this.angleXY(t.x,t.y,e)},angleXY:function(t,e,i){var n=Math.atan2(e-this.y,t-this.x);return i?s.Math.radToDeg(n):n},atan:function(t){var e=Math.atan2(this.y,this.x);return t?s.Math.radToDeg(e):e},rotate:function(t,e,i,n,r){return s.Point.rotate(this,t,e,i,n,r)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},getMagnitudeSq:function(){return this.x*this.x+this.y*this.y},setMagnitude:function(t){return this.normalize().multiply(t,t)},normalize:function(){if(!this.isZero()){var t=this.getMagnitude();this.x/=t,this.y/=t}return this},limit:function(t){return this.getMagnitudeSq()>t*t&&this.setMagnitude(t),this},expand:function(t){return this.getMagnitudeSq()=0&&e.x-i<0)return-1;if(t.x-i<0&&e.x-i>=0)return 1;if(t.x-i==0&&e.x-i==0)return t.y-n>=0||e.y-n>=0?t.y>e.y?1:-1:e.y>t.y?1:-1;var s=(t.x-i)*-(e.y-n)-(e.x-i)*-(t.y-n);return s<0?-1:s>0?1:(t.x-i)*(t.x-i)+(t.y-n)*(t.y-n)>(e.x-i)*(e.x-i)+(e.y-n)*(e.y-n)?-1:1}))},PIXI.Point=s.Point, +n.Point=function(t,e){t=t||0,e=e||0,this.x=t,this.y=e,this.type=n.POINT},n.Point.prototype={copyFrom:function(t){return this.setTo(t.x,t.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(t,e){return n.Point.set(this,t,e)},set:function(t,e){return n.Point.set(this,t,e)},setToPolar:function(t,e,i){return null==e&&(e=1),i&&(t=n.Math.degToRad(t)),this.setTo(Math.cos(t)*e,Math.sin(t)*e)},add:function(t,e){return this.x+=t,this.y+=e,this},subtract:function(t,e){return this.x-=t,this.y-=e,this},multiply:function(t,e){return this.x*=t,this.y*=e,this},divide:function(t,e){return this.x/=t,this.y/=e,this},clampX:function(t,e){return this.x=n.Math.clamp(this.x,t,e),this},clampY:function(t,e){return this.y=n.Math.clamp(this.y,t,e),this},clamp:function(t,e){return this.x=n.Math.clamp(this.x,t,e),this.y=n.Math.clamp(this.y,t,e),this},clip:function(t){var e=t.left,i=t.top,n=t.right,s=t.bottom;return this.xn&&(this.x=n),this.ys&&(this.y=s),this},clone:function(t){return null==t?t=new n.Point(this.x,this.y):t.setTo(this.x,this.y),t},copyTo:function(t){return t.x=this.x,t.y=this.y,t},distance:function(t,e){return n.Point.distance(this,t,e)},equals:function(t){return t.x===this.x&&t.y===this.y},equalsXY:function(t,e){return this.x===t&&this.y===e},fuzzyEquals:function(t,e){return n.Point.fuzzyEquals(this,t,e)},fuzzyEqualsXY:function(t,e,i){return n.Point.fuzzyEqualsXY(this,t,e,i)},angle:function(t,e){return this.angleXY(t.x,t.y,e)},angleXY:function(t,e,i){var s=Math.atan2(e-this.y,t-this.x);return i?n.Math.radToDeg(s):s},atan:function(t){var e=Math.atan2(this.y,this.x);return t?n.Math.radToDeg(e):e},rotate:function(t,e,i,s,r){return n.Point.rotate(this,t,e,i,s,r)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},getMagnitudeSq:function(){return this.x*this.x+this.y*this.y},setMagnitude:function(t){return this.normalize().multiply(t,t)},normalize:function(){if(!this.isZero()){var t=this.getMagnitude();this.x/=t,this.y/=t}return this},limit:function(t){return this.getMagnitudeSq()>t*t&&this.setMagnitude(t),this},expand:function(t){return this.getMagnitudeSq()=0&&e.x-i<0)return-1;if(t.x-i<0&&e.x-i>=0)return 1;if(t.x-i==0&&e.x-i==0)return t.y-n>=0||e.y-n>=0?t.y>e.y?1:-1:e.y>t.y?1:-1;var s=(t.x-i)*-(e.y-n)-(e.x-i)*-(t.y-n);return s<0?-1:s>0?1:(t.x-i)*(t.x-i)+(t.y-n)*(t.y-n)>(e.x-i)*(e.x-i)+(e.y-n)*(e.y-n)?-1:1}))},PIXI.Point=n.Point, /** * @author Richard Davey * @author Adrien Brault * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Polygon=function(){this.area=0,this._points=[],arguments.length>0&&this.setTo.apply(this,arguments),this.closed=!0,this.flattened=!1,this.type=s.POLYGON},s.Polygon.prototype={toNumberArray:function(t){void 0===t&&(t=[]);for(var e=0;e0){Array.isArray(t)||(t=Array.prototype.slice.call(arguments));for(var e=Number.MAX_VALUE,i=0,n=t.length;i0&&this.setTo.apply(this,arguments),this.closed=!0,this.flattened=!1,this.type=n.POLYGON},n.Polygon.prototype={toNumberArray:function(t){void 0===t&&(t=[]);for(var e=0;e0){Array.isArray(t)||(t=Array.prototype.slice.call(arguments));for(var e=Number.MAX_VALUE,i=0,n=t.length;i * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Rectangle=function(t,e,i,n){t=t||0,e=e||0,i=i||0,n=n||0,this.x=t,this.y=e,this.width=i,this.height=n,this.type=s.RECTANGLE},s.Rectangle.prototype={offset:function(t,e){return this.x+=t,this.y+=e,this},offsetPoint:function(t){return this.offset(t.x,t.y)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},scale:function(t,e){return void 0===e&&(e=t),this.width*=t,this.height*=e,this},centerOn:function(t,e){return this.centerX=t,this.centerY=e,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},ceil:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y)},ceilAll:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height)},copyFrom:function(t){return this.setTo(t.x,t.y,t.width,t.height)},copyFromBounds:function(t){return this.setTo(t.left,t.top,t.width,t.height)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},inflate:function(t,e){return s.Rectangle.inflate(this,t,e)},size:function(t){return s.Rectangle.size(this,t)},resize:function(t,e){return this.width=t,this.height=e,this},clone:function(t){return s.Rectangle.clone(this,t)},contains:function(t,e){return s.Rectangle.contains(this,t,e)},containsRect:function(t){return s.Rectangle.containsRect(t,this)},equals:function(t){return s.Rectangle.equals(this,t)},intersection:function(t,e){return s.Rectangle.intersection(this,t,e)},intersects:function(t){return s.Rectangle.intersects(this,t)},intersectsRaw:function(t,e,i,n,r){return s.Rectangle.intersectsRaw(this,t,e,i,n,r)},union:function(t,e){return s.Rectangle.union(this,t,e)},random:function(t){return void 0===t&&(t=new s.Point),t.x=this.randomX,t.y=this.randomY,t},getPoint:function(t,e){switch(void 0===e&&(e=new s.Point),t){default:case s.TOP_LEFT:return e.set(this.x,this.y);case s.TOP_CENTER:return e.set(this.centerX,this.y);case s.TOP_RIGHT:return e.set(this.right,this.y);case s.LEFT_CENTER:return e.set(this.x,this.centerY);case s.CENTER:return e.set(this.centerX,this.centerY);case s.RIGHT_CENTER:return e.set(this.right,this.centerY);case s.BOTTOM_LEFT:return e.set(this.x,this.bottom);case s.BOTTOM_CENTER:return e.set(this.centerX,this.bottom);case s.BOTTOM_RIGHT:return e.set(this.right,this.bottom)}},sides:function(t,e,i,n){arguments.length||(t=new s.Line,e=new s.Line,i=new s.Line,n=new s.Line);var r=this.x,o=this.y,a=this.right,h=this.bottom;return t.setTo(r,o,a,o),e.setTo(a,o,a,h),i.setTo(r,h,a,h),n.setTo(r,o,r,h),arguments.length?null:[t,e,i,n]},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}},Object.defineProperty(s.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}}),Object.defineProperty(s.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}}),Object.defineProperty(s.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}}),Object.defineProperty(s.Rectangle.prototype,"bottomLeft",{get:function(){return new s.Point(this.x,this.bottom)},set:function(t){this.x=t.x,this.bottom=t.y}}),Object.defineProperty(s.Rectangle.prototype,"bottomRight",{get:function(){return new s.Point(this.right,this.bottom)},set:function(t){this.right=t.x,this.bottom=t.y}}),Object.defineProperty(s.Rectangle.prototype,"left",{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}}),Object.defineProperty(s.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}}),Object.defineProperty(s.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(s.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(s.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(t){this.x=t-this.halfWidth}}),Object.defineProperty(s.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(t){this.y=t-this.halfHeight}}),Object.defineProperty(s.Rectangle.prototype,"randomX",{get:function(){return this.x+Math.random()*this.width}}),Object.defineProperty(s.Rectangle.prototype,"randomY",{get:function(){return this.y+Math.random()*this.height}}),Object.defineProperty(s.Rectangle.prototype,"top",{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}}),Object.defineProperty(s.Rectangle.prototype,"topLeft",{get:function(){return new s.Point(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}}),Object.defineProperty(s.Rectangle.prototype,"topRight",{get:function(){return new s.Point(this.x+this.width,this.y)},set:function(t){this.right=t.x,this.y=t.y}}),Object.defineProperty(s.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(t){!0===t&&this.setTo(0,0,0,0)}}),s.Rectangle.prototype.constructor=s.Rectangle,s.Rectangle.inflate=function(t,e,i){return t.x-=e,t.width+=2*e,t.y-=i,t.height+=2*i,t},s.Rectangle.inflatePoint=function(t,e){return s.Rectangle.inflate(t,e.x,e.y)},s.Rectangle.size=function(t,e){return null==e?e=new s.Point(t.width,t.height):e.setTo(t.width,t.height),e},s.Rectangle.clone=function(t,e){return null==e?e=new s.Rectangle(t.x,t.y,t.width,t.height):e.setTo(t.x,t.y,t.width,t.height),e},s.Rectangle.createFromBounds=function(t,e){return null==e&&(e=new s.Rectangle(t.x,t.y,t.width,t.height)),e.copyFromBounds(t)},s.Rectangle.contains=function(t,e,i){return!(t.width<=0||t.height<=0)&&(e>=t.x&&e=t.y&&i=t&&s=e&&re.volume)&&(t.x>=e.x&&t.y>=e.y&&t.righte.right||t.y>e.bottom)},s.Rectangle.intersectsRaw=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||si&&(i=t.x),t.xr&&(r=t.y),t.y=this.right?this.width=0:this.width=this.right-t,this.x=t}}),Object.defineProperty(n.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}}),Object.defineProperty(n.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(n.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(n.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(t){this.x=t-this.halfWidth}}),Object.defineProperty(n.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(t){this.y=t-this.halfHeight}}),Object.defineProperty(n.Rectangle.prototype,"randomX",{get:function(){return this.x+Math.random()*this.width}}),Object.defineProperty(n.Rectangle.prototype,"randomY",{get:function(){return this.y+Math.random()*this.height}}),Object.defineProperty(n.Rectangle.prototype,"top",{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}}),Object.defineProperty(n.Rectangle.prototype,"topLeft",{get:function(){return new n.Point(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}}),Object.defineProperty(n.Rectangle.prototype,"topRight",{get:function(){return new n.Point(this.x+this.width,this.y)},set:function(t){this.right=t.x,this.y=t.y}}),Object.defineProperty(n.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(t){!0===t&&this.setTo(0,0,0,0)}}),n.Rectangle.prototype.constructor=n.Rectangle,n.Rectangle.inflate=function(t,e,i){return t.x-=e,t.width+=2*e,t.y-=i,t.height+=2*i,t},n.Rectangle.inflatePoint=function(t,e){return n.Rectangle.inflate(t,e.x,e.y)},n.Rectangle.size=function(t,e){return null==e?e=new n.Point(t.width,t.height):e.setTo(t.width,t.height),e},n.Rectangle.clone=function(t,e){return null==e?e=new n.Rectangle(t.x,t.y,t.width,t.height):e.setTo(t.x,t.y,t.width,t.height),e},n.Rectangle.createFromBounds=function(t,e){return null==e&&(e=new n.Rectangle(t.x,t.y,t.width,t.height)),e.copyFromBounds(t)},n.Rectangle.contains=function(t,e,i){return!(t.width<=0||t.height<=0)&&(e>=t.x&&e=t.y&&i=t&&s=e&&re.volume)&&(t.x>=e.x&&t.y>=e.y&&t.righte.right||t.y>e.bottom)},n.Rectangle.intersectsRaw=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||si&&(i=t.x),t.xr&&(r=t.y),t.y * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.RoundedRectangle=function(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=20),this.x=t,this.y=e,this.width=i,this.height=n,this.radius=r||20,this.type=s.ROUNDEDRECTANGLE},s.RoundedRectangle.prototype={clone:function(){return new s.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},contains:function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var n=this.y;if(e>=n&&e<=n+this.height)return!0}return!1}},s.RoundedRectangle.prototype.constructor=s.RoundedRectangle,PIXI.RoundedRectangle=s.RoundedRectangle, +n.RoundedRectangle=function(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=20),this.x=t,this.y=e,this.width=i,this.height=s,this.radius=r||20,this.type=n.ROUNDEDRECTANGLE},n.RoundedRectangle.prototype={clone:function(){return new n.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},contains:function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var n=this.y;if(e>=n&&e<=n+this.height)return!0}return!1}},n.RoundedRectangle.prototype.constructor=n.RoundedRectangle,PIXI.RoundedRectangle=n.RoundedRectangle, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Camera=function(t,e,i,n,r,o){this.game=t,this.world=t.world,this.id=0,this.view=new s.Rectangle(i,n,r,o),this.bounds=new s.Rectangle(i,n,r,o),this.deadzone=null,this.visible=!0,this.roundPx=!0,this.atLimit={x:!1,y:!1},this.target=null,this.displayObject=null,this.scale=null,this.totalInView=0,this.lerp=new s.Point(1,1),this.onShakeComplete=new s.Signal,this.onFlashComplete=new s.Signal,this.onFadeComplete=new s.Signal,this.fx=null,this._targetPosition=new s.Point,this._edge=0,this._position=new s.Point,this._shake={intensity:0,duration:0,horizontal:!1,vertical:!1,shakeBounds:!0,x:0,y:0},this._fxDuration=0,this._fxType=0,this._fixedView=new s.Rectangle},s.Camera.FOLLOW_LOCKON=0,s.Camera.FOLLOW_PLATFORMER=1,s.Camera.FOLLOW_TOPDOWN=2,s.Camera.FOLLOW_TOPDOWN_TIGHT=3,s.Camera.SHAKE_BOTH=4,s.Camera.SHAKE_HORIZONTAL=5,s.Camera.SHAKE_VERTICAL=6,s.Camera.ENABLE_FX=!0,s.Camera.FLASH=0,s.Camera.FADE_OUT=1,s.Camera.FADE_IN=2,s.Camera.prototype={boot:function(){this.displayObject=this.game.world,this.scale=this.game.world.scale,this.game.camera=this,s.Graphics&&s.Camera.ENABLE_FX&&(this.fx=new s.Graphics(this.game),this.game.stage.addChild(this.fx))},preUpdate:function(){this.totalInView=0},follow:function(t,e,i,n){var r;switch(void 0===e&&(e=s.Camera.FOLLOW_LOCKON),void 0===i&&(i=1),void 0===n&&(n=1),this.target=t,this.lerp.set(i,n),e){case s.Camera.FOLLOW_PLATFORMER:var o=this.width/8,a=this.height/3;this.deadzone=new s.Rectangle((this.width-o)/2,(this.height-a)/2-.25*a,o,a);break;case s.Camera.FOLLOW_TOPDOWN:r=Math.max(this.width,this.height)/4,this.deadzone=new s.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case s.Camera.FOLLOW_TOPDOWN_TIGHT:r=Math.max(this.width,this.height)/8,this.deadzone=new s.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case s.Camera.FOLLOW_LOCKON:default:this.deadzone=null}},unfollow:function(){this.target=null},focusOn:function(t){this.setPosition(Math.round(t.x-this.view.halfWidth),Math.round(t.y-this.view.halfHeight))},focusOnXY:function(t,e){this.setPosition(Math.round(t-this.view.halfWidth),Math.round(e-this.view.halfHeight))},shake:function(t,e,i,n,r){return void 0===t&&(t=.05),void 0===e&&(e=500),void 0===i&&(i=!0),void 0===n&&(n=s.Camera.SHAKE_BOTH),void 0===r&&(r=!0),!(!i&&this._shake.duration>0)&&(this._shake.intensity=t,this._shake.duration=e,this._shake.shakeBounds=r,this._shake.x=0,this._shake.y=0,this._shake.horizontal=n===s.Camera.SHAKE_BOTH||n===s.Camera.SHAKE_HORIZONTAL,this._shake.vertical=n===s.Camera.SHAKE_BOTH||n===s.Camera.SHAKE_VERTICAL,!0)},flash:function(t,e,i,n){return void 0===t&&(t=16777215),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===n&&(n=1),!(!this.fx||!i&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(t,n),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=1,this._fxDuration=e,this._fxType=0,!0)},fade:function(t,e,i,n){return this.fadeEffect(t,e,i,n,s.Camera.FADE_OUT)},fadeIn:function(t,e,i,n){return this.fadeEffect(t,e,i,n,s.Camera.FADE_IN)},fadeEffect:function(t,e,i,n,r){if(void 0===t&&(t=0),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===n&&(n=1),!this.fx||!i&&this._fxDuration>0)return!1;if(this.fx.clear(),this.fx.beginFill(t,n),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),r<1||r>2)throw new Error("Wrong `type` argument");return this.fx.alpha=r===s.Camera.FADE_IN?1:0,this._fxDuration=e,this._fxType=r,!0},update:function(){this._fxDuration>0&&this.updateFX(),this._shake.duration>0&&this.updateShake(),this.bounds&&this.checkBounds(),this.roundPx&&(this.view.floor(),this._shake.x=Math.floor(this._shake.x),this._shake.y=Math.floor(this._shake.y)),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateFX:function(){this._fxType===s.Camera.FLASH?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFlashComplete.dispatch())):this._fxType===s.Camera.FADE_IN?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFadeComplete.dispatch())):(this.fx.alpha+=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha>=1&&(this._fxDuration=0,this.fx.alpha=1,this.onFadeComplete.dispatch()))},updateShake:function(){this._shake.duration-=this.game.time.elapsedMS,this._shake.duration<=0?(this.onShakeComplete.dispatch(),this._shake.x=0,this._shake.y=0):(this._shake.horizontal&&(this._shake.x=this.game.rnd.frac()*this._shake.intensity*this.view.width*2-this._shake.intensity*this.view.width),this._shake.vertical&&(this._shake.y=this.game.rnd.frac()*this._shake.intensity*this.view.height*2-this._shake.intensity*this.view.height))},updateTarget:function(){this._targetPosition.x=this.view.x+this.target.worldPosition.x,this._targetPosition.y=this.view.y+this.target.worldPosition.y,this.deadzone?(this._edge=this._targetPosition.x-this.view.x,this._edgethis.deadzone.right&&(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.right,this.lerp.x)),this._edge=this._targetPosition.y-this.view.y,this._edgethis.deadzone.bottom&&(this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.deadzone.bottom,this.lerp.y))):(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.view.halfWidth,this.lerp.x),this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.view.halfHeight,this.lerp.y)),this.bounds&&this.checkBounds(),this.roundPx&&this.view.floor(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},setBoundsToWorld:function(){this.bounds&&this.bounds.copyFrom(this.game.world.bounds)},checkBounds:function(){this.atLimit.x=!1,this.atLimit.y=!1;var t=this.view.x+this._shake.x,e=this.view.right+this._shake.x,i=this.view.y+this._shake.y,n=this.view.bottom+this._shake.y;t<=this.bounds.x*this.scale.x?(this.atLimit.x=!0,this.view.x=this.bounds.x*this.scale.x,this._shake.shakeBounds||(this._shake.x=0)):e>=this.bounds.right*this.scale.x&&(this.atLimit.x=!0,this.view.x=this.bounds.right*this.scale.x-this.width,this._shake.shakeBounds||(this._shake.x=0)),i<=this.bounds.top*this.scale.y?(this.atLimit.y=!0,this.view.y=this.bounds.top*this.scale.y,this._shake.shakeBounds||(this._shake.y=0)):n>=this.bounds.bottom*this.scale.y&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom*this.scale.y-this.height,this._shake.shakeBounds||(this._shake.y=0))},setPosition:function(t,e){this.view.x=t,this.view.y=e,this.bounds&&this.checkBounds()},setSize:function(t,e){this.view.width=t,this.view.height=e},reset:function(){this.target=null,this.view.x=0,this.view.y=0,this._shake.duration=0,this._shake.x=0,this._shake.y=0,this.resetFX()},resetFX:function(){this.fx&&(this.fx.clear(),this.fx.alpha=0),this._fxDuration=0}},s.Camera.prototype.constructor=s.Camera,Object.defineProperty(s.Camera.prototype,"x",{get:function(){return this.view.x},set:function(t){this.view.x=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(s.Camera.prototype,"y",{get:function(){return this.view.y},set:function(t){this.view.y=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(s.Camera.prototype,"position",{get:function(){return this._position.set(this.view.x,this.view.y),this._position},set:function(t){void 0!==t.x&&(this.view.x=t.x),void 0!==t.y&&(this.view.y=t.y),this.bounds&&this.checkBounds()}}),Object.defineProperty(s.Camera.prototype,"width",{get:function(){return this.view.width},set:function(t){this.view.width=t}}),Object.defineProperty(s.Camera.prototype,"height",{get:function(){return this.view.height},set:function(t){this.view.height=t}}),Object.defineProperty(s.Camera.prototype,"shakeIntensity",{get:function(){return this._shake.intensity},set:function(t){this._shake.intensity=t}}),Object.defineProperty(s.Camera.prototype,"fixedView",{get:function(){return this._fixedView.setTo(0,0,this.view.width,this.view.height),this._fixedView}}),Object.defineProperty(s.Camera.prototype,"centerX",{get:function(){return this.x+.5*this.width}}),Object.defineProperty(s.Camera.prototype,"centerY",{get:function(){return this.y+.5*this.height}}), +n.Camera=function(t,e,i,s,r,o){this.game=t,this.world=t.world,this.id=0,this.view=new n.Rectangle(i,s,r,o),this.bounds=new n.Rectangle(i,s,r,o),this.deadzone=null,this.visible=!0,this.roundPx=!0,this.atLimit={x:!1,y:!1},this.target=null,this.displayObject=null,this.scale=null,this.totalInView=0,this.lerp=new n.Point(1,1),this.onShakeComplete=new n.Signal,this.onFlashComplete=new n.Signal,this.onFadeComplete=new n.Signal,this.fx=null,this._targetPosition=new n.Point,this._edge=0,this._position=new n.Point,this._shake={intensity:0,duration:0,horizontal:!1,vertical:!1,shakeBounds:!0,x:0,y:0},this._fxDuration=0,this._fxType=0,this._fixedView=new n.Rectangle},n.Camera.FOLLOW_LOCKON=0,n.Camera.FOLLOW_PLATFORMER=1,n.Camera.FOLLOW_TOPDOWN=2,n.Camera.FOLLOW_TOPDOWN_TIGHT=3,n.Camera.SHAKE_BOTH=4,n.Camera.SHAKE_HORIZONTAL=5,n.Camera.SHAKE_VERTICAL=6,n.Camera.ENABLE_FX=!0,n.Camera.FLASH=0,n.Camera.FADE_OUT=1,n.Camera.FADE_IN=2,n.Camera.prototype={boot:function(){this.displayObject=this.game.world,this.scale=this.game.world.scale,this.game.camera=this,n.Graphics&&n.Camera.ENABLE_FX&&(this.fx=new n.Graphics(this.game),this.game.stage.addChild(this.fx))},preUpdate:function(){this.totalInView=0},follow:function(t,e,i,s){var r;switch(void 0===e&&(e=n.Camera.FOLLOW_LOCKON),void 0===i&&(i=1),void 0===s&&(s=1),this.target=t,this.lerp.set(i,s),e){case n.Camera.FOLLOW_PLATFORMER:var o=this.width/8,a=this.height/3;this.deadzone=new n.Rectangle((this.width-o)/2,(this.height-a)/2-.25*a,o,a);break;case n.Camera.FOLLOW_TOPDOWN:r=Math.max(this.width,this.height)/4,this.deadzone=new n.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case n.Camera.FOLLOW_TOPDOWN_TIGHT:r=Math.max(this.width,this.height)/8,this.deadzone=new n.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case n.Camera.FOLLOW_LOCKON:default:this.deadzone=null}},unfollow:function(){this.target=null},focusOn:function(t){this.setPosition(Math.round(t.x-this.view.halfWidth),Math.round(t.y-this.view.halfHeight))},focusOnXY:function(t,e){this.setPosition(Math.round(t-this.view.halfWidth),Math.round(e-this.view.halfHeight))},shake:function(t,e,i,s,r){return void 0===t&&(t=.05),void 0===e&&(e=500),void 0===i&&(i=!0),void 0===s&&(s=n.Camera.SHAKE_BOTH),void 0===r&&(r=!0),!(!i&&this._shake.duration>0)&&(this._shake.intensity=t,this._shake.duration=e,this._shake.shakeBounds=r,this._shake.x=0,this._shake.y=0,this._shake.horizontal=s===n.Camera.SHAKE_BOTH||s===n.Camera.SHAKE_HORIZONTAL,this._shake.vertical=s===n.Camera.SHAKE_BOTH||s===n.Camera.SHAKE_VERTICAL,!0)},flash:function(t,e,i,n){return void 0===t&&(t=16777215),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===n&&(n=1),!(!this.fx||!i&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(t,n),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=1,this._fxDuration=e,this._fxType=0,!0)},fade:function(t,e,i,s){return this.fadeEffect(t,e,i,s,n.Camera.FADE_OUT)},fadeIn:function(t,e,i,s){return this.fadeEffect(t,e,i,s,n.Camera.FADE_IN)},fadeEffect:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===s&&(s=1),!this.fx||!i&&this._fxDuration>0)return!1;if(this.fx.clear(),this.fx.beginFill(t,s),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),r<1||r>2)throw new Error("Wrong `type` argument");return this.fx.alpha=r===n.Camera.FADE_IN?1:0,this._fxDuration=e,this._fxType=r,!0},update:function(){this._fxDuration>0&&this.updateFX(),this._shake.duration>0&&this.updateShake(),this.bounds&&this.checkBounds(),this.roundPx&&(this.view.floor(),this._shake.x=Math.floor(this._shake.x),this._shake.y=Math.floor(this._shake.y)),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateFX:function(){this._fxType===n.Camera.FLASH?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFlashComplete.dispatch())):this._fxType===n.Camera.FADE_IN?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFadeComplete.dispatch())):(this.fx.alpha+=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha>=1&&(this._fxDuration=0,this.fx.alpha=1,this.onFadeComplete.dispatch()))},updateShake:function(){this._shake.duration-=this.game.time.elapsedMS,this._shake.duration<=0?(this.onShakeComplete.dispatch(),this._shake.x=0,this._shake.y=0):(this._shake.horizontal&&(this._shake.x=this.game.rnd.frac()*this._shake.intensity*this.view.width*2-this._shake.intensity*this.view.width),this._shake.vertical&&(this._shake.y=this.game.rnd.frac()*this._shake.intensity*this.view.height*2-this._shake.intensity*this.view.height))},updateTarget:function(){this._targetPosition.x=this.view.x+this.target.worldPosition.x,this._targetPosition.y=this.view.y+this.target.worldPosition.y,this.deadzone?(this._edge=this._targetPosition.x-this.view.x,this._edgethis.deadzone.right&&(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.right,this.lerp.x)),this._edge=this._targetPosition.y-this.view.y,this._edgethis.deadzone.bottom&&(this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.deadzone.bottom,this.lerp.y))):(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.view.halfWidth,this.lerp.x),this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.view.halfHeight,this.lerp.y)),this.bounds&&this.checkBounds(),this.roundPx&&this.view.floor(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},setBoundsToWorld:function(){this.bounds&&this.bounds.copyFrom(this.game.world.bounds)},checkBounds:function(){this.atLimit.x=!1,this.atLimit.y=!1;var t=this.view.x+this._shake.x,e=this.view.right+this._shake.x,i=this.view.y+this._shake.y,n=this.view.bottom+this._shake.y;t<=this.bounds.x*this.scale.x?(this.atLimit.x=!0,this.view.x=this.bounds.x*this.scale.x,this._shake.shakeBounds||(this._shake.x=0)):e>=this.bounds.right*this.scale.x&&(this.atLimit.x=!0,this.view.x=this.bounds.right*this.scale.x-this.width,this._shake.shakeBounds||(this._shake.x=0)),i<=this.bounds.top*this.scale.y?(this.atLimit.y=!0,this.view.y=this.bounds.top*this.scale.y,this._shake.shakeBounds||(this._shake.y=0)):n>=this.bounds.bottom*this.scale.y&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom*this.scale.y-this.height,this._shake.shakeBounds||(this._shake.y=0))},setPosition:function(t,e){this.view.x=t,this.view.y=e,this.bounds&&this.checkBounds()},setSize:function(t,e){this.view.width=t,this.view.height=e},reset:function(){this.target=null,this.view.x=0,this.view.y=0,this._shake.duration=0,this._shake.x=0,this._shake.y=0,this.resetFX()},resetFX:function(){this.fx&&(this.fx.clear(),this.fx.alpha=0),this._fxDuration=0}},n.Camera.prototype.constructor=n.Camera,Object.defineProperty(n.Camera.prototype,"x",{get:function(){return this.view.x},set:function(t){this.view.x=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(n.Camera.prototype,"y",{get:function(){return this.view.y},set:function(t){this.view.y=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(n.Camera.prototype,"position",{get:function(){return this._position.set(this.view.x,this.view.y),this._position},set:function(t){void 0!==t.x&&(this.view.x=t.x),void 0!==t.y&&(this.view.y=t.y),this.bounds&&this.checkBounds()}}),Object.defineProperty(n.Camera.prototype,"width",{get:function(){return this.view.width},set:function(t){this.view.width=t}}),Object.defineProperty(n.Camera.prototype,"height",{get:function(){return this.view.height},set:function(t){this.view.height=t}}),Object.defineProperty(n.Camera.prototype,"shakeIntensity",{get:function(){return this._shake.intensity},set:function(t){this._shake.intensity=t}}),Object.defineProperty(n.Camera.prototype,"fixedView",{get:function(){return this._fixedView.setTo(0,0,this.view.width,this.view.height),this._fixedView}}),Object.defineProperty(n.Camera.prototype,"centerX",{get:function(){return this.x+.5*this.width}}),Object.defineProperty(n.Camera.prototype,"centerY",{get:function(){return this.y+.5*this.height}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.State=function(){this.game=null,this.key="",this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.state=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},s.State.prototype={init:function(){},preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},postUpdate:function(){},preRender:function(){},render:function(){},resize:function(){},paused:function(){},resumed:function(){},pauseUpdate:function(){},shutdown:function(){}},s.State.prototype.constructor=s.State, +n.State=function(){this.game=null,this.key="",this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.state=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},n.State.prototype={init:function(){},preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},postUpdate:function(){},preRender:function(){},render:function(){},resize:function(){},paused:function(){},resumed:function(){},pauseUpdate:function(){},shutdown:function(){}},n.State.prototype.constructor=n.State, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.StateManager=function(t,e){this.game=t,this.states={},this._pendingState=null,null!=e&&(this._pendingState=e),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onStateChange=new s.Signal,this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.onShutDownCallback=null},s.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&"string"!=typeof this._pendingState&&this.add("default",this._pendingState,!0)},add:function(t,e,i){var n;return void 0===i&&(i=!1),e instanceof s.State?n=e:"object"==typeof e?(n=e).game=this.game:"function"==typeof e&&(n=new e(this.game)),this.states[t]=n,i&&(this.game.isBooted?this.start(t):this._pendingState=t),n},remove:function(t){this.current===t&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPreRenderCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null),delete this.states[t]},start:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.checkState(t)&&(this._pendingState=t,this._clearWorld=e,this._clearCache=i,arguments.length>3&&(this._args=Array.prototype.splice.call(arguments,3)))},restart:function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1),this._pendingState=this.current,this._clearWorld=t,this._clearCache=e,arguments.length>2&&(this._args=Array.prototype.slice.call(arguments,2))},dummy:function(){},preUpdate:function(){if(this._pendingState&&this.game.isBooted){if(this.clearCurrentState(),this.setCurrentState(this._pendingState),this.current!==this._pendingState)return;this._pendingState=null,this.onPreloadCallback?(this.game.load.reset(!0),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()&&0===this.game.load.totalQueuedPacks()?this.loadComplete():this.game.load.start()):this.loadComplete()}},clearCurrentState:function(){this.current&&(this.onShutDownCallback&&this.onShutDownCallback.call(this.callbackContext,this.game),this.game.tweens.removeAll(),this.game.camera.reset(),this.game.input.reset(!0),this.game.physics.clear(),this.game.time.removeAll(),this.game.scale.reset(this._clearWorld),this.game.debug&&this.game.debug.reset(),this._clearWorld&&(this.game.world.shutdown(),this._clearCache&&this.game.cache.destroy()))},checkState:function(t){var e=this.states[t];return e?!!(e.preload||e.create||e.update||e.render)||(console.warn("Invalid Phaser State object given. Must contain at least one of the required functions: preload, create, update or render"),!1):(console.warn("Phaser.StateManager - No state found with the key: "+t),!1)},link:function(t){var e=this.states[t];e.game=this.game,e.add=this.game.add,e.make=this.game.make,e.camera=this.game.camera,e.cache=this.game.cache,e.input=this.game.input,e.load=this.game.load,e.math=this.game.math,e.sound=this.game.sound,e.scale=this.game.scale,e.state=this,e.stage=this.game.stage,e.time=this.game.time,e.tweens=this.game.tweens,e.world=this.game.world,e.particles=this.game.particles,e.rnd=this.game.rnd,e.physics=this.game.physics,e.key=t},unlink:function(t){var e=this.states[t];e&&(e.game=null,e.add=null,e.make=null,e.camera=null,e.cache=null,e.input=null,e.load=null,e.math=null,e.sound=null,e.scale=null,e.state=null,e.stage=null,e.time=null,e.tweens=null,e.world=null,e.particles=null,e.rnd=null,e.physics=null)},setCurrentState:function(t){var e=this.current,i=this.states[t];this.callbackContext=i,this.link(t),this.onInitCallback=i.init||this.dummy,this.onPreloadCallback=i.preload||null,this.onLoadRenderCallback=i.loadRender||null,this.onLoadUpdateCallback=i.loadUpdate||null,this.onCreateCallback=i.create||null,this.onUpdateCallback=i.update||null,this.onPostUpdateCallback=i.postUpdate||null,this.onPreRenderCallback=i.preRender||null,this.onRenderCallback=i.render||null,this.onResizeCallback=i.resize||null,this.onPausedCallback=i.paused||null,this.onResumedCallback=i.resumed||null,this.onPauseUpdateCallback=i.pauseUpdate||null,this.onShutDownCallback=i.shutdown||this.dummy,""!==this.current&&this.game.physics.reset(),this.current=t,this._created=!1,this.onStateChange.dispatch(this.current,e),this.onInitCallback.apply(this.callbackContext,this._args),t===this._pendingState&&(this._args=[]),this.game._kickstart=!0},getCurrentState:function(){return this.states[this.current]},loadComplete:function(){!1===this._created&&this.onCreateCallback?(this._created=!0,this.onCreateCallback.call(this.callbackContext,this.game)):this._created=!0},loadUpdate:function(){!1===this._created&&this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},pause:function(){this._created&&this.onPausedCallback&&this.onPausedCallback.call(this.callbackContext,this.game)},resume:function(){this._created&&this.onResumedCallback&&this.onResumedCallback.call(this.callbackContext,this.game)},update:function(){this._created?this.onUpdateCallback&&this.onUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},postUpdate:function(){this._created&&this.onPostUpdateCallback&&this.onPostUpdateCallback.call(this.callbackContext,this.game)},pauseUpdate:function(){this._created?this.onPauseUpdateCallback&&this.onPauseUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},preRender:function(t){this._created&&this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game,t)},resize:function(t,e){this.onResizeCallback&&this.onResizeCallback.call(this.callbackContext,t,e)},render:function(){this._created?this.onRenderCallback&&(this.game.renderType===s.CANVAS?(this.game.context.save(),this.game.context.setTransform(1,0,0,1,0,0),this.onRenderCallback.call(this.callbackContext,this.game),this.game.context.restore()):this.onRenderCallback.call(this.callbackContext,this.game)):this.onLoadRenderCallback&&this.onLoadRenderCallback.call(this.callbackContext,this.game)},destroy:function(){this._clearWorld=!0,this._clearCache=!0,this.clearCurrentState(),this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPostUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.game=null,this.states={},this._pendingState=null,this.current=""}},s.StateManager.prototype.constructor=s.StateManager,Object.defineProperty(s.StateManager.prototype,"created",{get:function(){return this._created}}), +n.StateManager=function(t,e){this.game=t,this.states={},this._pendingState=null,null!=e&&(this._pendingState=e),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onStateChange=new n.Signal,this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.onShutDownCallback=null},n.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&"string"!=typeof this._pendingState&&this.add("default",this._pendingState,!0)},add:function(t,e,i){var s;return void 0===i&&(i=!1),e instanceof n.State?s=e:"object"==typeof e?(s=e).game=this.game:"function"==typeof e&&(s=new e(this.game)),this.states[t]=s,i&&(this.game.isBooted?this.start(t):this._pendingState=t),s},remove:function(t){this.current===t&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPreRenderCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null),delete this.states[t]},start:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.checkState(t)&&(this._pendingState=t,this._clearWorld=e,this._clearCache=i,arguments.length>3&&(this._args=Array.prototype.splice.call(arguments,3)))},restart:function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1),this._pendingState=this.current,this._clearWorld=t,this._clearCache=e,arguments.length>2&&(this._args=Array.prototype.slice.call(arguments,2))},dummy:function(){},preUpdate:function(){if(this._pendingState&&this.game.isBooted){if(this.clearCurrentState(),this.setCurrentState(this._pendingState),this.current!==this._pendingState)return;this._pendingState=null,this.onPreloadCallback?(this.game.load.reset(!0),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()&&0===this.game.load.totalQueuedPacks()?this.loadComplete():this.game.load.start()):this.loadComplete()}},clearCurrentState:function(){this.current&&(this.onShutDownCallback&&this.onShutDownCallback.call(this.callbackContext,this.game),this.game.tweens.removeAll(),this.game.camera.reset(),this.game.input.reset(!0),this.game.physics.clear(),this.game.time.removeAll(),this.game.scale.reset(this._clearWorld),this.game.debug&&this.game.debug.reset(),this._clearWorld&&(this.game.world.shutdown(),this._clearCache&&this.game.cache.destroy()))},checkState:function(t){var e=this.states[t];return e?!!(e.preload||e.create||e.update||e.render)||(console.warn("Invalid Phaser State object given. Must contain at least one of the required functions: preload, create, update or render"),!1):(console.warn("Phaser.StateManager - No state found with the key: "+t),!1)},link:function(t){var e=this.states[t];e.game=this.game,e.add=this.game.add,e.make=this.game.make,e.camera=this.game.camera,e.cache=this.game.cache,e.input=this.game.input,e.load=this.game.load,e.math=this.game.math,e.sound=this.game.sound,e.scale=this.game.scale,e.state=this,e.stage=this.game.stage,e.time=this.game.time,e.tweens=this.game.tweens,e.world=this.game.world,e.particles=this.game.particles,e.rnd=this.game.rnd,e.physics=this.game.physics,e.key=t},unlink:function(t){var e=this.states[t];e&&(e.game=null,e.add=null,e.make=null,e.camera=null,e.cache=null,e.input=null,e.load=null,e.math=null,e.sound=null,e.scale=null,e.state=null,e.stage=null,e.time=null,e.tweens=null,e.world=null,e.particles=null,e.rnd=null,e.physics=null)},setCurrentState:function(t){var e=this.current,i=this.states[t];this.callbackContext=i,this.link(t),this.onInitCallback=i.init||this.dummy,this.onPreloadCallback=i.preload||null,this.onLoadRenderCallback=i.loadRender||null,this.onLoadUpdateCallback=i.loadUpdate||null,this.onCreateCallback=i.create||null,this.onUpdateCallback=i.update||null,this.onPostUpdateCallback=i.postUpdate||null,this.onPreRenderCallback=i.preRender||null,this.onRenderCallback=i.render||null,this.onResizeCallback=i.resize||null,this.onPausedCallback=i.paused||null,this.onResumedCallback=i.resumed||null,this.onPauseUpdateCallback=i.pauseUpdate||null,this.onShutDownCallback=i.shutdown||this.dummy,""!==this.current&&this.game.physics.reset(),this.current=t,this._created=!1,this.onStateChange.dispatch(this.current,e),this.onInitCallback.apply(this.callbackContext,this._args),t===this._pendingState&&(this._args=[]),this.game._kickstart=!0},getCurrentState:function(){return this.states[this.current]},loadComplete:function(){!1===this._created&&this.onCreateCallback?(this._created=!0,this.onCreateCallback.call(this.callbackContext,this.game)):this._created=!0},loadUpdate:function(){!1===this._created&&this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},pause:function(){this._created&&this.onPausedCallback&&this.onPausedCallback.call(this.callbackContext,this.game)},resume:function(){this._created&&this.onResumedCallback&&this.onResumedCallback.call(this.callbackContext,this.game)},update:function(){this._created?this.onUpdateCallback&&this.onUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},postUpdate:function(){this._created&&this.onPostUpdateCallback&&this.onPostUpdateCallback.call(this.callbackContext,this.game)},pauseUpdate:function(){this._created?this.onPauseUpdateCallback&&this.onPauseUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},preRender:function(t){this._created&&this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game,t)},resize:function(t,e){this.onResizeCallback&&this.onResizeCallback.call(this.callbackContext,t,e)},render:function(){this._created?this.onRenderCallback&&(this.game.renderType===n.CANVAS?(this.game.context.save(),this.game.context.setTransform(1,0,0,1,0,0),this.onRenderCallback.call(this.callbackContext,this.game),this.game.context.restore()):this.onRenderCallback.call(this.callbackContext,this.game)):this.onLoadRenderCallback&&this.onLoadRenderCallback.call(this.callbackContext,this.game)},destroy:function(){this._clearWorld=!0,this._clearCache=!0,this.clearCurrentState(),this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPostUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.game=null,this.states={},this._pendingState=null,this.current=""}},n.StateManager.prototype.constructor=n.StateManager,Object.defineProperty(n.StateManager.prototype,"created",{get:function(){return this._created}}), /** * @author Miller Medeiros http://millermedeiros.github.com/js-signals/ * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Signal=function(){},s.Signal.prototype={_bindings:null,_prevParams:null,memorize:!1,_shouldPropagate:!0,active:!0,_boundDispatch:!1,validateListener:function(t,e){if("function"!=typeof t)throw new Error("Phaser.Signal: listener is a required param of {fn}() and should be a Function.".replace("{fn}",e))},_registerListener:function(t,e,i,n,r){var o,a=this._indexOfListener(t,i);if(-1!==a){if((o=this._bindings[a]).isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else o=new s.SignalBinding(this,t,e,i,n,r),this._addBinding(o);return this.memorize&&this._prevParams&&o.execute(this._prevParams),o},_addBinding:function(t){this._bindings||(this._bindings=[]);var e=this._bindings.length;do{e--}while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){if(!this._bindings)return-1;void 0===e&&(e=null);for(var i,n=this._bindings.length;n--;)if((i=this._bindings[n])._listener===t&&i.context===e)return n;return-1},has:function(t,e){return-1!==this._indexOfListener(t,e)},add:function(t,e,i){this.validateListener(t,"add");var n=[];if(arguments.length>3)for(var s=3;s3)for(var s=3;s3)for(var s=3;s3)for(var s=3;s * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.SignalBinding=function(t,e,i,n,s,r){this._listener=e,i&&(this._isOnce=!0),null!=n&&(this.context=n),this._signal=t,s&&(this._priority=s),r&&r.length&&(this._args=r)},s.SignalBinding.prototype={context:null,_isOnce:!1,_priority:0,_args:null,callCount:0,active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,this._args&&(i=i.concat(this._args)),e=this._listener.apply(this.context,i),this.callCount++,this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},s.SignalBinding.prototype.constructor=s.SignalBinding, +n.SignalBinding=function(t,e,i,n,s,r){this._listener=e,i&&(this._isOnce=!0),null!=n&&(this.context=n),this._signal=t,s&&(this._priority=s),r&&r.length&&(this._args=r)},n.SignalBinding.prototype={context:null,_isOnce:!1,_priority:0,_args:null,callCount:0,active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,this._args&&(i=i.concat(this._args)),e=this._listener.apply(this.context,i),this.callCount++,this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},n.SignalBinding.prototype.constructor=n.SignalBinding, /** * @author Richard Davey * @author Mat Groves (@Doormat23) * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Filter=function(t,e,i){this.game=t,this.type=s.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.prevPoint=new s.Point;var n=new Date;if(this.uniforms={resolution:{type:"2f",value:{x:256,y:256}},time:{type:"1f",value:0},mouse:{type:"2f",value:{x:0,y:0}},date:{type:"4fv",value:[n.getFullYear(),n.getMonth(),n.getDate(),60*n.getHours()*60+60*n.getMinutes()+n.getSeconds()]},sampleRate:{type:"1f",value:44100},iChannel0:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel1:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel2:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel3:{type:"sampler2D",value:null,textureData:{repeat:!0}}},e)for(var r in e)this.uniforms[r]=e[r];"string"==typeof i&&(i=i.split("\n")),this.fragmentSrc=i||[]},s.Filter.prototype={init:function(){},setResolution:function(t,e){this.uniforms.resolution.value.x=t,this.uniforms.resolution.value.y=e},update:function(t){if(t){var e=t.x/this.game.width,i=1-t.y/this.game.height;e===this.prevPoint.x&&i===this.prevPoint.y||(this.uniforms.mouse.value.x=e.toFixed(2),this.uniforms.mouse.value.y=i.toFixed(2),this.prevPoint.set(e,i))}this.uniforms.time.value=this.game.time.totalElapsedSeconds()},addToWorld:function(t,e,i,n,r,o){void 0===r&&(r=0),void 0===o&&(o=0),null!=i?this.width=i:i=this.width,null!=n?this.height=n:n=this.height;var a=this.game.add.image(t,e,s.Cache.DEFAULT);return a.width=i,a.height=n,a.anchor.set(r,o),a.filters=[this],a},syncUniforms:function(){for(var t=0;t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Plugin=function(t,e){void 0===e&&(e=null),this.game=t,this.parent=e,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},s.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},s.Plugin.prototype.constructor=s.Plugin, +n.Plugin=function(t,e){void 0===e&&(e=null),this.game=t,this.parent=e,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},n.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},n.Plugin.prototype.constructor=n.Plugin, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.PluginManager=function(t){this.game=t,this.plugins=[],this._len=0,this._i=0},s.PluginManager.prototype={add:function(t){var e=Array.prototype.slice.call(arguments,1),i=!1;return"function"==typeof t?t=new t(this.game,this):(t.game=this.game,t.parent=this),"function"==typeof t.preUpdate&&(t.hasPreUpdate=!0,i=!0),"function"==typeof t.update&&(t.hasUpdate=!0,i=!0),"function"==typeof t.postUpdate&&(t.hasPostUpdate=!0,i=!0),"function"==typeof t.render&&(t.hasRender=!0,i=!0),"function"==typeof t.postRender&&(t.hasPostRender=!0,i=!0),i?((t.hasPreUpdate||t.hasUpdate||t.hasPostUpdate)&&(t.active=!0),(t.hasRender||t.hasPostRender)&&(t.visible=!0),this._len=this.plugins.push(t),"function"==typeof t.init&&t.init.apply(t,e),t):null},remove:function(t,e){for(void 0===e&&(e=!0),this._i=this._len;this._i--;)if(this.plugins[this._i]===t)return e&&t.destroy(),this.plugins.splice(this._i,1),void this._len--},removeAll:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].destroy();this.plugins.length=0,this._len=0},preUpdate:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasPreUpdate&&this.plugins[this._i].preUpdate()},update:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasUpdate&&this.plugins[this._i].update()},postUpdate:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasPostUpdate&&this.plugins[this._i].postUpdate()},render:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].visible&&this.plugins[this._i].hasRender&&this.plugins[this._i].render()},postRender:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].visible&&this.plugins[this._i].hasPostRender&&this.plugins[this._i].postRender()},destroy:function(){this.removeAll(),this.game=null}},s.PluginManager.prototype.constructor=s.PluginManager, +n.PluginManager=function(t){this.game=t,this.plugins=[],this._len=0,this._i=0},n.PluginManager.prototype={add:function(t){var e=Array.prototype.slice.call(arguments,1),i=!1;return"function"==typeof t?t=new t(this.game,this):(t.game=this.game,t.parent=this),"function"==typeof t.preUpdate&&(t.hasPreUpdate=!0,i=!0),"function"==typeof t.update&&(t.hasUpdate=!0,i=!0),"function"==typeof t.postUpdate&&(t.hasPostUpdate=!0,i=!0),"function"==typeof t.render&&(t.hasRender=!0,i=!0),"function"==typeof t.postRender&&(t.hasPostRender=!0,i=!0),i?((t.hasPreUpdate||t.hasUpdate||t.hasPostUpdate)&&(t.active=!0),(t.hasRender||t.hasPostRender)&&(t.visible=!0),this._len=this.plugins.push(t),"function"==typeof t.init&&t.init.apply(t,e),t):null},remove:function(t,e){for(void 0===e&&(e=!0),this._i=this._len;this._i--;)if(this.plugins[this._i]===t)return e&&t.destroy(),this.plugins.splice(this._i,1),void this._len--},removeAll:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].destroy();this.plugins.length=0,this._len=0},preUpdate:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasPreUpdate&&this.plugins[this._i].preUpdate()},update:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasUpdate&&this.plugins[this._i].update()},postUpdate:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasPostUpdate&&this.plugins[this._i].postUpdate()},render:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].visible&&this.plugins[this._i].hasRender&&this.plugins[this._i].render()},postRender:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].visible&&this.plugins[this._i].hasPostRender&&this.plugins[this._i].postRender()},destroy:function(){this.removeAll(),this.game=null}},n.PluginManager.prototype.constructor=n.PluginManager, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Stage=function(t){this.game=t,PIXI.DisplayObjectContainer.call(this),this.name="_stage_root",this.disableVisibilityChange=!1,this.exists=!0,this.worldTransform=new s.Matrix,this.stage=this,this.currentRenderOrderID=0,this._hiddenVar="hidden",this._onChange=null,this._bgColor={r:0,g:0,b:0,a:0,color:0,rgba:"#000000"},this.game.transparent||(this._bgColor.a=1),t.config&&this.parseConfig(t.config)},s.Stage.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),s.Stage.prototype.constructor=s.Stage,s.Stage.prototype.parseConfig=function(t){t.disableVisibilityChange&&(this.disableVisibilityChange=t.disableVisibilityChange),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor)},s.Stage.prototype.boot=function(){s.DOM.getOffset(this.game.canvas,this.offset),s.Canvas.setUserSelect(this.game.canvas,"none"),s.Canvas.setTouchAction(this.game.canvas,"none"),this.checkVisibility()},s.Stage.prototype.preUpdate=function(){this.currentRenderOrderID=0;for(var t=0;t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Group=function(t,e,i,n,r,o){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=s.Physics.ARCADE),this.game=t,void 0===e&&(e=t.world),this.name=i||"group",this.z=0,PIXI.DisplayObjectContainer.call(this),n?(this.game.stage.addChild(this),this.z=this.game.stage.children.length):e&&(e.addChild(this),this.z=e.children.length),this.type=s.GROUP,this.physicsType=s.GROUP,this.alive=!0,this.exists=!0,this.ignoreDestroy=!1,this.pendingDestroy=!1,this.classType=s.Sprite,this.cursor=null,this.inputEnableChildren=!1,this.updateOnlyExistingChildren=!1,this.onChildInputDown=new s.Signal,this.onChildInputUp=new s.Signal,this.onChildInputOver=new s.Signal,this.onChildInputOut=new s.Signal,this.enableBody=r,this.enableBodyDebug=!1,this.physicsBodyType=o,this.physicsSortDirection=null,this.onDestroy=new s.Signal,this.cursorIndex=0,this.fixedToCamera=!1,this.cameraOffset=new s.Point,this.hash=[],this._sortProperty="z"},s.Group.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),s.Group.prototype.constructor=s.Group,s.Group.RETURN_NONE=0,s.Group.RETURN_TOTAL=1,s.Group.RETURN_CHILD=2,s.Group.RETURN_ALL=3,s.Group.SORT_ASCENDING=-1,s.Group.SORT_DESCENDING=1,s.Group.prototype.add=function(t,e,i){return void 0===e&&(e=!1),t.parent===this||(t.body&&t.parent&&t.parent.hash&&t.parent.removeFromHash(t),void 0===i?(t.z=this.children.length,this.addChild(t)):(this.addChildAt(t,i),this.updateZ()),this.enableBody&&t.hasOwnProperty("body")&&null===t.body?this.game.physics.enable(t,this.physicsBodyType):t.body&&this.addToHash(t),!this.inputEnableChildren||t.input&&!t.inputEnabled||(t.inputEnabled=!0),!e&&t.events&&t.events.onAddedToGroup$dispatch(t,this),null===this.cursor&&(this.cursor=t)),t},s.Group.prototype.addAt=function(t,e,i){return this.add(t,i,e)},s.Group.prototype.addToHash=function(t){if(t.parent===this&&-1===this.hash.indexOf(t))return this.hash.push(t),!0;return!1},s.Group.prototype.removeFromHash=function(t){if(t){var e=this.hash.indexOf(t);if(-1!==e)return this.hash.splice(e,1),!0}return!1},s.Group.prototype.addMultiple=function(t,e){if(t instanceof s.Group)t.moveAll(this,e);else if(Array.isArray(t))for(var i=0;i=this.children.length?-1:this.getChildAt(t)},s.Group.prototype.create=function(t,e,i,n,s,r){void 0===s&&(s=!0);var o=new this.classType(this.game,t,e,i,n);return o.exists=s,o.visible=s,o.alive=s,this.add(o,!1,r)},s.Group.prototype.createMultiple=function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=!1),Array.isArray(e)||(e=[e]),Array.isArray(i)||(i=[i]);var o=this,a=[];return e.forEach((function(e){i.forEach((function(i){for(var h=0;hthis.children.length||-1===t&&-1===e)return!1;for(var a=new s.Rectangle(0,0,i,n),h=t*i,l=e*n,u=o;uthis.children.length-1&&(t=0),this.cursor)return this.cursorIndex=t,this.cursor=this.children[this.cursorIndex],this.cursor},s.Group.prototype.next=function(){if(this.cursor)return this.cursorIndex>=this.children.length-1?this.cursorIndex=0:this.cursorIndex++,this.cursor=this.children[this.cursorIndex],this.cursor},s.Group.prototype.previous=function(){if(this.cursor)return 0===this.cursorIndex?this.cursorIndex=this.children.length-1:this.cursorIndex--,this.cursor=this.children[this.cursorIndex],this.cursor},s.Group.prototype.swap=function(t,e){this.swapChildren(t,e),this.updateZ()},s.Group.prototype.bringToTop=function(t){return t.parent===this&&this.getIndex(t)0&&(this.remove(t,!1,!0),this.addAt(t,0,!0)),t},s.Group.prototype.sendChildToBack=s.Group.prototype.sendToBack,s.Group.prototype.moveUp=function(t){if(t.parent===this&&this.getIndex(t)0){var e=this.getIndex(t),i=this.getAt(e-1);i&&this.swap(t,i)}return t},s.Group.prototype.xy=function(t,e,i){if(t<0||t>this.children.length)return-1;this.getChildAt(t).x=e,this.getChildAt(t).y=i},s.Group.prototype.reverse=function(){this.children.reverse(),this.updateZ()},s.Group.prototype.getIndex=function(t){return this.children.indexOf(t)},s.Group.prototype.getByName=function(t){return this.getFirst("name",t)},s.Group.prototype.replace=function(t,e){var i=this.getIndex(t);if(-1!==i)return e.parent&&(e.parent instanceof s.Group?e.parent.remove(e):e.parent.removeChild(e)),this.remove(t),this.addAt(e,i),t},s.Group.prototype.hasProperty=function(t,e){var i=e.length;return 1===i&&e[0]in t||(2===i&&e[0]in t&&e[1]in t[e[0]]||(3===i&&e[0]in t&&e[1]in t[e[0]]&&e[2]in t[e[0]][e[1]]||4===i&&e[0]in t&&e[1]in t[e[0]]&&e[2]in t[e[0]][e[1]]&&e[3]in t[e[0]][e[1]][e[2]]))},s.Group.prototype.setProperty=function(t,e,i,n,s){if(void 0===s&&(s=!1),n=n||0,!this.hasProperty(t,e)&&(!s||n>0))return!1;var r=e.length;return 1===r?0===n?t[e[0]]=i:1===n?t[e[0]]+=i:2===n?t[e[0]]-=i:3===n?t[e[0]]*=i:4===n&&(t[e[0]]/=i):2===r?0===n?t[e[0]][e[1]]=i:1===n?t[e[0]][e[1]]+=i:2===n?t[e[0]][e[1]]-=i:3===n?t[e[0]][e[1]]*=i:4===n&&(t[e[0]][e[1]]/=i):3===r?0===n?t[e[0]][e[1]][e[2]]=i:1===n?t[e[0]][e[1]][e[2]]+=i:2===n?t[e[0]][e[1]][e[2]]-=i:3===n?t[e[0]][e[1]][e[2]]*=i:4===n&&(t[e[0]][e[1]][e[2]]/=i):4===r&&(0===n?t[e[0]][e[1]][e[2]][e[3]]=i:1===n?t[e[0]][e[1]][e[2]][e[3]]+=i:2===n?t[e[0]][e[1]][e[2]][e[3]]-=i:3===n?t[e[0]][e[1]][e[2]][e[3]]*=i:4===n&&(t[e[0]][e[1]][e[2]][e[3]]/=i)),!0},s.Group.prototype.checkProperty=function(t,e,i,n){if(void 0===n&&(n=!1),this!==t.parent)return!1;var r=s.Utils.getProperty(t,e);return!(void 0===r&&n||r!==i)},s.Group.prototype.set=function(t,e,i,n,s,r,o){if(void 0===o&&(o=!1),e=e.split("."),void 0===n&&(n=!1),void 0===s&&(s=!1),(!1===n||n&&t.alive)&&(!1===s||s&&t.visible))return this.setProperty(t,e,i,r,o)},s.Group.prototype.setAll=function(t,e,i,n,s,r){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),t=t.split("."),s=s||0;for(var o=this.children.length,a=0;a2){i=[];for(var n=2;n2){i=[];for(var r=2;r=e&&(t=e-1);var i=this.children[t];this.updateOnlyExistingChildren&&!i.exists||i.update()}},s.Group.prototype.postUpdate=function(){this.fixedToCamera&&(this.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var t=0;t2){i=[null];for(var n=2;n2){i=[null];for(var n=2;n2){i=[null];for(var n=2;ne[this._sortProperty]?1:t.ze[this._sortProperty]?-1:0},s.Group.prototype.iterate=function(t,e,i,n,r,o){if(0===this.children.length){if(i===s.Group.RETURN_TOTAL)return 0;if(i===s.Group.RETURN_ALL)return[]}var a=0;if(i===s.Group.RETURN_ALL)var h=[];for(var l=0;l0)return this.children[this.children.length-1]},s.Group.prototype.getBottom=function(){if(this.children.length>0)return this.children[0]},s.Group.prototype.getClosestTo=function(t,e,i){for(var n=Number.MAX_VALUE,r=0,o=null,a=0;an&&(!e||e.call(i,h,r))&&(n=r,o=h)}return o},s.Group.prototype.count=function(t,e){return this.iterate(t,e,s.Group.RETURN_TOTAL)},s.Group.prototype.countLiving=function(){return this.count("alive",!0)},s.Group.prototype.countDead=function(){return this.count("alive",!1)},s.Group.prototype.getRandom=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.children.length),0===e?null:s.ArrayUtils.getRandomItem(this.children,t,e)},s.Group.prototype.getRandomExists=function(t,e){var i=this.getAll("exists",!0,t,e);return this.game.rnd.pick(i)},s.Group.prototype.getAll=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.children.length);for(var s=[],r=i;r0&&t instanceof s.Group){do{t.add(this.children[0],e)}while(this.children.length>0);this.hash=[],this.cursor=null}return t},s.Group.prototype.removeAll=function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1),0!==this.children.length){do{!e&&this.children[0].events&&this.children[0].events.onRemovedFromGroup$dispatch(this.children[0],this);var n=this.removeChild(this.children[0]);this.removeFromHash(n),t&&n&&n.destroy(!0,i)}while(this.children.length>0);this.hash=[],this.cursor=null}},s.Group.prototype.removeBetween=function(t,e,i,n){if(void 0===e&&(e=this.children.length-1),void 0===i&&(i=!1),void 0===n&&(n=!1),0!==this.children.length){if(t>e||t<0||e>this.children.length)return!1;for(var s=e;s>=t;){!n&&this.children[s].events&&this.children[s].events.onRemovedFromGroup$dispatch(this.children[s],this);var r=this.removeChild(this.children[s]);this.removeFromHash(r),i&&r&&r.destroy(!0),this.cursor===this.children[s]&&(this.cursor=null),s--}this.updateZ()}},s.Group.prototype.scatter=function(t,e){null==t&&(t=this.game.world.bounds),this.forEach((function(e){e.position.set(t.randomX,t.randomY)}),null,e)},s.Group.prototype.shuffle=function(){s.ArrayUtils.shuffle(this.children),this.updateZ()},s.Group.prototype.destroy=function(t,e){null===this.game||this.ignoreDestroy||(void 0===t&&(t=!0),void 0===e&&(e=!1),this.onDestroy.dispatch(this,t,e),this.removeAll(t),this.cursor=null,this.filters=null,this.pendingDestroy=!1,e||(this.parent&&this.parent.removeChild(this),this.game=null,this.exists=!1))},Object.defineProperty(s.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,s.Group.RETURN_TOTAL)}}),Object.defineProperty(s.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(s.Group.prototype,"angle",{get:function(){return s.Math.radToDeg(this.rotation)},set:function(t){this.rotation=s.Math.degToRad(t)}}),Object.defineProperty(s.Group.prototype,"centerX",{get:function(){return this.getBounds(this.parent).centerX},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.halfWidth}}),Object.defineProperty(s.Group.prototype,"centerY",{get:function(){return this.getBounds(this.parent).centerY},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.halfHeight}}),Object.defineProperty(s.Group.prototype,"left",{get:function(){return this.getBounds(this.parent).left},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i}}),Object.defineProperty(s.Group.prototype,"right",{get:function(){return this.getBounds(this.parent).right},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.width}}),Object.defineProperty(s.Group.prototype,"top",{get:function(){return this.getBounds(this.parent).top},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i}}),Object.defineProperty(s.Group.prototype,"bottom",{get:function(){return this.getBounds(this.parent).bottom},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.height}}), +n.Group=function(t,e,i,s,r,o){void 0===s&&(s=!1),void 0===r&&(r=!1),void 0===o&&(o=n.Physics.ARCADE),this.game=t,void 0===e&&(e=t.world),this.name=i||"group",this.z=0,PIXI.DisplayObjectContainer.call(this),s?(this.game.stage.addChild(this),this.z=this.game.stage.children.length):e&&(e.addChild(this),this.z=e.children.length),this.type=n.GROUP,this.physicsType=n.GROUP,this.alive=!0,this.exists=!0,this.ignoreDestroy=!1,this.pendingDestroy=!1,this.classType=n.Sprite,this.cursor=null,this.inputEnableChildren=!1,this.updateOnlyExistingChildren=!1,this.onChildInputDown=new n.Signal,this.onChildInputUp=new n.Signal,this.onChildInputOver=new n.Signal,this.onChildInputOut=new n.Signal,this.enableBody=r,this.enableBodyDebug=!1,this.physicsBodyType=o,this.physicsSortDirection=null,this.onDestroy=new n.Signal,this.cursorIndex=0,this.fixedToCamera=!1,this.cameraOffset=new n.Point,this.hash=[],this._sortProperty="z"},n.Group.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.Group.prototype.constructor=n.Group,n.Group.RETURN_NONE=0,n.Group.RETURN_TOTAL=1,n.Group.RETURN_CHILD=2,n.Group.RETURN_ALL=3,n.Group.SORT_ASCENDING=-1,n.Group.SORT_DESCENDING=1,n.Group.prototype.add=function(t,e,i){return void 0===e&&(e=!1),t.parent===this||(t.body&&t.parent&&t.parent.hash&&t.parent.removeFromHash(t),void 0===i?(t.z=this.children.length,this.addChild(t)):(this.addChildAt(t,i),this.updateZ()),this.enableBody&&t.hasOwnProperty("body")&&null===t.body?this.game.physics.enable(t,this.physicsBodyType):t.body&&this.addToHash(t),!this.inputEnableChildren||t.input&&!t.inputEnabled||(t.inputEnabled=!0),!e&&t.events&&t.events.onAddedToGroup$dispatch(t,this),null===this.cursor&&(this.cursor=t)),t},n.Group.prototype.addAt=function(t,e,i){return this.add(t,i,e)},n.Group.prototype.addToHash=function(t){if(t.parent===this&&-1===this.hash.indexOf(t))return this.hash.push(t),!0;return!1},n.Group.prototype.removeFromHash=function(t){if(t){var e=this.hash.indexOf(t);if(-1!==e)return this.hash.splice(e,1),!0}return!1},n.Group.prototype.addMultiple=function(t,e){if(t instanceof n.Group)t.moveAll(this,e);else if(Array.isArray(t))for(var i=0;i=this.children.length?-1:this.getChildAt(t)},n.Group.prototype.create=function(t,e,i,n,s,r){void 0===s&&(s=!0);var o=new this.classType(this.game,t,e,i,n);return o.exists=s,o.visible=s,o.alive=s,this.add(o,!1,r)},n.Group.prototype.createMultiple=function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=!1),Array.isArray(e)||(e=[e]),Array.isArray(i)||(i=[i]);var o=this,a=[];return e.forEach((function(e){i.forEach((function(i){for(var h=0;hthis.children.length||-1===t&&-1===e)return!1;for(var a=new n.Rectangle(0,0,i,s),h=t*i,l=e*s,c=o;cthis.children.length-1&&(t=0),this.cursor)return this.cursorIndex=t,this.cursor=this.children[this.cursorIndex],this.cursor},n.Group.prototype.next=function(){if(this.cursor)return this.cursorIndex>=this.children.length-1?this.cursorIndex=0:this.cursorIndex++,this.cursor=this.children[this.cursorIndex],this.cursor},n.Group.prototype.previous=function(){if(this.cursor)return 0===this.cursorIndex?this.cursorIndex=this.children.length-1:this.cursorIndex--,this.cursor=this.children[this.cursorIndex],this.cursor},n.Group.prototype.swap=function(t,e){this.swapChildren(t,e),this.updateZ()},n.Group.prototype.bringToTop=function(t){return t.parent===this&&this.getIndex(t)0&&(this.remove(t,!1,!0),this.addAt(t,0,!0)),t},n.Group.prototype.sendChildToBack=n.Group.prototype.sendToBack,n.Group.prototype.moveUp=function(t){if(t.parent===this&&this.getIndex(t)0){var e=this.getIndex(t),i=this.getAt(e-1);i&&this.swap(t,i)}return t},n.Group.prototype.xy=function(t,e,i){if(t<0||t>this.children.length)return-1;this.getChildAt(t).x=e,this.getChildAt(t).y=i},n.Group.prototype.reverse=function(){this.children.reverse(),this.updateZ()},n.Group.prototype.getIndex=function(t){return this.children.indexOf(t)},n.Group.prototype.getByName=function(t){return this.getFirst("name",t)},n.Group.prototype.replace=function(t,e){var i=this.getIndex(t);if(-1!==i)return e.parent&&(e.parent instanceof n.Group?e.parent.remove(e):e.parent.removeChild(e)),this.remove(t),this.addAt(e,i),t},n.Group.prototype.hasProperty=function(t,e){var i=e.length;return 1===i&&e[0]in t||(2===i&&e[0]in t&&e[1]in t[e[0]]||(3===i&&e[0]in t&&e[1]in t[e[0]]&&e[2]in t[e[0]][e[1]]||4===i&&e[0]in t&&e[1]in t[e[0]]&&e[2]in t[e[0]][e[1]]&&e[3]in t[e[0]][e[1]][e[2]]))},n.Group.prototype.setProperty=function(t,e,i,n,s){if(void 0===s&&(s=!1),n=n||0,!this.hasProperty(t,e)&&(!s||n>0))return!1;var r=e.length;return 1===r?0===n?t[e[0]]=i:1===n?t[e[0]]+=i:2===n?t[e[0]]-=i:3===n?t[e[0]]*=i:4===n&&(t[e[0]]/=i):2===r?0===n?t[e[0]][e[1]]=i:1===n?t[e[0]][e[1]]+=i:2===n?t[e[0]][e[1]]-=i:3===n?t[e[0]][e[1]]*=i:4===n&&(t[e[0]][e[1]]/=i):3===r?0===n?t[e[0]][e[1]][e[2]]=i:1===n?t[e[0]][e[1]][e[2]]+=i:2===n?t[e[0]][e[1]][e[2]]-=i:3===n?t[e[0]][e[1]][e[2]]*=i:4===n&&(t[e[0]][e[1]][e[2]]/=i):4===r&&(0===n?t[e[0]][e[1]][e[2]][e[3]]=i:1===n?t[e[0]][e[1]][e[2]][e[3]]+=i:2===n?t[e[0]][e[1]][e[2]][e[3]]-=i:3===n?t[e[0]][e[1]][e[2]][e[3]]*=i:4===n&&(t[e[0]][e[1]][e[2]][e[3]]/=i)),!0},n.Group.prototype.checkProperty=function(t,e,i,s){if(void 0===s&&(s=!1),this!==t.parent)return!1;var r=n.Utils.getProperty(t,e);return!(void 0===r&&s||r!==i)},n.Group.prototype.set=function(t,e,i,n,s,r,o){if(void 0===o&&(o=!1),e=e.split("."),void 0===n&&(n=!1),void 0===s&&(s=!1),(!1===n||n&&t.alive)&&(!1===s||s&&t.visible))return this.setProperty(t,e,i,r,o)},n.Group.prototype.setAll=function(t,e,i,n,s,r){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),t=t.split("."),s=s||0;for(var o=this.children.length,a=0;a2){i=[];for(var n=2;n2){i=[];for(var r=2;r=e&&(t=e-1);var i=this.children[t];this.updateOnlyExistingChildren&&!i.exists||i.update()}},n.Group.prototype.postUpdate=function(){this.fixedToCamera&&(this.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var t=0;t2){i=[null];for(var s=2;s2){i=[null];for(var s=2;s2){i=[null];for(var s=2;se[this._sortProperty]?1:t.ze[this._sortProperty]?-1:0},n.Group.prototype.iterate=function(t,e,i,s,r,o){if(0===this.children.length){if(i===n.Group.RETURN_TOTAL)return 0;if(i===n.Group.RETURN_ALL)return[]}var a=0;if(i===n.Group.RETURN_ALL)var h=[];for(var l=0;l0)return this.children[this.children.length-1]},n.Group.prototype.getBottom=function(){if(this.children.length>0)return this.children[0]},n.Group.prototype.getClosestTo=function(t,e,i){for(var s=Number.MAX_VALUE,r=0,o=null,a=0;as&&(!e||e.call(i,h,r))&&(s=r,o=h)}return o},n.Group.prototype.count=function(t,e){return this.iterate(t,e,n.Group.RETURN_TOTAL)},n.Group.prototype.countLiving=function(){return this.count("alive",!0)},n.Group.prototype.countDead=function(){return this.count("alive",!1)},n.Group.prototype.getRandom=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.children.length),0===e?null:n.ArrayUtils.getRandomItem(this.children,t,e)},n.Group.prototype.getRandomExists=function(t,e){var i=this.getAll("exists",!0,t,e);return this.game.rnd.pick(i)},n.Group.prototype.getAll=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.children.length);for(var s=[],r=i;r0&&t instanceof n.Group){do{t.add(this.children[0],e)}while(this.children.length>0);this.hash=[],this.cursor=null}return t},n.Group.prototype.removeAll=function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1),0!==this.children.length){do{!e&&this.children[0].events&&this.children[0].events.onRemovedFromGroup$dispatch(this.children[0],this);var n=this.removeChild(this.children[0]);this.removeFromHash(n),t&&n&&n.destroy(!0,i)}while(this.children.length>0);this.hash=[],this.cursor=null}},n.Group.prototype.removeBetween=function(t,e,i,n){if(void 0===e&&(e=this.children.length-1),void 0===i&&(i=!1),void 0===n&&(n=!1),0!==this.children.length){if(t>e||t<0||e>this.children.length)return!1;for(var s=e;s>=t;){!n&&this.children[s].events&&this.children[s].events.onRemovedFromGroup$dispatch(this.children[s],this);var r=this.removeChild(this.children[s]);this.removeFromHash(r),i&&r&&r.destroy(!0),this.cursor===this.children[s]&&(this.cursor=null),s--}this.updateZ()}},n.Group.prototype.scatter=function(t,e){null==t&&(t=this.game.world.bounds),this.forEach((function(e){e.position.set(t.randomX,t.randomY)}),null,e)},n.Group.prototype.shuffle=function(){n.ArrayUtils.shuffle(this.children),this.updateZ()},n.Group.prototype.destroy=function(t,e){null===this.game||this.ignoreDestroy||(void 0===t&&(t=!0),void 0===e&&(e=!1),this.onDestroy.dispatch(this,t,e),this.removeAll(t),this.cursor=null,this.filters=null,this.pendingDestroy=!1,e||(this.parent&&this.parent.removeChild(this),this.game=null,this.exists=!1))},Object.defineProperty(n.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,n.Group.RETURN_TOTAL)}}),Object.defineProperty(n.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(n.Group.prototype,"angle",{get:function(){return n.Math.radToDeg(this.rotation)},set:function(t){this.rotation=n.Math.degToRad(t)}}),Object.defineProperty(n.Group.prototype,"centerX",{get:function(){return this.getBounds(this.parent).centerX},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.halfWidth}}),Object.defineProperty(n.Group.prototype,"centerY",{get:function(){return this.getBounds(this.parent).centerY},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.halfHeight}}),Object.defineProperty(n.Group.prototype,"left",{get:function(){return this.getBounds(this.parent).left},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i}}),Object.defineProperty(n.Group.prototype,"right",{get:function(){return this.getBounds(this.parent).right},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.width}}),Object.defineProperty(n.Group.prototype,"top",{get:function(){return this.getBounds(this.parent).top},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i}}),Object.defineProperty(n.Group.prototype,"bottom",{get:function(){return this.getBounds(this.parent).bottom},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.height}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.World=function(t){s.Group.call(this,t,null,"__world",!1),this.bounds=new s.Rectangle(0,0,t.width,t.height),this.camera=null,this._definedSize=!1,this._width=t.width,this._height=t.height,this.game.state.onStateChange.add(this.stateChange,this)},s.World.prototype=Object.create(s.Group.prototype),s.World.prototype.constructor=s.World,s.World.prototype.boot=function(){this.camera=new s.Camera(this.game,0,0,0,this.game.width,this.game.height),this.game.stage.addChild(this),this.camera.boot()},s.World.prototype.stateChange=function(){this.x=0,this.y=0,this.camera.reset()},s.World.prototype.setBounds=function(t,e,i,n){this._definedSize=!0,this._width=i,this._height=n,this.bounds.setTo(t,e,i,n),this.x=t,this.y=e,this.camera.bounds&&this.camera.bounds.setTo(t,e,Math.max(i,this.game.width),Math.max(n,this.game.height)),this.game.physics.setBoundsToWorld()},s.World.prototype.resize=function(t,e){this._definedSize&&(tthis.bounds.right&&(t.x=this.bounds.left)),s&&(t.y+t._currentBounds.heightthis.bounds.bottom&&(t.y=this.bounds.top))):(n&&t.x+ethis.bounds.right&&(t.x=this.bounds.left-e),s&&t.y+ethis.bounds.bottom&&(t.y=this.bounds.top-e))},s.World.prototype.wrapAll=function(t,e,i,n,s,r){t.forEach(this.wrap,this,e,i,n,s,r)},Object.defineProperty(s.World.prototype,"width",{get:function(){return this.bounds.width},set:function(t){tthis.bounds.right&&(t.x=this.bounds.left)),s&&(t.y+t._currentBounds.heightthis.bounds.bottom&&(t.y=this.bounds.top))):(n&&t.x+ethis.bounds.right&&(t.x=this.bounds.left-e),s&&t.y+ethis.bounds.bottom&&(t.y=this.bounds.top-e))},n.World.prototype.wrapAll=function(t,e,i,n,s,r){t.forEach(this.wrap,this,e,i,n,s,r)},Object.defineProperty(n.World.prototype,"width",{get:function(){return this.bounds.width},set:function(t){t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Game=function(t,e,i,n,r,o,a,h){return this.id=s.GAMES.push(this)-1,this.config=null,this.physicsConfig=h,this.parent="",this.width=800,this.height=600,this.resolution=1,this._width=800,this._height=600,this.transparent=!1,this.antialias=!0,this.multiTexture=!1,this.preserveDrawingBuffer=!1,this.clearBeforeRender=!0,this.renderer=null,this.renderType=s.AUTO,this.state=null,this.isBooted=!1,this.isRunning=!1,this.raf=null,this.add=null,this.make=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.net=null,this.scale=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.physics=null,this.plugins=null,this.rnd=null,this.device=s.Device,this.camera=null,this.canvas=null,this.context=null,this.debug=null,this.particles=null,this.create=null,this.lockRender=!1,this.pendingDestroy=!1,this.stepping=!1,this.pendingStep=!1,this.stepCount=0,this.onPause=null,this.onResume=null,this.onBlur=null,this.onFocus=null,this._paused=!1,this._codePaused=!1,this.currentUpdateID=0,this.updatesThisFrame=1,this.rendersThisFrame=1,this._deltaTime=0,this._lastCount=0,this._spiraling=0,this._kickstart=!0,this.fpsProblemNotifier=new s.Signal,this.forceSingleUpdate=!0,this.forceSingleRender=!0,this.dropFrames=!1,this.maxUpdates=3,this.powerPreference="default",this._nextFpsNotification=0,1===arguments.length&&"object"==typeof arguments[0]?this.parseConfig(arguments[0]):(this.config={enableDebug:!0},void 0!==t&&(this._width=t),void 0!==e&&(this._height=e),void 0!==i&&(this.renderType=i),void 0!==n&&(this.parent=n),void 0!==o&&(this.transparent=o),void 0!==a&&(this.antialias=a),this.rnd=new s.RandomDataGenerator([(Date.now()*Math.random()).toString()]),this.state=new s.StateManager(this,r)),this.device.whenReady(this.boot,this),this},s.Game.prototype={parseConfig:function(t){this.config=t,void 0===t.enableDebug&&(this.config.enableDebug=!0),t.width&&(this._width=t.width),t.height&&(this._height=t.height),t.renderer&&(this.renderType=t.renderer),t.parent&&(this.parent=t.parent),void 0!==t.transparent&&(this.transparent=t.transparent),void 0!==t.antialias&&(this.antialias=t.antialias),void 0!==t.clearBeforeRender&&(this.clearBeforeRender=t.clearBeforeRender),void 0!==t.multiTexture&&(this.multiTexture=t.multiTexture),t.resolution&&(this.resolution=t.resolution),void 0!==t.preserveDrawingBuffer&&(this.preserveDrawingBuffer=t.preserveDrawingBuffer),void 0!==t.powerPreference&&(this.powerPreference=t.powerPreference),t.physicsConfig&&(this.physicsConfig=t.physicsConfig);var e=[(Date.now()*Math.random()).toString()];t.seed&&(e=t.seed),this.rnd=new s.RandomDataGenerator(e);var i=null;t.state&&(i=t.state),this.state=new s.StateManager(this,i)},boot:function(){if(!this.isBooted){if(this.onPause=new s.Signal,this.onResume=new s.Signal,this.onBlur=new s.Signal,this.onFocus=new s.Signal,this.isBooted=!0,PIXI.game=this,this.math=s.Math,this.scale=new s.ScaleManager(this,this._width,this._height),this.stage=new s.Stage(this),this.setUpRenderer(),this.world=new s.World(this),this.add=new s.GameObjectFactory(this),this.make=new s.GameObjectCreator(this),this.cache=new s.Cache(this),this.load=new s.Loader(this),this.time=new s.Time(this),this.tweens=new s.TweenManager(this),this.input=new s.Input(this),this.sound=new s.SoundManager(this),this.physics=new s.Physics(this,this.physicsConfig),this.particles=new s.Particles(this),this.create=new s.Create(this),this.plugins=new s.PluginManager(this),this.net=new s.Net(this),this.time.boot(),this.stage.boot(),this.world.boot(),this.scale.boot(),this.input.boot(this.config),this.sound.boot(),this.state.boot(),this.config.enableDebug)this.debug=new s.Utils.Debug(this),this.debug.boot();else{var t=function(){};this.debug={preUpdate:t,update:t,reset:t,destroy:t,isDisabled:!0}}this.showDebugHeader(),this.isRunning=!0,this.config&&this.config.forceSetTimeOut?this.raf=new s.RequestAnimationFrame(this,this.config.forceSetTimeOut):this.raf=new s.RequestAnimationFrame(this,!1),this._kickstart=!0,this.focusWindow(),this.config.disableStart||(this.cache.isReady?this.raf.start():this.cache.onReady.addOnce((function(){this.raf.start()}),this))}},showDebugHeader:function(){if(!window.PhaserGlobal||!window.PhaserGlobal.hideBanner){var t=s.VERSION,e="Canvas",i="HTML Audio",n=1;if(this.renderType===s.WEBGL?(e="WebGL",n++):this.renderType===s.HEADLESS&&(e="Headless"),this.device.webAudio&&(i="WebAudio",n++),this.device.ie)window.console&&console.log("Phaser v"+t+" | Pixi.js | "+e+" | "+i+" | http://phaser.io");else{for(var r=["%c %c %c Phaser CE v"+t+" | Pixi.js | "+e+" | "+i+" %c %c %c http://phaser.io %c♥%c♥%c♥","background: #fb8cb3","background: #d44a52","color: #ffffff; background: #871905;","background: #d44a52","background: #fb8cb3","background: #ffffff"],o=0;o<3;o++)o1&&!this.forceSingleUpdate)this.time.time>this._nextFpsNotification&&(this._nextFpsNotification=this.time.time+1e4,this.fpsProblemNotifier.dispatch()),this._deltaTime=0,this._spiraling=0,this.dropFrames?this.rendersThisFrame=0:(this.updateRender(this.time.slowMotion*this.time.desiredFps),this.rendersThisFrame=1);else{var e=1e3*this.time.slowMotion/this.time.desiredFps;this._deltaTime+=Math.max(Math.min(e*this.maxUpdates,this.time.elapsed),0);var i=0;for(this.updatesThisFrame=Math.floor(this._deltaTime/e),this.forceSingleUpdate&&(this.updatesThisFrame=Math.min(1,this.updatesThisFrame)),this.forceSingleRender?this.rendersThisFrame=1:this.rendersThisFrame=Math.min(1,this.updatesThisFrame);this._deltaTime>=e&&(this._deltaTime-=e,this.currentUpdateID=i,this.updateLogic(this.time.desiredFpsMult),i++,!this.forceSingleUpdate||1!==i);)this.time.refresh();i>this._lastCount?this._spiraling++:i0&&this.updateRender(this._deltaTime/e)}this.renderer.type===s.WEBGL&&this.renderer.gl.flush()}},updateLogic:function(t){this._paused||this.pendingStep?(this.scale.pauseUpdate(),this.state.pauseUpdate(t),this.debug.preUpdate(),this.input.pauseUpdate()):(this.stepping&&(this.pendingStep=!0),this.time.preUpdate(),this.scale.preUpdate(),this.debug.preUpdate(),this.camera.preUpdate(),this.physics.preUpdate(),this.state.preUpdate(t),this.plugins.preUpdate(t),this.stage.preUpdate(),this.state.update(),this.stage.update(),this.tweens.update(),this.sound.update(),this.input.update(),this.physics.update(),this.plugins.update(),this.stage.postUpdate(),this.state.postUpdate(),this.plugins.postUpdate()),this.stage.updateTransform()},updateRender:function(t){this.lockRender||this.renderType===s.HEADLESS||(this.time.preRender(),this.state.preRender(t),this.renderer.render(this.stage),this.plugins.render(t),this.state.render(t),this.plugins.postRender(t))},enableStep:function(){this.stepping=!0,this.pendingStep=!1,this.stepCount=0},disableStep:function(){this.stepping=!1,this.pendingStep=!1},step:function(){this.pendingStep=!1,this.stepCount++},destroy:function(){this.raf.stop(),this.debug.destroy(),this.state.destroy(),this.sound.destroy(),this.scale.destroy(),this.stage.destroy(),this.input.destroy(),this.physics.destroy(),this.plugins.destroy(),this.tweens.destroy(),this.debug=null,this.state=null,this.sound=null,this.scale=null,this.stage=null,this.input=null,this.physics=null,this.plugins=null,this.tweens=null,this.cache=null,this.load=null,this.time=null,this.world=null,this.isBooted=!1,this.renderer.destroy(!1),s.Canvas.removeFromDOM(this.canvas),PIXI.game===this&&(PIXI.game=null),PIXI.defaultRenderer=null,s.GAMES[this.id]=null},gamePaused:function(t){this._paused||(this._paused=!0,this.time.gamePaused(),this.sound.gamePaused(),this.onPause.dispatch(t),this.device.cordova&&this.device.iOS&&(this.lockRender=!0))},gameResumed:function(t){this._paused&&!this._codePaused&&(this._paused=!1,this.time.gameResumed(),this.input.reset(),this.sound.gameResumed(),this.onResume.dispatch(t),this.device.cordova&&this.device.iOS&&(this.lockRender=!1))},focusLoss:function(t){this.onBlur.dispatch(t),this.stage.disableVisibilityChange||this.gamePaused(t)},focusGain:function(t){this.focusWindow(),this.onFocus.dispatch(t),this.stage.disableVisibilityChange||this.gameResumed(t)},focusWindow:function(){window.focus&&(!window.PhaserGlobal||window.PhaserGlobal&&!window.PhaserGlobal.stopFocus)&&window.focus()}},s.Game.prototype.constructor=s.Game,Object.defineProperty(s.Game.prototype,"paused",{get:function(){return this._paused},set:function(t){!0===t?(!1===this._paused&&(this._paused=!0,this.sound.muteOnPause&&this.sound.setMute(),this.time.gamePaused(),this.onPause.dispatch(this)),this._codePaused=!0):(this._paused&&(this._paused=!1,this.input.reset(),this.sound.unsetMute(),this.time.gameResumed(),this.onResume.dispatch(this)),this._codePaused=!1)}}), +n.Game=function(t,e,i,s,r,o,a,h){return this.id=n.GAMES.push(this)-1,this.config=null,this.physicsConfig=h,this.parent="",this.width=800,this.height=600,this.resolution=1,this._width=800,this._height=600,this.transparent=!1,this.antialias=!0,this.multiTexture=!1,this.preserveDrawingBuffer=!1,this.clearBeforeRender=!0,this.renderer=null,this.renderType=n.AUTO,this.state=null,this.isBooted=!1,this.isRunning=!1,this.raf=null,this.add=null,this.make=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.net=null,this.scale=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.physics=null,this.plugins=null,this.rnd=null,this.device=n.Device,this.camera=null,this.canvas=null,this.context=null,this.debug=null,this.particles=null,this.create=null,this.lockRender=!1,this.pendingDestroy=!1,this.stepping=!1,this.pendingStep=!1,this.stepCount=0,this.onPause=null,this.onResume=null,this.onBlur=null,this.onFocus=null,this._paused=!1,this._codePaused=!1,this.currentUpdateID=0,this.updatesThisFrame=1,this.rendersThisFrame=1,this._deltaTime=0,this._lastCount=0,this._spiraling=0,this._kickstart=!0,this.fpsProblemNotifier=new n.Signal,this.forceSingleUpdate=!0,this.forceSingleRender=!0,this.dropFrames=!1,this.maxUpdates=3,this.powerPreference="default",this._nextFpsNotification=0,1===arguments.length&&"object"==typeof arguments[0]?this.parseConfig(arguments[0]):(this.config={enableDebug:!0},void 0!==t&&(this._width=t),void 0!==e&&(this._height=e),void 0!==i&&(this.renderType=i),void 0!==s&&(this.parent=s),void 0!==o&&(this.transparent=o),void 0!==a&&(this.antialias=a),this.rnd=new n.RandomDataGenerator([(Date.now()*Math.random()).toString()]),this.state=new n.StateManager(this,r)),this.device.whenReady(this.boot,this),this},n.Game.prototype={parseConfig:function(t){this.config=t,void 0===t.enableDebug&&(this.config.enableDebug=!0),t.width&&(this._width=t.width),t.height&&(this._height=t.height),t.renderer&&(this.renderType=t.renderer),t.parent&&(this.parent=t.parent),void 0!==t.transparent&&(this.transparent=t.transparent),void 0!==t.antialias&&(this.antialias=t.antialias),void 0!==t.clearBeforeRender&&(this.clearBeforeRender=t.clearBeforeRender),void 0!==t.multiTexture&&(this.multiTexture=t.multiTexture),t.resolution&&(this.resolution=t.resolution),void 0!==t.preserveDrawingBuffer&&(this.preserveDrawingBuffer=t.preserveDrawingBuffer),void 0!==t.powerPreference&&(this.powerPreference=t.powerPreference),t.physicsConfig&&(this.physicsConfig=t.physicsConfig);var e=[(Date.now()*Math.random()).toString()];t.seed&&(e=t.seed),this.rnd=new n.RandomDataGenerator(e);var i=null;t.state&&(i=t.state),this.state=new n.StateManager(this,i)},boot:function(){if(!this.isBooted){if(this.onPause=new n.Signal,this.onResume=new n.Signal,this.onBlur=new n.Signal,this.onFocus=new n.Signal,this.isBooted=!0,PIXI.game=this,this.math=n.Math,this.scale=new n.ScaleManager(this,this._width,this._height),this.stage=new n.Stage(this),this.setUpRenderer(),this.world=new n.World(this),this.add=new n.GameObjectFactory(this),this.make=new n.GameObjectCreator(this),this.cache=new n.Cache(this),this.load=new n.Loader(this),this.time=new n.Time(this),this.tweens=new n.TweenManager(this),this.input=new n.Input(this),this.sound=new n.SoundManager(this),this.physics=new n.Physics(this,this.physicsConfig),this.particles=new n.Particles(this),this.create=new n.Create(this),this.plugins=new n.PluginManager(this),this.net=new n.Net(this),this.time.boot(),this.stage.boot(),this.world.boot(),this.scale.boot(),this.input.boot(this.config),this.sound.boot(),this.state.boot(),this.config.enableDebug)this.debug=new n.Utils.Debug(this),this.debug.boot();else{var t=function(){};this.debug={preUpdate:t,update:t,reset:t,destroy:t,isDisabled:!0}}this.showDebugHeader(),this.isRunning=!0,this.config&&this.config.forceSetTimeOut?this.raf=new n.RequestAnimationFrame(this,this.config.forceSetTimeOut):this.raf=new n.RequestAnimationFrame(this,!1),this._kickstart=!0,this.focusWindow(),this.config.disableStart||(this.cache.isReady?this.raf.start():this.cache.onReady.addOnce((function(){this.raf.start()}),this))}},showDebugHeader:function(){if(!window.PhaserGlobal||!window.PhaserGlobal.hideBanner){var t=n.VERSION,e="Canvas",i="HTML Audio",s=1;if(this.renderType===n.WEBGL?(e="WebGL",s++):this.renderType===n.HEADLESS&&(e="Headless"),this.device.webAudio&&(i="WebAudio",s++),this.device.ie)window.console&&console.log("Phaser v"+t+" | Pixi.js | "+e+" | "+i+" | http://phaser.io");else{for(var r=["%c %c %c Phaser CE v"+t+" | Pixi.js | "+e+" | "+i+" %c %c %c http://phaser.io %c♥%c♥%c♥","background: #fb8cb3","background: #d44a52","color: #ffffff; background: #871905;","background: #d44a52","background: #fb8cb3","background: #ffffff"],o=0;o<3;o++)o1&&!this.forceSingleUpdate)this.time.time>this._nextFpsNotification&&(this._nextFpsNotification=this.time.time+1e4,this.fpsProblemNotifier.dispatch()),this._deltaTime=0,this._spiraling=0,this.dropFrames?this.rendersThisFrame=0:(this.updateRender(this.time.slowMotion*this.time.desiredFps),this.rendersThisFrame=1);else{var e=1e3*this.time.slowMotion/this.time.desiredFps;this._deltaTime+=Math.max(Math.min(e*this.maxUpdates,this.time.elapsed),0);var i=0;for(this.updatesThisFrame=Math.floor(this._deltaTime/e),this.forceSingleUpdate&&(this.updatesThisFrame=Math.min(1,this.updatesThisFrame)),this.forceSingleRender?this.rendersThisFrame=1:this.rendersThisFrame=Math.min(1,this.updatesThisFrame);this._deltaTime>=e&&(this._deltaTime-=e,this.currentUpdateID=i,this.updateLogic(this.time.desiredFpsMult),i++,!this.forceSingleUpdate||1!==i);)this.time.refresh();i>this._lastCount?this._spiraling++:i0&&this.updateRender(this._deltaTime/e)}this.renderer.type===n.WEBGL&&this.renderer.gl.flush()}},updateLogic:function(t){this._paused||this.pendingStep?(this.scale.pauseUpdate(),this.state.pauseUpdate(t),this.debug.preUpdate(),this.input.pauseUpdate()):(this.stepping&&(this.pendingStep=!0),this.time.preUpdate(),this.scale.preUpdate(),this.debug.preUpdate(),this.camera.preUpdate(),this.physics.preUpdate(),this.state.preUpdate(t),this.plugins.preUpdate(t),this.stage.preUpdate(),this.state.update(),this.stage.update(),this.tweens.update(),this.sound.update(),this.input.update(),this.physics.update(),this.plugins.update(),this.stage.postUpdate(),this.state.postUpdate(),this.plugins.postUpdate()),this.stage.updateTransform()},updateRender:function(t){this.lockRender||this.renderType===n.HEADLESS||(this.time.preRender(),this.state.preRender(t),this.renderer.render(this.stage),this.plugins.render(t),this.state.render(t),this.plugins.postRender(t))},enableStep:function(){this.stepping=!0,this.pendingStep=!1,this.stepCount=0},disableStep:function(){this.stepping=!1,this.pendingStep=!1},step:function(){this.pendingStep=!1,this.stepCount++},destroy:function(){this.raf.stop(),this.debug.destroy(),this.state.destroy(),this.sound.destroy(),this.scale.destroy(),this.stage.destroy(),this.input.destroy(),this.physics.destroy(),this.plugins.destroy(),this.tweens.destroy(),this.debug=null,this.state=null,this.sound=null,this.scale=null,this.stage=null,this.input=null,this.physics=null,this.plugins=null,this.tweens=null,this.cache=null,this.load=null,this.time=null,this.world=null,this.isBooted=!1,this.renderer.destroy(!1),n.Canvas.removeFromDOM(this.canvas),PIXI.game===this&&(PIXI.game=null),PIXI.defaultRenderer=null,n.GAMES[this.id]=null},gamePaused:function(t){this._paused||(this._paused=!0,this.time.gamePaused(),this.sound.gamePaused(),this.onPause.dispatch(t),this.device.cordova&&this.device.iOS&&(this.lockRender=!0))},gameResumed:function(t){this._paused&&!this._codePaused&&(this._paused=!1,this.time.gameResumed(),this.input.reset(),this.sound.gameResumed(),this.onResume.dispatch(t),this.device.cordova&&this.device.iOS&&(this.lockRender=!1))},focusLoss:function(t){this.onBlur.dispatch(t),this.stage.disableVisibilityChange||this.gamePaused(t)},focusGain:function(t){this.focusWindow(),this.onFocus.dispatch(t),this.stage.disableVisibilityChange||this.gameResumed(t)},focusWindow:function(){window.focus&&(!window.PhaserGlobal||window.PhaserGlobal&&!window.PhaserGlobal.stopFocus)&&window.focus()}},n.Game.prototype.constructor=n.Game,Object.defineProperty(n.Game.prototype,"paused",{get:function(){return this._paused},set:function(t){!0===t?(!1===this._paused&&(this._paused=!0,this.sound.muteOnPause&&this.sound.setMute(),this.time.gamePaused(),this.onPause.dispatch(this)),this._codePaused=!0):(this._paused&&(this._paused=!1,this.input.reset(),this.sound.unsetMute(),this.time.gameResumed(),this.onResume.dispatch(this)),this._codePaused=!1)}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Input=function(t){this.game=t,this.hitCanvas=null,this.hitContext=null,this.moveCallbacks=[],this.customCandidateHandler=null,this.customCandidateHandlerContext=null,this.pollRate=0,this.enabled=!0,this.multiInputOverride=s.Input.MOUSE_TOUCH_COMBINE,this.position=null,this.speed=null,this.circle=null,this.scale=null,this.maxPointers=-1,this.tapRate=200,this.doubleTapRate=300,this.holdRate=2e3,this.justPressedRate=200,this.justReleasedRate=200,this.recordPointerHistory=!1,this.recordRate=100,this.recordLimit=100,this.touchLockCallbacks=[],this.pointer1=null,this.pointer2=null,this.pointer3=null,this.pointer4=null,this.pointer5=null,this.pointer6=null,this.pointer7=null,this.pointer8=null,this.pointer9=null,this.pointer10=null,this.pointers=[],this.activePointer=null,this.mousePointer=null,this.mouse=null,this.keyboard=null,this.touch=null,this.mspointer=null,this.gamepad=null,this.resetLocked=!1,this.onDown=null,this.onUp=null,this.onTap=null,this.onHold=null,this.minPriorityID=0,this.interactiveItems=new s.ArraySet,this._localPoint=new s.Point,this._pollCounter=0,this._oldPosition=null,this._x=0,this._y=0},s.Input.MOUSE_OVERRIDES_TOUCH=0,s.Input.TOUCH_OVERRIDES_MOUSE=1,s.Input.MOUSE_TOUCH_COMBINE=2,s.Input.MAX_POINTERS=10,s.Input.prototype={boot:function(t){"maxPointers"in t&&(this.maxPointers=t.maxPointers),this.mousePointer=new s.Pointer(this.game,0,s.PointerMode.CURSOR),this.addPointer(),this.addPointer(),this.mouse=new s.Mouse(this.game),this.touch=new s.Touch(this.game),this.mspointer=new s.MSPointer(this.game),this.mouseWheel=new s.MouseWheel(this.game),this.pointerLock=new s.PointerLock(this.game),s.Keyboard&&(this.keyboard=new s.Keyboard(this.game)),s.Gamepad&&(this.gamepad=new s.Gamepad(this.game)),this.onDown=new s.Signal,this.onUp=new s.Signal,this.onTap=new s.Signal,this.onHold=new s.Signal,this.scale=new s.Point(1,1),this.speed=new s.Point,this.position=new s.Point,this._oldPosition=new s.Point,this.circle=new s.Circle(0,0,45),this.activePointer=this.mousePointer,this.hitCanvas=s.CanvasPool.create(this,1,1),this.hitContext=this.hitCanvas.getContext("2d"),this.game.device.mspointer&&!1!==t.mspointer?this.mspointer.start():this.game.device.touch&&!1!==t.touch&&this.touch.start(),this.mspointer.active||!1===t.mouse||this.mouse.start(),this.mousePointer.active=!0,!0===t.mouseWheel&&this.mouseWheel.start(),!1!==t.pointerLock&&this.pointerLock.start(),this.keyboard&&!1!==t.keyboard&&this.keyboard.start();var e=this;this._onClickTrampoline=function(t){e.onClickTrampoline(t)},this.game.canvas.addEventListener("click",this._onClickTrampoline,!1)},destroy:function(){this.mouse.stop(),this.mouseWheel.stop(),this.touch.stop(),this.mspointer.stop(),this.pointerLock.stop(),this.keyboard&&this.keyboard.stop(),this.gamepad&&this.gamepad.stop(),this.moveCallbacks=[],s.CanvasPool.remove(this),this.game.canvas.removeEventListener("click",this._onClickTrampoline)},setInteractiveCandidateHandler:function(t,e){this.customCandidateHandler=t,this.customCandidateHandlerContext=e},addMoveCallback:function(t,e){this.moveCallbacks.push({callback:t,context:e})},addTouchLockCallback:function(t,e,i){void 0===i&&(i=!1),this.touchLockCallbacks.push({callback:t,context:e,onEnd:i})},removeTouchLockCallback:function(t,e){for(var i=this.touchLockCallbacks.length;i--;)if(this.touchLockCallbacks[i].callback===t&&this.touchLockCallbacks[i].context===e)return this.touchLockCallbacks.splice(i,1),!0;return!1},executeTouchLockCallbacks:function(t,e){for(var i=this.touchLockCallbacks.length;i--;){var n=this.touchLockCallbacks[i];n.onEnd===t&&n.callback.call(n.context,this,e)&&this.touchLockCallbacks.splice(i,1)}},deleteMoveCallback:function(t,e){for(var i=this.moveCallbacks.length;i--;)if(this.moveCallbacks[i].callback===t&&this.moveCallbacks[i].context===e)return void this.moveCallbacks.splice(i,1)},addPointer:function(){if(this.pointers.length>=s.Input.MAX_POINTERS)return console.warn("Phaser.Input.addPointer: Maximum limit of "+s.Input.MAX_POINTERS+" pointers reached."),null;var t=this.pointers.length+1,e=new s.Pointer(this.game,t,s.PointerMode.CONTACT);return this.pointers.push(e),this["pointer"+t]=e,e},update:function(){if(this.keyboard&&this.keyboard.update(),this.pollRate>0&&this._pollCounter=0&&this.countActivePointers(this.maxPointers)>=this.maxPointers)return null;if(!this.pointer1.active)return this.pointer1.start(t);if(!this.pointer2.active)return this.pointer2.start(t);for(var e=2;e0;i++){this.pointers[i].active&&e--}return t-e},getPointer:function(t){void 0===t&&(t=!1);for(var e=0;e=o&&this.game.camera.x+e.x=a&&this.game.camera.y+e.y=o&&this._localPoint.x=a&&this._localPoint.y=o&&this._localPoint.x=a&&this._localPoint.y0&&this._pollCounter=n.Input.MAX_POINTERS)return console.warn("Phaser.Input.addPointer: Maximum limit of "+n.Input.MAX_POINTERS+" pointers reached."),null;var t=this.pointers.length+1,e=new n.Pointer(this.game,t,n.PointerMode.CONTACT);return this.pointers.push(e),this["pointer"+t]=e,e},update:function(){if(this.keyboard&&this.keyboard.update(),this.pollRate>0&&this._pollCounter=0&&this.countActivePointers(this.maxPointers)>=this.maxPointers)return null;if(!this.pointer1.active)return this.pointer1.start(t);if(!this.pointer2.active)return this.pointer2.start(t);for(var e=2;e0;i++){this.pointers[i].active&&e--}return t-e},getPointer:function(t){void 0===t&&(t=!1);for(var e=0;e=o&&this.game.camera.x+e.x=a&&this.game.camera.y+e.y=o&&this._localPoint.x=a&&this._localPoint.y=o&&this._localPoint.x=a&&this._localPoint.y0&&this._pollCounter * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Mouse=function(t){this.game=t,this.input=t.input,this.callbackContext=this.game,this.mouseDownCallback=null,this.mouseUpCallback=null,this.mouseOutCallback=null,this.mouseOverCallback=null,this.capture=!1,this.active=!1,this.enabled=!0,this.stopOnGameOut=!1,this.event=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null,this._onMouseOut=null,this._onMouseOver=null},s.Mouse.NO_BUTTON=-1,s.Mouse.LEFT_BUTTON=0,s.Mouse.MIDDLE_BUTTON=1,s.Mouse.RIGHT_BUTTON=2,s.Mouse.BACK_BUTTON=3,s.Mouse.FORWARD_BUTTON=4,s.Mouse.prototype={start:function(){var t=this.game.device;if(t.isAndroidStockBrowser()&&this.input.touch.active)return!1;if(null!==this._onMouseDown)return!1;var e=this;this._onMouseDown=function(t){return e.onMouseDown(t)},this._onMouseMove=function(t){return e.onMouseMove(t)},this._onMouseUp=function(t){return e.onMouseUp(t)},this._onMouseUpGlobal=function(t){return e.onMouseUpGlobal(t)},this._onMouseOutGlobal=function(t){return e.onMouseOutGlobal(t)},this._onMouseOut=function(t){return e.onMouseOut(t)},this._onMouseOver=function(t){return e.onMouseOver(t)};var i=this.game.canvas;return i.addEventListener("mousedown",this._onMouseDown,!0),i.addEventListener("mousemove",this._onMouseMove,!0),i.addEventListener("mouseup",this._onMouseUp,!0),t.cocoonJS||(window.addEventListener("mouseup",this._onMouseUpGlobal,!0),window.addEventListener("mouseout",this._onMouseOutGlobal,!0),i.addEventListener("mouseover",this._onMouseOver,!0),i.addEventListener("mouseout",this._onMouseOut,!0)),this.active=!0,!0},onMouseDown:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseDownCallback&&this.mouseDownCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.start(t))},onMouseMove:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseMoveCallback&&this.mouseMoveCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.move(t))},onMouseUp:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.stop(t))},onMouseUpGlobal:function(t){this.input.mousePointer.withinGame||(this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,t),t.identifier=0,this.input.mousePointer.stop(t))},onMouseOutGlobal:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!1,this.input.enabled&&this.enabled&&(this.input.mousePointer.stop(t),this.input.mousePointer.resetButtons())},onMouseOut:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!1,this.mouseOutCallback&&this.mouseOutCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(this.input.mousePointer.updateButtons(t),this.stopOnGameOut&&(t.identifier=0,this.input.mousePointer.stop(t),this.input.callAll("_pointerOutHandler",this.input.mousePointer)))},onMouseOver:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!0,this.mouseOverCallback&&this.mouseOverCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&this.input.mousePointer.updateButtons(t)},stop:function(){var t=this.game.canvas;t.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("mousemove",this._onMouseMove,!0),t.removeEventListener("mouseup",this._onMouseUp,!0),t.removeEventListener("mouseover",this._onMouseOver,!0),t.removeEventListener("mouseout",this._onMouseOut,!0),window.removeEventListener("mouseup",this._onMouseUpGlobal,!0),window.removeEventListener("mouseout",this._onMouseOutGlobal,!0),this.active=!1}},s.Mouse.prototype.constructor=s.Mouse,s.MouseWheel=function(t){this.game=t,this.input=t.input,this.element=t.canvas,this.preventDefault=!0,this.active=!1,this.callback=null,this.callbackContext=t,this.delta=0,this.wheelEventName=t.device.wheelEvent,this.boundOnWheelHandler=this.onWheelHandler.bind(this),this.eventProxy=null},s.MouseWheel.UP=1,s.MouseWheel.DOWN=-1,s.MouseWheel.prototype.start=function(){return!(!this.wheelEventName||this.active)&&(this.element.addEventListener(this.wheelEventName,this.boundOnWheelHandler,!0),"mousewheel"===this.wheelEventName?this.eventProxy=new s.WheelEventProxy(-1/40,1):"DOMMouseScroll"===this.wheelEventName&&(this.eventProxy=new s.WheelEventProxy(1,1)),this.active=!0,!0)},s.MouseWheel.prototype.stop=function(){this.active&&(this.element.removeEventListener(this.wheelEventName,this.boundOnWheelHandler,!0),this.active=!1)},s.MouseWheel.prototype.onWheelHandler=function(t){this.eventProxy&&(t=this.eventProxy.bindEvent(t)),this.preventDefault&&t.preventDefault(),this.delta=s.Math.clamp(-t.deltaY,-1,1),this.callback&&this.callback.call(this.callbackContext,t)}, +n.Mouse=function(t){this.game=t,this.input=t.input,this.callbackContext=this.game,this.mouseDownCallback=null,this.mouseUpCallback=null,this.mouseOutCallback=null,this.mouseOverCallback=null,this.capture=!1,this.active=!1,this.enabled=!0,this.stopOnGameOut=!1,this.event=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null,this._onMouseOut=null,this._onMouseOver=null},n.Mouse.NO_BUTTON=-1,n.Mouse.LEFT_BUTTON=0,n.Mouse.MIDDLE_BUTTON=1,n.Mouse.RIGHT_BUTTON=2,n.Mouse.BACK_BUTTON=3,n.Mouse.FORWARD_BUTTON=4,n.Mouse.prototype={start:function(){var t=this.game.device;if(t.isAndroidStockBrowser()&&this.input.touch.active)return!1;if(null!==this._onMouseDown)return!1;var e=this;this._onMouseDown=function(t){return e.onMouseDown(t)},this._onMouseMove=function(t){return e.onMouseMove(t)},this._onMouseUp=function(t){return e.onMouseUp(t)},this._onMouseUpGlobal=function(t){return e.onMouseUpGlobal(t)},this._onMouseOutGlobal=function(t){return e.onMouseOutGlobal(t)},this._onMouseOut=function(t){return e.onMouseOut(t)},this._onMouseOver=function(t){return e.onMouseOver(t)};var i=this.game.canvas;return i.addEventListener("mousedown",this._onMouseDown,!0),i.addEventListener("mousemove",this._onMouseMove,!0),i.addEventListener("mouseup",this._onMouseUp,!0),t.cocoonJS||(window.addEventListener("mouseup",this._onMouseUpGlobal,!0),window.addEventListener("mouseout",this._onMouseOutGlobal,!0),i.addEventListener("mouseover",this._onMouseOver,!0),i.addEventListener("mouseout",this._onMouseOut,!0)),this.active=!0,!0},onMouseDown:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseDownCallback&&this.mouseDownCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.start(t))},onMouseMove:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseMoveCallback&&this.mouseMoveCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.move(t))},onMouseUp:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.stop(t))},onMouseUpGlobal:function(t){this.input.mousePointer.withinGame||(this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,t),t.identifier=0,this.input.mousePointer.stop(t))},onMouseOutGlobal:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!1,this.input.enabled&&this.enabled&&(this.input.mousePointer.stop(t),this.input.mousePointer.resetButtons())},onMouseOut:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!1,this.mouseOutCallback&&this.mouseOutCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(this.input.mousePointer.updateButtons(t),this.stopOnGameOut&&(t.identifier=0,this.input.mousePointer.stop(t),this.input.callAll("_pointerOutHandler",this.input.mousePointer)))},onMouseOver:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!0,this.mouseOverCallback&&this.mouseOverCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&this.input.mousePointer.updateButtons(t)},stop:function(){var t=this.game.canvas;t.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("mousemove",this._onMouseMove,!0),t.removeEventListener("mouseup",this._onMouseUp,!0),t.removeEventListener("mouseover",this._onMouseOver,!0),t.removeEventListener("mouseout",this._onMouseOut,!0),window.removeEventListener("mouseup",this._onMouseUpGlobal,!0),window.removeEventListener("mouseout",this._onMouseOutGlobal,!0),this.active=!1}},n.Mouse.prototype.constructor=n.Mouse,n.MouseWheel=function(t){this.game=t,this.input=t.input,this.element=t.canvas,this.preventDefault=!0,this.active=!1,this.callback=null,this.callbackContext=t,this.delta=0,this.wheelEventName=t.device.wheelEvent,this.boundOnWheelHandler=this.onWheelHandler.bind(this),this.eventProxy=null},n.MouseWheel.UP=1,n.MouseWheel.DOWN=-1,n.MouseWheel.prototype.start=function(){return!(!this.wheelEventName||this.active)&&(this.element.addEventListener(this.wheelEventName,this.boundOnWheelHandler,!0),"mousewheel"===this.wheelEventName?this.eventProxy=new n.WheelEventProxy(-1/40,1):"DOMMouseScroll"===this.wheelEventName&&(this.eventProxy=new n.WheelEventProxy(1,1)),this.active=!0,!0)},n.MouseWheel.prototype.stop=function(){this.active&&(this.element.removeEventListener(this.wheelEventName,this.boundOnWheelHandler,!0),this.active=!1)},n.MouseWheel.prototype.onWheelHandler=function(t){this.eventProxy&&(t=this.eventProxy.bindEvent(t)),this.preventDefault&&t.preventDefault(),this.delta=n.Math.clamp(-t.deltaY,-1,1),this.callback&&this.callback.call(this.callbackContext,t)}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.MSPointer=function(t){this.game=t,this.input=t.input,this.callbackContext=this.game,this.pointerDownCallback=null,this.pointerMoveCallback=null,this.pointerUpCallback=null,this.pointerOutCallback=null,this.pointerOverCallback=null,this.pointerCancelCallback=null,this.capture=!1,this.event=null,this.active=!1,this.enabled=!0,this.stopOnGameOut=!1,this._onMSPointerDown=null,this._onMSPointerMove=null,this._onMSPointerUp=null,this._onMSPointerUpGlobal=null,this._onMSPointerOut=null,this._onMSPointerOver=null},s.MSPointer.prototype={start:function(){if(!this.game.device.mspointer)return!1;if(null!==this._onMSPointerDown)return!1;var t=this;this._onMSPointerDown=function(e){return t.onPointerDown(e)},this._onMSPointerMove=function(e){return t.onPointerMove(e)},this._onMSPointerUp=function(e){return t.onPointerUp(e)},this._onMSPointerUpGlobal=function(e){return t.onPointerUpGlobal(e)},this._onMSPointerOut=function(e){return t.onPointerOut(e)},this._onMSPointerOver=function(e){return t.onPointerOver(e)},this._onMSPointerCancel=function(e){return t.onPointerCancel(e)};var e=this.game.canvas;return e.addEventListener("MSPointerDown",this._onMSPointerDown,!1),e.addEventListener("MSPointerMove",this._onMSPointerMove,!1),e.addEventListener("MSPointerUp",this._onMSPointerUp,!1),e.addEventListener("MSPointerCancel",this._onMSPointerCancel,!1),e.addEventListener("pointerdown",this._onMSPointerDown,!1),e.addEventListener("pointermove",this._onMSPointerMove,!1),e.addEventListener("pointerup",this._onMSPointerUp,!1),e.addEventListener("pointercancel",this._onMSPointerCancel,!1),e.style["-ms-content-zooming"]="none",e.style["-ms-touch-action"]="none",this.game.device.cocoonJS||(window.addEventListener("MSPointerUp",this._onMSPointerUpGlobal,!0),e.addEventListener("MSPointerOver",this._onMSPointerOver,!0),e.addEventListener("MSPointerOut",this._onMSPointerOut,!0),window.addEventListener("pointerup",this._onMSPointerUpGlobal,!0),e.addEventListener("pointerover",this._onMSPointerOver,!0),e.addEventListener("pointerout",this._onMSPointerOut,!0)),this.active=!0,!0},onPointerDown:function(t){this.game.input.executeTouchLockCallbacks(!1,t),this.event=t,this.capture&&t.preventDefault(),this.pointerDownCallback&&this.pointerDownCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.start(t):this.input.startPointer(t))},onPointerMove:function(t){this.event=t,this.capture&&t.preventDefault(),this.pointerMoveCallback&&this.pointerMoveCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.move(t):this.input.updatePointer(t))},onPointerUp:function(t){this.game.input.executeTouchLockCallbacks(!0,t),this.event=t,this.capture&&t.preventDefault(),this.pointerUpCallback&&this.pointerUpCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.stop(t):this.input.stopPointer(t))},onPointerUpGlobal:function(t){if(t.identifier=t.pointerId,this.isMousePointerEvent(t)&&!this.input.mousePointer.withinGame)this.onPointerUp(t);else{var e=this.input.getPointerFromIdentifier(t.identifier);e&&e.withinGame&&this.onPointerUp(t)}},onPointerOut:function(t){this.event=t,this.capture&&t.preventDefault(),t.identifier=t.pointerId;var e=this.getPointerFromEvent(t);e&&(e.withinGame=!1),this.pointerOutCallback&&this.pointerOutCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&this.stopOnGameOut&&(t.identifier=0,e||(e=this.input.mousePointer),e.stop(t),this.input.callAll("_pointerOutHandler",e))},onPointerOver:function(t){this.event=t,this.capture&&t.preventDefault(),t.identifier=t.pointerId;var e=this.getPointerFromEvent(t);e&&(e.withinGame=!0),this.pointerOverCallback&&this.pointerOverCallback.call(this.callbackContext,t)},onPointerCancel:function(t){this.event=t,this.pointerCancelCallback&&this.pointerCancelCallback.call(this.callbackContext,t),this.game.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.stop(t):this.input.stopPointer(t))},stop:function(){var t=this.game.canvas;t.removeEventListener("MSPointerDown",this._onMSPointerDown,!1),t.removeEventListener("MSPointerMove",this._onMSPointerMove,!1),t.removeEventListener("MSPointerUp",this._onMSPointerUp,!1),t.removeEventListener("pointerdown",this._onMSPointerDown,!1),t.removeEventListener("pointermove",this._onMSPointerMove,!1),t.removeEventListener("pointerup",this._onMSPointerUp,!1),window.removeEventListener("MSPointerUp",this._onMSPointerUpGlobal,!0),t.removeEventListener("MSPointerOver",this._onMSPointerOver,!0),t.removeEventListener("MSPointerOut",this._onMSPointerOut,!0),window.removeEventListener("pointerup",this._onMSPointerUpGlobal,!0),t.removeEventListener("pointerover",this._onMSPointerOver,!0),t.removeEventListener("pointerout",this._onMSPointerOut,!0),this.active=!1},isMousePointerEvent:function(t){return"mouse"===t.pointerType||4===t.pointerType},getPointerFromEvent:function(t){return this.isMousePointerEvent(t)?this.input.mousePointer:this.input.getPointerFromIdentifier(t.identifier)}},s.MSPointer.prototype.constructor=s.MSPointer, +n.MSPointer=function(t){this.game=t,this.input=t.input,this.callbackContext=this.game,this.pointerDownCallback=null,this.pointerMoveCallback=null,this.pointerUpCallback=null,this.pointerOutCallback=null,this.pointerOverCallback=null,this.pointerCancelCallback=null,this.capture=!1,this.event=null,this.active=!1,this.enabled=!0,this.stopOnGameOut=!1,this._onMSPointerDown=null,this._onMSPointerMove=null,this._onMSPointerUp=null,this._onMSPointerUpGlobal=null,this._onMSPointerOut=null,this._onMSPointerOver=null},n.MSPointer.prototype={start:function(){if(!this.game.device.mspointer)return!1;if(null!==this._onMSPointerDown)return!1;var t=this;this._onMSPointerDown=function(e){return t.onPointerDown(e)},this._onMSPointerMove=function(e){return t.onPointerMove(e)},this._onMSPointerUp=function(e){return t.onPointerUp(e)},this._onMSPointerUpGlobal=function(e){return t.onPointerUpGlobal(e)},this._onMSPointerOut=function(e){return t.onPointerOut(e)},this._onMSPointerOver=function(e){return t.onPointerOver(e)},this._onMSPointerCancel=function(e){return t.onPointerCancel(e)};var e=this.game.canvas;return e.addEventListener("MSPointerDown",this._onMSPointerDown,!1),e.addEventListener("MSPointerMove",this._onMSPointerMove,!1),e.addEventListener("MSPointerUp",this._onMSPointerUp,!1),e.addEventListener("MSPointerCancel",this._onMSPointerCancel,!1),e.addEventListener("pointerdown",this._onMSPointerDown,!1),e.addEventListener("pointermove",this._onMSPointerMove,!1),e.addEventListener("pointerup",this._onMSPointerUp,!1),e.addEventListener("pointercancel",this._onMSPointerCancel,!1),e.style["-ms-content-zooming"]="none",e.style["-ms-touch-action"]="none",this.game.device.cocoonJS||(window.addEventListener("MSPointerUp",this._onMSPointerUpGlobal,!0),e.addEventListener("MSPointerOver",this._onMSPointerOver,!0),e.addEventListener("MSPointerOut",this._onMSPointerOut,!0),window.addEventListener("pointerup",this._onMSPointerUpGlobal,!0),e.addEventListener("pointerover",this._onMSPointerOver,!0),e.addEventListener("pointerout",this._onMSPointerOut,!0)),this.active=!0,!0},onPointerDown:function(t){this.game.input.executeTouchLockCallbacks(!1,t),this.event=t,this.capture&&t.preventDefault(),this.pointerDownCallback&&this.pointerDownCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.start(t):this.input.startPointer(t))},onPointerMove:function(t){this.event=t,this.capture&&t.preventDefault(),this.pointerMoveCallback&&this.pointerMoveCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.move(t):this.input.updatePointer(t))},onPointerUp:function(t){this.game.input.executeTouchLockCallbacks(!0,t),this.event=t,this.capture&&t.preventDefault(),this.pointerUpCallback&&this.pointerUpCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.stop(t):this.input.stopPointer(t))},onPointerUpGlobal:function(t){if(t.identifier=t.pointerId,this.isMousePointerEvent(t)&&!this.input.mousePointer.withinGame)this.onPointerUp(t);else{var e=this.input.getPointerFromIdentifier(t.identifier);e&&e.withinGame&&this.onPointerUp(t)}},onPointerOut:function(t){this.event=t,this.capture&&t.preventDefault(),t.identifier=t.pointerId;var e=this.getPointerFromEvent(t);e&&(e.withinGame=!1),this.pointerOutCallback&&this.pointerOutCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&this.stopOnGameOut&&(t.identifier=0,e||(e=this.input.mousePointer),e.stop(t),this.input.callAll("_pointerOutHandler",e))},onPointerOver:function(t){this.event=t,this.capture&&t.preventDefault(),t.identifier=t.pointerId;var e=this.getPointerFromEvent(t);e&&(e.withinGame=!0),this.pointerOverCallback&&this.pointerOverCallback.call(this.callbackContext,t)},onPointerCancel:function(t){this.event=t,this.pointerCancelCallback&&this.pointerCancelCallback.call(this.callbackContext,t),this.game.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.stop(t):this.input.stopPointer(t))},stop:function(){var t=this.game.canvas;t.removeEventListener("MSPointerDown",this._onMSPointerDown,!1),t.removeEventListener("MSPointerMove",this._onMSPointerMove,!1),t.removeEventListener("MSPointerUp",this._onMSPointerUp,!1),t.removeEventListener("pointerdown",this._onMSPointerDown,!1),t.removeEventListener("pointermove",this._onMSPointerMove,!1),t.removeEventListener("pointerup",this._onMSPointerUp,!1),window.removeEventListener("MSPointerUp",this._onMSPointerUpGlobal,!0),t.removeEventListener("MSPointerOver",this._onMSPointerOver,!0),t.removeEventListener("MSPointerOut",this._onMSPointerOut,!0),window.removeEventListener("pointerup",this._onMSPointerUpGlobal,!0),t.removeEventListener("pointerover",this._onMSPointerOver,!0),t.removeEventListener("pointerout",this._onMSPointerOut,!0),this.active=!1},isMousePointerEvent:function(t){return"mouse"===t.pointerType||4===t.pointerType},getPointerFromEvent:function(t){return this.isMousePointerEvent(t)?this.input.mousePointer:this.input.getPointerFromIdentifier(t.identifier)}},n.MSPointer.prototype.constructor=n.MSPointer, /** * @author Richard Davey * @author @karlmacklin * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.DeviceButton=function(t,e){this.parent=t,this.game=t.game,this.event=null,this.isDown=!1,this.isUp=!0,this.timeDown=0,this.timeUp=0,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1,this.value=0,this.buttonCode=e,this.onDown=new s.Signal,this.onUp=new s.Signal,this.onFloat=new s.Signal},s.DeviceButton.prototype={start:function(t,e){this.isDown||(this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.time,this.repeats=0,this.event=t,this.value=e,t&&(this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.ctrlKey=t.ctrlKey),this.onDown.dispatch(this,e))},stop:function(t,e){this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.event=t,this.value=e,t&&(this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.ctrlKey=t.ctrlKey),this.onUp.dispatch(this,e))},startStop:function(t,e,i){t?this.start(e,i):this.stop(e,i)},padFloat:function(t){this.isDown=!1,this.isUp=!1,this.value=t,this.onFloat.dispatch(this,t)},justPressed:function(t){return t=t||250,this.isDown&&this.timeDown+t>this.game.time.time},justReleased:function(t){return t=t||250,this.isUp&&this.timeUp+t>this.game.time.time},reset:function(){this.isDown=!1,this.isUp=!0,this.timeDown=this.game.time.time,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1},destroy:function(){this.onDown.dispose(),this.onUp.dispose(),this.onFloat.dispose(),this.parent=null,this.game=null}},s.DeviceButton.prototype.constructor=s.DeviceButton,Object.defineProperty(s.DeviceButton.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.time-this.timeDown}}), +n.DeviceButton=function(t,e){this.parent=t,this.game=t.game,this.event=null,this.isDown=!1,this.isUp=!0,this.timeDown=0,this.timeUp=0,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1,this.value=0,this.buttonCode=e,this.onDown=new n.Signal,this.onUp=new n.Signal,this.onFloat=new n.Signal},n.DeviceButton.prototype={start:function(t,e){this.isDown||(this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.time,this.repeats=0,this.event=t,this.value=e,t&&(this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.ctrlKey=t.ctrlKey),this.onDown.dispatch(this,e))},stop:function(t,e){this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.event=t,this.value=e,t&&(this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.ctrlKey=t.ctrlKey),this.onUp.dispatch(this,e))},startStop:function(t,e,i){t?this.start(e,i):this.stop(e,i)},padFloat:function(t){this.isDown=!1,this.isUp=!1,this.value=t,this.onFloat.dispatch(this,t)},justPressed:function(t){return t=t||250,this.isDown&&this.timeDown+t>this.game.time.time},justReleased:function(t){return t=t||250,this.isUp&&this.timeUp+t>this.game.time.time},reset:function(){this.isDown=!1,this.isUp=!0,this.timeDown=this.game.time.time,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1},destroy:function(){this.onDown.dispose(),this.onUp.dispose(),this.onFloat.dispose(),this.parent=null,this.game=null}},n.DeviceButton.prototype.constructor=n.DeviceButton,Object.defineProperty(n.DeviceButton.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.time-this.timeDown}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Pointer=function(t,e,i){this.game=t,this.id=e,this.type=s.POINTER,this.exists=!0,this.identifier=0,this.pointerId=null,this.pointerMode=i||s.PointerMode.CURSOR|s.PointerMode.CONTACT,this.target=null,this.button=null,this.leftButton=new s.DeviceButton(this,s.Pointer.LEFT_BUTTON),this.middleButton=new s.DeviceButton(this,s.Pointer.MIDDLE_BUTTON),this.rightButton=new s.DeviceButton(this,s.Pointer.RIGHT_BUTTON),this.backButton=new s.DeviceButton(this,s.Pointer.BACK_BUTTON),this.forwardButton=new s.DeviceButton(this,s.Pointer.FORWARD_BUTTON),this.eraserButton=new s.DeviceButton(this,s.Pointer.ERASER_BUTTON),this._holdSent=!1,this._history=[],this._nextDrop=0,this._stateReset=!1,this.withinGame=!1,this.clientX=-1,this.clientY=-1,this.pageX=-1,this.pageY=-1,this.screenX=-1,this.screenY=-1,this.rawMovementX=0,this.rawMovementY=0,this.movementX=0,this.movementY=0,this.x=-1,this.y=-1,this.isMouse=0===e,this.isDown=!1,this.isUp=!0,this.timeDown=0,this.timeUp=0,this.previousTapTime=0,this.totalTouches=0,this.msSinceLastClick=Number.MAX_VALUE,this.targetObject=null,this.interactiveCandidates=[],this.active=!1,this.dirty=!1,this.position=new s.Point,this.positionDown=new s.Point,this.positionUp=new s.Point,this.circle=new s.Circle(0,0,44),this._clickTrampolines=null,this._trampolineTargetObject=null},s.Pointer.NO_BUTTON=0,s.Pointer.LEFT_BUTTON=1,s.Pointer.RIGHT_BUTTON=2,s.Pointer.MIDDLE_BUTTON=4,s.Pointer.BACK_BUTTON=8,s.Pointer.FORWARD_BUTTON=16,s.Pointer.ERASER_BUTTON=32,s.Pointer.prototype={resetButtons:function(){this.isDown=!1,this.isUp=!0,this.isMouse&&(this.leftButton.reset(),this.middleButton.reset(),this.rightButton.reset(),this.backButton.reset(),this.forwardButton.reset(),this.eraserButton.reset())},processButtonsDown:function(t,e){switch(t){case s.Mouse.LEFT_BUTTON:this.leftButton.start(e);break;case s.Mouse.RIGHT_BUTTON:this.rightButton.start(e);break;case s.Mouse.MIDDLE_BUTTON:this.middleButton.start(e);break;case s.Mouse.BACK_BUTTON:this.backButton.start(e);break;case s.Mouse.FORWARD_BUTTON:this.forwardButton.start(e)}},processButtonsUp:function(t,e){switch(t){case s.Mouse.LEFT_BUTTON:this.leftButton.stop(e);break;case s.Mouse.RIGHT_BUTTON:this.rightButton.stop(e);break;case s.Mouse.MIDDLE_BUTTON:this.middleButton.stop(e);break;case s.Mouse.BACK_BUTTON:this.backButton.stop(e);break;case s.Mouse.FORWARD_BUTTON:this.forwardButton.stop(e)}},processButtonsUpDown:function(t,e){var i=e.type.toLowerCase().substr(-4),n="down"===i,r="move"===i;void 0!==t?(n&&1===t&&e.ctrlKey&&(t=2),this.leftButton.startStop(s.Pointer.LEFT_BUTTON&t,e),this.rightButton.startStop(s.Pointer.RIGHT_BUTTON&t,e),this.middleButton.startStop(s.Pointer.MIDDLE_BUTTON&t,e),this.backButton.startStop(s.Pointer.BACK_BUTTON&t,e),this.forwardButton.startStop(s.Pointer.FORWARD_BUTTON&t,e),this.eraserButton.startStop(s.Pointer.ERASER_BUTTON&t,e)):void 0!==e.button?n&&e.ctrlKey&&0===e.button?this.rightButton.start(e):n?this.processButtonsDown(e.button,e):r||this.processButtonsUp(e.button,e):n?e.ctrlKey?this.rightButton.start(e):this.leftButton.start(e):(this.leftButton.stop(e),this.rightButton.stop(e))},updateButtons:function(t){this.button=t.button,this.processButtonsUpDown(t.buttons,t),this.isUp=!0,this.isDown=!1,(this.leftButton.isDown||this.rightButton.isDown||this.middleButton.isDown||this.backButton.isDown||this.forwardButton.isDown||this.eraserButton.isDown)&&(this.isUp=!1,this.isDown=!0)},start:function(t){var e=this.game.input;return t.pointerId&&(this.pointerId=t.pointerId),this.identifier=t.identifier,this.target=t.target,this.isMouse?this.updateButtons(t):(this.isDown=!0,this.isUp=!1),this.active=!0,this.withinGame=!0,this.dirty=!1,this._history=[],this._clickTrampolines=null,this._trampolineTargetObject=null,this.msSinceLastClick=this.game.time.time-this.timeDown,this.timeDown=this.game.time.time,this._holdSent=!1,this.move(t,!0),this.positionDown.setTo(this.x,this.y),(e.multiInputOverride===s.Input.MOUSE_OVERRIDES_TOUCH||e.multiInputOverride===s.Input.MOUSE_TOUCH_COMBINE||e.multiInputOverride===s.Input.TOUCH_OVERRIDES_MOUSE&&0===e.totalActivePointers)&&(e.x=this.x,e.y=this.y,e.position.setTo(this.x,this.y),e.onDown.dispatch(this,t),e.resetSpeed(this.x,this.y)),this._stateReset=!1,this.totalTouches++,null!==this.targetObject&&this.targetObject._touchedHandler(this),this},update:function(){var t=this.game.input;this.active&&(this.dirty&&(t.interactiveItems.total>0&&this.processInteractiveObjects(!1),this.dirty=!1),!1===this._holdSent&&this.duration>=t.holdRate&&((t.multiInputOverride===s.Input.MOUSE_OVERRIDES_TOUCH||t.multiInputOverride===s.Input.MOUSE_TOUCH_COMBINE||t.multiInputOverride===s.Input.TOUCH_OVERRIDES_MOUSE&&0===t.totalActivePointers)&&t.onHold.dispatch(this),this._holdSent=!0),t.recordPointerHistory&&this.game.time.time>=this._nextDrop&&(this._nextDrop=this.game.time.time+t.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>t.recordLimit&&this._history.shift()))},move:function(t,e){var i=this.game.input;if(!i.pollLocked){void 0===e&&(e=!1),void 0!==t.button&&(this.button=t.button),this.isMouse&&this.updateButtons(t),this.clientX=t.clientX,this.clientY=t.clientY,this.pageX=t.pageX,this.pageY=t.pageY,this.screenX=t.screenX,this.screenY=t.screenY,this.isMouse&&i.pointerLock.locked&&!e&&(this.rawMovementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.rawMovementY=t.movementY||t.mozMovementY||t.webkitMovementY||0,this.movementX+=this.rawMovementX,this.movementY+=this.rawMovementY),this.x=(this.pageX-this.game.scale.offset.x)*i.scale.x,this.y=(this.pageY-this.game.scale.offset.y)*i.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(i.multiInputOverride===s.Input.MOUSE_OVERRIDES_TOUCH||i.multiInputOverride===s.Input.MOUSE_TOUCH_COMBINE||i.multiInputOverride===s.Input.TOUCH_OVERRIDES_MOUSE&&0===i.totalActivePointers)&&(i.activePointer=this,i.x=this.x,i.y=this.y,i.position.setTo(i.x,i.y),i.circle.x=i.x,i.circle.y=i.y),this.withinGame=this.game.scale.bounds.contains(this.pageX,this.pageY);for(var n=i.moveCallbacks.length;n--;)i.moveCallbacks[n].callback.call(i.moveCallbacks[n].context,this,this.x,this.y,e,t);return null===this.targetObject||this.game.paused&&!this.targetObject.noPause||!0!==this.targetObject.isDragged?i.interactiveItems.total>0&&this.processInteractiveObjects(e):!1===this.targetObject.update(this)&&(this.targetObject=null),this}},processInteractiveObjects:function(t){var e=0,i=-1,n=null,s=this.game.input.interactiveItems.first;for(this.interactiveCandidates=[];s;)s.checked=!1,!s.validForInput(i,e,!1)||this.game.paused&&!s.sprite.noPause||(s.checked=!0,(t&&s.checkPointerDown(this,!0)||!t&&s.checkPointerOver(this,!0))&&(e=s.sprite.renderOrderID,i=s.priorityID,n=s,this.interactiveCandidates.push(s))),s=this.game.input.interactiveItems.next;for(s=this.game.input.interactiveItems.first;s;)!s.checked&&s.validForInput(i,e,!0)&&(t&&s.checkPointerDown(this,!1)||!t&&s.checkPointerOver(this,!1))&&(e=s.sprite.renderOrderID,i=s.priorityID,n=s,this.interactiveCandidates.push(s)),s=this.game.input.interactiveItems.next;return this.game.input.customCandidateHandler&&(n=this.game.input.customCandidateHandler.call(this.game.input.customCandidateHandlerContext,this,this.interactiveCandidates,n)),this.swapTarget(n,!1),null!==this.targetObject},swapTarget:function(t,e){void 0===e&&(e=!1),null===t?this.targetObject&&(this.targetObject._pointerOutHandler(this,e),this.targetObject=null):null===this.targetObject?(this.targetObject=t,t._pointerOverHandler(this,e)):this.targetObject===t?!1===t.update(this)&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this,e),this.targetObject=t,this.targetObject._pointerOverHandler(this,e))},leave:function(t){this.withinGame=!1,this.move(t,!1)},stop:function(t){var e=this.game.input;if(!this._stateReset||!this.withinGame){if(this.timeUp=this.game.time.time,(e.multiInputOverride===s.Input.MOUSE_OVERRIDES_TOUCH||e.multiInputOverride===s.Input.MOUSE_TOUCH_COMBINE||e.multiInputOverride===s.Input.TOUCH_OVERRIDES_MOUSE&&0===e.totalActivePointers)&&(e.onUp.dispatch(this,t),this.duration>=0&&this.duration<=e.tapRate)){var i=this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=this.game.scale.bounds.contains(t.pageX,t.pageY),this.pointerId=null,this.identifier=null,this.positionUp.setTo(this.x,this.y),!1===this.isMouse&&e.currentPointers--,e.callAll("_releasedHandler",this),this._clickTrampolines&&(this._trampolineTargetObject=this.targetObject),this.targetObject=null,this}t.preventDefault()},justPressed:function(t){return t=t||this.game.input.justPressedRate,!0===this.isDown&&this.timeDown+t>this.game.time.time},justReleased:function(t){return t=t||this.game.input.justReleasedRate,this.isUp&&this.timeUp+t>this.game.time.time},addClickTrampoline:function(t,e,i,n){if(this.isDown){for(var s=this._clickTrampolines=this._clickTrampolines||[],r=0;r0&&this.processInteractiveObjects(!1),this.dirty=!1),!1===this._holdSent&&this.duration>=t.holdRate&&((t.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||t.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||t.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===t.totalActivePointers)&&t.onHold.dispatch(this),this._holdSent=!0),t.recordPointerHistory&&this.game.time.time>=this._nextDrop&&(this._nextDrop=this.game.time.time+t.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>t.recordLimit&&this._history.shift()))},move:function(t,e){var i=this.game.input;if(!i.pollLocked){void 0===e&&(e=!1),void 0!==t.button&&(this.button=t.button),this.isMouse&&this.updateButtons(t),this.clientX=t.clientX,this.clientY=t.clientY,this.pageX=t.pageX,this.pageY=t.pageY,this.screenX=t.screenX,this.screenY=t.screenY,this.isMouse&&i.pointerLock.locked&&!e&&(this.rawMovementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.rawMovementY=t.movementY||t.mozMovementY||t.webkitMovementY||0,this.movementX+=this.rawMovementX,this.movementY+=this.rawMovementY),this.x=(this.pageX-this.game.scale.offset.x)*i.scale.x,this.y=(this.pageY-this.game.scale.offset.y)*i.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(i.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||i.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||i.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===i.totalActivePointers)&&(i.activePointer=this,i.x=this.x,i.y=this.y,i.position.setTo(i.x,i.y),i.circle.x=i.x,i.circle.y=i.y),this.withinGame=this.game.scale.bounds.contains(this.pageX,this.pageY);for(var s=i.moveCallbacks.length;s--;)i.moveCallbacks[s].callback.call(i.moveCallbacks[s].context,this,this.x,this.y,e,t);return null===this.targetObject||this.game.paused&&!this.targetObject.noPause||!0!==this.targetObject.isDragged?i.interactiveItems.total>0&&this.processInteractiveObjects(e):!1===this.targetObject.update(this)&&(this.targetObject=null),this}},processInteractiveObjects:function(t){var e=0,i=-1,n=null,s=this.game.input.interactiveItems.first;for(this.interactiveCandidates=[];s;)s.checked=!1,!s.validForInput(i,e,!1)||this.game.paused&&!s.sprite.noPause||(s.checked=!0,(t&&s.checkPointerDown(this,!0)||!t&&s.checkPointerOver(this,!0))&&(e=s.sprite.renderOrderID,i=s.priorityID,n=s,this.interactiveCandidates.push(s))),s=this.game.input.interactiveItems.next;for(s=this.game.input.interactiveItems.first;s;)!s.checked&&s.validForInput(i,e,!0)&&(t&&s.checkPointerDown(this,!1)||!t&&s.checkPointerOver(this,!1))&&(e=s.sprite.renderOrderID,i=s.priorityID,n=s,this.interactiveCandidates.push(s)),s=this.game.input.interactiveItems.next;return this.game.input.customCandidateHandler&&(n=this.game.input.customCandidateHandler.call(this.game.input.customCandidateHandlerContext,this,this.interactiveCandidates,n)),this.swapTarget(n,!1),null!==this.targetObject},swapTarget:function(t,e){void 0===e&&(e=!1),null===t?this.targetObject&&(this.targetObject._pointerOutHandler(this,e),this.targetObject=null):null===this.targetObject?(this.targetObject=t,t._pointerOverHandler(this,e)):this.targetObject===t?!1===t.update(this)&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this,e),this.targetObject=t,this.targetObject._pointerOverHandler(this,e))},leave:function(t){this.withinGame=!1,this.move(t,!1)},stop:function(t){var e=this.game.input;if(!this._stateReset||!this.withinGame){if(this.timeUp=this.game.time.time,(e.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||e.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||e.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===e.totalActivePointers)&&(e.onUp.dispatch(this,t),this.duration>=0&&this.duration<=e.tapRate)){var i=this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=this.game.scale.bounds.contains(t.pageX,t.pageY),this.pointerId=null,this.identifier=null,this.positionUp.setTo(this.x,this.y),!1===this.isMouse&&e.currentPointers--,e.callAll("_releasedHandler",this),this._clickTrampolines&&(this._trampolineTargetObject=this.targetObject),this.targetObject=null,this}t.preventDefault()},justPressed:function(t){return t=t||this.game.input.justPressedRate,!0===this.isDown&&this.timeDown+t>this.game.time.time},justReleased:function(t){return t=t||this.game.input.justReleasedRate,this.isUp&&this.timeUp+t>this.game.time.time},addClickTrampoline:function(t,e,i,n){if(this.isDown){for(var s=this._clickTrampolines=this._clickTrampolines||[],r=0;r * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Touch=function(t){this.game=t,this.active=!1,this.enabled=!0,this.callbackContext=this.game,this.touchStartCallback=null,this.touchMoveCallback=null,this.touchEndCallback=null,this.touchEnterCallback=null,this.touchLeaveCallback=null,this.touchCancelCallback=null,this.preventDefault=!0,this.event=null,this._onTouchStart=null,this._onTouchMove=null,this._onTouchEnd=null,this._onTouchEnter=null,this._onTouchLeave=null,this._onTouchCancel=null,this._onTouchMove=null},s.Touch.prototype={start:function(){if(!this.game.device.touch)return!1;if(null!==this._onTouchStart)return!1;var t=this;return this._onTouchStart=function(e){return t.onTouchStart(e)},this._onTouchMove=function(e){return t.onTouchMove(e)},this._onTouchEnd=function(e){return t.onTouchEnd(e)},this._onTouchEnter=function(e){return t.onTouchEnter(e)},this._onTouchLeave=function(e){return t.onTouchLeave(e)},this._onTouchCancel=function(e){return t.onTouchCancel(e)},this.game.canvas.addEventListener("touchstart",this._onTouchStart,!1),this.game.canvas.addEventListener("touchmove",this._onTouchMove,!1),this.game.canvas.addEventListener("touchend",this._onTouchEnd,!1),this.game.canvas.addEventListener("touchcancel",this._onTouchCancel,!1),this.game.device.cocoonJS||(this.game.canvas.addEventListener("touchenter",this._onTouchEnter,!1),this.game.canvas.addEventListener("touchleave",this._onTouchLeave,!1)),this.active=!0,!0},consumeDocumentTouches:function(){this._documentTouchMove=function(t){t.preventDefault()},document.addEventListener("touchmove",this._documentTouchMove,!1)},onTouchStart:function(t){if(this.game.input.executeTouchLockCallbacks(!1,t),this.event=t,this.game.input.enabled&&this.enabled){this.touchStartCallback&&this.touchStartCallback.call(this.callbackContext,t),this.preventDefault&&t.preventDefault();for(var e=0;e * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.InputHandler=function(t){this.sprite=t,this.game=t.game,this.enabled=!1,this.checked=!1,this.priorityID=0,this.useHandCursor=!1,this._setHandCursor=!1,this.isDragged=!1,this.allowHorizontalDrag=!0,this.allowVerticalDrag=!0,this.bringToTop=!1,this.snapOffset=null,this.snapOnDrag=!1,this.snapOnRelease=!1,this.snapX=0,this.snapY=0,this.snapOffsetX=0,this.snapOffsetY=0,this.pixelPerfectOver=!1,this.pixelPerfectClick=!1,this.pixelPerfectAlpha=255,this.draggable=!1,this.boundsRect=null,this.boundsSprite=null,this.scaleLayer=!1,this.dragOffset=new s.Point,this.dragFromCenter=!1,this.dragStopBlocksInputUp=!1,this.dragStartPoint=new s.Point,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this.downPoint=new s.Point,this.snapPoint=new s.Point,this._dragPoint=new s.Point,this._dragPhase=!1,this._pendingDrag=!1,this._dragTimePass=!1,this._dragDistancePass=!1,this._wasEnabled=!1,this._tempPoint=new s.Point,this._pointerData=[],this._pointerData.push({id:0,x:0,y:0,camX:0,camY:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1})},s.InputHandler.prototype={start:function(t,e){if(t=t||0,void 0===e&&(e=!1),!1===this.enabled){this.game.input.interactiveItems.add(this),this.useHandCursor=e,this.priorityID=t;for(var i=0;i<10;i++)this._pointerData[i]={id:i,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new s.Point,this.enabled=!0,this._wasEnabled=!0}return this.sprite.events.onAddedToGroup.add(this.addedToGroup,this),this.sprite.events.onRemovedFromGroup.add(this.removedFromGroup,this),this.sprite},addedToGroup:function(){this._dragPhase||this._wasEnabled&&!this.enabled&&this.start()},removedFromGroup:function(){this._dragPhase||(this.enabled?(this._wasEnabled=!0,this.stop()):this._wasEnabled=!1)},reset:function(){this.enabled=!1;for(var t=0;t<10;t++)this._pointerData[t]={id:t,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){!1!==this.enabled&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.sprite&&(this._setHandCursor&&(this.game.canvas.style.cursor="",this._setHandCursor=!1),this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},validForInput:function(t,e,i){return void 0===i&&(i=!0),!(!this.enabled||0===this.sprite.scale.x||0===this.sprite.scale.y||this.priorityIDt||this.priorityID===t&&this.sprite.renderOrderID>e))},isPixelPerfect:function(){return this.pixelPerfectClick||this.pixelPerfectOver},pointerX:function(t){return t=t||0,this._pointerData[t].x},pointerY:function(t){return t=t||0,this._pointerData[t].y},pointerDown:function(t){return t=t||0,this._pointerData[t].isDown},pointerUp:function(t){return t=t||0,this._pointerData[t].isUp},pointerTimeDown:function(t){return t=t||0,this._pointerData[t].timeDown},pointerTimeUp:function(t){return t=t||0,this._pointerData[t].timeUp},pointerOver:function(t){if(!this.enabled)return!1;if(void 0===t){for(var e=0;e<10;e++)if(this._pointerData[e].isOver)return!0;return!1}return this._pointerData[t].isOver},pointerOut:function(t){if(!this.enabled)return!1;if(void 0!==t)return this._pointerData[t].isOut;for(var e=0;e<10;e++)if(this._pointerData[e].isOut)return!0},pointerTimeOver:function(t){return t=t||0,this._pointerData[t].timeOver},pointerTimeOut:function(t){return t=t||0,this._pointerData[t].timeOut},pointerDragged:function(t){return t=t||0,this._pointerData[t].isDragged},checkPointerDown:function(t,e){return!!(t.isDown&&this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectClick)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPointerOver:function(t,e){return!!(this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectOver)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPixel:function(t,e,i){if(this.sprite.texture.baseTexture.source){if(null===t&&null===e){this.game.input.getLocalPosition(this.sprite,i,this._tempPoint);t=this._tempPoint.x,e=this._tempPoint.y}if(0!==this.sprite.anchor.x&&(t-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(e-=-this.sprite.texture.frame.height*this.sprite.anchor.y),t+=this.sprite.texture.frame.x,e+=this.sprite.texture.frame.y,this.sprite.texture.trim&&(t-=this.sprite.texture.trim.x,e-=this.sprite.texture.trim.y,tthis.sprite.texture.crop.right||ethis.sprite.texture.crop.bottom))return this._dx=t,this._dy=e,!1;if(this._dx=t,this._dy=e,this.game.input.hitContext.clearRect(0,0,1,1),this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,t,e,1,1,0,0,1,1),this.game.input.hitContext.getImageData(0,0,1,1).data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(t){if(null!==this.sprite&&void 0!==this.sprite.parent)return this.enabled&&this.sprite.visible&&this.sprite.parent.visible?this._pendingDrag?(this._dragDistancePass||(this._dragDistancePass=s.Math.distance(t.x,t.y,this.downPoint.x,this.downPoint.y)>=this.dragDistanceThreshold),this._dragDistancePass&&this._dragTimePass&&this.startDrag(t),!0):this.draggable&&this._draggedPointerID===t.id?this.updateDrag(t,!1):this._pointerData[t.id].isOver?this.checkPointerOver(t)?(this._pointerData[t.id].x=t.x-this.sprite.x,this._pointerData[t.id].y=t.y-this.sprite.y,!0):(this._pointerOutHandler(t),!1):void 0:(this._pointerOutHandler(t),!1)},_pointerOverHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];if(!1===i.isOver||t.dirty){var n=!1===i.isOver;i.isOver=!0,i.isOut=!1,i.timeOver=this.game.time.time,i.x=t.x-this.sprite.x,i.y=t.y-this.sprite.y,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!0),!e&&n&&this.sprite&&this.sprite.events&&this.sprite.events.onInputOver$dispatch(this.sprite,t),this.sprite.parent&&this.sprite.parent.onChildInputOver&&this.sprite.parent.onChildInputOver.dispatch(this.sprite,t)}}},_pointerOutHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];i.isOver=!1,i.isOut=!0,i.timeOut=this.game.time.time,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="",this._setHandCursor=!1),!e&&this.sprite&&this.sprite.events&&(this.sprite.events.onInputOut$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputOut&&this.sprite.parent.onChildInputOut.dispatch(this.sprite,t))}},_touchedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(!e.isDown&&e.isOver){if(this.pixelPerfectClick&&!this.checkPixel(null,null,t))return;if(e.isDown=!0,e.isUp=!1,e.timeDown=this.game.time.time,this.downPoint.set(t.x,t.y),t.dirty=!0,this.sprite&&this.sprite.events&&(this.sprite.events.onInputDown$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputDown&&this.sprite.parent.onChildInputDown.dispatch(this.sprite,t),null===this.sprite))return;this.draggable&&!1===this.isDragged&&(0===this.dragTimeThreshold&&0===this.dragDistanceThreshold?this.startDrag(t):(this._pendingDrag=!0,this._dragDistancePass=0===this.dragDistanceThreshold,this.dragTimeThreshold>0?(this._dragTimePass=!1,this.game.time.events.add(this.dragTimeThreshold,this.dragTimeElapsed,this,t)):this._dragTimePass=!0)),this.bringToTop&&this.sprite.bringToTop()}}},dragTimeElapsed:function(t){this._dragTimePass=!0,this._pendingDrag&&this.sprite&&this._dragDistancePass&&this.startDrag(t)},_releasedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(e.isDown&&t.isUp){e.isDown=!1,e.isUp=!0,e.timeUp=this.game.time.time,e.downDuration=e.timeUp-e.timeDown;var i=this.checkPointerOver(t);this.sprite&&this.sprite.events&&(this.dragStopBlocksInputUp&&(!this.dragStopBlocksInputUp||this.draggable&&this.isDragged&&this._draggedPointerID===t.id)||this.sprite.events.onInputUp$dispatch(this.sprite,t,i),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputUp&&this.sprite.parent.onChildInputUp.dispatch(this.sprite,t,i),i&&(i=this.checkPointerOver(t))),e.isOver=i,!i&&this.useHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),t.dirty=!0,this._pendingDrag=!1,this.draggable&&this.isDragged&&this._draggedPointerID===t.id&&this.stopDrag(t)}}},updateDrag:function(t,e){var i=this.game.camera,n=this.dragOffset,s=this._dragPoint,r=this._pointerData[t.id],o=this.snapPoint,a=this.sprite;if(void 0===e&&(e=!1),t.isUp)return this.stopDrag(t),!1;var h=this.globalToLocal(t);if(a.fixedToCamera)var l=i.scale.x*h.x+s.x+n.x,u=i.scale.y*h.y+s.y+n.y;else l=h.x+s.x+n.x,u=h.y+s.y+n.y;if(a.fixedToCamera){var c=a.cameraOffset,d=c.x,p=c.y;this.allowHorizontalDrag&&(c.x=l-i.x),this.allowVerticalDrag&&(c.y=u-i.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(c.x=Math.round((c.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,c.y=Math.round((c.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,o.set(c.x,c.y));var f=c.x-d,g=c.y-p}else{var m=i.x-r.camX,y=i.y-r.camY;d=a.x,p=a.y;this.allowHorizontalDrag&&(a.x=l+m),this.allowVerticalDrag&&(a.y=u+y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(a.x=Math.round((a.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,a.y=Math.round((a.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,o.set(a.x,a.y));f=a.x-d,g=a.y-p}return this.sprite.events.onDragUpdate.dispatch(a,t,l,u,o,e,f,g),!0},justOver:function(t,e){return t=t||0,e=e||500,this._pointerData[t].isOver&&this.overDuration(t)this.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.leftthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-(this.sprite.height-this.sprite.offsetY)))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.cameraOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.cameraOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.cameraOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.cameraOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.leftthis.boundsSprite.right&&(this.sprite.x=this.boundsSprite.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsSprite.bottom&&(this.sprite.y=this.boundsSprite.bottom-(this.sprite.height-this.sprite.offsetY)))}},s.InputHandler.prototype.constructor=s.InputHandler,s.PointerLock=function(t){this.game=t,this.input=t.input,this.element=t.canvas,this.active=!1,this.locked=!1,this.onChange=new s.Signal,this.onError=new s.Signal,this.boundOnChangeHandler=this.onChangeHandler.bind(this),this.boundOnErrorHandler=this.onErrorHandler.bind(this);var e=t.device;this.pointerLockElement=e.pointerLockElement,this.pointerlockchange=e.pointerlockchange,this.pointerlockerror=e.pointerlockerror},s.PointerLock.prototype.start=function(){return!(!this.game.device.pointerLock||this.active)&&(this.element.requestPointerLock||(this.element.requestPointerLock=this.element.mozRequestPointerLock||this.element.webkitRequestPointerLock),document.exitPointerLock||(document.exitPointerLock=document.mozExitPointerLock||document.webkitExitPointerLock),document.addEventListener(this.pointerlockchange,this.boundOnChangeHandler,!0),document.addEventListener(this.pointerlockerror,this.boundOnErrorHandler,!0),this.active=!0,!0)},s.PointerLock.prototype.stop=function(){this.active&&(document.removeEventListener(this.pointerlockchange,this.boundOnChangeHandler,!0),document.removeEventListener(this.pointerlockerror,this.boundOnErrorHandler,!0),this.active=!1)},s.PointerLock.prototype.request=function(){this.active&&!this.locked&&this.element.requestPointerLock()},s.PointerLock.prototype.exit=function(){document.exitPointerLock()},s.PointerLock.prototype.onChangeHandler=function(t){this.locked=document[this.pointerLockElement]===this.element,this.onChange.dispatch(this.locked,t)},s.PointerLock.prototype.onErrorHandler=function(t){this.onError.dispatch(t)}, +n.InputHandler=function(t){this.sprite=t,this.game=t.game,this.enabled=!1,this.checked=!1,this.priorityID=0,this.useHandCursor=!1,this._setHandCursor=!1,this.isDragged=!1,this.allowHorizontalDrag=!0,this.allowVerticalDrag=!0,this.bringToTop=!1,this.snapOffset=null,this.snapOnDrag=!1,this.snapOnRelease=!1,this.snapX=0,this.snapY=0,this.snapOffsetX=0,this.snapOffsetY=0,this.pixelPerfectOver=!1,this.pixelPerfectClick=!1,this.pixelPerfectAlpha=255,this.draggable=!1,this.boundsRect=null,this.boundsSprite=null,this.scaleLayer=!1,this.dragOffset=new n.Point,this.dragFromCenter=!1,this.dragStopBlocksInputUp=!1,this.dragStartPoint=new n.Point,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this.downPoint=new n.Point,this.snapPoint=new n.Point,this._dragPoint=new n.Point,this._dragPhase=!1,this._pendingDrag=!1,this._dragTimePass=!1,this._dragDistancePass=!1,this._wasEnabled=!1,this._tempPoint=new n.Point,this._pointerData=[],this._pointerData.push({id:0,x:0,y:0,camX:0,camY:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1})},n.InputHandler.prototype={start:function(t,e){if(t=t||0,void 0===e&&(e=!1),!1===this.enabled){this.game.input.interactiveItems.add(this),this.useHandCursor=e,this.priorityID=t;for(var i=0;i<10;i++)this._pointerData[i]={id:i,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new n.Point,this.enabled=!0,this._wasEnabled=!0}return this.sprite.events.onAddedToGroup.add(this.addedToGroup,this),this.sprite.events.onRemovedFromGroup.add(this.removedFromGroup,this),this.sprite},addedToGroup:function(){this._dragPhase||this._wasEnabled&&!this.enabled&&this.start()},removedFromGroup:function(){this._dragPhase||(this.enabled?(this._wasEnabled=!0,this.stop()):this._wasEnabled=!1)},reset:function(){this.enabled=!1;for(var t=0;t<10;t++)this._pointerData[t]={id:t,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){!1!==this.enabled&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.sprite&&(this._setHandCursor&&(this.game.canvas.style.cursor="",this._setHandCursor=!1),this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},validForInput:function(t,e,i){return void 0===i&&(i=!0),!(!this.enabled||0===this.sprite.scale.x||0===this.sprite.scale.y||this.priorityIDt||this.priorityID===t&&this.sprite.renderOrderID>e))},isPixelPerfect:function(){return this.pixelPerfectClick||this.pixelPerfectOver},pointerX:function(t){return t=t||0,this._pointerData[t].x},pointerY:function(t){return t=t||0,this._pointerData[t].y},pointerDown:function(t){return t=t||0,this._pointerData[t].isDown},pointerUp:function(t){return t=t||0,this._pointerData[t].isUp},pointerTimeDown:function(t){return t=t||0,this._pointerData[t].timeDown},pointerTimeUp:function(t){return t=t||0,this._pointerData[t].timeUp},pointerOver:function(t){if(!this.enabled)return!1;if(void 0===t){for(var e=0;e<10;e++)if(this._pointerData[e].isOver)return!0;return!1}return this._pointerData[t].isOver},pointerOut:function(t){if(!this.enabled)return!1;if(void 0!==t)return this._pointerData[t].isOut;for(var e=0;e<10;e++)if(this._pointerData[e].isOut)return!0},pointerTimeOver:function(t){return t=t||0,this._pointerData[t].timeOver},pointerTimeOut:function(t){return t=t||0,this._pointerData[t].timeOut},pointerDragged:function(t){return t=t||0,this._pointerData[t].isDragged},checkPointerDown:function(t,e){return!!(t.isDown&&this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectClick)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPointerOver:function(t,e){return!!(this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectOver)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPixel:function(t,e,i){if(this.sprite.texture.baseTexture.source){if(null===t&&null===e){this.game.input.getLocalPosition(this.sprite,i,this._tempPoint);t=this._tempPoint.x,e=this._tempPoint.y}if(0!==this.sprite.anchor.x&&(t-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(e-=-this.sprite.texture.frame.height*this.sprite.anchor.y),t+=this.sprite.texture.frame.x,e+=this.sprite.texture.frame.y,this.sprite.texture.trim&&(t-=this.sprite.texture.trim.x,e-=this.sprite.texture.trim.y,tthis.sprite.texture.crop.right||ethis.sprite.texture.crop.bottom))return this._dx=t,this._dy=e,!1;if(this._dx=t,this._dy=e,this.game.input.hitContext.clearRect(0,0,1,1),this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,t,e,1,1,0,0,1,1),this.game.input.hitContext.getImageData(0,0,1,1).data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(t){if(null!==this.sprite&&void 0!==this.sprite.parent)return this.enabled&&this.sprite.visible&&this.sprite.parent.visible?this._pendingDrag?(this._dragDistancePass||(this._dragDistancePass=n.Math.distance(t.x,t.y,this.downPoint.x,this.downPoint.y)>=this.dragDistanceThreshold),this._dragDistancePass&&this._dragTimePass&&this.startDrag(t),!0):this.draggable&&this._draggedPointerID===t.id?this.updateDrag(t,!1):this._pointerData[t.id].isOver?this.checkPointerOver(t)?(this._pointerData[t.id].x=t.x-this.sprite.x,this._pointerData[t.id].y=t.y-this.sprite.y,!0):(this._pointerOutHandler(t),!1):void 0:(this._pointerOutHandler(t),!1)},_pointerOverHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];if(!1===i.isOver||t.dirty){var n=!1===i.isOver;i.isOver=!0,i.isOut=!1,i.timeOver=this.game.time.time,i.x=t.x-this.sprite.x,i.y=t.y-this.sprite.y,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!0),!e&&n&&this.sprite&&this.sprite.events&&this.sprite.events.onInputOver$dispatch(this.sprite,t),this.sprite.parent&&this.sprite.parent.onChildInputOver&&this.sprite.parent.onChildInputOver.dispatch(this.sprite,t)}}},_pointerOutHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];i.isOver=!1,i.isOut=!0,i.timeOut=this.game.time.time,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="",this._setHandCursor=!1),!e&&this.sprite&&this.sprite.events&&(this.sprite.events.onInputOut$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputOut&&this.sprite.parent.onChildInputOut.dispatch(this.sprite,t))}},_touchedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(!e.isDown&&e.isOver){if(this.pixelPerfectClick&&!this.checkPixel(null,null,t))return;if(e.isDown=!0,e.isUp=!1,e.timeDown=this.game.time.time,this.downPoint.set(t.x,t.y),t.dirty=!0,this.sprite&&this.sprite.events&&(this.sprite.events.onInputDown$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputDown&&this.sprite.parent.onChildInputDown.dispatch(this.sprite,t),null===this.sprite))return;this.draggable&&!1===this.isDragged&&(0===this.dragTimeThreshold&&0===this.dragDistanceThreshold?this.startDrag(t):(this._pendingDrag=!0,this._dragDistancePass=0===this.dragDistanceThreshold,this.dragTimeThreshold>0?(this._dragTimePass=!1,this.game.time.events.add(this.dragTimeThreshold,this.dragTimeElapsed,this,t)):this._dragTimePass=!0)),this.bringToTop&&this.sprite.bringToTop()}}},dragTimeElapsed:function(t){this._dragTimePass=!0,this._pendingDrag&&this.sprite&&this._dragDistancePass&&this.startDrag(t)},_releasedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(e.isDown&&t.isUp){e.isDown=!1,e.isUp=!0,e.timeUp=this.game.time.time,e.downDuration=e.timeUp-e.timeDown;var i=this.checkPointerOver(t);this.sprite&&this.sprite.events&&(this.dragStopBlocksInputUp&&(!this.dragStopBlocksInputUp||this.draggable&&this.isDragged&&this._draggedPointerID===t.id)||this.sprite.events.onInputUp$dispatch(this.sprite,t,i),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputUp&&this.sprite.parent.onChildInputUp.dispatch(this.sprite,t,i),i&&(i=this.checkPointerOver(t))),e.isOver=i,!i&&this.useHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),t.dirty=!0,this._pendingDrag=!1,this.draggable&&this.isDragged&&this._draggedPointerID===t.id&&this.stopDrag(t)}}},updateDrag:function(t,e){var i=this.game.camera,n=this.dragOffset,s=this._dragPoint,r=this._pointerData[t.id],o=this.snapPoint,a=this.sprite;if(void 0===e&&(e=!1),t.isUp)return this.stopDrag(t),!1;var h=this.globalToLocal(t);if(a.fixedToCamera)var l=i.scale.x*h.x+s.x+n.x,c=i.scale.y*h.y+s.y+n.y;else l=h.x+s.x+n.x,c=h.y+s.y+n.y;if(a.fixedToCamera){var u=a.cameraOffset,d=u.x,p=u.y;this.allowHorizontalDrag&&(u.x=l-i.x),this.allowVerticalDrag&&(u.y=c-i.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(u.x=Math.round((u.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,u.y=Math.round((u.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,o.set(u.x,u.y));var f=u.x-d,g=u.y-p}else{var m=i.x-r.camX,y=i.y-r.camY;d=a.x,p=a.y;this.allowHorizontalDrag&&(a.x=l+m),this.allowVerticalDrag&&(a.y=c+y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(a.x=Math.round((a.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,a.y=Math.round((a.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,o.set(a.x,a.y));f=a.x-d,g=a.y-p}return this.sprite.events.onDragUpdate.dispatch(a,t,l,c,o,e,f,g),!0},justOver:function(t,e){return t=t||0,e=e||500,this._pointerData[t].isOver&&this.overDuration(t)this.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.leftthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-(this.sprite.height-this.sprite.offsetY)))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.cameraOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.cameraOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.cameraOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.cameraOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.leftthis.boundsSprite.right&&(this.sprite.x=this.boundsSprite.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsSprite.bottom&&(this.sprite.y=this.boundsSprite.bottom-(this.sprite.height-this.sprite.offsetY)))}},n.InputHandler.prototype.constructor=n.InputHandler,n.PointerLock=function(t){this.game=t,this.input=t.input,this.element=t.canvas,this.active=!1,this.locked=!1,this.onChange=new n.Signal,this.onError=new n.Signal,this.boundOnChangeHandler=this.onChangeHandler.bind(this),this.boundOnErrorHandler=this.onErrorHandler.bind(this);var e=t.device;this.pointerLockElement=e.pointerLockElement,this.pointerlockchange=e.pointerlockchange,this.pointerlockerror=e.pointerlockerror},n.PointerLock.prototype.start=function(){return!(!this.game.device.pointerLock||this.active)&&(this.element.requestPointerLock||(this.element.requestPointerLock=this.element.mozRequestPointerLock||this.element.webkitRequestPointerLock),document.exitPointerLock||(document.exitPointerLock=document.mozExitPointerLock||document.webkitExitPointerLock),document.addEventListener(this.pointerlockchange,this.boundOnChangeHandler,!0),document.addEventListener(this.pointerlockerror,this.boundOnErrorHandler,!0),this.active=!0,!0)},n.PointerLock.prototype.stop=function(){this.active&&(document.removeEventListener(this.pointerlockchange,this.boundOnChangeHandler,!0),document.removeEventListener(this.pointerlockerror,this.boundOnErrorHandler,!0),this.active=!1)},n.PointerLock.prototype.request=function(){this.active&&!this.locked&&this.element.requestPointerLock()},n.PointerLock.prototype.exit=function(){document.exitPointerLock()},n.PointerLock.prototype.onChangeHandler=function(t){this.locked=document[this.pointerLockElement]===this.element,this.onChange.dispatch(this.locked,t)},n.PointerLock.prototype.onErrorHandler=function(t){this.onError.dispatch(t)}, /** * @author @karlmacklin * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Gamepad=function(t){this.game=t,this._gamepadIndexMap={},this._rawPads=[],this._active=!1,this.enabled=!0,this._gamepadSupportAvailable=!!navigator.webkitGetGamepads||!!navigator.webkitGamepads||-1!==navigator.userAgent.indexOf("Firefox/")||!!navigator.getGamepads,this._prevRawGamepadTypes=[],this._prevTimestamps=[],this.callbackContext=this,this.onConnectCallback=null,this.onDisconnectCallback=null,this.onDownCallback=null,this.onUpCallback=null,this.onAxisCallback=null,this.onFloatCallback=null,this._ongamepadconnected=null,this._gamepaddisconnected=null,this._gamepads=[new s.SinglePad(t,this),new s.SinglePad(t,this),new s.SinglePad(t,this),new s.SinglePad(t,this)]},s.Gamepad.prototype={addCallbacks:function(t,e){void 0!==e&&(this.onConnectCallback="function"==typeof e.onConnect?e.onConnect:this.onConnectCallback,this.onDisconnectCallback="function"==typeof e.onDisconnect?e.onDisconnect:this.onDisconnectCallback,this.onDownCallback="function"==typeof e.onDown?e.onDown:this.onDownCallback,this.onUpCallback="function"==typeof e.onUp?e.onUp:this.onUpCallback,this.onAxisCallback="function"==typeof e.onAxis?e.onAxis:this.onAxisCallback,this.onFloatCallback="function"==typeof e.onFloat?e.onFloat:this.onFloatCallback,this.callbackContext=t)},start:function(){if(!this._active){this._active=!0;var t=this;this._onGamepadConnected=function(e){return t.onGamepadConnected(e)},this._onGamepadDisconnected=function(e){return t.onGamepadDisconnected(e)},window.addEventListener("gamepadconnected",this._onGamepadConnected,!1),window.addEventListener("gamepaddisconnected",this._onGamepadDisconnected,!1)}},onGamepadConnected:function(t){var e=t.gamepad;this._rawPads.push(e),this._gamepads[e.index].connect(e)},onGamepadDisconnected:function(t){var e=t.gamepad;for(var i in this._rawPads)this._rawPads[i].index===e.index&&this._rawPads.splice(i,1);this._gamepads[e.index].disconnect()},update:function(){this._pollGamepads(),this.pad1.pollStatus(),this.pad2.pollStatus(),this.pad3.pollStatus(),this.pad4.pollStatus()},_pollGamepads:function(){if(this._active){if(navigator.getGamepads)var t=navigator.getGamepads();else if(navigator.webkitGetGamepads)t=navigator.webkitGetGamepads();else if(navigator.webkitGamepads)t=navigator.webkitGamepads();if(t){this._rawPads=[];for(var e=!1,i=0;i * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.SinglePad=function(t,e){this.game=t,this.index=null,this.connected=!1,this.callbackContext=this,this.onConnectCallback=null,this.onDisconnectCallback=null,this.onDownCallback=null,this.onUpCallback=null,this.onAxisCallback=null,this.onFloatCallback=null,this.deadZone=.26,this._padParent=e,this._rawPad=null,this._prevTimestamp=null,this._buttons=[],this._buttonsLen=0,this._axes=[],this._axesLen=0},s.SinglePad.prototype={addCallbacks:function(t,e){void 0!==e&&(this.onConnectCallback="function"==typeof e.onConnect?e.onConnect:this.onConnectCallback,this.onDisconnectCallback="function"==typeof e.onDisconnect?e.onDisconnect:this.onDisconnectCallback,this.onDownCallback="function"==typeof e.onDown?e.onDown:this.onDownCallback,this.onUpCallback="function"==typeof e.onUp?e.onUp:this.onUpCallback,this.onAxisCallback="function"==typeof e.onAxis?e.onAxis:this.onAxisCallback,this.onFloatCallback="function"==typeof e.onFloat?e.onFloat:this.onFloatCallback,this.callbackContext=t)},getButton:function(t){return this._buttons[t]?this._buttons[t]:null},pollStatus:function(){if(this.connected&&this.game.input.enabled&&this.game.input.gamepad.enabled&&this._rawPad&&(!this._rawPad.timestamp||this._rawPad.timestamp!==this._prevTimestamp)){for(var t=0;t0&&n>this.deadZone||n<0&&n<-this.deadZone?this.processAxisChange(i,n):this.processAxisChange(i,0)}this._prevTimestamp=this._rawPad.timestamp}},connect:function(t){var e=!this.connected;this.connected=!0,this.index=t.index,this._rawPad=t,this._buttons=[],this._buttonsLen=t.buttons.length,this._axes=[],this._axesLen=t.axes.length;for(var i=0;i0&&n>this.deadZone||n<0&&n<-this.deadZone?this.processAxisChange(i,n):this.processAxisChange(i,0)}this._prevTimestamp=this._rawPad.timestamp}},connect:function(t){var e=!this.connected;this.connected=!0,this.index=t.index,this._rawPad=t,this._buttons=[],this._buttonsLen=t.buttons.length,this._axes=[],this._axesLen=t.axes.length;for(var i=0;i * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Key=function(t,e){this.game=t,this._enabled=!0,this.event=null,this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.timeDown=0,this.duration=0,this.timeUp=-2500,this.durationUp=-2500,this.repeats=0,this.keyCode=e,this.onDown=new s.Signal,this.onHoldCallback=null,this.onHoldContext=null,this.onUp=new s.Signal,this._justDown=!1,this._justUp=!1},s.Key.prototype={update:function(){this._enabled&&(this.isDown?(this.duration=this.game.time.time-this.timeDown,this.repeats++,this.onHoldCallback&&this.onHoldCallback.call(this.onHoldContext,this)):this.durationUp=this.game.time.time-this.timeUp)},processKeyDown:function(t){this._enabled&&(this.event=t,this.isDown||(this.altKey=t.altKey,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.time,this.duration=0,this.durationUp=this.game.time.time-this.timeUp,this.repeats=0,this._justDown=!0,this.onDown.dispatch(this)))},processKeyUp:function(t){this._enabled&&(this.event=t,this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.duration=this.game.time.time-this.timeDown,this.durationUp=0,this._justUp=!0,this.onUp.dispatch(this)))},reset:function(t){void 0===t&&(t=!0),this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.duration=0,this.durationUp=-2500,this._enabled=!0,this._justDown=!1,this._justUp=!1,t&&(this.onDown.removeAll(),this.onUp.removeAll(),this.onHoldCallback=null,this.onHoldContext=null)},downDuration:function(t){return void 0===t&&(t=50),this.isDown&&this.duration * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Keyboard=function(t){this.game=t,this.active=!1,this.enabled=!0,this.event=null,this.pressEvent=null,this.callbackContext=this,this.onDownCallback=null,this.onPressCallback=null,this.onUpCallback=null,this._keys=[],this._capture=[],this._onKeyDown=null,this._onKeyPress=null,this._onKeyUp=null,this._i=0,this._k=0},s.Keyboard.prototype={addCallbacks:function(t,e,i,n){this.callbackContext=t,null!=e&&(this.onDownCallback=e),null!=i&&(this.onUpCallback=i),null!=n&&(this.onPressCallback=n)},removeCallbacks:function(){this.callbackContext=this,this.onDownCallback=null,this.onUpCallback=null,this.onPressCallback=null},addKey:function(t){return this._keys[t]||(this._keys[t]=new s.Key(this.game,t),this.addKeyCapture(t)),this._keys[t]},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},removeKey:function(t){this._keys[t]&&(this._keys[t]=null,this.removeKeyCapture(t))},createCursorKeys:function(){return this.addKeys({up:s.KeyCode.UP,down:s.KeyCode.DOWN,left:s.KeyCode.LEFT,right:s.KeyCode.RIGHT})},start:function(){if(this.game.device.cocoonJS)return!1;if(this.active)return!1;var t=this;return this._onKeyDown=function(e){return t.processKeyDown(e)},this._onKeyUp=function(e){return t.processKeyUp(e)},this._onKeyPress=function(e){return t.processKeyPress(e)},window.addEventListener("keydown",this._onKeyDown,!1),window.addEventListener("keyup",this._onKeyUp,!1),window.addEventListener("keypress",this._onKeyPress,!1),this.active=!0,!0},stop:function(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),window.removeEventListener("keypress",this._onKeyPress),this._onKeyDown=null,this._onKeyUp=null,this._onKeyPress=null,this.active=!1},destroy:function(){this.stop(),this.clearCaptures(),this._keys.length=0,this._i=0},addKeyCapture:function(t){if("object"==typeof t)for(var e in t)this._capture[t[e]]=!0;else this._capture[t]=!0},removeKeyCapture:function(t){delete this._capture[t]},clearCaptures:function(){this._capture={}},update:function(){for(this._i=this._keys.length;this._i--;)this._keys[this._i]&&this._keys[this._i].update()},processKeyDown:function(t){if(this.event=t,this.game.input.enabled&&this.enabled){var e=t.keyCode;this._capture[e]&&t.preventDefault(),this._keys[e]||(this._keys[e]=new s.Key(this.game,e)),this._keys[e].processKeyDown(t),this._k=e,this.onDownCallback&&this.onDownCallback.call(this.callbackContext,t)}},processKeyPress:function(t){this.pressEvent=t,this.game.input.enabled&&this.enabled&&this.onPressCallback&&this.onPressCallback.call(this.callbackContext,String.fromCharCode(t.charCode),t)},processKeyUp:function(t){if(this.event=t,this.game.input.enabled&&this.enabled){var e=t.keyCode;this._capture[e]&&t.preventDefault(),this._keys[e]||(this._keys[e]=new s.Key(this.game,e)),this._keys[e].processKeyUp(t),this.onUpCallback&&this.onUpCallback.call(this.callbackContext,t)}},reset:function(t){void 0===t&&(t=!0),this.event=null;for(var e=this._keys.length;e--;)this._keys[e]&&this._keys[e].reset(t)},downDuration:function(t,e){return this._keys[t]?this._keys[t].downDuration(e):null},upDuration:function(t,e){return this._keys[t]?this._keys[t].upDuration(e):null},justPressed:function(t){return this._keys[t]?this._keys[t].justPressed():null},justReleased:function(t){return this._keys[t]?this._keys[t].justReleased():null},isDown:function(t){return this._keys[t]?this._keys[t].isDown:null}},Object.defineProperty(s.Keyboard.prototype,"lastChar",{get:function(){return this.event&&32===this.event.charCode?"":this.pressEvent?String.fromCharCode(this.pressEvent.charCode):null}}),Object.defineProperty(s.Keyboard.prototype,"lastKey",{get:function(){return this._keys[this._k]}}),s.Keyboard.prototype.constructor=s.Keyboard,s.KeyCode={A:"A".charCodeAt(0),B:"B".charCodeAt(0),C:"C".charCodeAt(0),D:"D".charCodeAt(0),E:"E".charCodeAt(0),F:"F".charCodeAt(0),G:"G".charCodeAt(0),H:"H".charCodeAt(0),I:"I".charCodeAt(0),J:"J".charCodeAt(0),K:"K".charCodeAt(0),L:"L".charCodeAt(0),M:"M".charCodeAt(0),N:"N".charCodeAt(0),O:"O".charCodeAt(0),P:"P".charCodeAt(0),Q:"Q".charCodeAt(0),R:"R".charCodeAt(0),S:"S".charCodeAt(0),T:"T".charCodeAt(0),U:"U".charCodeAt(0),V:"V".charCodeAt(0),W:"W".charCodeAt(0),X:"X".charCodeAt(0),Y:"Y".charCodeAt(0),Z:"Z".charCodeAt(0),ZERO:"0".charCodeAt(0),ONE:"1".charCodeAt(0),TWO:"2".charCodeAt(0),THREE:"3".charCodeAt(0),FOUR:"4".charCodeAt(0),FIVE:"5".charCodeAt(0),SIX:"6".charCodeAt(0),SEVEN:"7".charCodeAt(0),EIGHT:"8".charCodeAt(0),NINE:"9".charCodeAt(0),NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,NUMPAD_MULTIPLY:106,NUMPAD_ADD:107,NUMPAD_ENTER:108,NUMPAD_SUBTRACT:109,NUMPAD_DECIMAL:110,NUMPAD_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,F13:124,F14:125,F15:126,COLON:186,EQUALS:187,COMMA:188,UNDERSCORE:189,PERIOD:190,QUESTION_MARK:191,TILDE:192,OPEN_BRACKET:219,BACKWARD_SLASH:220,CLOSED_BRACKET:221,QUOTES:222,BACKSPACE:8,TAB:9,CLEAR:12,ENTER:13,SHIFT:16,CONTROL:17,ALT:18,CAPS_LOCK:20,ESC:27,SPACEBAR:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS:43,MINUS:44,INSERT:45,DELETE:46,HELP:47,NUM_LOCK:144},s.KeyCode)s.KeyCode.hasOwnProperty(o)&&!o.match(/[a-z]/)&&(s.Keyboard[o]=s.KeyCode[o]); +n.Keyboard=function(t){this.game=t,this.active=!1,this.enabled=!0,this.event=null,this.pressEvent=null,this.callbackContext=this,this.onDownCallback=null,this.onPressCallback=null,this.onUpCallback=null,this._keys=[],this._capture=[],this._onKeyDown=null,this._onKeyPress=null,this._onKeyUp=null,this._i=0,this._k=0},n.Keyboard.prototype={addCallbacks:function(t,e,i,n){this.callbackContext=t,null!=e&&(this.onDownCallback=e),null!=i&&(this.onUpCallback=i),null!=n&&(this.onPressCallback=n)},removeCallbacks:function(){this.callbackContext=this,this.onDownCallback=null,this.onUpCallback=null,this.onPressCallback=null},addKey:function(t){return this._keys[t]||(this._keys[t]=new n.Key(this.game,t),this.addKeyCapture(t)),this._keys[t]},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},removeKey:function(t){this._keys[t]&&(this._keys[t]=null,this.removeKeyCapture(t))},createCursorKeys:function(){return this.addKeys({up:n.KeyCode.UP,down:n.KeyCode.DOWN,left:n.KeyCode.LEFT,right:n.KeyCode.RIGHT})},start:function(){if(this.game.device.cocoonJS)return!1;if(this.active)return!1;var t=this;return this._onKeyDown=function(e){return t.processKeyDown(e)},this._onKeyUp=function(e){return t.processKeyUp(e)},this._onKeyPress=function(e){return t.processKeyPress(e)},window.addEventListener("keydown",this._onKeyDown,!1),window.addEventListener("keyup",this._onKeyUp,!1),window.addEventListener("keypress",this._onKeyPress,!1),this.active=!0,!0},stop:function(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),window.removeEventListener("keypress",this._onKeyPress),this._onKeyDown=null,this._onKeyUp=null,this._onKeyPress=null,this.active=!1},destroy:function(){this.stop(),this.clearCaptures(),this._keys.length=0,this._i=0},addKeyCapture:function(t){if("object"==typeof t)for(var e in t)this._capture[t[e]]=!0;else this._capture[t]=!0},removeKeyCapture:function(t){delete this._capture[t]},clearCaptures:function(){this._capture={}},update:function(){for(this._i=this._keys.length;this._i--;)this._keys[this._i]&&this._keys[this._i].update()},processKeyDown:function(t){if(this.event=t,this.game.input.enabled&&this.enabled){var e=t.keyCode;this._capture[e]&&t.preventDefault(),this._keys[e]||(this._keys[e]=new n.Key(this.game,e)),this._keys[e].processKeyDown(t),this._k=e,this.onDownCallback&&this.onDownCallback.call(this.callbackContext,t)}},processKeyPress:function(t){this.pressEvent=t,this.game.input.enabled&&this.enabled&&this.onPressCallback&&this.onPressCallback.call(this.callbackContext,String.fromCharCode(t.charCode),t)},processKeyUp:function(t){if(this.event=t,this.game.input.enabled&&this.enabled){var e=t.keyCode;this._capture[e]&&t.preventDefault(),this._keys[e]||(this._keys[e]=new n.Key(this.game,e)),this._keys[e].processKeyUp(t),this.onUpCallback&&this.onUpCallback.call(this.callbackContext,t)}},reset:function(t){void 0===t&&(t=!0),this.event=null;for(var e=this._keys.length;e--;)this._keys[e]&&this._keys[e].reset(t)},downDuration:function(t,e){return this._keys[t]?this._keys[t].downDuration(e):null},upDuration:function(t,e){return this._keys[t]?this._keys[t].upDuration(e):null},justPressed:function(t){return this._keys[t]?this._keys[t].justPressed():null},justReleased:function(t){return this._keys[t]?this._keys[t].justReleased():null},isDown:function(t){return this._keys[t]?this._keys[t].isDown:null}},Object.defineProperty(n.Keyboard.prototype,"lastChar",{get:function(){return this.event&&32===this.event.charCode?"":this.pressEvent?String.fromCharCode(this.pressEvent.charCode):null}}),Object.defineProperty(n.Keyboard.prototype,"lastKey",{get:function(){return this._keys[this._k]}}),n.Keyboard.prototype.constructor=n.Keyboard,n.KeyCode={A:"A".charCodeAt(0),B:"B".charCodeAt(0),C:"C".charCodeAt(0),D:"D".charCodeAt(0),E:"E".charCodeAt(0),F:"F".charCodeAt(0),G:"G".charCodeAt(0),H:"H".charCodeAt(0),I:"I".charCodeAt(0),J:"J".charCodeAt(0),K:"K".charCodeAt(0),L:"L".charCodeAt(0),M:"M".charCodeAt(0),N:"N".charCodeAt(0),O:"O".charCodeAt(0),P:"P".charCodeAt(0),Q:"Q".charCodeAt(0),R:"R".charCodeAt(0),S:"S".charCodeAt(0),T:"T".charCodeAt(0),U:"U".charCodeAt(0),V:"V".charCodeAt(0),W:"W".charCodeAt(0),X:"X".charCodeAt(0),Y:"Y".charCodeAt(0),Z:"Z".charCodeAt(0),ZERO:"0".charCodeAt(0),ONE:"1".charCodeAt(0),TWO:"2".charCodeAt(0),THREE:"3".charCodeAt(0),FOUR:"4".charCodeAt(0),FIVE:"5".charCodeAt(0),SIX:"6".charCodeAt(0),SEVEN:"7".charCodeAt(0),EIGHT:"8".charCodeAt(0),NINE:"9".charCodeAt(0),NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,NUMPAD_MULTIPLY:106,NUMPAD_ADD:107,NUMPAD_ENTER:108,NUMPAD_SUBTRACT:109,NUMPAD_DECIMAL:110,NUMPAD_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,F13:124,F14:125,F15:126,COLON:186,EQUALS:187,COMMA:188,UNDERSCORE:189,PERIOD:190,QUESTION_MARK:191,TILDE:192,OPEN_BRACKET:219,BACKWARD_SLASH:220,CLOSED_BRACKET:221,QUOTES:222,BACKSPACE:8,TAB:9,CLEAR:12,ENTER:13,SHIFT:16,CONTROL:17,ALT:18,CAPS_LOCK:20,ESC:27,SPACEBAR:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS:43,MINUS:44,INSERT:45,DELETE:46,HELP:47,NUM_LOCK:144},n.KeyCode)n.KeyCode.hasOwnProperty(r)&&!r.match(/[a-z]/)&&(n.Keyboard[r]=n.KeyCode[r]); /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */for(var a in s.Component=function(){}, + */for(var o in n.Component=function(){}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Angle=function(){},s.Component.Angle.prototype={angle:{get:function(){return s.Math.wrapAngle(s.Math.radToDeg(this.rotation))},set:function(t){this.rotation=s.Math.degToRad(s.Math.wrapAngle(t))}}}, +n.Component.Angle=function(){},n.Component.Angle.prototype={angle:{get:function(){return n.Math.wrapAngle(n.Math.radToDeg(this.rotation))},set:function(t){this.rotation=n.Math.degToRad(n.Math.wrapAngle(t))}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Animation=function(){},s.Component.Animation.prototype={play:function(t,e,i,n){if(this.animations)return this.animations.play(t,e,i,n)}}, +n.Component.Animation=function(){},n.Component.Animation.prototype={play:function(t,e,i,n){if(this.animations)return this.animations.play(t,e,i,n)}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.AutoCull=function(){},s.Component.AutoCull.prototype={autoCull:!1,inCamera:{get:function(){return this.autoCull||this.checkWorldBounds||(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y),this.game.world.camera.view.intersects(this._bounds)}}}, +n.Component.AutoCull=function(){},n.Component.AutoCull.prototype={autoCull:!1,inCamera:{get:function(){return this.autoCull||this.checkWorldBounds||(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y),this.game.world.camera.view.intersects(this._bounds)}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Bounds=function(){},s.Component.Bounds.prototype={offsetX:{get:function(){return this.anchor.x*this.width}},offsetY:{get:function(){return this.anchor.y*this.height}},centerX:{get:function(){return this.x-this.offsetX+.5*this.width},set:function(t){this.x=t+this.offsetX-.5*this.width}},centerY:{get:function(){return this.y-this.offsetY+.5*this.height},set:function(t){this.y=t+this.offsetY-.5*this.height}},left:{get:function(){return this.x-this.offsetX},set:function(t){this.x=t+this.offsetX}},right:{get:function(){return this.x+this.width-this.offsetX},set:function(t){this.x=t-this.width+this.offsetX}},top:{get:function(){return this.y-this.offsetY},set:function(t){this.y=t+this.offsetY}},bottom:{get:function(){return this.y+this.height-this.offsetY},set:function(t){this.y=t-this.height+this.offsetY}},alignIn:function(t,e,i,n){switch(void 0===i&&(i=0),void 0===n&&(n=0),e){default:case s.TOP_LEFT:this.left=t.left-i,this.top=t.top-n;break;case s.TOP_CENTER:this.centerX=t.centerX+i,this.top=t.top-n;break;case s.TOP_RIGHT:this.right=t.right+i,this.top=t.top-n;break;case s.LEFT_CENTER:this.left=t.left-i,this.centerY=t.centerY+n;break;case s.CENTER:this.centerX=t.centerX+i,this.centerY=t.centerY+n;break;case s.RIGHT_CENTER:this.right=t.right+i,this.centerY=t.centerY+n;break;case s.BOTTOM_LEFT:this.left=t.left-i,this.bottom=t.bottom+n;break;case s.BOTTOM_CENTER:this.centerX=t.centerX+i,this.bottom=t.bottom+n;break;case s.BOTTOM_RIGHT:this.right=t.right+i,this.bottom=t.bottom+n}return this},alignTo:function(t,e,i,n){switch(void 0===i&&(i=0),void 0===n&&(n=0),e){default:case s.TOP_LEFT:this.left=t.left-i,this.bottom=t.top-n;break;case s.TOP_CENTER:this.centerX=t.centerX+i,this.bottom=t.top-n;break;case s.TOP_RIGHT:this.right=t.right+i,this.bottom=t.top-n;break;case s.LEFT_TOP:this.right=t.left-i,this.top=t.top-n;break;case s.LEFT_CENTER:this.right=t.left-i,this.centerY=t.centerY+n;break;case s.LEFT_BOTTOM:this.right=t.left-i,this.bottom=t.bottom+n;break;case s.RIGHT_TOP:this.left=t.right+i,this.top=t.top-n;break;case s.RIGHT_CENTER:this.left=t.right+i,this.centerY=t.centerY+n;break;case s.RIGHT_BOTTOM:this.left=t.right+i,this.bottom=t.bottom+n;break;case s.BOTTOM_LEFT:this.left=t.left-i,this.top=t.bottom+n;break;case s.BOTTOM_CENTER:this.centerX=t.centerX+i,this.top=t.bottom+n;break;case s.BOTTOM_RIGHT:this.right=t.right+i,this.top=t.bottom+n}return this}},s.Group.prototype.alignIn=s.Component.Bounds.prototype.alignIn,s.Group.prototype.alignTo=s.Component.Bounds.prototype.alignTo, +n.Component.Bounds=function(){},n.Component.Bounds.prototype={offsetX:{get:function(){return this.anchor.x*this.width}},offsetY:{get:function(){return this.anchor.y*this.height}},centerX:{get:function(){return this.x-this.offsetX+.5*this.width},set:function(t){this.x=t+this.offsetX-.5*this.width}},centerY:{get:function(){return this.y-this.offsetY+.5*this.height},set:function(t){this.y=t+this.offsetY-.5*this.height}},left:{get:function(){return this.x-this.offsetX},set:function(t){this.x=t+this.offsetX}},right:{get:function(){return this.x+this.width-this.offsetX},set:function(t){this.x=t-this.width+this.offsetX}},top:{get:function(){return this.y-this.offsetY},set:function(t){this.y=t+this.offsetY}},bottom:{get:function(){return this.y+this.height-this.offsetY},set:function(t){this.y=t-this.height+this.offsetY}},alignIn:function(t,e,i,s){switch(void 0===i&&(i=0),void 0===s&&(s=0),e){default:case n.TOP_LEFT:this.left=t.left-i,this.top=t.top-s;break;case n.TOP_CENTER:this.centerX=t.centerX+i,this.top=t.top-s;break;case n.TOP_RIGHT:this.right=t.right+i,this.top=t.top-s;break;case n.LEFT_CENTER:this.left=t.left-i,this.centerY=t.centerY+s;break;case n.CENTER:this.centerX=t.centerX+i,this.centerY=t.centerY+s;break;case n.RIGHT_CENTER:this.right=t.right+i,this.centerY=t.centerY+s;break;case n.BOTTOM_LEFT:this.left=t.left-i,this.bottom=t.bottom+s;break;case n.BOTTOM_CENTER:this.centerX=t.centerX+i,this.bottom=t.bottom+s;break;case n.BOTTOM_RIGHT:this.right=t.right+i,this.bottom=t.bottom+s}return this},alignTo:function(t,e,i,s){switch(void 0===i&&(i=0),void 0===s&&(s=0),e){default:case n.TOP_LEFT:this.left=t.left-i,this.bottom=t.top-s;break;case n.TOP_CENTER:this.centerX=t.centerX+i,this.bottom=t.top-s;break;case n.TOP_RIGHT:this.right=t.right+i,this.bottom=t.top-s;break;case n.LEFT_TOP:this.right=t.left-i,this.top=t.top-s;break;case n.LEFT_CENTER:this.right=t.left-i,this.centerY=t.centerY+s;break;case n.LEFT_BOTTOM:this.right=t.left-i,this.bottom=t.bottom+s;break;case n.RIGHT_TOP:this.left=t.right+i,this.top=t.top-s;break;case n.RIGHT_CENTER:this.left=t.right+i,this.centerY=t.centerY+s;break;case n.RIGHT_BOTTOM:this.left=t.right+i,this.bottom=t.bottom+s;break;case n.BOTTOM_LEFT:this.left=t.left-i,this.top=t.bottom+s;break;case n.BOTTOM_CENTER:this.centerX=t.centerX+i,this.top=t.bottom+s;break;case n.BOTTOM_RIGHT:this.right=t.right+i,this.top=t.bottom+s}return this}},n.Group.prototype.alignIn=n.Component.Bounds.prototype.alignIn,n.Group.prototype.alignTo=n.Component.Bounds.prototype.alignTo, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.BringToTop=function(){},s.Component.BringToTop.prototype.bringToTop=function(){return this.parent&&this.parent.bringChildToTop&&this.parent.bringChildToTop(this),this},s.Component.BringToTop.prototype.sendToBack=function(){return this.parent&&this.parent.sendChildToBack&&this.parent.sendChildToBack(this),this},s.Component.BringToTop.prototype.moveUp=function(){return this.parent&&this.parent.moveUp(this),this},s.Component.BringToTop.prototype.moveDown=function(){return this.parent&&this.parent.moveDown(this),this}, +n.Component.BringToTop=function(){},n.Component.BringToTop.prototype.bringToTop=function(){return this.parent&&this.parent.bringChildToTop&&this.parent.bringChildToTop(this),this},n.Component.BringToTop.prototype.sendToBack=function(){return this.parent&&this.parent.sendChildToBack&&this.parent.sendChildToBack(this),this},n.Component.BringToTop.prototype.moveUp=function(){return this.parent&&this.parent.moveUp(this),this},n.Component.BringToTop.prototype.moveDown=function(){return this.parent&&this.parent.moveDown(this),this}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Core=function(){},s.Component.Core.install=function(t){s.Utils.mixinPrototype(this,s.Component.Core.prototype),this.components={};for(var e=0;e * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Crop=function(){},s.Component.Crop.prototype={cropRect:null,_crop:null,crop:function(t,e){void 0===e&&(e=!1),t?(e&&null!==this.cropRect?this.cropRect.setTo(t.x,t.y,t.width,t.height):e&&null===this.cropRect?this.cropRect=new s.Rectangle(t.x,t.y,t.width,t.height):this.cropRect=t,this.updateCrop()):(this._crop=null,this.cropRect=null,this.resetFrame())},updateCrop:function(){if(this.cropRect){var t=this.texture.crop.x,e=this.texture.crop.y,i=this.texture.crop.width,n=this.texture.crop.height;this._crop=s.Rectangle.clone(this.cropRect,this._crop),this._crop.x+=this._frame.x,this._crop.y+=this._frame.y;var r=Math.max(this._frame.x,this._crop.x),o=Math.max(this._frame.y,this._crop.y),a=Math.min(this._frame.right,this._crop.right)-r,h=Math.min(this._frame.bottom,this._crop.bottom)-o;this.texture.crop.x=r,this.texture.crop.y=o,this.texture.crop.width=a,this.texture.crop.height=h,this.texture.frame.width=Math.min(a,this.cropRect.width),this.texture.frame.height=Math.min(h,this.cropRect.height),this.texture.width=this.texture.frame.width,this.texture.height=this.texture.frame.height,this.texture._updateUvs(),16777215===this.tint||t===r&&e===o&&i===a&&n===h||(this.texture.requiresReTint=!0)}}}, +n.Component.Crop=function(){},n.Component.Crop.prototype={cropRect:null,_crop:null,crop:function(t,e){void 0===e&&(e=!1),t?(e&&null!==this.cropRect?this.cropRect.setTo(t.x,t.y,t.width,t.height):e&&null===this.cropRect?this.cropRect=new n.Rectangle(t.x,t.y,t.width,t.height):this.cropRect=t,this.updateCrop()):(this._crop=null,this.cropRect=null,this.resetFrame())},updateCrop:function(){if(this.cropRect){var t=this.texture.crop.x,e=this.texture.crop.y,i=this.texture.crop.width,s=this.texture.crop.height;this._crop=n.Rectangle.clone(this.cropRect,this._crop),this._crop.x+=this._frame.x,this._crop.y+=this._frame.y;var r=Math.max(this._frame.x,this._crop.x),o=Math.max(this._frame.y,this._crop.y),a=Math.min(this._frame.right,this._crop.right)-r,h=Math.min(this._frame.bottom,this._crop.bottom)-o;this.texture.crop.x=r,this.texture.crop.y=o,this.texture.crop.width=a,this.texture.crop.height=h,this.texture.frame.width=Math.min(a,this.cropRect.width),this.texture.frame.height=Math.min(h,this.cropRect.height),this.texture.width=this.texture.frame.width,this.texture.height=this.texture.frame.height,this.texture._updateUvs(),16777215===this.tint||t===r&&e===o&&i===a&&s===h||(this.texture.requiresReTint=!0)}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Delta=function(){},s.Component.Delta.prototype={deltaX:{get:function(){return this.world.x-this.previousPosition.x}},deltaY:{get:function(){return this.world.y-this.previousPosition.y}},deltaZ:{get:function(){return this.rotation-this.previousRotation}}}, +n.Component.Delta=function(){},n.Component.Delta.prototype={deltaX:{get:function(){return this.world.x-this.previousPosition.x}},deltaY:{get:function(){return this.world.y-this.previousPosition.y}},deltaZ:{get:function(){return this.rotation-this.previousRotation}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Destroy=function(){},s.Component.Destroy.prototype={destroyPhase:!1,destroy:function(t,e){if(null!==this.game&&!this.destroyPhase){void 0===t&&(t=!0),void 0===e&&(e=!1),this.destroyPhase=!0,this.events&&this.events.onDestroy$dispatch(this),this.parent&&(this.parent instanceof s.Group?this.parent.remove(this):this.parent.removeChild(this)),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy(),this.game.tweens.removeFrom(this);var i=this.children.length;if(t)for(;i--;)this.children[i].destroy(t);else for(;i--;)this.removeChild(this.children[i]);this._crop&&(this._crop=null,this.cropRect=null),this._frame&&(this._frame=null),s.Video&&this.key instanceof s.Video&&this.key.onChangeSource.remove(this.resizeFrame,this),s.BitmapText&&this._glyphs&&(this._glyphs=[]),this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null,this.data={},this.renderable=!1,this.transformCallback&&(this.transformCallback=null,this.transformCallbackContext=null),this.hitArea=null,this.parent=null,this.stage=null,this.worldTransform=null,this.filterArea=null,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture(),e&&this.texture.destroy(!0),this.destroyPhase=!1,this.pendingDestroy=!1}}}, +n.Component.Destroy=function(){},n.Component.Destroy.prototype={destroyPhase:!1,destroy:function(t,e){if(null!==this.game&&!this.destroyPhase){void 0===t&&(t=!0),void 0===e&&(e=!1),this.destroyPhase=!0,this.events&&this.events.onDestroy$dispatch(this),this.parent&&(this.parent instanceof n.Group?this.parent.remove(this):this.parent.removeChild(this)),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy(),this.game.tweens.removeFrom(this);var i=this.children.length;if(t)for(;i--;)this.children[i].destroy(t);else for(;i--;)this.removeChild(this.children[i]);this._crop&&(this._crop=null,this.cropRect=null),this._frame&&(this._frame=null),n.Video&&this.key instanceof n.Video&&this.key.onChangeSource.remove(this.resizeFrame,this),n.BitmapText&&this._glyphs&&(this._glyphs=[]),this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null,this.data={},this.renderable=!1,this.transformCallback&&(this.transformCallback=null,this.transformCallbackContext=null),this.hitArea=null,this.parent=null,this.stage=null,this.worldTransform=null,this.filterArea=null,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture(),e&&this.texture.destroy(!0),this.destroyPhase=!1,this.pendingDestroy=!1}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Events=function(t){this.parent=t},s.Events.prototype={destroy:function(){this._parent=null,this._onDestroy&&this._onDestroy.dispose(),this._onAddedToGroup&&this._onAddedToGroup.dispose(),this._onRemovedFromGroup&&this._onRemovedFromGroup.dispose(),this._onKilled&&this._onKilled.dispose(),this._onRevived&&this._onRevived.dispose(),this._onEnterBounds&&this._onEnterBounds.dispose(),this._onOutOfBounds&&this._onOutOfBounds.dispose(),this._onInputOver&&this._onInputOver.dispose(),this._onInputOut&&this._onInputOut.dispose(),this._onInputDown&&this._onInputDown.dispose(),this._onInputUp&&this._onInputUp.dispose(),this._onDragStart&&this._onDragStart.dispose(),this._onDragUpdate&&this._onDragUpdate.dispose(),this._onDragStop&&this._onDragStop.dispose(),this._onAnimationStart&&this._onAnimationStart.dispose(),this._onAnimationComplete&&this._onAnimationComplete.dispose(),this._onAnimationLoop&&this._onAnimationLoop.dispose()},onAddedToGroup:null,onRemovedFromGroup:null,onDestroy:null,onKilled:null,onRevived:null,onOutOfBounds:null,onEnterBounds:null,onInputOver:null,onInputOut:null,onInputDown:null,onInputUp:null,onDragStart:null,onDragUpdate:null,onDragStop:null,onAnimationStart:null,onAnimationComplete:null,onAnimationLoop:null},s.Events.prototype.constructor=s.Events,s.Events.prototype)s.Events.prototype.hasOwnProperty(a)&&0===a.indexOf("on")&&null===s.Events.prototype[a]&&function(t,e){"use strict";Object.defineProperty(s.Events.prototype,t,{get:function(){return this[e]||(this[e]=new s.Signal)}}),s.Events.prototype[t+"$dispatch"]=function(){return this[e]?this[e].dispatch.apply(this[e],arguments):null}}(a,"_"+a); +n.Events=function(t){this.parent=t},n.Events.prototype={destroy:function(){this._parent=null,this._onDestroy&&this._onDestroy.dispose(),this._onAddedToGroup&&this._onAddedToGroup.dispose(),this._onRemovedFromGroup&&this._onRemovedFromGroup.dispose(),this._onKilled&&this._onKilled.dispose(),this._onRevived&&this._onRevived.dispose(),this._onEnterBounds&&this._onEnterBounds.dispose(),this._onOutOfBounds&&this._onOutOfBounds.dispose(),this._onInputOver&&this._onInputOver.dispose(),this._onInputOut&&this._onInputOut.dispose(),this._onInputDown&&this._onInputDown.dispose(),this._onInputUp&&this._onInputUp.dispose(),this._onDragStart&&this._onDragStart.dispose(),this._onDragUpdate&&this._onDragUpdate.dispose(),this._onDragStop&&this._onDragStop.dispose(),this._onAnimationStart&&this._onAnimationStart.dispose(),this._onAnimationComplete&&this._onAnimationComplete.dispose(),this._onAnimationLoop&&this._onAnimationLoop.dispose()},onAddedToGroup:null,onRemovedFromGroup:null,onDestroy:null,onKilled:null,onRevived:null,onOutOfBounds:null,onEnterBounds:null,onInputOver:null,onInputOut:null,onInputDown:null,onInputUp:null,onDragStart:null,onDragUpdate:null,onDragStop:null,onAnimationStart:null,onAnimationComplete:null,onAnimationLoop:null},n.Events.prototype.constructor=n.Events,n.Events.prototype)n.Events.prototype.hasOwnProperty(o)&&0===o.indexOf("on")&&null===n.Events.prototype[o]&&function(t,e){"use strict";Object.defineProperty(n.Events.prototype,t,{get:function(){return this[e]||(this[e]=new n.Signal)}}),n.Events.prototype[t+"$dispatch"]=function(){return this[e]?this[e].dispatch.apply(this[e],arguments):null}}(o,"_"+o); /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} - */s.Component.FixedToCamera=function(){},s.Component.FixedToCamera.postUpdate=function(){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y)},s.Component.FixedToCamera.prototype={_fixedToCamera:!1,fixedToCamera:{get:function(){return this._fixedToCamera},set:function(t){t?(this._fixedToCamera=!0,this.cameraOffset.set(this.x,this.y)):this._fixedToCamera=!1}},cameraOffset:new s.Point}, + */n.Component.FixedToCamera=function(){},n.Component.FixedToCamera.postUpdate=function(){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y)},n.Component.FixedToCamera.prototype={_fixedToCamera:!1,fixedToCamera:{get:function(){return this._fixedToCamera},set:function(t){t?(this._fixedToCamera=!0,this.cameraOffset.set(this.x,this.y)):this._fixedToCamera=!1}},cameraOffset:new n.Point}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Health=function(){},s.Component.Health.prototype={health:1,maxHealth:100,damage:function(t){return this.alive&&(this.health-=t,this.health<=0&&this.kill()),this},setHealth:function(t){return this.health=t,this.health>this.maxHealth&&(this.health=this.maxHealth),this},heal:function(t){return this.alive&&(this.health+=t,this.health>this.maxHealth&&(this.health=this.maxHealth)),this}}, +n.Component.Health=function(){},n.Component.Health.prototype={health:1,maxHealth:100,damage:function(t){return this.alive&&(this.health-=t,this.health<=0&&this.kill()),this},setHealth:function(t){return this.health=t,this.health>this.maxHealth&&(this.health=this.maxHealth),this},heal:function(t){return this.alive&&(this.health+=t,this.health>this.maxHealth&&(this.health=this.maxHealth)),this}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.InCamera=function(){},s.Component.InCamera.prototype={inCamera:{get:function(){return this.game.world.camera.view.intersects(this._bounds)}}}, +n.Component.InCamera=function(){},n.Component.InCamera.prototype={inCamera:{get:function(){return this.game.world.camera.view.intersects(this._bounds)}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.InputEnabled=function(){},s.Component.InputEnabled.prototype={input:null,inputEnabled:{get:function(){return this.input&&this.input.enabled},set:function(t){t?null===this.input?(this.input=new s.InputHandler(this),this.input.start()):this.input&&!this.input.enabled&&this.input.start():this.input&&this.input.enabled&&this.input.stop()}}}, +n.Component.InputEnabled=function(){},n.Component.InputEnabled.prototype={input:null,inputEnabled:{get:function(){return this.input&&this.input.enabled},set:function(t){t?null===this.input?(this.input=new n.InputHandler(this),this.input.start()):this.input&&!this.input.enabled&&this.input.start():this.input&&this.input.enabled&&this.input.stop()}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.InWorld=function(){},s.Component.InWorld.preUpdate=function(){if(this.pendingDestroy)return this.destroy(),!1;if(this.autoCull||this.checkWorldBounds){if(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y,this.autoCull)if(this.game.world.camera.view.intersects(this._bounds))this.renderable=!0,this.game.world.camera.totalInView++;else if(this.renderable=!1,this.outOfCameraBoundsKill)return this.kill(),!1;if(this.checkWorldBounds)if(this._outOfBoundsFired&&this.game.world.bounds.intersects(this._bounds))this._outOfBoundsFired=!1,this.events.onEnterBounds$dispatch(this);else if(!this._outOfBoundsFired&&!this.game.world.bounds.intersects(this._bounds)&&(this._outOfBoundsFired=!0,this.events.onOutOfBounds$dispatch(this),this.outOfBoundsKill))return this.kill(),!1}return!0},s.Component.InWorld.prototype={checkWorldBounds:!1,outOfBoundsKill:!1,outOfCameraBoundsKill:!1,_outOfBoundsFired:!1,inWorld:{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}}, +n.Component.InWorld=function(){},n.Component.InWorld.preUpdate=function(){if(this.pendingDestroy)return this.destroy(),!1;if(this.autoCull||this.checkWorldBounds){if(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y,this.autoCull)if(this.game.world.camera.view.intersects(this._bounds))this.renderable=!0,this.game.world.camera.totalInView++;else if(this.renderable=!1,this.outOfCameraBoundsKill)return this.kill(),!1;if(this.checkWorldBounds)if(this._outOfBoundsFired&&this.game.world.bounds.intersects(this._bounds))this._outOfBoundsFired=!1,this.events.onEnterBounds$dispatch(this);else if(!this._outOfBoundsFired&&!this.game.world.bounds.intersects(this._bounds)&&(this._outOfBoundsFired=!0,this.events.onOutOfBounds$dispatch(this),this.outOfBoundsKill))return this.kill(),!1}return!0},n.Component.InWorld.prototype={checkWorldBounds:!1,outOfBoundsKill:!1,outOfCameraBoundsKill:!1,_outOfBoundsFired:!1,inWorld:{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.LifeSpan=function(){},s.Component.LifeSpan.preUpdate=function(){return this.pendingDestroy?(this.destroy(),!1):!(this.lifespan>0&&(this.lifespan-=this.game.time.physicsElapsedMS,this.lifespan<=0))||(this.kill(),!1)},s.Component.LifeSpan.prototype={alive:!0,lifespan:0,revive:function(t){return void 0===t&&(t=100),this.alive=!0,this.exists=!0,this.visible=!0,"function"==typeof this.setHealth&&this.setHealth(t),this.events&&this.events.onRevived$dispatch(this),this},kill:function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled$dispatch(this),this}}, +n.Component.LifeSpan=function(){},n.Component.LifeSpan.preUpdate=function(){return this.pendingDestroy?(this.destroy(),!1):!(this.lifespan>0&&(this.lifespan-=this.game.time.physicsElapsedMS,this.lifespan<=0))||(this.kill(),!1)},n.Component.LifeSpan.prototype={alive:!0,lifespan:0,revive:function(t){return void 0===t&&(t=100),this.alive=!0,this.exists=!0,this.visible=!0,"function"==typeof this.setHealth&&this.setHealth(t),this.events&&this.events.onRevived$dispatch(this),this},kill:function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled$dispatch(this),this}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.LoadTexture=function(){},s.Component.LoadTexture.prototype={customRender:!1,_frame:null,loadTexture:function(t,e,i){t===s.PENDING_ATLAS?(t=e,e=0):e=e||0,(i||void 0===i)&&this.animations&&this.animations.stop(),this.key=t,this.customRender=!1;var n=this.game.cache,r=!0,o=this.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR;if(s.RenderTexture&&t instanceof s.RenderTexture)this.key=t.key,this.setTexture(t);else if(s.BitmapData&&t instanceof s.BitmapData)this.customRender=!0,this.setTexture(t.texture),r=n.hasFrameData(t.key,s.Cache.BITMAPDATA)?!this.animations.loadFrameData(n.getFrameData(t.key,s.Cache.BITMAPDATA),e):!this.animations.loadFrameData(t.frameData,0);else if(s.Video&&t instanceof s.Video){this.customRender=!0;var a=t.texture.valid;this.setTexture(t.texture),this.setFrame(t.texture.frame.clone()),t.onChangeSource.add(this.resizeFrame,this),this.texture.valid=a}else if(s.Tilemap&&t instanceof s.TilemapLayer)this.setTexture(PIXI.Texture.fromCanvas(t.canvas));else if(t instanceof PIXI.Texture)o=t.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,this.setTexture(t);else{var h=n.getImage(t,!0);this.key=h.key,this.setTexture(new PIXI.Texture(h.base)),this.texture.baseTexture.skipRender="__default"===t,r=!this.animations.loadFrameData(h.frameData,e)}r&&(this._frame=s.Rectangle.clone(this.texture.frame)),o||(this.texture.baseTexture.scaleMode=1)},setFrame:function(t){this._frame=t,this.texture.frame.x=t.x,this.texture.frame.y=t.y,this.texture.frame.width=t.width,this.texture.frame.height=t.height,this.texture.crop.x=t.x,this.texture.crop.y=t.y,this.texture.crop.width=t.width,this.texture.crop.height=t.height,t.trimmed?(this.texture.trim?(this.texture.trim.x=t.spriteSourceSizeX,this.texture.trim.y=t.spriteSourceSizeY,this.texture.trim.width=t.sourceSizeW,this.texture.trim.height=t.sourceSizeH):this.texture.trim={x:t.spriteSourceSizeX,y:t.spriteSourceSizeY,width:t.sourceSizeW,height:t.sourceSizeH},this.texture.width=t.sourceSizeW,this.texture.height=t.sourceSizeH,this.texture.frame.width=t.sourceSizeW,this.texture.frame.height=t.sourceSizeH):!t.trimmed&&this.texture.trim&&(this.texture.trim=null),t.rotated&&(this.texture.rotated=!0),this.cropRect&&this.updateCrop(),this.texture.requiresReTint=!0,this.texture._updateUvs(),this.tilingTexture&&(this.refreshTexture=!0)},resizeFrame:function(t,e,i){this.texture.frame.resize(e,i),this.texture.setFrame(this.texture.frame)},resetFrame:function(){this._frame&&this.setFrame(this._frame)},frame:{get:function(){return this.animations.frame},set:function(t){this.animations.frame=t}},frameName:{get:function(){return this.animations.frameName},set:function(t){this.animations.frameName=t}}}, +n.Component.LoadTexture=function(){},n.Component.LoadTexture.prototype={customRender:!1,_frame:null,loadTexture:function(t,e,i){t===n.PENDING_ATLAS?(t=e,e=0):e=e||0,(i||void 0===i)&&this.animations&&this.animations.stop(),this.key=t,this.customRender=!1;var s=this.game.cache,r=!0,o=this.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR;if(n.RenderTexture&&t instanceof n.RenderTexture)this.key=t.key,this.setTexture(t);else if(n.BitmapData&&t instanceof n.BitmapData)this.customRender=!0,this.setTexture(t.texture),r=s.hasFrameData(t.key,n.Cache.BITMAPDATA)?!this.animations.loadFrameData(s.getFrameData(t.key,n.Cache.BITMAPDATA),e):!this.animations.loadFrameData(t.frameData,0);else if(n.Video&&t instanceof n.Video){this.customRender=!0;var a=t.texture.valid;this.setTexture(t.texture),this.setFrame(t.texture.frame.clone()),t.onChangeSource.add(this.resizeFrame,this),this.texture.valid=a}else if(n.Tilemap&&t instanceof n.TilemapLayer)this.setTexture(PIXI.Texture.fromCanvas(t.canvas));else if(t instanceof PIXI.Texture)o=t.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,this.setTexture(t);else{var h=s.getImage(t,!0);this.key=h.key,this.setTexture(new PIXI.Texture(h.base)),this.texture.baseTexture.skipRender="__default"===t,r=!this.animations.loadFrameData(h.frameData,e)}r&&(this._frame=n.Rectangle.clone(this.texture.frame)),o||(this.texture.baseTexture.scaleMode=1)},setFrame:function(t){this._frame=t,this.texture.frame.x=t.x,this.texture.frame.y=t.y,this.texture.frame.width=t.width,this.texture.frame.height=t.height,this.texture.crop.x=t.x,this.texture.crop.y=t.y,this.texture.crop.width=t.width,this.texture.crop.height=t.height,t.trimmed?(this.texture.trim?(this.texture.trim.x=t.spriteSourceSizeX,this.texture.trim.y=t.spriteSourceSizeY,this.texture.trim.width=t.sourceSizeW,this.texture.trim.height=t.sourceSizeH):this.texture.trim={x:t.spriteSourceSizeX,y:t.spriteSourceSizeY,width:t.sourceSizeW,height:t.sourceSizeH},this.texture.width=t.sourceSizeW,this.texture.height=t.sourceSizeH,this.texture.frame.width=t.sourceSizeW,this.texture.frame.height=t.sourceSizeH):!t.trimmed&&this.texture.trim&&(this.texture.trim=null),t.rotated&&(this.texture.rotated=!0),this.cropRect&&this.updateCrop(),this.texture.requiresReTint=!0,this.texture._updateUvs(),this.tilingTexture&&(this.refreshTexture=!0)},resizeFrame:function(t,e,i){this.texture.frame.resize(e,i),this.texture.setFrame(this.texture.frame)},resetFrame:function(){this._frame&&this.setFrame(this._frame)},frame:{get:function(){return this.animations.frame},set:function(t){this.animations.frame=t}},frameName:{get:function(){return this.animations.frameName},set:function(t){this.animations.frameName=t}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Overlap=function(){},s.Component.Overlap.prototype={overlap:function(t){return s.Rectangle.intersects(this.getBounds(),t.getBounds())}}, +n.Component.Overlap=function(){},n.Component.Overlap.prototype={overlap:function(t){return n.Rectangle.intersects(this.getBounds(),t.getBounds())}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.PhysicsBody=function(){},s.Component.PhysicsBody.preUpdate=function(){return this.pendingDestroy?(this.destroy(),!1):this.fresh&&this.exists?(this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,this.body&&this.body.preUpdate(),this.fresh=!1,this.preUpdateChildren(),!1):(this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,!(!this._exists||!this.parent.exists)||(this.renderOrderID=-1,!1))},s.Component.PhysicsBody.postUpdate=function(){this.exists&&this.body&&this.body.postUpdate()},s.Component.PhysicsBody.prototype={body:null,x:{get:function(){return this.position.x},set:function(t){this.position.x=t,this.body&&!this.body.dirty&&(this.body._reset=!0)}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t,this.body&&!this.body.dirty&&(this.body._reset=!0)}}}, +n.Component.PhysicsBody=function(){},n.Component.PhysicsBody.preUpdate=function(){return this.pendingDestroy?(this.destroy(),!1):this.fresh&&this.exists?(this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,this.body&&this.body.preUpdate(),this.fresh=!1,this.preUpdateChildren(),!1):(this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,!(!this._exists||!this.parent.exists)||(this.renderOrderID=-1,!1))},n.Component.PhysicsBody.postUpdate=function(){this.exists&&this.body&&this.body.postUpdate()},n.Component.PhysicsBody.prototype={body:null,x:{get:function(){return this.position.x},set:function(t){this.position.x=t,this.body&&!this.body.dirty&&(this.body._reset=!0)}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t,this.body&&!this.body.dirty&&(this.body._reset=!0)}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Reset=function(){},s.Component.Reset.prototype.reset=function(t,e,i){return void 0===i&&(i=1),this.world.set(t,e),this.position.set(t,e),this.fresh=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this.components.InWorld&&(this._outOfBoundsFired=!1),this.components.LifeSpan&&(this.alive=!0,this.health=i),this.components.PhysicsBody&&this.body&&this.body.reset(t,e,!1,!1),this}, +n.Component.Reset=function(){},n.Component.Reset.prototype.reset=function(t,e,i){return void 0===i&&(i=1),this.world.set(t,e),this.position.set(t,e),this.fresh=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this.components.InWorld&&(this._outOfBoundsFired=!1),this.components.LifeSpan&&(this.alive=!0,this.health=i),this.components.PhysicsBody&&this.body&&this.body.reset(t,e,!1,!1),this}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.ScaleMinMax=function(){},s.Component.ScaleMinMax.prototype={transformCallback:null,transformCallbackContext:this,scaleMin:null,scaleMax:null,checkTransform:function(t){this.scaleMin&&(t.athis.scaleMax.x&&(t.a=this.scaleMax.x),t.d>this.scaleMax.y&&(t.d=this.scaleMax.y))},setScaleMinMax:function(t,e,i,n){void 0===e?e=i=n=t:void 0===i&&(i=n=e,e=t),null===t?this.scaleMin=null:this.scaleMin?this.scaleMin.set(t,e):this.scaleMin=new s.Point(t,e),null===i?this.scaleMax=null:this.scaleMax?this.scaleMax.set(i,n):this.scaleMax=new s.Point(i,n),null===this.scaleMin?this.transformCallback=null:(this.transformCallback=this.checkTransform,this.transformCallbackContext=this)}}, +n.Component.ScaleMinMax=function(){},n.Component.ScaleMinMax.prototype={transformCallback:null,transformCallbackContext:this,scaleMin:null,scaleMax:null,checkTransform:function(t){this.scaleMin&&(t.athis.scaleMax.x&&(t.a=this.scaleMax.x),t.d>this.scaleMax.y&&(t.d=this.scaleMax.y))},setScaleMinMax:function(t,e,i,s){void 0===e?e=i=s=t:void 0===i&&(i=s=e,e=t),null===t?this.scaleMin=null:this.scaleMin?this.scaleMin.set(t,e):this.scaleMin=new n.Point(t,e),null===i?this.scaleMax=null:this.scaleMax?this.scaleMax.set(i,s):this.scaleMax=new n.Point(i,s),null===this.scaleMin?this.transformCallback=null:(this.transformCallback=this.checkTransform,this.transformCallbackContext=this)}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Component.Smoothed=function(){},s.Component.Smoothed.prototype={smoothed:{get:function(){return!this.texture.baseTexture.scaleMode},set:function(t){t?this.texture&&0!==this.texture.baseTexture.scaleMode&&(this.texture.baseTexture.scaleMode=0,this.texture.baseTexture.dirty()):this.texture&&1!==this.texture.baseTexture.scaleMode&&(this.texture.baseTexture.scaleMode=1,this.texture.baseTexture.dirty())}}}, +n.Component.Smoothed=function(){},n.Component.Smoothed.prototype={smoothed:{get:function(){return!this.texture.baseTexture.scaleMode},set:function(t){t?this.texture&&0!==this.texture.baseTexture.scaleMode&&(this.texture.baseTexture.scaleMode=0,this.texture.baseTexture.dirty()):this.texture&&1!==this.texture.baseTexture.scaleMode&&(this.texture.baseTexture.scaleMode=1,this.texture.baseTexture.dirty())}}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.GameObjectFactory=function(t){this.game=t,this.world=this.game.world},s.GameObjectFactory.prototype={existing:function(t){return this.world.add(t)},weapon:function(t,e,i,n,r){var o=this.game.plugins.add(s.Weapon);return r&&(o.bulletClass=r),o.createBullets(t,e,i,n),o},image:function(t,e,i,n,r){return void 0===r&&(r=this.world),r.add(new s.Image(this.game,t,e,i,n))},sprite:function(t,e,i,n,r){return void 0===r&&(r=this.world),r.add(new s.Sprite(this.game,t,e,i,n))},creature:function(t,e,i,n,r,o,a){void 0===r&&(r=this.world);var h=new s.Creature(this.game,t,e,i,n,o,a);return r.add(h),h},tween:function(t){return this.game.tweens.create(t)},group:function(t,e,i,n,r){return new s.Group(this.game,t,e,i,n,r)},physicsGroup:function(t,e,i,n){return new s.Group(this.game,e,i,n,!0,t)},spriteBatch:function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e="group"),void 0===i&&(i=!1),new s.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},sound:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},audioSprite:function(t){return this.game.sound.addSprite(t)},tileSprite:function(t,e,i,n,r,o,a){return void 0===a&&(a=this.world),a.add(new s.TileSprite(this.game,t,e,i,n,r,o))},rope:function(t,e,i,n,r,o){return void 0===o&&(o=this.world),o.add(new s.Rope(this.game,t,e,i,n,r))},text:function(t,e,i,n,r){return void 0===r&&(r=this.world),r.add(new s.Text(this.game,t,e,i,n))},button:function(t,e,i,n,r,o,a,h,l,u){return void 0===u&&(u=this.world),u.add(new s.Button(this.game,t,e,i,n,r,o,a,h,l))},graphics:function(t,e,i){return void 0===i&&(i=this.world),i.add(new s.Graphics(this.game,t,e))},emitter:function(t,e,i){return this.game.particles.add(new s.Particles.Arcade.Emitter(this.game,t,e,i))},retroFont:function(t,e,i,n,r,o,a,h,l){return new s.RetroFont(this.game,t,e,i,n,r,o,a,h,l)},bitmapText:function(t,e,i,n,r,o){return void 0===o&&(o=this.world),o.add(new s.BitmapText(this.game,t,e,i,n,r))},tilemap:function(t,e,i,n,r){return new s.Tilemap(this.game,t,e,i,n,r)},renderTexture:function(t,e,i,n){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===n&&(n=!1);var r=new s.RenderTexture(this.game,t,e,i);return n&&this.game.cache.addRenderTexture(i,r),r},video:function(t,e){return new s.Video(this.game,t,e)},bitmapData:function(t,e,i,n){void 0===n&&(n=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var r=new s.BitmapData(this.game,i,t,e);return n&&this.game.cache.addBitmapData(i,r),r},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new s.Filter[t](this.game)).init.apply(t,e),t},plugin:function(){return this.game.plugins.add.apply(this.game.plugins,arguments)}},s.GameObjectFactory.prototype.constructor=s.GameObjectFactory, +n.GameObjectFactory=function(t){this.game=t,this.world=this.game.world},n.GameObjectFactory.prototype={existing:function(t){return this.world.add(t)},weapon:function(t,e,i,s,r){var o=this.game.plugins.add(n.Weapon);return r&&(o.bulletClass=r),o.createBullets(t,e,i,s),o},image:function(t,e,i,s,r){return void 0===r&&(r=this.world),r.add(new n.Image(this.game,t,e,i,s))},sprite:function(t,e,i,s,r){return void 0===r&&(r=this.world),r.add(new n.Sprite(this.game,t,e,i,s))},creature:function(t,e,i,s,r,o,a){void 0===r&&(r=this.world);var h=new n.Creature(this.game,t,e,i,s,o,a);return r.add(h),h},tween:function(t){return this.game.tweens.create(t)},group:function(t,e,i,s,r){return new n.Group(this.game,t,e,i,s,r)},physicsGroup:function(t,e,i,s){return new n.Group(this.game,e,i,s,!0,t)},spriteBatch:function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e="group"),void 0===i&&(i=!1),new n.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},sound:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},audioSprite:function(t){return this.game.sound.addSprite(t)},tileSprite:function(t,e,i,s,r,o,a){return void 0===a&&(a=this.world),a.add(new n.TileSprite(this.game,t,e,i,s,r,o))},rope:function(t,e,i,s,r,o){return void 0===o&&(o=this.world),o.add(new n.Rope(this.game,t,e,i,s,r))},text:function(t,e,i,s,r){return void 0===r&&(r=this.world),r.add(new n.Text(this.game,t,e,i,s))},button:function(t,e,i,s,r,o,a,h,l,c){return void 0===c&&(c=this.world),c.add(new n.Button(this.game,t,e,i,s,r,o,a,h,l))},graphics:function(t,e,i){return void 0===i&&(i=this.world),i.add(new n.Graphics(this.game,t,e))},emitter:function(t,e,i){return this.game.particles.add(new n.Particles.Arcade.Emitter(this.game,t,e,i))},retroFont:function(t,e,i,s,r,o,a,h,l){return new n.RetroFont(this.game,t,e,i,s,r,o,a,h,l)},bitmapText:function(t,e,i,s,r,o){return void 0===o&&(o=this.world),o.add(new n.BitmapText(this.game,t,e,i,s,r))},tilemap:function(t,e,i,s,r){return new n.Tilemap(this.game,t,e,i,s,r)},renderTexture:function(t,e,i,s){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===s&&(s=!1);var r=new n.RenderTexture(this.game,t,e,i);return s&&this.game.cache.addRenderTexture(i,r),r},video:function(t,e){return new n.Video(this.game,t,e)},bitmapData:function(t,e,i,s){void 0===s&&(s=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var r=new n.BitmapData(this.game,i,t,e);return s&&this.game.cache.addBitmapData(i,r),r},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new n.Filter[t](this.game)).init.apply(t,e),t},plugin:function(){return this.game.plugins.add.apply(this.game.plugins,arguments)}},n.GameObjectFactory.prototype.constructor=n.GameObjectFactory, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.GameObjectCreator=function(t){this.game=t,this.world=this.game.world},s.GameObjectCreator.prototype={image:function(t,e,i,n){return new s.Image(this.game,t,e,i,n)},sprite:function(t,e,i,n){return new s.Sprite(this.game,t,e,i,n)},tween:function(t){return new s.Tween(t,this.game,this.game.tweens)},group:function(t,e,i,n,r){return new s.Group(this.game,t||null,e,i,n,r)},spriteBatch:function(t,e,i){return void 0===e&&(e="group"),void 0===i&&(i=!1),new s.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},audioSprite:function(t){return this.game.sound.addSprite(t)},sound:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},tileSprite:function(t,e,i,n,r,o){return new s.TileSprite(this.game,t,e,i,n,r,o)},rope:function(t,e,i,n,r){return new s.Rope(this.game,t,e,i,n,r)},text:function(t,e,i,n){return new s.Text(this.game,t,e,i,n)},button:function(t,e,i,n,r,o,a,h,l){return new s.Button(this.game,t,e,i,n,r,o,a,h,l)},graphics:function(t,e){return new s.Graphics(this.game,t,e)},emitter:function(t,e,i){return new s.Particles.Arcade.Emitter(this.game,t,e,i)},retroFont:function(t,e,i,n,r,o,a,h,l){return new s.RetroFont(this.game,t,e,i,n,r,o,a,h,l)},bitmapText:function(t,e,i,n,r,o){return new s.BitmapText(this.game,t,e,i,n,r,o)},tilemap:function(t,e,i,n,r){return new s.Tilemap(this.game,t,e,i,n,r)},renderTexture:function(t,e,i,n){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===n&&(n=!1);var r=new s.RenderTexture(this.game,t,e,i);return n&&this.game.cache.addRenderTexture(i,r),r},bitmapData:function(t,e,i,n){void 0===n&&(n=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var r=new s.BitmapData(this.game,i,t,e);return n&&this.game.cache.addBitmapData(i,r),r},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new s.Filter[t](this.game)).init.apply(t,e),t}},s.GameObjectCreator.prototype.constructor=s.GameObjectCreator, +n.GameObjectCreator=function(t){this.game=t,this.world=this.game.world},n.GameObjectCreator.prototype={image:function(t,e,i,s){return new n.Image(this.game,t,e,i,s)},sprite:function(t,e,i,s){return new n.Sprite(this.game,t,e,i,s)},tween:function(t){return new n.Tween(t,this.game,this.game.tweens)},group:function(t,e,i,s,r){return new n.Group(this.game,t||null,e,i,s,r)},spriteBatch:function(t,e,i){return void 0===e&&(e="group"),void 0===i&&(i=!1),new n.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},audioSprite:function(t){return this.game.sound.addSprite(t)},sound:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},tileSprite:function(t,e,i,s,r,o){return new n.TileSprite(this.game,t,e,i,s,r,o)},rope:function(t,e,i,s,r){return new n.Rope(this.game,t,e,i,s,r)},text:function(t,e,i,s){return new n.Text(this.game,t,e,i,s)},button:function(t,e,i,s,r,o,a,h,l){return new n.Button(this.game,t,e,i,s,r,o,a,h,l)},graphics:function(t,e){return new n.Graphics(this.game,t,e)},emitter:function(t,e,i){return new n.Particles.Arcade.Emitter(this.game,t,e,i)},retroFont:function(t,e,i,s,r,o,a,h,l){return new n.RetroFont(this.game,t,e,i,s,r,o,a,h,l)},bitmapText:function(t,e,i,s,r,o){return new n.BitmapText(this.game,t,e,i,s,r,o)},tilemap:function(t,e,i,s,r){return new n.Tilemap(this.game,t,e,i,s,r)},renderTexture:function(t,e,i,s){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===s&&(s=!1);var r=new n.RenderTexture(this.game,t,e,i);return s&&this.game.cache.addRenderTexture(i,r),r},bitmapData:function(t,e,i,s){void 0===s&&(s=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var r=new n.BitmapData(this.game,i,t,e);return s&&this.game.cache.addBitmapData(i,r),r},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new n.Filter[t](this.game)).init.apply(t,e),t}},n.GameObjectCreator.prototype.constructor=n.GameObjectCreator, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Sprite=function(t,e,i,n,r){e=e||0,i=i||0,n=n||null,r=r||null,this.type=s.SPRITE,this.physicsType=s.SPRITE,PIXI.Sprite.call(this,s.Cache.DEFAULT),s.Component.Core.init.call(this,t,e,i,n,r)},s.Sprite.prototype=Object.create(PIXI.Sprite.prototype),s.Sprite.prototype.constructor=s.Sprite,s.Component.Core.install.call(s.Sprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Delta","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","ScaleMinMax","Smoothed"]),s.Sprite.prototype.preUpdatePhysics=s.Component.PhysicsBody.preUpdate,s.Sprite.prototype.preUpdateLifeSpan=s.Component.LifeSpan.preUpdate,s.Sprite.prototype.preUpdateInWorld=s.Component.InWorld.preUpdate,s.Sprite.prototype.preUpdateCore=s.Component.Core.preUpdate,s.Sprite.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()}, +n.Sprite=function(t,e,i,s,r){e=e||0,i=i||0,s=s||null,r=r||null,this.type=n.SPRITE,this.physicsType=n.SPRITE,PIXI.Sprite.call(this,n.Cache.DEFAULT),n.Component.Core.init.call(this,t,e,i,s,r)},n.Sprite.prototype=Object.create(PIXI.Sprite.prototype),n.Sprite.prototype.constructor=n.Sprite,n.Component.Core.install.call(n.Sprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Delta","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","ScaleMinMax","Smoothed"]),n.Sprite.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.Sprite.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Sprite.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Sprite.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Sprite.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Image=function(t,e,i,n,r){e=e||0,i=i||0,n=n||null,r=r||null,this.type=s.IMAGE,PIXI.Sprite.call(this,s.Cache.DEFAULT),s.Component.Core.init.call(this,t,e,i,n,r)},s.Image.prototype=Object.create(PIXI.Sprite.prototype),s.Image.prototype.constructor=s.Image,s.Component.Core.install.call(s.Image.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Destroy","FixedToCamera","InputEnabled","LifeSpan","LoadTexture","Overlap","Reset","ScaleMinMax","Smoothed"]),s.Image.prototype.preUpdateLifeSpan=s.Component.LifeSpan.preUpdate,s.Image.prototype.preUpdateInWorld=s.Component.InWorld.preUpdate,s.Image.prototype.preUpdateCore=s.Component.Core.preUpdate,s.Image.prototype.preUpdate=function(){return!(!this.preUpdateInWorld()||!this.preUpdateLifeSpan())&&this.preUpdateCore()}, +n.Image=function(t,e,i,s,r){e=e||0,i=i||0,s=s||null,r=r||null,this.type=n.IMAGE,PIXI.Sprite.call(this,n.Cache.DEFAULT),n.Component.Core.init.call(this,t,e,i,s,r)},n.Image.prototype=Object.create(PIXI.Sprite.prototype),n.Image.prototype.constructor=n.Image,n.Component.Core.install.call(n.Image.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Destroy","FixedToCamera","InputEnabled","LifeSpan","LoadTexture","Overlap","Reset","ScaleMinMax","Smoothed"]),n.Image.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Image.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Image.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Image.prototype.preUpdate=function(){return!(!this.preUpdateInWorld()||!this.preUpdateLifeSpan())&&this.preUpdateCore()}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Button=function(t,e,i,n,r,o,a,h,l,u){e=e||0,i=i||0,n=n||null,r=r||null,o=o||this,s.Image.call(this,t,e,i,n,h),this.type=s.BUTTON,this.physicsType=s.SPRITE,this._onOverFrame=null,this._onOutFrame=null,this._onDownFrame=null,this._onUpFrame=null,this.onOverSound=null,this.onOutSound=null,this.onDownSound=null,this.onUpSound=null,this.onOverSoundMarker="",this.onOutSoundMarker="",this.onDownSoundMarker="",this.onUpSoundMarker="",this.onInputOver=new s.Signal,this.onInputOut=new s.Signal,this.onInputDown=new s.Signal,this.onInputUp=new s.Signal,this.onOverMouseOnly=!0,this.justReleasedPreventsOver=s.PointerMode.CONTACT,this.freezeFrames=!1,this.forceOut=!1,this.inputEnabled=!0,this.input.start(0,!0),this.input.useHandCursor=!0,this.setFrames(a,h,l,u),null!==r&&this.onInputUp.add(r,o),this.events.onInputOver.add(this.onInputOverHandler,this),this.events.onInputOut.add(this.onInputOutHandler,this),this.events.onInputDown.add(this.onInputDownHandler,this),this.events.onInputUp.add(this.onInputUpHandler,this)},s.Button.prototype=Object.create(s.Image.prototype),s.Button.prototype.constructor=s.Button;return s.Button.prototype.clearFrames=function(){this.setFrames(null,null,null,null)},s.Button.prototype.setStateFrame=function(t,e,i){var n="_on"+t+"Frame";null!==e?(this[n]=e,i&&this.changeStateFrame(t)):this[n]=null},s.Button.prototype.changeStateFrame=function(t){if(this.freezeFrames)return!1;var e=this["_on"+t+"Frame"];return"string"==typeof e?(this.frameName=e,!0):"number"==typeof e&&(this.frame=e,!0)},s.Button.prototype.setFrames=function(t,e,i,n){this.setStateFrame("Over",t,this.input.pointerOver()),this.setStateFrame("Out",e,!this.input.pointerOver()),this.setStateFrame("Down",i,this.input.pointerDown()),this.setStateFrame("Up",n,this.input.pointerUp())},s.Button.prototype.setStateSound=function(t,e,i){var n="on"+t+"Sound",r="on"+t+"SoundMarker";e instanceof s.Sound||e instanceof s.AudioSprite?(this[n]=e,this[r]="string"==typeof i?i:""):(this[n]=null,this[r]="")},s.Button.prototype.playStateSound=function(t){var e=this["on"+t+"Sound"];if(e){var i=this["on"+t+"SoundMarker"];return e.play(i),!0}return!1},s.Button.prototype.setSounds=function(t,e,i,n,s,r,o,a){this.setStateSound("Over",t,e),this.setStateSound("Out",s,r),this.setStateSound("Down",i,n),this.setStateSound("Up",o,a)},s.Button.prototype.setOverSound=function(t,e){this.setStateSound("Over",t,e)},s.Button.prototype.setOutSound=function(t,e){this.setStateSound("Out",t,e)},s.Button.prototype.setDownSound=function(t,e){this.setStateSound("Down",t,e)},s.Button.prototype.setUpSound=function(t,e){this.setStateSound("Up",t,e)},s.Button.prototype.onInputOverHandler=function(t,e){e.justReleased()&&(this.justReleasedPreventsOver&e.pointerMode)===e.pointerMode||(this.changeStateFrame("Over"),this.onOverMouseOnly&&!e.isMouse||(this.playStateSound("Over"),this.onInputOver&&this.onInputOver.dispatch(this,e)))},s.Button.prototype.onInputOutHandler=function(t,e){this.changeStateFrame("Out"),this.playStateSound("Out"),this.onInputOut&&this.onInputOut.dispatch(this,e)},s.Button.prototype.onInputDownHandler=function(t,e){this.changeStateFrame("Down"),this.playStateSound("Down"),this.onInputDown&&this.onInputDown.dispatch(this,e)},s.Button.prototype.onInputUpHandler=function(t,e,i){(this.playStateSound("Up"),this.onInputUp&&this.onInputUp.dispatch(this,e,i),this.freezeFrames)||(!0===this.forceOut||(this.forceOut&e.pointerMode)===e.pointerMode?this.changeStateFrame("Out"):this.changeStateFrame("Up")||(i?this.changeStateFrame("Over"):this.changeStateFrame("Out")))}, +n.Button=function(t,e,i,s,r,o,a,h,l,c){e=e||0,i=i||0,s=s||null,r=r||null,o=o||this,n.Image.call(this,t,e,i,s,h),this.type=n.BUTTON,this.physicsType=n.SPRITE,this._onOverFrame=null,this._onOutFrame=null,this._onDownFrame=null,this._onUpFrame=null,this.onOverSound=null,this.onOutSound=null,this.onDownSound=null,this.onUpSound=null,this.onOverSoundMarker="",this.onOutSoundMarker="",this.onDownSoundMarker="",this.onUpSoundMarker="",this.onInputOver=new n.Signal,this.onInputOut=new n.Signal,this.onInputDown=new n.Signal,this.onInputUp=new n.Signal,this.onOverMouseOnly=!0,this.justReleasedPreventsOver=n.PointerMode.CONTACT,this.freezeFrames=!1,this.forceOut=!1,this.inputEnabled=!0,this.input.start(0,!0),this.input.useHandCursor=!0,this.setFrames(a,h,l,c),null!==r&&this.onInputUp.add(r,o),this.events.onInputOver.add(this.onInputOverHandler,this),this.events.onInputOut.add(this.onInputOutHandler,this),this.events.onInputDown.add(this.onInputDownHandler,this),this.events.onInputUp.add(this.onInputUpHandler,this)},n.Button.prototype=Object.create(n.Image.prototype),n.Button.prototype.constructor=n.Button;var a="Over",h="Out",l="Down",c="Up";return n.Button.prototype.clearFrames=function(){this.setFrames(null,null,null,null)},n.Button.prototype.setStateFrame=function(t,e,i){var n="_on"+t+"Frame";null!==e?(this[n]=e,i&&this.changeStateFrame(t)):this[n]=null},n.Button.prototype.changeStateFrame=function(t){if(this.freezeFrames)return!1;var e=this["_on"+t+"Frame"];return"string"==typeof e?(this.frameName=e,!0):"number"==typeof e&&(this.frame=e,!0)},n.Button.prototype.setFrames=function(t,e,i,n){this.setStateFrame(a,t,this.input.pointerOver()),this.setStateFrame(h,e,!this.input.pointerOver()),this.setStateFrame(l,i,this.input.pointerDown()),this.setStateFrame(c,n,this.input.pointerUp())},n.Button.prototype.setStateSound=function(t,e,i){var s="on"+t+"Sound",r="on"+t+"SoundMarker";e instanceof n.Sound||e instanceof n.AudioSprite?(this[s]=e,this[r]="string"==typeof i?i:""):(this[s]=null,this[r]="")},n.Button.prototype.playStateSound=function(t){var e=this["on"+t+"Sound"];if(e){var i=this["on"+t+"SoundMarker"];return e.play(i),!0}return!1},n.Button.prototype.setSounds=function(t,e,i,n,s,r,o,u){this.setStateSound(a,t,e),this.setStateSound(h,s,r),this.setStateSound(l,i,n),this.setStateSound(c,o,u)},n.Button.prototype.setOverSound=function(t,e){this.setStateSound(a,t,e)},n.Button.prototype.setOutSound=function(t,e){this.setStateSound(h,t,e)},n.Button.prototype.setDownSound=function(t,e){this.setStateSound(l,t,e)},n.Button.prototype.setUpSound=function(t,e){this.setStateSound(c,t,e)},n.Button.prototype.onInputOverHandler=function(t,e){e.justReleased()&&(this.justReleasedPreventsOver&e.pointerMode)===e.pointerMode||(this.changeStateFrame(a),this.onOverMouseOnly&&!e.isMouse||(this.playStateSound(a),this.onInputOver&&this.onInputOver.dispatch(this,e)))},n.Button.prototype.onInputOutHandler=function(t,e){this.changeStateFrame(h),this.playStateSound(h),this.onInputOut&&this.onInputOut.dispatch(this,e)},n.Button.prototype.onInputDownHandler=function(t,e){this.changeStateFrame(l),this.playStateSound(l),this.onInputDown&&this.onInputDown.dispatch(this,e)},n.Button.prototype.onInputUpHandler=function(t,e,i){(this.playStateSound(c),this.onInputUp&&this.onInputUp.dispatch(this,e,i),this.freezeFrames)||(!0===this.forceOut||(this.forceOut&e.pointerMode)===e.pointerMode?this.changeStateFrame(h):this.changeStateFrame(c)||(i?this.changeStateFrame(a):this.changeStateFrame(h)))}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.SpriteBatch=function(t,e,i,n){null==e&&(e=t.world),s.Group.call(this,t,e,i,n),this.type=s.SPRITEBATCH,this.fastSpriteBatch=null,this.ready=!1},s.SpriteBatch.prototype=Object.create(s.Group.prototype),s.SpriteBatch.prototype.constructor=s.SpriteBatch,s.SpriteBatch.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||!this.children.length||(this.ready||(this.fastSpriteBatch=new PIXI.WebGLFastSpriteBatch(t.gl),this.ready=!0),this.fastSpriteBatch.gl!==t.gl&&this.fastSpriteBatch.setContext(t.gl),t.spriteBatch.stop(),t.shaderManager.setShader(t.shaderManager.fastShader),this.fastSpriteBatch.begin(this,t),this.fastSpriteBatch.render(this),t.spriteBatch.start())},s.SpriteBatch.prototype._renderCanvas=function(t){if(this.visible&&!(this.alpha<=0)&&this.children.length){var e=t.context;e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var i=this.worldTransform,n=!0,s=0;s * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.BitmapData=function(t,e,i,n,r){void 0!==i&&0!==i||(i=256),void 0!==n&&0!==n||(n=256),void 0===r&&(r=!1),this.game=t,this.key=e,this.width=i,this.height=n,this.canvas=s.Canvas.create(this,i,n,null,r),this.context=this.canvas.getContext("2d",{alpha:!0}),this.ctx=this.context,this.smoothProperty=t.renderType===s.CANVAS?t.renderer.renderSession.smoothProperty:s.Canvas.getSmoothingPrefix(this.context),this.imageData=this.context.getImageData(0,0,i,n),this.data=null,this.imageData&&(this.data=this.imageData.data),this.pixels=null,this.data&&(this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data),this.baseTexture=new PIXI.BaseTexture(this.canvas,null,this.game.resolution),this.texture=new PIXI.Texture(this.baseTexture),this.frameData=new s.FrameData,this.textureFrame=this.frameData.addFrame(new s.Frame(0,0,0,i,n,"bitmapData")),this.texture.frame=this.textureFrame,this.type=s.BITMAPDATA,this.disableTextureUpload=!1,this.dirty=!1,this.cls=this.clear,this._image=null,this._pos=new s.Point,this._size=new s.Point,this._scale=new s.Point,this._rotate=0,this._alpha={prev:1,current:1},this._anchor=new s.Point,this._tempR=0,this._tempG=0,this._tempB=0,this._circle=new s.Circle,this._swapCanvas=void 0},s.BitmapData.prototype={move:function(t,e,i){return 0!==t&&this.moveH(t,i),0!==e&&this.moveV(e,i),this},moveH:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=s.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),n=this.height,r=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var o=this.width-t;e&&i.drawImage(r,0,0,t,n,o,0,t,n),i.drawImage(r,t,0,o,n,0,0,o,n)}else{o=this.width-t;e&&i.drawImage(r,o,0,t,n,0,0,t,n),i.drawImage(r,0,0,o,n,t,0,o,n)}return this.clear(),this.copy(this._swapCanvas)},moveV:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=s.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),n=this.width,r=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var o=this.height-t;e&&i.drawImage(r,0,0,n,t,0,o,n,t),i.drawImage(r,0,t,n,o,0,0,n,o)}else{o=this.height-t;e&&i.drawImage(r,0,o,n,t,0,0,n,t),i.drawImage(r,0,0,n,o,0,t,n,o)}return this.clear(),this.copy(this._swapCanvas)},add:function(t){if(Array.isArray(t))for(var e=0;e=0&&t<=this.width&&e>=0&&e<=this.height&&(s.Device.LITTLE_ENDIAN?this.pixels[e*this.width+t]=o<<24|r<<16|n<<8|i:this.pixels[e*this.width+t]=i<<24|n<<16|r<<8|o,a&&(this.context.putImageData(this.imageData,0,0),this.dirty=!0)),this},setPixel:function(t,e,i,n,s,r){return this.setPixel32(t,e,i,n,s,255,r)},getPixel:function(t,e,i){i||(i=s.Color.createColor());var n=~~(t+e*this.width);return n*=4,i.r=this.data[n],i.g=this.data[++n],i.b=this.data[++n],i.a=this.data[++n],i},getPixel32:function(t,e){if(t>=0&&t<=this.width&&e>=0&&e<=this.height)return this.pixels[e*this.width+t]},getPixelRGB:function(t,e,i,n,r){return s.Color.unpackPixel(this.getPixel32(t,e),i,n,r)},getPixels:function(t){return this.context.getImageData(t.x,t.y,t.width,t.height)},getFirstPixel:function(t){void 0===t&&(t=0);var e=s.Color.createColor(),i=0,n=0,r=1,o=!1;1===t?(r=-1,n=this.height):3===t&&(r=-1,i=this.width);do{s.Color.unpackPixel(this.getPixel32(i,n),e),0===t||1===t?++i===this.width&&(i=0,((n+=r)>=this.height||n<=0)&&(o=!0)):2!==t&&3!==t||++n===this.height&&(n=0,((i+=r)>=this.width||i<=0)&&(o=!0))}while(0===e.a&&!o);return e.x=i,e.y=n,e},getBounds:function(t){return void 0===t&&(t=new s.Rectangle),t.x=this.getFirstPixel(2).x,t.x===this.width?t.setTo(0,0,0,0):(t.y=this.getFirstPixel(0).y,t.width=this.getFirstPixel(3).x-t.x+1,t.height=this.getFirstPixel(1).y-t.y+1,t)},addToWorld:function(t,e,i,n,s,r){s=s||1,r=r||1;var o=this.game.add.image(t,e,this);return o.anchor.set(i,n),o.scale.set(s,r),o},copy:function(t,e,i,n,r,o,a,h,l,u,c,d,p,f,g,m,y){if(null==t&&(t=this),t instanceof s.RenderTexture&&(t=t.getCanvas()),this._image=t,t instanceof s.Sprite||t instanceof s.Image||t instanceof s.Text||t instanceof PIXI.Sprite)this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),this._scale.set(t.scale.x,t.scale.y),this._anchor.set(t.anchor.x,t.anchor.y),this._rotate=t.rotation,this._alpha.current=t.alpha,t.texture instanceof s.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source,null==o&&(o=t.x),null==a&&(a=t.y),t.texture.trim&&(o+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,a+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0));else{if(this._pos.set(0),this._scale.set(1),this._anchor.set(0),this._rotate=0,this._alpha.current=1,t instanceof s.BitmapData)this._image=t.canvas;else if("string"==typeof t){if(null===(t=this.game.cache.getImage(t)))return this;this._image=t}this._size.set(this._image.width,this._image.height)}if(null==e&&(e=0),null==i&&(i=0),n&&(this._size.x=n),r&&(this._size.y=r),null==o&&(o=e),null==a&&(a=i),null==h&&(h=this._size.x),null==l&&(l=this._size.y),"number"==typeof u&&(this._rotate=u),"number"==typeof c&&(this._anchor.x=c),"number"==typeof d&&(this._anchor.y=d),"number"==typeof p&&(this._scale.x=p),"number"==typeof f&&(this._scale.y=f),"number"==typeof g&&(this._alpha.current=g),void 0===m&&(m=null),void 0===y&&(y=!1),this._alpha.current<=0||0===this._scale.x||0===this._scale.y||0===this._size.x||0===this._size.y)return this;var v=this.context;return this._alpha.prev=v.globalAlpha,v.save(),v.globalAlpha=this._alpha.current,m&&(this.op=m),y&&(o|=0,a|=0),v.translate(o,a),v.scale(this._scale.x,this._scale.y),v.rotate(this._rotate),v.drawImage(this._image,this._pos.x+e,this._pos.y+i,this._size.x,this._size.y,-h*this._anchor.x,-l*this._anchor.y,h,l),v.restore(),v.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyTransform:function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=!1),!t.hasOwnProperty("worldTransform")||!t.worldVisible||0===t.worldAlpha)return this;var n=t.worldTransform;if(this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),0===n.a||0===n.d||0===this._size.x||0===this._size.y)return this;t.texture instanceof s.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source;var r=n.tx,o=n.ty;t.texture.trim&&(r+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,o+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0)),i&&(r|=0,o|=0);var a=this.context;return this._alpha.prev=a.globalAlpha,a.save(),a.globalAlpha=this._alpha.current,e&&(this.op=e),a[this.smoothProperty]=t.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,a.setTransform(n.a,n.b,n.c,n.d,r,o),a.drawImage(this._image,this._pos.x,this._pos.y,this._size.x,this._size.y,-this._size.x*t.anchor.x,-this._size.y*t.anchor.y,this._size.x,this._size.y),a.restore(),a.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyRect:function(t,e,i,n,s,r,o){return this.copy(t,e.x,e.y,e.width,e.height,i,n,e.width,e.height,0,0,0,1,1,s,r,o)},draw:function(t,e,i,n,s,r,o){return this.copy(t,null,null,null,null,e,i,n,s,null,null,null,null,null,null,r,o)},drawGroup:function(t,e,i){return t.total>0&&t.forEachExists(this.drawGroupProxy,this,e,i),this},drawGroupProxy:function(t,e,i){if(t.hasOwnProperty("texture")&&this.copyTransform(t,e,i),t.type===s.GROUP&&t.exists)this.drawGroup(t,e,i);else if(t.hasOwnProperty("children")&&t.children.length>0)for(var n=0;ne.width&&(n=e.width);var r=this.context;return r.fillStyle=r.createPattern(e,i),this._circle=new s.Circle(t.start.x,t.start.y,e.height),this._circle.circumferencePoint(t.angle-1.5707963267948966,!1,this._pos),r.save(),r.translate(this._pos.x,this._pos.y),r.rotate(t.angle),r.fillRect(0,0,n,e.height),r.restore(),this.dirty=!0,this}},render:function(){return!this.disableTextureUpload&&this.dirty&&(this.baseTexture.dirty(),this.dirty=!1),this},destroy:function(){this.frameData.destroy(),this.texture.destroy(!0),s.CanvasPool.remove(this)},blendReset:function(){return this.op="source-over",this},blendSourceOver:function(){return this.op="source-over",this},blendSourceIn:function(){return this.op="source-in",this},blendSourceOut:function(){return this.op="source-out",this},blendSourceAtop:function(){return this.op="source-atop",this},blendDestinationOver:function(){return this.op="destination-over",this},blendDestinationIn:function(){return this.op="destination-in",this},blendDestinationOut:function(){return this.op="destination-out",this},blendDestinationAtop:function(){return this.op="destination-atop",this},blendXor:function(){return this.op="xor",this},blendAdd:function(){return this.op="lighter",this},blendMultiply:function(){return this.op="multiply",this},blendScreen:function(){return this.op="screen",this},blendOverlay:function(){return this.op="overlay",this},blendDarken:function(){return this.op="darken",this},blendLighten:function(){return this.op="lighten",this},blendColorDodge:function(){return this.op="color-dodge",this},blendColorBurn:function(){return this.op="color-burn",this},blendHardLight:function(){return this.op="hard-light",this},blendSoftLight:function(){return this.op="soft-light",this},blendDifference:function(){return this.op="difference",this},blendExclusion:function(){return this.op="exclusion",this},blendHue:function(){return this.op="hue",this},blendSaturation:function(){return this.op="saturation",this},blendColor:function(){return this.op="color",this},blendLuminosity:function(){return this.op="luminosity",this},copyBitmapData:function(t,e,i){t.update();for(var n,s=0;s80*i){n=o=t[0],r=a=t[1];for(var g=i;go&&(o=h),l>a&&(a=l);u=Math.max(o-n,a-r)}return s.EarCut.earcutLinked(p,f,i,n,r,u),f},s.EarCut.linkedList=function(t,e,i,n,r){var o,a,h,l=0;for(o=e,a=i-n;o0)for(o=e;o=e;o-=n)h=s.EarCut.insertNode(o,t[o],t[o+1],h);return h},s.EarCut.filterPoints=function(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!s.EarCut.equals(n,n.next)&&0!==s.EarCut.area(n.prev,n,n.next))n=n.next;else{if(s.EarCut.removeNode(n),(n=e=n.prev)===n.next)return null;i=!0}}while(i||n!==e);return e},s.EarCut.earcutLinked=function(t,e,i,n,r,o,a){if(t){!a&&o&&s.EarCut.indexCurve(t,n,r,o);for(var h,l,u=t;t.prev!==t.next;)if(h=t.prev,l=t.next,o?s.EarCut.isEarHashed(t,n,r,o):s.EarCut.isEar(t))e.push(h.i/i),e.push(t.i/i),e.push(l.i/i),s.EarCut.removeNode(t),t=l.next,u=l.next;else if((t=l)===u){a?1===a?(t=s.EarCut.cureLocalIntersections(t,e,i),s.EarCut.earcutLinked(t,e,i,n,r,o,2)):2===a&&s.EarCut.splitEarcut(t,e,i,n,r,o):s.EarCut.earcutLinked(s.EarCut.filterPoints(t),e,i,n,r,o,1);break}}},s.EarCut.isEar=function(t){var e=t.prev,i=t,n=t.next;if(s.EarCut.area(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(s.EarCut.pointInTriangle(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&s.EarCut.area(r.prev,r,r.next)>=0)return!1;r=r.next}return!0},s.EarCut.isEarHashed=function(t,e,i,n){var r=t.prev,o=t,a=t.next;if(s.EarCut.area(r,o,a)>=0)return!1;for(var h=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,c=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,d=s.EarCut.zOrder(h,l,e,i,n),p=s.EarCut.zOrder(u,c,e,i,n),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&s.EarCut.pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&s.EarCut.area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=d;){if(f!==t.prev&&f!==t.next&&s.EarCut.pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&s.EarCut.area(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0},s.EarCut.cureLocalIntersections=function(t,e,i){var n=t;do{var r=n.prev,o=n.next.next;s.EarCut.intersects(r,n,n.next,o)&&s.EarCut.locallyInside(r,o)&&s.EarCut.locallyInside(o,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(o.i/i),s.EarCut.removeNode(n),s.EarCut.removeNode(n.next),n=t=o),n=n.next}while(n!==t);return n},s.EarCut.splitEarcut=function(t,e,i,n,r,o){var a=t;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&s.EarCut.isValidDiagonal(a,h)){var l=s.EarCut.splitPolygon(a,h);return a=s.EarCut.filterPoints(a,a.next),l=s.EarCut.filterPoints(l,l.next),s.EarCut.earcutLinked(a,e,i,n,r,o),void s.EarCut.earcutLinked(l,e,i,n,r,o)}h=h.next}a=a.next}while(a!==t)},s.EarCut.eliminateHoles=function(t,e,i,n){var r,o,a,h,l,u=[];for(r=0,o=e.length;r=n.next.y){var h=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);h<=r&&h>a&&(a=h,i=n.x=n.x&&n.x>=i.x&&s.EarCut.pointInTriangle(oi.x)&&s.EarCut.locallyInside(n,t)&&(i=n,c=l),n=n.next;return i},s.EarCut.indexCurve=function(t,e,i,n){var r=t;do{null===r.z&&(r.z=s.EarCut.zOrder(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,s.EarCut.sortLinked(r)},s.EarCut.sortLinked=function(t){var e,i,n,s,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0===a?(s=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--):(s=i,i=i.nextZ,a--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,l*=2}while(o>1);return t},s.EarCut.zOrder=function(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1},s.EarCut.getLeftmost=function(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0},s.EarCut.isValidDiagonal=function(t,e){return s.EarCut.equals(t,e)||t.next.i!==e.i&&t.prev.i!==e.i&&!s.EarCut.intersectsPolygon(t,e)&&s.EarCut.locallyInside(t,e)&&s.EarCut.locallyInside(e,t)&&s.EarCut.middleInside(t,e)},s.EarCut.area=function(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)},s.EarCut.equals=function(t,e){return t.x===e.x&&t.y===e.y},s.EarCut.intersects=function(t,e,i,n){return s.EarCut.area(t,e,i)>0!=s.EarCut.area(t,e,n)>0&&s.EarCut.area(i,n,t)>0!=s.EarCut.area(i,n,e)>0},s.EarCut.intersectsPolygon=function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&s.EarCut.intersects(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1},s.EarCut.locallyInside=function(t,e){return s.EarCut.area(t.prev,t,t.next)<0?s.EarCut.area(t,e,t.next)>=0&&s.EarCut.area(t,t.prev,e)>=0:s.EarCut.area(t,e,t.prev)<0||s.EarCut.area(t,t.next,e)<0},s.EarCut.middleInside=function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n},s.EarCut.splitPolygon=function(t,e){var i=new s.EarCut.Node(t.i,t.x,t.y),n=new s.EarCut.Node(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,o.next=n,n.prev=o,n},s.EarCut.insertNode=function(t,e,i,n){var r=new s.EarCut.Node(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r},s.EarCut.removeNode=function(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)},s.EarCut.Node=function(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1},PIXI.WebGLGraphics=function(){},PIXI.WebGLGraphics.stencilBufferLimit=6,PIXI.WebGLGraphics.renderGraphics=function(t,e){var i,n=e.gl,r=e.projection,o=e.offset,a=e.shaderManager.primitiveShader;t.dirty&&PIXI.WebGLGraphics.updateGraphics(t,n);var h=t._webGL[n.id];if(h)for(var l=0;l=PIXI.WebGLGraphics.stencilBufferLimit)if(a.points.length<2*PIXI.WebGLGraphics.stencilBufferLimit)n=PIXI.WebGLGraphics.switchMode(r,0),PIXI.WebGLGraphics.buildPoly(a,n)||(n=PIXI.WebGLGraphics.switchMode(r,1),PIXI.WebGLGraphics.buildComplexPoly(a,n));else n=PIXI.WebGLGraphics.switchMode(r,1),PIXI.WebGLGraphics.buildComplexPoly(a,n);a.lineWidth>0&&(n=PIXI.WebGLGraphics.switchMode(r,0),PIXI.WebGLGraphics.buildLine(a,n))}else n=PIXI.WebGLGraphics.switchMode(r,0),a.type===s.RECTANGLE?PIXI.WebGLGraphics.buildRectangle(a,n):a.type===s.CIRCLE||a.type===s.ELLIPSE?PIXI.WebGLGraphics.buildCircle(a,n):a.type===s.ROUNDEDRECTANGLE&&PIXI.WebGLGraphics.buildRoundedRectangle(a,n);r.lastIndex++}for(i=0;i19600?(w=y-x,_=v-b,w/=k=Math.sqrt(w*w+_*_),_/=k,w*=O,_*=O,M.push(p-w,f-_),M.push(N,G,j,U),M.push(p+w,f+_),M.push(N,G,j,U),M.push(p-w,f-_),M.push(N,G,j,U),I++):(M.push(l,u),M.push(N,G,j,U),M.push(p-(l-p),f-(u-f)),M.push(N,G,j,U));for(c=n[2*(F-2)],d=n[2*(F-2)+1],p=n[2*(F-1)],y=-(d-(f=n[2*(F-1)+1])),v=c-p,y/=k=Math.sqrt(y*y+v*v),v/=k,y*=O,v*=O,M.push(p-y,f-v),M.push(N,G,j,U),M.push(p+y,f+v),M.push(N,G,j,U),B.push(L),i=0;ih?r:h,l=(o=i[c+1])u?o:u;i.push(a,l,h,l,h,u,a,u);var d=i.length/2;for(c=0;cA?A:T,e.beginPath(),e.moveTo(w,_+T),e.lineTo(w,_+S-T),e.quadraticCurveTo(w,_+S,w+T,_+S),e.lineTo(w+C-T,_+S),e.quadraticCurveTo(w+C,_+S,w+C,_+S-T),e.lineTo(w+C,_+T),e.quadraticCurveTo(w+C,_,w+C-T,_),e.lineTo(w+T,_),e.quadraticCurveTo(w,_,w,_+T),e.closePath(),(r.fillColor||0===r.fillColor)&&(e.globalAlpha=r.fillAlpha*i,e.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),e.fill()),r.lineWidth&&(e.globalAlpha=r.lineAlpha*i,e.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),e.stroke())}}},PIXI.CanvasGraphics.renderGraphicsMask=function(t,e){var i=t.graphicsData.length;if(0!==i){e.beginPath();for(var n=0;nS?S:C,e.moveTo(x,b+C),e.lineTo(x,b+_-C),e.quadraticCurveTo(x,b+_,x+C,b+_),e.lineTo(x+w-C,b+_),e.quadraticCurveTo(x+w,b+_,x+w,b+_-C),e.lineTo(x+w,b+C),e.quadraticCurveTo(x+w,b,x+w-C,b),e.lineTo(x+C,b),e.quadraticCurveTo(x,b,x,b+C),e.closePath()}}}},PIXI.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,n=(255&t.tint)/255,s=0;s>16&255)/255*e*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*n*255,r._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*n*255}},s.GraphicsData=function(t,e,i,n,s,r,o){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=n,this.fillAlpha=s,this._fillTint=n,this.fill=r,this.shape=o,this.type=o.type},s.GraphicsData.prototype.constructor=s.GraphicsData,s.GraphicsData.prototype.clone=function(){return new s.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.fill,this.shape)}, +n.BitmapData=function(t,e,i,s,r){void 0!==i&&0!==i||(i=256),void 0!==s&&0!==s||(s=256),void 0===r&&(r=!1),this.game=t,this.key=e,this.width=i,this.height=s,this.canvas=n.Canvas.create(this,i,s,null,r),this.context=this.canvas.getContext("2d",{alpha:!0}),this.ctx=this.context,this.smoothProperty=t.renderType===n.CANVAS?t.renderer.renderSession.smoothProperty:n.Canvas.getSmoothingPrefix(this.context),this.imageData=this.context.getImageData(0,0,i,s),this.data=null,this.imageData&&(this.data=this.imageData.data),this.pixels=null,this.data&&(this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data),this.baseTexture=new PIXI.BaseTexture(this.canvas,null,this.game.resolution),this.texture=new PIXI.Texture(this.baseTexture),this.frameData=new n.FrameData,this.textureFrame=this.frameData.addFrame(new n.Frame(0,0,0,i,s,"bitmapData")),this.texture.frame=this.textureFrame,this.type=n.BITMAPDATA,this.disableTextureUpload=!1,this.dirty=!1,this.cls=this.clear,this._image=null,this._pos=new n.Point,this._size=new n.Point,this._scale=new n.Point,this._rotate=0,this._alpha={prev:1,current:1},this._anchor=new n.Point,this._tempR=0,this._tempG=0,this._tempB=0,this._circle=new n.Circle,this._swapCanvas=void 0},n.BitmapData.prototype={move:function(t,e,i){return 0!==t&&this.moveH(t,i),0!==e&&this.moveV(e,i),this},moveH:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=n.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),s=this.height,r=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var o=this.width-t;e&&i.drawImage(r,0,0,t,s,o,0,t,s),i.drawImage(r,t,0,o,s,0,0,o,s)}else{o=this.width-t;e&&i.drawImage(r,o,0,t,s,0,0,t,s),i.drawImage(r,0,0,o,s,t,0,o,s)}return this.clear(),this.copy(this._swapCanvas)},moveV:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=n.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),s=this.width,r=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var o=this.height-t;e&&i.drawImage(r,0,0,s,t,0,o,s,t),i.drawImage(r,0,t,s,o,0,0,s,o)}else{o=this.height-t;e&&i.drawImage(r,0,o,s,t,0,0,s,t),i.drawImage(r,0,0,s,o,0,t,s,o)}return this.clear(),this.copy(this._swapCanvas)},add:function(t){if(Array.isArray(t))for(var e=0;e=0&&t<=this.width&&e>=0&&e<=this.height&&(n.Device.LITTLE_ENDIAN?this.pixels[e*this.width+t]=o<<24|r<<16|s<<8|i:this.pixels[e*this.width+t]=i<<24|s<<16|r<<8|o,a&&(this.context.putImageData(this.imageData,0,0),this.dirty=!0)),this},setPixel:function(t,e,i,n,s,r){return this.setPixel32(t,e,i,n,s,255,r)},getPixel:function(t,e,i){i||(i=n.Color.createColor());var s=~~(t+e*this.width);return s*=4,i.r=this.data[s],i.g=this.data[++s],i.b=this.data[++s],i.a=this.data[++s],i},getPixel32:function(t,e){if(t>=0&&t<=this.width&&e>=0&&e<=this.height)return this.pixels[e*this.width+t]},getPixelRGB:function(t,e,i,s,r){return n.Color.unpackPixel(this.getPixel32(t,e),i,s,r)},getPixels:function(t){return this.context.getImageData(t.x,t.y,t.width,t.height)},getFirstPixel:function(t){void 0===t&&(t=0);var e=n.Color.createColor(),i=0,s=0,r=1,o=!1;1===t?(r=-1,s=this.height):3===t&&(r=-1,i=this.width);do{n.Color.unpackPixel(this.getPixel32(i,s),e),0===t||1===t?++i===this.width&&(i=0,((s+=r)>=this.height||s<=0)&&(o=!0)):2!==t&&3!==t||++s===this.height&&(s=0,((i+=r)>=this.width||i<=0)&&(o=!0))}while(0===e.a&&!o);return e.x=i,e.y=s,e},getBounds:function(t){return void 0===t&&(t=new n.Rectangle),t.x=this.getFirstPixel(2).x,t.x===this.width?t.setTo(0,0,0,0):(t.y=this.getFirstPixel(0).y,t.width=this.getFirstPixel(3).x-t.x+1,t.height=this.getFirstPixel(1).y-t.y+1,t)},addToWorld:function(t,e,i,n,s,r){s=s||1,r=r||1;var o=this.game.add.image(t,e,this);return o.anchor.set(i,n),o.scale.set(s,r),o},copy:function(t,e,i,s,r,o,a,h,l,c,u,d,p,f,g,m,y){if(null==t&&(t=this),t instanceof n.RenderTexture&&(t=t.getCanvas()),this._image=t,t instanceof n.Sprite||t instanceof n.Image||t instanceof n.Text||t instanceof PIXI.Sprite)this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),this._scale.set(t.scale.x,t.scale.y),this._anchor.set(t.anchor.x,t.anchor.y),this._rotate=t.rotation,this._alpha.current=t.alpha,t.texture instanceof n.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source,null==o&&(o=t.x),null==a&&(a=t.y),t.texture.trim&&(o+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,a+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0));else{if(this._pos.set(0),this._scale.set(1),this._anchor.set(0),this._rotate=0,this._alpha.current=1,t instanceof n.BitmapData)this._image=t.canvas;else if("string"==typeof t){if(null===(t=this.game.cache.getImage(t)))return this;this._image=t}this._size.set(this._image.width,this._image.height)}if(null==e&&(e=0),null==i&&(i=0),s&&(this._size.x=s),r&&(this._size.y=r),null==o&&(o=e),null==a&&(a=i),null==h&&(h=this._size.x),null==l&&(l=this._size.y),"number"==typeof c&&(this._rotate=c),"number"==typeof u&&(this._anchor.x=u),"number"==typeof d&&(this._anchor.y=d),"number"==typeof p&&(this._scale.x=p),"number"==typeof f&&(this._scale.y=f),"number"==typeof g&&(this._alpha.current=g),void 0===m&&(m=null),void 0===y&&(y=!1),this._alpha.current<=0||0===this._scale.x||0===this._scale.y||0===this._size.x||0===this._size.y)return this;var v=this.context;return this._alpha.prev=v.globalAlpha,v.save(),v.globalAlpha=this._alpha.current,m&&(this.op=m),y&&(o|=0,a|=0),v.translate(o,a),v.scale(this._scale.x,this._scale.y),v.rotate(this._rotate),v.drawImage(this._image,this._pos.x+e,this._pos.y+i,this._size.x,this._size.y,-h*this._anchor.x,-l*this._anchor.y,h,l),v.restore(),v.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyTransform:function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=!1),!t.hasOwnProperty("worldTransform")||!t.worldVisible||0===t.worldAlpha)return this;var s=t.worldTransform;if(this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),0===s.a||0===s.d||0===this._size.x||0===this._size.y)return this;t.texture instanceof n.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source;var r=s.tx,o=s.ty;t.texture.trim&&(r+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,o+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0)),i&&(r|=0,o|=0);var a=this.context;return this._alpha.prev=a.globalAlpha,a.save(),a.globalAlpha=this._alpha.current,e&&(this.op=e),a[this.smoothProperty]=t.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,a.setTransform(s.a,s.b,s.c,s.d,r,o),a.drawImage(this._image,this._pos.x,this._pos.y,this._size.x,this._size.y,-this._size.x*t.anchor.x,-this._size.y*t.anchor.y,this._size.x,this._size.y),a.restore(),a.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyRect:function(t,e,i,n,s,r,o){return this.copy(t,e.x,e.y,e.width,e.height,i,n,e.width,e.height,0,0,0,1,1,s,r,o)},draw:function(t,e,i,n,s,r,o){return this.copy(t,null,null,null,null,e,i,n,s,null,null,null,null,null,null,r,o)},drawGroup:function(t,e,i){return t.total>0&&t.forEachExists(this.drawGroupProxy,this,e,i),this},drawGroupProxy:function(t,e,i){if(t.hasOwnProperty("texture")&&this.copyTransform(t,e,i),t.type===n.GROUP&&t.exists)this.drawGroup(t,e,i);else if(t.hasOwnProperty("children")&&t.children.length>0)for(var s=0;se.width&&(s=e.width);var r=this.context;return r.fillStyle=r.createPattern(e,i),this._circle=new n.Circle(t.start.x,t.start.y,e.height),this._circle.circumferencePoint(t.angle-1.5707963267948966,!1,this._pos),r.save(),r.translate(this._pos.x,this._pos.y),r.rotate(t.angle),r.fillRect(0,0,s,e.height),r.restore(),this.dirty=!0,this}},render:function(){return!this.disableTextureUpload&&this.dirty&&(this.baseTexture.dirty(),this.dirty=!1),this},destroy:function(){this.frameData.destroy(),this.texture.destroy(!0),n.CanvasPool.remove(this)},blendReset:function(){return this.op="source-over",this},blendSourceOver:function(){return this.op="source-over",this},blendSourceIn:function(){return this.op="source-in",this},blendSourceOut:function(){return this.op="source-out",this},blendSourceAtop:function(){return this.op="source-atop",this},blendDestinationOver:function(){return this.op="destination-over",this},blendDestinationIn:function(){return this.op="destination-in",this},blendDestinationOut:function(){return this.op="destination-out",this},blendDestinationAtop:function(){return this.op="destination-atop",this},blendXor:function(){return this.op="xor",this},blendAdd:function(){return this.op="lighter",this},blendMultiply:function(){return this.op="multiply",this},blendScreen:function(){return this.op="screen",this},blendOverlay:function(){return this.op="overlay",this},blendDarken:function(){return this.op="darken",this},blendLighten:function(){return this.op="lighten",this},blendColorDodge:function(){return this.op="color-dodge",this},blendColorBurn:function(){return this.op="color-burn",this},blendHardLight:function(){return this.op="hard-light",this},blendSoftLight:function(){return this.op="soft-light",this},blendDifference:function(){return this.op="difference",this},blendExclusion:function(){return this.op="exclusion",this},blendHue:function(){return this.op="hue",this},blendSaturation:function(){return this.op="saturation",this},blendColor:function(){return this.op="color",this},blendLuminosity:function(){return this.op="luminosity",this},copyBitmapData:function(t,e,i){t.update();for(var n,s=0;s80*i){s=o=t[0],r=a=t[1];for(var g=i;go&&(o=h),l>a&&(a=l);c=Math.max(o-s,a-r)}return n.EarCut.earcutLinked(p,f,i,s,r,c),f},n.EarCut.linkedList=function(t,e,i,s,r){var o,a,h,l=0;for(o=e,a=i-s;o0)for(o=e;o=e;o-=s)h=n.EarCut.insertNode(o,t[o],t[o+1],h);return h},n.EarCut.filterPoints=function(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!n.EarCut.equals(s,s.next)&&0!==n.EarCut.area(s.prev,s,s.next))s=s.next;else{if(n.EarCut.removeNode(s),(s=e=s.prev)===s.next)return null;i=!0}}while(i||s!==e);return e},n.EarCut.earcutLinked=function(t,e,i,s,r,o,a){if(t){!a&&o&&n.EarCut.indexCurve(t,s,r,o);for(var h,l,c=t;t.prev!==t.next;)if(h=t.prev,l=t.next,o?n.EarCut.isEarHashed(t,s,r,o):n.EarCut.isEar(t))e.push(h.i/i),e.push(t.i/i),e.push(l.i/i),n.EarCut.removeNode(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?(t=n.EarCut.cureLocalIntersections(t,e,i),n.EarCut.earcutLinked(t,e,i,s,r,o,2)):2===a&&n.EarCut.splitEarcut(t,e,i,s,r,o):n.EarCut.earcutLinked(n.EarCut.filterPoints(t),e,i,s,r,o,1);break}}},n.EarCut.isEar=function(t){var e=t.prev,i=t,s=t.next;if(n.EarCut.area(e,i,s)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(n.EarCut.pointInTriangle(e.x,e.y,i.x,i.y,s.x,s.y,r.x,r.y)&&n.EarCut.area(r.prev,r,r.next)>=0)return!1;r=r.next}return!0},n.EarCut.isEarHashed=function(t,e,i,s){var r=t.prev,o=t,a=t.next;if(n.EarCut.area(r,o,a)>=0)return!1;for(var h=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,u=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,d=n.EarCut.zOrder(h,l,e,i,s),p=n.EarCut.zOrder(c,u,e,i,s),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&n.EarCut.pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&n.EarCut.area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=d;){if(f!==t.prev&&f!==t.next&&n.EarCut.pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&n.EarCut.area(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0},n.EarCut.cureLocalIntersections=function(t,e,i){var s=t;do{var r=s.prev,o=s.next.next;n.EarCut.intersects(r,s,s.next,o)&&n.EarCut.locallyInside(r,o)&&n.EarCut.locallyInside(o,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(o.i/i),n.EarCut.removeNode(s),n.EarCut.removeNode(s.next),s=t=o),s=s.next}while(s!==t);return s},n.EarCut.splitEarcut=function(t,e,i,s,r,o){var a=t;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&n.EarCut.isValidDiagonal(a,h)){var l=n.EarCut.splitPolygon(a,h);return a=n.EarCut.filterPoints(a,a.next),l=n.EarCut.filterPoints(l,l.next),n.EarCut.earcutLinked(a,e,i,s,r,o),void n.EarCut.earcutLinked(l,e,i,s,r,o)}h=h.next}a=a.next}while(a!==t)},n.EarCut.eliminateHoles=function(t,e,i,s){var r,o,a,h,l,c=[];for(r=0,o=e.length;r=s.next.y){var h=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);h<=r&&h>a&&(a=h,i=s.x=s.x&&s.x>=i.x&&n.EarCut.pointInTriangle(oi.x)&&n.EarCut.locallyInside(s,t)&&(i=s,u=l),s=s.next;return i},n.EarCut.indexCurve=function(t,e,i,s){var r=t;do{null===r.z&&(r.z=n.EarCut.zOrder(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,n.EarCut.sortLinked(r)},n.EarCut.sortLinked=function(t){var e,i,n,s,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0===a?(s=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--):(s=i,i=i.nextZ,a--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,l*=2}while(o>1);return t},n.EarCut.zOrder=function(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1},n.EarCut.getLeftmost=function(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0},n.EarCut.isValidDiagonal=function(t,e){return n.EarCut.equals(t,e)||t.next.i!==e.i&&t.prev.i!==e.i&&!n.EarCut.intersectsPolygon(t,e)&&n.EarCut.locallyInside(t,e)&&n.EarCut.locallyInside(e,t)&&n.EarCut.middleInside(t,e)},n.EarCut.area=function(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)},n.EarCut.equals=function(t,e){return t.x===e.x&&t.y===e.y},n.EarCut.intersects=function(t,e,i,s){return n.EarCut.area(t,e,i)>0!=n.EarCut.area(t,e,s)>0&&n.EarCut.area(i,s,t)>0!=n.EarCut.area(i,s,e)>0},n.EarCut.intersectsPolygon=function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&n.EarCut.intersects(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1},n.EarCut.locallyInside=function(t,e){return n.EarCut.area(t.prev,t,t.next)<0?n.EarCut.area(t,e,t.next)>=0&&n.EarCut.area(t,t.prev,e)>=0:n.EarCut.area(t,e,t.prev)<0||n.EarCut.area(t,t.next,e)<0},n.EarCut.middleInside=function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n},n.EarCut.splitPolygon=function(t,e){var i=new n.EarCut.Node(t.i,t.x,t.y),s=new n.EarCut.Node(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s},n.EarCut.insertNode=function(t,e,i,s){var r=new n.EarCut.Node(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r},n.EarCut.removeNode=function(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)},n.EarCut.Node=function(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1},PIXI.WebGLGraphics=function(){},PIXI.WebGLGraphics.stencilBufferLimit=6,PIXI.WebGLGraphics.renderGraphics=function(t,e){var i,s=e.gl,r=e.projection,o=e.offset,a=e.shaderManager.primitiveShader;t.dirty&&PIXI.WebGLGraphics.updateGraphics(t,s);var h=t._webGL[s.id];if(h)for(var l=0;l=PIXI.WebGLGraphics.stencilBufferLimit)if(a.points.length<2*PIXI.WebGLGraphics.stencilBufferLimit)s=PIXI.WebGLGraphics.switchMode(r,0),PIXI.WebGLGraphics.buildPoly(a,s)||(s=PIXI.WebGLGraphics.switchMode(r,1),PIXI.WebGLGraphics.buildComplexPoly(a,s));else s=PIXI.WebGLGraphics.switchMode(r,1),PIXI.WebGLGraphics.buildComplexPoly(a,s);a.lineWidth>0&&(s=PIXI.WebGLGraphics.switchMode(r,0),PIXI.WebGLGraphics.buildLine(a,s))}else s=PIXI.WebGLGraphics.switchMode(r,0),a.type===n.RECTANGLE?PIXI.WebGLGraphics.buildRectangle(a,s):a.type===n.CIRCLE||a.type===n.ELLIPSE?PIXI.WebGLGraphics.buildCircle(a,s):a.type===n.ROUNDEDRECTANGLE&&PIXI.WebGLGraphics.buildRoundedRectangle(a,s);r.lastIndex++}for(i=0;i19600?(w=y-b,_=v-x,w/=k=Math.sqrt(w*w+_*_),_/=k,w*=F,_*=F,L.push(p-w,f-_),L.push(G,N,j,U),L.push(p+w,f+_),L.push(G,N,j,U),L.push(p-w,f-_),L.push(G,N,j,U),B++):(L.push(l,c),L.push(G,N,j,U),L.push(p-(l-p),f-(c-f)),L.push(G,N,j,U));for(u=s[2*(I-2)],d=s[2*(I-2)+1],p=s[2*(I-1)],y=-(d-(f=s[2*(I-1)+1])),v=u-p,y/=k=Math.sqrt(y*y+v*v),v/=k,y*=F,v*=F,L.push(p-y,f-v),L.push(G,N,j,U),L.push(p+y,f+v),L.push(G,N,j,U),O.push(R),i=0;ih?r:h,l=(o=i[u+1])c?o:c;i.push(a,l,h,l,h,c,a,c);var d=i.length/2;for(u=0;uA?A:P,e.beginPath(),e.moveTo(_,T+P),e.lineTo(_,T+S-P),e.quadraticCurveTo(_,T+S,_+P,T+S),e.lineTo(_+C-P,T+S),e.quadraticCurveTo(_+C,T+S,_+C,T+S-P),e.lineTo(_+C,T+P),e.quadraticCurveTo(_+C,T,_+C-P,T),e.lineTo(_+P,T),e.quadraticCurveTo(_,T,_,T+P),e.closePath(),(r.fillColor||0===r.fillColor)&&(e.globalAlpha=r.fillAlpha*i,e.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),e.fill()),r.lineWidth&&(e.globalAlpha=r.lineAlpha*i,e.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),e.stroke())}}},PIXI.CanvasGraphics.renderGraphicsMask=function(t,e){var i=t.graphicsData.length;if(0!==i){e.beginPath();for(var s=0;sS?S:C,e.moveTo(x,w+C),e.lineTo(x,w+T-C),e.quadraticCurveTo(x,w+T,x+C,w+T),e.lineTo(x+_-C,w+T),e.quadraticCurveTo(x+_,w+T,x+_,w+T-C),e.lineTo(x+_,w+C),e.quadraticCurveTo(x+_,w,x+_-C,w),e.lineTo(x+C,w),e.quadraticCurveTo(x,w,x,w+C),e.closePath()}}}},PIXI.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,n=(255&t.tint)/255,s=0;s>16&255)/255*e*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*n*255,r._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*n*255}},n.GraphicsData=function(t,e,i,n,s,r,o){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=n,this.fillAlpha=s,this._fillTint=n,this.fill=r,this.shape=o,this.type=o.type},n.GraphicsData.prototype.constructor=n.GraphicsData,n.GraphicsData.prototype.clone=function(){return new n.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.fill,this.shape)}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Graphics=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.type=s.GRAPHICS,this.physicsType=s.SPRITE,this.anchor=new s.Point,PIXI.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=PIXI.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new s.Rectangle(0,0,1,1),this.dirty=!0,this._boundsDirty=!1,this.webGLDirty=!1,this.cachedSpriteDirty=!1,s.Component.Core.init.call(this,t,e,i,"",null)},s.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),s.Graphics.prototype.constructor=s.Graphics,s.Component.Core.install.call(s.Graphics.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),s.Graphics.prototype.preUpdatePhysics=s.Component.PhysicsBody.preUpdate,s.Graphics.prototype.preUpdateLifeSpan=s.Component.LifeSpan.preUpdate,s.Graphics.prototype.preUpdateInWorld=s.Component.InWorld.preUpdate,s.Graphics.prototype.preUpdateCore=s.Component.Core.preUpdate,s.Graphics.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},s.Graphics.prototype.postUpdate=function(){s.Component.PhysicsBody.postUpdate.call(this),s.Component.FixedToCamera.postUpdate.call(this),this._boundsDirty&&(this.updateLocalBounds(),this._boundsDirty=!1);for(var t=0;t0&&this.drawPolygon(i)}else this.drawPolygon(i)},s.Graphics.prototype.drawTriangles=function(t,e,i){void 0===i&&(i=!1);var n,r=new s.Point,o=new s.Point,a=new s.Point,h=[];if(e)if(t[0]instanceof s.Point)for(n=0;nu*a)}return this.dirty=!0,this._boundsDirty=!0,this},s.Graphics.prototype.arc=function(t,e,i,n,s,r,o){if(n===s)return this;void 0===r&&(r=!1),void 0===o&&(o=40),!r&&s<=n?s+=2*Math.PI:r&&n<=s&&(n+=2*Math.PI);var a=r?-1*(n-s):s-n,h=Math.ceil(Math.abs(a)/(2*Math.PI))*o;if(0===a)return this;var l=t+Math.cos(n)*i,u=e+Math.sin(n)*i;r&&this.filling?this.moveTo(t,e):this.moveTo(l,u);for(var c=this.currentPath.shape.points,d=a/(2*h),p=2*d,f=Math.cos(d),g=Math.sin(d),m=h-1,y=m%1/m,v=0;v<=m;v++){var x=d+n+p*(v+y*v),b=Math.cos(x),w=-Math.sin(x);c.push((f*b+g*w)*i+t,(f*-w+g*b)*i+e)}return this.dirty=!0,this._boundsDirty=!0,this},s.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},s.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},s.Graphics.prototype.drawRect=function(t,e,i,n){return this.drawShape(new s.Rectangle(t,e,i,n)),this},s.Graphics.prototype.drawRoundedRect=function(t,e,i,n,r){return this.drawShape(new s.RoundedRectangle(t,e,i,n,r)),this},s.Graphics.prototype.drawCircle=function(t,e,i){return this.drawShape(new s.Circle(t,e,i)),this},s.Graphics.prototype.drawEllipse=function(t,e,i,n){return this.drawShape({x:t,y:e,width:i,height:n,type:s.ELLIPSE}),this},s.Graphics.prototype.drawPolygon=function(t){t instanceof s.Polygon&&(t=t.points);var e=t;if(!Array.isArray(e)){e=new Array(arguments.length);for(var i=0;i(_=v>(_=m>_?m:_)?v:_)?b:_,C=w>(C=x>(C=y>C?y:C)?x:C)?w:C,this._bounds.x=S,this._bounds.width=_-S,this._bounds.y=T,this._bounds.height=C-T,this._currentBounds=this._bounds,this._currentBounds},s.Graphics.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=s.identityMatrix;for(var e=0;ee?a+l:e,i=hn?h+u:n;else if(p===s.CIRCLE)a=r.x,h=r.y,t=a-(l=r.radius+f/2)e?a+l:e,i=h-(u=r.radius+f/2)n?h+u:n;else if(p===s.ELLIPSE)a=r.x,h=r.y,t=a-(l=r.width+f/2)e?a+l:e,i=h-(u=r.height+f/2)n?h+u:n;else{o=r.points;for(var g=0;ge?a+f:e,i=h-fn?h+f:n}}else t=0,e=0,i=0,n=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=e-t+2*m,this._localBounds.y=i-m,this._localBounds.height=n-i+2*m},s.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var e=new PIXI.CanvasBuffer(t.width,t.height),i=PIXI.Texture.fromCanvas(e.canvas);this._cachedSprite=new PIXI.Sprite(i),this._cachedSprite.buffer=e,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,PIXI.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},s.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},s.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},s.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null,t instanceof s.Polygon&&(t=t.clone()).flatten();var e=new s.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(e),e.type===s.POLYGON&&(e.shape.closed=this.filling,this.currentPath=e),this.dirty=!0,this._boundsDirty=!0,e},Object.defineProperty(s.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():this.destroyCachedSprite(),this.dirty=!0,this.webGLDirty=!0}}), +n.Graphics=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.type=n.GRAPHICS,this.physicsType=n.SPRITE,this.anchor=new n.Point,PIXI.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=PIXI.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new n.Rectangle(0,0,1,1),this.dirty=!0,this._boundsDirty=!1,this.webGLDirty=!1,this.cachedSpriteDirty=!1,n.Component.Core.init.call(this,t,e,i,"",null)},n.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.Graphics.prototype.constructor=n.Graphics,n.Component.Core.install.call(n.Graphics.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),n.Graphics.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.Graphics.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Graphics.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Graphics.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Graphics.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.Graphics.prototype.postUpdate=function(){n.Component.PhysicsBody.postUpdate.call(this),n.Component.FixedToCamera.postUpdate.call(this),this._boundsDirty&&(this.updateLocalBounds(),this._boundsDirty=!1);for(var t=0;t0&&this.drawPolygon(i)}else this.drawPolygon(i)},n.Graphics.prototype.drawTriangles=function(t,e,i){void 0===i&&(i=!1);var s,r=new n.Point,o=new n.Point,a=new n.Point,h=[];if(e)if(t[0]instanceof n.Point)for(s=0;sc*a)}return this.dirty=!0,this._boundsDirty=!0,this},n.Graphics.prototype.arc=function(t,e,i,n,s,r,o){if(n===s)return this;void 0===r&&(r=!1),void 0===o&&(o=40),!r&&s<=n?s+=2*Math.PI:r&&n<=s&&(n+=2*Math.PI);var a=r?-1*(n-s):s-n,h=Math.ceil(Math.abs(a)/(2*Math.PI))*o;if(0===a)return this;var l=t+Math.cos(n)*i,c=e+Math.sin(n)*i;r&&this.filling?this.moveTo(t,e):this.moveTo(l,c);for(var u=this.currentPath.shape.points,d=a/(2*h),p=2*d,f=Math.cos(d),g=Math.sin(d),m=h-1,y=m%1/m,v=0;v<=m;v++){var b=d+n+p*(v+y*v),x=Math.cos(b),w=-Math.sin(b);u.push((f*x+g*w)*i+t,(f*-w+g*x)*i+e)}return this.dirty=!0,this._boundsDirty=!0,this},n.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},n.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},n.Graphics.prototype.drawRect=function(t,e,i,s){return this.drawShape(new n.Rectangle(t,e,i,s)),this},n.Graphics.prototype.drawRoundedRect=function(t,e,i,s,r){return this.drawShape(new n.RoundedRectangle(t,e,i,s,r)),this},n.Graphics.prototype.drawCircle=function(t,e,i){return this.drawShape(new n.Circle(t,e,i)),this},n.Graphics.prototype.drawEllipse=function(t,e,i,s){return this.drawShape({x:t,y:e,width:i,height:s,type:n.ELLIPSE}),this},n.Graphics.prototype.drawPolygon=function(t){t instanceof n.Polygon&&(t=t.points);var e=t;if(!Array.isArray(e)){e=new Array(arguments.length);for(var i=0;i(_=v>(_=m>_?m:_)?v:_)?x:_,T=w>(T=b>(T=y>T?y:T)?b:T)?w:T,this._bounds.x=C,this._bounds.width=_-C,this._bounds.y=S,this._bounds.height=T-S,this._currentBounds=this._bounds,this._currentBounds},n.Graphics.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=n.identityMatrix;for(var e=0;ee?a+l:e,i=hs?h+c:s;else if(p===n.CIRCLE)a=r.x,h=r.y,t=a-(l=r.radius+f/2)e?a+l:e,i=h-(c=r.radius+f/2)s?h+c:s;else if(p===n.ELLIPSE)a=r.x,h=r.y,t=a-(l=r.width+f/2)e?a+l:e,i=h-(c=r.height+f/2)s?h+c:s;else{o=r.points;for(var g=0;ge?a+f:e,i=h-fs?h+f:s}}else t=0,e=0,i=0,s=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=e-t+2*m,this._localBounds.y=i-m,this._localBounds.height=s-i+2*m},n.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var e=new PIXI.CanvasBuffer(t.width,t.height),i=PIXI.Texture.fromCanvas(e.canvas);this._cachedSprite=new PIXI.Sprite(i),this._cachedSprite.buffer=e,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,PIXI.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},n.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},n.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},n.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null,t instanceof n.Polygon&&(t=t.clone()).flatten();var e=new n.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(e),e.type===n.POLYGON&&(e.shape.closed=this.filling,this.currentPath=e),this.dirty=!0,this._boundsDirty=!0,e},Object.defineProperty(n.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():this.destroyCachedSprite(),this.dirty=!0,this.webGLDirty=!0}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.RenderTexture=function(t,e,i,n,r,o,a,h){if(void 0===e&&(e=100),void 0===i&&(i=100),void 0===n&&(n=""),void 0===r&&(r=s.scaleModes.DEFAULT),void 0===o&&(o=1),void 0===a&&(a=PIXI.defaultRenderer),void 0===h&&(h=0),this.game=t,this.key=n,this.type=s.RENDERTEXTURE,this._tempMatrix=new s.Matrix,this.width=e,this.height=i,this.resolution=o,this.frame=new s.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=this.frame.clone(),this.baseTexture=new PIXI.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=r,this.baseTexture.hasLoaded=!0,PIXI.Texture.call(this,this.baseTexture,this.frame.clone()),this.renderer=a,this.renderer.type===s.WEBGL){var l=this.renderer.gl;this.baseTexture.textureIndex=h,this.baseTexture._dirty[l.id]=!1,this.textureBuffer=new PIXI.FilterTexture(l,this.width,this.height,this.baseTexture.scaleMode,h),this.baseTexture._glTextures[l.id]=this.textureBuffer.texture,this.projection=new s.Point(.5*this.width,.5*-this.height)}else this.textureBuffer=new PIXI.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this.tempMatrix=new s.Matrix,this._updateUvs()},s.RenderTexture.prototype=Object.create(PIXI.Texture.prototype),s.RenderTexture.prototype.constructor=s.RenderTexture,s.RenderTexture.prototype.renderXY=function(t,e,i,n){t.updateTransform(),this._tempMatrix.copyFrom(t.worldTransform),this._tempMatrix.tx=e,this._tempMatrix.ty=i,this.renderer.type===s.WEBGL?this._renderWebGL(t,this._tempMatrix,n):this._renderCanvas(t,this._tempMatrix,n)},s.RenderTexture.prototype.renderRawXY=function(t,e,i,n){this._tempMatrix.identity().translate(e,i),this.renderer.type===s.WEBGL?this._renderWebGL(t,this._tempMatrix,n):this._renderCanvas(t,this._tempMatrix,n)},s.RenderTexture.prototype.render=function(t,e,i){null==e?this._tempMatrix.copyFrom(t.worldTransform):this._tempMatrix.copyFrom(e),this.renderer.type===s.WEBGL?this._renderWebGL(t,this._tempMatrix,i):this._renderCanvas(t,this._tempMatrix,i)},s.RenderTexture.prototype.resize=function(t,e,i){t===this.width&&e===this.height||(this.valid=t>0&&e>0,this.width=t,this.height=e,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=e*this.resolution,i&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===s.WEBGL&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},s.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===s.WEBGL&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},s.RenderTexture.prototype._renderWebGL=function(t,e,i){if(this.valid&&0!==t.alpha){var n=t.worldTransform;n.identity(),n.translate(0,2*this.projection.y),e&&n.append(e),n.scale(1,-1);for(var s=0;s0&&e>0,this.width=t,this.height=e,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=e*this.resolution,i&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===n.WEBGL&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},n.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===n.WEBGL&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},n.RenderTexture.prototype._renderWebGL=function(t,e,i){if(this.valid&&0!==t.alpha){var n=t.worldTransform;n.identity(),n.translate(0,2*this.projection.y),e&&n.append(e),n.scale(1,-1);for(var s=0;s * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Text=function(t,e,i,n,r){e=e||0,i=i||0,n=null==n?"":n.toString(),this.canvas=s.CanvasPool.create(this),s.Sprite.call(this,t,e,i,PIXI.Texture.fromCanvas(this.canvas)),this.type=s.TEXT,this.physicsType=s.SPRITE,this.padding=new s.Point,this.textBounds=null,this.context=this.canvas.getContext("2d"),this.colors=[],this.strokeColors=[],this.fontStyles=[],this.fontWeights=[],this.autoRound=!1,this.useAdvancedWrap=!1,this.splitRegExp=/(?:\r\n|\r|\n)/,this.characterLimitSize=-1,this.characterLimitSuffix="",this._testString="|MÉq",this._res=t.renderer.resolution,this._text=n,this._fontComponents=null,this._lineSpacing=0,this._charCount=0,this._width=0,this._height=0,this.style={},this.setStyle(r||{}),""!==n&&this.updateText()},s.Text.prototype=Object.create(s.Sprite.prototype),s.Text.prototype.constructor=s.Text,s.Text.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},s.Text.prototype.update=function(){},s.Text.prototype.destroy=function(t){this.texture.destroy(!0),s.Component.Destroy.prototype.destroy.call(this,t)},s.Text.prototype.setShadow=function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="rgba(0, 0, 0, 1)"),void 0===n&&(n=0),void 0===s&&(s=!0),void 0===r&&(r=!0),this.style.shadowOffsetX=t,this.style.shadowOffsetY=e,this.style.shadowColor=i,this.style.shadowBlur=n,this.style.shadowStroke=s,this.style.shadowFill=r,this.dirty=!0,this},s.Text.prototype.setStyle=function(t,e){void 0===e&&(e=!1);var i=Object.assign({},t);i.font=t.font||"bold 20pt Arial",i.backgroundColor=t.backgroundColor||null,i.fill=t.fill||"black",i.align=(t.align||"left").toLowerCase(),i.boundsAlignH=(t.boundsAlignH||"left").toLowerCase(),i.boundsAlignV=(t.boundsAlignV||"top").toLowerCase(),i.stroke=t.stroke||"black",i.strokeThickness=Number(t.strokeThickness)||0,i.wordWrap=t.wordWrap||!1,i.wordWrapWidth=t.wordWrapWidth||100,i.maxLines=t.maxLines||0,i.shadowOffsetX=t.shadowOffsetX||0,i.shadowOffsetY=t.shadowOffsetY||0,i.shadowColor=t.shadowColor||"rgba(0,0,0,0)",i.shadowBlur=t.shadowBlur||0,i.tabs=t.tabs||0;var n=this.fontToComponents(i.font);return i.fontStyle&&(n.fontStyle=i.fontStyle),i.fontVariant&&(n.fontVariant=i.fontVariant),i.fontWeight&&(n.fontWeight=i.fontWeight),i.fontSize&&("number"==typeof i.fontSize&&(i.fontSize=i.fontSize+"px"),n.fontSize=i.fontSize),this._fontComponents=n,i.font=this.componentsToFont(this._fontComponents),this.style=i,this.dirty=!0,e&&this.updateText(),this},s.Text.prototype.updateText=function(){this.texture.baseTexture.resolution=this._res,this.context.font=this.style.font;var t=this.text;this.characterLimitSize>-1&&this.characterLimitSize0&&this.style.maxLines0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?h+=this.measureLine(e[a]):h+=this.context.measureText(e[a]).width,this.style.wordWrap&&(h-=this.context.measureText(" ").width)}else{var l=e[a].split(/(?:\t)/);h=this.padding.x+this.style.strokeThickness;if(Array.isArray(i))for(var u=0,c=0;c0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?this.measureLine(l[c]):Math.ceil(this.context.measureText(l[c]).width),c>0&&(u+=i[c-1]),h=u+d}else for(c=0;c0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?h+=this.measureLine(l[c]):h+=Math.ceil(this.context.measureText(l[c]).width),h+=this.game.math.snapToCeil(h,i)-h}}n[a]=Math.ceil(h),s=Math.max(s,n[a])}this.canvas.width=s*this._res;var p,f,g=r.fontSize+this.style.strokeThickness+this.padding.y,m=g*o,y=this._lineSpacing;for(y<0&&Math.abs(y)>g&&(y=-g),0!==y&&(m+=y>0?y*e.length:y*(e.length-1)),this.canvas.height=m*this._res,this.context.scale(this._res,this._res),navigator.isCocoonJS&&this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.style.backgroundColor&&(this.context.fillStyle=this.style.backgroundColor,this.context.fillRect(0,0,this.canvas.width,this.canvas.height)),this.context.fillStyle=this.style.fill,this.context.font=this.style.font,this.context.strokeStyle=this.style.stroke,this.context.textBaseline="alphabetic",this.context.lineWidth=this.style.strokeThickness,this.context.lineCap="round",this.context.lineJoin="round",this._charCount=0,a=0;a0&&(f+=y*a),"right"===this.style.align?p+=s-n[a]:"center"===this.style.align&&(p+=(s-n[a])/2),this.autoRound&&(p=Math.round(p),f=Math.round(f)),this.colors.length>0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?this.updateLine(e[a],p,f):(this.style.stroke&&this.style.strokeThickness&&(this.updateShadow(this.style.shadowStroke),0===i?this.context.strokeText(e[a],p,f):this.renderTabLine(e[a],p,f,!1)),this.style.fill&&(this.updateShadow(this.style.shadowFill),0===i?this.context.fillText(e[a],p,f):this.renderTabLine(e[a],p,f,!0)));this.updateTexture(),this.dirty=!1},s.Text.prototype.renderTabLine=function(t,e,i,n){var s=t.split(/(?:\t)/),r=this.style.tabs,o=0;if(Array.isArray(r))for(var a=0,h=0;h0&&(a+=r[h-1]),o=e+a,n?this.context.fillText(s[h],o,i):this.context.strokeText(s[h],o,i);else for(h=0;h0||this.fontStyles.length>0){var s=this.fontToComponents(this.context.font);this.fontStyles[this._charCount]&&(s.fontStyle=this.fontStyles[this._charCount]),this.fontWeights[this._charCount]&&(s.fontWeight=this.fontWeights[this._charCount]),this.context.font=this.componentsToFont(s)}this.style.stroke&&this.style.strokeThickness&&(this.strokeColors[this._charCount]&&(this.context.strokeStyle=this.strokeColors[this._charCount]),this.updateShadow(this.style.shadowStroke)),this.style.fill&&(this.colors[this._charCount]&&(this.context.fillStyle=this.colors[this._charCount]),this.updateShadow(this.style.shadowFill)),e+=this.context.measureText(n).width,this._charCount++}return Math.ceil(e)},s.Text.prototype.updateLine=function(t,e,i){for(var n=0;n0||this.fontStyles.length>0){var r=this.fontToComponents(this.context.font);this.fontStyles[this._charCount]&&(r.fontStyle=this.fontStyles[this._charCount]),this.fontWeights[this._charCount]&&(r.fontWeight=this.fontWeights[this._charCount]),this.context.font=this.componentsToFont(r)}this.style.stroke&&this.style.strokeThickness&&(this.strokeColors[this._charCount]&&(this.context.strokeStyle=this.strokeColors[this._charCount]),this.updateShadow(this.style.shadowStroke),this.context.strokeText(s,e,i)),this.style.fill&&(this.colors[this._charCount]&&(this.context.fillStyle=this.colors[this._charCount]),this.updateShadow(this.style.shadowFill),this.context.fillText(s,e,i)),e+=this.context.measureText(s).width,this._charCount++}},s.Text.prototype.clearColors=function(){return this.colors=[],this.strokeColors=[],this.dirty=!0,this},s.Text.prototype.clearFontValues=function(){return this.fontStyles=[],this.fontWeights=[],this.dirty=!0,this},s.Text.prototype.addColor=function(t,e){return this.colors[e]=t,this.dirty=!0,this},s.Text.prototype.addStrokeColor=function(t,e){return this.strokeColors[e]=t,this.dirty=!0,this},s.Text.prototype.addFontStyle=function(t,e){return this.fontStyles[e]=t,this.dirty=!0,this},s.Text.prototype.addFontWeight=function(t,e){return this.fontWeights[e]=t,this.dirty=!0,this},s.Text.prototype.precalculateWordWrap=function(t){return this.texture.baseTexture.resolution=this._res,this.context.font=this.style.font,this.runWordWrap(t).split(/(?:\r\n|\r|\n)/)},s.Text.prototype.runWordWrap=function(t){return this.useAdvancedWrap?this.advancedWordWrap(t):this.basicWordWrap(t)},s.Text.prototype.advancedWordWrap=function(t){for(var e=this.context,i=this.style.wordWrapWidth,n="",s=t.replace(/ +/gi," ").split(/\r?\n/gi),r=s.length,o=0;ol){if(0===c){for(var g=p;g.length&&(g=g.slice(0,-1),!((f=e.measureText(g).width)<=l)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var m=d.substr(g.length);u[c]=m,h+=g}var y=u[c].length?c:c+1,v=u.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=v+" "+(s[o+1]||""),r=s.length;break}h+=p,l-=f}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},s.Text.prototype.basicWordWrap=function(t){for(var e="",i=t.split("\n"),n=0;ns?(o>0&&(e+="\n"),e+=r[o]+" ",s=this.style.wordWrapWidth-a):(s-=h,e+=r[o]+" ")}ni&&(this.style.wordWrapWidth=i)),this.updateTexture(),this},s.Text.prototype.updateTexture=function(){var t=this.texture.baseTexture,e=this.texture.crop,i=this.texture.frame,n=this.canvas.width,s=this.canvas.height;if(t.width=n,t.height=s,e.width=n,e.height=s,i.width=n,i.height=s,this.texture.width=n,this.texture.height=s,this._width=n,this._height=s,this.textBounds){var r=this.textBounds.x,o=this.textBounds.y;"right"===this.style.boundsAlignH?r+=this.textBounds.width-this.canvas.width/this.resolution:"center"===this.style.boundsAlignH&&(r+=this.textBounds.halfWidth-this.canvas.width/this.resolution/2),"bottom"===this.style.boundsAlignV?o+=this.textBounds.height-this.canvas.height/this.resolution:"middle"===this.style.boundsAlignV&&(o+=this.textBounds.halfHeight-this.canvas.height/this.resolution/2),this.pivot.x=-r,this.pivot.y=-o}this.renderable=0!==n&&0!==s,this.texture.requiresReTint=!0,this.texture.baseTexture.dirty()},s.Text.prototype._renderWebGL=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderWebGL.call(this,t)},s.Text.prototype._renderCanvas=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderCanvas.call(this,t)},s.Text.prototype.determineFontProperties=function(t){var e=s.Text.fontPropertiesCache[t],i=this.testString||"|MÉq";if(!e){e={};var n=s.Text.fontPropertiesCanvas,r=s.Text.fontPropertiesContext;r.font=t;var o=Math.ceil(r.measureText(i).width),a=Math.ceil(r.measureText(i).width),h=2*a;if(a=1.4*a|0,n.width=o,n.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(i,0,a),!r.getImageData(0,0,o,h))return e.ascent=a,e.descent=a+6,e.fontSize=e.ascent+e.descent,s.Text.fontPropertiesCache[t]=e,e;var l,u,c=r.getImageData(0,0,o,h).data,d=c.length,p=4*o,f=0,g=!1;for(l=0;la;l--){for(u=0;u-1&&this.characterLimitSize0&&this.style.maxLines0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?h+=this.measureLine(e[a]):h+=this.context.measureText(e[a]).width,this.style.wordWrap&&(h-=this.context.measureText(" ").width)}else{var l=e[a].split(/(?:\t)/);h=this.padding.x+this.style.strokeThickness;if(Array.isArray(i))for(var c=0,u=0;u0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?this.measureLine(l[u]):Math.ceil(this.context.measureText(l[u]).width),u>0&&(c+=i[u-1]),h=c+d}else for(u=0;u0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?h+=this.measureLine(l[u]):h+=Math.ceil(this.context.measureText(l[u]).width),h+=this.game.math.snapToCeil(h,i)-h}}n[a]=Math.ceil(h),s=Math.max(s,n[a])}this.canvas.width=s*this._res;var p,f,g=r.fontSize+this.style.strokeThickness+this.padding.y,m=g*o,y=this._lineSpacing;for(y<0&&Math.abs(y)>g&&(y=-g),0!==y&&(m+=y>0?y*e.length:y*(e.length-1)),this.canvas.height=m*this._res,this.context.scale(this._res,this._res),navigator.isCocoonJS&&this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.style.backgroundColor&&(this.context.fillStyle=this.style.backgroundColor,this.context.fillRect(0,0,this.canvas.width,this.canvas.height)),this.context.fillStyle=this.style.fill,this.context.font=this.style.font,this.context.strokeStyle=this.style.stroke,this.context.textBaseline="alphabetic",this.context.lineWidth=this.style.strokeThickness,this.context.lineCap="round",this.context.lineJoin="round",this._charCount=0,a=0;a0&&(f+=y*a),"right"===this.style.align?p+=s-n[a]:"center"===this.style.align&&(p+=(s-n[a])/2),this.autoRound&&(p=Math.round(p),f=Math.round(f)),this.colors.length>0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?this.updateLine(e[a],p,f):(this.style.stroke&&this.style.strokeThickness&&(this.updateShadow(this.style.shadowStroke),0===i?this.context.strokeText(e[a],p,f):this.renderTabLine(e[a],p,f,!1)),this.style.fill&&(this.updateShadow(this.style.shadowFill),0===i?this.context.fillText(e[a],p,f):this.renderTabLine(e[a],p,f,!0)));this.updateTexture(),this.dirty=!1},n.Text.prototype.renderTabLine=function(t,e,i,n){var s=t.split(/(?:\t)/),r=this.style.tabs,o=0;if(Array.isArray(r))for(var a=0,h=0;h0&&(a+=r[h-1]),o=e+a,n?this.context.fillText(s[h],o,i):this.context.strokeText(s[h],o,i);else for(h=0;h0||this.fontStyles.length>0){var s=this.fontToComponents(this.context.font);this.fontStyles[this._charCount]&&(s.fontStyle=this.fontStyles[this._charCount]),this.fontWeights[this._charCount]&&(s.fontWeight=this.fontWeights[this._charCount]),this.context.font=this.componentsToFont(s)}this.style.stroke&&this.style.strokeThickness&&(this.strokeColors[this._charCount]&&(this.context.strokeStyle=this.strokeColors[this._charCount]),this.updateShadow(this.style.shadowStroke)),this.style.fill&&(this.colors[this._charCount]&&(this.context.fillStyle=this.colors[this._charCount]),this.updateShadow(this.style.shadowFill)),e+=this.context.measureText(n).width,this._charCount++}return Math.ceil(e)},n.Text.prototype.updateLine=function(t,e,i){for(var n=0;n0||this.fontStyles.length>0){var r=this.fontToComponents(this.context.font);this.fontStyles[this._charCount]&&(r.fontStyle=this.fontStyles[this._charCount]),this.fontWeights[this._charCount]&&(r.fontWeight=this.fontWeights[this._charCount]),this.context.font=this.componentsToFont(r)}this.style.stroke&&this.style.strokeThickness&&(this.strokeColors[this._charCount]&&(this.context.strokeStyle=this.strokeColors[this._charCount]),this.updateShadow(this.style.shadowStroke),this.context.strokeText(s,e,i)),this.style.fill&&(this.colors[this._charCount]&&(this.context.fillStyle=this.colors[this._charCount]),this.updateShadow(this.style.shadowFill),this.context.fillText(s,e,i)),e+=this.context.measureText(s).width,this._charCount++}},n.Text.prototype.clearColors=function(){return this.colors=[],this.strokeColors=[],this.dirty=!0,this},n.Text.prototype.clearFontValues=function(){return this.fontStyles=[],this.fontWeights=[],this.dirty=!0,this},n.Text.prototype.addColor=function(t,e){return this.colors[e]=t,this.dirty=!0,this},n.Text.prototype.addStrokeColor=function(t,e){return this.strokeColors[e]=t,this.dirty=!0,this},n.Text.prototype.addFontStyle=function(t,e){return this.fontStyles[e]=t,this.dirty=!0,this},n.Text.prototype.addFontWeight=function(t,e){return this.fontWeights[e]=t,this.dirty=!0,this},n.Text.prototype.precalculateWordWrap=function(t){return this.texture.baseTexture.resolution=this._res,this.context.font=this.style.font,this.runWordWrap(t).split(/(?:\r\n|\r|\n)/)},n.Text.prototype.runWordWrap=function(t){return this.useAdvancedWrap?this.advancedWordWrap(t):this.basicWordWrap(t)},n.Text.prototype.advancedWordWrap=function(t){for(var e=this.context,i=this.style.wordWrapWidth,n="",s=t.replace(/ +/gi," ").split(/\r?\n/gi),r=s.length,o=0;ol){if(0===u){for(var g=p;g.length&&(g=g.slice(0,-1),!((f=e.measureText(g).width)<=l)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var m=d.substr(g.length);c[u]=m,h+=g}var y=c[u].length?u:u+1,v=c.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=v+" "+(s[o+1]||""),r=s.length;break}h+=p,l-=f}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},n.Text.prototype.basicWordWrap=function(t){for(var e="",i=t.split("\n"),n=0;ns?(o>0&&(e+="\n"),e+=r[o]+" ",s=this.style.wordWrapWidth-a):(s-=h,e+=r[o]+" ")}ni&&(this.style.wordWrapWidth=i)),this.updateTexture(),this},n.Text.prototype.updateTexture=function(){var t=this.texture.baseTexture,e=this.texture.crop,i=this.texture.frame,n=this.canvas.width,s=this.canvas.height;if(t.width=n,t.height=s,e.width=n,e.height=s,i.width=n,i.height=s,this.texture.width=n,this.texture.height=s,this._width=n,this._height=s,this.textBounds){var r=this.textBounds.x,o=this.textBounds.y;"right"===this.style.boundsAlignH?r+=this.textBounds.width-this.canvas.width/this.resolution:"center"===this.style.boundsAlignH&&(r+=this.textBounds.halfWidth-this.canvas.width/this.resolution/2),"bottom"===this.style.boundsAlignV?o+=this.textBounds.height-this.canvas.height/this.resolution:"middle"===this.style.boundsAlignV&&(o+=this.textBounds.halfHeight-this.canvas.height/this.resolution/2),this.pivot.x=-r,this.pivot.y=-o}this.renderable=0!==n&&0!==s,this.texture.requiresReTint=!0,this.texture.baseTexture.dirty()},n.Text.prototype._renderWebGL=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderWebGL.call(this,t)},n.Text.prototype._renderCanvas=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderCanvas.call(this,t)},n.Text.prototype.determineFontProperties=function(t){var e=n.Text.fontPropertiesCache[t],i=this.testString||"|MÉq";if(!e){e={};var s=n.Text.fontPropertiesCanvas,r=n.Text.fontPropertiesContext;r.font=t;var o=Math.ceil(r.measureText(i).width),a=Math.ceil(r.measureText(i).width),h=2*a;if(a=1.4*a|0,s.width=o,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(i,0,a),!r.getImageData(0,0,o,h))return e.ascent=a,e.descent=a+6,e.fontSize=e.ascent+e.descent,n.Text.fontPropertiesCache[t]=e,e;var l,c,u=r.getImageData(0,0,o,h).data,d=u.length,p=4*o,f=0,g=!1;for(l=0;la;l--){for(c=0;c * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.BitmapText=function(t,e,i,n,r,o,a){e=e||0,i=i||0,n=n||"",r=r||"",o=o||32,a=a||"left",PIXI.DisplayObjectContainer.call(this),this.type=s.BITMAPTEXT,this.physicsType=s.SPRITE,this.textWidth=0,this.textHeight=0,this.anchor=new s.Point,this._prevAnchor=new s.Point,this._glyphs=[],this._maxWidth=0,this._text=r.toString()||"",this._data=t.cache.getBitmapFont(n),this._font=n,this._fontSize=o,this._align=a,this._letterSpacing=0,this._tint=16777215,this.updateText(),this.dirty=!1,s.Component.Core.init.call(this,t,e,i,"",null)},s.BitmapText.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),s.BitmapText.prototype.constructor=s.BitmapText,s.Component.Core.install.call(s.BitmapText.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),s.BitmapText.prototype.preUpdatePhysics=s.Component.PhysicsBody.preUpdate,s.BitmapText.prototype.preUpdateLifeSpan=s.Component.LifeSpan.preUpdate,s.BitmapText.prototype.preUpdateInWorld=s.Component.InWorld.preUpdate,s.BitmapText.prototype.preUpdateCore=s.Component.Core.preUpdate,s.BitmapText.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},s.BitmapText.prototype.postUpdate=function(){s.Component.PhysicsBody.postUpdate.call(this),s.Component.FixedToCamera.postUpdate.call(this),this.body&&this.body.type===s.Physics.ARCADE&&(this.textWidth===this.body.sourceWidth&&this.textHeight===this.body.sourceHeight||this.body.setSize(this.textWidth,this.textHeight))},s.BitmapText.prototype.setText=function(t){this.text=t},s.BitmapText.prototype.scanLine=function(t,e,i){for(var n=0,s=0,r=-1,o=0,a=null,h=this._maxWidth>0?this._maxWidth:null,l=[],u=0;u=h&&r>-1)return{width:o||s,text:i.substr(0,u-(u-r)),end:!1,chars:l};s+=(f.xAdvance+g+this.letterSpacing)*e,l.push(n+(f.xOffset+g+this.letterSpacing)*e),n+=(f.xAdvance+g+this.letterSpacing)*e,a=p}return{width:s,text:i,end:c,chars:l}},s.BitmapText.prototype.cleanText=function(t,e){void 0===e&&(e="");var i=this._data.font;if(!i)return"";for(var n=t.replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s=0;sthis.textWidth&&(this.textWidth=u.width),s+=t.lineHeight*i,e=e.substr(u.text.length+1)}while(!1===u.end);this.textHeight=s;for(var r=0,o=0,a=this.textWidth*this.anchor.x,h=this.textHeight*this.anchor.y,l=0;l0&&(this._fontSize=t,this.updateText())}}),Object.defineProperty(s.BitmapText.prototype,"text",{get:function(){return this._text},set:function(t){t!==this._text&&(this._text=t.toString()||"",this.updateText())}}),Object.defineProperty(s.BitmapText.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){t!==this._maxWidth&&(this._maxWidth=t,this.updateText())}}),Object.defineProperty(s.BitmapText.prototype,"smoothed",{get:function(){return!this._data.base.scaleMode},set:function(t){this._data.base.scaleMode=t?0:1,this._data.base.dirty()}}), +n.BitmapText=function(t,e,i,s,r,o,a){e=e||0,i=i||0,s=s||"",r=r||"",o=o||32,a=a||"left",PIXI.DisplayObjectContainer.call(this),this.type=n.BITMAPTEXT,this.physicsType=n.SPRITE,this.textWidth=0,this.textHeight=0,this.anchor=new n.Point,this._prevAnchor=new n.Point,this._glyphs=[],this._maxWidth=0,this._text=r.toString()||"",this._data=t.cache.getBitmapFont(s),this._font=s,this._fontSize=o,this._align=a,this._letterSpacing=0,this._tint=16777215,this.updateText(),this.dirty=!1,n.Component.Core.init.call(this,t,e,i,"",null)},n.BitmapText.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.BitmapText.prototype.constructor=n.BitmapText,n.Component.Core.install.call(n.BitmapText.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),n.BitmapText.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.BitmapText.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.BitmapText.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.BitmapText.prototype.preUpdateCore=n.Component.Core.preUpdate,n.BitmapText.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.BitmapText.prototype.postUpdate=function(){n.Component.PhysicsBody.postUpdate.call(this),n.Component.FixedToCamera.postUpdate.call(this),this.body&&this.body.type===n.Physics.ARCADE&&(this.textWidth===this.body.sourceWidth&&this.textHeight===this.body.sourceHeight||this.body.setSize(this.textWidth,this.textHeight))},n.BitmapText.prototype.setText=function(t){this.text=t},n.BitmapText.prototype.scanLine=function(t,e,i){for(var n=0,s=0,r=-1,o=0,a=null,h=this._maxWidth>0?this._maxWidth:null,l=[],c=0;c=h&&r>-1)return{width:o||s,text:i.substr(0,c-(c-r)),end:!1,chars:l};s+=(f.xAdvance+g+this.letterSpacing)*e,l.push(n+(f.xOffset+g+this.letterSpacing)*e),n+=(f.xAdvance+g+this.letterSpacing)*e,a=p}return{width:s,text:i,end:u,chars:l}},n.BitmapText.prototype.cleanText=function(t,e){void 0===e&&(e="");var i=this._data.font;if(!i)return"";for(var n=t.replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s=0;sthis.textWidth&&(this.textWidth=c.width),s+=t.lineHeight*i,e=e.substr(c.text.length+1)}while(!1===c.end);this.textHeight=s;for(var r=0,o=0,a=this.textWidth*this.anchor.x,h=this.textHeight*this.anchor.y,l=0;l0&&(this._fontSize=t,this.updateText())}}),Object.defineProperty(n.BitmapText.prototype,"text",{get:function(){return this._text},set:function(t){t!==this._text&&(this._text=t.toString()||"",this.updateText())}}),Object.defineProperty(n.BitmapText.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){t!==this._maxWidth&&(this._maxWidth=t,this.updateText())}}),Object.defineProperty(n.BitmapText.prototype,"smoothed",{get:function(){return!this._data.base.scaleMode},set:function(t){this._data.base.scaleMode=t?0:1,this._data.base.dirty()}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.RetroFont=function(t,e,i,n,r,o,a,h,l,u){if(!t.cache.checkImageKey(e))return!1;null==o&&(o=t.cache.getImage(e).width/i),this.characterWidth=i,this.characterHeight=n,this.characterSpacingX=a||0,this.characterSpacingY=h||0,this.characterPerRow=o,this.offsetX=l||0,this.offsetY=u||0,this.align="left",this.multiLine=!1,this.autoUpperCase=!0,this.customSpacingX=0,this.customSpacingY=0,this.fixedWidth=0,this.fontSet=t.cache.getImage(e),this._text="",this.grabData=[],this.frameData=new s.FrameData;for(var c=this.offsetX,d=this.offsetY,p=0,f=0;f?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",s.RetroFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.RetroFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",s.RetroFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",s.RetroFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",s.RetroFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",s.RetroFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",s.RetroFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.RetroFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",s.RetroFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s.RetroFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",s.RetroFont.prototype.setFixedWidth=function(t,e){void 0===e&&(e="left"),this.fixedWidth=t,this.align=e},s.RetroFont.prototype.setText=function(t,e,i,n,s,r){this.multiLine=e||!1,this.customSpacingX=i||0,this.customSpacingY=n||0,this.align=s||"left",this.autoUpperCase=!r,t.length>0&&(this.text=t)},s.RetroFont.prototype.buildRetroFontText=function(){var t=0,e=0;if(this.clear(),this.multiLine){var i=this._text.split("\n");this.fixedWidth>0?this.resize(this.fixedWidth,i.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY,!0):this.resize(this.getLongestLine()*(this.characterWidth+this.customSpacingX),i.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY,!0);for(var n=0;n0?this.resize(this.fixedWidth,this.characterHeight,!0):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight,!0),t=0,this.align===s.RetroFont.ALIGN_RIGHT?t=this.width-this._text.length*(this.characterWidth+this.customSpacingX):this.align===s.RetroFont.ALIGN_CENTER&&(t=this.width/2-this._text.length*(this.characterWidth+this.customSpacingX)/2,t+=this.customSpacingX/2),t<0&&(t=0),this.pasteLine(this._text,t,0,this.customSpacingX);this.requiresReTint=!0},s.RetroFont.prototype.pasteLine=function(t,e,i,n){for(var s=0;s=0&&(this.stamp.frame=this.grabData[t.charCodeAt(s)],this.renderXY(this.stamp,e,i,!1),(e+=this.characterWidth+n)>this.width))break},s.RetroFont.prototype.getLongestLine=function(){var t=0;if(this._text.length>0)for(var e=this._text.split("\n"),i=0;it&&(t=e[i].length);return t},s.RetroFont.prototype.removeUnsupportedCharacters=function(t){for(var e="",i=0;i=0||!t&&"\n"===n)&&(e=e.concat(n))}return e},s.RetroFont.prototype.updateOffset=function(t,e){if(this.offsetX!==t||this.offsetY!==e){for(var i=t-this.offsetX,n=e-this.offsetY,s=this.game.cache.getFrameData(this.stamp.key).getFrames(),r=s.length;r--;)s[r].x+=i,s[r].y+=n;this.buildRetroFontText()}},Object.defineProperty(s.RetroFont.prototype,"text",{get:function(){return this._text},set:function(t){var e;(e=this.autoUpperCase?t.toUpperCase():t)!==this._text&&(this._text=e,this.removeUnsupportedCharacters(this.multiLine),this.buildRetroFontText())}}),Object.defineProperty(s.RetroFont.prototype,"smoothed",{get:function(){return this.stamp.smoothed},set:function(t){this.stamp.smoothed=t,this.buildRetroFontText()}}), +n.RetroFont=function(t,e,i,s,r,o,a,h,l,c){if(!t.cache.checkImageKey(e))return!1;null==o&&(o=t.cache.getImage(e).width/i),this.characterWidth=i,this.characterHeight=s,this.characterSpacingX=a||0,this.characterSpacingY=h||0,this.characterPerRow=o,this.offsetX=l||0,this.offsetY=c||0,this.align="left",this.multiLine=!1,this.autoUpperCase=!0,this.customSpacingX=0,this.customSpacingY=0,this.fixedWidth=0,this.fontSet=t.cache.getImage(e),this._text="",this.grabData=[],this.frameData=new n.FrameData;for(var u=this.offsetX,d=this.offsetY,p=0,f=0;f?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",n.RetroFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",n.RetroFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",n.RetroFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",n.RetroFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",n.RetroFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",n.RetroFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",n.RetroFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",n.RetroFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",n.RetroFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n.RetroFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",n.RetroFont.prototype.setFixedWidth=function(t,e){void 0===e&&(e="left"),this.fixedWidth=t,this.align=e},n.RetroFont.prototype.setText=function(t,e,i,n,s,r){this.multiLine=e||!1,this.customSpacingX=i||0,this.customSpacingY=n||0,this.align=s||"left",this.autoUpperCase=!r,t.length>0&&(this.text=t)},n.RetroFont.prototype.buildRetroFontText=function(){var t=0,e=0;if(this.clear(),this.multiLine){var i=this._text.split("\n");this.fixedWidth>0?this.resize(this.fixedWidth,i.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY,!0):this.resize(this.getLongestLine()*(this.characterWidth+this.customSpacingX),i.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY,!0);for(var s=0;s0?this.resize(this.fixedWidth,this.characterHeight,!0):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight,!0),t=0,this.align===n.RetroFont.ALIGN_RIGHT?t=this.width-this._text.length*(this.characterWidth+this.customSpacingX):this.align===n.RetroFont.ALIGN_CENTER&&(t=this.width/2-this._text.length*(this.characterWidth+this.customSpacingX)/2,t+=this.customSpacingX/2),t<0&&(t=0),this.pasteLine(this._text,t,0,this.customSpacingX);this.requiresReTint=!0},n.RetroFont.prototype.pasteLine=function(t,e,i,n){for(var s=0;s=0&&(this.stamp.frame=this.grabData[t.charCodeAt(s)],this.renderXY(this.stamp,e,i,!1),(e+=this.characterWidth+n)>this.width))break},n.RetroFont.prototype.getLongestLine=function(){var t=0;if(this._text.length>0)for(var e=this._text.split("\n"),i=0;it&&(t=e[i].length);return t},n.RetroFont.prototype.removeUnsupportedCharacters=function(t){for(var e="",i=0;i=0||!t&&"\n"===n)&&(e=e.concat(n))}return e},n.RetroFont.prototype.updateOffset=function(t,e){if(this.offsetX!==t||this.offsetY!==e){for(var i=t-this.offsetX,n=e-this.offsetY,s=this.game.cache.getFrameData(this.stamp.key).getFrames(),r=s.length;r--;)s[r].x+=i,s[r].y+=n;this.buildRetroFontText()}},Object.defineProperty(n.RetroFont.prototype,"text",{get:function(){return this._text},set:function(t){var e;(e=this.autoUpperCase?t.toUpperCase():t)!==this._text&&(this._text=e,this.removeUnsupportedCharacters(this.multiLine),this.buildRetroFontText())}}),Object.defineProperty(n.RetroFont.prototype,"smoothed",{get:function(){return this.stamp.smoothed},set:function(t){this.stamp.smoothed=t,this.buildRetroFontText()}}), /** * @author Richard Davey * @author Mat Groves (@Doormat23) @@ -467,441 +445,456 @@ s.RetroFont=function(t,e,i,n,r,o,a,h,l,u){if(!t.cache.checkImageKey(e))return!1; * @copyright 2016 Photon Storm Ltd, Richard Davey * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Rope=function(t,e,i,n,r,o){this.points=o||[],this._hasUpdateAnimation=!1,this._updateAnimationCallback=null,e=e||0,i=i||0,n=n||null,r=r||null,this.type=s.ROPE,PIXI.DisplayObjectContainer.call(this),this.texture=s.Cache.DEFAULT,this.uvs=new Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new Float32Array([0,0,100,0,100,100,0,100]),this.colors=new Float32Array([1,1,1,1]),this.indices=new Uint16Array([0,1,2,3]),o&&(this.vertices=new Float32Array(4*o.length),this.uvs=new Float32Array(4*o.length),this.colors=new Float32Array(2*o.length),this.indices=new Uint16Array(2*o.length)),this.dirty=!0,this.canvasPadding=0,this.drawMode=s.Rope.TRIANGLE_STRIP,s.Component.Core.init.call(this,t,e,i,n,r),this.refresh()},s.Rope.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),s.Rope.prototype.constructor=s.Rope,s.Component.Core.install.call(s.Rope.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Delta","Destroy","FixedToCamera","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","ScaleMinMax","Smoothed"]),s.Rope.prototype.preUpdatePhysics=s.Component.PhysicsBody.preUpdate,s.Rope.prototype.preUpdateLifeSpan=s.Component.LifeSpan.preUpdate,s.Rope.prototype.preUpdateInWorld=s.Component.InWorld.preUpdate,s.Rope.prototype.preUpdateCore=s.Component.Core.preUpdate,s.Rope.TRIANGLE_STRIP=0,s.Rope.TRIANGLES=1,s.Rope.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},s.Rope.prototype.update=function(){this._hasUpdateAnimation&&this.updateAnimation.call(this)},s.Rope.prototype.reset=function(t,e){return s.Component.Reset.prototype.reset.call(this,t,e),this},s.Rope.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,i=this.indices,n=this.colors;this.count-=.2;for(var s=t.length,r=0,o=0,a=0;a0){var w=this.canvasPadding/this.worldTransform.a,_=this.canvasPadding/this.worldTransform.d,C=(l+u+c)/3,S=(d+p+f)/3,T=l-C,A=d-S,E=Math.sqrt(T*T+A*A);l=C+T/E*(E+w),d=S+A/E*(E+_),A=p-S,u=C+(T=u-C)/(E=Math.sqrt(T*T+A*A))*(E+w),p=S+A/E*(E+_),A=f-S,c=C+(T=c-C)/(E=Math.sqrt(T*T+A*A))*(E+w),f=S+A/E*(E+_)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(u,p),t.lineTo(c,f),t.closePath(),t.clip();var P=g*x+v*y+m*b-x*y-v*m-g*b,D=l*x+v*c+u*b-x*c-v*u-l*b,k=g*u+l*y+m*c-u*y-l*m-g*c,M=g*x*c+v*u*y+l*m*b-l*x*y-v*m*c-g*u*b,B=d*x+v*f+p*b-x*f-v*p-d*b,F=g*p+d*y+m*f-p*y-d*m-g*f,I=g*x*f+v*p*y+d*m*b-d*x*y-v*m*f-g*p*b;t.transform(D/P,B/P,k/P,F/P,M/P,I/P),t.drawImage(o,0,0),t.restore()},s.Rope.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,n=i.length/2;this.count++,e.beginPath();for(var s=1;sl?y:l,u=v>u?v:u}if(c===-1/0||u===1/0)return s.EmptyRectangle;var x=this._bounds;return x.x=c,x.width=l-c,x.y=d,x.height=u-d,this._currentBounds=x,x},Object.defineProperty(s.Rope.prototype,"updateAnimation",{get:function(){return this._updateAnimation},set:function(t){t&&"function"==typeof t?(this._hasUpdateAnimation=!0,this._updateAnimation=t):(this._hasUpdateAnimation=!1,this._updateAnimation=null)}}),Object.defineProperty(s.Rope.prototype,"segments",{get:function(){for(var t,e,i,n,r,o,a,h,l=[],u=0;u0){var w=this.canvasPadding/this.worldTransform.a,_=this.canvasPadding/this.worldTransform.d,T=(l+c+u)/3,C=(d+p+f)/3,S=l-T,P=d-C,A=Math.sqrt(S*S+P*P);l=T+S/A*(A+w),d=C+P/A*(A+_),P=p-C,c=T+(S=c-T)/(A=Math.sqrt(S*S+P*P))*(A+w),p=C+P/A*(A+_),P=f-C,u=T+(S=u-T)/(A=Math.sqrt(S*S+P*P))*(A+w),f=C+P/A*(A+_)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(c,p),t.lineTo(u,f),t.closePath(),t.clip();var E=g*b+v*y+m*x-b*y-v*m-g*x,M=l*b+v*u+c*x-b*u-v*c-l*x,k=g*c+l*y+m*u-c*y-l*m-g*u,L=g*b*u+v*c*y+l*m*x-l*b*y-v*m*u-g*c*x,O=d*b+v*f+p*x-b*f-v*p-d*x,I=g*p+d*y+m*f-p*y-d*m-g*f,B=g*b*f+v*p*y+d*m*x-d*b*y-v*m*f-g*p*x;t.transform(M/E,O/E,k/E,I/E,L/E,B/E),t.drawImage(o,0,0),t.restore()},n.Rope.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,n=i.length/2;this.count++,e.beginPath();for(var s=1;sl?y:l,c=v>c?v:c}if(u===-1/0||c===1/0)return n.EmptyRectangle;var b=this._bounds;return b.x=u,b.width=l-u,b.y=d,b.height=c-d,this._currentBounds=b,b},Object.defineProperty(n.Rope.prototype,"updateAnimation",{get:function(){return this._updateAnimation},set:function(t){t&&"function"==typeof t?(this._hasUpdateAnimation=!0,this._updateAnimation=t):(this._hasUpdateAnimation=!1,this._updateAnimation=null)}}),Object.defineProperty(n.Rope.prototype,"segments",{get:function(){for(var t,e,i,s,r,o,a,h,l=[],c=0;c * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.TileSprite=function(t,e,i,n,r,o,a){e=e||0,i=i||0,n=n||256,r=r||256,o=o||null,a=a||null,PIXI.Sprite.call(this,new PIXI.Texture(s.Cache.DEFAULT.baseTexture),n,r),this.type=s.TILESPRITE,this.physicsType=s.SPRITE,this._scroll=new s.Point,this.tileScale=new s.Point(1,1),this.tileScaleOffset=new s.Point(1,1),this.tilePosition=new s.Point,this.textureDebug=!1,this.canvasBuffer=null,this.tilingTexture=null,this.tilePattern=null,this.refreshTexture=!0,this.frameWidth=0,this.frameHeight=0,this._width=n,this._height=r,s.Component.Core.init.call(this,t,e,i,o,a)},s.TileSprite.prototype=Object.create(PIXI.Sprite.prototype),s.TileSprite.prototype.constructor=s.TileSprite,s.Component.Core.install.call(s.TileSprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","Smoothed"]),s.TileSprite.prototype.preUpdatePhysics=s.Component.PhysicsBody.preUpdate,s.TileSprite.prototype.preUpdateLifeSpan=s.Component.LifeSpan.preUpdate,s.TileSprite.prototype.preUpdateInWorld=s.Component.InWorld.preUpdate,s.TileSprite.prototype.preUpdateCore=s.Component.Core.preUpdate,s.TileSprite.prototype.preUpdate=function(){return 0!==this._scroll.x&&(this.tilePosition.x+=this._scroll.x*this.game.time.physicsElapsed),0!==this._scroll.y&&(this.tilePosition.y+=this._scroll.y*this.game.time.physicsElapsed),!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},s.TileSprite.prototype.autoScroll=function(t,e){return this._scroll.set(t,e),this},s.TileSprite.prototype.stopScroll=function(){return this._scroll.set(0,0),this},s.TileSprite.prototype.destroy=function(t){s.Component.Destroy.prototype.destroy.call(this,t),PIXI.Sprite.prototype.destroy.call(this),this.canvasBuffer&&(this.canvasBuffer.destroy(),this.canvasBuffer=null),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture&&(this.tilingTexture.destroy(!0),this.tilingTexture=null)},s.TileSprite.prototype.reset=function(t,e){return s.Component.Reset.prototype.reset.call(this,t,e),this.tilePosition.x=0,this.tilePosition.y=0,this},s.TileSprite.prototype.setTexture=function(t){return this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215),this},s.TileSprite.prototype._renderWebGL=function(t){if(this.visible&&this.renderable&&0!==this.alpha){if(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this.refreshTexture){if(this.generateTilingTexture(!0,t),!this.tilingTexture)return;this.tilingTexture.needsUpdate&&(this.tilingTexture.baseTexture.textureIndex=this.texture.baseTexture.textureIndex,t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)}t.spriteBatch.renderTilingSprite(this);for(var e=0;e(w=y>(w=g>(w=p>w?p:w)?g:w)?y:w)?x:w,_=b>(_=v>(_=m>(_=f>_?f:_)?m:_)?v:_)?b:_;var T=this._bounds;return T.x=C,T.width=w-C,T.y=S,T.height=_-S,this._currentBounds=T,T},Object.defineProperty(s.TileSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(s.TileSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}), +n.TileSprite=function(t,e,i,s,r,o,a){e=e||0,i=i||0,s=s||256,r=r||256,o=o||null,a=a||null,PIXI.Sprite.call(this,new PIXI.Texture(n.Cache.DEFAULT.baseTexture),s,r),this.type=n.TILESPRITE,this.physicsType=n.SPRITE,this._scroll=new n.Point,this.tileScale=new n.Point(1,1),this.tileScaleOffset=new n.Point(1,1),this.tilePosition=new n.Point,this.textureDebug=!1,this.canvasBuffer=null,this.tilingTexture=null,this.tilePattern=null,this.refreshTexture=!0,this.frameWidth=0,this.frameHeight=0,this._width=s,this._height=r,n.Component.Core.init.call(this,t,e,i,o,a)},n.TileSprite.prototype=Object.create(PIXI.Sprite.prototype),n.TileSprite.prototype.constructor=n.TileSprite,n.Component.Core.install.call(n.TileSprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","Smoothed"]),n.TileSprite.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.TileSprite.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.TileSprite.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.TileSprite.prototype.preUpdateCore=n.Component.Core.preUpdate,n.TileSprite.prototype.preUpdate=function(){return 0!==this._scroll.x&&(this.tilePosition.x+=this._scroll.x*this.game.time.physicsElapsed),0!==this._scroll.y&&(this.tilePosition.y+=this._scroll.y*this.game.time.physicsElapsed),!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.TileSprite.prototype.autoScroll=function(t,e){return this._scroll.set(t,e),this},n.TileSprite.prototype.stopScroll=function(){return this._scroll.set(0,0),this},n.TileSprite.prototype.destroy=function(t){n.Component.Destroy.prototype.destroy.call(this,t),PIXI.Sprite.prototype.destroy.call(this),this.canvasBuffer&&(this.canvasBuffer.destroy(),this.canvasBuffer=null),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture&&(this.tilingTexture.destroy(!0),this.tilingTexture=null)},n.TileSprite.prototype.reset=function(t,e){return n.Component.Reset.prototype.reset.call(this,t,e),this.tilePosition.x=0,this.tilePosition.y=0,this},n.TileSprite.prototype.setTexture=function(t){return this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215),this},n.TileSprite.prototype._renderWebGL=function(t){if(this.visible&&this.renderable&&0!==this.alpha){if(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this.refreshTexture){if(this.generateTilingTexture(!0,t),!this.tilingTexture)return;this.tilingTexture.needsUpdate&&(this.tilingTexture.baseTexture.textureIndex=this.texture.baseTexture.textureIndex,t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)}t.spriteBatch.renderTilingSprite(this);for(var e=0;e(w=y>(w=g>(w=p>w?p:w)?g:w)?y:w)?b:w,_=x>(_=v>(_=m>(_=f>_?f:_)?m:_)?v:_)?x:_;var S=this._bounds;return S.x=T,S.width=w-T,S.y=C,S.height=_-C,this._currentBounds=S,S},Object.defineProperty(n.TileSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(n.TileSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.CanvasPool={create:function(t,e,i){var n,r=s.CanvasPool.getFirst();if(-1===r){var o={parent:t,canvas:document.createElement("canvas")};s.CanvasPool.pool.push(o),n=o.canvas}else s.CanvasPool.pool[r].parent=t,n=s.CanvasPool.pool[r].canvas;return void 0!==e&&(n.width=e,n.height=i),n},getFirst:function(){for(var t=s.CanvasPool.pool,e=0;e * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Device=function(){this.deviceReadyAt=0,this.initialized=!1,this.desktop=!1,this.iOS=!1,this.iOSVersion=0,this.cocoonJS=!1,this.cocoonJSApp=!1,this.cordova=!1,this.node=!1,this.nodeWebkit=!1,this.electron=!1,this.ejecta=!1,this.crosswalk=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.windowsPhone=!1,this.canvas=!1,this.canvasBitBltShift=null,this.canHandleAlpha=!1,this.canUseMultiply=!1,this.webGL=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.worker=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.getUserMedia=!0,this.quirksMode=!1,this.touch=!1,this.mspointer=!1,this.wheelEvent=null,this.arora=!1,this.chrome=!1,this.chromeVersion=0,this.epiphany=!1,this.firefox=!1,this.firefoxVersion=0,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.edge=!1,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.safariVersion=0,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.dolby=!1,this.oggVideo=!1,this.h264Video=!1,this.mp4Video=!1,this.webmVideo=!1,this.vp9Video=!1,this.hlsVideo=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this.LITTLE_ENDIAN=!1,this.support32bit=!1,this.fullscreen=!1,this.requestFullscreen="",this.cancelFullscreen="",this.fullscreenKeyboard=!1},s.Device=new s.Device,s.Device.onInitialized=new s.Signal,s.Device.whenReady=function(t,e,i){var n=this._readyCheck;if(this.deviceReadyAt||!n)t.call(e,this);else if(n._monitor||i)n._queue=n._queue||[],n._queue.push([t,e]);else{n._monitor=n.bind(this),n._queue=n._queue||[],n._queue.push([t,e]);var s=void 0!==window.cordova,r=navigator.isCocoonJS;"complete"===document.readyState||"interactive"===document.readyState?window.setTimeout(n._monitor,0):s&&!r?document.addEventListener("deviceready",n._monitor,!1):(document.addEventListener("DOMContentLoaded",n._monitor,!1),window.addEventListener("load",n._monitor,!1))}},s.Device._readyCheck=function(){var t=this._readyCheck;if(document.body){if(!this.deviceReadyAt){var e;for(this.deviceReadyAt=Date.now(),document.removeEventListener("deviceready",t._monitor),document.removeEventListener("DOMContentLoaded",t._monitor),window.removeEventListener("load",t._monitor),this._initialize(),this.initialized=!0,this.onInitialized.dispatch(this);e=t._queue.shift();){var i=e[0],n=e[1];i.call(n,this)}this._readyCheck=null,this._initialize=null,this.onInitialized=null}}else window.setTimeout(t._monitor,20)},s.Device._initialize=function(){var t,e,n,r=this;!function(){var t=navigator.userAgent;/Playstation Vita/.test(t)?r.vita=!0:/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?r.kindle=!0:/Android/.test(t)?r.android=!0:/CrOS/.test(t)?r.chromeOS=!0:/iP[ao]d|iPhone/i.test(t)?(r.iOS=!0,navigator.appVersion.match(/OS (\d+)/),r.iOSVersion=parseInt(RegExp.$1,10)):/Linux/.test(t)?r.linux=!0:/Mac OS/.test(t)?r.macOS=!0:/Windows/.test(t)&&(r.windows=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(r.android=!1,r.iOS=!1,r.macOS=!1,r.windows=!0,r.windowsPhone=!0);var e=/Silk/.test(t);(r.windows||r.macOS||r.linux&&!e||r.chromeOS)&&(r.desktop=!0),(r.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(r.desktop=!1)}(),function(){var t=navigator.userAgent;if(/Arora/.test(t)?r.arora=!0:/Edge\/\d+/.test(t)?r.edge=!0:/Chrome\/(\d+)/.test(t)&&!r.windowsPhone?(r.chrome=!0,r.chromeVersion=parseInt(RegExp.$1,10)):/Epiphany/.test(t)?r.epiphany=!0:/Firefox\D+(\d+)/.test(t)?(r.firefox=!0,r.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(t)&&r.iOS?r.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(t)?(r.ie=!0,r.ieVersion=parseInt(RegExp.$1,10)):/Midori/.test(t)?r.midori=!0:/Opera/.test(t)?r.opera=!0:/Safari\/(\d+)/.test(t)&&!r.windowsPhone?(r.safari=!0,/Version\/(\d+)\./.test(t)&&(r.safariVersion=parseInt(RegExp.$1,10))):/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(t)&&(r.ie=!0,r.trident=!0,r.tridentVersion=parseInt(RegExp.$1,10),r.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(t)&&(r.silk=!0),navigator.standalone&&(r.webApp=!0),void 0!==window.cordova&&(r.cordova=!0),void 0!==i&&(r.node=!0),r.node&&"object"==typeof i.versions&&(r.nodeWebkit=!!i.versions["node-webkit"],r.electron=!!i.versions.electron),navigator.isCocoonJS&&(r.cocoonJS=!0),r.cocoonJS)try{r.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){r.cocoonJSApp=!1}void 0!==window.ejecta&&(r.ejecta=!0),/Crosswalk/.test(t)&&(r.crosswalk=!0)}(),function(){r.audioData=!!window.Audio,r.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio");try{if(t.canPlayType&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(r.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(r.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(r.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(r.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(r.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(r.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(r.edge)r.dolby=!0;else if(r.safari&&r.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var e=parseInt(RegExp.$1,10),i=parseInt(RegExp.$2,10);(10===e&&i>=11||e>10)&&(r.dolby=!0)}}catch(t){}}(),function(){var t=document.createElement("video");try{t.canPlayType&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(r.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(r.h264Video=!0,r.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(r.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(r.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(r.hlsVideo=!0))}catch(t){}}(),function(){var t,e=document.createElement("p"),i={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var n in document.body.insertBefore(e,null),i)void 0!==e.style[n]&&(e.style[n]="translate3d(1px,1px,1px)",t=window.getComputedStyle(e).getPropertyValue(i[n]));document.body.removeChild(e),r.css3D=void 0!==t&&t.length>0&&"none"!==t}(),r.pixelRatio=window.devicePixelRatio||1,r.iPhone=-1!==navigator.userAgent.toLowerCase().indexOf("iphone"),r.iPhone4=2===r.pixelRatio&&r.iPhone,r.iPad=-1!==navigator.userAgent.toLowerCase().indexOf("ipad"),"undefined"!=typeof Int8Array?r.typedArray=!0:r.typedArray=!1,"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(r.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),n=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===n[0]||2712847316!==n[0]&&null),r.LITTLE_ENDIAN=r.littleEndian),r.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==r.littleEndian&&function(){if(void 0===Uint8ClampedArray)return!1;var t=s.CanvasPool.create(this,1,1).getContext("2d");if(!t)return!1;var e=t.createImageData(1,1);return s.CanvasPool.remove(this),e.data instanceof Uint8ClampedArray}(),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(r.vibration=!0),function(){r.canvas=!!window.CanvasRenderingContext2D||r.cocoonJS;try{r.localStorage=!!localStorage.getItem}catch(t){r.localStorage=!1}r.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),r.fileSystem=!!window.requestFileSystem,r.webGL=!!window.WebGLRenderingContext,r.worker=!!window.Worker,r.pointerLockElement=("pointerLockElement"in document?"pointerLockElement":"mozPointerLockElement"in document&&"mozPointerLockElement")||"webkitPointerLockElement"in document&&"webkitPointerLockElement",r.pointerlockchange=("onpointerlockchange"in document?"pointerlockchange":"onmozpointerlockchange"in document&&"mozpointerlockchange")||"onwebkitpointerlockchange"in document&&"webkitpointerlockchange",r.pointerlockerror=("onpointerlockerror"in document?"pointerlockerror":"onmozpointerlockerror"in document&&"mozpointerlockerror")||"onwebkitpointerlockerror"in document&&"webkitpointerlockerror",r.pointerLock=!!r.pointerLockElement,r.quirksMode="CSS1Compat"!==document.compatMode,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,r.getUserMedia=r.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,r.firefox&&r.firefoxVersion<21&&(r.getUserMedia=!1),!r.iOS&&(r.ie||r.firefox||r.chrome)&&(r.canvasBitBltShift=!0),(r.safari||r.mobileSafari)&&(r.canvasBitBltShift=!1)}(),function(){var t=s.CanvasPool.create(this,6,1),e=t.getContext("2d");e.fillStyle="rgba(10, 20, 30, 0.5)",e.fillRect(0,0,1,1);var i=e.getImageData(0,0,1,1);if(i){e.putImageData(i,1,0);var n=e.getImageData(1,0,1,1);r.canHandleAlpha=n.data[0]===i.data[0]&&n.data[1]===i.data[1]&&n.data[2]===i.data[2]&&n.data[3]===i.data[3]}e.globalCompositeOperation="multiply",r.canUseMultiply="multiply"===e.globalCompositeOperation,s.CanvasPool.removeByCanvas(t),PIXI.CanvasTinter.tintMethod=r.canUseMultiply?PIXI.CanvasTinter.tintWithMultiply:PIXI.CanvasTinter.tintWithPerPixel}(),function(){for(var t=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],e=document.createElement("div"),i=0;i=1)&&(r.touch=!0),(window.PointerEvent||window.MSPointerEvent||window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(r.mspointer=!0),r.cocoonJS||("onwheel"in window||r.ie&&"WheelEvent"in window?r.wheelEvent="wheel":"onmousewheel"in window?r.wheelEvent="mousewheel":r.firefox&&"MouseScrollEvent"in window&&(r.wheelEvent="DOMMouseScroll"))},s.Device.canPlayAudio=function(t){return!("mp3"!==t||!this.mp3)||(!("ogg"!==t||!this.ogg&&!this.opus)||(!("m4a"!==t||!this.m4a)||(!("opus"!==t||!this.opus)||(!("wav"!==t||!this.wav)||(!("webm"!==t||!this.webm)||!("mp4"!==t||!this.dolby))))))},s.Device.canPlayVideo=function(t){return!("webm"!==t||!this.webmVideo&&!this.vp9Video)||(!("mp4"!==t||!this.mp4Video&&!this.h264Video)||(!("ogg"!==t&&"ogv"!==t||!this.oggVideo)||!("mpeg"!==t||!this.hlsVideo)))},s.Device.needsTouchUnlock=function(){return!!(!this.cocoonJS&&(this.iOS||this.android)||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)},s.Device.isAndroidStockBrowser=function(){var t=window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.]+)/);return t&&t[1]<537}, +n.Device=function(){this.deviceReadyAt=0,this.initialized=!1,this.desktop=!1,this.iOS=!1,this.iOSVersion=0,this.cocoonJS=!1,this.cocoonJSApp=!1,this.cordova=!1,this.node=!1,this.nodeWebkit=!1,this.electron=!1,this.ejecta=!1,this.crosswalk=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.windowsPhone=!1,this.canvas=!1,this.canvasBitBltShift=null,this.canHandleAlpha=!1,this.canUseMultiply=!1,this.webGL=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.worker=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.getUserMedia=!0,this.quirksMode=!1,this.touch=!1,this.mspointer=!1,this.wheelEvent=null,this.arora=!1,this.chrome=!1,this.chromeVersion=0,this.epiphany=!1,this.firefox=!1,this.firefoxVersion=0,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.edge=!1,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.safariVersion=0,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.dolby=!1,this.oggVideo=!1,this.h264Video=!1,this.mp4Video=!1,this.webmVideo=!1,this.vp9Video=!1,this.hlsVideo=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this.LITTLE_ENDIAN=!1,this.support32bit=!1,this.fullscreen=!1,this.requestFullscreen="",this.cancelFullscreen="",this.fullscreenKeyboard=!1},n.Device=new n.Device,n.Device.onInitialized=new n.Signal,n.Device.whenReady=function(t,e,i){var n=this._readyCheck;if(this.deviceReadyAt||!n)t.call(e,this);else if(n._monitor||i)n._queue=n._queue||[],n._queue.push([t,e]);else{n._monitor=n.bind(this),n._queue=n._queue||[],n._queue.push([t,e]);var s=void 0!==window.cordova,r=navigator.isCocoonJS;"complete"===document.readyState||"interactive"===document.readyState?window.setTimeout(n._monitor,0):s&&!r?document.addEventListener("deviceready",n._monitor,!1):(document.addEventListener("DOMContentLoaded",n._monitor,!1),window.addEventListener("load",n._monitor,!1))}},n.Device._readyCheck=function(){var t=this._readyCheck;if(document.body){if(!this.deviceReadyAt){var e;for(this.deviceReadyAt=Date.now(),document.removeEventListener("deviceready",t._monitor),document.removeEventListener("DOMContentLoaded",t._monitor),window.removeEventListener("load",t._monitor),this._initialize(),this.initialized=!0,this.onInitialized.dispatch(this);e=t._queue.shift();){var i=e[0],n=e[1];i.call(n,this)}this._readyCheck=null,this._initialize=null,this.onInitialized=null}}else window.setTimeout(t._monitor,20)},n.Device._initialize=function(){var t,e,i,s=this;!function(){var t=navigator.userAgent;/Playstation Vita/.test(t)?s.vita=!0:/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?s.kindle=!0:/Android/.test(t)?s.android=!0:/CrOS/.test(t)?s.chromeOS=!0:/iP[ao]d|iPhone/i.test(t)?(s.iOS=!0,navigator.appVersion.match(/OS (\d+)/),s.iOSVersion=parseInt(RegExp.$1,10)):/Linux/.test(t)?s.linux=!0:/Mac OS/.test(t)?s.macOS=!0:/Windows/.test(t)&&(s.windows=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(s.android=!1,s.iOS=!1,s.macOS=!1,s.windows=!0,s.windowsPhone=!0);var e=/Silk/.test(t);(s.windows||s.macOS||s.linux&&!e||s.chromeOS)&&(s.desktop=!0),(s.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(s.desktop=!1)}(),function(){var t=navigator.userAgent;if(/Arora/.test(t)?s.arora=!0:/Edge\/\d+/.test(t)?s.edge=!0:/Chrome\/(\d+)/.test(t)&&!s.windowsPhone?(s.chrome=!0,s.chromeVersion=parseInt(RegExp.$1,10)):/Epiphany/.test(t)?s.epiphany=!0:/Firefox\D+(\d+)/.test(t)?(s.firefox=!0,s.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(t)&&s.iOS?s.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(t)?(s.ie=!0,s.ieVersion=parseInt(RegExp.$1,10)):/Midori/.test(t)?s.midori=!0:/Opera/.test(t)?s.opera=!0:/Safari\/(\d+)/.test(t)&&!s.windowsPhone?(s.safari=!0,/Version\/(\d+)\./.test(t)&&(s.safariVersion=parseInt(RegExp.$1,10))):/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(t)&&(s.ie=!0,s.trident=!0,s.tridentVersion=parseInt(RegExp.$1,10),s.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(t)&&(s.silk=!0),navigator.standalone&&(s.webApp=!0),void 0!==window.cordova&&(s.cordova=!0),"undefined"!=typeof process&&(s.node=!0),s.node&&"object"==typeof process.versions&&(s.nodeWebkit=!!process.versions["node-webkit"],s.electron=!!process.versions.electron),navigator.isCocoonJS&&(s.cocoonJS=!0),s.cocoonJS)try{s.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){s.cocoonJSApp=!1}void 0!==window.ejecta&&(s.ejecta=!0),/Crosswalk/.test(t)&&(s.crosswalk=!0)}(),function(){s.audioData=!!window.Audio,s.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio");try{if(t.canPlayType&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(s.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(s.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(s.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(s.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(s.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(s.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(s.edge)s.dolby=!0;else if(s.safari&&s.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var e=parseInt(RegExp.$1,10),i=parseInt(RegExp.$2,10);(10===e&&i>=11||e>10)&&(s.dolby=!0)}}catch(t){}}(),function(){var t=document.createElement("video");try{t.canPlayType&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(s.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(s.h264Video=!0,s.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(s.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(s.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(s.hlsVideo=!0))}catch(t){}}(),function(){var t,e=document.createElement("p"),i={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var n in document.body.insertBefore(e,null),i)void 0!==e.style[n]&&(e.style[n]="translate3d(1px,1px,1px)",t=window.getComputedStyle(e).getPropertyValue(i[n]));document.body.removeChild(e),s.css3D=void 0!==t&&t.length>0&&"none"!==t}(),s.pixelRatio=window.devicePixelRatio||1,s.iPhone=-1!==navigator.userAgent.toLowerCase().indexOf("iphone"),s.iPhone4=2===s.pixelRatio&&s.iPhone,s.iPad=-1!==navigator.userAgent.toLowerCase().indexOf("ipad"),"undefined"!=typeof Int8Array?s.typedArray=!0:s.typedArray=!1,"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(s.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null),s.LITTLE_ENDIAN=s.littleEndian),s.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==s.littleEndian&&function(){if(void 0===Uint8ClampedArray)return!1;var t=n.CanvasPool.create(this,1,1).getContext("2d");if(!t)return!1;var e=t.createImageData(1,1);return n.CanvasPool.remove(this),e.data instanceof Uint8ClampedArray}(),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(s.vibration=!0),function(){s.canvas=!!window.CanvasRenderingContext2D||s.cocoonJS;try{s.localStorage=!!localStorage.getItem}catch(t){s.localStorage=!1}s.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),s.fileSystem=!!window.requestFileSystem,s.webGL=!!window.WebGLRenderingContext,s.worker=!!window.Worker,s.pointerLockElement=("pointerLockElement"in document?"pointerLockElement":"mozPointerLockElement"in document&&"mozPointerLockElement")||"webkitPointerLockElement"in document&&"webkitPointerLockElement",s.pointerlockchange=("onpointerlockchange"in document?"pointerlockchange":"onmozpointerlockchange"in document&&"mozpointerlockchange")||"onwebkitpointerlockchange"in document&&"webkitpointerlockchange",s.pointerlockerror=("onpointerlockerror"in document?"pointerlockerror":"onmozpointerlockerror"in document&&"mozpointerlockerror")||"onwebkitpointerlockerror"in document&&"webkitpointerlockerror",s.pointerLock=!!s.pointerLockElement,s.quirksMode="CSS1Compat"!==document.compatMode,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,s.getUserMedia=s.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,s.firefox&&s.firefoxVersion<21&&(s.getUserMedia=!1),!s.iOS&&(s.ie||s.firefox||s.chrome)&&(s.canvasBitBltShift=!0),(s.safari||s.mobileSafari)&&(s.canvasBitBltShift=!1)}(),function(){var t=n.CanvasPool.create(this,6,1),e=t.getContext("2d");e.fillStyle="rgba(10, 20, 30, 0.5)",e.fillRect(0,0,1,1);var i=e.getImageData(0,0,1,1);if(i){e.putImageData(i,1,0);var r=e.getImageData(1,0,1,1);s.canHandleAlpha=r.data[0]===i.data[0]&&r.data[1]===i.data[1]&&r.data[2]===i.data[2]&&r.data[3]===i.data[3]}e.globalCompositeOperation="multiply",s.canUseMultiply="multiply"===e.globalCompositeOperation,n.CanvasPool.removeByCanvas(t),PIXI.CanvasTinter.tintMethod=s.canUseMultiply?PIXI.CanvasTinter.tintWithMultiply:PIXI.CanvasTinter.tintWithPerPixel}(),function(){for(var t=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],e=document.createElement("div"),i=0;i=1)&&(s.touch=!0),(window.PointerEvent||window.MSPointerEvent||window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(s.mspointer=!0),s.cocoonJS||("onwheel"in window||s.ie&&"WheelEvent"in window?s.wheelEvent="wheel":"onmousewheel"in window?s.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(s.wheelEvent="DOMMouseScroll"))},n.Device.canPlayAudio=function(t){return!("mp3"!==t||!this.mp3)||(!("ogg"!==t||!this.ogg&&!this.opus)||(!("m4a"!==t||!this.m4a)||(!("opus"!==t||!this.opus)||(!("wav"!==t||!this.wav)||(!("webm"!==t||!this.webm)||!("mp4"!==t||!this.dolby))))))},n.Device.canPlayVideo=function(t){return!("webm"!==t||!this.webmVideo&&!this.vp9Video)||(!("mp4"!==t||!this.mp4Video&&!this.h264Video)||(!("ogg"!==t&&"ogv"!==t||!this.oggVideo)||!("mpeg"!==t||!this.hlsVideo)))},n.Device.needsTouchUnlock=function(){return!!(!this.cocoonJS&&(this.iOS||this.android)||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)},n.Device.isAndroidStockBrowser=function(){var t=window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.]+)/);return t&&t[1]<537}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Canvas={create:function(t,e,i,n,r){e=e||256,i=i||256;var o=r?document.createElement("canvas"):s.CanvasPool.create(t,e,i);return"string"==typeof n&&""!==n&&(o.id=n),o.width=e,o.height=i,o.style.display="block",o},setBackgroundColor:function(t,e){return e=e||"rgb(0,0,0)",t.style.backgroundColor=e,t},setTouchAction:function(t,e){return e=e||"none",t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t},setUserSelect:function(t,e){return e=e||"none",t.style["-webkit-touch-callout"]=e,t.style["-webkit-user-select"]=e,t.style["-khtml-user-select"]=e,t.style["-moz-user-select"]=e,t.style["-ms-user-select"]=e,t.style["user-select"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t},addToDOM:function(t,e,i){var n;return void 0===i&&(i=!0),e&&("string"==typeof e?n=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(n=e)),n||(n=document.body),i&&n.style&&(n.style.overflow="hidden"),n.appendChild(t),t},removeFromDOM:function(t){t.parentNode&&t.parentNode.removeChild(t)},setTransform:function(t,e,i,n,s,r,o){return t.setTransform(n,r,o,s,e,i),t},setSmoothingEnabled:function(t,e){var i=s.Canvas.getSmoothingPrefix(t);return i&&(t[i]=e),t},getSmoothingPrefix:function(t){var e=["i","webkitI","msI","mozI","oI"];for(var i in e){var n=e[i]+"mageSmoothingEnabled";if(n in t)return n}return null},getSmoothingEnabled:function(t){var e=s.Canvas.getSmoothingPrefix(t);if(e)return t[e]},setImageRenderingCrisp:function(t){for(var e=["-webkit-optimize-contrast","-moz-crisp-edges","crisp-edges","pixelated"],i=0;i * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.RequestAnimationFrame=function(t,e){void 0===e&&(e=!1),this.game=t,this.isRunning=!1,this.forceSetTimeOut=e;for(var i=["ms","moz","webkit","o"],n=0;n * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Math={PI2:2*Math.PI,HALF_PI:.5*Math.PI,DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,degToRad:function(t){return t*s.Math.DEG_TO_RAD},radToDeg:function(t){return t*s.Math.RAD_TO_DEG},getNextPowerOfTwo:function(t){if(t>0&&0==(t&t-1))return t;for(var e=1;e0&&0==(t&t-1)&&e>0&&0==(e&e-1)},random:function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=1),t===e)return t;if(t>e){var i=t;t=e,e=i}return Math.random()*(e-t)+t},between:function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=1),t===e)return t;if(t>e){var i=t;t=e,e=i}return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t},fuzzyEqual:function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)e-i},fuzzyCeil:function(t,e){return void 0===e&&(e=1e-4),Math.ceil(t-e)},fuzzyFloor:function(t,e){return void 0===e&&(e=1e-4),Math.floor(t+e)},average:function(){for(var t=0,e=arguments.length,i=0;i=s.Math.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e=0?t:t+2*Math.PI},maxAdd:function(t,e,i){return Math.min(t+e,i)},minSub:function(t,e,i){return Math.max(t-e,i)},wrap:function(t,e,i){var n=i-e;if(n<=0)return 0;var s=(t-e)%n;return s<0&&(s+=n),s+e},wrapValue:function(t,e,i){return((t=Math.abs(t))+(e=Math.abs(e)))%(i=Math.abs(i))},isOdd:function(t){return!!(1&t)},isEven:function(t){return!(1&t)},min:function(){if(1===arguments.length&&"object"==typeof arguments[0])var t=arguments[0];else t=arguments;for(var e=1,i=0,n=t.length;et[i]&&(i=e);return t[i]},minProperty:function(t){if(2===arguments.length&&"object"==typeof arguments[1])var e=arguments[1];else e=arguments.slice(1);for(var i=1,n=0,s=e.length;ie[n][t]&&(n=i);return e[n][t]},wrapAngle:function(t,e){return e?this.wrap(t,-Math.PI,Math.PI):this.wrap(t,-180,180)},linearInterpolation:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n);return e<0?this.linear(t[0],t[1],n):e>1?this.linear(t[i],t[i-1],i-n):this.linear(t[s],t[s+1>i?i:s+1],n-s)},bezierInterpolation:function(t,e){for(var i=0,n=t.length-1,s=0;s<=n;s++)i+=Math.pow(1-e,n-s)*Math.pow(e,s)*t[s]*this.bernstein(n,s);return i},catmullRomInterpolation:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n);return t[0]===t[i]?(e<0&&(s=Math.floor(n=i*(1+e))),this.catmullRom(t[(s-1+i)%i],t[s],t[(s+1)%i],t[(s+2)%i],n-s)):e<0?t[0]-(this.catmullRom(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(this.catmullRom(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):this.catmullRom(t[s?s-1:0],t[s],t[i0?Math.ceil(t):Math.floor(t)},sinCosGenerator:function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1);for(var s=e,r=i,o=n*Math.PI/t,a=[],h=[],l=0;l0?1:0},percent:function(t,e,i){return void 0===i&&(i=0),t>e||i>e?1:tt?0:(t-i)/e}}, +n.Math={PI2:2*Math.PI,HALF_PI:.5*Math.PI,DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,degToRad:function(t){return t*n.Math.DEG_TO_RAD},radToDeg:function(t){return t*n.Math.RAD_TO_DEG},getNextPowerOfTwo:function(t){if(t>0&&0==(t&t-1))return t;for(var e=1;e0&&0==(t&t-1)&&e>0&&0==(e&e-1)},random:function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=1),t===e)return t;if(t>e){var i=t;t=e,e=i}return Math.random()*(e-t)+t},between:function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=1),t===e)return t;if(t>e){var i=t;t=e,e=i}return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t},fuzzyEqual:function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)e-i},fuzzyCeil:function(t,e){return void 0===e&&(e=1e-4),Math.ceil(t-e)},fuzzyFloor:function(t,e){return void 0===e&&(e=1e-4),Math.floor(t+e)},average:function(){for(var t=0,e=arguments.length,i=0;i=n.Math.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e=0?t:t+2*Math.PI},maxAdd:function(t,e,i){return Math.min(t+e,i)},minSub:function(t,e,i){return Math.max(t-e,i)},wrap:function(t,e,i){var n=i-e;if(n<=0)return 0;var s=(t-e)%n;return s<0&&(s+=n),s+e},wrapValue:function(t,e,i){return((t=Math.abs(t))+(e=Math.abs(e)))%(i=Math.abs(i))},isOdd:function(t){return!!(1&t)},isEven:function(t){return!(1&t)},min:function(){if(1===arguments.length&&"object"==typeof arguments[0])var t=arguments[0];else t=arguments;for(var e=1,i=0,n=t.length;et[i]&&(i=e);return t[i]},minProperty:function(t){if(2===arguments.length&&"object"==typeof arguments[1])var e=arguments[1];else e=arguments.slice(1);for(var i=1,n=0,s=e.length;ie[n][t]&&(n=i);return e[n][t]},wrapAngle:function(t,e){return e?this.wrap(t,-Math.PI,Math.PI):this.wrap(t,-180,180)},linearInterpolation:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n);return e<0?this.linear(t[0],t[1],n):e>1?this.linear(t[i],t[i-1],i-n):this.linear(t[s],t[s+1>i?i:s+1],n-s)},bezierInterpolation:function(t,e){for(var i=0,n=t.length-1,s=0;s<=n;s++)i+=Math.pow(1-e,n-s)*Math.pow(e,s)*t[s]*this.bernstein(n,s);return i},catmullRomInterpolation:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n);return t[0]===t[i]?(e<0&&(s=Math.floor(n=i*(1+e))),this.catmullRom(t[(s-1+i)%i],t[s],t[(s+1)%i],t[(s+2)%i],n-s)):e<0?t[0]-(this.catmullRom(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(this.catmullRom(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):this.catmullRom(t[s?s-1:0],t[s],t[i0?Math.ceil(t):Math.floor(t)},sinCosGenerator:function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1);for(var s=e,r=i,o=n*Math.PI/t,a=[],h=[],l=0;l0?1:0},percent:function(t,e,i){return void 0===i&&(i=0),t>e||i>e?1:tt?0:(t-i)/e}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.RandomDataGenerator=function(t){void 0===t&&(t=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,"string"==typeof t?this.state(t):this.sow(t)},s.RandomDataGenerator.prototype={rnd:function(){var t=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|t,this.s0=this.s1,this.s1=this.s2,this.s2=t-this.c,this.s2},sow:function(t){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,t)for(var e=0;e>>0,n=(e*=n)>>>0,n+=4294967296*(e-=n);return 2.3283064365386963e-10*(n>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+11102230246251565e-32*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(t,e){return Math.floor(this.realInRange(0,e-t+1)+t)},between:function(t,e){return this.integerInRange(t,e)},realInRange:function(t,e){return this.frac()*(e-t)+t},normal:function(){return 1-2*this.frac()},uuid:function(){var t="",e="";for(e=t="";t++<36;e+=~t%5|3*t&4?(15^t?8^this.frac()*(20^t?16:4):4).toString(16):"-");return e},pick:function(t){return t[this.integerInRange(0,t.length-1)]},sign:function(){return this.pick([-1,1])},weightedPick:function(t){return t[~~(Math.pow(this.frac(),2)*(t.length-1)+.5)]},timestamp:function(t,e){return this.realInRange(t||9466848e5,e||1577862e6)},angle:function(){return this.integerInRange(-180,180)},state:function(t){return"string"==typeof t&&t.match(/^!rnd/)&&(t=t.split(","),this.c=parseFloat(t[1]),this.s0=parseFloat(t[2]),this.s1=parseFloat(t[3]),this.s2=parseFloat(t[4])),["!rnd",this.c,this.s0,this.s1,this.s2].join(",")}},s.RandomDataGenerator.prototype.constructor=s.RandomDataGenerator, +n.RandomDataGenerator=function(t){void 0===t&&(t=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,"string"==typeof t?this.state(t):this.sow(t)},n.RandomDataGenerator.prototype={rnd:function(){var t=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|t,this.s0=this.s1,this.s1=this.s2,this.s2=t-this.c,this.s2},sow:function(t){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,t)for(var e=0;e>>0,n=(e*=n)>>>0,n+=4294967296*(e-=n);return 2.3283064365386963e-10*(n>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+11102230246251565e-32*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(t,e){return Math.floor(this.realInRange(0,e-t+1)+t)},between:function(t,e){return this.integerInRange(t,e)},realInRange:function(t,e){return this.frac()*(e-t)+t},normal:function(){return 1-2*this.frac()},uuid:function(){var t="",e="";for(e=t="";t++<36;e+=~t%5|3*t&4?(15^t?8^this.frac()*(20^t?16:4):4).toString(16):"-");return e},pick:function(t){return t[this.integerInRange(0,t.length-1)]},sign:function(){return this.pick([-1,1])},weightedPick:function(t){return t[~~(Math.pow(this.frac(),2)*(t.length-1)+.5)]},timestamp:function(t,e){return this.realInRange(t||9466848e5,e||1577862e6)},angle:function(){return this.integerInRange(-180,180)},state:function(t){return"string"==typeof t&&t.match(/^!rnd/)&&(t=t.split(","),this.c=parseFloat(t[1]),this.s0=parseFloat(t[2]),this.s1=parseFloat(t[3]),this.s2=parseFloat(t[4])),["!rnd",this.c,this.s0,this.s1,this.s2].join(",")}},n.RandomDataGenerator.prototype.constructor=n.RandomDataGenerator, /** * @author Timo Hausmann * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.QuadTree=function(t,e,i,n,s,r,o){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this._empty=[],this.reset(t,e,i,n,s,r,o)},s.QuadTree.prototype={reset:function(t,e,i,n,s,r,o){this.maxObjects=s||10,this.maxLevels=r||4,this.level=o||0,this.bounds={x:Math.round(t),y:Math.round(e),width:i,height:n,subWidth:Math.floor(i/2),subHeight:Math.floor(n/2),right:Math.round(t)+Math.floor(i/2),bottom:Math.round(e)+Math.floor(n/2)},this.objects.length=0,this.nodes.length=0},populate:function(t){t.forEach(this.populateHandler,this,!0)},populateHandler:function(t){t.body&&t.exists&&this.insert(t.body)},split:function(){this.nodes[0]=new s.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[1]=new s.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[2]=new s.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[3]=new s.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1)},insert:function(t){var e,i=0;if(null==this.nodes[0]||-1===(e=this.getIndex(t))){if(this.objects.push(t),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(e=2):t.x>this.bounds.right&&(t.ythis.bounds.bottom&&(e=3)),e},retrieve:function(t){if(t instanceof s.Rectangle)var e=this.objects,i=this.getIndex(t);else{if(!t.body)return this._empty;e=this.objects,i=this.getIndex(t.body)}return this.nodes[0]&&(e=-1!==i?e.concat(this.nodes[i].retrieve(t)):(e=(e=(e=e.concat(this.nodes[0].retrieve(t))).concat(this.nodes[1].retrieve(t))).concat(this.nodes[2].retrieve(t))).concat(this.nodes[3].retrieve(t))),e},clear:function(){this.objects.length=0;for(var t=this.nodes.length;t--;)this.nodes[t].clear(),this.nodes.splice(t,1);this.nodes.length=0}},s.QuadTree.prototype.constructor=s.QuadTree, +n.QuadTree=function(t,e,i,n,s,r,o){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this._empty=[],this.reset(t,e,i,n,s,r,o)},n.QuadTree.prototype={reset:function(t,e,i,n,s,r,o){this.maxObjects=s||10,this.maxLevels=r||4,this.level=o||0,this.bounds={x:Math.round(t),y:Math.round(e),width:i,height:n,subWidth:Math.floor(i/2),subHeight:Math.floor(n/2),right:Math.round(t)+Math.floor(i/2),bottom:Math.round(e)+Math.floor(n/2)},this.objects.length=0,this.nodes.length=0},populate:function(t){t.forEach(this.populateHandler,this,!0)},populateHandler:function(t){t.body&&t.exists&&this.insert(t.body)},split:function(){this.nodes[0]=new n.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[1]=new n.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[2]=new n.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[3]=new n.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1)},insert:function(t){var e,i=0;if(null==this.nodes[0]||-1===(e=this.getIndex(t))){if(this.objects.push(t),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(e=2):t.x>this.bounds.right&&(t.ythis.bounds.bottom&&(e=3)),e},retrieve:function(t){if(t instanceof n.Rectangle)var e=this.objects,i=this.getIndex(t);else{if(!t.body)return this._empty;e=this.objects,i=this.getIndex(t.body)}return this.nodes[0]&&(e=-1!==i?e.concat(this.nodes[i].retrieve(t)):(e=(e=(e=e.concat(this.nodes[0].retrieve(t))).concat(this.nodes[1].retrieve(t))).concat(this.nodes[2].retrieve(t))).concat(this.nodes[3].retrieve(t))),e},clear:function(){this.objects.length=0;for(var t=this.nodes.length;t--;)this.nodes[t].clear(),this.nodes.splice(t,1);this.nodes.length=0}},n.QuadTree.prototype.constructor=n.QuadTree, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Net=function(t){this.game=t},s.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(t){return-1!==window.location.hostname.indexOf(t)},updateQueryString:function(t,e,i,n){void 0===i&&(i=!1),void 0!==n&&""!==n||(n=window.location.href);var s="",r=new RegExp("([?|&])"+t+"=.*?(&|#|$)(.*)","gi");if(r.test(n))s=null!=e?n.replace(r,"$1"+t+"="+e+"$2$3"):n.replace(r,"$1$3").replace(/(&|\?)$/,"");else if(null!=e){var o=-1!==n.indexOf("?")?"&":"?",a=n.split("#");n=a[0]+o+t+"="+e,a[1]&&(n+="#"+a[1]),s=n}else s=n;if(!i)return s;window.location.href=s},getQueryString:function(t){void 0===t&&(t="");var e={},i=location.search.substring(1).split("&");for(var n in i){var s=i[n].split("=");if(s.length>1){if(t&&t===this.decodeURI(s[0]))return this.decodeURI(s[1]);e[this.decodeURI(s[0])]=this.decodeURI(s[1])}}return e},decodeURI:function(t){return decodeURIComponent(t.replace(/\+/g," "))}},s.Net.prototype.constructor=s.Net, +n.Net=function(t){this.game=t},n.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(t){return-1!==window.location.hostname.indexOf(t)},updateQueryString:function(t,e,i,n){void 0===i&&(i=!1),void 0!==n&&""!==n||(n=window.location.href);var s="",r=new RegExp("([?|&])"+t+"=.*?(&|#|$)(.*)","gi");if(r.test(n))s=null!=e?n.replace(r,"$1"+t+"="+e+"$2$3"):n.replace(r,"$1$3").replace(/(&|\?)$/,"");else if(null!=e){var o=-1!==n.indexOf("?")?"&":"?",a=n.split("#");n=a[0]+o+t+"="+e,a[1]&&(n+="#"+a[1]),s=n}else s=n;if(!i)return s;window.location.href=s},getQueryString:function(t){void 0===t&&(t="");var e={},i=location.search.substring(1).split("&");for(var n in i){var s=i[n].split("=");if(s.length>1){if(t&&t===this.decodeURI(s[0]))return this.decodeURI(s[1]);e[this.decodeURI(s[0])]=this.decodeURI(s[1])}}return e},decodeURI:function(t){return decodeURIComponent(t.replace(/\+/g," "))}},n.Net.prototype.constructor=n.Net, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.TweenManager=function(t){this.game=t,this.frameBased=!1,this._tweens=[],this._add=[],this.easeMap={Power0:s.Easing.Power0,Power1:s.Easing.Power1,Power2:s.Easing.Power2,Power3:s.Easing.Power3,Power4:s.Easing.Power4,Linear:s.Easing.Linear.None,Quad:s.Easing.Quadratic.Out,Cubic:s.Easing.Cubic.Out,Quart:s.Easing.Quartic.Out,Quint:s.Easing.Quintic.Out,Sine:s.Easing.Sinusoidal.Out,Expo:s.Easing.Exponential.Out,Circ:s.Easing.Circular.Out,Elastic:s.Easing.Elastic.Out,Back:s.Easing.Back.Out,Bounce:s.Easing.Bounce.Out,"Quad.easeIn":s.Easing.Quadratic.In,"Cubic.easeIn":s.Easing.Cubic.In,"Quart.easeIn":s.Easing.Quartic.In,"Quint.easeIn":s.Easing.Quintic.In,"Sine.easeIn":s.Easing.Sinusoidal.In,"Expo.easeIn":s.Easing.Exponential.In,"Circ.easeIn":s.Easing.Circular.In,"Elastic.easeIn":s.Easing.Elastic.In,"Back.easeIn":s.Easing.Back.In,"Bounce.easeIn":s.Easing.Bounce.In,"Quad.easeOut":s.Easing.Quadratic.Out,"Cubic.easeOut":s.Easing.Cubic.Out,"Quart.easeOut":s.Easing.Quartic.Out,"Quint.easeOut":s.Easing.Quintic.Out,"Sine.easeOut":s.Easing.Sinusoidal.Out,"Expo.easeOut":s.Easing.Exponential.Out,"Circ.easeOut":s.Easing.Circular.Out,"Elastic.easeOut":s.Easing.Elastic.Out,"Back.easeOut":s.Easing.Back.Out,"Bounce.easeOut":s.Easing.Bounce.Out,"Quad.easeInOut":s.Easing.Quadratic.InOut,"Cubic.easeInOut":s.Easing.Cubic.InOut,"Quart.easeInOut":s.Easing.Quartic.InOut,"Quint.easeInOut":s.Easing.Quintic.InOut,"Sine.easeInOut":s.Easing.Sinusoidal.InOut,"Expo.easeInOut":s.Easing.Exponential.InOut,"Circ.easeInOut":s.Easing.Circular.InOut,"Elastic.easeInOut":s.Easing.Elastic.InOut,"Back.easeInOut":s.Easing.Back.InOut,"Bounce.easeInOut":s.Easing.Bounce.InOut},this.game.onPause.add(this._pauseAll,this),this.game.onResume.add(this._resumeAll,this)},s.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var t=0;t0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(t,e){return e||(e=!1),this._tweens.some((function(i){return i.target===t&&(!e||i.isRunning&&!i.pendingDelete)}))},_pauseAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t]._pause()},_resumeAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t]._resume()},pauseAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t].pause()},resumeAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t].resume(!0)},destroy:function(){this.game.onPause.remove(this._pauseAll,this),this.game.onResume.remove(this._resumeAll,this),this.game=null,this._add=null,this._tweens=null}},s.TweenManager.prototype.constructor=s.TweenManager, +n.TweenManager=function(t){this.game=t,this.frameBased=!1,this._tweens=[],this._add=[],this.easeMap={Power0:n.Easing.Power0,Power1:n.Easing.Power1,Power2:n.Easing.Power2,Power3:n.Easing.Power3,Power4:n.Easing.Power4,Linear:n.Easing.Linear.None,Quad:n.Easing.Quadratic.Out,Cubic:n.Easing.Cubic.Out,Quart:n.Easing.Quartic.Out,Quint:n.Easing.Quintic.Out,Sine:n.Easing.Sinusoidal.Out,Expo:n.Easing.Exponential.Out,Circ:n.Easing.Circular.Out,Elastic:n.Easing.Elastic.Out,Back:n.Easing.Back.Out,Bounce:n.Easing.Bounce.Out,"Quad.easeIn":n.Easing.Quadratic.In,"Cubic.easeIn":n.Easing.Cubic.In,"Quart.easeIn":n.Easing.Quartic.In,"Quint.easeIn":n.Easing.Quintic.In,"Sine.easeIn":n.Easing.Sinusoidal.In,"Expo.easeIn":n.Easing.Exponential.In,"Circ.easeIn":n.Easing.Circular.In,"Elastic.easeIn":n.Easing.Elastic.In,"Back.easeIn":n.Easing.Back.In,"Bounce.easeIn":n.Easing.Bounce.In,"Quad.easeOut":n.Easing.Quadratic.Out,"Cubic.easeOut":n.Easing.Cubic.Out,"Quart.easeOut":n.Easing.Quartic.Out,"Quint.easeOut":n.Easing.Quintic.Out,"Sine.easeOut":n.Easing.Sinusoidal.Out,"Expo.easeOut":n.Easing.Exponential.Out,"Circ.easeOut":n.Easing.Circular.Out,"Elastic.easeOut":n.Easing.Elastic.Out,"Back.easeOut":n.Easing.Back.Out,"Bounce.easeOut":n.Easing.Bounce.Out,"Quad.easeInOut":n.Easing.Quadratic.InOut,"Cubic.easeInOut":n.Easing.Cubic.InOut,"Quart.easeInOut":n.Easing.Quartic.InOut,"Quint.easeInOut":n.Easing.Quintic.InOut,"Sine.easeInOut":n.Easing.Sinusoidal.InOut,"Expo.easeInOut":n.Easing.Exponential.InOut,"Circ.easeInOut":n.Easing.Circular.InOut,"Elastic.easeInOut":n.Easing.Elastic.InOut,"Back.easeInOut":n.Easing.Back.InOut,"Bounce.easeInOut":n.Easing.Bounce.InOut},this.game.onPause.add(this._pauseAll,this),this.game.onResume.add(this._resumeAll,this)},n.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var t=0;t0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(t,e){return e||(e=!1),this._tweens.some((function(i){return i.target===t&&(!e||i.isRunning&&!i.pendingDelete)}))},_pauseAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t]._pause()},_resumeAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t]._resume()},pauseAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t].pause()},resumeAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t].resume(!0)},destroy:function(){this.game.onPause.remove(this._pauseAll,this),this.game.onResume.remove(this._resumeAll,this),this.game=null,this._add=null,this._tweens=null}},n.TweenManager.prototype.constructor=n.TweenManager, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Tween=function(t,e,i){this.game=e,this.target=t,this.manager=i,this.timeline=[],this.reverse=!1,this.timeScale=1,this.repeatCounter=0,this.pendingDelete=!1,this.onStart=new s.Signal,this.onLoop=new s.Signal,this.onRepeat=new s.Signal,this.onChildComplete=new s.Signal,this.onComplete=new s.Signal,this.isRunning=!1,this.current=0,this.properties={},this.chainedTween=null,this.isPaused=!1,this.frameBased=i.frameBased,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._pausedTime=0,this._codePaused=!1,this._hasStarted=!1},s.Tween.updateColor=function(t){s.Color.updateColor(t.target)},s.Tween.prototype={to:function(t,e,i,n,r,o,a){return(void 0===e||e<=0)&&(e=1e3),null==i&&(i=s.Easing.Default),void 0===n&&(n=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=!1),"string"==typeof i&&this.manager.easeMap[i]&&(i=this.manager.easeMap[i]),this.isRunning?(console.warn("Phaser.Tween.to cannot be called after Tween.start"),this):(this.timeline.push(new s.TweenData(this).to(t,e,i,r,o,a)),n&&this.start(),this)},from:function(t,e,i,n,r,o,a){return void 0===e&&(e=1e3),null==i&&(i=s.Easing.Default),void 0===n&&(n=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=!1),"string"==typeof i&&this.manager.easeMap[i]&&(i=this.manager.easeMap[i]),this.isRunning?(console.warn("Phaser.Tween.from cannot be called after Tween.start"),this):(this.timeline.push(new s.TweenData(this).from(t,e,i,r,o,a)),n&&this.start(),this)},start:function(t){if(void 0===t&&(t=0),this.pendingDelete)return console.warn("Phaser.Tween.start cannot be called after Tween.stop"),this;if(null===this.game||null===this.target||0===this.timeline.length||this.isRunning)return this;for(var e=0;ethis.timeline.length-1)&&(t=0),this.current=t,this.timeline[this.current].start(),this},stop:function(t){return void 0===t&&(t=!1),this.isRunning=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,t&&(this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start()),this.manager.remove(this),this},updateTweenData:function(t,e,i){if(0===this.timeline.length)return this;if(void 0===i&&(i=0),-1===i)for(var n=0;n0?arguments[t-1].chainedTween=arguments[t]:this.chainedTween=arguments[t];return this},loop:function(t){return void 0===t&&(t=!0),this.repeatCounter=t?-1:0,this},onUpdateCallback:function(t,e){return this._onUpdateCallback=t,this._onUpdateCallbackContext=e,this},pause:function(){this.isPaused=!0,this._codePaused=!0,this._pausedTime=this.game.time.time},_pause:function(){this._codePaused||(this.isPaused=!0,this._pausedTime=this.game.time.time)},resume:function(){if(this.isPaused){this.isPaused=!1,this._codePaused=!1;for(var t=0;t0?(this.repeatCounter--,this.timeline[this.current].start(),this.onRepeat.dispatch(this.target,this),!0):(this.isRunning=!1,this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start(),!1):(this.onChildComplete.dispatch(this.target,this),this.timeline[this.current].start(),!0)}},generateData:function(t,e){if(null===this.game||null===this.target)return null;void 0===t&&(t=60),void 0===e&&(e=[]);for(var i=0;ithis.timeline.length-1)&&(t=0),this.current=t,this.timeline[this.current].start(),this},stop:function(t){return void 0===t&&(t=!1),this.isRunning=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,t&&(this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start()),this.manager.remove(this),this},updateTweenData:function(t,e,i){if(0===this.timeline.length)return this;if(void 0===i&&(i=0),-1===i)for(var n=0;n0?arguments[t-1].chainedTween=arguments[t]:this.chainedTween=arguments[t];return this},loop:function(t){return void 0===t&&(t=!0),this.repeatCounter=t?-1:0,this},onUpdateCallback:function(t,e){return this._onUpdateCallback=t,this._onUpdateCallbackContext=e,this},pause:function(){this.isPaused=!0,this._codePaused=!0,this._pausedTime=this.game.time.time},_pause:function(){this._codePaused||(this.isPaused=!0,this._pausedTime=this.game.time.time)},resume:function(){if(this.isPaused){this.isPaused=!1,this._codePaused=!1;for(var t=0;t0?(this.repeatCounter--,this.timeline[this.current].start(),this.onRepeat.dispatch(this.target,this),!0):(this.isRunning=!1,this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start(),!1):(this.onChildComplete.dispatch(this.target,this),this.timeline[this.current].start(),!0)}},generateData:function(t,e){if(null===this.game||null===this.target)return null;void 0===t&&(t=60),void 0===e&&(e=[]);for(var i=0;i * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.TweenData=function(t){this.parent=t,this.game=t.game,this.vStart={},this.vStartCache={},this.vEnd={},this.vEndCache={},this.duration=1e3,this.percent=0,this.value=0,this.repeatCounter=0,this.repeatDelay=0,this.repeatTotal=0,this.interpolate=!1,this.yoyo=!1,this.yoyoDelay=0,this.inReverse=!1,this.delay=0,this.dt=0,this.startTime=null,this.easingFunction=s.Easing.Default,this.interpolationFunction=s.Math.linearInterpolation,this.interpolationContext=s.Math,this.isRunning=!1,this.isFrom=!1},s.TweenData.PENDING=0,s.TweenData.RUNNING=1,s.TweenData.LOOPED=2,s.TweenData.COMPLETE=3,s.TweenData.prototype={to:function(t,e,i,n,s,r){return this.vEnd=t,this.duration=e,this.easingFunction=i,this.delay=n,this.repeatTotal=s,this.yoyo=r,this.isFrom=!1,this},from:function(t,e,i,n,s,r){return this.vEnd=t,this.duration=e,this.easingFunction=i,this.delay=n,this.repeatTotal=s,this.yoyo=r,this.isFrom=!0,this},start:function(){if(this.startTime=this.game.time.time+this.delay,this.parent.reverse?this.dt=this.duration:this.dt=0,this.delay>0?this.isRunning=!1:this.isRunning=!0,this.isFrom)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t],this.parent.target[t]=this.vStart[t];return this.value=0,this.repeatCounter=this.repeatTotal,this},loadValues:function(){for(var t in this.parent.properties){if(this.vStart[t]=this.parent.properties[t],Array.isArray(this.vEnd[t])){if(0===this.vEnd[t].length)continue;0===this.percent&&(this.vEnd[t]=[this.vStart[t]].concat(this.vEnd[t]))}void 0!==this.vEnd[t]?("string"==typeof this.vEnd[t]&&(this.vEnd[t]=this.vStart[t]+parseFloat(this.vEnd[t])),this.parent.properties[t]=this.vEnd[t]):this.vEnd[t]=this.vStart[t],this.vStartCache[t]=this.vStart[t],this.vEndCache[t]=this.vEnd[t]}return this},update:function(t){if(this.isRunning){if(t=this.startTime))return s.TweenData.PENDING;this.isRunning=!0}var e=this.parent.frameBased?this.game.time.physicsElapsedMS:this.game.time.elapsedMS;for(var i in this.parent.reverse?(this.dt-=e*this.parent.timeScale,this.dt=Math.max(this.dt,0)):(this.dt+=e*this.parent.timeScale,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent),this.vEnd){var n=this.vStart[i],r=this.vEnd[i];Array.isArray(r)?this.parent.target[i]=this.interpolationFunction.call(this.interpolationContext,r,this.value):this.parent.target[i]=n+(r-n)*this.value}return!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent?this.repeat():s.TweenData.RUNNING},generateData:function(t){this.parent.reverse?this.dt=this.duration:this.dt=0;var e=[],i=!1,n=1/t*1e3;do{this.parent.reverse?(this.dt-=n,this.dt=Math.max(this.dt,0)):(this.dt+=n,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent);var s={};for(var r in this.vEnd){var o=this.vStart[r],a=this.vEnd[r];Array.isArray(a)?s[r]=this.interpolationFunction.call(this.interpolationContext,a,this.value):s[r]=o+(a-o)*this.value}e.push(s),(!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent)&&(i=!0)}while(!i);if(this.yoyo){var h=e.slice();h.reverse(),e=e.concat(h)}return e},repeat:function(){if(this.yoyo){if(this.inReverse&&0===this.repeatCounter){for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];return this.inReverse=!1,s.TweenData.COMPLETE}this.inReverse=!this.inReverse}else if(0===this.repeatCounter)return s.TweenData.COMPLETE;if(this.inReverse)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t];else{for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];this.repeatCounter>0&&this.repeatCounter--}return this.startTime=this.game.time.time,this.yoyo&&this.inReverse?this.startTime+=this.yoyoDelay:this.inReverse||(this.startTime+=this.repeatDelay),this.parent.reverse?this.dt=this.duration:this.dt=0,s.TweenData.LOOPED}},s.TweenData.prototype.constructor=s.TweenData, +n.TweenData=function(t){this.parent=t,this.game=t.game,this.vStart={},this.vStartCache={},this.vEnd={},this.vEndCache={},this.duration=1e3,this.percent=0,this.value=0,this.repeatCounter=0,this.repeatDelay=0,this.repeatTotal=0,this.interpolate=!1,this.yoyo=!1,this.yoyoDelay=0,this.inReverse=!1,this.delay=0,this.dt=0,this.startTime=null,this.easingFunction=n.Easing.Default,this.interpolationFunction=n.Math.linearInterpolation,this.interpolationContext=n.Math,this.isRunning=!1,this.isFrom=!1},n.TweenData.PENDING=0,n.TweenData.RUNNING=1,n.TweenData.LOOPED=2,n.TweenData.COMPLETE=3,n.TweenData.prototype={to:function(t,e,i,n,s,r){return this.vEnd=t,this.duration=e,this.easingFunction=i,this.delay=n,this.repeatTotal=s,this.yoyo=r,this.isFrom=!1,this},from:function(t,e,i,n,s,r){return this.vEnd=t,this.duration=e,this.easingFunction=i,this.delay=n,this.repeatTotal=s,this.yoyo=r,this.isFrom=!0,this},start:function(){if(this.startTime=this.game.time.time+this.delay,this.parent.reverse?this.dt=this.duration:this.dt=0,this.delay>0?this.isRunning=!1:this.isRunning=!0,this.isFrom)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t],this.parent.target[t]=this.vStart[t];return this.value=0,this.repeatCounter=this.repeatTotal,this},loadValues:function(){for(var t in this.parent.properties){if(this.vStart[t]=this.parent.properties[t],Array.isArray(this.vEnd[t])){if(0===this.vEnd[t].length)continue;0===this.percent&&(this.vEnd[t]=[this.vStart[t]].concat(this.vEnd[t]))}void 0!==this.vEnd[t]?("string"==typeof this.vEnd[t]&&(this.vEnd[t]=this.vStart[t]+parseFloat(this.vEnd[t])),this.parent.properties[t]=this.vEnd[t]):this.vEnd[t]=this.vStart[t],this.vStartCache[t]=this.vStart[t],this.vEndCache[t]=this.vEnd[t]}return this},update:function(t){if(this.isRunning){if(t=this.startTime))return n.TweenData.PENDING;this.isRunning=!0}var e=this.parent.frameBased?this.game.time.physicsElapsedMS:this.game.time.elapsedMS;for(var i in this.parent.reverse?(this.dt-=e*this.parent.timeScale,this.dt=Math.max(this.dt,0)):(this.dt+=e*this.parent.timeScale,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent),this.vEnd){var s=this.vStart[i],r=this.vEnd[i];Array.isArray(r)?this.parent.target[i]=this.interpolationFunction.call(this.interpolationContext,r,this.value):this.parent.target[i]=s+(r-s)*this.value}return!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent?this.repeat():n.TweenData.RUNNING},generateData:function(t){this.parent.reverse?this.dt=this.duration:this.dt=0;var e=[],i=!1,n=1/t*1e3;do{this.parent.reverse?(this.dt-=n,this.dt=Math.max(this.dt,0)):(this.dt+=n,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent);var s={};for(var r in this.vEnd){var o=this.vStart[r],a=this.vEnd[r];Array.isArray(a)?s[r]=this.interpolationFunction.call(this.interpolationContext,a,this.value):s[r]=o+(a-o)*this.value}e.push(s),(!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent)&&(i=!0)}while(!i);if(this.yoyo){var h=e.slice();h.reverse(),e=e.concat(h)}return e},repeat:function(){if(this.yoyo){if(this.inReverse&&0===this.repeatCounter){for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];return this.inReverse=!1,n.TweenData.COMPLETE}this.inReverse=!this.inReverse}else if(0===this.repeatCounter)return n.TweenData.COMPLETE;if(this.inReverse)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t];else{for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];this.repeatCounter>0&&this.repeatCounter--}return this.startTime=this.game.time.time,this.yoyo&&this.inReverse?this.startTime+=this.yoyoDelay:this.inReverse||(this.startTime+=this.repeatDelay),this.parent.reverse?this.dt=this.duration:this.dt=0,n.TweenData.LOOPED}},n.TweenData.prototype.constructor=n.TweenData, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Easing={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 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)},Out:function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)},InOut:function(t){return 0===t?0:1===t?1:.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:(.1,-1*Math.pow(2,10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4))},Out:function(t){return 0===t?0:1===t?1:(.1,1*Math.pow(2,-10*t)*Math.sin((t-.1)*(2*Math.PI)/.4)+1)},InOut:function(t){return 0===t?0:1===t?1:(.1,(t*=2)<1?1*Math.pow(2,10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4)*-.5:1*Math.pow(2,-10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4)*.5+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-s.Easing.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*s.Easing.Bounce.In(2*t):.5*s.Easing.Bounce.Out(2*t-1)+.5}}},s.Easing.Default=s.Easing.Linear.None,s.Easing.Power0=s.Easing.Linear.None,s.Easing.Power1=s.Easing.Quadratic.Out,s.Easing.Power2=s.Easing.Cubic.Out,s.Easing.Power3=s.Easing.Quartic.Out,s.Easing.Power4=s.Easing.Quintic.Out, +n.Easing={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 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)},Out:function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)},InOut:function(t){return 0===t?0:1===t?1:.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:(.1,-1*Math.pow(2,10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4))},Out:function(t){return 0===t?0:1===t?1:(.1,1*Math.pow(2,-10*t)*Math.sin((t-.1)*(2*Math.PI)/.4)+1)},InOut:function(t){return 0===t?0:1===t?1:(.1,(t*=2)<1?1*Math.pow(2,10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4)*-.5:1*Math.pow(2,-10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4)*.5+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-n.Easing.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*n.Easing.Bounce.In(2*t):.5*n.Easing.Bounce.Out(2*t-1)+.5}}},n.Easing.Default=n.Easing.Linear.None,n.Easing.Power0=n.Easing.Linear.None,n.Easing.Power1=n.Easing.Quadratic.Out,n.Easing.Power2=n.Easing.Cubic.Out,n.Easing.Power3=n.Easing.Quartic.Out,n.Easing.Power4=n.Easing.Quintic.Out, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Time=function(t){this.game=t,this.time=0,this.prevTime=0,this.now=0,this.elapsed=0,this.elapsedMS=0,this.physicsElapsed=1/60,this.physicsElapsedMS=1/60*1e3,this.desiredFpsMult=1/60,this._desiredFps=60,this.suggestedFps=this.desiredFps,this.slowMotion=1,this.advancedTiming=!1,this.frames=0,this.updates=0,this.renders=0,this.fps=0,this.ups=0,this.rps=0,this.fpsMin=1e3,this.fpsMax=0,this.msMin=1e3,this.msMax=0,this.pauseDuration=0,this.timeToCall=0,this.timeExpected=0,this.events=new s.Timer(this.game,!1),this._frameCount=0,this._elapsedAccumulator=0,this._started=0,this._timeLastSecond=0,this._pauseStarted=0,this._justResumed=!1,this._timers=[]},s.Time.prototype={boot:function(){this._started=Date.now(),this.time=Date.now(),this.events.start(),this.timeExpected=this.time},add:function(t){return this._timers.push(t),t},create:function(t){void 0===t&&(t=!0);var e=new s.Timer(this.game,t);return this._timers.push(e),e},removeAll:function(){for(var t=0;t=2*this._desiredFps&&(this.suggestedFps=5*Math.floor(200/(this._elapsedAccumulator/this._frameCount)),this._frameCount=0,this._elapsedAccumulator=0),this.msMin=Math.min(this.msMin,this.elapsed),this.msMax=Math.max(this.msMax,this.elapsed),this.frames++,this.now>this._timeLastSecond+1e3){var t=this.now-this._timeLastSecond;this.fps=Math.round(1e3*this.frames/t),this.ups=Math.round(1e3*this.updates/t),this.rps=Math.round(1e3*this.renders/t),this.fpsMin=Math.min(this.fpsMin,this.fps),this.fpsMax=Math.max(this.fpsMax,this.fps),this._timeLastSecond=this.now,this.frames=0,this.updates=0,this.renders=0}},preUpdate:function(){this.advancedTiming&&this.updates++},preRender:function(){this.advancedTiming&&this.renders++},gamePaused:function(){this._pauseStarted=Date.now(),this.events.pause();for(var t=this._timers.length;t--;)this._timers[t]._pause()},gameResumed:function(){this.time=Date.now(),this.pauseDuration=this.time-this._pauseStarted,this.events.resume();for(var t=this._timers.length;t--;)this._timers[t]._resume()},totalElapsedSeconds:function(){return.001*(this.time-this._started)},elapsedSince:function(t){return this.time-t},elapsedSecondsSince:function(t){return.001*(this.time-t)},reset:function(){this._started=this.time,this.removeAll()}},Object.defineProperty(s.Time.prototype,"desiredFps",{get:function(){return this._desiredFps},set:function(t){this._desiredFps=t,this.physicsElapsed=1/t,this.physicsElapsedMS=1e3*this.physicsElapsed,this.desiredFpsMult=1/t}}),s.Time.prototype.constructor=s.Time, +n.Time=function(t){this.game=t,this.time=0,this.prevTime=0,this.now=0,this.elapsed=0,this.elapsedMS=0,this.physicsElapsed=1/60,this.physicsElapsedMS=1/60*1e3,this.desiredFpsMult=1/60,this._desiredFps=60,this.suggestedFps=this.desiredFps,this.slowMotion=1,this.advancedTiming=!1,this.frames=0,this.updates=0,this.renders=0,this.fps=0,this.ups=0,this.rps=0,this.fpsMin=1e3,this.fpsMax=0,this.msMin=1e3,this.msMax=0,this.pauseDuration=0,this.timeToCall=0,this.timeExpected=0,this.events=new n.Timer(this.game,!1),this._frameCount=0,this._elapsedAccumulator=0,this._started=0,this._timeLastSecond=0,this._pauseStarted=0,this._justResumed=!1,this._timers=[]},n.Time.prototype={boot:function(){this._started=Date.now(),this.time=Date.now(),this.events.start(),this.timeExpected=this.time},add:function(t){return this._timers.push(t),t},create:function(t){void 0===t&&(t=!0);var e=new n.Timer(this.game,t);return this._timers.push(e),e},removeAll:function(){for(var t=0;t=2*this._desiredFps&&(this.suggestedFps=5*Math.floor(200/(this._elapsedAccumulator/this._frameCount)),this._frameCount=0,this._elapsedAccumulator=0),this.msMin=Math.min(this.msMin,this.elapsed),this.msMax=Math.max(this.msMax,this.elapsed),this.frames++,this.now>this._timeLastSecond+1e3){var t=this.now-this._timeLastSecond;this.fps=Math.round(1e3*this.frames/t),this.ups=Math.round(1e3*this.updates/t),this.rps=Math.round(1e3*this.renders/t),this.fpsMin=Math.min(this.fpsMin,this.fps),this.fpsMax=Math.max(this.fpsMax,this.fps),this._timeLastSecond=this.now,this.frames=0,this.updates=0,this.renders=0}},preUpdate:function(){this.advancedTiming&&this.updates++},preRender:function(){this.advancedTiming&&this.renders++},gamePaused:function(){this._pauseStarted=Date.now(),this.events.pause();for(var t=this._timers.length;t--;)this._timers[t]._pause()},gameResumed:function(){this.time=Date.now(),this.pauseDuration=this.time-this._pauseStarted,this.events.resume();for(var t=this._timers.length;t--;)this._timers[t]._resume()},totalElapsedSeconds:function(){return.001*(this.time-this._started)},elapsedSince:function(t){return this.time-t},elapsedSecondsSince:function(t){return.001*(this.time-t)},reset:function(){this._started=this.time,this.removeAll()}},Object.defineProperty(n.Time.prototype,"desiredFps",{get:function(){return this._desiredFps},set:function(t){this._desiredFps=t,this.physicsElapsed=1/t,this.physicsElapsedMS=1e3*this.physicsElapsed,this.desiredFpsMult=1/t}}),n.Time.prototype.constructor=n.Time, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Timer=function(t,e){void 0===e&&(e=!0),this.game=t,this.running=!1,this.autoDestroy=e,this.expired=!1,this.elapsed=0,this.events=[],this.onComplete=new s.Signal,this.nextTick=0,this.timeCap=1e3,this.paused=!1,this._codePaused=!1,this._started=0,this._pauseStarted=0,this._pauseTotal=0,this._now=Date.now(),this._len=0,this._marked=0,this._i=0,this._diff=0,this._newTick=0},s.Timer.MINUTE=6e4,s.Timer.SECOND=1e3,s.Timer.HALF=500,s.Timer.QUARTER=250,s.Timer.prototype={create:function(t,e,i,n,r,o){var a=t=Math.round(t);0===this._now?a+=this.game.time.time:a+=this._now;var h=new s.TimerEvent(this,t,a,i,e,n,r,o);return this.events.push(h),this.order(),this.expired=!1,h},add:function(t,e,i){return this.create(t,!1,0,e,i,Array.prototype.slice.call(arguments,3))},repeat:function(t,e,i,n){return this.create(t,!1,e,i,n,Array.prototype.slice.call(arguments,4))},loop:function(t,e,i){return this.create(t,!0,0,e,i,Array.prototype.slice.call(arguments,3))},start:function(t){if(!this.running){this._started=this.game.time.time+(t||0),this.running=!0;for(var e=0;e0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(t,e){return t.ticke.tick?1:0},clearPendingEvents:function(){for(this._i=this.events.length;this._i--;)this.events[this._i].pendingDelete&&this.events.splice(this._i,1);this._len=this.events.length,this._i=0},update:function(t){if(this.paused)return!0;if(this.elapsed=t-this._now,this._now=t,this.elapsed>this.timeCap&&this.adjustEvents(t-this.elapsed),this._marked=0,this.clearPendingEvents(),this.running&&this._now>=this.nextTick&&this._len>0){for(;this._i=e.tick)||e.pendingDelete)break;this._newTick=this._now+e.delay-(this._now-e.tick),this._newTick<0&&(this._newTick=this._now+e.delay),!0===e.loop?(e.tick=this._newTick,e.callback.apply(e.callbackContext,e.args)):e.repeatCount>0?(e.repeatCount--,e.tick=this._newTick,e.callback.apply(e.callbackContext,e.args)):(this._marked++,e.pendingDelete=!0,e.callback.apply(e.callbackContext,e.args)),this._i++}this.events.length>this._marked?this.order():(this.expired=!0,this.onComplete.dispatch(this))}return!this.expired||!this.autoDestroy},pause:function(){this.running&&(this._codePaused=!0,this.paused||(this._pauseStarted=this.game.time.time,this.paused=!0))},_pause:function(){!this.paused&&this.running&&(this._pauseStarted=this.game.time.time,this.paused=!0)},adjustEvents:function(t){for(var e=0;ethis._now?this.nextTick-this._now:0}}),Object.defineProperty(s.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(s.Timer.prototype,"ms",{get:function(){return this.running?this._now-this._started-this._pauseTotal:0}}),Object.defineProperty(s.Timer.prototype,"seconds",{get:function(){return this.running?.001*this.ms:0}}),s.Timer.prototype.constructor=s.Timer, +n.Timer=function(t,e){void 0===e&&(e=!0),this.game=t,this.running=!1,this.autoDestroy=e,this.expired=!1,this.elapsed=0,this.events=[],this.onComplete=new n.Signal,this.nextTick=0,this.timeCap=1e3,this.paused=!1,this._codePaused=!1,this._started=0,this._pauseStarted=0,this._pauseTotal=0,this._now=Date.now(),this._len=0,this._marked=0,this._i=0,this._diff=0,this._newTick=0},n.Timer.MINUTE=6e4,n.Timer.SECOND=1e3,n.Timer.HALF=500,n.Timer.QUARTER=250,n.Timer.prototype={create:function(t,e,i,s,r,o){var a=t=Math.round(t);0===this._now?a+=this.game.time.time:a+=this._now;var h=new n.TimerEvent(this,t,a,i,e,s,r,o);return this.events.push(h),this.order(),this.expired=!1,h},add:function(t,e,i){return this.create(t,!1,0,e,i,Array.prototype.slice.call(arguments,3))},repeat:function(t,e,i,n){return this.create(t,!1,e,i,n,Array.prototype.slice.call(arguments,4))},loop:function(t,e,i){return this.create(t,!0,0,e,i,Array.prototype.slice.call(arguments,3))},start:function(t){if(!this.running){this._started=this.game.time.time+(t||0),this.running=!0;for(var e=0;e0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(t,e){return t.ticke.tick?1:0},clearPendingEvents:function(){for(this._i=this.events.length;this._i--;)this.events[this._i].pendingDelete&&this.events.splice(this._i,1);this._len=this.events.length,this._i=0},update:function(t){if(this.paused)return!0;if(this.elapsed=t-this._now,this._now=t,this.elapsed>this.timeCap&&this.adjustEvents(t-this.elapsed),this._marked=0,this.clearPendingEvents(),this.running&&this._now>=this.nextTick&&this._len>0){for(;this._i=e.tick)||e.pendingDelete)break;this._newTick=this._now+e.delay-(this._now-e.tick),this._newTick<0&&(this._newTick=this._now+e.delay),!0===e.loop?(e.tick=this._newTick,e.callback.apply(e.callbackContext,e.args)):e.repeatCount>0?(e.repeatCount--,e.tick=this._newTick,e.callback.apply(e.callbackContext,e.args)):(this._marked++,e.pendingDelete=!0,e.callback.apply(e.callbackContext,e.args)),this._i++}this.events.length>this._marked?this.order():(this.expired=!0,this.onComplete.dispatch(this))}return!this.expired||!this.autoDestroy},pause:function(){this.running&&(this._codePaused=!0,this.paused||(this._pauseStarted=this.game.time.time,this.paused=!0))},_pause:function(){!this.paused&&this.running&&(this._pauseStarted=this.game.time.time,this.paused=!0)},adjustEvents:function(t){for(var e=0;ethis._now?this.nextTick-this._now:0}}),Object.defineProperty(n.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(n.Timer.prototype,"ms",{get:function(){return this.running?this._now-this._started-this._pauseTotal:0}}),Object.defineProperty(n.Timer.prototype,"seconds",{get:function(){return this.running?.001*this.ms:0}}),n.Timer.prototype.constructor=n.Timer, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.TimerEvent=function(t,e,i,n,s,r,o,a){this.timer=t,this.delay=e,this.tick=i,this.repeatCount=n-1,this.loop=s,this.callback=r,this.callbackContext=o,this.args=a,this.pendingDelete=!1},s.TimerEvent.prototype.constructor=s.TimerEvent, +n.TimerEvent=function(t,e,i,n,s,r,o,a){this.timer=t,this.delay=e,this.tick=i,this.repeatCount=n-1,this.loop=s,this.callback=r,this.callbackContext=o,this.args=a,this.pendingDelete=!1},n.TimerEvent.prototype.constructor=n.TimerEvent, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.AnimationManager=function(t){this.sprite=t,this.game=t.game,this.currentFrame=null,this.currentAnim=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},s.AnimationManager.prototype={loadFrameData:function(t,e){if(void 0===t)return!1;if(this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(t);return this._frameData=t,null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0,!0},copyFrameData:function(t,e){if(this._frameData=t.clone(),this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(this._frameData);return null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0,!0},add:function(t,e,i,n,r){return e=e||[],i=i||60,void 0===n&&(n=!1),void 0===r&&(r=!(!e||"number"!=typeof e[0])),this._outputFrames=[],this._frameData.getFrameIndexes(e,r,this._outputFrames),this._anims[t]=new s.Animation(this.game,this.sprite,t,this._frameData,this._outputFrames,i,n),this.currentAnim=this._anims[t],this.sprite.tilingTexture&&(this.sprite.refreshTexture=!0),this._anims[t]},validateFrames:function(t,e){void 0===e&&(e=!0);for(var i=0;ithis._frameData.total)return!1}else if(!1===this._frameData.checkFrameName(t[i]))return!1;return!0},play:function(t,e,i,n){if(this._anims[t])return this.currentAnim===this._anims[t]?!1===this.currentAnim.isPlaying?(this.currentAnim.paused=!1,this.currentAnim.play(e,i,n)):this.currentAnim:(this.currentAnim&&this.currentAnim.isPlaying&&this.currentAnim.stop(),this.currentAnim=this._anims[t],this.currentAnim.paused=!1,this.currentFrame=this.currentAnim.currentFrame,this.currentAnim.play(e,i,n))},stop:function(t,e){void 0===e&&(e=!1),!this.currentAnim||"string"==typeof t&&t!==this.currentAnim.name||this.currentAnim.stop(e)},update:function(){return!(this.updateIfVisible&&!this.sprite.visible)&&(!(!this.currentAnim||!this.currentAnim.update())&&(this.currentFrame=this.currentAnim.currentFrame,!0))},next:function(t){this.currentAnim&&(this.currentAnim.next(t),this.currentFrame=this.currentAnim.currentFrame)},previous:function(t){this.currentAnim&&(this.currentAnim.previous(t),this.currentFrame=this.currentAnim.currentFrame)},getAnimation:function(t){return"string"==typeof t&&this._anims[t]?this._anims[t]:null},refreshFrame:function(){},destroy:function(){var t=null;for(var t in this._anims)this._anims.hasOwnProperty(t)&&this._anims[t].destroy();this._anims={},this._outputFrames=[],this._frameData=null,this.currentAnim=null,this.currentFrame=null,this.sprite=null,this.game=null}},s.AnimationManager.prototype.constructor=s.AnimationManager,Object.defineProperty(s.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(s.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData.total}}),Object.defineProperty(s.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(t){this.currentAnim.paused=t}}),Object.defineProperty(s.AnimationManager.prototype,"name",{get:function(){return this.currentAnim?this.currentAnim.name:void 0}}),Object.defineProperty(s.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this.currentFrame.index:void 0},set:function(t){var e;"number"==typeof t&&this._frameData&&(e=this._frameData.getFrame(t))&&(this.currentFrame=e,this.sprite.setFrame(this.currentFrame))}}),Object.defineProperty(s.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(t){var e;"string"==typeof t&&this._frameData&&(e=this._frameData.getFrameByName(t))?(this.currentFrame=e,this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame)):console.warn("Cannot set frameName: "+t)}}), +n.AnimationManager=function(t){this.sprite=t,this.game=t.game,this.currentFrame=null,this.currentAnim=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},n.AnimationManager.prototype={loadFrameData:function(t,e){if(void 0===t)return!1;if(this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(t);return this._frameData=t,null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0,!0},copyFrameData:function(t,e){if(this._frameData=t.clone(),this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(this._frameData);return null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0,!0},add:function(t,e,i,s,r){return e=e||[],i=i||60,void 0===s&&(s=!1),void 0===r&&(r=!(!e||"number"!=typeof e[0])),this._outputFrames=[],this._frameData.getFrameIndexes(e,r,this._outputFrames),this._anims[t]=new n.Animation(this.game,this.sprite,t,this._frameData,this._outputFrames,i,s),this.currentAnim=this._anims[t],this.sprite.tilingTexture&&(this.sprite.refreshTexture=!0),this._anims[t]},validateFrames:function(t,e){void 0===e&&(e=!0);for(var i=0;ithis._frameData.total)return!1}else if(!1===this._frameData.checkFrameName(t[i]))return!1;return!0},play:function(t,e,i,n){if(this._anims[t])return this.currentAnim===this._anims[t]?!1===this.currentAnim.isPlaying?(this.currentAnim.paused=!1,this.currentAnim.play(e,i,n)):this.currentAnim:(this.currentAnim&&this.currentAnim.isPlaying&&this.currentAnim.stop(),this.currentAnim=this._anims[t],this.currentAnim.paused=!1,this.currentFrame=this.currentAnim.currentFrame,this.currentAnim.play(e,i,n))},stop:function(t,e){void 0===e&&(e=!1),!this.currentAnim||"string"==typeof t&&t!==this.currentAnim.name||this.currentAnim.stop(e)},update:function(){return!(this.updateIfVisible&&!this.sprite.visible)&&(!(!this.currentAnim||!this.currentAnim.update())&&(this.currentFrame=this.currentAnim.currentFrame,!0))},next:function(t){this.currentAnim&&(this.currentAnim.next(t),this.currentFrame=this.currentAnim.currentFrame)},previous:function(t){this.currentAnim&&(this.currentAnim.previous(t),this.currentFrame=this.currentAnim.currentFrame)},getAnimation:function(t){return"string"==typeof t&&this._anims[t]?this._anims[t]:null},refreshFrame:function(){},destroy:function(){var t=null;for(var t in this._anims)this._anims.hasOwnProperty(t)&&this._anims[t].destroy();this._anims={},this._outputFrames=[],this._frameData=null,this.currentAnim=null,this.currentFrame=null,this.sprite=null,this.game=null}},n.AnimationManager.prototype.constructor=n.AnimationManager,Object.defineProperty(n.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(n.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData.total}}),Object.defineProperty(n.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(t){this.currentAnim.paused=t}}),Object.defineProperty(n.AnimationManager.prototype,"name",{get:function(){return this.currentAnim?this.currentAnim.name:void 0}}),Object.defineProperty(n.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this.currentFrame.index:void 0},set:function(t){var e;"number"==typeof t&&this._frameData&&(e=this._frameData.getFrame(t))&&(this.currentFrame=e,this.sprite.setFrame(this.currentFrame))}}),Object.defineProperty(n.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(t){var e;"string"==typeof t&&this._frameData&&(e=this._frameData.getFrameByName(t))?(this.currentFrame=e,this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame)):console.warn("Cannot set frameName: "+t)}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Animation=function(t,e,i,n,r,o,a){void 0===a&&(a=!1),this.game=t,this._parent=e,this._frameData=n,this.name=i,this._frames=[],this._frames=this._frames.concat(r),this.delay=1e3/o,this.loop=a,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new s.Signal,this.onUpdate=null,this.onComplete=new s.Signal,this.onLoop=new s.Signal,this.isReversed=!1,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},s.Animation.prototype={play:function(t,e,i){return"number"==typeof t&&(this.delay=1e3/t),"boolean"==typeof e&&(this.loop=e),void 0!==i&&(this.killOnComplete=i),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=this.isReversed?this._frames.length-1:0,this.updateCurrentFrame(!1,!0),this._parent.events.onAnimationStart$dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setFrame(this.currentFrame),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this.onStart.dispatch(this._parent,this)},reverse:function(){return this.reversed=!this.reversed,this},reverseOnce:function(){return this.onComplete.addOnce(this.reverse,this),this.reverse()},setFrame:function(t,e){var i;if(void 0===e&&(e=!1),"string"==typeof t)for(var n=0;n=0)&&(this._frameSkip=1,this._frameDiff=e,this._timeLastFrame=t,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=t+(this.delay-this._frameDiff),this.isReversed?this._frameIndex-=this._frameSkip:this._frameIndex+=this._frameSkip,!this.isReversed&&this._frameIndex>=this._frames.length||this.isReversed&&this._frameIndex<=-1?this.loop?(this._frameIndex=Math.abs(this._frameIndex)%this._frames.length,this.isReversed&&(this._frameIndex=this._frames.length-1-this._frameIndex),this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&this._parent.setFrame(this.currentFrame),this.loopCount++,this._parent.events.onAnimationLoop$dispatch(this._parent,this),this.onLoop.dispatch(this._parent,this),!this.onUpdate||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)):(this.complete(),!1):this.updateCurrentFrame(!0))},updateCurrentFrame:function(t,e){if(void 0===e&&(e=!1),!this._frameData)return!1;var i=this.currentFrame.index;return this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(e||i!==this.currentFrame.index)&&this._parent.setFrame(this.currentFrame),!this.onUpdate||!t||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)},next:function(t){void 0===t&&(t=1);var e=this._frameIndex+t;e>=this._frames.length&&(this.loop?e%=this._frames.length:e=this._frames.length-1),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},previous:function(t){void 0===t&&(t=1);var e=this._frameIndex-t;e<0&&(this.loop?e=this._frames.length+e:e++),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},updateFrameData:function(t){this._frameData=t,this.currentFrame=this._frameData?this._frameData.getFrame(this._frames[this._frameIndex%this._frames.length]):null},destroy:function(){this._frameData&&(this.game.onPause.remove(this.onPause,this),this.game.onResume.remove(this.onResume,this),this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1,this.onStart.dispose(),this.onLoop.dispose(),this.onComplete.dispose(),this.onUpdate&&this.onUpdate.dispose())},complete:function(){this._frameIndex=this._frames.length-1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.updateCurrentFrame(!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events.onAnimationComplete$dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},s.Animation.prototype.constructor=s.Animation,Object.defineProperty(s.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(t){this.isPaused=t,t?this._pauseStartTime=this.game.time.time:this.isPlaying&&(this._timeNextFrame=this.game.time.time+this.delay)}}),Object.defineProperty(s.Animation.prototype,"reversed",{get:function(){return this.isReversed},set:function(t){this.isReversed=t}}),Object.defineProperty(s.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(s.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(t){this.currentFrame=this._frameData.getFrame(this._frames[t]),null!==this.currentFrame&&(this._frameIndex=t,this._parent.setFrame(this.currentFrame),this.onUpdate&&this.onUpdate.dispatch(this,this.currentFrame))}}),Object.defineProperty(s.Animation.prototype,"speed",{get:function(){return 1e3/this.delay},set:function(t){t>0&&(this.delay=1e3/t)}}),Object.defineProperty(s.Animation.prototype,"enableUpdate",{get:function(){return null!==this.onUpdate},set:function(t){t&&null===this.onUpdate?this.onUpdate=new s.Signal:t||null===this.onUpdate||(this.onUpdate.dispose(),this.onUpdate=null)}}),s.Animation.generateFrameNames=function(t,e,i,n,r){void 0===n&&(n="");var o=[],a="";if(e=i;h--)a=t+(a="number"==typeof r?s.Utils.pad(h.toString(),r,"0",1):h.toString())+n,o.push(a);return o}, +n.Animation=function(t,e,i,s,r,o,a){void 0===a&&(a=!1),this.game=t,this._parent=e,this._frameData=s,this.name=i,this._frames=[],this._frames=this._frames.concat(r),this.delay=1e3/o,this.loop=a,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new n.Signal,this.onUpdate=null,this.onComplete=new n.Signal,this.onLoop=new n.Signal,this.isReversed=!1,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},n.Animation.prototype={play:function(t,e,i){return"number"==typeof t&&(this.delay=1e3/t),"boolean"==typeof e&&(this.loop=e),void 0!==i&&(this.killOnComplete=i),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=this.isReversed?this._frames.length-1:0,this.updateCurrentFrame(!1,!0),this._parent.events.onAnimationStart$dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setFrame(this.currentFrame),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this.onStart.dispatch(this._parent,this)},reverse:function(){return this.reversed=!this.reversed,this},reverseOnce:function(){return this.onComplete.addOnce(this.reverse,this),this.reverse()},setFrame:function(t,e){var i;if(void 0===e&&(e=!1),"string"==typeof t)for(var n=0;n=0)&&(this._frameSkip=1,this._frameDiff=e,this._timeLastFrame=t,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=t+(this.delay-this._frameDiff),this.isReversed?this._frameIndex-=this._frameSkip:this._frameIndex+=this._frameSkip,!this.isReversed&&this._frameIndex>=this._frames.length||this.isReversed&&this._frameIndex<=-1?this.loop?(this._frameIndex=Math.abs(this._frameIndex)%this._frames.length,this.isReversed&&(this._frameIndex=this._frames.length-1-this._frameIndex),this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&this._parent.setFrame(this.currentFrame),this.loopCount++,this._parent.events.onAnimationLoop$dispatch(this._parent,this),this.onLoop.dispatch(this._parent,this),!this.onUpdate||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)):(this.complete(),!1):this.updateCurrentFrame(!0))},updateCurrentFrame:function(t,e){if(void 0===e&&(e=!1),!this._frameData)return!1;var i=this.currentFrame.index;return this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(e||i!==this.currentFrame.index)&&this._parent.setFrame(this.currentFrame),!this.onUpdate||!t||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)},next:function(t){void 0===t&&(t=1);var e=this._frameIndex+t;e>=this._frames.length&&(this.loop?e%=this._frames.length:e=this._frames.length-1),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},previous:function(t){void 0===t&&(t=1);var e=this._frameIndex-t;e<0&&(this.loop?e=this._frames.length+e:e++),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},updateFrameData:function(t){this._frameData=t,this.currentFrame=this._frameData?this._frameData.getFrame(this._frames[this._frameIndex%this._frames.length]):null},destroy:function(){this._frameData&&(this.game.onPause.remove(this.onPause,this),this.game.onResume.remove(this.onResume,this),this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1,this.onStart.dispose(),this.onLoop.dispose(),this.onComplete.dispose(),this.onUpdate&&this.onUpdate.dispose())},complete:function(){this._frameIndex=this._frames.length-1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.updateCurrentFrame(!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events.onAnimationComplete$dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},n.Animation.prototype.constructor=n.Animation,Object.defineProperty(n.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(t){this.isPaused=t,t?this._pauseStartTime=this.game.time.time:this.isPlaying&&(this._timeNextFrame=this.game.time.time+this.delay)}}),Object.defineProperty(n.Animation.prototype,"reversed",{get:function(){return this.isReversed},set:function(t){this.isReversed=t}}),Object.defineProperty(n.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(n.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(t){this.currentFrame=this._frameData.getFrame(this._frames[t]),null!==this.currentFrame&&(this._frameIndex=t,this._parent.setFrame(this.currentFrame),this.onUpdate&&this.onUpdate.dispatch(this,this.currentFrame))}}),Object.defineProperty(n.Animation.prototype,"speed",{get:function(){return 1e3/this.delay},set:function(t){t>0&&(this.delay=1e3/t)}}),Object.defineProperty(n.Animation.prototype,"enableUpdate",{get:function(){return null!==this.onUpdate},set:function(t){t&&null===this.onUpdate?this.onUpdate=new n.Signal:t||null===this.onUpdate||(this.onUpdate.dispose(),this.onUpdate=null)}}),n.Animation.generateFrameNames=function(t,e,i,s,r){void 0===s&&(s="");var o=[],a="";if(e=i;h--)a=t+(a="number"==typeof r?n.Utils.pad(h.toString(),r,"0",1):h.toString())+s,o.push(a);return o}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Frame=function(t,e,i,n,r,o){this.index=t,this.x=e,this.y=i,this.width=n,this.height=r,0!==this.width&&0!==this.height||console.warn('Phaser.Frame: Frame "'+this.name+'" has a width or height of zero'),this.name=o,this.centerX=Math.floor(n/2),this.centerY=Math.floor(r/2),this.distance=s.Math.distance(0,0,n,r),this.rotated=!1,this.trimmed=!1,this.sourceSizeW=n,this.sourceSizeH=r,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0,this.right=this.x+this.width,this.bottom=this.y+this.height},s.Frame.prototype={resize:function(t,e){this.width=t,this.height=e,this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2),this.distance=s.Math.distance(0,0,t,e),this.sourceSizeW=t,this.sourceSizeH=e,this.right=this.x+t,this.bottom=this.y+e},setTrim:function(t,e,i,n,s,r,o){this.trimmed=t,t&&(this.sourceSizeW=e,this.sourceSizeH=i,this.centerX=Math.floor(e/2),this.centerY=Math.floor(i/2),this.spriteSourceSizeX=n,this.spriteSourceSizeY=s,this.spriteSourceSizeW=r,this.spriteSourceSizeH=o)},clone:function(){var t=new s.Frame(this.index,this.x,this.y,this.width,this.height,this.name);for(var e in this)this.hasOwnProperty(e)&&(t[e]=this[e]);return t},getRect:function(t){return void 0===t?t=new s.Rectangle(this.x,this.y,this.width,this.height):t.setTo(this.x,this.y,this.width,this.height),t}},s.Frame.prototype.constructor=s.Frame, +n.Frame=function(t,e,i,s,r,o){this.index=t,this.x=e,this.y=i,this.width=s,this.height=r,0!==this.width&&0!==this.height||console.warn('Phaser.Frame: Frame "'+this.name+'" has a width or height of zero'),this.name=o,this.centerX=Math.floor(s/2),this.centerY=Math.floor(r/2),this.distance=n.Math.distance(0,0,s,r),this.rotated=!1,this.trimmed=!1,this.sourceSizeW=s,this.sourceSizeH=r,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0,this.right=this.x+this.width,this.bottom=this.y+this.height},n.Frame.prototype={resize:function(t,e){this.width=t,this.height=e,this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2),this.distance=n.Math.distance(0,0,t,e),this.sourceSizeW=t,this.sourceSizeH=e,this.right=this.x+t,this.bottom=this.y+e},setTrim:function(t,e,i,n,s,r,o){this.trimmed=t,t&&(this.sourceSizeW=e,this.sourceSizeH=i,this.centerX=Math.floor(e/2),this.centerY=Math.floor(i/2),this.spriteSourceSizeX=n,this.spriteSourceSizeY=s,this.spriteSourceSizeW=r,this.spriteSourceSizeH=o)},clone:function(){var t=new n.Frame(this.index,this.x,this.y,this.width,this.height,this.name);for(var e in this)this.hasOwnProperty(e)&&(t[e]=this[e]);return t},getRect:function(t){return void 0===t?t=new n.Rectangle(this.x,this.y,this.width,this.height):t.setTo(this.x,this.y,this.width,this.height),t}},n.Frame.prototype.constructor=n.Frame, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.FrameData=function(){this._frames=[],this._frameNames=[]},s.FrameData.prototype={addFrame:function(t){return t.index=this._frames.length,this._frames.push(t),""!==t.name&&(this._frameNames[t.name]=t.index),t},getFrame:function(t){return t>=this._frames.length&&(t=0),this._frames[t]},getFrameByName:function(t){return"number"==typeof this._frameNames[t]?this._frames[this._frameNames[t]]:null},checkFrameName:function(t){return null!=this._frameNames[t]},clone:function(){for(var t=new s.FrameData,e=0;e=this._frames.length&&(t=0),this._frames[t]},getFrameByName:function(t){return"number"==typeof this._frameNames[t]?this._frames[this._frameNames[t]]:null},checkFrameName:function(t){return null!=this._frameNames[t]},clone:function(){for(var t=new n.FrameData,e=0;e * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.AnimationParser={spriteSheet:function(t,e,i,n,r,o,a,h){void 0===r&&(r=-1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0);var l=e;if("string"==typeof e?l=t.cache.getImage(e):e=l.name,null===l)return null;if(i<=0||n<=0)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' frameWidth (%s) or frameHeight (%s) must be positive",e,i,n),null;var u=l.width,c=l.height;if(0===u||0===c)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' width (%s) or height (%s) is zero",e,u,c),null;if(uf||h<-f)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' skipFrames = %s is larger than the frame total %s",e,h,f),null;if(r>-1&&(v=(f=r)-1),d<1&&console.warn("Phaser.AnimationParser.spriteSheet: image '%s' has width %d, but it should be at least %d (frameWidth=%s, margin=%s, spacing=%s)",e,u,i+o+a,i,o,a),p<1&&console.warn("Phaser.AnimationParser.spriteSheet: image '%s' has height %d, but it should be at least %d (frameHeight=%s, margin=%s, spacing=%s)",e,c,n+o+a,n,o,a),0===g)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' zero frames were produced",e),null;if(h>0?v=(y=h)+(f=Math.min(f,g-h))-1:h<0&&(y=(v=m+h)-(f=Math.min(f,g+h))+1),y<0)return console.warn("First frame index %s is outside of range [0, %d]",y,m),null;if(v>m)return console.warn("Last frame index %s is outside of range [0, %d]",v,m),null;for(var x=new s.FrameData,b=o,w=o,_=0,C=0;Cv);C++)C>=y&&x.addFrame(new s.Frame(_++,b,w,i,n,"")),(b+=i+a)+i>u&&(b=o,w+=n+a);return x},JSONData:function(t,e){if(!e.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),void console.log(e);for(var i,n=new s.FrameData,r=e.frames,o=0;o tag")}}, +n.AnimationParser={spriteSheet:function(t,e,i,s,r,o,a,h){void 0===r&&(r=-1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0);var l=e;if("string"==typeof e?l=t.cache.getImage(e):e=l.name,null===l)return null;if(i<=0||s<=0)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' frameWidth (%s) or frameHeight (%s) must be positive",e,i,s),null;var c=l.width,u=l.height;if(0===c||0===u)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' width (%s) or height (%s) is zero",e,c,u),null;if(cf||h<-f)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' skipFrames = %s is larger than the frame total %s",e,h,f),null;if(r>-1&&(v=(f=r)-1),d<1&&console.warn("Phaser.AnimationParser.spriteSheet: image '%s' has width %d, but it should be at least %d (frameWidth=%s, margin=%s, spacing=%s)",e,c,i+o+a,i,o,a),p<1&&console.warn("Phaser.AnimationParser.spriteSheet: image '%s' has height %d, but it should be at least %d (frameHeight=%s, margin=%s, spacing=%s)",e,u,s+o+a,s,o,a),0===g)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' zero frames were produced",e),null;if(h>0?v=(y=h)+(f=Math.min(f,g-h))-1:h<0&&(y=(v=m+h)-(f=Math.min(f,g+h))+1),y<0)return console.warn("First frame index %s is outside of range [0, %d]",y,m),null;if(v>m)return console.warn("Last frame index %s is outside of range [0, %d]",v,m),null;for(var b=new n.FrameData,x=o,w=o,_=0,T=0;Tv);T++)T>=y&&b.addFrame(new n.Frame(_++,x,w,i,s,"")),(x+=i+a)+i>c&&(x=o,w+=s+a);return b},JSONData:function(t,e){if(!e.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),void console.log(e);for(var i,s=new n.FrameData,r=e.frames,o=0;o tag")}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Cache=function(t){this.game=t,this.autoResolveURL=!1,this._cache={canvas:{},image:{},texture:{},sound:{},video:{},text:{},json:{},xml:{},physics:{},tilemap:{},binary:{},bitmapData:{},bitmapFont:{},shader:{},renderTexture:{},compressedTexture:{},data:{}},this._urlMap={},this._urlResolver=new Image,this._urlTemp=null,this.onSoundUnlock=new s.Signal,this._cacheMap=[],this._cacheMap[s.Cache.CANVAS]=this._cache.canvas,this._cacheMap[s.Cache.IMAGE]=this._cache.image,this._cacheMap[s.Cache.TEXTURE]=this._cache.texture,this._cacheMap[s.Cache.SOUND]=this._cache.sound,this._cacheMap[s.Cache.TEXT]=this._cache.text,this._cacheMap[s.Cache.PHYSICS]=this._cache.physics,this._cacheMap[s.Cache.TILEMAP]=this._cache.tilemap,this._cacheMap[s.Cache.BINARY]=this._cache.binary,this._cacheMap[s.Cache.BITMAPDATA]=this._cache.bitmapData,this._cacheMap[s.Cache.BITMAPFONT]=this._cache.bitmapFont,this._cacheMap[s.Cache.JSON]=this._cache.json,this._cacheMap[s.Cache.XML]=this._cache.xml,this._cacheMap[s.Cache.VIDEO]=this._cache.video,this._cacheMap[s.Cache.SHADER]=this._cache.shader,this._cacheMap[s.Cache.RENDER_TEXTURE]=this._cache.renderTexture,this._cacheMap[s.Cache.DATA]=this._cache.data,this._pendingCount=0,this.onReady=new s.Signal,this._addImages()},s.Cache.CANVAS=1,s.Cache.IMAGE=2,s.Cache.TEXTURE=3,s.Cache.SOUND=4,s.Cache.TEXT=5,s.Cache.PHYSICS=6,s.Cache.TILEMAP=7,s.Cache.BINARY=8,s.Cache.BITMAPDATA=9,s.Cache.BITMAPFONT=10,s.Cache.JSON=11,s.Cache.XML=12,s.Cache.VIDEO=13,s.Cache.SHADER=14,s.Cache.RENDER_TEXTURE=15,s.Cache.DATA=16,s.Cache.DEFAULT=null,s.Cache.DEFAULT_KEY="__default",s.Cache.DEFAULT_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==",s.Cache.MISSING=null,s.Cache.MISSING_KEY="__missing",s.Cache.MISSING_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==",s.Cache.READY_TIMEOUT=1e3,s.Cache.prototype={addCompressedTextureMetaData:function(t,e,i,n){this.checkImageKey(t)&&this.removeImage(t);var r=i in s.LoaderParser?s.LoaderParser[i](n):n,o={key:t,url:e,data:r,base:new PIXI.BaseTexture(r,null,this.game.resolution),frame:new s.Frame(0,0,0,r.width,r.height,t),frameData:new s.FrameData,fileFormat:i};return o.frameData.addFrame(new s.Frame(0,0,0,r.width,r.height,e)),this._cache.image[t]=o,this._resolveURL(e,o),o},addCanvas:function(t,e,i){void 0===i&&(i=e.getContext("2d")),this._cache.canvas[t]={canvas:e,context:i}},addImage:function(t,e,i){this.checkImageKey(t)&&this.removeImage(t),!1===i.complete&&console.warn('Phaser.Cache.addImage: Image "%s" is not complete',t);var n={key:t,url:e,data:i,base:new PIXI.BaseTexture(i,null,this.game.resolution),frame:new s.Frame(0,0,0,i.width,i.height,t),frameData:new s.FrameData};return n.frameData.addFrame(new s.Frame(0,0,0,i.width,i.height,e)),this._cache.image[t]=n,this._resolveURL(e,n),"__default"===t?s.Cache.DEFAULT=new PIXI.Texture(n.base):"__missing"===t&&(s.Cache.MISSING=new PIXI.Texture(n.base)),n},addImageAsync:function(t,e,i){var n=this,s=new Image;s.onload=function(){i.call(this,n.addImage(t,null,s)),n._removePending(),s.onload=null},this._addPending(),s.src=e},addDefaultImage:function(){this.addImageAsync(s.Cache.DEFAULT_KEY,s.Cache.DEFAULT_SRC,(function(t){t.base.skipRender=!0,s.Cache.DEFAULT=new PIXI.Texture(t.base)}))},addMissingImage:function(){this.addImageAsync(s.Cache.MISSING_KEY,s.Cache.MISSING_SRC,(function(t){s.Cache.MISSING=new PIXI.Texture(t.base)}))},addSound:function(t,e,i,n,s){void 0===n&&(n=!0,s=!1),void 0===s&&(n=!1,s=!0);var r=!1;s&&(r=!0),this._cache.sound[t]={url:e,data:i,isDecoding:!1,decoded:r,webAudio:n,audioTag:s,locked:this.game.sound.touchLocked},this._resolveURL(e,this._cache.sound[t])},addText:function(t,e,i){this._cache.text[t]={url:e,data:i},this._resolveURL(e,this._cache.text[t])},addPhysicsData:function(t,e,i,n){this._cache.physics[t]={url:e,data:i,format:n},this._resolveURL(e,this._cache.physics[t])},addTilemap:function(t,e,i,n){this._cache.tilemap[t]={url:e,data:i,format:n},this._resolveURL(e,this._cache.tilemap[t])},addBinary:function(t,e){this._cache.binary[t]=e},addBitmapData:function(t,e,i){return e.key=t,void 0===i&&(i=new s.FrameData).addFrame(e.textureFrame),this._cache.bitmapData[t]={data:e,frameData:i},e},addBitmapFont:function(t,e,i,n,r,o,a){var h={url:e,data:i,font:null,base:new PIXI.BaseTexture(i,null,this.game.resolution)};void 0===o&&(o=0),void 0===a&&(a=0),h.font="json"===r?s.LoaderParser.jsonBitmapFont(n,h.base,o,a,!1,this.game.resolution):s.LoaderParser.xmlBitmapFont(n,h.base,o,a,!1,this.game.resolution),this._cache.bitmapFont[t]=h,this._resolveURL(e,h)},addBitmapFontFromAtlas:function(t,e,i,n,r,o,a){var h=this.getFrameByName(e,i);if(h){var l,u={font:null,base:this.getBaseTexture(e),frame:h};void 0===o&&(o=0),void 0===a&&(a=0),"json"===r?(l=this.getJSON(n),u.font=s.LoaderParser.jsonBitmapFont(l,u.base,o,a,h,this.game.resolution)):(l=this.getXML(n),u.font=s.LoaderParser.xmlBitmapFont(l,u.base,o,a,h,this.game.resolution)),this._cache.bitmapFont[t]=u}},addJSON:function(t,e,i){this._cache.json[t]={url:e,data:i},this._resolveURL(e,this._cache.json[t])},addXML:function(t,e,i){this._cache.xml[t]={url:e,data:i},this._resolveURL(e,this._cache.xml[t])},addVideo:function(t,e,i,n){this._cache.video[t]={url:e,data:i,isBlob:n,locked:!0},this._resolveURL(e,this._cache.video[t])},addShader:function(t,e,i){this._cache.shader[t]={url:e,data:i},this._resolveURL(e,this._cache.shader[t])},addRenderTexture:function(t,e){this._cache.renderTexture[t]={texture:e,frame:new s.Frame(0,0,0,e.width,e.height,"","")}},addSpriteSheet:function(t,e,i,n,r,o,a,h,l){void 0===o&&(o=-1),void 0===a&&(a=0),void 0===h&&(h=0);var u={key:t,url:e,data:i,frameWidth:n,frameHeight:r,margin:a,spacing:h,base:new PIXI.BaseTexture(i,null,this.game.resolution),frameData:s.AnimationParser.spriteSheet(this.game,i,n,r,o,a,h,l)};this._cache.image[t]=u,this._resolveURL(e,u)},addTextureAtlas:function(t,e,i,n,r){var o={key:t,url:e,data:i,base:new PIXI.BaseTexture(i,null,this.game.resolution)};r===s.Loader.TEXTURE_ATLAS_XML_STARLING?o.frameData=s.AnimationParser.XMLData(this.game,n,t):r===s.Loader.TEXTURE_ATLAS_JSON_PYXEL?o.frameData=s.AnimationParser.JSONDataPyxel(this.game,n,t):Array.isArray(n.frames)?o.frameData=s.AnimationParser.JSONData(this.game,n,t):o.frameData=s.AnimationParser.JSONDataHash(this.game,n,t),this._cache.image[t]=o,this._resolveURL(e,o)},addData:function(t,e){this._cache.data[t]=e},reloadSound:function(t){var e=this,i=this.getSound(t);i&&(i.data.src=i.url,i.data.addEventListener("canplaythrough",(function(){return e.reloadSoundComplete(t)}),!1),i.data.load())},reloadSoundComplete:function(t){var e=this.getSound(t);e&&(e.locked=!1,this.onSoundUnlock.dispatch(t))},updateSound:function(t,e,i){var n=this.getSound(t);n&&(n[e]=i)},decodedSound:function(t,e){var i=this.getSound(t);i.data=e,i.decoded=!0,i.isDecoding=!1},isSoundDecoded:function(t){var e=this.getItem(t,s.Cache.SOUND,"isSoundDecoded");if(e)return e.decoded},isSoundReady:function(t){var e=this.getItem(t,s.Cache.SOUND,"isSoundDecoded");if(e)return e.decoded&&!this.game.sound.touchLocked},checkKey:function(t,e){return!!this._cacheMap[t][e]},checkURL:function(t){return!!this._urlMap[this._resolveURL(t)]},checkCanvasKey:function(t){return this.checkKey(s.Cache.CANVAS,t)},checkDataKey:function(t){return this.checkKey(s.Cache.DATA,t)},checkImageKey:function(t){return this.checkKey(s.Cache.IMAGE,t)},checkTextureKey:function(t){return this.checkKey(s.Cache.TEXTURE,t)},checkSoundKey:function(t){return this.checkKey(s.Cache.SOUND,t)},checkTextKey:function(t){return this.checkKey(s.Cache.TEXT,t)},checkPhysicsKey:function(t){return this.checkKey(s.Cache.PHYSICS,t)},checkTilemapKey:function(t){return this.checkKey(s.Cache.TILEMAP,t)},checkBinaryKey:function(t){return this.checkKey(s.Cache.BINARY,t)},checkBitmapDataKey:function(t){return this.checkKey(s.Cache.BITMAPDATA,t)},checkBitmapFontKey:function(t){return this.checkKey(s.Cache.BITMAPFONT,t)},checkJSONKey:function(t){return this.checkKey(s.Cache.JSON,t)},checkXMLKey:function(t){return this.checkKey(s.Cache.XML,t)},checkVideoKey:function(t){return this.checkKey(s.Cache.VIDEO,t)},checkShaderKey:function(t){return this.checkKey(s.Cache.SHADER,t)},checkRenderTextureKey:function(t){return this.checkKey(s.Cache.RENDER_TEXTURE,t)},getItem:function(t,e,i,n){return this.checkKey(e,t)?void 0===n?this._cacheMap[e][t]:this._cacheMap[e][t][n]:(i&&console.warn("Phaser.Cache."+i+': Key "'+t+'" not found in Cache.'),null)},getCanvas:function(t){return this.getItem(t,s.Cache.CANVAS,"getCanvas","canvas")},getImage:function(t,e){null==t&&(t="__default"),void 0===e&&(e=!1);var i=this.getItem(t,s.Cache.IMAGE,"getImage");return null===i&&(i=this.getItem("__missing",s.Cache.IMAGE,"getImage")),e?i:i.data},getTextureFrame:function(t){return this.getItem(t,s.Cache.TEXTURE,"getTextureFrame","frame")},getSound:function(t){return this.getItem(t,s.Cache.SOUND,"getSound")},getSoundData:function(t){return this.getItem(t,s.Cache.SOUND,"getSoundData","data")},getText:function(t){return this.getItem(t,s.Cache.TEXT,"getText","data")},getPhysicsData:function(t,e,i){var n=this.getItem(t,s.Cache.PHYSICS,"getPhysicsData","data");if(null===n||null==e)return n;if(n[e]){var r=n[e];if(!r||!i)return r;for(var o in r)if((o=r[o]).fixtureKey===i)return o;console.warn('Phaser.Cache.getPhysicsData: Could not find given fixtureKey: "'+i+" in "+t+'"')}else console.warn('Phaser.Cache.getPhysicsData: Invalid key/object: "'+t+" / "+e+'"');return null},getTilemapData:function(t){return this.getItem(t,s.Cache.TILEMAP,"getTilemapData")},getBinary:function(t){return this.getItem(t,s.Cache.BINARY,"getBinary")},getBitmapData:function(t){return this.getItem(t,s.Cache.BITMAPDATA,"getBitmapData","data")},getBitmapFont:function(t){return this.getItem(t,s.Cache.BITMAPFONT,"getBitmapFont")},getJSON:function(t,e){var i=this.getItem(t,s.Cache.JSON,"getJSON","data");return i?e?s.Utils.extend(!0,Array.isArray(i)?[]:{},i):i:null},getXML:function(t){return this.getItem(t,s.Cache.XML,"getXML","data")},getVideo:function(t){return this.getItem(t,s.Cache.VIDEO,"getVideo")},getShader:function(t){return this.getItem(t,s.Cache.SHADER,"getShader","data")},getRenderTexture:function(t){return this.getItem(t,s.Cache.RENDER_TEXTURE,"getRenderTexture")},getData:function(t){return this.getItem(t,s.Cache.DATA,"getData")},getBaseTexture:function(t,e){return void 0===e&&(e=s.Cache.IMAGE),this.getItem(t,e,"getBaseTexture","base")},getFrame:function(t,e){return void 0===e&&(e=s.Cache.IMAGE),this.getItem(t,e,"getFrame","frame")},getFrameCount:function(t,e){var i=this.getFrameData(t,e);return i?i.total:0},getFrameData:function(t,e){return void 0===e&&(e=s.Cache.IMAGE),this.getItem(t,e,"getFrameData","frameData")},hasFrameData:function(t,e){return void 0===e&&(e=s.Cache.IMAGE),null!==this.getItem(t,e,"","frameData")},updateFrameData:function(t,e,i){void 0===i&&(i=s.Cache.IMAGE),this._cacheMap[i][t]&&(this._cacheMap[i][t].frameData=e)},getFrameByIndex:function(t,e,i){var n=this.getFrameData(t,i);return n?n.getFrame(e):null},getFrameByName:function(t,e,i){var n=this.getFrameData(t,i);return n?n.getFrameByName(e):null},getURL:function(t){return(t=this._resolveURL(t))?this._urlMap[t]:(console.warn('Phaser.Cache.getUrl: Invalid url: "'+t+'" or Cache.autoResolveURL was false'),null)},getKeys:function(t){void 0===t&&(t=s.Cache.IMAGE);var e=[];if(this._cacheMap[t])for(var i in this._cacheMap[t])"__default"!==i&&"__missing"!==i&&e.push(i);return e},removeCanvas:function(t){delete this._cache.canvas[t]},removeImage:function(t,e){void 0===e&&(e=!0);var i=this.getImage(t,!0);e&&i.base&&i.base.destroy(),delete this._cache.image[t]},removeSound:function(t){delete this._cache.sound[t]},removeText:function(t){delete this._cache.text[t]},removePhysics:function(t){delete this._cache.physics[t]},removeTilemap:function(t){delete this._cache.tilemap[t]},removeBinary:function(t){delete this._cache.binary[t]},removeBitmapData:function(t){delete this._cache.bitmapData[t]},removeBitmapFont:function(t){delete this._cache.bitmapFont[t]},removeJSON:function(t){delete this._cache.json[t]},removeXML:function(t){delete this._cache.xml[t]},removeVideo:function(t){delete this._cache.video[t]},removeShader:function(t){delete this._cache.shader[t]},removeRenderTexture:function(t){delete this._cache.renderTexture[t]},removeSpriteSheet:function(t){delete this._cache.spriteSheet[t]},removeTextureAtlas:function(t){delete this._cache.image[t]},removeData:function(t){delete this._cache.data[t]},clearGLTextures:function(){for(var t in this._cache.image)this._cache.image[t].base._glTextures=[]},_resolveURL:function(t,e){return this.autoResolveURL?(this._urlResolver.src=this.game.load.baseURL+t,this._urlTemp=this._urlResolver.src,this._urlResolver.src="",e&&(this._urlMap[this._urlTemp]=e),this._urlTemp):null},destroy:function(){for(var t=0;t0?setTimeout((function(){t.isReady||(console.warn("Phaser.Cache: Still waiting for images after %s ms.",e),t._ready())}),s.Cache.READY_TIMEOUT):this._ready()},_addPending:function(){this._pendingCount+=1},_removePending:function(){this._pendingCount-=1,this._checkReady()},_checkReady:function(){this.isReady&&this._ready()},_ready:function(){this._pendingCount=0,this.onReady.dispatch(this)}},s.Cache.prototype.constructor=s.Cache,Object.defineProperty(s.Cache.prototype,"isReady",{get:function(){return this._pendingCount<=0}}), +n.Cache=function(t){this.game=t,this.autoResolveURL=!1,this._cache={canvas:{},image:{},texture:{},sound:{},video:{},text:{},json:{},xml:{},physics:{},tilemap:{},binary:{},bitmapData:{},bitmapFont:{},shader:{},renderTexture:{},compressedTexture:{},data:{}},this._urlMap={},this._urlResolver=new Image,this._urlTemp=null,this.onSoundUnlock=new n.Signal,this._cacheMap=[],this._cacheMap[n.Cache.CANVAS]=this._cache.canvas,this._cacheMap[n.Cache.IMAGE]=this._cache.image,this._cacheMap[n.Cache.TEXTURE]=this._cache.texture,this._cacheMap[n.Cache.SOUND]=this._cache.sound,this._cacheMap[n.Cache.TEXT]=this._cache.text,this._cacheMap[n.Cache.PHYSICS]=this._cache.physics,this._cacheMap[n.Cache.TILEMAP]=this._cache.tilemap,this._cacheMap[n.Cache.BINARY]=this._cache.binary,this._cacheMap[n.Cache.BITMAPDATA]=this._cache.bitmapData,this._cacheMap[n.Cache.BITMAPFONT]=this._cache.bitmapFont,this._cacheMap[n.Cache.JSON]=this._cache.json,this._cacheMap[n.Cache.XML]=this._cache.xml,this._cacheMap[n.Cache.VIDEO]=this._cache.video,this._cacheMap[n.Cache.SHADER]=this._cache.shader,this._cacheMap[n.Cache.RENDER_TEXTURE]=this._cache.renderTexture,this._cacheMap[n.Cache.DATA]=this._cache.data,this._pendingCount=0,this.onReady=new n.Signal,this._addImages()},n.Cache.CANVAS=1,n.Cache.IMAGE=2,n.Cache.TEXTURE=3,n.Cache.SOUND=4,n.Cache.TEXT=5,n.Cache.PHYSICS=6,n.Cache.TILEMAP=7,n.Cache.BINARY=8,n.Cache.BITMAPDATA=9,n.Cache.BITMAPFONT=10,n.Cache.JSON=11,n.Cache.XML=12,n.Cache.VIDEO=13,n.Cache.SHADER=14,n.Cache.RENDER_TEXTURE=15,n.Cache.DATA=16,n.Cache.DEFAULT=null,n.Cache.DEFAULT_KEY="__default",n.Cache.DEFAULT_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==",n.Cache.MISSING=null,n.Cache.MISSING_KEY="__missing",n.Cache.MISSING_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==",n.Cache.READY_TIMEOUT=1e3,n.Cache.prototype={addCompressedTextureMetaData:function(t,e,i,s){this.checkImageKey(t)&&this.removeImage(t);var r=i in n.LoaderParser?n.LoaderParser[i](s):s,o={key:t,url:e,data:r,base:new PIXI.BaseTexture(r,null,this.game.resolution),frame:new n.Frame(0,0,0,r.width,r.height,t),frameData:new n.FrameData,fileFormat:i};return o.frameData.addFrame(new n.Frame(0,0,0,r.width,r.height,e)),this._cache.image[t]=o,this._resolveURL(e,o),o},addCanvas:function(t,e,i){void 0===i&&(i=e.getContext("2d")),this._cache.canvas[t]={canvas:e,context:i}},addImage:function(t,e,i){this.checkImageKey(t)&&this.removeImage(t),!1===i.complete&&console.warn('Phaser.Cache.addImage: Image "%s" is not complete',t);var s={key:t,url:e,data:i,base:new PIXI.BaseTexture(i,null,this.game.resolution),frame:new n.Frame(0,0,0,i.width,i.height,t),frameData:new n.FrameData};return s.frameData.addFrame(new n.Frame(0,0,0,i.width,i.height,e)),this._cache.image[t]=s,this._resolveURL(e,s),"__default"===t?n.Cache.DEFAULT=new PIXI.Texture(s.base):"__missing"===t&&(n.Cache.MISSING=new PIXI.Texture(s.base)),s},addImageAsync:function(t,e,i){var n=this,s=new Image;s.onload=function(){i.call(this,n.addImage(t,null,s)),n._removePending(),s.onload=null},this._addPending(),s.src=e},addDefaultImage:function(){this.addImageAsync(n.Cache.DEFAULT_KEY,n.Cache.DEFAULT_SRC,(function(t){t.base.skipRender=!0,n.Cache.DEFAULT=new PIXI.Texture(t.base)}))},addMissingImage:function(){this.addImageAsync(n.Cache.MISSING_KEY,n.Cache.MISSING_SRC,(function(t){n.Cache.MISSING=new PIXI.Texture(t.base)}))},addSound:function(t,e,i,n,s){void 0===n&&(n=!0,s=!1),void 0===s&&(n=!1,s=!0);var r=!1;s&&(r=!0),this._cache.sound[t]={url:e,data:i,isDecoding:!1,decoded:r,webAudio:n,audioTag:s,locked:this.game.sound.touchLocked},this._resolveURL(e,this._cache.sound[t])},addText:function(t,e,i){this._cache.text[t]={url:e,data:i},this._resolveURL(e,this._cache.text[t])},addPhysicsData:function(t,e,i,n){this._cache.physics[t]={url:e,data:i,format:n},this._resolveURL(e,this._cache.physics[t])},addTilemap:function(t,e,i,n){this._cache.tilemap[t]={url:e,data:i,format:n},this._resolveURL(e,this._cache.tilemap[t])},addBinary:function(t,e){this._cache.binary[t]=e},addBitmapData:function(t,e,i){return e.key=t,void 0===i&&(i=new n.FrameData).addFrame(e.textureFrame),this._cache.bitmapData[t]={data:e,frameData:i},e},addBitmapFont:function(t,e,i,s,r,o,a){var h={url:e,data:i,font:null,base:new PIXI.BaseTexture(i,null,this.game.resolution)};void 0===o&&(o=0),void 0===a&&(a=0),h.font="json"===r?n.LoaderParser.jsonBitmapFont(s,h.base,o,a,!1,this.game.resolution):n.LoaderParser.xmlBitmapFont(s,h.base,o,a,!1,this.game.resolution),this._cache.bitmapFont[t]=h,this._resolveURL(e,h)},addBitmapFontFromAtlas:function(t,e,i,s,r,o,a){var h=this.getFrameByName(e,i);if(h){var l,c={font:null,base:this.getBaseTexture(e),frame:h};void 0===o&&(o=0),void 0===a&&(a=0),"json"===r?(l=this.getJSON(s),c.font=n.LoaderParser.jsonBitmapFont(l,c.base,o,a,h,this.game.resolution)):(l=this.getXML(s),c.font=n.LoaderParser.xmlBitmapFont(l,c.base,o,a,h,this.game.resolution)),this._cache.bitmapFont[t]=c}},addJSON:function(t,e,i){this._cache.json[t]={url:e,data:i},this._resolveURL(e,this._cache.json[t])},addXML:function(t,e,i){this._cache.xml[t]={url:e,data:i},this._resolveURL(e,this._cache.xml[t])},addVideo:function(t,e,i,n){this._cache.video[t]={url:e,data:i,isBlob:n,locked:!0},this._resolveURL(e,this._cache.video[t])},addShader:function(t,e,i){this._cache.shader[t]={url:e,data:i},this._resolveURL(e,this._cache.shader[t])},addRenderTexture:function(t,e){this._cache.renderTexture[t]={texture:e,frame:new n.Frame(0,0,0,e.width,e.height,"","")}},addSpriteSheet:function(t,e,i,s,r,o,a,h,l){void 0===o&&(o=-1),void 0===a&&(a=0),void 0===h&&(h=0);var c={key:t,url:e,data:i,frameWidth:s,frameHeight:r,margin:a,spacing:h,base:new PIXI.BaseTexture(i,null,this.game.resolution),frameData:n.AnimationParser.spriteSheet(this.game,i,s,r,o,a,h,l)};this._cache.image[t]=c,this._resolveURL(e,c)},addTextureAtlas:function(t,e,i,s,r){var o={key:t,url:e,data:i,base:new PIXI.BaseTexture(i,null,this.game.resolution)};r===n.Loader.TEXTURE_ATLAS_XML_STARLING?o.frameData=n.AnimationParser.XMLData(this.game,s,t):r===n.Loader.TEXTURE_ATLAS_JSON_PYXEL?o.frameData=n.AnimationParser.JSONDataPyxel(this.game,s,t):Array.isArray(s.frames)?o.frameData=n.AnimationParser.JSONData(this.game,s,t):o.frameData=n.AnimationParser.JSONDataHash(this.game,s,t),this._cache.image[t]=o,this._resolveURL(e,o)},addData:function(t,e){this._cache.data[t]=e},reloadSound:function(t){var e=this,i=this.getSound(t);i&&(i.data.src=i.url,i.data.addEventListener("canplaythrough",(function(){return e.reloadSoundComplete(t)}),!1),i.data.load())},reloadSoundComplete:function(t){var e=this.getSound(t);e&&(e.locked=!1,this.onSoundUnlock.dispatch(t))},updateSound:function(t,e,i){var n=this.getSound(t);n&&(n[e]=i)},decodedSound:function(t,e){var i=this.getSound(t);i.data=e,i.decoded=!0,i.isDecoding=!1},isSoundDecoded:function(t){var e=this.getItem(t,n.Cache.SOUND,"isSoundDecoded");if(e)return e.decoded},isSoundReady:function(t){var e=this.getItem(t,n.Cache.SOUND,"isSoundDecoded");if(e)return e.decoded&&!this.game.sound.touchLocked},checkKey:function(t,e){return!!this._cacheMap[t][e]},checkURL:function(t){return!!this._urlMap[this._resolveURL(t)]},checkCanvasKey:function(t){return this.checkKey(n.Cache.CANVAS,t)},checkDataKey:function(t){return this.checkKey(n.Cache.DATA,t)},checkImageKey:function(t){return this.checkKey(n.Cache.IMAGE,t)},checkTextureKey:function(t){return this.checkKey(n.Cache.TEXTURE,t)},checkSoundKey:function(t){return this.checkKey(n.Cache.SOUND,t)},checkTextKey:function(t){return this.checkKey(n.Cache.TEXT,t)},checkPhysicsKey:function(t){return this.checkKey(n.Cache.PHYSICS,t)},checkTilemapKey:function(t){return this.checkKey(n.Cache.TILEMAP,t)},checkBinaryKey:function(t){return this.checkKey(n.Cache.BINARY,t)},checkBitmapDataKey:function(t){return this.checkKey(n.Cache.BITMAPDATA,t)},checkBitmapFontKey:function(t){return this.checkKey(n.Cache.BITMAPFONT,t)},checkJSONKey:function(t){return this.checkKey(n.Cache.JSON,t)},checkXMLKey:function(t){return this.checkKey(n.Cache.XML,t)},checkVideoKey:function(t){return this.checkKey(n.Cache.VIDEO,t)},checkShaderKey:function(t){return this.checkKey(n.Cache.SHADER,t)},checkRenderTextureKey:function(t){return this.checkKey(n.Cache.RENDER_TEXTURE,t)},getItem:function(t,e,i,n){return this.checkKey(e,t)?void 0===n?this._cacheMap[e][t]:this._cacheMap[e][t][n]:(i&&console.warn("Phaser.Cache."+i+': Key "'+t+'" not found in Cache.'),null)},getCanvas:function(t){return this.getItem(t,n.Cache.CANVAS,"getCanvas","canvas")},getImage:function(t,e){null==t&&(t="__default"),void 0===e&&(e=!1);var i=this.getItem(t,n.Cache.IMAGE,"getImage");return null===i&&(i=this.getItem("__missing",n.Cache.IMAGE,"getImage")),e?i:i.data},getTextureFrame:function(t){return this.getItem(t,n.Cache.TEXTURE,"getTextureFrame","frame")},getSound:function(t){return this.getItem(t,n.Cache.SOUND,"getSound")},getSoundData:function(t){return this.getItem(t,n.Cache.SOUND,"getSoundData","data")},getText:function(t){return this.getItem(t,n.Cache.TEXT,"getText","data")},getPhysicsData:function(t,e,i){var s=this.getItem(t,n.Cache.PHYSICS,"getPhysicsData","data");if(null===s||null==e)return s;if(s[e]){var r=s[e];if(!r||!i)return r;for(var o in r)if((o=r[o]).fixtureKey===i)return o;console.warn('Phaser.Cache.getPhysicsData: Could not find given fixtureKey: "'+i+" in "+t+'"')}else console.warn('Phaser.Cache.getPhysicsData: Invalid key/object: "'+t+" / "+e+'"');return null},getTilemapData:function(t){return this.getItem(t,n.Cache.TILEMAP,"getTilemapData")},getBinary:function(t){return this.getItem(t,n.Cache.BINARY,"getBinary")},getBitmapData:function(t){return this.getItem(t,n.Cache.BITMAPDATA,"getBitmapData","data")},getBitmapFont:function(t){return this.getItem(t,n.Cache.BITMAPFONT,"getBitmapFont")},getJSON:function(t,e){var i=this.getItem(t,n.Cache.JSON,"getJSON","data");return i?e?n.Utils.extend(!0,Array.isArray(i)?[]:{},i):i:null},getXML:function(t){return this.getItem(t,n.Cache.XML,"getXML","data")},getVideo:function(t){return this.getItem(t,n.Cache.VIDEO,"getVideo")},getShader:function(t){return this.getItem(t,n.Cache.SHADER,"getShader","data")},getRenderTexture:function(t){return this.getItem(t,n.Cache.RENDER_TEXTURE,"getRenderTexture")},getData:function(t){return this.getItem(t,n.Cache.DATA,"getData")},getBaseTexture:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),this.getItem(t,e,"getBaseTexture","base")},getFrame:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),this.getItem(t,e,"getFrame","frame")},getFrameCount:function(t,e){var i=this.getFrameData(t,e);return i?i.total:0},getFrameData:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),this.getItem(t,e,"getFrameData","frameData")},hasFrameData:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),null!==this.getItem(t,e,"","frameData")},updateFrameData:function(t,e,i){void 0===i&&(i=n.Cache.IMAGE),this._cacheMap[i][t]&&(this._cacheMap[i][t].frameData=e)},getFrameByIndex:function(t,e,i){var n=this.getFrameData(t,i);return n?n.getFrame(e):null},getFrameByName:function(t,e,i){var n=this.getFrameData(t,i);return n?n.getFrameByName(e):null},getURL:function(t){return(t=this._resolveURL(t))?this._urlMap[t]:(console.warn('Phaser.Cache.getUrl: Invalid url: "'+t+'" or Cache.autoResolveURL was false'),null)},getKeys:function(t){void 0===t&&(t=n.Cache.IMAGE);var e=[];if(this._cacheMap[t])for(var i in this._cacheMap[t])"__default"!==i&&"__missing"!==i&&e.push(i);return e},removeCanvas:function(t){delete this._cache.canvas[t]},removeImage:function(t,e){void 0===e&&(e=!0);var i=this.getImage(t,!0);e&&i.base&&i.base.destroy(),delete this._cache.image[t]},removeSound:function(t){delete this._cache.sound[t]},removeText:function(t){delete this._cache.text[t]},removePhysics:function(t){delete this._cache.physics[t]},removeTilemap:function(t){delete this._cache.tilemap[t]},removeBinary:function(t){delete this._cache.binary[t]},removeBitmapData:function(t){delete this._cache.bitmapData[t]},removeBitmapFont:function(t){delete this._cache.bitmapFont[t]},removeJSON:function(t){delete this._cache.json[t]},removeXML:function(t){delete this._cache.xml[t]},removeVideo:function(t){delete this._cache.video[t]},removeShader:function(t){delete this._cache.shader[t]},removeRenderTexture:function(t){delete this._cache.renderTexture[t]},removeSpriteSheet:function(t){delete this._cache.spriteSheet[t]},removeTextureAtlas:function(t){delete this._cache.image[t]},removeData:function(t){delete this._cache.data[t]},clearGLTextures:function(){for(var t in this._cache.image)this._cache.image[t].base._glTextures=[]},_resolveURL:function(t,e){return this.autoResolveURL?(this._urlResolver.src=this.game.load.baseURL+t,this._urlTemp=this._urlResolver.src,this._urlResolver.src="",e&&(this._urlMap[this._urlTemp]=e),this._urlTemp):null},destroy:function(){for(var t=0;t0?setTimeout((function(){t.isReady||(console.warn("Phaser.Cache: Still waiting for images after %s ms.",e),t._ready())}),n.Cache.READY_TIMEOUT):this._ready()},_addPending:function(){this._pendingCount+=1},_removePending:function(){this._pendingCount-=1,this._checkReady()},_checkReady:function(){this.isReady&&this._ready()},_ready:function(){this._pendingCount=0,this.onReady.dispatch(this)}},n.Cache.prototype.constructor=n.Cache,Object.defineProperty(n.Cache.prototype,"isReady",{get:function(){return this._pendingCount<=0}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Loader=function(t){this.game=t,this.cache=t.cache,this.resetLocked=!1,this.isLoading=!1,this.hasLoaded=!1,this.preloadSprite=null,this.crossOrigin=!1,this.baseURL="",this.path="",this.headers={requestedWith:!1,json:"application/json",xml:"application/xml"},this.onLoadStart=new s.Signal,this.onBeforeLoadComplete=new s.Signal,this.onLoadComplete=new s.Signal,this.onPackComplete=new s.Signal,this.onFileStart=new s.Signal,this.onFileComplete=new s.Signal,this.onFileError=new s.Signal,this.enableParallel=!0,this.maxParallelDownloads=4,this._withSyncPointDepth=0,this._fileList=[],this._flightQueue=[],this._processingHead=0,this._fileLoadStarted=!1,this._totalPackCount=0,this._totalFileCount=0,this._loadedPackCount=0,this._loadedFileCount=0},s.Loader.TEXTURE_ATLAS_JSON_ARRAY=0,s.Loader.TEXTURE_ATLAS_JSON_HASH=1,s.Loader.TEXTURE_ATLAS_XML_STARLING=2,s.Loader.PHYSICS_LIME_CORONA_JSON=3,s.Loader.PHYSICS_PHASER_JSON=4,s.Loader.TEXTURE_ATLAS_JSON_PYXEL=5,s.Loader.prototype={setPreloadSprite:function(t,e){e=e||0,this.preloadSprite={sprite:t,direction:e,width:t.width,height:t.height,rect:null},this.preloadSprite.rect=0===e?new s.Rectangle(0,0,1,t.height):new s.Rectangle(0,0,t.width,1),t.crop(this.preloadSprite.rect),t.visible=!0},resize:function(){this.preloadSprite&&this.preloadSprite.height!==this.preloadSprite.sprite.height&&(this.preloadSprite.rect.height=this.preloadSprite.sprite.height)},checkKeyExists:function(t,e){return this.getAssetIndex(t,e)>-1},getAssetIndex:function(t,e){for(var i=-1,n=0;n-1&&{index:i,file:this._fileList[i]}},reset:function(t,e){void 0===e&&(e=!1),this.resetLocked||(t&&(this.preloadSprite=null),this.isLoading=!1,this._processingHead=0,this._fileList.length=0,this._flightQueue.length=0,this._fileLoadStarted=!1,this._totalFileCount=0,this._totalPackCount=0,this._loadedPackCount=0,this._loadedFileCount=0,e&&(this.onLoadStart.removeAll(),this.onLoadComplete.removeAll(),this.onPackComplete.removeAll(),this.onFileStart.removeAll(),this.onFileComplete.removeAll(),this.onFileError.removeAll()))},addToFileList:function(t,e,i,n,s,r){if(void 0===s&&(s=!1),void 0===e||""===e)return console.warn("Phaser.Loader: Invalid or no key given of type "+t),this;if(null==i){if(!r)return console.warn("Phaser.Loader: No URL given for file type: "+t+" key: "+e),this;i=e+r}var o={type:t,key:e,path:this.path,url:i,syncPoint:this._withSyncPointDepth>0,data:null,loading:!1,loaded:!1,error:!1};if(n)for(var a in n)o[a]=n[a];var h=this.getAssetIndex(t,e);if(s&&h>-1){var l=this._fileList[h];l.loading||l.loaded?(this._fileList.push(o),this._totalFileCount++):this._fileList[h]=o}else-1===h&&(this._fileList.push(o),this._totalFileCount++);return this},replaceInFileList:function(t,e,i,n){return this.addToFileList(t,e,i,n,!0)},pack:function(t,e,i,n){if(void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),!e&&!i)return console.warn("Phaser.Loader.pack - Both url and data are null. One must be set."),this;var s={type:"packfile",key:t,url:e,path:this.path,syncPoint:!0,data:null,loading:!1,loaded:!1,error:!1,callbackContext:n};i&&("string"==typeof i&&(i=JSON.parse(i)),s.data=i||{},s.loaded=!0);for(var r=0;r=i||e&&this._loadedPackCount===this._totalPackCount)break}if(this.updateProgress(),this._processingHead>=this._fileList.length)this.finishedLoading();else if(!this._flightQueue.length){console.warn("Phaser.Loader - aborting: processing queue empty, loading may have stalled");var s=this;setTimeout((function(){s.finishedLoading(!0)}),2e3)}},finishedLoading:function(t){!this.hasLoaded&&this.game.state&&(this.hasLoaded=!0,this.isLoading=!1,t||this._fileLoadStarted||(this._fileLoadStarted=!0,this.onLoadStart.dispatch()),this.game.state.loadUpdate(),this.onBeforeLoadComplete.dispatch(),this.reset(),this.onLoadComplete.dispatch(),this.game.state.loadComplete())},asyncComplete:function(t,e){void 0===e&&(e=""),t.loaded=!0,t.error=!!e,e&&(t.errorMessage=e,console.warn("Phaser.Loader - "+t.type+"["+t.key+"]: "+e)),this.processLoadQueue()},processPack:function(t){var e=t.data[t.key];if(e)for(var i=0;i=400&&r.status<=599?s.call(o,t,r):n.call(o,t,r)}catch(e){o.hasLoaded?window.console&&console.error(e):o.asyncComplete(t,e.message||"Exception")}},r.onerror=function(){try{return s.call(o,t,r)}catch(e){o.hasLoaded?window.console&&console.error(e):o.asyncComplete(t,e.message||"Exception")}},t.requestObject=r,t.requestUrl=e,r.send()},getVideoURL:function(t){for(var e=0;e=0&&(n=n.substr(0,n.indexOf("?"))),i=n.substr((Math.max(0,n.lastIndexOf("."))||1/0)+1).toLowerCase(),this.game.device.canPlayVideo(i))return t[e]}}return null},getAudioURL:function(t){if(this.game.sound.noAudio)return null;for(var e=0;e=0&&(n=n.substr(0,n.indexOf("?"))),i=n.substr((Math.max(0,n.lastIndexOf("."))||1/0)+1).toLowerCase(),this.game.device.canPlayAudio(i))return t[e]}}return null},fileError:function(t,e,i){var n="error loading asset from URL "+(t.requestUrl||this.transformUrl(t.url,t));!i&&e&&(i=e.status),i&&(n=n+" ("+i+")"),this.asyncComplete(t,n)},fileComplete:function(t,e){var i=!0;switch(t.type){case"packfile":var n=JSON.parse(e.responseText);t.data=n||{};break;case"texture":var r=/\.([^.]+)$/.exec(t.url.split("?",1)[0])[1].toLowerCase();null!==t.data?this.cache.addCompressedTextureMetaData(t.key,t.url,r,t.data):this.cache.addCompressedTextureMetaData(t.key,t.url,r,e.response);break;case"image":this.cache.addImage(t.key,t.url,t.data);break;case"spritesheet":this.cache.addSpriteSheet(t.key,t.url,t.data,t.frameWidth,t.frameHeight,t.frameMax,t.margin,t.spacing,t.skipFrames);break;case"textureatlas":if(null==t.atlasURL)this.cache.addTextureAtlas(t.key,t.url,t.data,t.atlasData,t.format);else if(i=!1,t.format===s.Loader.TEXTURE_ATLAS_JSON_ARRAY||t.format===s.Loader.TEXTURE_ATLAS_JSON_HASH||t.format===s.Loader.TEXTURE_ATLAS_JSON_PYXEL)this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",this.jsonLoadComplete);else{if(t.format!==s.Loader.TEXTURE_ATLAS_XML_STARLING)throw new Error("Phaser.Loader. Invalid Texture Atlas format: "+t.format);this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",this.xmlLoadComplete)}break;case"bitmapfont":t.atlasURL?(i=!1,this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",(function(t,e){var i;try{i=JSON.parse(e.responseText)}catch(t){}i?(t.atlasType="json",this.jsonLoadComplete(t,e)):(t.atlasType="xml",this.xmlLoadComplete(t,e))}))):this.cache.addBitmapFont(t.key,t.url,t.data,t.atlasData,t.atlasType,t.xSpacing,t.ySpacing);break;case"video":if(t.asBlob)try{t.data=e.response}catch(e){throw new Error("Phaser.Loader. Unable to parse video file as Blob: "+t.key)}this.cache.addVideo(t.key,t.url,t.data,t.asBlob);break;case"audio":this.game.sound.usingWebAudio?(t.data=e.response,this.cache.addSound(t.key,t.url,t.data,!0,!1),t.autoDecode&&this.game.sound.decode(t.key)):this.cache.addSound(t.key,t.url,t.data,!1,!0);break;case"text":t.data=e.responseText,this.cache.addText(t.key,t.url,t.data);break;case"shader":t.data=e.responseText,this.cache.addShader(t.key,t.url,t.data);break;case"physics":n=JSON.parse(e.responseText);this.cache.addPhysicsData(t.key,t.url,n,t.format);break;case"script":t.data=document.createElement("script"),t.data.language="javascript",t.data.type="text/javascript",t.data.defer=!1,t.data.text=e.responseText,document.head.appendChild(t.data),t.callback&&(t.data=t.callback.call(t.callbackContext,t.key,e.responseText));break;case"binary":t.callback?t.data=t.callback.call(t.callbackContext,t.key,e.response):t.data=e.response,this.cache.addBinary(t.key,t.data)}i&&this.asyncComplete(t)},jsonLoadComplete:function(t,e){var i=JSON.parse(e.responseText);"tilemap"===t.type?this.cache.addTilemap(t.key,t.url,i,t.format):"bitmapfont"===t.type?this.cache.addBitmapFont(t.key,t.url,t.data,i,t.atlasType,t.xSpacing,t.ySpacing):"json"===t.type?this.cache.addJSON(t.key,t.url,i):this.cache.addTextureAtlas(t.key,t.url,t.data,i,t.format),this.asyncComplete(t)},csvLoadComplete:function(t,e){var i=e.responseText;this.cache.addTilemap(t.key,t.url,i,t.format),this.asyncComplete(t)},xmlLoadComplete:function(t,e){var i=e.responseText,n=this.parseXml(i);if(!n){var s=e.responseType||e.contentType;return console.warn("Phaser.Loader - "+t.key+": invalid XML ("+s+")"),void this.asyncComplete(t,"invalid XML")}"bitmapfont"===t.type?this.cache.addBitmapFont(t.key,t.url,t.data,n,t.atlasType,t.xSpacing,t.ySpacing):"textureatlas"===t.type?this.cache.addTextureAtlas(t.key,t.url,t.data,n,t.format):"xml"===t.type&&this.cache.addXML(t.key,t.url,n),this.asyncComplete(t)},parseXml:function(t){var e;try{if(window.DOMParser)e=(new DOMParser).parseFromString(t,"text/xml");else(e=new ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null},updateProgress:function(){this.preloadSprite&&(0===this.preloadSprite.direction?this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress):this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite?this.preloadSprite.sprite.updateCrop():this.preloadSprite=null)},totalLoadedFiles:function(){return this._loadedFileCount},totalQueuedFiles:function(){return this._totalFileCount-this._loadedFileCount},totalLoadedPacks:function(){return this._totalPackCount},totalQueuedPacks:function(){return this._totalPackCount-this._loadedPackCount}},Object.defineProperty(s.Loader.prototype,"progressFloat",{get:function(){var t=this._loadedFileCount/this._totalFileCount*100;return s.Math.clamp(t||0,0,100)}}),Object.defineProperty(s.Loader.prototype,"progress",{get:function(){return Math.round(this.progressFloat)}}),s.Loader.prototype.constructor=s.Loader, +n.Loader=function(t){this.game=t,this.cache=t.cache,this.resetLocked=!1,this.isLoading=!1,this.hasLoaded=!1,this.preloadSprite=null,this.crossOrigin=!1,this.baseURL="",this.path="",this.headers={requestedWith:!1,json:"application/json",xml:"application/xml"},this.onLoadStart=new n.Signal,this.onBeforeLoadComplete=new n.Signal,this.onLoadComplete=new n.Signal,this.onPackComplete=new n.Signal,this.onFileStart=new n.Signal,this.onFileComplete=new n.Signal,this.onFileError=new n.Signal,this.enableParallel=!0,this.maxParallelDownloads=4,this._withSyncPointDepth=0,this._fileList=[],this._flightQueue=[],this._processingHead=0,this._fileLoadStarted=!1,this._totalPackCount=0,this._totalFileCount=0,this._loadedPackCount=0,this._loadedFileCount=0},n.Loader.TEXTURE_ATLAS_JSON_ARRAY=0,n.Loader.TEXTURE_ATLAS_JSON_HASH=1,n.Loader.TEXTURE_ATLAS_XML_STARLING=2,n.Loader.PHYSICS_LIME_CORONA_JSON=3,n.Loader.PHYSICS_PHASER_JSON=4,n.Loader.TEXTURE_ATLAS_JSON_PYXEL=5,n.Loader.prototype={setPreloadSprite:function(t,e){e=e||0,this.preloadSprite={sprite:t,direction:e,width:t.width,height:t.height,rect:null},this.preloadSprite.rect=0===e?new n.Rectangle(0,0,1,t.height):new n.Rectangle(0,0,t.width,1),t.crop(this.preloadSprite.rect),t.visible=!0},resize:function(){this.preloadSprite&&this.preloadSprite.height!==this.preloadSprite.sprite.height&&(this.preloadSprite.rect.height=this.preloadSprite.sprite.height)},checkKeyExists:function(t,e){return this.getAssetIndex(t,e)>-1},getAssetIndex:function(t,e){for(var i=-1,n=0;n-1&&{index:i,file:this._fileList[i]}},reset:function(t,e){void 0===e&&(e=!1),this.resetLocked||(t&&(this.preloadSprite=null),this.isLoading=!1,this._processingHead=0,this._fileList.length=0,this._flightQueue.length=0,this._fileLoadStarted=!1,this._totalFileCount=0,this._totalPackCount=0,this._loadedPackCount=0,this._loadedFileCount=0,e&&(this.onLoadStart.removeAll(),this.onLoadComplete.removeAll(),this.onPackComplete.removeAll(),this.onFileStart.removeAll(),this.onFileComplete.removeAll(),this.onFileError.removeAll()))},addToFileList:function(t,e,i,n,s,r){if(void 0===s&&(s=!1),void 0===e||""===e)return console.warn("Phaser.Loader: Invalid or no key given of type "+t),this;if(null==i){if(!r)return console.warn("Phaser.Loader: No URL given for file type: "+t+" key: "+e),this;i=e+r}var o={type:t,key:e,path:this.path,url:i,syncPoint:this._withSyncPointDepth>0,data:null,loading:!1,loaded:!1,error:!1};if(n)for(var a in n)o[a]=n[a];var h=this.getAssetIndex(t,e);if(s&&h>-1){var l=this._fileList[h];l.loading||l.loaded?(this._fileList.push(o),this._totalFileCount++):this._fileList[h]=o}else-1===h&&(this._fileList.push(o),this._totalFileCount++);return this},replaceInFileList:function(t,e,i,n){return this.addToFileList(t,e,i,n,!0)},pack:function(t,e,i,n){if(void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),!e&&!i)return console.warn("Phaser.Loader.pack - Both url and data are null. One must be set."),this;var s={type:"packfile",key:t,url:e,path:this.path,syncPoint:!0,data:null,loading:!1,loaded:!1,error:!1,callbackContext:n};i&&("string"==typeof i&&(i=JSON.parse(i)),s.data=i||{},s.loaded=!0);for(var r=0;r=i||e&&this._loadedPackCount===this._totalPackCount)break}if(this.updateProgress(),this._processingHead>=this._fileList.length)this.finishedLoading();else if(!this._flightQueue.length){console.warn("Phaser.Loader - aborting: processing queue empty, loading may have stalled");var s=this;setTimeout((function(){s.finishedLoading(!0)}),2e3)}},finishedLoading:function(t){!this.hasLoaded&&this.game.state&&(this.hasLoaded=!0,this.isLoading=!1,t||this._fileLoadStarted||(this._fileLoadStarted=!0,this.onLoadStart.dispatch()),this.game.state.loadUpdate(),this.onBeforeLoadComplete.dispatch(),this.reset(),this.onLoadComplete.dispatch(),this.game.state.loadComplete())},asyncComplete:function(t,e){void 0===e&&(e=""),t.loaded=!0,t.error=!!e,e&&(t.errorMessage=e,console.warn("Phaser.Loader - "+t.type+"["+t.key+"]: "+e)),this.processLoadQueue()},processPack:function(t){var e=t.data[t.key];if(e)for(var i=0;i=400&&r.status<=599?s.call(o,t,r):n.call(o,t,r)}catch(e){o.hasLoaded?window.console&&console.error(e):o.asyncComplete(t,e.message||"Exception")}},r.onerror=function(){try{return s.call(o,t,r)}catch(e){o.hasLoaded?window.console&&console.error(e):o.asyncComplete(t,e.message||"Exception")}},t.requestObject=r,t.requestUrl=e,r.send()},getVideoURL:function(t){for(var e=0;e=0&&(n=n.substr(0,n.indexOf("?"))),i=n.substr((Math.max(0,n.lastIndexOf("."))||1/0)+1).toLowerCase(),this.game.device.canPlayVideo(i))return t[e]}}return null},getAudioURL:function(t){if(this.game.sound.noAudio)return null;for(var e=0;e=0&&(n=n.substr(0,n.indexOf("?"))),i=n.substr((Math.max(0,n.lastIndexOf("."))||1/0)+1).toLowerCase(),this.game.device.canPlayAudio(i))return t[e]}}return null},fileError:function(t,e,i){var n="error loading asset from URL "+(t.requestUrl||this.transformUrl(t.url,t));!i&&e&&(i=e.status),i&&(n=n+" ("+i+")"),this.asyncComplete(t,n)},fileComplete:function(t,e){var i=!0;switch(t.type){case"packfile":var s=JSON.parse(e.responseText);t.data=s||{};break;case"texture":var r=/\.([^.]+)$/.exec(t.url.split("?",1)[0])[1].toLowerCase();null!==t.data?this.cache.addCompressedTextureMetaData(t.key,t.url,r,t.data):this.cache.addCompressedTextureMetaData(t.key,t.url,r,e.response);break;case"image":this.cache.addImage(t.key,t.url,t.data);break;case"spritesheet":this.cache.addSpriteSheet(t.key,t.url,t.data,t.frameWidth,t.frameHeight,t.frameMax,t.margin,t.spacing,t.skipFrames);break;case"textureatlas":if(null==t.atlasURL)this.cache.addTextureAtlas(t.key,t.url,t.data,t.atlasData,t.format);else if(i=!1,t.format===n.Loader.TEXTURE_ATLAS_JSON_ARRAY||t.format===n.Loader.TEXTURE_ATLAS_JSON_HASH||t.format===n.Loader.TEXTURE_ATLAS_JSON_PYXEL)this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",this.jsonLoadComplete);else{if(t.format!==n.Loader.TEXTURE_ATLAS_XML_STARLING)throw new Error("Phaser.Loader. Invalid Texture Atlas format: "+t.format);this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",this.xmlLoadComplete)}break;case"bitmapfont":t.atlasURL?(i=!1,this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",(function(t,e){var i;try{i=JSON.parse(e.responseText)}catch(t){}i?(t.atlasType="json",this.jsonLoadComplete(t,e)):(t.atlasType="xml",this.xmlLoadComplete(t,e))}))):this.cache.addBitmapFont(t.key,t.url,t.data,t.atlasData,t.atlasType,t.xSpacing,t.ySpacing);break;case"video":if(t.asBlob)try{t.data=e.response}catch(e){throw new Error("Phaser.Loader. Unable to parse video file as Blob: "+t.key)}this.cache.addVideo(t.key,t.url,t.data,t.asBlob);break;case"audio":this.game.sound.usingWebAudio?(t.data=e.response,this.cache.addSound(t.key,t.url,t.data,!0,!1),t.autoDecode&&this.game.sound.decode(t.key)):this.cache.addSound(t.key,t.url,t.data,!1,!0);break;case"text":t.data=e.responseText,this.cache.addText(t.key,t.url,t.data);break;case"shader":t.data=e.responseText,this.cache.addShader(t.key,t.url,t.data);break;case"physics":s=JSON.parse(e.responseText);this.cache.addPhysicsData(t.key,t.url,s,t.format);break;case"script":t.data=document.createElement("script"),t.data.language="javascript",t.data.type="text/javascript",t.data.defer=!1,t.data.text=e.responseText,document.head.appendChild(t.data),t.callback&&(t.data=t.callback.call(t.callbackContext,t.key,e.responseText));break;case"binary":t.callback?t.data=t.callback.call(t.callbackContext,t.key,e.response):t.data=e.response,this.cache.addBinary(t.key,t.data)}i&&this.asyncComplete(t)},jsonLoadComplete:function(t,e){var i=JSON.parse(e.responseText);"tilemap"===t.type?this.cache.addTilemap(t.key,t.url,i,t.format):"bitmapfont"===t.type?this.cache.addBitmapFont(t.key,t.url,t.data,i,t.atlasType,t.xSpacing,t.ySpacing):"json"===t.type?this.cache.addJSON(t.key,t.url,i):this.cache.addTextureAtlas(t.key,t.url,t.data,i,t.format),this.asyncComplete(t)},csvLoadComplete:function(t,e){var i=e.responseText;this.cache.addTilemap(t.key,t.url,i,t.format),this.asyncComplete(t)},xmlLoadComplete:function(t,e){var i=e.responseText,n=this.parseXml(i);if(!n){var s=e.responseType||e.contentType;return console.warn("Phaser.Loader - "+t.key+": invalid XML ("+s+")"),void this.asyncComplete(t,"invalid XML")}"bitmapfont"===t.type?this.cache.addBitmapFont(t.key,t.url,t.data,n,t.atlasType,t.xSpacing,t.ySpacing):"textureatlas"===t.type?this.cache.addTextureAtlas(t.key,t.url,t.data,n,t.format):"xml"===t.type&&this.cache.addXML(t.key,t.url,n),this.asyncComplete(t)},parseXml:function(t){var e;try{if(window.DOMParser)e=(new DOMParser).parseFromString(t,"text/xml");else(e=new ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null},updateProgress:function(){this.preloadSprite&&(0===this.preloadSprite.direction?this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress):this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite?this.preloadSprite.sprite.updateCrop():this.preloadSprite=null)},totalLoadedFiles:function(){return this._loadedFileCount},totalQueuedFiles:function(){return this._totalFileCount-this._loadedFileCount},totalLoadedPacks:function(){return this._totalPackCount},totalQueuedPacks:function(){return this._totalPackCount-this._loadedPackCount}},Object.defineProperty(n.Loader.prototype,"progressFloat",{get:function(){var t=this._loadedFileCount/this._totalFileCount*100;return n.Math.clamp(t||0,0,100)}}),Object.defineProperty(n.Loader.prototype,"progress",{get:function(){return Math.round(this.progressFloat)}}),n.Loader.prototype.constructor=n.Loader, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.LoaderParser={bitmapFont:function(t,e,i,n,s,r){return this.xmlBitmapFont(t,e,i,n,s,r)},xmlBitmapFont:function(t,e,i,n,s,r){null==r&&(r=1);var o={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];o.font=a.getAttribute("face"),o.size=parseInt(a.getAttribute("size"),10),o.lineHeight=parseInt(h.getAttribute("lineHeight"),10)+n,o.chars={};for(var l=t.getElementsByTagName("char"),u=s?s.x:0,c=s?s.y:0,d=0;ds.spriteSourceSizeX+s.spriteSourceSizeW&&(f.width-=f.x+f.width-s.spriteSourceSizeX-s.spriteSourceSizeW),f.y+f.height>s.spriteSourceSizeY+s.spriteSourceSizeH&&(f.height-=f.y+f.height-s.spriteSourceSizeY-s.spriteSourceSizeH),f.xs.spriteSourceSizeX+s.spriteSourceSizeW&&(n.width-=n.x+n.width-s.spriteSourceSizeX-s.spriteSourceSizeW),n.y+n.height>s.spriteSourceSizeY+s.spriteSourceSizeH&&(n.height-=n.y+n.height-s.spriteSourceSizeY-s.spriteSourceSizeH),n.x=0){switch(r>=0&&r<=3?e="PVRTC":r>=7&&r<=11?e="S3TC":6===r&&(e="ETC1"),r){case 0:o=35841;break;case 1:o=35843;break;case 2:o=35840;break;case 3:o=35842;break;case 6:o=36196;break;case 7:o=33777;break;case 9:o=33778;break;case 11:o=33779;break;default:o=-1}s={complete:!0,fileFormat:"PVR",compressionAlgorithm:e,flags:i[1],pixelFormat:r,colorSpace:i[4],channelType:i[5],height:i[6],width:i[7],depth:i[8],numberOfSurfaces:i[9],numberOfFaces:i[10],numberOfMipmaps:i[11],metaDataSize:i[12],textureData:n.subarray(52+i[12],n.byteLength),glExtensionFormat:o}}return s},dds:function(t){var e=new Uint8Array(t),i=new Uint32Array(t),n=null;return 68===e[0]&&68===e[1]&&83===e[2]&&32===e[3]&&("DX10"===(n={complete:!0,fileFormat:"DDS",compressionAlgorithm:"S3TC",size:i[1],flags:i[2],height:i[3],width:i[4],pitch:i[5],depth:i[6],mipmapCount:i[7],formatSize:i[19],formatFlag:i[19],formatFourCC:[String.fromCharCode(e[84]),String.fromCharCode(e[85]),String.fromCharCode(e[86]),String.fromCharCode(e[87])].join(""),formatBitCount:i[21],formatRBitMask:i[22],formatGBitMask:i[23],formatBBitMask:i[24],formatABitMask:i[25],caps1:i[26],caps2:i[27],caps3:i[28],caps4:i[29],reserved2:i[30],DXGIFormat:null,resourceDimension:null,miscFlag:null,arraySize:null,textureData:e.subarray(i[1]+4,e.byteLength)}).formatFourCC?(n.DXGIFormat=i[31],n.resourceDimension=i[32],n.miscFlag=i[33],n.arraySize=i[34],n.miscFlag=i[35]):"DXT5"===n.formatFourCC?n.glExtensionFormat=33779:"DXT3"===n.formatFourCC&&(n.glExtensionFormat=33778)),n},ktx:function(t){var e=new Uint8Array(t),i=new Uint32Array(t),n=null,s=16+i[15]/4|0,r=i[s],o=i[7],a=0;if(171===e[0]&&75===e[1]&&84===e[2]&&88===e[3]&&32===e[4]&&49===e[5]&&49===e[6]&&187===e[7]&&13===e[8]&&10===e[9]&&26===e[10]&&10===e[11]&&[36196,35840,35841,35842,35843,33776,33777,33778,33779].indexOf(o)>=0){switch(o){case 36196:a="ETC1";break;case 35840:case 35841:case 35842:case 35843:a="PVRTC";break;case 33776:case 33777:case 33778:case 33779:a="S3TC"}n={complete:!0,fileFormat:"KTX",compressionAlgorithm:a,endianness:i[3],glType:i[4],glTypeSize:i[5],glFormat:i[6],glInternalFormat:i[7],glBaseInternalFormat:i[8],width:i[9],height:i[10],pixelDepth:i[11],numberOfArrayElements:i[12],numberOfFaces:i[13],numberOfMipmapLevels:i[14],bytesOfKeyValueData:i[15],keyAndValueByteSize:i[16],imageSize:r,textureData:e.subarray(4*(s+1),r+100)}}return n},pkm:function(t){var e=new Uint8Array(t),i=null;return 80===e[0]&&75===e[1]&&77===e[2]&&32===e[3]&&(i={complete:!0,fileFormat:"PKM",compressionAlgorithm:"ETC1",format:65535&(e[6]<<8|e[7]),width:65535&(e[8]<<8|e[9]),height:65535&(e[10]<<8|e[11]),originalWidth:65535&(e[12]<<8|e[13]),originalHeight:65535&(e[14]<<8|e[15]),textureData:e.subarray(16,e.length)}),i}}, +n.LoaderParser={bitmapFont:function(t,e,i,n,s,r){return this.xmlBitmapFont(t,e,i,n,s,r)},xmlBitmapFont:function(t,e,i,n,s,r){null==r&&(r=1);var o={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];o.font=a.getAttribute("face"),o.size=parseInt(a.getAttribute("size"),10),o.lineHeight=parseInt(h.getAttribute("lineHeight"),10)+n,o.chars={};for(var l=t.getElementsByTagName("char"),c=s?s.x:0,u=s?s.y:0,d=0;ds.spriteSourceSizeX+s.spriteSourceSizeW&&(f.width-=f.x+f.width-s.spriteSourceSizeX-s.spriteSourceSizeW),f.y+f.height>s.spriteSourceSizeY+s.spriteSourceSizeH&&(f.height-=f.y+f.height-s.spriteSourceSizeY-s.spriteSourceSizeH),f.xs.spriteSourceSizeX+s.spriteSourceSizeW&&(n.width-=n.x+n.width-s.spriteSourceSizeX-s.spriteSourceSizeW),n.y+n.height>s.spriteSourceSizeY+s.spriteSourceSizeH&&(n.height-=n.y+n.height-s.spriteSourceSizeY-s.spriteSourceSizeH),n.x=0){switch(r>=0&&r<=3?e="PVRTC":r>=7&&r<=11?e="S3TC":6===r&&(e="ETC1"),r){case 0:o=35841;break;case 1:o=35843;break;case 2:o=35840;break;case 3:o=35842;break;case 6:o=36196;break;case 7:o=33777;break;case 9:o=33778;break;case 11:o=33779;break;default:o=-1}s={complete:!0,fileFormat:"PVR",compressionAlgorithm:e,flags:i[1],pixelFormat:r,colorSpace:i[4],channelType:i[5],height:i[6],width:i[7],depth:i[8],numberOfSurfaces:i[9],numberOfFaces:i[10],numberOfMipmaps:i[11],metaDataSize:i[12],textureData:n.subarray(52+i[12],n.byteLength),glExtensionFormat:o}}return s},dds:function(t){var e=new Uint8Array(t),i=new Uint32Array(t),n=null;return 68===e[0]&&68===e[1]&&83===e[2]&&32===e[3]&&("DX10"===(n={complete:!0,fileFormat:"DDS",compressionAlgorithm:"S3TC",size:i[1],flags:i[2],height:i[3],width:i[4],pitch:i[5],depth:i[6],mipmapCount:i[7],formatSize:i[19],formatFlag:i[19],formatFourCC:[String.fromCharCode(e[84]),String.fromCharCode(e[85]),String.fromCharCode(e[86]),String.fromCharCode(e[87])].join(""),formatBitCount:i[21],formatRBitMask:i[22],formatGBitMask:i[23],formatBBitMask:i[24],formatABitMask:i[25],caps1:i[26],caps2:i[27],caps3:i[28],caps4:i[29],reserved2:i[30],DXGIFormat:null,resourceDimension:null,miscFlag:null,arraySize:null,textureData:e.subarray(i[1]+4,e.byteLength)}).formatFourCC?(n.DXGIFormat=i[31],n.resourceDimension=i[32],n.miscFlag=i[33],n.arraySize=i[34],n.miscFlag=i[35]):"DXT5"===n.formatFourCC?n.glExtensionFormat=33779:"DXT3"===n.formatFourCC&&(n.glExtensionFormat=33778)),n},ktx:function(t){var e=new Uint8Array(t),i=new Uint32Array(t),n=null,s=16+i[15]/4|0,r=i[s],o=i[7],a=0;if(171===e[0]&&75===e[1]&&84===e[2]&&88===e[3]&&32===e[4]&&49===e[5]&&49===e[6]&&187===e[7]&&13===e[8]&&10===e[9]&&26===e[10]&&10===e[11]&&[36196,35840,35841,35842,35843,33776,33777,33778,33779].indexOf(o)>=0){switch(o){case 36196:a="ETC1";break;case 35840:case 35841:case 35842:case 35843:a="PVRTC";break;case 33776:case 33777:case 33778:case 33779:a="S3TC"}n={complete:!0,fileFormat:"KTX",compressionAlgorithm:a,endianness:i[3],glType:i[4],glTypeSize:i[5],glFormat:i[6],glInternalFormat:i[7],glBaseInternalFormat:i[8],width:i[9],height:i[10],pixelDepth:i[11],numberOfArrayElements:i[12],numberOfFaces:i[13],numberOfMipmapLevels:i[14],bytesOfKeyValueData:i[15],keyAndValueByteSize:i[16],imageSize:r,textureData:e.subarray(4*(s+1),r+100)}}return n},pkm:function(t){var e=new Uint8Array(t),i=null;return 80===e[0]&&75===e[1]&&77===e[2]&&32===e[3]&&(i={complete:!0,fileFormat:"PKM",compressionAlgorithm:"ETC1",format:65535&(e[6]<<8|e[7]),width:65535&(e[8]<<8|e[9]),height:65535&(e[10]<<8|e[11]),originalWidth:65535&(e[12]<<8|e[13]),originalHeight:65535&(e[14]<<8|e[15]),textureData:e.subarray(16,e.length)}),i}}, /** * @author Jeremy Dowell * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.AudioSprite=function(t,e){for(var i in this.game=t,this.key=e,this.config=this.game.cache.getJSON(e+"-audioatlas"),this.autoplayKey=null,this.autoplay=!1,this.sounds={},this.config.spritemap){var n=this.config.spritemap[i],s=this.game.add.sound(this.key);s.addMarker(i,n.start,n.end-n.start,null,n.loop),this.sounds[i]=s}this.config.autoplay&&(this.autoplayKey=this.config.autoplay,this.play(this.autoplayKey),this.autoplay=this.sounds[this.autoplayKey])},s.AudioSprite.prototype={play:function(t,e){return void 0===e&&(e=1),this.sounds[t].play(t,null,e)},stop:function(t){if(t)this.sounds[t].stop();else for(var e in this.sounds)this.sounds[e].stop()},get:function(t){return this.sounds[t]}},s.AudioSprite.prototype.constructor=s.AudioSprite, +n.AudioSprite=function(t,e){for(var i in this.game=t,this.key=e,this.config=this.game.cache.getJSON(e+"-audioatlas"),this.autoplayKey=null,this.autoplay=!1,this.sounds={},this.config.spritemap){var n=this.config.spritemap[i],s=this.game.add.sound(this.key);s.addMarker(i,n.start,n.end-n.start,null,n.loop),this.sounds[i]=s}this.config.autoplay&&(this.autoplayKey=this.config.autoplay,this.play(this.autoplayKey),this.autoplay=this.sounds[this.autoplayKey])},n.AudioSprite.prototype={play:function(t,e){return void 0===e&&(e=1),this.sounds[t].play(t,null,e)},stop:function(t){if(t)this.sounds[t].stop();else for(var e in this.sounds)this.sounds[e].stop()},get:function(t){return this.sounds[t]}},n.AudioSprite.prototype.constructor=n.AudioSprite, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Sound=function(t,e,i,n,r){void 0===i&&(i=1),void 0===n&&(n=!1),void 0===r&&(r=t.sound.connectToMaster),this.game=t,this.name=e,this.key=e,this.loop=n,this.markers={},this.context=null,this.autoplay=!1,this.totalDuration=0,this.startTime=0,this.currentTime=0,this.duration=0,this.durationMS=0,this.position=0,this.stopTime=0,this.paused=!1,this.pausedPosition=0,this.pausedTime=0,this.isPlaying=!1,this.currentMarker="",this.fadeTween=null,this.pendingPlayback=!1,this.override=!1,this.allowMultiple=!1,this.playOnce=!1,this.usingWebAudio=this.game.sound.usingWebAudio,this.usingAudioTag=this.game.sound.usingAudioTag,this.externalNode=null,this.masterGainNode=null,this.gainNode=null,this._sound=null,this._globalVolume=1,this._markedToDelete=!1,this._pendingStart=!1,this._removeFromSoundManager=!1,this._sourceId=0,this.usingWebAudio?(this.context=this.game.sound.context,this.masterGainNode=this.game.sound.masterGain,void 0===this.context.createGain?this.gainNode=this.context.createGainNode():this.gainNode=this.context.createGain(),this.gainNode.gain.value=i,r&&this.gainNode.connect(this.masterGainNode)):this.usingAudioTag&&(this.game.cache.getSound(e)&&this.game.cache.isSoundReady(e)?(this._sound=this.game.cache.getSoundData(e),this.totalDuration=0,this._sound.duration&&(this.totalDuration=this._sound.duration)):this.game.cache.onSoundUnlock.add(this.soundHasUnlocked,this)),this.onDecoded=new s.Signal,this.onPlay=new s.Signal,this.onPause=new s.Signal,this.onResume=new s.Signal,this.onLoop=new s.Signal,this.onStop=new s.Signal,this.onMute=new s.Signal,this.onMarkerComplete=new s.Signal,this.onFadeComplete=new s.Signal,this._volume=i,this._buffer=null,this._muted=!1,this._tempMarker=0,this._tempPosition=0,this._tempVolume=0,this._tempPause=0,this._muteVolume=0,this._tempLoop=0,this._paused=!1,this._onDecodedEventDispatched=!1},s.Sound.prototype={soundHasUnlocked:function(t){t===this.key&&(this._sound=this.game.cache.getSoundData(this.key),this.totalDuration=this._sound.duration)},addMarker:function(t,e,i,n,s){null==i&&(i=1),null==n&&(n=1),void 0===s&&(s=!1),this.markers[t]={name:t,start:e,stop:e+i,volume:n,duration:i,durationMS:1e3*i,loop:s}},removeMarker:function(t){delete this.markers[t]},onEndedHandler:function(){this._removeOnEndedHandler(),this.isPlaying=!1,this.currentTime=this.durationMS,this.stop(),this.playOnce&&(this._markedToDelete=!0,this._removeFromSoundManager=!0),this._markedToDelete&&(this._disconnectSource(),this._removeFromSoundManager?this.game.sound.remove(this):(this.markers={},this.context=null,this._buffer=null,this.externalNode=null,this.onDecoded.dispose(),this.onPlay.dispose(),this.onPause.dispose(),this.onResume.dispose(),this.onLoop.dispose(),this.onStop.dispose(),this.onMute.dispose(),this.onMarkerComplete.dispose()))},update:function(){if(this.game.cache.checkSoundKey(this.key)){this.isDecoded&&!this._onDecodedEventDispatched&&(this.onDecoded.dispatch(this),this._onDecodedEventDispatched=!0),this.pendingPlayback&&this.game.cache.isSoundReady(this.key)&&(this.pendingPlayback=!1,this.play(this._tempMarker,this._tempPosition,this._tempVolume,this._tempLoop));var t=this.game.time.time;if(this.isPlaying){if(this._pendingStart){var e=this._sound.currentTime;if(!(e>((this.paused?this._tempPause:0)||this.position||0)))return;this._pendingStart=!1,this.startTime=t-1e3*e,this.stopTime=this.startTime+this.durationMS}this.currentTime=t-this.startTime,this.currentTime>=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),this.isPlaying=!1,""===this.currentMarker?(this.currentTime=0,this.startTime=t,this.isPlaying=!0):(this.onMarkerComplete.dispatch(this.currentMarker,this),this.play(this.currentMarker,0,this.volume,!0,!0,!1))):""!==this.currentMarker&&this.stop():this.loop?(this.onLoop.dispatch(this),""===this.currentMarker&&(this.currentTime=0,this.startTime=t),this.isPlaying=!1,this.play(this.currentMarker,0,this.volume,!0,!0,!1)):this.stop())}}else this.destroy()},loopFull:function(t){return this.play(null,0,t,!0)},play:function(t,e,i,n,s,r){if(void 0!==t&&!1!==t&&null!==t||(t=""),void 0===s&&(s=!0),void 0===r&&(r=!0),this.isPlaying&&!this.allowMultiple&&!s&&!this.override)return this;if(this._sound&&this.isPlaying&&!this.allowMultiple&&(this.override||s)&&(this.usingWebAudio?this._stopSourceAndDisconnect():this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0),this.isPlaying=!1),""===t&&Object.keys(this.markers).length>0)return this;if(""!==t){if(!this.markers[t])return console.warn("Phaser.Sound.play: audio marker "+t+" doesn't exist"),this;this.currentMarker=t,this.position=this.markers[t].start,this.volume=this.markers[t].volume,this.loop=this.markers[t].loop,this.duration=this.markers[t].duration,this.durationMS=this.markers[t].durationMS,void 0!==i&&(this.volume=i),void 0!==n&&(this.loop=n),this._tempMarker=t,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else e=e||0,void 0===i&&(i=this._volume),void 0===n&&(n=this.loop),this.position=Math.max(0,e),this.volume=i,this.loop=n,this.duration=0,this.durationMS=0,this._tempMarker=t,this._tempPosition=e,this._tempVolume=i,this._tempLoop=n;return this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(this._createSourceAndConnect(),this.loop&&""===t&&(this._sound.loop=!0),this.loop||""!==t||this._addOnEndedHandler(),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=Math.ceil(1e3*this.totalDuration)),this.loop&&""===t?this._startSource(0,0):this._startSource(0,this.position,this.duration),this.isPlaying=!0,this.paused=!1,this.startTime=this.game.time.time,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,r&&this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&!1===this.game.cache.getSound(this.key).isDecoding&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this._sound.loop=this.loop,this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._globalVolume=this.game.sound.volume,this._sound.currentTime=this.position,this._sound.muted=this._muted,this._muted||this.game.sound.mute?this._sound.volume=0:this._sound.volume=this._volume*this._globalVolume,this._pendingStart=!this.currentMarker,this.isPlaying=!0,this.paused=!1,this._tempPause=0,this.startTime=this.game.time.time,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,r&&this.onPlay.dispatch(this)):this.pendingPlayback=!0,this.playOnce&&(this.loop&&console.warn("Phaser.Sound.play: audio clip "+this.name+" cannot be deleted while looping."),this._markedToDelete=!0,this._removeFromSoundManager=!0),this},restart:function(t,e,i,n){t=t||"",e=e||0,i=i||1,void 0===n&&(n=!1),this.play(t,e,i,n,!0)},pause:function(){this.isPlaying&&(this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.time,this._tempPause=this._sound.currentTime,this.onPause.dispatch(this),this.stop())},resume:function(){if(this.paused){if(this.usingWebAudio){var t=Math.max(0,this.position+this.pausedPosition/1e3);this._createSourceAndConnect(),""===this.currentMarker&&(this.loop?this._sound.loop=!0:this._addOnEndedHandler());var e=this.duration-this.pausedPosition/1e3;this.loop&&""===this.currentMarker?this._startSource(0,t):this._startSource(0,t,e)}else this._pendingStart=!this.currentMarker,this._sound.currentTime=this._tempPause,this._tempPause=0,this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.time-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound&&(this.usingWebAudio?this._stopSourceAndDisconnect():this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.pendingPlayback=!1,this.isPlaying=!1,!this.paused){var t=this.currentMarker;""!==this.currentMarker&&this.onMarkerComplete.dispatch(this.currentMarker,this),this.currentMarker="",null!==this.fadeTween&&this.fadeTween.stop(),this.onStop.dispatch(this,t)}},fadeIn:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=this.currentMarker),this.paused||(this.play(i,0,0,e),this.fadeTo(t,1))},fadeOut:function(t){this.fadeTo(t,0)},fadeTo:function(t,e){this.isPlaying&&!this.paused&&e!==this.volume&&(void 0===t&&(t=1e3),void 0!==e?(this.fadeTween=this.game.add.tween(this).to({volume:e},t,s.Easing.Linear.None,!0),this.fadeTween.onComplete.add(this.fadeComplete,this)):console.warn("Phaser.Sound.fadeTo: No Volume Specified."))},fadeComplete:function(){this.onFadeComplete.dispatch(this,this.volume),0===this.volume&&this.stop()},updateGlobalVolume:function(t){this.usingAudioTag&&this._sound&&(this._globalVolume=t,this._sound.volume=this._globalVolume*this._volume)},destroy:function(t){void 0===t&&(t=!0),this._markedToDelete=!0,this._removeFromSoundManager=t,this.stop(),t?this.game.sound.remove(this):(this.markers={},this.context=null,this._buffer=null,this.externalNode=null,this.onDecoded.dispose(),this.onPlay.dispose(),this.onPause.dispose(),this.onResume.dispose(),this.onLoop.dispose(),this.onStop.dispose(),this.onMute.dispose(),this.onMarkerComplete.dispose())},_createSourceAndConnect:function(){this._sound=this.context.createBufferSource(),this._sound.connect(this.externalNode||this.gainNode),this._buffer=this.game.cache.getSoundData(this.key),this._sound.buffer=this._buffer,this._sourceId++},_disconnectSource:function(){this._sound.disconnect(this.externalNode||this.gainNode)},_startSource:function(t,e,i){void 0===i?this._sound.start(t||0,e||0):this._sound.start(t||0,e||0,i)},_stopSourceAndDisconnect:function(){this._removeOnEndedHandler();try{this._sound.stop(0)}catch(t){}this._disconnectSource(),this._sound=null},_addOnEndedHandler:function(){this._sound.onended=this.onEndedHandler.bind(this)},_removeOnEndedHandler:function(){this._sound.onended=null}},s.Sound.prototype.constructor=s.Sound,Object.defineProperty(s.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}}),Object.defineProperty(s.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}}),Object.defineProperty(s.Sound.prototype,"mute",{get:function(){return this._muted||this.game.sound.mute},set:function(t){(t=t||!1)!==this._muted&&(t?(this._muted=!0,this._muteVolume=this._tempVolume,this.usingWebAudio?this.gainNode.gain.value=0:this.usingAudioTag&&this._sound&&(this._sound.volume=0)):(this._muted=!1,this.usingWebAudio?this.gainNode.gain.value=this._muteVolume:this.usingAudioTag&&this._sound&&(this._sound.volume=this._muteVolume)),this.onMute.dispatch(this))}}),Object.defineProperty(s.Sound.prototype,"volume",{get:function(){return this._volume},set:function(t){this.usingAudioTag&&(t=this.game.math.clamp(t,0,1)),this._muted?this._muteVolume=t:(this._tempVolume=t,this._volume=t,this.usingWebAudio?this.gainNode.gain.value=t:this.usingAudioTag&&this._sound&&(this._sound.volume=this._globalVolume*t))}}),Object.defineProperty(s.Sound.prototype,"sourceId",{get:function(){return this._sound?this._sourceId:null}}), +n.Sound=function(t,e,i,s,r){void 0===i&&(i=1),void 0===s&&(s=!1),void 0===r&&(r=t.sound.connectToMaster),this.game=t,this.name=e,this.key=e,this.loop=s,this.markers={},this.context=null,this.autoplay=!1,this.totalDuration=0,this.startTime=0,this.currentTime=0,this.duration=0,this.durationMS=0,this.position=0,this.stopTime=0,this.paused=!1,this.pausedPosition=0,this.pausedTime=0,this.isPlaying=!1,this.currentMarker="",this.fadeTween=null,this.pendingPlayback=!1,this.override=!1,this.allowMultiple=!1,this.playOnce=!1,this.usingWebAudio=this.game.sound.usingWebAudio,this.usingAudioTag=this.game.sound.usingAudioTag,this.externalNode=null,this.masterGainNode=null,this.gainNode=null,this._sound=null,this._globalVolume=1,this._markedToDelete=!1,this._pendingStart=!1,this._removeFromSoundManager=!1,this._sourceId=0,this.usingWebAudio?(this.context=this.game.sound.context,this.masterGainNode=this.game.sound.masterGain,void 0===this.context.createGain?this.gainNode=this.context.createGainNode():this.gainNode=this.context.createGain(),this.gainNode.gain.value=i,r&&this.gainNode.connect(this.masterGainNode)):this.usingAudioTag&&(this.game.cache.getSound(e)&&this.game.cache.isSoundReady(e)?(this._sound=this.game.cache.getSoundData(e),this.totalDuration=0,this._sound.duration&&(this.totalDuration=this._sound.duration)):this.game.cache.onSoundUnlock.add(this.soundHasUnlocked,this)),this.onDecoded=new n.Signal,this.onPlay=new n.Signal,this.onPause=new n.Signal,this.onResume=new n.Signal,this.onLoop=new n.Signal,this.onStop=new n.Signal,this.onMute=new n.Signal,this.onMarkerComplete=new n.Signal,this.onFadeComplete=new n.Signal,this._volume=i,this._buffer=null,this._muted=!1,this._tempMarker=0,this._tempPosition=0,this._tempVolume=0,this._tempPause=0,this._muteVolume=0,this._tempLoop=0,this._paused=!1,this._onDecodedEventDispatched=!1},n.Sound.prototype={soundHasUnlocked:function(t){t===this.key&&(this._sound=this.game.cache.getSoundData(this.key),this.totalDuration=this._sound.duration)},addMarker:function(t,e,i,n,s){null==i&&(i=1),null==n&&(n=1),void 0===s&&(s=!1),this.markers[t]={name:t,start:e,stop:e+i,volume:n,duration:i,durationMS:1e3*i,loop:s}},removeMarker:function(t){delete this.markers[t]},onEndedHandler:function(){this._removeOnEndedHandler(),this.isPlaying=!1,this.currentTime=this.durationMS,this.stop(),this.playOnce&&(this._markedToDelete=!0,this._removeFromSoundManager=!0),this._markedToDelete&&(this._disconnectSource(),this._removeFromSoundManager?this.game.sound.remove(this):(this.markers={},this.context=null,this._buffer=null,this.externalNode=null,this.onDecoded.dispose(),this.onPlay.dispose(),this.onPause.dispose(),this.onResume.dispose(),this.onLoop.dispose(),this.onStop.dispose(),this.onMute.dispose(),this.onMarkerComplete.dispose()))},update:function(){if(this.game.cache.checkSoundKey(this.key)){this.isDecoded&&!this._onDecodedEventDispatched&&(this.onDecoded.dispatch(this),this._onDecodedEventDispatched=!0),this.pendingPlayback&&this.game.cache.isSoundReady(this.key)&&(this.pendingPlayback=!1,this.play(this._tempMarker,this._tempPosition,this._tempVolume,this._tempLoop));var t=this.game.time.time;if(this.isPlaying){if(this._pendingStart){var e=this._sound.currentTime;if(!(e>((this.paused?this._tempPause:0)||this.position||0)))return;this._pendingStart=!1,this.startTime=t-1e3*e,this.stopTime=this.startTime+this.durationMS}this.currentTime=t-this.startTime,this.currentTime>=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),this.isPlaying=!1,""===this.currentMarker?(this.currentTime=0,this.startTime=t,this.isPlaying=!0):(this.onMarkerComplete.dispatch(this.currentMarker,this),this.play(this.currentMarker,0,this.volume,!0,!0,!1))):""!==this.currentMarker&&this.stop():this.loop?(this.onLoop.dispatch(this),""===this.currentMarker&&(this.currentTime=0,this.startTime=t),this.isPlaying=!1,this.play(this.currentMarker,0,this.volume,!0,!0,!1)):this.stop())}}else this.destroy()},loopFull:function(t){return this.play(null,0,t,!0)},play:function(t,e,i,n,s,r){if(void 0!==t&&!1!==t&&null!==t||(t=""),void 0===s&&(s=!0),void 0===r&&(r=!0),this.isPlaying&&!this.allowMultiple&&!s&&!this.override)return this;if(this._sound&&this.isPlaying&&!this.allowMultiple&&(this.override||s)&&(this.usingWebAudio?this._stopSourceAndDisconnect():this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0),this.isPlaying=!1),""===t&&Object.keys(this.markers).length>0)return this;if(""!==t){if(!this.markers[t])return console.warn("Phaser.Sound.play: audio marker "+t+" doesn't exist"),this;this.currentMarker=t,this.position=this.markers[t].start,this.volume=this.markers[t].volume,this.loop=this.markers[t].loop,this.duration=this.markers[t].duration,this.durationMS=this.markers[t].durationMS,void 0!==i&&(this.volume=i),void 0!==n&&(this.loop=n),this._tempMarker=t,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else e=e||0,void 0===i&&(i=this._volume),void 0===n&&(n=this.loop),this.position=Math.max(0,e),this.volume=i,this.loop=n,this.duration=0,this.durationMS=0,this._tempMarker=t,this._tempPosition=e,this._tempVolume=i,this._tempLoop=n;return this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(this._createSourceAndConnect(),this.loop&&""===t&&(this._sound.loop=!0),this.loop||""!==t||this._addOnEndedHandler(),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=Math.ceil(1e3*this.totalDuration)),this.loop&&""===t?this._startSource(0,0):this._startSource(0,this.position,this.duration),this.isPlaying=!0,this.paused=!1,this.startTime=this.game.time.time,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,r&&this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&!1===this.game.cache.getSound(this.key).isDecoding&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this._sound.loop=this.loop,this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._globalVolume=this.game.sound.volume,this._sound.currentTime=this.position,this._sound.muted=this._muted,this._muted||this.game.sound.mute?this._sound.volume=0:this._sound.volume=this._volume*this._globalVolume,this._pendingStart=!this.currentMarker,this.isPlaying=!0,this.paused=!1,this._tempPause=0,this.startTime=this.game.time.time,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,r&&this.onPlay.dispatch(this)):this.pendingPlayback=!0,this.playOnce&&(this.loop&&console.warn("Phaser.Sound.play: audio clip "+this.name+" cannot be deleted while looping."),this._markedToDelete=!0,this._removeFromSoundManager=!0),this},restart:function(t,e,i,n){t=t||"",e=e||0,i=i||1,void 0===n&&(n=!1),this.play(t,e,i,n,!0)},pause:function(){this.isPlaying&&(this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.time,this._tempPause=this._sound.currentTime,this.onPause.dispatch(this),this.stop())},resume:function(){if(this.paused){if(this.usingWebAudio){var t=Math.max(0,this.position+this.pausedPosition/1e3);this._createSourceAndConnect(),""===this.currentMarker&&(this.loop?this._sound.loop=!0:this._addOnEndedHandler());var e=this.duration-this.pausedPosition/1e3;this.loop&&""===this.currentMarker?this._startSource(0,t):this._startSource(0,t,e)}else this._pendingStart=!this.currentMarker,this._sound.currentTime=this._tempPause,this._tempPause=0,this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.time-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound&&(this.usingWebAudio?this._stopSourceAndDisconnect():this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.pendingPlayback=!1,this.isPlaying=!1,!this.paused){var t=this.currentMarker;""!==this.currentMarker&&this.onMarkerComplete.dispatch(this.currentMarker,this),this.currentMarker="",null!==this.fadeTween&&this.fadeTween.stop(),this.onStop.dispatch(this,t)}},fadeIn:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=this.currentMarker),this.paused||(this.play(i,0,0,e),this.fadeTo(t,1))},fadeOut:function(t){this.fadeTo(t,0)},fadeTo:function(t,e){this.isPlaying&&!this.paused&&e!==this.volume&&(void 0===t&&(t=1e3),void 0!==e?(this.fadeTween=this.game.add.tween(this).to({volume:e},t,n.Easing.Linear.None,!0),this.fadeTween.onComplete.add(this.fadeComplete,this)):console.warn("Phaser.Sound.fadeTo: No Volume Specified."))},fadeComplete:function(){this.onFadeComplete.dispatch(this,this.volume),0===this.volume&&this.stop()},updateGlobalVolume:function(t){this.usingAudioTag&&this._sound&&(this._globalVolume=t,this._sound.volume=this._globalVolume*this._volume)},destroy:function(t){void 0===t&&(t=!0),this._markedToDelete=!0,this._removeFromSoundManager=t,this.stop(),t?this.game.sound.remove(this):(this.markers={},this.context=null,this._buffer=null,this.externalNode=null,this.onDecoded.dispose(),this.onPlay.dispose(),this.onPause.dispose(),this.onResume.dispose(),this.onLoop.dispose(),this.onStop.dispose(),this.onMute.dispose(),this.onMarkerComplete.dispose())},_createSourceAndConnect:function(){this._sound=this.context.createBufferSource(),this._sound.connect(this.externalNode||this.gainNode),this._buffer=this.game.cache.getSoundData(this.key),this._sound.buffer=this._buffer,this._sourceId++},_disconnectSource:function(){this._sound.disconnect(this.externalNode||this.gainNode)},_startSource:function(t,e,i){void 0===i?this._sound.start(t||0,e||0):this._sound.start(t||0,e||0,i)},_stopSourceAndDisconnect:function(){this._removeOnEndedHandler();try{this._sound.stop(0)}catch(t){}this._disconnectSource(),this._sound=null},_addOnEndedHandler:function(){this._sound.onended=this.onEndedHandler.bind(this)},_removeOnEndedHandler:function(){this._sound.onended=null}},n.Sound.prototype.constructor=n.Sound,Object.defineProperty(n.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}}),Object.defineProperty(n.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}}),Object.defineProperty(n.Sound.prototype,"mute",{get:function(){return this._muted||this.game.sound.mute},set:function(t){(t=t||!1)!==this._muted&&(t?(this._muted=!0,this._muteVolume=this._tempVolume,this.usingWebAudio?this.gainNode.gain.value=0:this.usingAudioTag&&this._sound&&(this._sound.volume=0)):(this._muted=!1,this.usingWebAudio?this.gainNode.gain.value=this._muteVolume:this.usingAudioTag&&this._sound&&(this._sound.volume=this._muteVolume)),this.onMute.dispatch(this))}}),Object.defineProperty(n.Sound.prototype,"volume",{get:function(){return this._volume},set:function(t){this.usingAudioTag&&(t=this.game.math.clamp(t,0,1)),this._muted?this._muteVolume=t:(this._tempVolume=t,this._volume=t,this.usingWebAudio?this.gainNode.gain.value=t:this.usingAudioTag&&this._sound&&(this._sound.volume=this._globalVolume*t))}}),Object.defineProperty(n.Sound.prototype,"sourceId",{get:function(){return this._sound?this._sourceId:null}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.SoundManager=function(t){this.game=t,this.onSoundDecode=new s.Signal,this.onVolumeChange=new s.Signal,this.onMute=new s.Signal,this.onUnMute=new s.Signal,this.onTouchUnlock=new s.Signal,this.onStateChange=new s.Signal,this.context=null,this.baseLatency=null,this.usingWebAudio=!1,this.usingAudioTag=!1,this.noAudio=!1,this.connectToMaster=!0,this.touchLocked=!1,this.channels=32,this.muteOnPause=!0,this._codeMuted=!1,this._muted=!1,this._unlockSource=null,this._volume=1,this._sounds=[],this._watchList=new s.ArraySet,this._watching=!1,this._watchCallback=null,this._watchContext=null,this._onClick=this._onClick.bind(this),this._onStateChange=this._onStateChange.bind(this)},s.SoundManager.prototype={boot:function(){var t=this.game.device,e=window.PhaserGlobal;if(t.iOS&&!1===t.webAudio&&(this.channels=1),e){if(!0===e.disableAudio)return this.noAudio=!0,void(this.touchLocked=!1);if(!0===e.disableWebAudio)return this.usingAudioTag=!0,void(this.touchLocked=!1)}if(e&&e.audioContext)this.context=e.audioContext;else{var i=window.AudioContext||window.webkitAudioContext;if(i)try{this.context=new i}catch(t){this.context=null,this.usingWebAudio=!1,this.touchLocked=!1,console.warn(t)}}if(null===this.context){if(void 0===window.Audio)return void(this.noAudio=!0);this.usingAudioTag=!0}else this.usingWebAudio=!0,this.baseLatency=this.context.baseLatency||256/(this.context.sampleRate||44100),void 0===this.context.createGain?this.masterGain=this.context.createGainNode():this.masterGain=this.context.createGain(),this.masterGain.gain.value=1,this.masterGain.connect(this.context.destination),this.context.onstatechange=this._onStateChange,"suspended"===this.context.state&&this.game.canvas.addEventListener("click",this._onClick);this.noAudio||t.needsTouchUnlock()&&this.setTouchLock(),this.usingWebAudio&&t.chrome&&t.chromeVersion<=65&&console.log('A "GainNode.gain.value setter smoothing is deprecated" notice in Chrome is normal. ')},setTouchLock:function(){this.noAudio||window.PhaserGlobal&&!0===window.PhaserGlobal.disableAudio||(this.game.input.addTouchLockCallback(this.unlock,this,!0),this.touchLocked=!0)},setTouchUnlock:function(){this.touchLocked=!1,this._unlockSource=null,this.onTouchUnlock.dispatch()},resumeWebAudio:function(){if(this.usingWebAudio)return this.context.resume()},resumeWebAudioIfSuspended:function(){if(this.usingWebAudio&&"suspended"===this.context.state)return this.context.resume()},unlock:function(){if(this.noAudio||!this.touchLocked||null!==this._unlockSource)return!0;if(this.usingAudioTag)this.setTouchUnlock();else if(this.usingWebAudio){var t=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource(),this._unlockSource.buffer=t,this._unlockSource.connect(this.context.destination);var e=this;this._unlockSource.onended=function(){e.setTouchUnlock(),e.resumeWebAudioIfSuspended()},void 0===this._unlockSource.start?this._unlockSource.noteOn(0):this._unlockSource.start(0),this.resumeWebAudioIfSuspended()}return!0},stopAll:function(){if(!this.noAudio)for(var t=0;t1&&(t=1),this._volume!==t){if(this._volume=t,this.usingWebAudio)this.masterGain.gain.value=t;else for(var e=0;e')},setTouchLock:function(){this.noAudio||window.PhaserGlobal&&!0===window.PhaserGlobal.disableAudio||(this.game.input.addTouchLockCallback(this.unlock,this,!0),this.touchLocked=!0)},setTouchUnlock:function(){this.touchLocked=!1,this._unlockSource=null,this.onTouchUnlock.dispatch()},resumeWebAudio:function(){if(this.usingWebAudio)return this.context.resume()},resumeWebAudioIfSuspended:function(){if(this.usingWebAudio&&"suspended"===this.context.state)return this.context.resume()},unlock:function(){if(this.noAudio||!this.touchLocked||null!==this._unlockSource)return!0;if(this.usingAudioTag)this.setTouchUnlock();else if(this.usingWebAudio){var t=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource(),this._unlockSource.buffer=t,this._unlockSource.connect(this.context.destination);var e=this;this._unlockSource.onended=function(){e.setTouchUnlock(),e.resumeWebAudioIfSuspended()},void 0===this._unlockSource.start?this._unlockSource.noteOn(0):this._unlockSource.start(0),this.resumeWebAudioIfSuspended()}return!0},stopAll:function(){if(!this.noAudio)for(var t=0;t1&&(t=1),this._volume!==t){if(this._volume=t,this.usingWebAudio)this.masterGain.gain.value=t;else for(var e=0;e * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.ScaleManager=function(t,e,i){this.game=t,this.dom=s.DOM,this.grid=null,this.width=0,this.height=0,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.offset=new s.Point,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this._pageAlignHorizontally=!1,this._pageAlignVertically=!1,this.onOrientationChange=new s.Signal,this.enterIncorrectOrientation=new s.Signal,this.leaveIncorrectOrientation=new s.Signal,this.hasPhaserSetFullScreen=!1,this.fullScreenTarget=null,this._createdFullScreenTarget=null,this.onFullScreenInit=new s.Signal,this.onFullScreenChange=new s.Signal,this.onFullScreenError=new s.Signal,this.screenOrientation=this.dom.getScreenOrientation(),this.scaleFactor=new s.Point(1,1),this.scaleFactorInversed=new s.Point(1,1),this.margin={left:0,top:0,right:0,bottom:0,x:0,y:0},this.bounds=new s.Rectangle,this.aspectRatio=0,this.sourceAspectRatio=0,this.event=null,this.windowConstraints={right:"layout",bottom:""},this.compatibility={supportsFullScreen:!1,orientationFallback:null,noMargins:!1,scrollTo:null,forceMinimumDocumentHeight:!1,canExpandParent:!0,clickTrampoline:""},this._scaleMode=s.ScaleManager.NO_SCALE,this._fullScreenScaleMode=s.ScaleManager.NO_SCALE,this.parentIsWindow=!1,this.parentNode=null,this.parentScaleFactor=new s.Point(1,1),this.trackParentInterval=2e3,this.onSizeChange=new s.Signal,this.onResize=null,this.onResizeContext=null,this._pendingScaleMode=null,this._fullScreenRestore=null,this._gameSize=new s.Rectangle,this._userScaleFactor=new s.Point(1,1),this._userScaleTrim=new s.Point(0,0),this._lastUpdate=0,this._updateThrottle=0,this._updateThrottleReset=100,this._parentBounds=new s.Rectangle,this._tempBounds=new s.Rectangle,this._lastReportedCanvasSize=new s.Rectangle,this._lastReportedGameSize=new s.Rectangle,this._booted=!1,t.config&&this.parseConfig(t.config),this.setupScale(e,i)},s.ScaleManager.EXACT_FIT=0,s.ScaleManager.NO_SCALE=1,s.ScaleManager.SHOW_ALL=2,s.ScaleManager.RESIZE=3,s.ScaleManager.USER_SCALE=4,s.ScaleManager.MODES=["EXACT_FIT","NO_SCALE","SHOW_ALL","RESIZE","USER_SCALE"],s.ScaleManager.prototype={boot:function(){var t=this.compatibility;t.supportsFullScreen=this.game.device.fullscreen&&!this.game.device.cocoonJS,this.game.device.iPad||this.game.device.webApp||this.game.device.desktop||(this.game.device.android&&!this.game.device.chrome?t.scrollTo=new s.Point(0,1):t.scrollTo=new s.Point(0,0)),this.game.device.desktop?(t.orientationFallback="screen",t.clickTrampoline="when-not-mouse"):(t.orientationFallback="",t.clickTrampoline="");var e=this;this._orientationChange=function(t){return e.orientationChange(t)},this._windowResize=function(t){return e.windowResize(t)},window.addEventListener("orientationchange",this._orientationChange,!1),window.addEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(this._fullScreenChange=function(t){return e.fullScreenChange(t)},this._fullScreenError=function(t){return e.fullScreenError(t)},document.addEventListener("webkitfullscreenchange",this._fullScreenChange,!1),document.addEventListener("mozfullscreenchange",this._fullScreenChange,!1),document.addEventListener("MSFullscreenChange",this._fullScreenChange,!1),document.addEventListener("fullscreenchange",this._fullScreenChange,!1),document.addEventListener("webkitfullscreenerror",this._fullScreenError,!1),document.addEventListener("mozfullscreenerror",this._fullScreenError,!1),document.addEventListener("MSFullscreenError",this._fullScreenError,!1),document.addEventListener("fullscreenerror",this._fullScreenError,!1)),this.game.onResume.add(this._gameResumed,this),this.dom.getOffset(this.game.canvas,this.offset),this.bounds.setTo(this.offset.x,this.offset.y,this.width,this.height),this.setGameSize(this.game.width,this.game.height),this.screenOrientation=this.dom.getScreenOrientation(this.compatibility.orientationFallback),s.FlexGrid&&(this.grid=new s.FlexGrid(this,this.width,this.height)),this._booted=!0,null!==this._pendingScaleMode&&(this.scaleMode=this._pendingScaleMode,this._pendingScaleMode=null)},parseConfig:function(t){void 0!==t.scaleMode&&(this._booted?this.scaleMode=t.scaleMode:this._pendingScaleMode=t.scaleMode),void 0!==t.fullScreenScaleMode&&(this.fullScreenScaleMode=t.fullScreenScaleMode),t.fullScreenTarget&&(this.fullScreenTarget=t.fullScreenTarget),this.pageAlignHorizontally=t.alignH||!1,this.pageAlignVertically=t.alignV||!1,t.scaleH&&t.scaleV&&this.setUserScale(t.scaleH,t.scaleV,t.trimH,t.trimV)},setupScale:function(t,e){var i,n=new s.Rectangle;""!==this.game.parent&&("string"==typeof this.game.parent?i=document.getElementById(this.game.parent):this.game.parent&&1===this.game.parent.nodeType&&(i=this.game.parent)),i?(this.parentNode=i,this.parentIsWindow=!1,this.getParentBounds(this._parentBounds,this.parentNode),n.width=this._parentBounds.width,n.height=this._parentBounds.height,this.offset.set(this._parentBounds.x,this._parentBounds.y)):(this.parentNode=null,this.parentIsWindow=!0,n.width=this.dom.visualBounds.width,n.height=this.dom.visualBounds.height,this.offset.set(0,0));var r=0,o=0;"number"==typeof t?r=t:(this.parentScaleFactor.x=parseInt(t,10)/100,r=n.width*this.parentScaleFactor.x),"number"==typeof e?o=e:(this.parentScaleFactor.y=parseInt(e,10)/100,o=n.height*this.parentScaleFactor.y),r=Math.floor(r),o=Math.floor(o),this._gameSize.setTo(0,0,r,o),this.updateDimensions(r,o,!1)},_gameResumed:function(){this.queueUpdate(!0)},setGameSize:function(t,e){this._gameSize.setTo(0,0,t,e),this.currentScaleMode!==s.ScaleManager.RESIZE&&this.updateDimensions(t,e,!0),this.queueUpdate(!0)},setUserScale:function(t,e,i,n,s,r){this._userScaleFactor.setTo(t,e),this._userScaleTrim.setTo(0|i,0|n),void 0===s&&(s=!0),void 0===r&&(r=!0),s&&this.queueUpdate(r)},setResizeCallback:function(t,e){this.onResize=t,this.onResizeContext=e},signalSizeChange:function(){if(!s.Rectangle.sameDimensions(this,this._lastReportedCanvasSize)||!s.Rectangle.sameDimensions(this.game,this._lastReportedGameSize)){var t=this.width,e=this.height;this._lastReportedCanvasSize.setTo(0,0,t,e),this._lastReportedGameSize.setTo(0,0,this.game.width,this.game.height),this.grid&&this.grid.onResize(t,e),this.onSizeChange.dispatch(this,t,e),this.currentScaleMode===s.ScaleManager.RESIZE&&(this.game.state.resize(t,e),this.game.load.resize(t,e))}},setMinMax:function(t,e,i,n){this.minWidth=t,this.minHeight=e,void 0!==i&&(this.maxWidth=i),void 0!==n&&(this.maxHeight=n)},preUpdate:function(){if(!(this.game.time.time=400?0:100,this.dom.getOffset(this.game.canvas,this.offset);var e=this._parentBounds.width,i=this._parentBounds.height,n=this.getParentBounds(this._parentBounds),r=n.width!==e||n.height!==i,o=this.updateOrientationState();(r||o)&&(this.onResize&&this.onResize.call(this.onResizeContext,this,n),this.updateLayout(),this.signalSizeChange());var a=2*this._updateThrottle;this._updateThrottlee;return(h=h?n:!n)?(t.width=Math.floor(s),t.height=Math.floor(r)):(t.width=Math.floor(o),t.height=Math.floor(a)),t},destroy:function(){this.game.onResume.remove(this._gameResumed,this),window.removeEventListener("orientationchange",this._orientationChange,!1),window.removeEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(document.removeEventListener("webkitfullscreenchange",this._fullScreenChange,!1),document.removeEventListener("mozfullscreenchange",this._fullScreenChange,!1),document.removeEventListener("MSFullscreenChange",this._fullScreenChange,!1),document.removeEventListener("fullscreenchange",this._fullScreenChange,!1),document.removeEventListener("webkitfullscreenerror",this._fullScreenError,!1),document.removeEventListener("mozfullscreenerror",this._fullScreenError,!1),document.removeEventListener("MSFullscreenError",this._fullScreenError,!1),document.removeEventListener("fullscreenerror",this._fullScreenError,!1))}},s.ScaleManager.prototype.constructor=s.ScaleManager,Object.defineProperty(s.ScaleManager.prototype,"boundingParent",{get:function(){return this.parentIsWindow||this.isFullScreen&&this.hasPhaserSetFullScreen&&!this._createdFullScreenTarget?null:this.game.canvas&&this.game.canvas.parentNode||null}}),Object.defineProperty(s.ScaleManager.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){return t!==this._scaleMode&&(this.isFullScreen||(this.updateDimensions(this._gameSize.width,this._gameSize.height,!0),this.queueUpdate(!0)),this._scaleMode=t),this._scaleMode}}),Object.defineProperty(s.ScaleManager.prototype,"fullScreenScaleMode",{get:function(){return this._fullScreenScaleMode},set:function(t){return t!==this._fullScreenScaleMode&&(this.isFullScreen?(this.prepScreenMode(!1),this._fullScreenScaleMode=t,this.prepScreenMode(!0),this.queueUpdate(!0)):this._fullScreenScaleMode=t),this._fullScreenScaleMode}}),Object.defineProperty(s.ScaleManager.prototype,"currentScaleMode",{get:function(){return this.isFullScreen?this._fullScreenScaleMode:this._scaleMode}}),Object.defineProperty(s.ScaleManager.prototype,"pageAlignHorizontally",{get:function(){return this._pageAlignHorizontally},set:function(t){t!==this._pageAlignHorizontally&&(this._pageAlignHorizontally=t,this.queueUpdate(!0))}}),Object.defineProperty(s.ScaleManager.prototype,"pageAlignVertically",{get:function(){return this._pageAlignVertically},set:function(t){t!==this._pageAlignVertically&&(this._pageAlignVertically=t,this.queueUpdate(!0))}}),Object.defineProperty(s.ScaleManager.prototype,"isFullScreen",{get:function(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}}),Object.defineProperty(s.ScaleManager.prototype,"isPortrait",{get:function(){return"portrait"===this.classifyOrientation(this.screenOrientation)}}),Object.defineProperty(s.ScaleManager.prototype,"isLandscape",{get:function(){return"landscape"===this.classifyOrientation(this.screenOrientation)}}),Object.defineProperty(s.ScaleManager.prototype,"isGamePortrait",{get:function(){return this.height>this.width}}),Object.defineProperty(s.ScaleManager.prototype,"isGameLandscape",{get:function(){return this.width>this.height}}), +n.ScaleManager=function(t,e,i){this.game=t,this.dom=n.DOM,this.grid=null,this.width=0,this.height=0,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.offset=new n.Point,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this._pageAlignHorizontally=!1,this._pageAlignVertically=!1,this.onOrientationChange=new n.Signal,this.enterIncorrectOrientation=new n.Signal,this.leaveIncorrectOrientation=new n.Signal,this.hasPhaserSetFullScreen=!1,this.fullScreenTarget=null,this._createdFullScreenTarget=null,this.onFullScreenInit=new n.Signal,this.onFullScreenChange=new n.Signal,this.onFullScreenError=new n.Signal,this.screenOrientation=this.dom.getScreenOrientation(),this.scaleFactor=new n.Point(1,1),this.scaleFactorInversed=new n.Point(1,1),this.margin={left:0,top:0,right:0,bottom:0,x:0,y:0},this.bounds=new n.Rectangle,this.aspectRatio=0,this.sourceAspectRatio=0,this.event=null,this.windowConstraints={right:"layout",bottom:""},this.compatibility={supportsFullScreen:!1,orientationFallback:null,noMargins:!1,scrollTo:null,forceMinimumDocumentHeight:!1,canExpandParent:!0,clickTrampoline:""},this._scaleMode=n.ScaleManager.NO_SCALE,this._fullScreenScaleMode=n.ScaleManager.NO_SCALE,this.parentIsWindow=!1,this.parentNode=null,this.parentScaleFactor=new n.Point(1,1),this.trackParentInterval=2e3,this.onSizeChange=new n.Signal,this.onResize=null,this.onResizeContext=null,this._pendingScaleMode=null,this._fullScreenRestore=null,this._gameSize=new n.Rectangle,this._userScaleFactor=new n.Point(1,1),this._userScaleTrim=new n.Point(0,0),this._lastUpdate=0,this._updateThrottle=0,this._updateThrottleReset=100,this._parentBounds=new n.Rectangle,this._tempBounds=new n.Rectangle,this._lastReportedCanvasSize=new n.Rectangle,this._lastReportedGameSize=new n.Rectangle,this._booted=!1,t.config&&this.parseConfig(t.config),this.setupScale(e,i)},n.ScaleManager.EXACT_FIT=0,n.ScaleManager.NO_SCALE=1,n.ScaleManager.SHOW_ALL=2,n.ScaleManager.RESIZE=3,n.ScaleManager.USER_SCALE=4,n.ScaleManager.MODES=["EXACT_FIT","NO_SCALE","SHOW_ALL","RESIZE","USER_SCALE"],n.ScaleManager.prototype={boot:function(){var t=this.compatibility;t.supportsFullScreen=this.game.device.fullscreen&&!this.game.device.cocoonJS,this.game.device.iPad||this.game.device.webApp||this.game.device.desktop||(this.game.device.android&&!this.game.device.chrome?t.scrollTo=new n.Point(0,1):t.scrollTo=new n.Point(0,0)),this.game.device.desktop?(t.orientationFallback="screen",t.clickTrampoline="when-not-mouse"):(t.orientationFallback="",t.clickTrampoline="");var e=this;this._orientationChange=function(t){return e.orientationChange(t)},this._windowResize=function(t){return e.windowResize(t)},window.addEventListener("orientationchange",this._orientationChange,!1),window.addEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(this._fullScreenChange=function(t){return e.fullScreenChange(t)},this._fullScreenError=function(t){return e.fullScreenError(t)},document.addEventListener("webkitfullscreenchange",this._fullScreenChange,!1),document.addEventListener("mozfullscreenchange",this._fullScreenChange,!1),document.addEventListener("MSFullscreenChange",this._fullScreenChange,!1),document.addEventListener("fullscreenchange",this._fullScreenChange,!1),document.addEventListener("webkitfullscreenerror",this._fullScreenError,!1),document.addEventListener("mozfullscreenerror",this._fullScreenError,!1),document.addEventListener("MSFullscreenError",this._fullScreenError,!1),document.addEventListener("fullscreenerror",this._fullScreenError,!1)),this.game.onResume.add(this._gameResumed,this),this.dom.getOffset(this.game.canvas,this.offset),this.bounds.setTo(this.offset.x,this.offset.y,this.width,this.height),this.setGameSize(this.game.width,this.game.height),this.screenOrientation=this.dom.getScreenOrientation(this.compatibility.orientationFallback),n.FlexGrid&&(this.grid=new n.FlexGrid(this,this.width,this.height)),this._booted=!0,null!==this._pendingScaleMode&&(this.scaleMode=this._pendingScaleMode,this._pendingScaleMode=null)},parseConfig:function(t){void 0!==t.scaleMode&&(this._booted?this.scaleMode=t.scaleMode:this._pendingScaleMode=t.scaleMode),void 0!==t.fullScreenScaleMode&&(this.fullScreenScaleMode=t.fullScreenScaleMode),t.fullScreenTarget&&(this.fullScreenTarget=t.fullScreenTarget),this.pageAlignHorizontally=t.alignH||!1,this.pageAlignVertically=t.alignV||!1,t.scaleH&&t.scaleV&&this.setUserScale(t.scaleH,t.scaleV,t.trimH,t.trimV)},setupScale:function(t,e){var i,s=new n.Rectangle;""!==this.game.parent&&("string"==typeof this.game.parent?i=document.getElementById(this.game.parent):this.game.parent&&1===this.game.parent.nodeType&&(i=this.game.parent)),i?(this.parentNode=i,this.parentIsWindow=!1,this.getParentBounds(this._parentBounds,this.parentNode),s.width=this._parentBounds.width,s.height=this._parentBounds.height,this.offset.set(this._parentBounds.x,this._parentBounds.y)):(this.parentNode=null,this.parentIsWindow=!0,s.width=this.dom.visualBounds.width,s.height=this.dom.visualBounds.height,this.offset.set(0,0));var r=0,o=0;"number"==typeof t?r=t:(this.parentScaleFactor.x=parseInt(t,10)/100,r=s.width*this.parentScaleFactor.x),"number"==typeof e?o=e:(this.parentScaleFactor.y=parseInt(e,10)/100,o=s.height*this.parentScaleFactor.y),r=Math.floor(r),o=Math.floor(o),this._gameSize.setTo(0,0,r,o),this.updateDimensions(r,o,!1)},_gameResumed:function(){this.queueUpdate(!0)},setGameSize:function(t,e){this._gameSize.setTo(0,0,t,e),this.currentScaleMode!==n.ScaleManager.RESIZE&&this.updateDimensions(t,e,!0),this.queueUpdate(!0)},setUserScale:function(t,e,i,n,s,r){this._userScaleFactor.setTo(t,e),this._userScaleTrim.setTo(0|i,0|n),void 0===s&&(s=!0),void 0===r&&(r=!0),s&&this.queueUpdate(r)},setResizeCallback:function(t,e){this.onResize=t,this.onResizeContext=e},signalSizeChange:function(){if(!n.Rectangle.sameDimensions(this,this._lastReportedCanvasSize)||!n.Rectangle.sameDimensions(this.game,this._lastReportedGameSize)){var t=this.width,e=this.height;this._lastReportedCanvasSize.setTo(0,0,t,e),this._lastReportedGameSize.setTo(0,0,this.game.width,this.game.height),this.grid&&this.grid.onResize(t,e),this.onSizeChange.dispatch(this,t,e),this.currentScaleMode===n.ScaleManager.RESIZE&&(this.game.state.resize(t,e),this.game.load.resize(t,e))}},setMinMax:function(t,e,i,n){this.minWidth=t,this.minHeight=e,void 0!==i&&(this.maxWidth=i),void 0!==n&&(this.maxHeight=n)},preUpdate:function(){if(!(this.game.time.time=400?0:100,this.dom.getOffset(this.game.canvas,this.offset);var e=this._parentBounds.width,i=this._parentBounds.height,s=this.getParentBounds(this._parentBounds),r=s.width!==e||s.height!==i,o=this.updateOrientationState();(r||o)&&(this.onResize&&this.onResize.call(this.onResizeContext,this,s),this.updateLayout(),this.signalSizeChange());var a=2*this._updateThrottle;this._updateThrottlee;return(h=h?n:!n)?(t.width=Math.floor(s),t.height=Math.floor(r)):(t.width=Math.floor(o),t.height=Math.floor(a)),t},destroy:function(){this.game.onResume.remove(this._gameResumed,this),window.removeEventListener("orientationchange",this._orientationChange,!1),window.removeEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(document.removeEventListener("webkitfullscreenchange",this._fullScreenChange,!1),document.removeEventListener("mozfullscreenchange",this._fullScreenChange,!1),document.removeEventListener("MSFullscreenChange",this._fullScreenChange,!1),document.removeEventListener("fullscreenchange",this._fullScreenChange,!1),document.removeEventListener("webkitfullscreenerror",this._fullScreenError,!1),document.removeEventListener("mozfullscreenerror",this._fullScreenError,!1),document.removeEventListener("MSFullscreenError",this._fullScreenError,!1),document.removeEventListener("fullscreenerror",this._fullScreenError,!1))}},n.ScaleManager.prototype.constructor=n.ScaleManager,Object.defineProperty(n.ScaleManager.prototype,"boundingParent",{get:function(){return this.parentIsWindow||this.isFullScreen&&this.hasPhaserSetFullScreen&&!this._createdFullScreenTarget?null:this.game.canvas&&this.game.canvas.parentNode||null}}),Object.defineProperty(n.ScaleManager.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){return t!==this._scaleMode&&(this.isFullScreen||(this.updateDimensions(this._gameSize.width,this._gameSize.height,!0),this.queueUpdate(!0)),this._scaleMode=t),this._scaleMode}}),Object.defineProperty(n.ScaleManager.prototype,"fullScreenScaleMode",{get:function(){return this._fullScreenScaleMode},set:function(t){return t!==this._fullScreenScaleMode&&(this.isFullScreen?(this.prepScreenMode(!1),this._fullScreenScaleMode=t,this.prepScreenMode(!0),this.queueUpdate(!0)):this._fullScreenScaleMode=t),this._fullScreenScaleMode}}),Object.defineProperty(n.ScaleManager.prototype,"currentScaleMode",{get:function(){return this.isFullScreen?this._fullScreenScaleMode:this._scaleMode}}),Object.defineProperty(n.ScaleManager.prototype,"pageAlignHorizontally",{get:function(){return this._pageAlignHorizontally},set:function(t){t!==this._pageAlignHorizontally&&(this._pageAlignHorizontally=t,this.queueUpdate(!0))}}),Object.defineProperty(n.ScaleManager.prototype,"pageAlignVertically",{get:function(){return this._pageAlignVertically},set:function(t){t!==this._pageAlignVertically&&(this._pageAlignVertically=t,this.queueUpdate(!0))}}),Object.defineProperty(n.ScaleManager.prototype,"isFullScreen",{get:function(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}}),Object.defineProperty(n.ScaleManager.prototype,"isPortrait",{get:function(){return"portrait"===this.classifyOrientation(this.screenOrientation)}}),Object.defineProperty(n.ScaleManager.prototype,"isLandscape",{get:function(){return"landscape"===this.classifyOrientation(this.screenOrientation)}}),Object.defineProperty(n.ScaleManager.prototype,"isGamePortrait",{get:function(){return this.height>this.width}}),Object.defineProperty(n.ScaleManager.prototype,"isGameLandscape",{get:function(){return this.width>this.height}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Utils.Debug=function(t){this.game=t,this.sprite=null,this.bmd=null,this.canvas=null,this.context=null,this.font="14px monospace",this.columnWidth=100,this.lineHeight=16,this.lineWidth=1,this.renderShadow=!0,this.currentColor=null,this.currentX=0,this.currentY=0,this.currentAlpha=1,this.dirty=!1,this.isDisabled=!1,this._line=null,this._rect=null},s.Utils.Debug.GEOM_AUTO=0,s.Utils.Debug.GEOM_RECTANGLE=1,s.Utils.Debug.GEOM_CIRCLE=2,s.Utils.Debug.GEOM_POINT=3,s.Utils.Debug.GEOM_LINE=4,s.Utils.Debug.GEOM_ELLIPSE=5,s.Utils.Debug.prototype={boot:function(){this.game.renderType===s.CANVAS?this.context=this.game.context:(this.bmd=new s.BitmapData(this.game,"__DEBUG",this.game.width,this.game.height,!0),this.sprite=this.game.make.image(0,0,this.bmd),this.game.stage.addChild(this.sprite),this.game.scale.onSizeChange.add(this.resize,this),this.canvas=s.CanvasPool.create(this,this.game.width,this.game.height),this.context=this.canvas.getContext("2d")),this._line=new s.Line,this._rect=new s.Rectangle},resize:function(){this.bmd.resize(this.game.width,this.game.height),this.canvas.width=this.game.width,this.canvas.height=this.game.height},preUpdate:function(){this.dirty&&this.sprite&&(this.bmd.clear(),this.bmd.draw(this.canvas,0,0),this.context.clearRect(0,0,this.game.width,this.game.height),this.dirty=!1)},reset:function(){this.context&&this.context.clearRect(0,0,this.game.width,this.game.height),this.sprite&&this.bmd.clear()},start:function(t,e,i,n){"number"!=typeof t&&(t=0),"number"!=typeof e&&(e=0),i=i||"rgb(255,255,255)",void 0===n&&(n=0),this.currentX=t,this.currentY=e,this.currentColor=i,this.columnWidth=n,this.dirty=!0,this.context.save(),this.context.setTransform(1,0,0,1,0,0),this.context.strokeStyle=i,this.context.fillStyle=i,this.context.font=this.font,this.context.globalAlpha=this.currentAlpha},stop:function(){this.context.restore()},line:function(){for(var t=this.currentX,e=0;e ")+o):o===n._pendingState?this.line("+ "+o):this.line(" "+o)}this.stop()},sound:function(t,e,i){var n=this.game.sound;this.start(t,e,i),n.noAudio?this.line("Audio is disabled"):(this.line("Volume: "+n.volume.toFixed(2)+(n.mute?" (Mute)":"")),this.line("Mute on pause: "+n.muteOnPause),this.line("Using: "+(n.usingWebAudio?"Web Audio - "+n.context.state:"Audio Tag")),this.line("Touch locked: "+n.touchLocked),this.line("Sounds: "+n._sounds.length)),this.stop()},soundInfo:function(t,e,i,n){if(this.start(e,i,n),this.line("Sound: "+t.key+" Touch locked: "+t.game.sound.touchLocked),this.line("Is Ready?: "+this.game.cache.isSoundReady(t.key)+" Pending Playback: "+t.pendingPlayback),this.line("Decoded: "+t.isDecoded+" Decoding: "+t.isDecoding),this.line("Playing: "+t.isPlaying+" Loop: "+t.loop),this.line("Time: "+(t.currentTime/1e3).toFixed(3)+"s Total: "+t.totalDuration.toFixed(3)+"s"),this.line("Volume: "+t.volume.toFixed(2)+(t.mute?" (Mute)":"")),this.line("Using: "+(t.usingWebAudio?"Web Audio":"Audio Tag")),t.usingWebAudio&&this.line(" Source: "+(t.sourceId||"none")),t.usingAudioTag&&t._sound){var s=t._sound;this.line(" currentSrc: "+s.currentSrc),this.line(" currentTime: "+s.currentTime),this.line(" duration: "+s.duration),this.line(" ended: "+s.ended),this.line(" loop: "+s.loop),this.line(" muted: "+s.muted),this.line(" paused: "+s.paused)}""!==t.currentMarker&&(this.line("Marker: "+t.currentMarker+" Duration: "+t.duration.toFixed(3)+"s ("+t.durationMS+"ms)"),this.line("Start: "+t.markers[t.currentMarker].start.toFixed(3)+" Stop: "+t.markers[t.currentMarker].stop.toFixed(3)),this.line("Position: "+t.position.toFixed(3))),this.stop()},camera:function(t,e,i){var n=t.deadzone,s=t.target,r=t.view;n&&(this._rect.setTo(r.x+n.x,r.y+n.y,n.width,n.height),this.rectangle(this._rect,e,i)),s&&(this._line.setTo(r.centerX,r.centerY,s.x,s.y),this.geom(this._line,e,i),this.geom(s,e,!1,3))},cameraInfo:function(t,e,i,n){var s=t.bounds,r=t.deadzone,o=t.target,a=t.view;this.start(e,i,n),this.line("Camera ("+t.width+" x "+t.height+")"),this.line("x: "+t.x+" y: "+t.y),this.line("Bounds: "+(s?"x: "+s.x+" y: "+s.y+" w: "+s.width+" h: "+s.height:"none")),this.line("View: x: "+a.x+" y: "+a.y+" w: "+a.width+" h: "+a.height),this.line("Center: x: "+t.centerX+" y: "+t.centerY),this.line("Deadzone: "+(r?"x: "+r.x+" y: "+r.y+" w: "+r.width+" h: "+r.height:r)),this.line("Total in view: "+t.totalInView),this.line("At limit: x: "+t.atLimit.x+" y: "+t.atLimit.y),this.line("Target: "+(o?o.name||o:"none")),this.stop()},timer:function(t,e,i,n){this.start(e,i,n),this.line("Timer (running: "+t.running+" expired: "+t.expired+")"),this.line("Next Tick: "+t.next+" Duration: "+t.duration),this.line("Paused: "+t.paused+" Length: "+t.length),this.stop()},pointer:function(t,e,i,n,s,r){if(null!=t&&(void 0===e&&(e=!1),i=i||"rgba(0,255,0,0.5)",n=n||"rgba(255,255,0,0.5)",r=r||"rgba(255,0,0,0.5)",!0!==e||!0!==t.isUp)){this.start(t.x,t.y-150,s),this.context.beginPath(),this.context.arc(t.x,t.y,t.circle.radius,0,2*Math.PI),t.active?this.context.fillStyle=t.isDown?i:n:this.context.fillStyle=r,this.context.fill(),this.context.closePath(),this.context.beginPath(),this.context.moveTo(t.positionDown.x,t.positionDown.y),this.context.lineTo(t.position.x,t.position.y),this.context.lineWidth=2,this.context.stroke(),this.context.closePath();var o=t.movementX,a=t.movementY;(o||a)&&(this.context.beginPath(),this.context.moveTo(o+t.position.x,a+t.position.y),this.context.lineTo(t.position.x,t.position.y),this.context.lineWidth=2,this.context.stroke(),this.context.closePath()),this.line("ID: "+t.id+" Active: "+t.active),this.line("World X: "+t.worldX.toFixed(1)+" World Y: "+t.worldY.toFixed(1)),this.line("Screen X: "+t.x.toFixed(1)+" Screen Y: "+t.y.toFixed(1)+" In: "+t.withinGame),this.line("Movement: X: "+o+" Y: "+a),this.line("Duration: "+t.duration+" ms"),this.line("is Down: "+t.isDown+" is Up: "+t.isUp),this.line("Identifier: "+t.identifier+" Pointer ID: "+t.pointerId),t.isMouse&&this.line("Buttons: "+this._pointerButtonIcon(t.leftButton)+" "+this._pointerButtonIcon(t.middleButton)+" "+this._pointerButtonIcon(t.rightButton)),this.stop()}},_pointerButtonIcon:function(t){return t.isDown?"x":t.isUp?"o":"-"},spriteInputInfo:function(t,e,i,n){this.start(e,i,n),this.line("Sprite Input: ("+t.width+" x "+t.height+")"),this.line("x: "+t.input.pointerX().toFixed(1)+" y: "+t.input.pointerY().toFixed(1)),this.line("over: "+t.input.pointerOver()+" duration: "+t.input.overDuration().toFixed(0)),this.line("down: "+t.input.pointerDown()+" duration: "+t.input.downDuration().toFixed(0)),this.line("just over: "+t.input.justOver()+" just out: "+t.input.justOut()),this.stop()},key:function(t,e,i,n){this.start(e,i,n,150),this.line("Key:",t.keyCode,"isDown:",t.isDown),this.line("justDown:",t.justDown,"justUp:",t.justUp),this.line("Time Down:",t.timeDown.toFixed(0),"duration:",t.duration.toFixed(0)),this.stop()},inputInfo:function(t,e,i,n){var r=this.game.input;if(void 0===n&&(n=!0),this.start(t,e,i),this.line("Input"),this.line("X: "+r.x+" Y: "+r.y),this.line("World X: "+r.worldX+" World Y: "+r.worldY),this.line("Scale X: "+r.scale.x.toFixed(2)+" Scale Y: "+r.scale.x.toFixed(2)),this.line("Screen X: "+r.activePointer.screenX.toFixed(1)+" Screen Y: "+r.activePointer.screenY.toFixed(1)),n){this.line("Sources:"),this.line(" "+this._inputHandler(r.mouse,"mouse")),this.line(" "+this._inputHandler(r.mspointer,"mspointer")),this.line(" "+this._inputHandler(r.touch,"touch"));var o=r.pointers,a=r.mousePointer,h=s.PointerModes,l=0,u=0;this.line("Pointers:"),this.line(" "+(a.isDown?"x":"o")+" "+h[a.pointerMode]+" "+a.identifier);for(var c=0;c0)for(var e=0;e ")+o):o===n._pendingState?this.line("+ "+o):this.line(" "+o)}this.stop()},sound:function(t,e,i){var n=this.game.sound;this.start(t,e,i),n.noAudio?this.line("Audio is disabled"):(this.line("Volume: "+n.volume.toFixed(2)+(n.mute?" (Mute)":"")),this.line("Mute on pause: "+n.muteOnPause),this.line("Using: "+(n.usingWebAudio?"Web Audio - "+n.context.state:"Audio Tag")),this.line("Touch locked: "+n.touchLocked),this.line("Sounds: "+n._sounds.length)),this.stop()},soundInfo:function(t,e,i,n){if(this.start(e,i,n),this.line("Sound: "+t.key+" Touch locked: "+t.game.sound.touchLocked),this.line("Is Ready?: "+this.game.cache.isSoundReady(t.key)+" Pending Playback: "+t.pendingPlayback),this.line("Decoded: "+t.isDecoded+" Decoding: "+t.isDecoding),this.line("Playing: "+t.isPlaying+" Loop: "+t.loop),this.line("Time: "+(t.currentTime/1e3).toFixed(3)+"s Total: "+t.totalDuration.toFixed(3)+"s"),this.line("Volume: "+t.volume.toFixed(2)+(t.mute?" (Mute)":"")),this.line("Using: "+(t.usingWebAudio?"Web Audio":"Audio Tag")),t.usingWebAudio&&this.line(" Source: "+(t.sourceId||"none")),t.usingAudioTag&&t._sound){var s=t._sound;this.line(" currentSrc: "+s.currentSrc),this.line(" currentTime: "+s.currentTime),this.line(" duration: "+s.duration),this.line(" ended: "+s.ended),this.line(" loop: "+s.loop),this.line(" muted: "+s.muted),this.line(" paused: "+s.paused)}""!==t.currentMarker&&(this.line("Marker: "+t.currentMarker+" Duration: "+t.duration.toFixed(3)+"s ("+t.durationMS+"ms)"),this.line("Start: "+t.markers[t.currentMarker].start.toFixed(3)+" Stop: "+t.markers[t.currentMarker].stop.toFixed(3)),this.line("Position: "+t.position.toFixed(3))),this.stop()},camera:function(t,e,i){var n=t.deadzone,s=t.target,r=t.view;n&&(this._rect.setTo(r.x+n.x,r.y+n.y,n.width,n.height),this.rectangle(this._rect,e,i)),s&&(this._line.setTo(r.centerX,r.centerY,s.x,s.y),this.geom(this._line,e,i),this.geom(s,e,!1,3))},cameraInfo:function(t,e,i,n){var s=t.bounds,r=t.deadzone,o=t.target,a=t.view;this.start(e,i,n),this.line("Camera ("+t.width+" x "+t.height+")"),this.line("x: "+t.x+" y: "+t.y),this.line("Bounds: "+(s?"x: "+s.x+" y: "+s.y+" w: "+s.width+" h: "+s.height:"none")),this.line("View: x: "+a.x+" y: "+a.y+" w: "+a.width+" h: "+a.height),this.line("Center: x: "+t.centerX+" y: "+t.centerY),this.line("Deadzone: "+(r?"x: "+r.x+" y: "+r.y+" w: "+r.width+" h: "+r.height:r)),this.line("Total in view: "+t.totalInView),this.line("At limit: x: "+t.atLimit.x+" y: "+t.atLimit.y),this.line("Target: "+(o?o.name||o:"none")),this.stop()},timer:function(t,e,i,n){this.start(e,i,n),this.line("Timer (running: "+t.running+" expired: "+t.expired+")"),this.line("Next Tick: "+t.next+" Duration: "+t.duration),this.line("Paused: "+t.paused+" Length: "+t.length),this.stop()},pointer:function(t,e,i,n,s,r){if(null!=t&&(void 0===e&&(e=!1),i=i||"rgba(0,255,0,0.5)",n=n||"rgba(255,255,0,0.5)",r=r||"rgba(255,0,0,0.5)",!0!==e||!0!==t.isUp)){this.start(t.x,t.y-150,s),this.context.beginPath(),this.context.arc(t.x,t.y,t.circle.radius,0,2*Math.PI),t.active?this.context.fillStyle=t.isDown?i:n:this.context.fillStyle=r,this.context.fill(),this.context.closePath(),this.context.beginPath(),this.context.moveTo(t.positionDown.x,t.positionDown.y),this.context.lineTo(t.position.x,t.position.y),this.context.lineWidth=2,this.context.stroke(),this.context.closePath();var o=t.movementX,a=t.movementY;(o||a)&&(this.context.beginPath(),this.context.moveTo(o+t.position.x,a+t.position.y),this.context.lineTo(t.position.x,t.position.y),this.context.lineWidth=2,this.context.stroke(),this.context.closePath()),this.line("ID: "+t.id+" Active: "+t.active),this.line("World X: "+t.worldX.toFixed(1)+" World Y: "+t.worldY.toFixed(1)),this.line("Screen X: "+t.x.toFixed(1)+" Screen Y: "+t.y.toFixed(1)+" In: "+t.withinGame),this.line("Movement: X: "+o+" Y: "+a),this.line("Duration: "+t.duration+" ms"),this.line("is Down: "+t.isDown+" is Up: "+t.isUp),this.line("Identifier: "+t.identifier+" Pointer ID: "+t.pointerId),t.isMouse&&this.line("Buttons: "+this._pointerButtonIcon(t.leftButton)+" "+this._pointerButtonIcon(t.middleButton)+" "+this._pointerButtonIcon(t.rightButton)),this.stop()}},_pointerButtonIcon:function(t){return t.isDown?"x":t.isUp?"o":"-"},spriteInputInfo:function(t,e,i,n){this.start(e,i,n),this.line("Sprite Input: ("+t.width+" x "+t.height+")"),this.line("x: "+t.input.pointerX().toFixed(1)+" y: "+t.input.pointerY().toFixed(1)),this.line("over: "+t.input.pointerOver()+" duration: "+t.input.overDuration().toFixed(0)),this.line("down: "+t.input.pointerDown()+" duration: "+t.input.downDuration().toFixed(0)),this.line("just over: "+t.input.justOver()+" just out: "+t.input.justOut()),this.stop()},key:function(t,e,i,n){this.start(e,i,n,150),this.line("Key:",t.keyCode,"isDown:",t.isDown),this.line("justDown:",t.justDown,"justUp:",t.justUp),this.line("Time Down:",t.timeDown.toFixed(0),"duration:",t.duration.toFixed(0)),this.stop()},inputInfo:function(t,e,i,s){var r=this.game.input;if(void 0===s&&(s=!0),this.start(t,e,i),this.line("Input"),this.line("X: "+r.x+" Y: "+r.y),this.line("World X: "+r.worldX+" World Y: "+r.worldY),this.line("Scale X: "+r.scale.x.toFixed(2)+" Scale Y: "+r.scale.x.toFixed(2)),this.line("Screen X: "+r.activePointer.screenX.toFixed(1)+" Screen Y: "+r.activePointer.screenY.toFixed(1)),s){this.line("Sources:"),this.line(" "+this._inputHandler(r.mouse,"mouse")),this.line(" "+this._inputHandler(r.mspointer,"mspointer")),this.line(" "+this._inputHandler(r.touch,"touch"));var o=r.pointers,a=r.mousePointer,h=n.PointerModes,l=0,c=0;this.line("Pointers:"),this.line(" "+(a.isDown?"x":"o")+" "+h[a.pointerMode]+" "+a.identifier);for(var u=0;u0)for(var e=0;e * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.DOM={getOffset:function(t,e){e=e||new s.Point;var i=t.getBoundingClientRect(),n=s.DOM.scrollY,r=s.DOM.scrollX,o=document.documentElement.clientTop,a=document.documentElement.clientLeft;return e.x=i.left+r-a,e.y=i.top+n-o,e},getBounds:function(t,e){return void 0===e&&(e=0),!(!(t=t&&!t.nodeType?t[0]:t)||1!==t.nodeType)&&this.calibrate(t.getBoundingClientRect(),e)},calibrate:function(t,e){e=+e||0;var i={width:0,height:0,left:0,right:0,top:0,bottom:0};return i.width=(i.right=t.right+e)-(i.left=t.left-e),i.height=(i.bottom=t.bottom+e)-(i.top=t.top-e),i},getAspectRatio:function(t){var e=(t=null==t?this.visualBounds:1===t.nodeType?this.getBounds(t):t).width,i=t.height;return"function"==typeof e&&(e=e.call(t)),"function"==typeof i&&(i=i.call(t)),e/i},inLayoutViewport:function(t,e){var i=this.getBounds(t,e);return!!i&&i.bottom>=0&&i.right>=0&&i.top<=this.layoutBounds.width&&i.left<=this.layoutBounds.height},getScreenOrientation:function(t){var e=window.screen,i=e.orientation||e.mozOrientation||e.msOrientation;if(i&&"string"==typeof i.type)return i.type;if("string"==typeof i)return i;var n="portrait-primary",s="landscape-primary";if("screen"===t)return e.height>e.width?n:s;if("viewport"===t)return this.visualBounds.height>this.visualBounds.width?n:s;if("window.orientation"===t&&"number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?n:s;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return n;if(window.matchMedia("(orientation: landscape)").matches)return s}return this.visualBounds.height>this.visualBounds.width?n:s},visualBounds:new s.Rectangle,layoutBounds:new s.Rectangle,documentBounds:new s.Rectangle},s.Device.whenReady((function(t){var e=window&&"pageXOffset"in window?function(){return window.pageXOffset}:function(){return document.documentElement.scrollLeft},i=window&&"pageYOffset"in window?function(){return window.pageYOffset}:function(){return document.documentElement.scrollTop};if(Object.defineProperty(s.DOM,"scrollX",{get:e}),Object.defineProperty(s.DOM,"scrollY",{get:i}),Object.defineProperty(s.DOM.visualBounds,"x",{get:e}),Object.defineProperty(s.DOM.visualBounds,"y",{get:i}),Object.defineProperty(s.DOM.layoutBounds,"x",{value:0}),Object.defineProperty(s.DOM.layoutBounds,"y",{value:0}),t.desktop&&document.documentElement.clientWidth<=window.innerWidth&&document.documentElement.clientHeight<=window.innerHeight){var n=function(){return Math.max(window.innerWidth,document.documentElement.clientWidth)},r=function(){return Math.max(window.innerHeight,document.documentElement.clientHeight)};Object.defineProperty(s.DOM.visualBounds,"width",{get:n}),Object.defineProperty(s.DOM.visualBounds,"height",{get:r}),Object.defineProperty(s.DOM.layoutBounds,"width",{get:n}),Object.defineProperty(s.DOM.layoutBounds,"height",{get:r})}else Object.defineProperty(s.DOM.visualBounds,"width",{get:function(){return window.innerWidth}}),Object.defineProperty(s.DOM.visualBounds,"height",{get:function(){return window.innerHeight}}),Object.defineProperty(s.DOM.layoutBounds,"width",{get:function(){var t=document.documentElement.clientWidth,e=window.innerWidth;return t=0&&i.right>=0&&i.top<=this.layoutBounds.width&&i.left<=this.layoutBounds.height},getScreenOrientation:function(t){var e=window.screen,i=e.orientation||e.mozOrientation||e.msOrientation;if(i&&"string"==typeof i.type)return i.type;if("string"==typeof i)return i;var n="portrait-primary",s="landscape-primary";if("screen"===t)return e.height>e.width?n:s;if("viewport"===t)return this.visualBounds.height>this.visualBounds.width?n:s;if("window.orientation"===t&&"number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?n:s;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return n;if(window.matchMedia("(orientation: landscape)").matches)return s}return this.visualBounds.height>this.visualBounds.width?n:s},visualBounds:new n.Rectangle,layoutBounds:new n.Rectangle,documentBounds:new n.Rectangle},n.Device.whenReady((function(t){var e=window&&"pageXOffset"in window?function(){return window.pageXOffset}:function(){return document.documentElement.scrollLeft},i=window&&"pageYOffset"in window?function(){return window.pageYOffset}:function(){return document.documentElement.scrollTop};if(Object.defineProperty(n.DOM,"scrollX",{get:e}),Object.defineProperty(n.DOM,"scrollY",{get:i}),Object.defineProperty(n.DOM.visualBounds,"x",{get:e}),Object.defineProperty(n.DOM.visualBounds,"y",{get:i}),Object.defineProperty(n.DOM.layoutBounds,"x",{value:0}),Object.defineProperty(n.DOM.layoutBounds,"y",{value:0}),t.desktop&&document.documentElement.clientWidth<=window.innerWidth&&document.documentElement.clientHeight<=window.innerHeight){var s=function(){return Math.max(window.innerWidth,document.documentElement.clientWidth)},r=function(){return Math.max(window.innerHeight,document.documentElement.clientHeight)};Object.defineProperty(n.DOM.visualBounds,"width",{get:s}),Object.defineProperty(n.DOM.visualBounds,"height",{get:r}),Object.defineProperty(n.DOM.layoutBounds,"width",{get:s}),Object.defineProperty(n.DOM.layoutBounds,"height",{get:r})}else Object.defineProperty(n.DOM.visualBounds,"width",{get:function(){return window.innerWidth}}),Object.defineProperty(n.DOM.visualBounds,"height",{get:function(){return window.innerHeight}}),Object.defineProperty(n.DOM.layoutBounds,"width",{get:function(){var t=document.documentElement.clientWidth,e=window.innerWidth;return t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.ArraySet=function(t){this.position=0,this.list=t||[]},s.ArraySet.prototype={add:function(t){return this.exists(t)||this.list.push(t),t},getIndex:function(t){return this.list.indexOf(t)},getByKey:function(t,e){for(var i=this.list.length;i--;)if(this.list[i][t]===e)return this.list[i];return null},exists:function(t){return this.list.indexOf(t)>-1},reset:function(){this.list.length=0},remove:function(t){var e=this.list.indexOf(t);if(e>-1)return this.list.splice(e,1),t},setAll:function(t,e){for(var i=this.list.length;i--;)this.list[i]&&(this.list[i][t]=e)},callAll:function(t){for(var e=Array.prototype.slice.call(arguments,1),i=this.list.length;i--;)this.list[i]&&this.list[i][t]&&this.list[i][t].apply(this.list[i],e)},removeAll:function(t){void 0===t&&(t=!1);for(var e=this.list.length;e--;)if(this.list[e]){var i=this.remove(this.list[e]);t&&i.destroy()}this.position=0,this.list=[]}},Object.defineProperty(s.ArraySet.prototype,"total",{get:function(){return this.list.length}}),Object.defineProperty(s.ArraySet.prototype,"first",{get:function(){return this.position=0,this.list.length>0?this.list[0]:null}}),Object.defineProperty(s.ArraySet.prototype,"next",{get:function(){return this.position-1},reset:function(){this.list.length=0},remove:function(t){var e=this.list.indexOf(t);if(e>-1)return this.list.splice(e,1),t},setAll:function(t,e){for(var i=this.list.length;i--;)this.list[i]&&(this.list[i][t]=e)},callAll:function(t){for(var e=Array.prototype.slice.call(arguments,1),i=this.list.length;i--;)this.list[i]&&this.list[i][t]&&this.list[i][t].apply(this.list[i],e)},removeAll:function(t){void 0===t&&(t=!1);for(var e=this.list.length;e--;)if(this.list[e]){var i=this.remove(this.list[e]);t&&i.destroy()}this.position=0,this.list=[]}},Object.defineProperty(n.ArraySet.prototype,"total",{get:function(){return this.list.length}}),Object.defineProperty(n.ArraySet.prototype,"first",{get:function(){return this.position=0,this.list.length>0?this.list[0]:null}}),Object.defineProperty(n.ArraySet.prototype,"next",{get:function(){return this.position * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.ArrayUtils={getRandomItem:function(t,e,i){if(null===t)return null;void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]},removeRandomItem:function(t,e,i){if(null==t)return null;void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);if(n=n||0===i)){null==i&&(i=1);for(var s=n-i,r=e;r0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t},transposeMatrix:function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n},rotateMatrix:function(t,e){if("string"!=typeof e&&(e=(e%360+360)%360),90===e||-270===e||"rotateLeft"===e)t=(t=s.ArrayUtils.transposeMatrix(t)).reverse();else if(-90===e||270===e||"rotateRight"===e)t=t.reverse(),t=s.ArrayUtils.transposeMatrix(t);else if(180===Math.abs(e)||"rotate180"===e){for(var i=0;i=n||0===i)){null==i&&(i=1);for(var s=n-i,r=e;r0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t},transposeMatrix:function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n},rotateMatrix:function(t,e){if("string"!=typeof e&&(e=(e%360+360)%360),90===e||-270===e||"rotateLeft"===e)t=(t=n.ArrayUtils.transposeMatrix(t)).reverse();else if(-90===e||270===e||"rotateRight"===e)t=t.reverse(),t=n.ArrayUtils.transposeMatrix(t);else if(180===Math.abs(e)||"rotate180"===e){for(var i=0;i * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},s.LinkedList.prototype={add:function(t){return 0===this.total&&null===this.first&&null===this.last?(this.first=t,this.last=t,this.next=t,t.prev=this,this.total++,t):(this.last.next=t,t.prev=this.last,this.last=t,this.total++,t)},reset:function(){this.first=null,this.last=null,this.next=null,this.prev=null,this.total=0},remove:function(t){if(1===this.total)return this.reset(),void(t.next=t.prev=null);t===this.first?this.first=this.first.next:t===this.last&&(this.last=this.last.prev),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.next=t.prev=null,null===this.first&&(this.last=null),this.total--},callAll:function(t){if(this.first&&this.last){var e=this.first;do{e&&e[t]&&e[t].call(e),e=e.next}while(e!==this.last.next)}}},s.LinkedList.prototype.constructor=s.LinkedList, +n.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},n.LinkedList.prototype={add:function(t){return 0===this.total&&null===this.first&&null===this.last?(this.first=t,this.last=t,this.next=t,t.prev=this,this.total++,t):(this.last.next=t,t.prev=this.last,this.last=t,this.total++,t)},reset:function(){this.first=null,this.last=null,this.next=null,this.prev=null,this.total=0},remove:function(t){if(1===this.total)return this.reset(),void(t.next=t.prev=null);t===this.first?this.first=this.first.next:t===this.last&&(this.last=this.last.prev),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.next=t.prev=null,null===this.first&&(this.last=null),this.total--},callAll:function(t){if(this.first&&this.last){var e=this.first;do{e&&e[t]&&e[t].call(e),e=e.next}while(e!==this.last.next)}}},n.LinkedList.prototype.constructor=n.LinkedList, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Create=function(t){this.game=t,this.bmd=null,this.canvas=null,this.ctx=null,this.palettes=[{0:"#000",1:"#9D9D9D",2:"#FFF",3:"#BE2633",4:"#E06F8B",5:"#493C2B",6:"#A46422",7:"#EB8931",8:"#F7E26B",9:"#2F484E",A:"#44891A",B:"#A3CE27",C:"#1B2632",D:"#005784",E:"#31A2F2",F:"#B2DCEF"},{0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"},{0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"},{0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"},{0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}]},s.Create.PALETTE_ARNE=0,s.Create.PALETTE_JMP=1,s.Create.PALETTE_CGA=2,s.Create.PALETTE_C64=3,s.Create.PALETTE_JAPANESE_MACHINE=4,s.Create.prototype={texture:function(t,e,i,n,s,r,o,a){void 0===i&&(i=8),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=!0);var h=e[0].length*i,l=e.length*n;null===this.bmd&&(this.bmd=this.game.make.bitmapData(),this.canvas=this.bmd.canvas,this.ctx=this.bmd.context),this.bmd.resize(h,l),this.bmd.clear();for(var u=0;u * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.FlexGrid=function(t,e,i){this.game=t.game,this.manager=t,this.width=e,this.height=i,this.boundsCustom=new s.Rectangle(0,0,e,i),this.boundsFluid=new s.Rectangle(0,0,e,i),this.boundsFull=new s.Rectangle(0,0,e,i),this.boundsNone=new s.Rectangle(0,0,e,i),this.positionCustom=new s.Point(0,0),this.positionFluid=new s.Point(0,0),this.positionFull=new s.Point(0,0),this.positionNone=new s.Point(0,0),this.scaleCustom=new s.Point(1,1),this.scaleFluid=new s.Point(1,1),this.scaleFluidInversed=new s.Point(1,1),this.scaleFull=new s.Point(1,1),this.scaleNone=new s.Point(1,1),this.customWidth=0,this.customHeight=0,this.customOffsetX=0,this.customOffsetY=0,this.ratioH=e/i,this.ratioV=i/e,this.multiplier=0,this.layers=[]},s.FlexGrid.prototype={setSize:function(t,e){this.width=t,this.height=e,this.ratioH=t/e,this.ratioV=e/t,this.scaleNone=new s.Point(1,1),this.boundsNone.width=this.width,this.boundsNone.height=this.height,this.refresh()},createCustomLayer:function(t,e,i,n){void 0===n&&(n=!0),this.customWidth=t,this.customHeight=e,this.boundsCustom.width=t,this.boundsCustom.height=e;var r=new s.FlexLayer(this,this.positionCustom,this.boundsCustom,this.scaleCustom);return n&&this.game.world.add(r),this.layers.push(r),i&&r.addMultiple(i),r},createFluidLayer:function(t,e){void 0===e&&(e=!0);var i=new s.FlexLayer(this,this.positionFluid,this.boundsFluid,this.scaleFluid);return e&&this.game.world.add(i),this.layers.push(i),t&&i.addMultiple(t),i},createFullLayer:function(t){var e=new s.FlexLayer(this,this.positionFull,this.boundsFull,this.scaleFluid);return this.game.world.add(e),this.layers.push(e),void 0!==t&&e.addMultiple(t),e},createFixedLayer:function(t){var e=new s.FlexLayer(this,this.positionNone,this.boundsNone,this.scaleNone);return this.game.world.add(e),this.layers.push(e),void 0!==t&&e.addMultiple(t),e},reset:function(){for(var t=this.layers.length;t--;)this.layers[t].persist||(this.layers[t].position=null,this.layers[t].scale=null,this.layers.slice(t,1))},onResize:function(t,e){this.ratioH=t/e,this.ratioV=e/t,this.refresh(t,e)},refresh:function(){this.multiplier=Math.min(this.manager.height/this.height,this.manager.width/this.width),this.boundsFluid.width=Math.round(this.width*this.multiplier),this.boundsFluid.height=Math.round(this.height*this.multiplier),this.scaleFluid.set(this.boundsFluid.width/this.width,this.boundsFluid.height/this.height),this.scaleFluidInversed.set(this.width/this.boundsFluid.width,this.height/this.boundsFluid.height),this.scaleFull.set(this.boundsFull.width/this.width,this.boundsFull.height/this.height),this.boundsFull.width=Math.round(this.manager.width*this.scaleFluidInversed.x),this.boundsFull.height=Math.round(this.manager.height*this.scaleFluidInversed.y),this.boundsFluid.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.boundsNone.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.positionFluid.set(this.boundsFluid.x,this.boundsFluid.y),this.positionNone.set(this.boundsNone.x,this.boundsNone.y)},fitSprite:function(t){this.manager.scaleSprite(t),t.x=this.manager.bounds.centerX,t.y=this.manager.bounds.centerY},debug:function(){this.game.debug.text(this.boundsFluid.width+" x "+this.boundsFluid.height,this.boundsFluid.x+4,this.boundsFluid.y+16),this.game.debug.geom(this.boundsFluid,"rgba(255,0,0,0.9",!1)}},s.FlexGrid.prototype.constructor=s.FlexGrid, +n.FlexGrid=function(t,e,i){this.game=t.game,this.manager=t,this.width=e,this.height=i,this.boundsCustom=new n.Rectangle(0,0,e,i),this.boundsFluid=new n.Rectangle(0,0,e,i),this.boundsFull=new n.Rectangle(0,0,e,i),this.boundsNone=new n.Rectangle(0,0,e,i),this.positionCustom=new n.Point(0,0),this.positionFluid=new n.Point(0,0),this.positionFull=new n.Point(0,0),this.positionNone=new n.Point(0,0),this.scaleCustom=new n.Point(1,1),this.scaleFluid=new n.Point(1,1),this.scaleFluidInversed=new n.Point(1,1),this.scaleFull=new n.Point(1,1),this.scaleNone=new n.Point(1,1),this.customWidth=0,this.customHeight=0,this.customOffsetX=0,this.customOffsetY=0,this.ratioH=e/i,this.ratioV=i/e,this.multiplier=0,this.layers=[]},n.FlexGrid.prototype={setSize:function(t,e){this.width=t,this.height=e,this.ratioH=t/e,this.ratioV=e/t,this.scaleNone=new n.Point(1,1),this.boundsNone.width=this.width,this.boundsNone.height=this.height,this.refresh()},createCustomLayer:function(t,e,i,s){void 0===s&&(s=!0),this.customWidth=t,this.customHeight=e,this.boundsCustom.width=t,this.boundsCustom.height=e;var r=new n.FlexLayer(this,this.positionCustom,this.boundsCustom,this.scaleCustom);return s&&this.game.world.add(r),this.layers.push(r),i&&r.addMultiple(i),r},createFluidLayer:function(t,e){void 0===e&&(e=!0);var i=new n.FlexLayer(this,this.positionFluid,this.boundsFluid,this.scaleFluid);return e&&this.game.world.add(i),this.layers.push(i),t&&i.addMultiple(t),i},createFullLayer:function(t){var e=new n.FlexLayer(this,this.positionFull,this.boundsFull,this.scaleFluid);return this.game.world.add(e),this.layers.push(e),void 0!==t&&e.addMultiple(t),e},createFixedLayer:function(t){var e=new n.FlexLayer(this,this.positionNone,this.boundsNone,this.scaleNone);return this.game.world.add(e),this.layers.push(e),void 0!==t&&e.addMultiple(t),e},reset:function(){for(var t=this.layers.length;t--;)this.layers[t].persist||(this.layers[t].position=null,this.layers[t].scale=null,this.layers.slice(t,1))},onResize:function(t,e){this.ratioH=t/e,this.ratioV=e/t,this.refresh(t,e)},refresh:function(){this.multiplier=Math.min(this.manager.height/this.height,this.manager.width/this.width),this.boundsFluid.width=Math.round(this.width*this.multiplier),this.boundsFluid.height=Math.round(this.height*this.multiplier),this.scaleFluid.set(this.boundsFluid.width/this.width,this.boundsFluid.height/this.height),this.scaleFluidInversed.set(this.width/this.boundsFluid.width,this.height/this.boundsFluid.height),this.scaleFull.set(this.boundsFull.width/this.width,this.boundsFull.height/this.height),this.boundsFull.width=Math.round(this.manager.width*this.scaleFluidInversed.x),this.boundsFull.height=Math.round(this.manager.height*this.scaleFluidInversed.y),this.boundsFluid.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.boundsNone.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.positionFluid.set(this.boundsFluid.x,this.boundsFluid.y),this.positionNone.set(this.boundsNone.x,this.boundsNone.y)},fitSprite:function(t){this.manager.scaleSprite(t),t.x=this.manager.bounds.centerX,t.y=this.manager.bounds.centerY},debug:function(){this.game.debug.text(this.boundsFluid.width+" x "+this.boundsFluid.height,this.boundsFluid.x+4,this.boundsFluid.y+16),this.game.debug.geom(this.boundsFluid,"rgba(255,0,0,0.9",!1)}},n.FlexGrid.prototype.constructor=n.FlexGrid, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.FlexLayer=function(t,e,i,n){s.Group.call(this,t.game,null,"__flexLayer"+t.game.rnd.uuid(),!1),this.manager=t.manager,this.grid=t,this.persist=!1,this.position=e,this.bounds=i,this.scale=n,this.topLeft=i.topLeft,this.topMiddle=new s.Point(i.halfWidth,0),this.topRight=i.topRight,this.bottomLeft=i.bottomLeft,this.bottomMiddle=new s.Point(i.halfWidth,i.bottom),this.bottomRight=i.bottomRight},s.FlexLayer.prototype=Object.create(s.Group.prototype),s.FlexLayer.prototype.constructor=s.FlexLayer,s.FlexLayer.prototype.resize=function(){},s.FlexLayer.prototype.debug=function(){this.game.debug.text(this.bounds.width+" x "+this.bounds.height,this.bounds.x+4,this.bounds.y+16),this.game.debug.geom(this.bounds,"rgba(0,0,255,0.9",!1),this.game.debug.geom(this.topLeft,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topMiddle,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topRight,"rgba(255,255,255,0.9")}, +n.FlexLayer=function(t,e,i,s){n.Group.call(this,t.game,null,"__flexLayer"+t.game.rnd.uuid(),!1),this.manager=t.manager,this.grid=t,this.persist=!1,this.position=e,this.bounds=i,this.scale=s,this.topLeft=i.topLeft,this.topMiddle=new n.Point(i.halfWidth,0),this.topRight=i.topRight,this.bottomLeft=i.bottomLeft,this.bottomMiddle=new n.Point(i.halfWidth,i.bottom),this.bottomRight=i.bottomRight},n.FlexLayer.prototype=Object.create(n.Group.prototype),n.FlexLayer.prototype.constructor=n.FlexLayer,n.FlexLayer.prototype.resize=function(){},n.FlexLayer.prototype.debug=function(){this.game.debug.text(this.bounds.width+" x "+this.bounds.height,this.bounds.x+4,this.bounds.y+16),this.game.debug.geom(this.bounds,"rgba(0,0,255,0.9",!1),this.game.debug.geom(this.topLeft,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topMiddle,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topRight,"rgba(255,255,255,0.9")}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Color={RED:16711680,ORANGE:16750848,YELLOW:16776960,GREEN:65280,AQUA:65535,BLUE:255,VIOLET:16711935,WHITE:16777215,BLACK:0,GRAY:6710886,packPixel:function(t,e,i,n){return s.Device.LITTLE_ENDIAN?(n<<24|i<<16|e<<8|t)>>>0:(t<<24|e<<16|i<<8|n)>>>0},unpackPixel:function(t,e,i,n){return null==e&&(e=s.Color.createColor()),null==i&&(i=!1),null==n&&(n=!1),s.Device.LITTLE_ENDIAN?(e.a=(4278190080&t)>>>24,e.b=(16711680&t)>>>16,e.g=(65280&t)>>>8,e.r=255&t):(e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t),e.color=t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a/255+")",i&&s.Color.RGBtoHSL(e.r,e.g,e.b,e),n&&s.Color.RGBtoHSV(e.r,e.g,e.b,e),e},fromRGBA:function(t,e){return e||(e=s.Color.createColor()),e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a+")",e},toRGBA:function(t,e,i,n){return t<<24|e<<16|i<<8|n},toABGR:function(t,e,i,n){return(n<<24|i<<16|e<<8|t)>>>0},hexToRGBArray:function(t){return[(t>>16&255)/255,(t>>8&255)/255,(255&t)/255]},RGBArrayToHex:function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},RGBtoHSL:function(t,e,i,n){n||(n=s.Color.createColor(t,e,i,1)),t/=255,e/=255,i/=255;var r=Math.min(t,e,i),o=Math.max(t,e,i);if(n.h=0,n.s=0,n.l=(o+r)/2,o!==r){var a=o-r;n.s=n.l>.5?a/(2-o-r):a/(o+r),o===t?n.h=(e-i)/a+(e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},createColor:function(t,e,i,n,r,o,a,h){var l={r:t||0,g:e||0,b:i||0,a:n||1,h:r||0,s:o||0,l:a||0,v:h||0,color:0,color32:0,rgba:""};return s.Color.updateColor(l)},updateColor:function(t){return t.rgba="rgba("+t.r.toFixed()+","+t.g.toFixed()+","+t.b.toFixed()+","+t.a.toString()+")",t.color=s.Color.getColor(t.r,t.g,t.b),t.color32=s.Color.getColor32(255*t.a,t.r,t.g,t.b),t},getColor32:function(t,e,i,n){return t<<24|e<<16|i<<8|n},getColor:function(t,e,i){return t<<16|e<<8|i},RGBtoString:function(t,e,i,n,r){return void 0===n&&(n=255),void 0===r&&(r="#"),"#"===r?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+s.Color.componentToHex(n)+s.Color.componentToHex(t)+s.Color.componentToHex(e)+s.Color.componentToHex(i)},hexToRGB:function(t){var e=s.Color.hexToColor(t);if(e)return s.Color.getColor32(e.a,e.r,e.g,e.b)},hexToColor:function(t,e){t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,n){return e+e+i+i+n+n}));var i=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(i){var n=parseInt(i[1],16),r=parseInt(i[2],16),o=parseInt(i[3],16);e?(e.r=n,e.g=r,e.b=o):e=s.Color.createColor(n,r,o)}return e},webToColor:function(t,e){e||(e=s.Color.createColor());var i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t);return i&&(e.r=~~Number(i[1]),e.g=~~Number(i[2]),e.b=~~Number(i[3]),e.a=void 0!==i[4]?Number(i[4]):1,s.Color.updateColor(e)),e},valueToColor:function(t,e){if(e||(e=s.Color.createColor()),"string"==typeof t)return 0===t.indexOf("rgb")?s.Color.webToColor(t,e):(e.a=1,s.Color.hexToColor(t,e));if("number"==typeof t){var i=s.Color.getRGB(t);return e.r=i.r,e.g=i.g,e.b=i.b,e.a=i.a/255,e}return e},componentToHex:function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},HSVColorWheel:function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],n=0;n<=359;n++)i.push(s.Color.HSVtoRGB(n/359,t,e));return i},HSLColorWheel:function(t,e){void 0===t&&(t=.5),void 0===e&&(e=.5);for(var i=[],n=0;n<=359;n++)i.push(s.Color.HSLtoRGB(n/359,t,e));return i},interpolateColor:function(t,e,i,n,r,o){void 0===r&&(r=255),void 0===o&&(o=0);var a=s.Color.getRGB(t),h=s.Color.getRGB(e);if(0===o)var l=(h.red-a.red)*n/i+a.red,u=(h.green-a.green)*n/i+a.green,c=(h.blue-a.blue)*n/i+a.blue;if(1===o){var d,p=s.Color.RGBtoHSV(a.r,a.g,a.b),f=s.Color.RGBtoHSV(h.r,h.g,h.b),g=f.h-p.h;if(p.h>f.h){var m=f.h;f.h=p.h,p.h=m,g=-g,n=i-n}g>.5&&(p.h=p.h+1,d=((f.h-p.h)*n/i+p.h)%1),g<=.5&&(d=(f.h-p.h)*n/i+p.h);var y=(f.s-p.s)*n/i+p.s,v=(f.v-p.v)*n/i+p.v,x=s.Color.HSVtoRGB(d,y,v,x);l=x.r,u=x.g,c=x.b}return s.Color.getColor32(r,l,u,c)},interpolateColorWithRGB:function(t,e,i,n,r,o){var a=s.Color.getRGB(t),h=(e-a.red)*o/r+a.red,l=(i-a.green)*o/r+a.green,u=(n-a.blue)*o/r+a.blue;return s.Color.getColor(h,l,u)},interpolateRGB:function(t,e,i,n,r,o,a,h){var l=(n-t)*h/a+t,u=(r-e)*h/a+e,c=(o-i)*h/a+i;return s.Color.getColor(l,u,c)},linear:function(t,e,i){return this.interpolateColor(t,e,1,i)},linearInterpolation:function(t,e){var i=s.Math.linear(0,t.length-1,e),n=t[Math.floor(i)],r=t[Math.ceil(i)];return this.linear(n,r,i%1)},getRandomColor:function(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=255),void 0===i&&(i=255),e>255||t>e)return s.Color.getColor(255,255,255);var n=t+Math.round(Math.random()*(e-t)),r=t+Math.round(Math.random()*(e-t)),o=t+Math.round(Math.random()*(e-t));return s.Color.getColor32(i,n,r,o)},getRGB:function(t){return t>16777215?{alpha:t>>>24,red:t>>16&255,green:t>>8&255,blue:255&t,a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{alpha:255,red:t>>16&255,green:t>>8&255,blue:255&t,a:255,r:t>>16&255,g:t>>8&255,b:255&t}},getWebRGB:function(t){if("object"==typeof t)return"rgba("+t.r.toString()+","+t.g.toString()+","+t.b.toString()+","+(t.a/255).toString()+")";var e=s.Color.getRGB(t);return"rgba("+e.r.toString()+","+e.g.toString()+","+e.b.toString()+","+(e.a/255).toString()+")"},getAlpha:function(t){return t>>>24},getAlphaFloat:function(t){return(t>>>24)/255},getRed:function(t){return t>>16&255},getGreen:function(t){return t>>8&255},getBlue:function(t){return 255&t},blendNormal:function(t){return t},blendLighten:function(t,e){return e>t?e:t},blendDarken:function(t,e){return e>t?t:e},blendMultiply:function(t,e){return t*e/255},blendAverage:function(t,e){return(t+e)/2},blendAdd:function(t,e){return Math.min(255,t+e)},blendSubtract:function(t,e){return Math.max(0,t+e-255)},blendDifference:function(t,e){return Math.abs(t-e)},blendNegation:function(t,e){return 255-Math.abs(255-t-e)},blendScreen:function(t,e){return 255-((255-t)*(255-e)>>8)},blendExclusion:function(t,e){return t+e-2*t*e/255},blendOverlay:function(t,e){return e<128?2*t*e/255:255-2*(255-t)*(255-e)/255},blendSoftLight:function(t,e){return e<128?2*(64+(t>>1))*(e/255):255-2*(255-(64+(t>>1)))*(255-e)/255},blendHardLight:function(t,e){return s.Color.blendOverlay(e,t)},blendColorDodge:function(t,e){return 255===e?e:Math.min(255,(t<<8)/(255-e))},blendColorBurn:function(t,e){return 0===e?e:Math.max(0,255-(255-t<<8)/e)},blendLinearDodge:function(t,e){return s.Color.blendAdd(t,e)},blendLinearBurn:function(t,e){return s.Color.blendSubtract(t,e)},blendLinearLight:function(t,e){return e<128?s.Color.blendLinearBurn(t,2*e):s.Color.blendLinearDodge(t,2*(e-128))},blendVividLight:function(t,e){return e<128?s.Color.blendColorBurn(t,2*e):s.Color.blendColorDodge(t,2*(e-128))},blendPinLight:function(t,e){return e<128?s.Color.blendDarken(t,2*e):s.Color.blendLighten(t,2*(e-128))},blendHardMix:function(t,e){return s.Color.blendVividLight(t,e)<128?0:255},blendReflect:function(t,e){return 255===e?e:Math.min(255,t*t/(255-e))},blendGlow:function(t,e){return s.Color.blendReflect(e,t)},blendPhoenix:function(t,e){return Math.min(t,e)-Math.max(t,e)+255}}, +n.Color={RED:16711680,ORANGE:16750848,YELLOW:16776960,GREEN:65280,AQUA:65535,BLUE:255,VIOLET:16711935,WHITE:16777215,BLACK:0,GRAY:6710886,packPixel:function(t,e,i,s){return n.Device.LITTLE_ENDIAN?(s<<24|i<<16|e<<8|t)>>>0:(t<<24|e<<16|i<<8|s)>>>0},unpackPixel:function(t,e,i,s){return null==e&&(e=n.Color.createColor()),null==i&&(i=!1),null==s&&(s=!1),n.Device.LITTLE_ENDIAN?(e.a=(4278190080&t)>>>24,e.b=(16711680&t)>>>16,e.g=(65280&t)>>>8,e.r=255&t):(e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t),e.color=t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a/255+")",i&&n.Color.RGBtoHSL(e.r,e.g,e.b,e),s&&n.Color.RGBtoHSV(e.r,e.g,e.b,e),e},fromRGBA:function(t,e){return e||(e=n.Color.createColor()),e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a+")",e},toRGBA:function(t,e,i,n){return t<<24|e<<16|i<<8|n},toABGR:function(t,e,i,n){return(n<<24|i<<16|e<<8|t)>>>0},hexToRGBArray:function(t){return[(t>>16&255)/255,(t>>8&255)/255,(255&t)/255]},RGBArrayToHex:function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},RGBtoHSL:function(t,e,i,s){s||(s=n.Color.createColor(t,e,i,1)),t/=255,e/=255,i/=255;var r=Math.min(t,e,i),o=Math.max(t,e,i);if(s.h=0,s.s=0,s.l=(o+r)/2,o!==r){var a=o-r;s.s=s.l>.5?a/(2-o-r):a/(o+r),o===t?s.h=(e-i)/a+(e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},createColor:function(t,e,i,s,r,o,a,h){var l={r:t||0,g:e||0,b:i||0,a:s||1,h:r||0,s:o||0,l:a||0,v:h||0,color:0,color32:0,rgba:""};return n.Color.updateColor(l)},updateColor:function(t){return t.rgba="rgba("+t.r.toFixed()+","+t.g.toFixed()+","+t.b.toFixed()+","+t.a.toString()+")",t.color=n.Color.getColor(t.r,t.g,t.b),t.color32=n.Color.getColor32(255*t.a,t.r,t.g,t.b),t},getColor32:function(t,e,i,n){return t<<24|e<<16|i<<8|n},getColor:function(t,e,i){return t<<16|e<<8|i},RGBtoString:function(t,e,i,s,r){return void 0===s&&(s=255),void 0===r&&(r="#"),"#"===r?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+n.Color.componentToHex(s)+n.Color.componentToHex(t)+n.Color.componentToHex(e)+n.Color.componentToHex(i)},hexToRGB:function(t){var e=n.Color.hexToColor(t);if(e)return n.Color.getColor32(e.a,e.r,e.g,e.b)},hexToColor:function(t,e){t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,n){return e+e+i+i+n+n}));var i=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(i){var s=parseInt(i[1],16),r=parseInt(i[2],16),o=parseInt(i[3],16);e?(e.r=s,e.g=r,e.b=o):e=n.Color.createColor(s,r,o)}return e},webToColor:function(t,e){e||(e=n.Color.createColor());var i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t);return i&&(e.r=~~Number(i[1]),e.g=~~Number(i[2]),e.b=~~Number(i[3]),e.a=void 0!==i[4]?Number(i[4]):1,n.Color.updateColor(e)),e},valueToColor:function(t,e){if(e||(e=n.Color.createColor()),"string"==typeof t)return 0===t.indexOf("rgb")?n.Color.webToColor(t,e):(e.a=1,n.Color.hexToColor(t,e));if("number"==typeof t){var i=n.Color.getRGB(t);return e.r=i.r,e.g=i.g,e.b=i.b,e.a=i.a/255,e}return e},componentToHex:function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},HSVColorWheel:function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],s=0;s<=359;s++)i.push(n.Color.HSVtoRGB(s/359,t,e));return i},HSLColorWheel:function(t,e){void 0===t&&(t=.5),void 0===e&&(e=.5);for(var i=[],s=0;s<=359;s++)i.push(n.Color.HSLtoRGB(s/359,t,e));return i},interpolateColor:function(t,e,i,s,r,o){void 0===r&&(r=255),void 0===o&&(o=0);var a=n.Color.getRGB(t),h=n.Color.getRGB(e);if(0===o)var l=(h.red-a.red)*s/i+a.red,c=(h.green-a.green)*s/i+a.green,u=(h.blue-a.blue)*s/i+a.blue;if(1===o){var d,p=n.Color.RGBtoHSV(a.r,a.g,a.b),f=n.Color.RGBtoHSV(h.r,h.g,h.b),g=f.h-p.h;if(p.h>f.h){var m=f.h;f.h=p.h,p.h=m,g=-g,s=i-s}g>.5&&(p.h=p.h+1,d=((f.h-p.h)*s/i+p.h)%1),g<=.5&&(d=(f.h-p.h)*s/i+p.h);var y=(f.s-p.s)*s/i+p.s,v=(f.v-p.v)*s/i+p.v,b=n.Color.HSVtoRGB(d,y,v,b);l=b.r,c=b.g,u=b.b}return n.Color.getColor32(r,l,c,u)},interpolateColorWithRGB:function(t,e,i,s,r,o){var a=n.Color.getRGB(t),h=(e-a.red)*o/r+a.red,l=(i-a.green)*o/r+a.green,c=(s-a.blue)*o/r+a.blue;return n.Color.getColor(h,l,c)},interpolateRGB:function(t,e,i,s,r,o,a,h){var l=(s-t)*h/a+t,c=(r-e)*h/a+e,u=(o-i)*h/a+i;return n.Color.getColor(l,c,u)},linear:function(t,e,i){return this.interpolateColor(t,e,1,i)},linearInterpolation:function(t,e){var i=n.Math.linear(0,t.length-1,e),s=t[Math.floor(i)],r=t[Math.ceil(i)];return this.linear(s,r,i%1)},getRandomColor:function(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=255),void 0===i&&(i=255),e>255||t>e)return n.Color.getColor(255,255,255);var s=t+Math.round(Math.random()*(e-t)),r=t+Math.round(Math.random()*(e-t)),o=t+Math.round(Math.random()*(e-t));return n.Color.getColor32(i,s,r,o)},getRGB:function(t){return t>16777215?{alpha:t>>>24,red:t>>16&255,green:t>>8&255,blue:255&t,a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{alpha:255,red:t>>16&255,green:t>>8&255,blue:255&t,a:255,r:t>>16&255,g:t>>8&255,b:255&t}},getWebRGB:function(t){if("object"==typeof t)return"rgba("+t.r.toString()+","+t.g.toString()+","+t.b.toString()+","+(t.a/255).toString()+")";var e=n.Color.getRGB(t);return"rgba("+e.r.toString()+","+e.g.toString()+","+e.b.toString()+","+(e.a/255).toString()+")"},getAlpha:function(t){return t>>>24},getAlphaFloat:function(t){return(t>>>24)/255},getRed:function(t){return t>>16&255},getGreen:function(t){return t>>8&255},getBlue:function(t){return 255&t},blendNormal:function(t){return t},blendLighten:function(t,e){return e>t?e:t},blendDarken:function(t,e){return e>t?t:e},blendMultiply:function(t,e){return t*e/255},blendAverage:function(t,e){return(t+e)/2},blendAdd:function(t,e){return Math.min(255,t+e)},blendSubtract:function(t,e){return Math.max(0,t+e-255)},blendDifference:function(t,e){return Math.abs(t-e)},blendNegation:function(t,e){return 255-Math.abs(255-t-e)},blendScreen:function(t,e){return 255-((255-t)*(255-e)>>8)},blendExclusion:function(t,e){return t+e-2*t*e/255},blendOverlay:function(t,e){return e<128?2*t*e/255:255-2*(255-t)*(255-e)/255},blendSoftLight:function(t,e){return e<128?2*(64+(t>>1))*(e/255):255-2*(255-(64+(t>>1)))*(255-e)/255},blendHardLight:function(t,e){return n.Color.blendOverlay(e,t)},blendColorDodge:function(t,e){return 255===e?e:Math.min(255,(t<<8)/(255-e))},blendColorBurn:function(t,e){return 0===e?e:Math.max(0,255-(255-t<<8)/e)},blendLinearDodge:function(t,e){return n.Color.blendAdd(t,e)},blendLinearBurn:function(t,e){return n.Color.blendSubtract(t,e)},blendLinearLight:function(t,e){return e<128?n.Color.blendLinearBurn(t,2*e):n.Color.blendLinearDodge(t,2*(e-128))},blendVividLight:function(t,e){return e<128?n.Color.blendColorBurn(t,2*e):n.Color.blendColorDodge(t,2*(e-128))},blendPinLight:function(t,e){return e<128?n.Color.blendDarken(t,2*e):n.Color.blendLighten(t,2*(e-128))},blendHardMix:function(t,e){return n.Color.blendVividLight(t,e)<128?0:255},blendReflect:function(t,e){return 255===e?e:Math.min(255,t*t/(255-e))},blendGlow:function(t,e){return n.Color.blendReflect(e,t)},blendPhoenix:function(t,e){return Math.min(t,e)-Math.max(t,e)+255}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics=function(t,e){e=e||{},this.game=t,this.config=e,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.matter=null,this.parseConfig()},s.Physics.ARCADE=0,s.Physics.P2JS=1,s.Physics.NINJA=2,s.Physics.BOX2D=3,s.Physics.CHIPMUNK=4,s.Physics.MATTERJS=5,s.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&!0!==this.config.arcade||!s.Physics.hasOwnProperty("Arcade")||(this.arcade=new s.Physics.Arcade(this.game)),this.config.hasOwnProperty("ninja")&&!0===this.config.ninja&&s.Physics.hasOwnProperty("Ninja")&&(this.ninja=new s.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&!0===this.config.p2&&s.Physics.hasOwnProperty("P2")&&(this.p2=new s.Physics.P2(this.game,this.config)),this.config.hasOwnProperty("box2d")&&!0===this.config.box2d&&s.Physics.hasOwnProperty("BOX2D")&&(this.box2d=new s.Physics.Box2D(this.game,this.config)),this.config.hasOwnProperty("matter")&&!0===this.config.matter&&s.Physics.hasOwnProperty("Matter")&&(this.matter=new s.Physics.Matter(this.game,this.config))},startSystem:function(t){t===s.Physics.ARCADE?this.arcade=new s.Physics.Arcade(this.game):t===s.Physics.P2JS?null===this.p2?this.p2=new s.Physics.P2(this.game,this.config):this.p2.reset():t===s.Physics.NINJA?this.ninja=new s.Physics.Ninja(this.game):t===s.Physics.BOX2D?null===this.box2d?this.box2d=new s.Physics.Box2D(this.game,this.config):this.box2d.reset():t===s.Physics.MATTERJS&&(null===this.matter?this.matter=new s.Physics.Matter(this.game,this.config):this.matter.reset())},enable:function(t,e,i){void 0===e&&(e=s.Physics.ARCADE),void 0===i&&(i=!1),e===s.Physics.ARCADE?this.arcade.enable(t):e===s.Physics.P2JS&&this.p2?this.p2.enable(t,i):e===s.Physics.NINJA&&this.ninja?this.ninja.enableAABB(t):e===s.Physics.BOX2D&&this.box2d?this.box2d.enable(t):e===s.Physics.MATTERJS&&this.matter?this.matter.enable(t):console.warn(t.key+" is attempting to enable a physics body using an unknown physics system.")},preUpdate:function(){this.p2&&this.p2.preUpdate(),this.box2d&&this.box2d.preUpdate(),this.matter&&this.matter.preUpdate()},update:function(){this.p2&&this.p2.update(),this.box2d&&this.box2d.update(),this.matter&&this.matter.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld(),this.box2d&&this.box2d.setBoundsToWorld(),this.matter&&this.matter.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear(),this.box2d&&this.box2d.clear(),this.matter&&this.matter.clear()},reset:function(){this.p2&&this.p2.reset(),this.box2d&&this.box2d.reset(),this.matter&&this.matter.reset()},destroy:function(){this.p2&&this.p2.destroy(),this.box2d&&this.box2d.destroy(),this.matter&&this.matter.destroy(),this.arcade=null,this.ninja=null,this.p2=null,this.box2d=null,this.matter=null}},s.Physics.prototype.constructor=s.Physics, +n.Physics=function(t,e){e=e||{},this.game=t,this.config=e,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.matter=null,this.parseConfig()},n.Physics.ARCADE=0,n.Physics.P2JS=1,n.Physics.NINJA=2,n.Physics.BOX2D=3,n.Physics.CHIPMUNK=4,n.Physics.MATTERJS=5,n.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&!0!==this.config.arcade||!n.Physics.hasOwnProperty("Arcade")||(this.arcade=new n.Physics.Arcade(this.game)),this.config.hasOwnProperty("ninja")&&!0===this.config.ninja&&n.Physics.hasOwnProperty("Ninja")&&(this.ninja=new n.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&!0===this.config.p2&&n.Physics.hasOwnProperty("P2")&&(this.p2=new n.Physics.P2(this.game,this.config)),this.config.hasOwnProperty("box2d")&&!0===this.config.box2d&&n.Physics.hasOwnProperty("BOX2D")&&(this.box2d=new n.Physics.Box2D(this.game,this.config)),this.config.hasOwnProperty("matter")&&!0===this.config.matter&&n.Physics.hasOwnProperty("Matter")&&(this.matter=new n.Physics.Matter(this.game,this.config))},startSystem:function(t){t===n.Physics.ARCADE?this.arcade=new n.Physics.Arcade(this.game):t===n.Physics.P2JS?null===this.p2?this.p2=new n.Physics.P2(this.game,this.config):this.p2.reset():t===n.Physics.NINJA?this.ninja=new n.Physics.Ninja(this.game):t===n.Physics.BOX2D?null===this.box2d?this.box2d=new n.Physics.Box2D(this.game,this.config):this.box2d.reset():t===n.Physics.MATTERJS&&(null===this.matter?this.matter=new n.Physics.Matter(this.game,this.config):this.matter.reset())},enable:function(t,e,i){void 0===e&&(e=n.Physics.ARCADE),void 0===i&&(i=!1),e===n.Physics.ARCADE?this.arcade.enable(t):e===n.Physics.P2JS&&this.p2?this.p2.enable(t,i):e===n.Physics.NINJA&&this.ninja?this.ninja.enableAABB(t):e===n.Physics.BOX2D&&this.box2d?this.box2d.enable(t):e===n.Physics.MATTERJS&&this.matter?this.matter.enable(t):console.warn(t.key+" is attempting to enable a physics body using an unknown physics system.")},preUpdate:function(){this.p2&&this.p2.preUpdate(),this.box2d&&this.box2d.preUpdate(),this.matter&&this.matter.preUpdate()},update:function(){this.p2&&this.p2.update(),this.box2d&&this.box2d.update(),this.matter&&this.matter.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld(),this.box2d&&this.box2d.setBoundsToWorld(),this.matter&&this.matter.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear(),this.box2d&&this.box2d.clear(),this.matter&&this.matter.clear()},reset:function(){this.p2&&this.p2.reset(),this.box2d&&this.box2d.reset(),this.matter&&this.matter.reset()},destroy:function(){this.p2&&this.p2.destroy(),this.box2d&&this.box2d.destroy(),this.matter&&this.matter.destroy(),this.arcade=null,this.ninja=null,this.p2=null,this.box2d=null,this.matter=null}},n.Physics.prototype.constructor=n.Physics, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.Arcade=function(t){this.game=t,this.gravity=new s.Point,this.bounds=new s.Rectangle(0,0,t.world.width,t.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.forceX=!1,this.sortDirection=s.Physics.Arcade.LEFT_RIGHT,this.skipQuadTree=!0,this.isPaused=!1,this.quadTree=new s.QuadTree(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this._total=0,this.setBoundsToWorld()},s.Physics.Arcade.prototype.constructor=s.Physics.Arcade,s.Physics.Arcade.SORT_NONE=0,s.Physics.Arcade.LEFT_RIGHT=1,s.Physics.Arcade.RIGHT_LEFT=2,s.Physics.Arcade.TOP_BOTTOM=3,s.Physics.Arcade.BOTTOM_TOP=4,s.Physics.Arcade.prototype={setBounds:function(t,e,i,n){this.bounds.setTo(t,e,i,n)},setBoundsToWorld:function(){this.bounds.copyFrom(this.game.world.bounds)},enable:function(t,e){void 0===e&&(e=!0);var i=1;if(Array.isArray(t))for(i=t.length;i--;)t[i]instanceof s.Group?this.enable(t[i].children,e):(this.enableBody(t[i]),e&&t[i].hasOwnProperty("children")&&t[i].children.length>0&&this.enable(t[i],!0));else t instanceof s.Group?this.enable(t.children,e):(this.enableBody(t),e&&t.hasOwnProperty("children")&&t.children.length>0&&this.enable(t.children,!0))},enableBody:function(t){t.hasOwnProperty("body")&&null===t.body&&(t.body=new s.Physics.Arcade.Body(t),t.parent&&t.parent instanceof s.Group&&t.parent.addToHash(t))},updateMotion:function(t){if(t.allowRotation){var e=this.computeVelocity(0,t,t.angularVelocity,t.angularAcceleration,t.angularDrag,t.maxAngular)-t.angularVelocity;t.angularVelocity+=e,t.rotation+=t.angularVelocity*this.game.time.physicsElapsed}t.velocity.x=this.computeVelocity(1,t,t.velocity.x,t.acceleration.x,t.drag.x,t.maxVelocity.x),t.velocity.y=this.computeVelocity(2,t,t.velocity.y,t.acceleration.y,t.drag.y,t.maxVelocity.y)},computeVelocity:function(t,e,i,n,s,r){return void 0===r&&(r=1e4),1===t&&e.allowGravity?i+=(this.gravity.x+e.gravity.x)*this.game.time.physicsElapsed:2===t&&e.allowGravity&&(i+=(this.gravity.y+e.gravity.y)*this.game.time.physicsElapsed),n?i+=n*this.game.time.physicsElapsed:s&&e.allowDrag&&(i-(s*=this.game.time.physicsElapsed)>0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},overlap:function(t,e,i,n,s){return i=i||null,n=n||null,s=s||i,this._total=0,this.collideObjects(t,e,i,n,s,!0),this._total>0},collide:function(t,e,i,n,s){return i=i||null,n=n||null,s=s||i,this._total=0,this.collideObjects(t,e,i,n,s,!1),this._total>0},sortLeftRight:function(t,e){return t.body&&e.body?t.body.x-e.body.x:0},sortRightLeft:function(t,e){return t.body&&e.body?e.body.x-t.body.x:0},sortTopBottom:function(t,e){return t.body&&e.body?t.body.y-e.body.y:0},sortBottomTop:function(t,e){return t.body&&e.body?e.body.y-t.body.y:0},sort:function(t,e){null!==t.physicsSortDirection?e=t.physicsSortDirection:void 0===e&&(e=this.sortDirection),e===s.Physics.Arcade.LEFT_RIGHT?t.hash.sort(this.sortLeftRight):e===s.Physics.Arcade.RIGHT_LEFT?t.hash.sort(this.sortRightLeft):e===s.Physics.Arcade.TOP_BOTTOM?t.hash.sort(this.sortTopBottom):e===s.Physics.Arcade.BOTTOM_TOP&&t.hash.sort(this.sortBottomTop)},collideObjects:function(t,e,i,n,s,r){if(!Array.isArray(t)&&Array.isArray(e))for(var o=0;oa.right)break;if(a.x>t.body.right)continue}else if(this.sortDirection===s.Physics.Arcade.TOP_BOTTOM){if(t.body.bottoma.bottom)break;if(a.y>t.body.bottom)continue}this.collideSpriteVsSprite(t,l,i,n,r,o)}}else{this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(e);var u=this.quadTree.retrieve(t);for(h=0;hu.right)continue;if(u.x>a.right)break}else if(this.sortDirection===s.Physics.Arcade.TOP_BOTTOM){if(a.bottomu.bottom)continue;if(u.y>h.body.bottom)break}this.collideSpriteVsSprite(h,c,e,i,n,r)}}}}},collideGroupVsGroup:function(t,e,i,n,r,o){if(0!==t.length&&0!==e.length)for(var a=0;aa.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var l=!1,u=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=s.Math.clamp(t.center.x,e.left,e.right),n=s.Math.clamp(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-n)*(t.center.y-n)<=t.halfWidth*t.halfWidth},separateCircle:function(t,e,i){this.getOverlapX(t,e),this.getOverlapY(t,e);var n=e.center.x-t.center.x,r=e.center.y-t.center.y,o=Math.atan2(r,n),a=0;if(t.isCircle!==e.isCircle){var h={x:e.isCircle?t.position.x:e.position.x,y:e.isCircle?t.position.y:e.position.y,right:e.isCircle?t.right:e.right,bottom:e.isCircle?t.bottom:e.bottom},l={x:t.isCircle?t.center.x:e.center.x,y:t.isCircle?t.center.y:e.center.y,radius:t.isCircle?t.halfWidth:e.halfWidth};l.yh.right&&(a=s.Math.distance(l.x,l.y,h.right,h.y)-l.radius):l.y>h.bottom&&(l.xh.right&&(a=s.Math.distance(l.x,l.y,h.right,h.bottom)-l.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-s.Math.distance(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap&&t.onOverlap.dispatch(t.sprite,e.sprite),e.onOverlap&&e.onOverlap.dispatch(e.sprite,t.sprite)),0!==a;var u=t.velocity.x*Math.cos(o)+t.velocity.y*Math.sin(o),c=-t.velocity.x*Math.sin(o)+t.velocity.y*Math.cos(o),d=e.velocity.x*Math.cos(o)+e.velocity.y*Math.sin(o),p=-e.velocity.x*Math.sin(o)+e.velocity.y*Math.cos(o),f=((t.mass-e.mass)*u+2*e.mass*d)/(t.mass+e.mass),g=(2*t.mass*u+(e.mass-t.mass)*d)/(t.mass+e.mass);return t.immovable||(t.velocity.x=(f*Math.cos(o)-c*Math.sin(o))*t.bounce.x,t.velocity.y=(c*Math.cos(o)+f*Math.sin(o))*t.bounce.y),e.immovable||(e.velocity.x=(g*Math.cos(o)-p*Math.sin(o))*e.bounce.x,e.velocity.y=(p*Math.cos(o)+g*Math.sin(o))*e.bounce.y),Math.abs(o)0&&!t.immovable&&e.velocity.x>t.velocity.x?t.velocity.x*=-1:e.velocity.x<0&&!e.immovable&&t.velocity.x0&&!t.immovable&&e.velocity.y>t.velocity.y?t.velocity.y*=-1:e.velocity.y<0&&!e.immovable&&t.velocity.yMath.PI/2&&(t.velocity.x<0&&!t.immovable&&e.velocity.x0&&!e.immovable&&t.velocity.x>e.velocity.x?e.velocity.x*=-1:t.velocity.y<0&&!t.immovable&&e.velocity.y0&&!e.immovable&&t.velocity.x>e.velocity.y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.game.time.physicsElapsed-a*Math.cos(o),t.y+=t.velocity.y*this.game.time.physicsElapsed-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.game.time.physicsElapsed+a*Math.cos(o),e.y+=e.velocity.y*this.game.time.physicsElapsed+a*Math.sin(o)),t.onCollide&&t.onCollide.dispatch(t.sprite,e.sprite),e.onCollide&&e.onCollide.dispatch(e.sprite,t.sprite),!0},getOverlapX:function(t,e,i){var n=0,s=t.deltaAbsX()+e.deltaAbsX()+this.OVERLAP_BIAS;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(n=t.right-e.x)>s&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?n=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()s&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?n=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=n,e.overlapX=n,n},getOverlapY:function(t,e,i){var n=0,s=t.deltaAbsY()+e.deltaAbsY()+this.OVERLAP_BIAS;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(n=t.bottom-e.y)>s&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?n=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()s&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?n=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=n,e.overlapY=n,n},separateX:function(t,e,i){var n=this.getOverlapX(t,e,i);if(i||0===n||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==n||t.embedded&&e.embedded;var s=t.velocity.x,r=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=n,e.velocity.x=s-r*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=n,t.velocity.x=r-s*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{n*=.5,t.x-=n,e.x+=n;var o=Math.sqrt(r*r*e.mass/t.mass)*(r>0?1:-1),a=Math.sqrt(s*s*t.mass/e.mass)*(s>0?1:-1),h=.5*(o+a);o-=h,a-=h,t.velocity.x=h+o*t.bounce.x,e.velocity.x=h+a*e.bounce.x}return!0},separateY:function(t,e,i){var n=this.getOverlapY(t,e,i);if(i||0===n||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==n||t.embedded&&e.embedded;var s=t.velocity.y,r=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=n,e.velocity.y=s-r*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=n,t.velocity.y=r-s*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{n*=.5,t.y-=n,e.y+=n;var o=Math.sqrt(r*r*e.mass/t.mass)*(r>0?1:-1),a=Math.sqrt(s*s*t.mass/e.mass)*(s>0?1:-1),h=.5*(o+a);o-=h,a-=h,t.velocity.y=h+o*t.bounce.y,e.velocity.y=h+a*e.bounce.y}return!0},getObjectsUnderPointer:function(t,e,i,n){if(0!==e.length&&t.exists)return this.getObjectsAtLocation(t.x,t.y,e,i,n,t)},getObjectsAtLocation:function(t,e,i,n,r,o){this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(i);for(var a=new s.Rectangle(t,e,1,1),h=[],l=this.quadTree.retrieve(a),u=0;u0&&(i=this.distanceBetween(t,e)/(n/1e3)),t.body.velocity.setToPolar(r,i),r},moveToPointer:function(t,e,i,n){void 0===e&&(e=60),i=i||this.game.input.activePointer,void 0===n&&(n=0);var s=this.angleToPointer(t,i);return n>0&&(e=this.distanceToPointer(t,i)/(n/1e3)),t.body.velocity.setToPolar(s,e),s},moveToXY:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=this.distanceToXY(t,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),(i=i||new s.Point).setToPolar(t,e,!0)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),(i=i||new s.Point).setToPolar(t,e)},accelerationFromRotation:function(t,e,i){return void 0===e&&(e=60),(i=i||new s.Point).setToPolar(t,e)},accelerateToObject:function(t,e,i,n,s){void 0===i&&(i=60),void 0===n&&(n=1e3),void 0===s&&(s=1e3);var r=this.angleBetween(t,e);return t.body.acceleration.setToPolar(r,i),t.body.maxVelocity.setTo(n,s),r},accelerateToPointer:function(t,e,i,n,s){void 0===i&&(i=60),void 0===e&&(e=this.game.input.activePointer),void 0===n&&(n=1e3),void 0===s&&(s=1e3);var r=this.angleToPointer(t,e);return t.body.acceleration.setToPolar(r,i),t.body.maxVelocity.setTo(n,s),r},accelerateToXY:function(t,e,i,n,s,r){void 0===n&&(n=60),void 0===s&&(s=1e3),void 0===r&&(r=1e3);var o=this.angleToXY(t,e,i);return t.body.acceleration.setTo(o,n),t.body.maxVelocity.setTo(s,r),o},distanceBetween:function(t,e,i,n){var s,r;return void 0===i&&(i=!1),n?(s=t.centerX-e.centerX,r=t.centerY-e.centerY):i?(s=t.world.x-e.world.x,r=t.world.y-e.world.y):(s=t.x-e.x,r=t.y-e.y),Math.sqrt(s*s+r*r)},distanceToXY:function(t,e,i,n){void 0===n&&(n=!1);var s=n?t.world.x-e:t.x-e,r=n?t.world.y-i:t.y-i;return Math.sqrt(s*s+r*r)},distanceToPointer:function(t,e,i){void 0===e&&(e=this.game.input.activePointer),void 0===i&&(i=!1);var n=i?t.world.x-e.worldX:t.x-e.worldX,s=i?t.world.y-e.worldY:t.y-e.worldY;return Math.sqrt(n*n+s*s)},closest:function(t,e,i,n){for(var s=1/0,r=null,o=0,a=e.length;os&&(r=h,s=l)}return r},angleBetween:function(t,e,i){return void 0===i&&(i=!1),i?s.Point.angle(e.world,t.world):s.Point.angle(e,t)},angleBetweenCenters:function(t,e){var i=e.centerX-t.centerX,n=e.centerY-t.centerY;return Math.atan2(n,i)},angleToXY:function(t,e,i,n){return void 0===n&&(n=!1),n?Math.atan2(i-t.world.y,e-t.world.x):Math.atan2(i-t.y,e-t.x)},angleToPointer:function(t,e,i){return void 0===e&&(e=this.game.input.activePointer),void 0===i&&(i=!1),i?Math.atan2(e.worldY-t.world.y,e.worldX-t.world.x):Math.atan2(e.worldY-t.y,e.worldX-t.x)},worldAngleToPointer:function(t,e){return this.angleToPointer(t,e,!0)}}, +n.Physics.Arcade=function(t){this.game=t,this.gravity=new n.Point,this.bounds=new n.Rectangle(0,0,t.world.width,t.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.forceX=!1,this.sortDirection=n.Physics.Arcade.LEFT_RIGHT,this.skipQuadTree=!0,this.isPaused=!1,this.quadTree=new n.QuadTree(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this._total=0,this.setBoundsToWorld()},n.Physics.Arcade.prototype.constructor=n.Physics.Arcade,n.Physics.Arcade.SORT_NONE=0,n.Physics.Arcade.LEFT_RIGHT=1,n.Physics.Arcade.RIGHT_LEFT=2,n.Physics.Arcade.TOP_BOTTOM=3,n.Physics.Arcade.BOTTOM_TOP=4,n.Physics.Arcade.prototype={setBounds:function(t,e,i,n){this.bounds.setTo(t,e,i,n)},setBoundsToWorld:function(){this.bounds.copyFrom(this.game.world.bounds)},enable:function(t,e){void 0===e&&(e=!0);var i=1;if(Array.isArray(t))for(i=t.length;i--;)t[i]instanceof n.Group?this.enable(t[i].children,e):(this.enableBody(t[i]),e&&t[i].hasOwnProperty("children")&&t[i].children.length>0&&this.enable(t[i],!0));else t instanceof n.Group?this.enable(t.children,e):(this.enableBody(t),e&&t.hasOwnProperty("children")&&t.children.length>0&&this.enable(t.children,!0))},enableBody:function(t){t.hasOwnProperty("body")&&null===t.body&&(t.body=new n.Physics.Arcade.Body(t),t.parent&&t.parent instanceof n.Group&&t.parent.addToHash(t))},updateMotion:function(t){if(t.allowRotation){var e=this.computeVelocity(0,t,t.angularVelocity,t.angularAcceleration,t.angularDrag,t.maxAngular)-t.angularVelocity;t.angularVelocity+=e,t.rotation+=t.angularVelocity*this.game.time.physicsElapsed}t.velocity.x=this.computeVelocity(1,t,t.velocity.x,t.acceleration.x,t.drag.x,t.maxVelocity.x),t.velocity.y=this.computeVelocity(2,t,t.velocity.y,t.acceleration.y,t.drag.y,t.maxVelocity.y)},computeVelocity:function(t,e,i,n,s,r){return void 0===r&&(r=1e4),1===t&&e.allowGravity?i+=(this.gravity.x+e.gravity.x)*this.game.time.physicsElapsed:2===t&&e.allowGravity&&(i+=(this.gravity.y+e.gravity.y)*this.game.time.physicsElapsed),n?i+=n*this.game.time.physicsElapsed:s&&e.allowDrag&&(i-(s*=this.game.time.physicsElapsed)>0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},overlap:function(t,e,i,n,s){return i=i||null,n=n||null,s=s||i,this._total=0,this.collideObjects(t,e,i,n,s,!0),this._total>0},collide:function(t,e,i,n,s){return i=i||null,n=n||null,s=s||i,this._total=0,this.collideObjects(t,e,i,n,s,!1),this._total>0},sortLeftRight:function(t,e){return t.body&&e.body?t.body.x-e.body.x:0},sortRightLeft:function(t,e){return t.body&&e.body?e.body.x-t.body.x:0},sortTopBottom:function(t,e){return t.body&&e.body?t.body.y-e.body.y:0},sortBottomTop:function(t,e){return t.body&&e.body?e.body.y-t.body.y:0},sort:function(t,e){null!==t.physicsSortDirection?e=t.physicsSortDirection:void 0===e&&(e=this.sortDirection),e===n.Physics.Arcade.LEFT_RIGHT?t.hash.sort(this.sortLeftRight):e===n.Physics.Arcade.RIGHT_LEFT?t.hash.sort(this.sortRightLeft):e===n.Physics.Arcade.TOP_BOTTOM?t.hash.sort(this.sortTopBottom):e===n.Physics.Arcade.BOTTOM_TOP&&t.hash.sort(this.sortBottomTop)},collideObjects:function(t,e,i,n,s,r){if(!Array.isArray(t)&&Array.isArray(e))for(var o=0;oa.right)break;if(a.x>t.body.right)continue}else if(this.sortDirection===n.Physics.Arcade.TOP_BOTTOM){if(t.body.bottoma.bottom)break;if(a.y>t.body.bottom)continue}this.collideSpriteVsSprite(t,l,i,s,r,o)}}else{this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(e);var c=this.quadTree.retrieve(t);for(h=0;hc.right)continue;if(c.x>a.right)break}else if(this.sortDirection===n.Physics.Arcade.TOP_BOTTOM){if(a.bottomc.bottom)continue;if(c.y>h.body.bottom)break}this.collideSpriteVsSprite(h,u,e,i,s,r)}}}}},collideGroupVsGroup:function(t,e,i,s,r,o){if(0!==t.length&&0!==e.length)for(var a=0;aa.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var l=!1,c=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=n.Math.clamp(t.center.x,e.left,e.right),s=n.Math.clamp(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-s)*(t.center.y-s)<=t.halfWidth*t.halfWidth},separateCircle:function(t,e,i){this.getOverlapX(t,e),this.getOverlapY(t,e);var s=e.center.x-t.center.x,r=e.center.y-t.center.y,o=Math.atan2(r,s),a=0;if(t.isCircle!==e.isCircle){var h={x:e.isCircle?t.position.x:e.position.x,y:e.isCircle?t.position.y:e.position.y,right:e.isCircle?t.right:e.right,bottom:e.isCircle?t.bottom:e.bottom},l={x:t.isCircle?t.center.x:e.center.x,y:t.isCircle?t.center.y:e.center.y,radius:t.isCircle?t.halfWidth:e.halfWidth};l.yh.right&&(a=n.Math.distance(l.x,l.y,h.right,h.y)-l.radius):l.y>h.bottom&&(l.xh.right&&(a=n.Math.distance(l.x,l.y,h.right,h.bottom)-l.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-n.Math.distance(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap&&t.onOverlap.dispatch(t.sprite,e.sprite),e.onOverlap&&e.onOverlap.dispatch(e.sprite,t.sprite)),0!==a;var c=t.velocity.x*Math.cos(o)+t.velocity.y*Math.sin(o),u=-t.velocity.x*Math.sin(o)+t.velocity.y*Math.cos(o),d=e.velocity.x*Math.cos(o)+e.velocity.y*Math.sin(o),p=-e.velocity.x*Math.sin(o)+e.velocity.y*Math.cos(o),f=((t.mass-e.mass)*c+2*e.mass*d)/(t.mass+e.mass),g=(2*t.mass*c+(e.mass-t.mass)*d)/(t.mass+e.mass);return t.immovable||(t.velocity.x=(f*Math.cos(o)-u*Math.sin(o))*t.bounce.x,t.velocity.y=(u*Math.cos(o)+f*Math.sin(o))*t.bounce.y),e.immovable||(e.velocity.x=(g*Math.cos(o)-p*Math.sin(o))*e.bounce.x,e.velocity.y=(p*Math.cos(o)+g*Math.sin(o))*e.bounce.y),Math.abs(o)0&&!t.immovable&&e.velocity.x>t.velocity.x?t.velocity.x*=-1:e.velocity.x<0&&!e.immovable&&t.velocity.x0&&!t.immovable&&e.velocity.y>t.velocity.y?t.velocity.y*=-1:e.velocity.y<0&&!e.immovable&&t.velocity.yMath.PI/2&&(t.velocity.x<0&&!t.immovable&&e.velocity.x0&&!e.immovable&&t.velocity.x>e.velocity.x?e.velocity.x*=-1:t.velocity.y<0&&!t.immovable&&e.velocity.y0&&!e.immovable&&t.velocity.x>e.velocity.y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.game.time.physicsElapsed-a*Math.cos(o),t.y+=t.velocity.y*this.game.time.physicsElapsed-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.game.time.physicsElapsed+a*Math.cos(o),e.y+=e.velocity.y*this.game.time.physicsElapsed+a*Math.sin(o)),t.onCollide&&t.onCollide.dispatch(t.sprite,e.sprite),e.onCollide&&e.onCollide.dispatch(e.sprite,t.sprite),!0},getOverlapX:function(t,e,i){var n=0,s=t.deltaAbsX()+e.deltaAbsX()+this.OVERLAP_BIAS;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(n=t.right-e.x)>s&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?n=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()s&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?n=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=n,e.overlapX=n,n},getOverlapY:function(t,e,i){var n=0,s=t.deltaAbsY()+e.deltaAbsY()+this.OVERLAP_BIAS;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(n=t.bottom-e.y)>s&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?n=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()s&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?n=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=n,e.overlapY=n,n},separateX:function(t,e,i){var n=this.getOverlapX(t,e,i);if(i||0===n||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==n||t.embedded&&e.embedded;var s=t.velocity.x,r=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=n,e.velocity.x=s-r*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=n,t.velocity.x=r-s*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{n*=.5,t.x-=n,e.x+=n;var o=Math.sqrt(r*r*e.mass/t.mass)*(r>0?1:-1),a=Math.sqrt(s*s*t.mass/e.mass)*(s>0?1:-1),h=.5*(o+a);o-=h,a-=h,t.velocity.x=h+o*t.bounce.x,e.velocity.x=h+a*e.bounce.x}return!0},separateY:function(t,e,i){var n=this.getOverlapY(t,e,i);if(i||0===n||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==n||t.embedded&&e.embedded;var s=t.velocity.y,r=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=n,e.velocity.y=s-r*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=n,t.velocity.y=r-s*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{n*=.5,t.y-=n,e.y+=n;var o=Math.sqrt(r*r*e.mass/t.mass)*(r>0?1:-1),a=Math.sqrt(s*s*t.mass/e.mass)*(s>0?1:-1),h=.5*(o+a);o-=h,a-=h,t.velocity.y=h+o*t.bounce.y,e.velocity.y=h+a*e.bounce.y}return!0},getObjectsUnderPointer:function(t,e,i,n){if(0!==e.length&&t.exists)return this.getObjectsAtLocation(t.x,t.y,e,i,n,t)},getObjectsAtLocation:function(t,e,i,s,r,o){this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(i);for(var a=new n.Rectangle(t,e,1,1),h=[],l=this.quadTree.retrieve(a),c=0;c0&&(i=this.distanceBetween(t,e)/(s/1e3)),t.body.velocity.setToPolar(r,i),r},moveToPointer:function(t,e,i,n){void 0===e&&(e=60),i=i||this.game.input.activePointer,void 0===n&&(n=0);var s=this.angleToPointer(t,i);return n>0&&(e=this.distanceToPointer(t,i)/(n/1e3)),t.body.velocity.setToPolar(s,e),s},moveToXY:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=this.distanceToXY(t,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),(i=i||new n.Point).setToPolar(t,e,!0)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),(i=i||new n.Point).setToPolar(t,e)},accelerationFromRotation:function(t,e,i){return void 0===e&&(e=60),(i=i||new n.Point).setToPolar(t,e)},accelerateToObject:function(t,e,i,n,s){void 0===i&&(i=60),void 0===n&&(n=1e3),void 0===s&&(s=1e3);var r=this.angleBetween(t,e);return t.body.acceleration.setToPolar(r,i),t.body.maxVelocity.setTo(n,s),r},accelerateToPointer:function(t,e,i,n,s){void 0===i&&(i=60),void 0===e&&(e=this.game.input.activePointer),void 0===n&&(n=1e3),void 0===s&&(s=1e3);var r=this.angleToPointer(t,e);return t.body.acceleration.setToPolar(r,i),t.body.maxVelocity.setTo(n,s),r},accelerateToXY:function(t,e,i,n,s,r){void 0===n&&(n=60),void 0===s&&(s=1e3),void 0===r&&(r=1e3);var o=this.angleToXY(t,e,i);return t.body.acceleration.setTo(o,n),t.body.maxVelocity.setTo(s,r),o},distanceBetween:function(t,e,i,n){var s,r;return void 0===i&&(i=!1),n?(s=t.centerX-e.centerX,r=t.centerY-e.centerY):i?(s=t.world.x-e.world.x,r=t.world.y-e.world.y):(s=t.x-e.x,r=t.y-e.y),Math.sqrt(s*s+r*r)},distanceToXY:function(t,e,i,n){void 0===n&&(n=!1);var s=n?t.world.x-e:t.x-e,r=n?t.world.y-i:t.y-i;return Math.sqrt(s*s+r*r)},distanceToPointer:function(t,e,i){void 0===e&&(e=this.game.input.activePointer),void 0===i&&(i=!1);var n=i?t.world.x-e.worldX:t.x-e.worldX,s=i?t.world.y-e.worldY:t.y-e.worldY;return Math.sqrt(n*n+s*s)},closest:function(t,e,i,n){for(var s=1/0,r=null,o=0,a=e.length;os&&(r=h,s=l)}return r},angleBetween:function(t,e,i){return void 0===i&&(i=!1),i?n.Point.angle(e.world,t.world):n.Point.angle(e,t)},angleBetweenCenters:function(t,e){var i=e.centerX-t.centerX,n=e.centerY-t.centerY;return Math.atan2(n,i)},angleToXY:function(t,e,i,n){return void 0===n&&(n=!1),n?Math.atan2(i-t.world.y,e-t.world.x):Math.atan2(i-t.y,e-t.x)},angleToPointer:function(t,e,i){return void 0===e&&(e=this.game.input.activePointer),void 0===i&&(i=!1),i?Math.atan2(e.worldY-t.world.y,e.worldX-t.world.x):Math.atan2(e.worldY-t.y,e.worldX-t.x)},worldAngleToPointer:function(t,e){return this.angleToPointer(t,e,!0)}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.Arcade.Body=function(t){this.sprite=t,this.game=t.game,this.type=s.Physics.ARCADE,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new s.Point,this.position=new s.Point(t.x,t.y),this.prev=new s.Point(this.position.x,this.position.y),this.allowRotation=!0,this.rotation=t.angle,this.preRotation=t.angle,this.width=t.width,this.height=t.height,this.sourceWidth=t.width,this.sourceHeight=t.height,t.texture&&(this.sourceWidth=t.texture.frame.width,this.sourceHeight=t.texture.frame.height),this.halfWidth=Math.abs(t.width/2),this.halfHeight=Math.abs(t.height/2),this.center=new s.Point(t.x+this.halfWidth,t.y+this.halfHeight),this.velocity=new s.Point,this.newVelocity=new s.Point,this.deltaMax=new s.Point,this.acceleration=new s.Point,this.allowDrag=!0,this.drag=new s.Point,this.allowGravity=!0,this.gravity=new s.Point,this.bounce=new s.Point,this.worldBounce=null,this.onWorldBounds=null,this.onCollide=null,this.onOverlap=null,this.maxVelocity=new s.Point(1e4,1e4),this.friction=new s.Point(1,0),this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=s.NONE,this.immovable=!1,this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.tilePadding=new s.Point,this.dirty=!1,this.skipQuadTree=!1,this.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.moveTimer=0,this.moveDistance=0,this.moveDuration=0,this.moveTarget=null,this.moveEnd=null,this.onMoveComplete=new s.Signal,this.movementCallback=null,this.movementCallbackContext=null,this._reset=!0,this._sx=t.scale.x,this._sy=t.scale.y,this._dx=0,this._dy=0},s.Physics.Arcade.Body.prototype={updateBounds:function(){if(this.syncBounds){var t=this.sprite.getBounds();t.ceilAll(),t.width===this.width&&t.height===this.height||(this.width=t.width,this.height=t.height,this._reset=!0)}else{var e=Math.abs(this.sprite.scale.x),i=Math.abs(this.sprite.scale.y);e===this._sx&&i===this._sy||(this.width=this.sourceWidth*e,this.height=this.sourceHeight*i,this._sx=e,this._sy=i,this._reset=!0)}this._reset&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},preUpdate:function(){this.enable&&!this.game.physics.arcade.isPaused&&(this.dirty=!0,this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds(),this.position.x=this.sprite.world.x-this.sprite.anchor.x*this.sprite.width+this.sprite.scale.x*this.offset.x,this.position.x-=this.sprite.scale.x<0?this.width:0,this.position.y=this.sprite.world.y-this.sprite.anchor.y*this.sprite.height+this.sprite.scale.y*this.offset.y,this.position.y-=this.sprite.scale.y<0?this.height:0,this.updateCenter(),this.rotation=this.sprite.angle,this.preRotation=this.rotation,(this._reset||this.sprite.fresh)&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves&&(this.game.physics.arcade.updateMotion(this),this.newVelocity.set(this.velocity.x*this.game.time.physicsElapsed,this.velocity.y*this.game.time.physicsElapsed),this.position.x+=this.newVelocity.x,this.position.y+=this.newVelocity.y,this.updateCenter(),this.position.x===this.prev.x&&this.position.y===this.prev.y||(this.angle=this.velocity.atan()),this.speed=Math.sqrt(this.velocity.x*this.velocity.x+this.velocity.y*this.velocity.y),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.onWorldBounds.dispatch(this.sprite,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)),this._dx=this.deltaX(),this._dy=this.deltaY(),this._reset=!1)},updateMovement:function(){var t=0,e=0!==this.overlapX||0!==this.overlapY;if(this.moveDuration>0?(this.moveTimer+=this.game.time.elapsedMS,t=this.moveTimer/this.moveDuration):(this.moveTarget.end.set(this.position.x,this.position.y),t=this.moveTarget.length/this.moveDistance),this.movementCallback)var i=this.movementCallback.call(this.movementCallbackContext,this,this.velocity,t);return!(e||t>=1||void 0!==i&&!0!==i)||(this.stopMovement(t>=1||this.stopVelocityOnCollide&&e),!1)},stopMovement:function(t){this.isMoving&&(this.isMoving=!1,t&&this.velocity.set(0),this.onMoveComplete.dispatch(this.sprite,0!==this.overlapX||0!==this.overlapY))},postUpdate:function(){this.enable&&this.dirty&&(this.isMoving&&this.updateMovement(),this.dirty=!1,this.deltaX()<0?this.facing=s.LEFT:this.deltaX()>0&&(this.facing=s.RIGHT),this.deltaY()<0?this.facing=s.UP:this.deltaY()>0&&(this.facing=s.DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.sprite.position.x+=this._dx,this.sprite.position.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.sprite.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.game.physics.arcade.bounds,i=this.game.physics.arcade.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},moveFrom:function(t,e,i){return void 0===e&&(e=this.speed),0!==e&&(void 0===i?(n=this.angle,i=this.game.math.radToDeg(n)):n=this.game.math.degToRad(i),this.moveTimer=0,this.moveDuration=t,0===i||180===i?this.velocity.set(Math.cos(n)*e,0):90===i||270===i?this.velocity.set(0,Math.sin(n)*e):this.velocity.setToPolar(n,e),this.isMoving=!0,!0);var n},moveTo:function(t,e,i){var n,r=e/(t/1e3);return 0!==r&&(void 0===i?(n=this.angle,i=this.game.math.radToDeg(n)):n=this.game.math.degToRad(i),e=Math.abs(e),this.moveDuration=0,this.moveDistance=e,null===this.moveTarget&&(this.moveTarget=new s.Line,this.moveEnd=new s.Point),this.moveTarget.fromAngle(this.x,this.y,n,e),this.moveEnd.set(this.moveTarget.end.x,this.moveTarget.end.y),this.moveTarget.setTo(this.x,this.y,this.x,this.y),0===i||180===i?this.velocity.set(Math.cos(n)*r,0):90===i||270===i?this.velocity.set(0,Math.sin(n)*r):this.velocity.setToPolar(n,r),this.isMoving=!0,!0)},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0},setCircle:function(t,e,i){void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(e,i),this.updateCenter()):this.isCircle=!1},reset:function(t,e){this.stop(),this.position.x=t-this.sprite.anchor.x*this.sprite.width+this.sprite.scale.x*this.offset.x,this.position.x-=this.sprite.scale.x<0?this.width:0,this.position.y=e-this.sprite.anchor.y*this.sprite.height+this.sprite.scale.y*this.offset.y,this.position.y-=this.sprite.scale.y<0?this.height:0,this.prev.x=this.position.x,this.prev.y=this.position.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,this.updateBounds(),this.updateCenter()},stop:function(){this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?s.Circle.contains(this,t,e):s.Rectangle.contains(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.sprite.parent&&this.sprite.parent instanceof s.Group&&this.sprite.parent.removeFromHash(this.sprite),this.sprite.body=null,this.sprite=null}},Object.defineProperty(s.Physics.Arcade.Body.prototype,"left",{get:function(){return this.position.x}}),Object.defineProperty(s.Physics.Arcade.Body.prototype,"right",{get:function(){return this.position.x+this.width}}),Object.defineProperty(s.Physics.Arcade.Body.prototype,"top",{get:function(){return this.position.y}}),Object.defineProperty(s.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.position.y+this.height}}),Object.defineProperty(s.Physics.Arcade.Body.prototype,"x",{get:function(){return this.position.x},set:function(t){this.position.x=t}}),Object.defineProperty(s.Physics.Arcade.Body.prototype,"y",{get:function(){return this.position.y},set:function(t){this.position.y=t}}),s.Physics.Arcade.Body.render=function(t,e,i,n,s){void 0===n&&(n=!0),i=i||"rgba(0,255,0,0.4)",t.fillStyle=i,t.strokeStyle=i,t.lineWidth=s||1,e.isCircle?(t.beginPath(),t.arc(e.center.x-e.game.camera.x,e.center.y-e.game.camera.y,e.halfWidth,0,2*Math.PI),n?t.fill():t.stroke()):n?t.fillRect(e.position.x-e.game.camera.x,e.position.y-e.game.camera.y,e.width,e.height):t.strokeRect(e.position.x-e.game.camera.x,e.position.y-e.game.camera.y,e.width,e.height)},s.Physics.Arcade.Body.renderBodyInfo=function(t,e){t.line("x: "+e.x.toFixed(2),"y: "+e.y.toFixed(2),"width: "+e.width,"height: "+e.height),t.line("velocity x: "+e.velocity.x.toFixed(2),"y: "+e.velocity.y.toFixed(2),"deltaX: "+e._dx.toFixed(2),"deltaY: "+e._dy.toFixed(2)),t.line("acceleration x: "+e.acceleration.x.toFixed(2),"y: "+e.acceleration.y.toFixed(2),"speed: "+e.speed.toFixed(2),"angle: "+e.angle.toFixed(2)),t.line("gravity x: "+e.gravity.x,"y: "+e.gravity.y,"bounce x: "+e.bounce.x.toFixed(2),"y: "+e.bounce.y.toFixed(2)),t.line("touching left: "+e.touching.left,"right: "+e.touching.right,"up: "+e.touching.up,"down: "+e.touching.down),t.line("blocked left: "+e.blocked.left,"right: "+e.blocked.right,"up: "+e.blocked.up,"down: "+e.blocked.down)},s.Physics.Arcade.Body.prototype.constructor=s.Physics.Arcade.Body, +n.Physics.Arcade.Body=function(t){this.sprite=t,this.game=t.game,this.type=n.Physics.ARCADE,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new n.Point,this.position=new n.Point(t.x,t.y),this.prev=new n.Point(this.position.x,this.position.y),this.allowRotation=!0,this.rotation=t.angle,this.preRotation=t.angle,this.width=t.width,this.height=t.height,this.sourceWidth=t.width,this.sourceHeight=t.height,t.texture&&(this.sourceWidth=t.texture.frame.width,this.sourceHeight=t.texture.frame.height),this.halfWidth=Math.abs(t.width/2),this.halfHeight=Math.abs(t.height/2),this.center=new n.Point(t.x+this.halfWidth,t.y+this.halfHeight),this.velocity=new n.Point,this.newVelocity=new n.Point,this.deltaMax=new n.Point,this.acceleration=new n.Point,this.allowDrag=!0,this.drag=new n.Point,this.allowGravity=!0,this.gravity=new n.Point,this.bounce=new n.Point,this.worldBounce=null,this.onWorldBounds=null,this.onCollide=null,this.onOverlap=null,this.maxVelocity=new n.Point(1e4,1e4),this.friction=new n.Point(1,0),this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=n.NONE,this.immovable=!1,this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.tilePadding=new n.Point,this.dirty=!1,this.skipQuadTree=!1,this.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.moveTimer=0,this.moveDistance=0,this.moveDuration=0,this.moveTarget=null,this.moveEnd=null,this.onMoveComplete=new n.Signal,this.movementCallback=null,this.movementCallbackContext=null,this._reset=!0,this._sx=t.scale.x,this._sy=t.scale.y,this._dx=0,this._dy=0},n.Physics.Arcade.Body.prototype={updateBounds:function(){if(this.syncBounds){var t=this.sprite.getBounds();t.ceilAll(),t.width===this.width&&t.height===this.height||(this.width=t.width,this.height=t.height,this._reset=!0)}else{var e=Math.abs(this.sprite.scale.x),i=Math.abs(this.sprite.scale.y);e===this._sx&&i===this._sy||(this.width=this.sourceWidth*e,this.height=this.sourceHeight*i,this._sx=e,this._sy=i,this._reset=!0)}this._reset&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},preUpdate:function(){this.enable&&!this.game.physics.arcade.isPaused&&(this.dirty=!0,this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds(),this.position.x=this.sprite.world.x-this.sprite.anchor.x*this.sprite.width+this.sprite.scale.x*this.offset.x,this.position.x-=this.sprite.scale.x<0?this.width:0,this.position.y=this.sprite.world.y-this.sprite.anchor.y*this.sprite.height+this.sprite.scale.y*this.offset.y,this.position.y-=this.sprite.scale.y<0?this.height:0,this.updateCenter(),this.rotation=this.sprite.angle,this.preRotation=this.rotation,(this._reset||this.sprite.fresh)&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves&&(this.game.physics.arcade.updateMotion(this),this.newVelocity.set(this.velocity.x*this.game.time.physicsElapsed,this.velocity.y*this.game.time.physicsElapsed),this.position.x+=this.newVelocity.x,this.position.y+=this.newVelocity.y,this.updateCenter(),this.position.x===this.prev.x&&this.position.y===this.prev.y||(this.angle=this.velocity.atan()),this.speed=Math.sqrt(this.velocity.x*this.velocity.x+this.velocity.y*this.velocity.y),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.onWorldBounds.dispatch(this.sprite,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)),this._dx=this.deltaX(),this._dy=this.deltaY(),this._reset=!1)},updateMovement:function(){var t=0,e=0!==this.overlapX||0!==this.overlapY;if(this.moveDuration>0?(this.moveTimer+=this.game.time.elapsedMS,t=this.moveTimer/this.moveDuration):(this.moveTarget.end.set(this.position.x,this.position.y),t=this.moveTarget.length/this.moveDistance),this.movementCallback)var i=this.movementCallback.call(this.movementCallbackContext,this,this.velocity,t);return!(e||t>=1||void 0!==i&&!0!==i)||(this.stopMovement(t>=1||this.stopVelocityOnCollide&&e),!1)},stopMovement:function(t){this.isMoving&&(this.isMoving=!1,t&&this.velocity.set(0),this.onMoveComplete.dispatch(this.sprite,0!==this.overlapX||0!==this.overlapY))},postUpdate:function(){this.enable&&this.dirty&&(this.isMoving&&this.updateMovement(),this.dirty=!1,this.deltaX()<0?this.facing=n.LEFT:this.deltaX()>0&&(this.facing=n.RIGHT),this.deltaY()<0?this.facing=n.UP:this.deltaY()>0&&(this.facing=n.DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.sprite.position.x+=this._dx,this.sprite.position.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.sprite.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.game.physics.arcade.bounds,i=this.game.physics.arcade.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},moveFrom:function(t,e,i){return void 0===e&&(e=this.speed),0!==e&&(void 0===i?(n=this.angle,i=this.game.math.radToDeg(n)):n=this.game.math.degToRad(i),this.moveTimer=0,this.moveDuration=t,0===i||180===i?this.velocity.set(Math.cos(n)*e,0):90===i||270===i?this.velocity.set(0,Math.sin(n)*e):this.velocity.setToPolar(n,e),this.isMoving=!0,!0);var n},moveTo:function(t,e,i){var s,r=e/(t/1e3);return 0!==r&&(void 0===i?(s=this.angle,i=this.game.math.radToDeg(s)):s=this.game.math.degToRad(i),e=Math.abs(e),this.moveDuration=0,this.moveDistance=e,null===this.moveTarget&&(this.moveTarget=new n.Line,this.moveEnd=new n.Point),this.moveTarget.fromAngle(this.x,this.y,s,e),this.moveEnd.set(this.moveTarget.end.x,this.moveTarget.end.y),this.moveTarget.setTo(this.x,this.y,this.x,this.y),0===i||180===i?this.velocity.set(Math.cos(s)*r,0):90===i||270===i?this.velocity.set(0,Math.sin(s)*r):this.velocity.setToPolar(s,r),this.isMoving=!0,!0)},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0},setCircle:function(t,e,i){void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(e,i),this.updateCenter()):this.isCircle=!1},reset:function(t,e){this.stop(),this.position.x=t-this.sprite.anchor.x*this.sprite.width+this.sprite.scale.x*this.offset.x,this.position.x-=this.sprite.scale.x<0?this.width:0,this.position.y=e-this.sprite.anchor.y*this.sprite.height+this.sprite.scale.y*this.offset.y,this.position.y-=this.sprite.scale.y<0?this.height:0,this.prev.x=this.position.x,this.prev.y=this.position.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,this.updateBounds(),this.updateCenter()},stop:function(){this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n.Circle.contains(this,t,e):n.Rectangle.contains(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.sprite.parent&&this.sprite.parent instanceof n.Group&&this.sprite.parent.removeFromHash(this.sprite),this.sprite.body=null,this.sprite=null}},Object.defineProperty(n.Physics.Arcade.Body.prototype,"left",{get:function(){return this.position.x}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"right",{get:function(){return this.position.x+this.width}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"top",{get:function(){return this.position.y}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.position.y+this.height}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"x",{get:function(){return this.position.x},set:function(t){this.position.x=t}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"y",{get:function(){return this.position.y},set:function(t){this.position.y=t}}),n.Physics.Arcade.Body.render=function(t,e,i,n,s){void 0===n&&(n=!0),i=i||"rgba(0,255,0,0.4)",t.fillStyle=i,t.strokeStyle=i,t.lineWidth=s||1,e.isCircle?(t.beginPath(),t.arc(e.center.x-e.game.camera.x,e.center.y-e.game.camera.y,e.halfWidth,0,2*Math.PI),n?t.fill():t.stroke()):n?t.fillRect(e.position.x-e.game.camera.x,e.position.y-e.game.camera.y,e.width,e.height):t.strokeRect(e.position.x-e.game.camera.x,e.position.y-e.game.camera.y,e.width,e.height)},n.Physics.Arcade.Body.renderBodyInfo=function(t,e){t.line("x: "+e.x.toFixed(2),"y: "+e.y.toFixed(2),"width: "+e.width,"height: "+e.height),t.line("velocity x: "+e.velocity.x.toFixed(2),"y: "+e.velocity.y.toFixed(2),"deltaX: "+e._dx.toFixed(2),"deltaY: "+e._dy.toFixed(2)),t.line("acceleration x: "+e.acceleration.x.toFixed(2),"y: "+e.acceleration.y.toFixed(2),"speed: "+e.speed.toFixed(2),"angle: "+e.angle.toFixed(2)),t.line("gravity x: "+e.gravity.x,"y: "+e.gravity.y,"bounce x: "+e.bounce.x.toFixed(2),"y: "+e.bounce.y.toFixed(2)),t.line("touching left: "+e.touching.left,"right: "+e.touching.right,"up: "+e.touching.up,"down: "+e.touching.down),t.line("blocked left: "+e.blocked.left,"right: "+e.blocked.right,"up: "+e.blocked.up,"down: "+e.blocked.down)},n.Physics.Arcade.Body.prototype.constructor=n.Physics.Arcade.Body, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.Arcade.TilemapCollision=function(){},s.Physics.Arcade.TilemapCollision.prototype={TILE_BIAS:16,collideSpriteVsTilemapLayer:function(t,e,i,n,s,r){if(t.body){var o=e.getTiles(t.body.position.x-t.body.tilePadding.x-e.getTileOffsetX(),t.body.position.y-t.body.tilePadding.y-e.getTileOffsetY(),t.body.width+t.body.tilePadding.x,t.body.height+t.body.tilePadding.y,!1,!1);if(0!==o.length)for(var a=0;ae.deltaAbsY()?l=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right-s>e.left&&(n=t.right-s-e.left)>this.TILE_BIAS&&(n=0),0!==n&&(t.customSeparateX?t.overlapX=n:this.processTileSeparationX(t,n)),n},tileCheckY:function(t,e,i){var n=0,s=i.getTileOffsetY();return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y-s0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom-s>e.top&&(n=t.bottom-s-e.top)>this.TILE_BIAS&&(n=0),0!==n&&(t.customSeparateY?t.overlapY=n:this.processTileSeparationY(t,n)),n},processTileSeparationX:function(t,e){e<0?(t.blocked.left=!0,t.blocked.none=!1):e>0&&(t.blocked.right=!0,t.blocked.none=!1),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x},processTileSeparationY:function(t,e){e<0?(t.blocked.up=!0,t.blocked.none=!1):e>0&&(t.blocked.down=!0,t.blocked.none=!1),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},s.Utils.mixinPrototype(s.Physics.Arcade.prototype,s.Physics.Arcade.TilemapCollision.prototype), +n.Physics.Arcade.TilemapCollision=function(){},n.Physics.Arcade.TilemapCollision.prototype={TILE_BIAS:16,collideSpriteVsTilemapLayer:function(t,e,i,n,s,r){if(t.body){var o=e.getTiles(t.body.position.x-t.body.tilePadding.x-e.getTileOffsetX(),t.body.position.y-t.body.tilePadding.y-e.getTileOffsetY(),t.body.width+t.body.tilePadding.x,t.body.height+t.body.tilePadding.y,!1,!1);if(0!==o.length)for(var a=0;ae.deltaAbsY()?l=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right-s>e.left&&(n=t.right-s-e.left)>this.TILE_BIAS&&(n=0),0!==n&&(t.customSeparateX?t.overlapX=n:this.processTileSeparationX(t,n)),n},tileCheckY:function(t,e,i){var n=0,s=i.getTileOffsetY();return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y-s0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom-s>e.top&&(n=t.bottom-s-e.top)>this.TILE_BIAS&&(n=0),0!==n&&(t.customSeparateY?t.overlapY=n:this.processTileSeparationY(t,n)),n},processTileSeparationX:function(t,e){e<0?(t.blocked.left=!0,t.blocked.none=!1):e>0&&(t.blocked.right=!0,t.blocked.none=!1),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x},processTileSeparationY:function(t,e){e<0?(t.blocked.up=!0,t.blocked.none=!1):e>0&&(t.blocked.down=!0,t.blocked.none=!1),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},n.Utils.mixinPrototype(n.Physics.Arcade.prototype,n.Physics.Arcade.TilemapCollision.prototype), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -p2.Body.prototype.parent=null,p2.Spring.prototype.parent=null,s.Physics.P2=function(t,e){this.game=t,void 0===e?e={gravity:[0,0],broadphase:new p2.SAPBroadphase}:(e.hasOwnProperty("gravity")||(e.gravity=[0,0]),e.hasOwnProperty("broadphase")||(e.broadphase=new p2.SAPBroadphase)),this.config=e,this.world=new p2.World(this.config),this.frameRate=1/60,this.useElapsedTime=!1,this.paused=!1,this.materials=[],this.gravity=new s.Physics.P2.InversePointProxy(this,this.world.gravity),this.walls={left:null,right:null,top:null,bottom:null},this.onBodyAdded=new s.Signal,this.onBodyRemoved=new s.Signal,this.onSpringAdded=new s.Signal,this.onSpringRemoved=new s.Signal,this.onConstraintAdded=new s.Signal,this.onConstraintRemoved=new s.Signal,this.onContactMaterialAdded=new s.Signal,this.onContactMaterialRemoved=new s.Signal,this.postBroadphaseCallback=null,this.callbackContext=null,this.onBeginContact=new s.Signal,this.onEndContact=new s.Signal,e.hasOwnProperty("mpx")&&e.hasOwnProperty("pxm")&&e.hasOwnProperty("mpxi")&&e.hasOwnProperty("pxmi")&&(this.mpx=e.mpx,this.mpxi=e.mpxi,this.pxm=e.pxm,this.pxmi=e.pxmi),this.world.on("beginContact",this.beginContactHandler,this),this.world.on("endContact",this.endContactHandler,this),this.collisionGroups=[],this.nothingCollisionGroup=new s.Physics.P2.CollisionGroup(1),this.boundsCollisionGroup=new s.Physics.P2.CollisionGroup(2),this.everythingCollisionGroup=new s.Physics.P2.CollisionGroup(2147483648),this.boundsCollidesWith=[],this._toRemove=[],this._collisionGroupID=2,this._boundsLeft=!0,this._boundsRight=!0,this._boundsTop=!0,this._boundsBottom=!0,this._boundsOwnGroup=!1,this.setBoundsToWorld(!0,!0,!0,!0,!1)},s.Physics.P2.prototype={removeBodyNextStep:function(t){this._toRemove.push(t)},preUpdate:function(){for(var t=this._toRemove.length;t--;)this.removeBody(this._toRemove[t]);this._toRemove.length=0},enable:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!0);var n=1;if(Array.isArray(t))for(n=t.length;n--;)t[n]instanceof s.Group?this.enable(t[n].children,e,i):(this.enableBody(t[n],e),i&&t[n].hasOwnProperty("children")&&t[n].children.length>0&&this.enable(t[n],e,!0));else t instanceof s.Group?this.enable(t.children,e,i):(this.enableBody(t,e),i&&t.hasOwnProperty("children")&&t.children.length>0&&this.enable(t.children,e,!0))},enableBody:function(t,e){t.hasOwnProperty("body")&&null===t.body&&(t.body=new s.Physics.P2.Body(this.game,t,t.x,t.y,1),t.body.debug=e,void 0!==t.anchor&&t.anchor.set(.5))},setImpactEvents:function(t){t?this.world.on("impact",this.impactHandler,this):this.world.off("impact",this.impactHandler,this)},setPostBroadphaseCallback:function(t,e){this.postBroadphaseCallback=t,this.callbackContext=e,null!==t?this.world.on("postBroadphase",this.postBroadphaseHandler,this):this.world.off("postBroadphase",this.postBroadphaseHandler,this)},postBroadphaseHandler:function(t){if(this.postBroadphaseCallback&&0!==t.pairs.length)for(var e=t.pairs.length-2;e>=0;e-=2)t.pairs[e].parent&&t.pairs[e+1].parent&&!this.postBroadphaseCallback.call(this.callbackContext,t.pairs[e].parent,t.pairs[e+1].parent)&&t.pairs.splice(e,2)},impactHandler:function(t){if(t.bodyA.parent&&t.bodyB.parent){var e=t.bodyA.parent,i=t.bodyB.parent;e._bodyCallbacks[t.bodyB.id]&&e._bodyCallbacks[t.bodyB.id].call(e._bodyCallbackContext[t.bodyB.id],e,i,t.shapeA,t.shapeB),i._bodyCallbacks[t.bodyA.id]&&i._bodyCallbacks[t.bodyA.id].call(i._bodyCallbackContext[t.bodyA.id],i,e,t.shapeB,t.shapeA),e._groupCallbacks[t.shapeB.collisionGroup]&&e._groupCallbacks[t.shapeB.collisionGroup].call(e._groupCallbackContext[t.shapeB.collisionGroup],e,i,t.shapeA,t.shapeB),i._groupCallbacks[t.shapeA.collisionGroup]&&i._groupCallbacks[t.shapeA.collisionGroup].call(i._groupCallbackContext[t.shapeA.collisionGroup],i,e,t.shapeB,t.shapeA)}},beginContactHandler:function(t){t.bodyA&&t.bodyB&&(this.onBeginContact.dispatch(t.bodyA,t.bodyB,t.shapeA,t.shapeB,t.contactEquations),t.bodyA.parent&&t.bodyA.parent.onBeginContact.dispatch(t.bodyB.parent,t.bodyB,t.shapeA,t.shapeB,t.contactEquations),t.bodyB.parent&&t.bodyB.parent.onBeginContact.dispatch(t.bodyA.parent,t.bodyA,t.shapeB,t.shapeA,t.contactEquations))},endContactHandler:function(t){t.bodyA&&t.bodyB&&(this.onEndContact.dispatch(t.bodyA,t.bodyB,t.shapeA,t.shapeB),t.bodyA.parent&&t.bodyA.parent.onEndContact.dispatch(t.bodyB.parent,t.bodyB,t.shapeA,t.shapeB),t.bodyB.parent&&t.bodyB.parent.onEndContact.dispatch(t.bodyA.parent,t.bodyA,t.shapeB,t.shapeA))},setBoundsToWorld:function(t,e,i,n,s){this.setBounds(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,t,e,i,n,s)},setWorldMaterial:function(t,e,i,n,s){void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===s&&(s=!0),e&&this.walls.left&&(this.walls.left.shapes[0].material=t),i&&this.walls.right&&(this.walls.right.shapes[0].material=t),n&&this.walls.top&&(this.walls.top.shapes[0].material=t),s&&this.walls.bottom&&(this.walls.bottom.shapes[0].material=t)},updateBoundsCollisionGroup:function(t){void 0===t&&(t=!0);var e=t?this.boundsCollisionGroup.mask:this.everythingCollisionGroup.mask;this.walls.left&&(this.walls.left.shapes[0].collisionGroup=e),this.walls.right&&(this.walls.right.shapes[0].collisionGroup=e),this.walls.top&&(this.walls.top.shapes[0].collisionGroup=e),this.walls.bottom&&(this.walls.bottom.shapes[0].collisionGroup=e),this._boundsOwnGroup=t},setBounds:function(t,e,i,n,s,r,o,a,h){void 0===s&&(s=this._boundsLeft),void 0===r&&(r=this._boundsRight),void 0===o&&(o=this._boundsTop),void 0===a&&(a=this._boundsBottom),void 0===h&&(h=this._boundsOwnGroup),this.setupWall(s,"left",t,e,1.5707963267948966,h),this.setupWall(r,"right",t+i,e,-1.5707963267948966,h),this.setupWall(o,"top",t,e,-3.141592653589793,h),this.setupWall(a,"bottom",t,e+n,0,h),this._boundsLeft=s,this._boundsRight=r,this._boundsTop=o,this._boundsBottom=a,this._boundsOwnGroup=h},setupWall:function(t,e,i,n,s,r){t?(this.walls[e]?this.walls[e].position=[this.pxmi(i),this.pxmi(n)]:(this.walls[e]=new p2.Body({mass:0,position:[this.pxmi(i),this.pxmi(n)],angle:s}),this.walls[e].addShape(new p2.Plane),this.world.addBody(this.walls[e])),r&&(this.walls[e].shapes[0].collisionGroup=this.boundsCollisionGroup.mask)):this.walls[e]&&(this.world.removeBody(this.walls[e]),this.walls[e]=null)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},update:function(){this.paused||(this.useElapsedTime?this.world.step(this.game.time.physicsElapsed):this.world.step(this.frameRate))},reset:function(){this.world.on("beginContact",this.beginContactHandler,this),this.world.on("endContact",this.endContactHandler,this),this.nothingCollisionGroup=new s.Physics.P2.CollisionGroup(1),this.boundsCollisionGroup=new s.Physics.P2.CollisionGroup(2),this.everythingCollisionGroup=new s.Physics.P2.CollisionGroup(2147483648),this._collisionGroupID=2,this.setBoundsToWorld(!0,!0,!0,!0,!1)},clear:function(){this.world.time=0,this.world.fixedStepTime=0,this.world.solver&&this.world.solver.equations.length&&this.world.solver.removeAllEquations();for(var t=this.world.constraints,e=t.length-1;e>=0;e--)this.world.removeConstraint(t[e]);var i=this.world.bodies;for(e=i.length-1;e>=0;e--)this.world.removeBody(i[e]);var n=this.world.springs;for(e=n.length-1;e>=0;e--)this.world.removeSpring(n[e]);var s=this.world.contactMaterials;for(e=s.length-1;e>=0;e--)this.world.removeContactMaterial(s[e]);this.world.off("beginContact",this.beginContactHandler,this),this.world.off("endContact",this.endContactHandler,this),this.postBroadphaseCallback=null,this.callbackContext=null,this.impactCallback=null,this.collisionGroups=[],this._toRemove=[],this.boundsCollidesWith=[],this.walls={left:null,right:null,top:null,bottom:null}},destroy:function(){this.clear(),this.game=null},addBody:function(t){return!t.data.world&&(this.world.addBody(t.data),this.onBodyAdded.dispatch(t),!0)},removeBody:function(t){return t.data.world===this.world&&(this.world.removeBody(t.data),this.onBodyRemoved.dispatch(t)),t},addSpring:function(t){return t instanceof s.Physics.P2.Spring||t instanceof s.Physics.P2.RotationalSpring?this.world.addSpring(t.data):this.world.addSpring(t),this.onSpringAdded.dispatch(t),t},removeSpring:function(t){return t instanceof s.Physics.P2.Spring||t instanceof s.Physics.P2.RotationalSpring?this.world.removeSpring(t.data):this.world.removeSpring(t),this.onSpringRemoved.dispatch(t),t},createDistanceConstraint:function(t,e,i,n,r,o){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new s.Physics.P2.DistanceConstraint(this,t,e,i,n,r,o));console.warn("Cannot create Constraint, invalid body objects given")},createGearConstraint:function(t,e,i,n){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new s.Physics.P2.GearConstraint(this,t,e,i,n));console.warn("Cannot create Constraint, invalid body objects given")},createRevoluteConstraint:function(t,e,i,n,r,o){if(t=this.getBody(t),i=this.getBody(i),t&&i)return this.addConstraint(new s.Physics.P2.RevoluteConstraint(this,t,e,i,n,r,o));console.warn("Cannot create Constraint, invalid body objects given")},createLockConstraint:function(t,e,i,n,r){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new s.Physics.P2.LockConstraint(this,t,e,i,n,r));console.warn("Cannot create Constraint, invalid body objects given")},createPrismaticConstraint:function(t,e,i,n,r,o,a){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new s.Physics.P2.PrismaticConstraint(this,t,e,i,n,r,o,a));console.warn("Cannot create Constraint, invalid body objects given")},addConstraint:function(t){return this.world.addConstraint(t),this.onConstraintAdded.dispatch(t),t},removeConstraint:function(t){return this.world.removeConstraint(t),this.onConstraintRemoved.dispatch(t),t},addContactMaterial:function(t){return this.world.addContactMaterial(t),this.onContactMaterialAdded.dispatch(t),t},removeContactMaterial:function(t){return this.world.removeContactMaterial(t),this.onContactMaterialRemoved.dispatch(t),t},getContactMaterial:function(t,e){return this.world.getContactMaterial(t,e)},setMaterial:function(t,e){for(var i=e.length;i--;)e[i].setMaterial(t)},createMaterial:function(t,e){t=t||"";var i=new s.Physics.P2.Material(t);return this.materials.push(i),void 0!==e&&e.setMaterial(i),i},createContactMaterial:function(t,e,i){void 0===t&&(t=this.createMaterial()),void 0===e&&(e=this.createMaterial());var n=new s.Physics.P2.ContactMaterial(t,e,i);return this.addContactMaterial(n)},getBodies:function(){for(var t=[],e=this.world.bodies.length;e--;)t.push(this.world.bodies[e].parent);return t},getBody:function(t){return t instanceof p2.Body?t:t instanceof s.Physics.P2.Body?t.data:t.body&&t.body.type===s.Physics.P2JS?t.body.data:null},getSprings:function(){for(var t=[],e=this.world.springs.length;e--;)t.push(this.world.springs[e].parent);return t},getConstraints:function(){for(var t=[],e=this.world.constraints.length;e--;)t.push(this.world.constraints[e]);return t},hitTest:function(t,e,i,n){void 0===e&&(e=this.world.bodies),void 0===i&&(i=5),void 0===n&&(n=!1);for(var r=[this.pxmi(t.x),this.pxmi(t.y)],o=[],a=e.length;a--;)e[a]instanceof s.Physics.P2.Body&&(!n||e[a].data.type!==p2.Body.STATIC)?o.push(e[a].data):e[a]instanceof p2.Body&&e[a].parent&&(!n||e[a].type!==p2.Body.STATIC)?o.push(e[a]):e[a]instanceof s.Sprite&&e[a].hasOwnProperty("body")&&(!n||e[a].body.data.type!==p2.Body.STATIC)&&o.push(e[a].body.data);return this.world.hitTest(r,o,i)},toJSON:function(){return this.world.toJSON()},createCollisionGroup:function(t){var e=Math.pow(2,this._collisionGroupID);this.walls.left&&(this.walls.left.shapes[0].collisionMask=this.walls.left.shapes[0].collisionMask|e),this.walls.right&&(this.walls.right.shapes[0].collisionMask=this.walls.right.shapes[0].collisionMask|e),this.walls.top&&(this.walls.top.shapes[0].collisionMask=this.walls.top.shapes[0].collisionMask|e),this.walls.bottom&&(this.walls.bottom.shapes[0].collisionMask=this.walls.bottom.shapes[0].collisionMask|e),this._collisionGroupID++;var i=new s.Physics.P2.CollisionGroup(e);return this.collisionGroups.push(i),t&&this.setCollisionGroup(t,i),i},setCollisionGroup:function(t,e){if(t instanceof s.Group)for(var i=0;i-1&&c.collides)if(n){var d=t.getTileRight(e,l,a);if(0===s&&(r=c.x*c.width,o=c.y*c.height,s=c.width),d&&d.collides)s+=c.width;else(p=this.createBody(r,o,0,!1)).addRectangle(s,c.height,s/2,c.height/2,0),i&&this.addBody(p),t.layers[e].bodies.push(p),s=0}else{var p;(p=this.createBody(c.x*c.width,c.y*c.height,0,!1)).addRectangle(c.width,c.height,c.width/2,c.height/2,0),i&&this.addBody(p),t.layers[e].bodies.push(p)}}}return t.layers[e].bodies},mpx:function(t){return 20*t},pxm:function(t){return.05*t},mpxi:function(t){return-20*t},pxmi:function(t){return-.05*t}},Object.defineProperty(s.Physics.P2.prototype,"friction",{get:function(){return this.world.defaultContactMaterial.friction},set:function(t){this.world.defaultContactMaterial.friction=t}}),Object.defineProperty(s.Physics.P2.prototype,"restitution",{get:function(){return this.world.defaultContactMaterial.restitution},set:function(t){this.world.defaultContactMaterial.restitution=t}}),Object.defineProperty(s.Physics.P2.prototype,"contactMaterial",{get:function(){return this.world.defaultContactMaterial},set:function(t){this.world.defaultContactMaterial=t}}),Object.defineProperty(s.Physics.P2.prototype,"applySpringForces",{get:function(){return this.world.applySpringForces},set:function(t){this.world.applySpringForces=t}}),Object.defineProperty(s.Physics.P2.prototype,"applyDamping",{get:function(){return this.world.applyDamping},set:function(t){this.world.applyDamping=t}}),Object.defineProperty(s.Physics.P2.prototype,"applyGravity",{get:function(){return this.world.applyGravity},set:function(t){this.world.applyGravity=t}}),Object.defineProperty(s.Physics.P2.prototype,"solveConstraints",{get:function(){return this.world.solveConstraints},set:function(t){this.world.solveConstraints=t}}),Object.defineProperty(s.Physics.P2.prototype,"time",{get:function(){return this.world.time}}),Object.defineProperty(s.Physics.P2.prototype,"emitImpactEvent",{get:function(){return this.world.emitImpactEvent},set:function(t){this.world.emitImpactEvent=t}}),Object.defineProperty(s.Physics.P2.prototype,"sleepMode",{get:function(){return this.world.sleepMode},set:function(t){this.world.sleepMode=t}}),Object.defineProperty(s.Physics.P2.prototype,"total",{get:function(){return this.world.bodies.length}}), +p2.Body.prototype.parent=null,p2.Spring.prototype.parent=null,n.Physics.P2=function(t,e){this.game=t,void 0===e?e={gravity:[0,0],broadphase:new p2.SAPBroadphase}:(e.hasOwnProperty("gravity")||(e.gravity=[0,0]),e.hasOwnProperty("broadphase")||(e.broadphase=new p2.SAPBroadphase)),this.config=e,this.world=new p2.World(this.config),this.frameRate=1/60,this.useElapsedTime=!1,this.paused=!1,this.materials=[],this.gravity=new n.Physics.P2.InversePointProxy(this,this.world.gravity),this.walls={left:null,right:null,top:null,bottom:null},this.onBodyAdded=new n.Signal,this.onBodyRemoved=new n.Signal,this.onSpringAdded=new n.Signal,this.onSpringRemoved=new n.Signal,this.onConstraintAdded=new n.Signal,this.onConstraintRemoved=new n.Signal,this.onContactMaterialAdded=new n.Signal,this.onContactMaterialRemoved=new n.Signal,this.postBroadphaseCallback=null,this.callbackContext=null,this.onBeginContact=new n.Signal,this.onEndContact=new n.Signal,e.hasOwnProperty("mpx")&&e.hasOwnProperty("pxm")&&e.hasOwnProperty("mpxi")&&e.hasOwnProperty("pxmi")&&(this.mpx=e.mpx,this.mpxi=e.mpxi,this.pxm=e.pxm,this.pxmi=e.pxmi),this.world.on("beginContact",this.beginContactHandler,this),this.world.on("endContact",this.endContactHandler,this),this.collisionGroups=[],this.nothingCollisionGroup=new n.Physics.P2.CollisionGroup(1),this.boundsCollisionGroup=new n.Physics.P2.CollisionGroup(2),this.everythingCollisionGroup=new n.Physics.P2.CollisionGroup(2147483648),this.boundsCollidesWith=[],this._toRemove=[],this._collisionGroupID=2,this._boundsLeft=!0,this._boundsRight=!0,this._boundsTop=!0,this._boundsBottom=!0,this._boundsOwnGroup=!1,this.setBoundsToWorld(!0,!0,!0,!0,!1)},n.Physics.P2.prototype={removeBodyNextStep:function(t){this._toRemove.push(t)},preUpdate:function(){for(var t=this._toRemove.length;t--;)this.removeBody(this._toRemove[t]);this._toRemove.length=0},enable:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!0);var s=1;if(Array.isArray(t))for(s=t.length;s--;)t[s]instanceof n.Group?this.enable(t[s].children,e,i):(this.enableBody(t[s],e),i&&t[s].hasOwnProperty("children")&&t[s].children.length>0&&this.enable(t[s],e,!0));else t instanceof n.Group?this.enable(t.children,e,i):(this.enableBody(t,e),i&&t.hasOwnProperty("children")&&t.children.length>0&&this.enable(t.children,e,!0))},enableBody:function(t,e){t.hasOwnProperty("body")&&null===t.body&&(t.body=new n.Physics.P2.Body(this.game,t,t.x,t.y,1),t.body.debug=e,void 0!==t.anchor&&t.anchor.set(.5))},setImpactEvents:function(t){t?this.world.on("impact",this.impactHandler,this):this.world.off("impact",this.impactHandler,this)},setPostBroadphaseCallback:function(t,e){this.postBroadphaseCallback=t,this.callbackContext=e,null!==t?this.world.on("postBroadphase",this.postBroadphaseHandler,this):this.world.off("postBroadphase",this.postBroadphaseHandler,this)},postBroadphaseHandler:function(t){if(this.postBroadphaseCallback&&0!==t.pairs.length)for(var e=t.pairs.length-2;e>=0;e-=2)t.pairs[e].parent&&t.pairs[e+1].parent&&!this.postBroadphaseCallback.call(this.callbackContext,t.pairs[e].parent,t.pairs[e+1].parent)&&t.pairs.splice(e,2)},impactHandler:function(t){if(t.bodyA.parent&&t.bodyB.parent){var e=t.bodyA.parent,i=t.bodyB.parent;e._bodyCallbacks[t.bodyB.id]&&e._bodyCallbacks[t.bodyB.id].call(e._bodyCallbackContext[t.bodyB.id],e,i,t.shapeA,t.shapeB),i._bodyCallbacks[t.bodyA.id]&&i._bodyCallbacks[t.bodyA.id].call(i._bodyCallbackContext[t.bodyA.id],i,e,t.shapeB,t.shapeA),e._groupCallbacks[t.shapeB.collisionGroup]&&e._groupCallbacks[t.shapeB.collisionGroup].call(e._groupCallbackContext[t.shapeB.collisionGroup],e,i,t.shapeA,t.shapeB),i._groupCallbacks[t.shapeA.collisionGroup]&&i._groupCallbacks[t.shapeA.collisionGroup].call(i._groupCallbackContext[t.shapeA.collisionGroup],i,e,t.shapeB,t.shapeA)}},beginContactHandler:function(t){t.bodyA&&t.bodyB&&(this.onBeginContact.dispatch(t.bodyA,t.bodyB,t.shapeA,t.shapeB,t.contactEquations),t.bodyA.parent&&t.bodyA.parent.onBeginContact.dispatch(t.bodyB.parent,t.bodyB,t.shapeA,t.shapeB,t.contactEquations),t.bodyB.parent&&t.bodyB.parent.onBeginContact.dispatch(t.bodyA.parent,t.bodyA,t.shapeB,t.shapeA,t.contactEquations))},endContactHandler:function(t){t.bodyA&&t.bodyB&&(this.onEndContact.dispatch(t.bodyA,t.bodyB,t.shapeA,t.shapeB),t.bodyA.parent&&t.bodyA.parent.onEndContact.dispatch(t.bodyB.parent,t.bodyB,t.shapeA,t.shapeB),t.bodyB.parent&&t.bodyB.parent.onEndContact.dispatch(t.bodyA.parent,t.bodyA,t.shapeB,t.shapeA))},setBoundsToWorld:function(t,e,i,n,s){this.setBounds(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,t,e,i,n,s)},setWorldMaterial:function(t,e,i,n,s){void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===s&&(s=!0),e&&this.walls.left&&(this.walls.left.shapes[0].material=t),i&&this.walls.right&&(this.walls.right.shapes[0].material=t),n&&this.walls.top&&(this.walls.top.shapes[0].material=t),s&&this.walls.bottom&&(this.walls.bottom.shapes[0].material=t)},updateBoundsCollisionGroup:function(t){void 0===t&&(t=!0);var e=t?this.boundsCollisionGroup.mask:this.everythingCollisionGroup.mask;this.walls.left&&(this.walls.left.shapes[0].collisionGroup=e),this.walls.right&&(this.walls.right.shapes[0].collisionGroup=e),this.walls.top&&(this.walls.top.shapes[0].collisionGroup=e),this.walls.bottom&&(this.walls.bottom.shapes[0].collisionGroup=e),this._boundsOwnGroup=t},setBounds:function(t,e,i,n,s,r,o,a,h){void 0===s&&(s=this._boundsLeft),void 0===r&&(r=this._boundsRight),void 0===o&&(o=this._boundsTop),void 0===a&&(a=this._boundsBottom),void 0===h&&(h=this._boundsOwnGroup),this.setupWall(s,"left",t,e,1.5707963267948966,h),this.setupWall(r,"right",t+i,e,-1.5707963267948966,h),this.setupWall(o,"top",t,e,-3.141592653589793,h),this.setupWall(a,"bottom",t,e+n,0,h),this._boundsLeft=s,this._boundsRight=r,this._boundsTop=o,this._boundsBottom=a,this._boundsOwnGroup=h},setupWall:function(t,e,i,n,s,r){t?(this.walls[e]?this.walls[e].position=[this.pxmi(i),this.pxmi(n)]:(this.walls[e]=new p2.Body({mass:0,position:[this.pxmi(i),this.pxmi(n)],angle:s}),this.walls[e].addShape(new p2.Plane),this.world.addBody(this.walls[e])),r&&(this.walls[e].shapes[0].collisionGroup=this.boundsCollisionGroup.mask)):this.walls[e]&&(this.world.removeBody(this.walls[e]),this.walls[e]=null)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},update:function(){this.paused||(this.useElapsedTime?this.world.step(this.game.time.physicsElapsed):this.world.step(this.frameRate))},reset:function(){this.world.on("beginContact",this.beginContactHandler,this),this.world.on("endContact",this.endContactHandler,this),this.nothingCollisionGroup=new n.Physics.P2.CollisionGroup(1),this.boundsCollisionGroup=new n.Physics.P2.CollisionGroup(2),this.everythingCollisionGroup=new n.Physics.P2.CollisionGroup(2147483648),this._collisionGroupID=2,this.setBoundsToWorld(!0,!0,!0,!0,!1)},clear:function(){this.world.time=0,this.world.fixedStepTime=0,this.world.solver&&this.world.solver.equations.length&&this.world.solver.removeAllEquations();for(var t=this.world.constraints,e=t.length-1;e>=0;e--)this.world.removeConstraint(t[e]);var i=this.world.bodies;for(e=i.length-1;e>=0;e--)this.world.removeBody(i[e]);var n=this.world.springs;for(e=n.length-1;e>=0;e--)this.world.removeSpring(n[e]);var s=this.world.contactMaterials;for(e=s.length-1;e>=0;e--)this.world.removeContactMaterial(s[e]);this.world.off("beginContact",this.beginContactHandler,this),this.world.off("endContact",this.endContactHandler,this),this.postBroadphaseCallback=null,this.callbackContext=null,this.impactCallback=null,this.collisionGroups=[],this._toRemove=[],this.boundsCollidesWith=[],this.walls={left:null,right:null,top:null,bottom:null}},destroy:function(){this.clear(),this.game=null},addBody:function(t){return!t.data.world&&(this.world.addBody(t.data),this.onBodyAdded.dispatch(t),!0)},removeBody:function(t){return t.data.world===this.world&&(this.world.removeBody(t.data),this.onBodyRemoved.dispatch(t)),t},addSpring:function(t){return t instanceof n.Physics.P2.Spring||t instanceof n.Physics.P2.RotationalSpring?this.world.addSpring(t.data):this.world.addSpring(t),this.onSpringAdded.dispatch(t),t},removeSpring:function(t){return t instanceof n.Physics.P2.Spring||t instanceof n.Physics.P2.RotationalSpring?this.world.removeSpring(t.data):this.world.removeSpring(t),this.onSpringRemoved.dispatch(t),t},createDistanceConstraint:function(t,e,i,s,r,o){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.DistanceConstraint(this,t,e,i,s,r,o));console.warn("Cannot create Constraint, invalid body objects given")},createGearConstraint:function(t,e,i,s){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.GearConstraint(this,t,e,i,s));console.warn("Cannot create Constraint, invalid body objects given")},createRevoluteConstraint:function(t,e,i,s,r,o){if(t=this.getBody(t),i=this.getBody(i),t&&i)return this.addConstraint(new n.Physics.P2.RevoluteConstraint(this,t,e,i,s,r,o));console.warn("Cannot create Constraint, invalid body objects given")},createLockConstraint:function(t,e,i,s,r){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.LockConstraint(this,t,e,i,s,r));console.warn("Cannot create Constraint, invalid body objects given")},createPrismaticConstraint:function(t,e,i,s,r,o,a){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.PrismaticConstraint(this,t,e,i,s,r,o,a));console.warn("Cannot create Constraint, invalid body objects given")},addConstraint:function(t){return this.world.addConstraint(t),this.onConstraintAdded.dispatch(t),t},removeConstraint:function(t){return this.world.removeConstraint(t),this.onConstraintRemoved.dispatch(t),t},addContactMaterial:function(t){return this.world.addContactMaterial(t),this.onContactMaterialAdded.dispatch(t),t},removeContactMaterial:function(t){return this.world.removeContactMaterial(t),this.onContactMaterialRemoved.dispatch(t),t},getContactMaterial:function(t,e){return this.world.getContactMaterial(t,e)},setMaterial:function(t,e){for(var i=e.length;i--;)e[i].setMaterial(t)},createMaterial:function(t,e){t=t||"";var i=new n.Physics.P2.Material(t);return this.materials.push(i),void 0!==e&&e.setMaterial(i),i},createContactMaterial:function(t,e,i){void 0===t&&(t=this.createMaterial()),void 0===e&&(e=this.createMaterial());var s=new n.Physics.P2.ContactMaterial(t,e,i);return this.addContactMaterial(s)},getBodies:function(){for(var t=[],e=this.world.bodies.length;e--;)t.push(this.world.bodies[e].parent);return t},getBody:function(t){return t instanceof p2.Body?t:t instanceof n.Physics.P2.Body?t.data:t.body&&t.body.type===n.Physics.P2JS?t.body.data:null},getSprings:function(){for(var t=[],e=this.world.springs.length;e--;)t.push(this.world.springs[e].parent);return t},getConstraints:function(){for(var t=[],e=this.world.constraints.length;e--;)t.push(this.world.constraints[e]);return t},hitTest:function(t,e,i,s){void 0===e&&(e=this.world.bodies),void 0===i&&(i=5),void 0===s&&(s=!1);for(var r=[this.pxmi(t.x),this.pxmi(t.y)],o=[],a=e.length;a--;)e[a]instanceof n.Physics.P2.Body&&(!s||e[a].data.type!==p2.Body.STATIC)?o.push(e[a].data):e[a]instanceof p2.Body&&e[a].parent&&(!s||e[a].type!==p2.Body.STATIC)?o.push(e[a]):e[a]instanceof n.Sprite&&e[a].hasOwnProperty("body")&&(!s||e[a].body.data.type!==p2.Body.STATIC)&&o.push(e[a].body.data);return this.world.hitTest(r,o,i)},toJSON:function(){return this.world.toJSON()},createCollisionGroup:function(t){var e=Math.pow(2,this._collisionGroupID);this.walls.left&&(this.walls.left.shapes[0].collisionMask=this.walls.left.shapes[0].collisionMask|e),this.walls.right&&(this.walls.right.shapes[0].collisionMask=this.walls.right.shapes[0].collisionMask|e),this.walls.top&&(this.walls.top.shapes[0].collisionMask=this.walls.top.shapes[0].collisionMask|e),this.walls.bottom&&(this.walls.bottom.shapes[0].collisionMask=this.walls.bottom.shapes[0].collisionMask|e),this._collisionGroupID++;var i=new n.Physics.P2.CollisionGroup(e);return this.collisionGroups.push(i),t&&this.setCollisionGroup(t,i),i},setCollisionGroup:function(t,e){if(t instanceof n.Group)for(var i=0;i-1&&u.collides)if(n){var d=t.getTileRight(e,l,a);if(0===s&&(r=u.x*u.width,o=u.y*u.height,s=u.width),d&&d.collides)s+=u.width;else(p=this.createBody(r,o,0,!1)).addRectangle(s,u.height,s/2,u.height/2,0),i&&this.addBody(p),t.layers[e].bodies.push(p),s=0}else{var p;(p=this.createBody(u.x*u.width,u.y*u.height,0,!1)).addRectangle(u.width,u.height,u.width/2,u.height/2,0),i&&this.addBody(p),t.layers[e].bodies.push(p)}}}return t.layers[e].bodies},mpx:function(t){return 20*t},pxm:function(t){return.05*t},mpxi:function(t){return-20*t},pxmi:function(t){return-.05*t}},Object.defineProperty(n.Physics.P2.prototype,"friction",{get:function(){return this.world.defaultContactMaterial.friction},set:function(t){this.world.defaultContactMaterial.friction=t}}),Object.defineProperty(n.Physics.P2.prototype,"restitution",{get:function(){return this.world.defaultContactMaterial.restitution},set:function(t){this.world.defaultContactMaterial.restitution=t}}),Object.defineProperty(n.Physics.P2.prototype,"contactMaterial",{get:function(){return this.world.defaultContactMaterial},set:function(t){this.world.defaultContactMaterial=t}}),Object.defineProperty(n.Physics.P2.prototype,"applySpringForces",{get:function(){return this.world.applySpringForces},set:function(t){this.world.applySpringForces=t}}),Object.defineProperty(n.Physics.P2.prototype,"applyDamping",{get:function(){return this.world.applyDamping},set:function(t){this.world.applyDamping=t}}),Object.defineProperty(n.Physics.P2.prototype,"applyGravity",{get:function(){return this.world.applyGravity},set:function(t){this.world.applyGravity=t}}),Object.defineProperty(n.Physics.P2.prototype,"solveConstraints",{get:function(){return this.world.solveConstraints},set:function(t){this.world.solveConstraints=t}}),Object.defineProperty(n.Physics.P2.prototype,"time",{get:function(){return this.world.time}}),Object.defineProperty(n.Physics.P2.prototype,"emitImpactEvent",{get:function(){return this.world.emitImpactEvent},set:function(t){this.world.emitImpactEvent=t}}),Object.defineProperty(n.Physics.P2.prototype,"sleepMode",{get:function(){return this.world.sleepMode},set:function(t){this.world.sleepMode=t}}),Object.defineProperty(n.Physics.P2.prototype,"total",{get:function(){return this.world.bodies.length}}), /** * @author Georgios Kaleadis https://github.com/georgiee * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.FixtureList=function(t){Array.isArray(t)||(t=[t]),this.rawList=t,this.init(),this.parse(this.rawList)},s.Physics.P2.FixtureList.prototype={init:function(){this.namedFixtures={},this.groupedFixtures=[],this.allFixtures=[]},setCategory:function(t,e){this.getFixtures(e).forEach((function(e){e.collisionGroup=t}))},setMask:function(t,e){this.getFixtures(e).forEach((function(e){e.collisionMask=t}))},setSensor:function(t,e){this.getFixtures(e).forEach((function(e){e.sensor=t}))},setMaterial:function(t,e){this.getFixtures(e).forEach((function(e){e.material=t}))},getFixtures:function(t){var e=[];if(t){t instanceof Array||(t=[t]);var i=this;return t.forEach((function(t){i.namedFixtures[t]&&e.push(i.namedFixtures[t])})),this.flatten(e)}return this.allFixtures},getFixtureByKey:function(t){return this.namedFixtures[t]},getGroup:function(t){return this.groupedFixtures[t]},parse:function(){var t,e,i,n;for(t in n=[],i=this.rawList)e=i[t],isNaN(t-0)?this.namedFixtures[t]=this.flatten(e):(this.groupedFixtures[t]=this.groupedFixtures[t]||[],this.groupedFixtures[t]=this.groupedFixtures[t].concat(e)),n.push(this.allFixtures=this.flatten(this.groupedFixtures))},flatten:function(t){var e,i;return e=[],i=arguments.callee,t.forEach((function(t){return Array.prototype.push.apply(e,Array.isArray(t)?i(t):[t])})),e}}, +n.Physics.P2.FixtureList=function(t){Array.isArray(t)||(t=[t]),this.rawList=t,this.init(),this.parse(this.rawList)},n.Physics.P2.FixtureList.prototype={init:function(){this.namedFixtures={},this.groupedFixtures=[],this.allFixtures=[]},setCategory:function(t,e){this.getFixtures(e).forEach((function(e){e.collisionGroup=t}))},setMask:function(t,e){this.getFixtures(e).forEach((function(e){e.collisionMask=t}))},setSensor:function(t,e){this.getFixtures(e).forEach((function(e){e.sensor=t}))},setMaterial:function(t,e){this.getFixtures(e).forEach((function(e){e.material=t}))},getFixtures:function(t){var e=[];if(t){t instanceof Array||(t=[t]);var i=this;return t.forEach((function(t){i.namedFixtures[t]&&e.push(i.namedFixtures[t])})),this.flatten(e)}return this.allFixtures},getFixtureByKey:function(t){return this.namedFixtures[t]},getGroup:function(t){return this.groupedFixtures[t]},parse:function(){var t,e,i,n;for(t in n=[],i=this.rawList)e=i[t],isNaN(t-0)?this.namedFixtures[t]=this.flatten(e):(this.groupedFixtures[t]=this.groupedFixtures[t]||[],this.groupedFixtures[t]=this.groupedFixtures[t].concat(e)),n.push(this.allFixtures=this.flatten(this.groupedFixtures))},flatten:function(t){var e,i;return e=[],i=arguments.callee,t.forEach((function(t){return Array.prototype.push.apply(e,Array.isArray(t)?i(t):[t])})),e}}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.PointProxy=function(t,e){this.world=t,this.destination=e},s.Physics.P2.PointProxy.prototype.constructor=s.Physics.P2.PointProxy,Object.defineProperty(s.Physics.P2.PointProxy.prototype,"x",{get:function(){return this.world.mpx(this.destination[0])},set:function(t){this.destination[0]=this.world.pxm(t)}}),Object.defineProperty(s.Physics.P2.PointProxy.prototype,"y",{get:function(){return this.world.mpx(this.destination[1])},set:function(t){this.destination[1]=this.world.pxm(t)}}),Object.defineProperty(s.Physics.P2.PointProxy.prototype,"mx",{get:function(){return this.destination[0]},set:function(t){this.destination[0]=t}}),Object.defineProperty(s.Physics.P2.PointProxy.prototype,"my",{get:function(){return this.destination[1]},set:function(t){this.destination[1]=t}}), +n.Physics.P2.PointProxy=function(t,e){this.world=t,this.destination=e},n.Physics.P2.PointProxy.prototype.constructor=n.Physics.P2.PointProxy,Object.defineProperty(n.Physics.P2.PointProxy.prototype,"x",{get:function(){return this.world.mpx(this.destination[0])},set:function(t){this.destination[0]=this.world.pxm(t)}}),Object.defineProperty(n.Physics.P2.PointProxy.prototype,"y",{get:function(){return this.world.mpx(this.destination[1])},set:function(t){this.destination[1]=this.world.pxm(t)}}),Object.defineProperty(n.Physics.P2.PointProxy.prototype,"mx",{get:function(){return this.destination[0]},set:function(t){this.destination[0]=t}}),Object.defineProperty(n.Physics.P2.PointProxy.prototype,"my",{get:function(){return this.destination[1]},set:function(t){this.destination[1]=t}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.InversePointProxy=function(t,e){this.world=t,this.destination=e},s.Physics.P2.InversePointProxy.prototype.constructor=s.Physics.P2.InversePointProxy,Object.defineProperty(s.Physics.P2.InversePointProxy.prototype,"x",{get:function(){return this.world.mpxi(this.destination[0])},set:function(t){this.destination[0]=this.world.pxmi(t)}}),Object.defineProperty(s.Physics.P2.InversePointProxy.prototype,"y",{get:function(){return this.world.mpxi(this.destination[1])},set:function(t){this.destination[1]=this.world.pxmi(t)}}),Object.defineProperty(s.Physics.P2.InversePointProxy.prototype,"mx",{get:function(){return this.destination[0]},set:function(t){this.destination[0]=-t}}),Object.defineProperty(s.Physics.P2.InversePointProxy.prototype,"my",{get:function(){return this.destination[1]},set:function(t){this.destination[1]=-t}}), +n.Physics.P2.InversePointProxy=function(t,e){this.world=t,this.destination=e},n.Physics.P2.InversePointProxy.prototype.constructor=n.Physics.P2.InversePointProxy,Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"x",{get:function(){return this.world.mpxi(this.destination[0])},set:function(t){this.destination[0]=this.world.pxmi(t)}}),Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"y",{get:function(){return this.world.mpxi(this.destination[1])},set:function(t){this.destination[1]=this.world.pxmi(t)}}),Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"mx",{get:function(){return this.destination[0]},set:function(t){this.destination[0]=-t}}),Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"my",{get:function(){return this.destination[1]},set:function(t){this.destination[1]=-t}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.Body=function(t,e,i,n,r){e=e||null,i=i||0,n=n||0,void 0===r&&(r=1),this.game=t,this.world=t.physics.p2,this.sprite=e,this.type=s.Physics.P2JS,this.offset=new s.Point,this.data=new p2.Body({position:[this.world.pxmi(i),this.world.pxmi(n)],mass:r}),this.data.parent=this,this.velocity=new s.Physics.P2.InversePointProxy(this.world,this.data.velocity),this.force=new s.Physics.P2.InversePointProxy(this.world,this.data.force),this.gravity=new s.Point,this.onBeginContact=new s.Signal,this.onEndContact=new s.Signal,this.collidesWith=[],this.removeNextStep=!1,this.debugBody=null,this.dirty=!1,this._collideWorldBounds=!0,this._bodyCallbacks={},this._bodyCallbackContext={},this._groupCallbacks={},this._groupCallbackContext={},this._reset=!1,e&&(this.setRectangleFromSprite(e),e.exists&&this.game.physics.p2.addBody(this))},s.Physics.P2.Body.prototype={createBodyCallback:function(t,e,i){var n=-1;t.id?n=t.id:t.body&&(n=t.body.id),n>-1&&(null===e?(delete this._bodyCallbacks[n],delete this._bodyCallbackContext[n]):(this._bodyCallbacks[n]=e,this._bodyCallbackContext[n]=i))},createGroupCallback:function(t,e,i){null===e?(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]):(this._groupCallbacks[t.mask]=e,this._groupCallbackContext[t.mask]=i)},getCollisionMask:function(){var t=0;this._collideWorldBounds&&(t=this.game.physics.p2.boundsCollisionGroup.mask);for(var e=0;e=0;i--)this.data.shapes[i].collisionMask=e;else t.collisionMask=e},setCollisionGroup:function(t,e){var i=this.getCollisionMask();if(void 0===e)for(var n=this.data.shapes.length-1;n>=0;n--)this.data.shapes[n].collisionGroup=t.mask,this.data.shapes[n].collisionMask=i;else e.collisionGroup=t.mask,e.collisionMask=i},clearCollision:function(t,e,i){if(void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i)for(var n=this.data.shapes.length-1;n>=0;n--)t&&(this.data.shapes[n].collisionGroup=null),e&&(this.data.shapes[n].collisionMask=null);else t&&(i.collisionGroup=null),e&&(i.collisionMask=null);t&&(this.collidesWith.length=0)},removeCollisionGroup:function(t,e,i){var n;if(void 0===e&&(e=!0),Array.isArray(t))for(var s=0;s-1&&(this.collidesWith.splice(n,1),e&&(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]));else(n=this.collidesWith.indexOf(t))>-1&&(this.collidesWith.splice(n,1),e&&(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]));var r=this.getCollisionMask();if(void 0===i)for(s=this.data.shapes.length-1;s>=0;s--)this.data.shapes[s].collisionMask=r;else i.collisionMask=r},collides:function(t,e,i,n){if(Array.isArray(t))for(var s=0;s=0;s--)this.data.shapes[s].collisionMask=r;else n.collisionMask=r},adjustCenterOfMass:function(){this.data.adjustCenterOfMass(),this.shapeChanged()},getVelocityAtPoint:function(t,e){return this.data.getVelocityAtPoint(t,e)},applyDamping:function(t){this.data.applyDamping(t)},applyImpulse:function(t,e,i){this.data.applyImpulse(t,[this.world.pxmi(e),this.world.pxmi(i)])},applyImpulseLocal:function(t,e,i){this.data.applyImpulseLocal(t,[this.world.pxmi(e),this.world.pxmi(i)])},applyForce:function(t,e,i){this.data.applyForce(t,[this.world.pxmi(e),this.world.pxmi(i)])},setZeroForce:function(){this.data.setZeroForce()},setZeroRotation:function(){this.data.angularVelocity=0},setZeroVelocity:function(){this.data.velocity[0]=0,this.data.velocity[1]=0},setZeroDamping:function(){this.data.damping=0,this.data.angularDamping=0},toLocalFrame:function(t,e){return this.data.toLocalFrame(t,e)},toWorldFrame:function(t,e){return this.data.toWorldFrame(t,e)},rotateLeft:function(t){this.data.angularVelocity=this.world.pxm(-t)},rotateRight:function(t){this.data.angularVelocity=this.world.pxm(t)},moveForward:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.velocity[0]=e*Math.cos(i),this.data.velocity[1]=e*Math.sin(i)},moveBackward:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.velocity[0]=-e*Math.cos(i),this.data.velocity[1]=-e*Math.sin(i)},thrust:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.force[0]+=e*Math.cos(i),this.data.force[1]+=e*Math.sin(i)},thrustLeft:function(t){var e=this.world.pxmi(-t),i=this.data.angle;this.data.force[0]+=e*Math.cos(i),this.data.force[1]+=e*Math.sin(i)},thrustRight:function(t){var e=this.world.pxmi(-t),i=this.data.angle;this.data.force[0]-=e*Math.cos(i),this.data.force[1]-=e*Math.sin(i)},reverse:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.force[0]-=e*Math.cos(i),this.data.force[1]-=e*Math.sin(i)},moveLeft:function(t){this.data.velocity[0]=this.world.pxmi(-t)},moveRight:function(t){this.data.velocity[0]=this.world.pxmi(t)},moveUp:function(t){this.data.velocity[1]=this.world.pxmi(-t)},moveDown:function(t){this.data.velocity[1]=this.world.pxmi(t)},preUpdate:function(){this.dirty=!0,this.removeNextStep&&(this.removeFromWorld(),this.removeNextStep=!1)},postUpdate:function(){this.sprite.x=this.world.mpxi(this.data.position[0])+this.offset.x,this.sprite.y=this.world.mpxi(this.data.position[1])+this.offset.y,this.fixedRotation||(this.sprite.rotation=this.data.angle),this.debugBody&&this.debugBody.updateSpriteTransform(),this.dirty=!1},reset:function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1),this.setZeroForce(),this.setZeroVelocity(),this.setZeroRotation(),i&&this.setZeroDamping(),n&&(this.mass=1),this.x=t,this.y=e},addToWorld:function(){if(this.game.physics.p2._toRemove)for(var t=0;t=0;i--)this.data.shapes[i].material=t;else e.material=t},shapeChanged:function(){this.debugBody&&this.debugBody.draw()},addPhaserPolygon:function(t,e){for(var i=this.game.cache.getPhysicsData(t,e),n=[],s=0;s-1&&(null===e?(delete this._bodyCallbacks[n],delete this._bodyCallbackContext[n]):(this._bodyCallbacks[n]=e,this._bodyCallbackContext[n]=i))},createGroupCallback:function(t,e,i){null===e?(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]):(this._groupCallbacks[t.mask]=e,this._groupCallbackContext[t.mask]=i)},getCollisionMask:function(){var t=0;this._collideWorldBounds&&(t=this.game.physics.p2.boundsCollisionGroup.mask);for(var e=0;e=0;i--)this.data.shapes[i].collisionMask=e;else t.collisionMask=e},setCollisionGroup:function(t,e){var i=this.getCollisionMask();if(void 0===e)for(var n=this.data.shapes.length-1;n>=0;n--)this.data.shapes[n].collisionGroup=t.mask,this.data.shapes[n].collisionMask=i;else e.collisionGroup=t.mask,e.collisionMask=i},clearCollision:function(t,e,i){if(void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i)for(var n=this.data.shapes.length-1;n>=0;n--)t&&(this.data.shapes[n].collisionGroup=null),e&&(this.data.shapes[n].collisionMask=null);else t&&(i.collisionGroup=null),e&&(i.collisionMask=null);t&&(this.collidesWith.length=0)},removeCollisionGroup:function(t,e,i){var n;if(void 0===e&&(e=!0),Array.isArray(t))for(var s=0;s-1&&(this.collidesWith.splice(n,1),e&&(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]));else(n=this.collidesWith.indexOf(t))>-1&&(this.collidesWith.splice(n,1),e&&(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]));var r=this.getCollisionMask();if(void 0===i)for(s=this.data.shapes.length-1;s>=0;s--)this.data.shapes[s].collisionMask=r;else i.collisionMask=r},collides:function(t,e,i,n){if(Array.isArray(t))for(var s=0;s=0;s--)this.data.shapes[s].collisionMask=r;else n.collisionMask=r},adjustCenterOfMass:function(){this.data.adjustCenterOfMass(),this.shapeChanged()},getVelocityAtPoint:function(t,e){return this.data.getVelocityAtPoint(t,e)},applyDamping:function(t){this.data.applyDamping(t)},applyImpulse:function(t,e,i){this.data.applyImpulse(t,[this.world.pxmi(e),this.world.pxmi(i)])},applyImpulseLocal:function(t,e,i){this.data.applyImpulseLocal(t,[this.world.pxmi(e),this.world.pxmi(i)])},applyForce:function(t,e,i){this.data.applyForce(t,[this.world.pxmi(e),this.world.pxmi(i)])},setZeroForce:function(){this.data.setZeroForce()},setZeroRotation:function(){this.data.angularVelocity=0},setZeroVelocity:function(){this.data.velocity[0]=0,this.data.velocity[1]=0},setZeroDamping:function(){this.data.damping=0,this.data.angularDamping=0},toLocalFrame:function(t,e){return this.data.toLocalFrame(t,e)},toWorldFrame:function(t,e){return this.data.toWorldFrame(t,e)},rotateLeft:function(t){this.data.angularVelocity=this.world.pxm(-t)},rotateRight:function(t){this.data.angularVelocity=this.world.pxm(t)},moveForward:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.velocity[0]=e*Math.cos(i),this.data.velocity[1]=e*Math.sin(i)},moveBackward:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.velocity[0]=-e*Math.cos(i),this.data.velocity[1]=-e*Math.sin(i)},thrust:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.force[0]+=e*Math.cos(i),this.data.force[1]+=e*Math.sin(i)},thrustLeft:function(t){var e=this.world.pxmi(-t),i=this.data.angle;this.data.force[0]+=e*Math.cos(i),this.data.force[1]+=e*Math.sin(i)},thrustRight:function(t){var e=this.world.pxmi(-t),i=this.data.angle;this.data.force[0]-=e*Math.cos(i),this.data.force[1]-=e*Math.sin(i)},reverse:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.force[0]-=e*Math.cos(i),this.data.force[1]-=e*Math.sin(i)},moveLeft:function(t){this.data.velocity[0]=this.world.pxmi(-t)},moveRight:function(t){this.data.velocity[0]=this.world.pxmi(t)},moveUp:function(t){this.data.velocity[1]=this.world.pxmi(-t)},moveDown:function(t){this.data.velocity[1]=this.world.pxmi(t)},preUpdate:function(){this.dirty=!0,this.removeNextStep&&(this.removeFromWorld(),this.removeNextStep=!1)},postUpdate:function(){this.sprite.x=this.world.mpxi(this.data.position[0])+this.offset.x,this.sprite.y=this.world.mpxi(this.data.position[1])+this.offset.y,this.fixedRotation||(this.sprite.rotation=this.data.angle),this.debugBody&&this.debugBody.updateSpriteTransform(),this.dirty=!1},reset:function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1),this.setZeroForce(),this.setZeroVelocity(),this.setZeroRotation(),i&&this.setZeroDamping(),n&&(this.mass=1),this.x=t,this.y=e},addToWorld:function(){if(this.game.physics.p2._toRemove)for(var t=0;t=0;i--)this.data.shapes[i].material=t;else e.material=t},shapeChanged:function(){this.debugBody&&this.debugBody.draw()},addPhaserPolygon:function(t,e){for(var i=this.game.cache.getPhysicsData(t,e),n=[],s=0;s * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.BodyDebug=function(t,e,i){s.Group.call(this,t);var n={pixelsPerLengthUnit:t.physics.p2.mpx(1),debugPolygons:!1,lineWidth:1,alpha:.5};this.settings=Object.assign(n,i),this.ppu=this.settings.pixelsPerLengthUnit,this.ppu=-1*this.ppu,this.body=e,this.canvas=new s.Graphics(t),this.canvas.alpha=this.settings.alpha,this.add(this.canvas),this.draw(),this.updateSpriteTransform()},s.Physics.P2.BodyDebug.prototype=Object.create(s.Group.prototype),s.Physics.P2.BodyDebug.prototype.constructor=s.Physics.P2.BodyDebug,Object.assign(s.Physics.P2.BodyDebug.prototype,{updateSpriteTransform:function(){this.position.x=this.body.position[0]*this.ppu,this.position.y=this.body.position[1]*this.ppu,this.rotation=this.body.angle},draw:function(){var t,e,i,n,s,r,o,a,h,l,u,c,d,p;if(o=this.body,(h=this.canvas).clear(),i=parseInt(this.randomPastelHex(),16),16711680,r=this.lineWidth,o instanceof p2.Body&&o.shapes.length){var f=o.shapes.length;for(n=0;n!==f;){if(a=(e=o.shapes[n]).position||0,t=e.angle||0,e instanceof p2.Circle)this.drawCircle(h,a[0]*this.ppu,a[1]*this.ppu,t,e.radius*this.ppu,i,r);else if(e instanceof p2.Capsule)this.drawCapsule(h,a[0]*this.ppu,a[1]*this.ppu,t,e.length*this.ppu,e.radius*this.ppu,16711680,i,r);else if(e instanceof p2.Plane)this.drawPlane(h,a[0]*this.ppu,-a[1]*this.ppu,i,16711680,5*r,10*r,10*r,100*this.ppu,t);else if(e instanceof p2.Line)this.drawLine(h,e.length*this.ppu,16711680,r);else if(e instanceof p2.Box)this.drawRectangle(h,a[0]*this.ppu,a[1]*this.ppu,t,e.width*this.ppu,e.height*this.ppu,16711680,i,r);else if(e instanceof p2.Convex){for(u=[],c=p2.vec2.create(),s=d=0,p=e.vertices.length;p>=0?dp;s=p>=0?++d:--d)l=e.vertices[s],p2.vec2.rotate(c,l,t),u.push([(c[0]+a[0])*this.ppu,-(c[1]+a[1])*this.ppu]);this.drawConvex(h,u,e.triangles,16711680,i,r,this.settings.debugPolygons,[a[0]*this.ppu,-a[1]*this.ppu])}n++}}},drawRectangle:function(t,e,i,n,s,r,o,a,h){void 0===h&&(h=1),void 0===o&&(o=0),t.lineStyle(h,o,1),t.beginFill(a),t.drawRect(e-s/2,i-r/2,s,r)},drawCircle:function(t,e,i,n,s,r,o){void 0===o&&(o=1),void 0===r&&(r=16777215),t.lineStyle(o,0,1),t.beginFill(r,1),t.drawCircle(e,i,2*-s),t.endFill(),t.moveTo(e,i),t.lineTo(e+s*Math.cos(-n),i+s*Math.sin(-n))},drawLine:function(t,e,i,n){void 0===n&&(n=1),void 0===i&&(i=0),t.lineStyle(5*n,i,1),t.moveTo(-e/2,0),t.lineTo(e/2,0)},drawConvex:function(t,e,i,n,s,r,o,a){var h,l,u,c,d,p,f,g,m,y,v;if(void 0===r&&(r=1),void 0===n&&(n=0),o){for(h=[16711680,65280,255],l=0;l!==e.length+1;)c=e[l%e.length],d=e[(l+1)%e.length],f=c[0],y=c[1],g=d[0],v=d[1],t.lineStyle(r,h[l%h.length],1),t.moveTo(f,-y),t.lineTo(g,-v),t.drawCircle(f,-y,2*r),l++;return t.lineStyle(r,0,1),t.drawCircle(a[0],a[1],2*r)}for(t.lineStyle(r,n,1),t.beginFill(s),l=0;l!==e.length;)p=(u=e[l])[0],m=u[1],0===l?t.moveTo(p,-m):t.lineTo(p,-m),l++;if(t.endFill(),e.length>2)return t.moveTo(e[e.length-1][0],-e[e.length-1][1]),t.lineTo(e[0][0],-e[0][1])},drawPath:function(t,e,i,n,s){var r,o,a,h,l,u,c,d,p,f,g;for(void 0===s&&(s=1),void 0===i&&(i=0),t.lineStyle(s,i,1),"number"==typeof n&&t.beginFill(n),o=null,a=null,r=0;r2&&"number"==typeof n&&(t.moveTo(e[e.length-1][0],e[e.length-1][1]),t.lineTo(e[0][0],e[0][1]))},drawPlane:function(t,e,i,n,s,r,o,a,h,l){var u,c;void 0===r&&(r=1),void 0===n&&(n=16777215),t.lineStyle(r,s,11),t.beginFill(n),t.moveTo(e,-i),u=e+Math.cos(l)*this.game.width,c=i+Math.sin(l)*this.game.height,t.lineTo(u,-c),t.moveTo(e,-i),u=e+Math.cos(l)*-this.game.width,c=i+Math.sin(l)*-this.game.height,t.lineTo(u,-c)},drawCapsule:function(t,e,i,n,s,r,o,a,h){void 0===h&&(h=1),void 0===o&&(o=0),t.lineStyle(h,o,1);var l=Math.cos(n),u=Math.sin(n);t.beginFill(a,1),t.drawCircle(-s/2*l+e,-s/2*u+i,2*-r),t.drawCircle(s/2*l+e,s/2*u+i,2*-r),t.endFill(),t.lineStyle(h,o,0),t.beginFill(a,1),t.moveTo(-s/2*l+r*u+e,-s/2*u+r*l+i),t.lineTo(s/2*l+r*u+e,s/2*u+r*l+i),t.lineTo(s/2*l-r*u+e,s/2*u-r*l+i),t.lineTo(-s/2*l-r*u+e,-s/2*u-r*l+i),t.endFill(),t.lineStyle(h,o,1),t.moveTo(-s/2*l+r*u+e,-s/2*u+r*l+i),t.lineTo(s/2*l+r*u+e,s/2*u+r*l+i),t.moveTo(-s/2*l-r*u+e,-s/2*u-r*l+i),t.lineTo(s/2*l-r*u+e,s/2*u-r*l+i)},randomPastelHex:function(){var t,e,i,n;return i=[255,255,255],n=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),t=Math.floor(256*Math.random()),n=Math.floor((n+3*i[0])/4),e=Math.floor((e+3*i[1])/4),t=Math.floor((t+3*i[2])/4),this.rgbToHex(n,e,t)},rgbToHex:function(t,e,i){return this.componentToHex(t)+this.componentToHex(e)+this.componentToHex(i)},componentToHex:function(t){var e;return 2===(e=t.toString(16)).length?e:e+"0"}}), +n.Physics.P2.BodyDebug=function(t,e,i){n.Group.call(this,t);var s={pixelsPerLengthUnit:t.physics.p2.mpx(1),debugPolygons:!1,lineWidth:1,alpha:.5};this.settings=Object.assign(s,i),this.ppu=this.settings.pixelsPerLengthUnit,this.ppu=-1*this.ppu,this.body=e,this.canvas=new n.Graphics(t),this.canvas.alpha=this.settings.alpha,this.add(this.canvas),this.draw(),this.updateSpriteTransform()},n.Physics.P2.BodyDebug.prototype=Object.create(n.Group.prototype),n.Physics.P2.BodyDebug.prototype.constructor=n.Physics.P2.BodyDebug,Object.assign(n.Physics.P2.BodyDebug.prototype,{updateSpriteTransform:function(){this.position.x=this.body.position[0]*this.ppu,this.position.y=this.body.position[1]*this.ppu,this.rotation=this.body.angle},draw:function(){var t,e,i,n,s,r,o,a,h,l,c,u,d,p,f;if(a=this.body,(l=this.canvas).clear(),i=parseInt(this.randomPastelHex(),16),r=16711680,o=this.lineWidth,a instanceof p2.Body&&a.shapes.length){var g=a.shapes.length;for(n=0;n!==g;){if(h=(e=a.shapes[n]).position||0,t=e.angle||0,e instanceof p2.Circle)this.drawCircle(l,h[0]*this.ppu,h[1]*this.ppu,t,e.radius*this.ppu,i,o);else if(e instanceof p2.Capsule)this.drawCapsule(l,h[0]*this.ppu,h[1]*this.ppu,t,e.length*this.ppu,e.radius*this.ppu,r,i,o);else if(e instanceof p2.Plane)this.drawPlane(l,h[0]*this.ppu,-h[1]*this.ppu,i,r,5*o,10*o,10*o,100*this.ppu,t);else if(e instanceof p2.Line)this.drawLine(l,e.length*this.ppu,r,o);else if(e instanceof p2.Box)this.drawRectangle(l,h[0]*this.ppu,h[1]*this.ppu,t,e.width*this.ppu,e.height*this.ppu,r,i,o);else if(e instanceof p2.Convex){for(u=[],d=p2.vec2.create(),s=p=0,f=e.vertices.length;f>=0?pf;s=f>=0?++p:--p)c=e.vertices[s],p2.vec2.rotate(d,c,t),u.push([(d[0]+h[0])*this.ppu,-(d[1]+h[1])*this.ppu]);this.drawConvex(l,u,e.triangles,r,i,o,this.settings.debugPolygons,[h[0]*this.ppu,-h[1]*this.ppu])}n++}}},drawRectangle:function(t,e,i,n,s,r,o,a,h){void 0===h&&(h=1),void 0===o&&(o=0),t.lineStyle(h,o,1),t.beginFill(a),t.drawRect(e-s/2,i-r/2,s,r)},drawCircle:function(t,e,i,n,s,r,o){void 0===o&&(o=1),void 0===r&&(r=16777215),t.lineStyle(o,0,1),t.beginFill(r,1),t.drawCircle(e,i,2*-s),t.endFill(),t.moveTo(e,i),t.lineTo(e+s*Math.cos(-n),i+s*Math.sin(-n))},drawLine:function(t,e,i,n){void 0===n&&(n=1),void 0===i&&(i=0),t.lineStyle(5*n,i,1),t.moveTo(-e/2,0),t.lineTo(e/2,0)},drawConvex:function(t,e,i,n,s,r,o,a){var h,l,c,u,d,p,f,g,m,y,v;if(void 0===r&&(r=1),void 0===n&&(n=0),o){for(h=[16711680,65280,255],l=0;l!==e.length+1;)u=e[l%e.length],d=e[(l+1)%e.length],f=u[0],y=u[1],g=d[0],v=d[1],t.lineStyle(r,h[l%h.length],1),t.moveTo(f,-y),t.lineTo(g,-v),t.drawCircle(f,-y,2*r),l++;return t.lineStyle(r,0,1),t.drawCircle(a[0],a[1],2*r)}for(t.lineStyle(r,n,1),t.beginFill(s),l=0;l!==e.length;)p=(c=e[l])[0],m=c[1],0===l?t.moveTo(p,-m):t.lineTo(p,-m),l++;if(t.endFill(),e.length>2)return t.moveTo(e[e.length-1][0],-e[e.length-1][1]),t.lineTo(e[0][0],-e[0][1])},drawPath:function(t,e,i,n,s){var r,o,a,h,l,c,u,d,p,f,g;for(void 0===s&&(s=1),void 0===i&&(i=0),t.lineStyle(s,i,1),"number"==typeof n&&t.beginFill(n),o=null,a=null,r=0;r2&&"number"==typeof n&&(t.moveTo(e[e.length-1][0],e[e.length-1][1]),t.lineTo(e[0][0],e[0][1]))},drawPlane:function(t,e,i,n,s,r,o,a,h,l){var c,u;void 0===r&&(r=1),void 0===n&&(n=16777215),t.lineStyle(r,s,11),t.beginFill(n),t.moveTo(e,-i),c=e+Math.cos(l)*this.game.width,u=i+Math.sin(l)*this.game.height,t.lineTo(c,-u),t.moveTo(e,-i),c=e+Math.cos(l)*-this.game.width,u=i+Math.sin(l)*-this.game.height,t.lineTo(c,-u)},drawCapsule:function(t,e,i,n,s,r,o,a,h){void 0===h&&(h=1),void 0===o&&(o=0),t.lineStyle(h,o,1);var l=Math.cos(n),c=Math.sin(n);t.beginFill(a,1),t.drawCircle(-s/2*l+e,-s/2*c+i,2*-r),t.drawCircle(s/2*l+e,s/2*c+i,2*-r),t.endFill(),t.lineStyle(h,o,0),t.beginFill(a,1),t.moveTo(-s/2*l+r*c+e,-s/2*c+r*l+i),t.lineTo(s/2*l+r*c+e,s/2*c+r*l+i),t.lineTo(s/2*l-r*c+e,s/2*c-r*l+i),t.lineTo(-s/2*l-r*c+e,-s/2*c-r*l+i),t.endFill(),t.lineStyle(h,o,1),t.moveTo(-s/2*l+r*c+e,-s/2*c+r*l+i),t.lineTo(s/2*l+r*c+e,s/2*c+r*l+i),t.moveTo(-s/2*l-r*c+e,-s/2*c-r*l+i),t.lineTo(s/2*l-r*c+e,s/2*c-r*l+i)},randomPastelHex:function(){var t,e,i,n;return i=[255,255,255],n=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),t=Math.floor(256*Math.random()),n=Math.floor((n+3*i[0])/4),e=Math.floor((e+3*i[1])/4),t=Math.floor((t+3*i[2])/4),this.rgbToHex(n,e,t)},rgbToHex:function(t,e,i){return this.componentToHex(t)+this.componentToHex(e)+this.componentToHex(i)},componentToHex:function(t){var e;return 2===(e=t.toString(16)).length?e:e+"0"}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.Spring=function(t,e,i,n,s,r,o,a,h,l){this.game=t.game,this.world=t,void 0===n&&(n=1),void 0===s&&(s=100),void 0===r&&(r=1);var u={restLength:n=t.pxm(n),stiffness:s,damping:r};null!=o&&(u.worldAnchorA=[t.pxm(o[0]),t.pxm(o[1])]),null!=a&&(u.worldAnchorB=[t.pxm(a[0]),t.pxm(a[1])]),null!=h&&(u.localAnchorA=[t.pxm(h[0]),t.pxm(h[1])]),null!=l&&(u.localAnchorB=[t.pxm(l[0]),t.pxm(l[1])]),this.data=new p2.LinearSpring(e,i,u),this.data.parent=this},s.Physics.P2.Spring.prototype.constructor=s.Physics.P2.Spring, +n.Physics.P2.Spring=function(t,e,i,n,s,r,o,a,h,l){this.game=t.game,this.world=t,void 0===n&&(n=1),void 0===s&&(s=100),void 0===r&&(r=1);var c={restLength:n=t.pxm(n),stiffness:s,damping:r};null!=o&&(c.worldAnchorA=[t.pxm(o[0]),t.pxm(o[1])]),null!=a&&(c.worldAnchorB=[t.pxm(a[0]),t.pxm(a[1])]),null!=h&&(c.localAnchorA=[t.pxm(h[0]),t.pxm(h[1])]),null!=l&&(c.localAnchorB=[t.pxm(l[0]),t.pxm(l[1])]),this.data=new p2.LinearSpring(e,i,c),this.data.parent=this},n.Physics.P2.Spring.prototype.constructor=n.Physics.P2.Spring, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.RotationalSpring=function(t,e,i,n,s,r){this.game=t.game,this.world=t,void 0===n&&(n=null),void 0===s&&(s=100),void 0===r&&(r=1),n&&(n=t.pxm(n));var o={restAngle:n,stiffness:s,damping:r};this.data=new p2.RotationalSpring(e,i,o),this.data.parent=this},s.Physics.P2.Spring.prototype.constructor=s.Physics.P2.Spring, +n.Physics.P2.RotationalSpring=function(t,e,i,n,s,r){this.game=t.game,this.world=t,void 0===n&&(n=null),void 0===s&&(s=100),void 0===r&&(r=1),n&&(n=t.pxm(n));var o={restAngle:n,stiffness:s,damping:r};this.data=new p2.RotationalSpring(e,i,o),this.data.parent=this},n.Physics.P2.Spring.prototype.constructor=n.Physics.P2.Spring, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.Material=function(t){this.name=t,p2.Material.call(this)},s.Physics.P2.Material.prototype=Object.create(p2.Material.prototype),s.Physics.P2.Material.prototype.constructor=s.Physics.P2.Material, +n.Physics.P2.Material=function(t){this.name=t,p2.Material.call(this)},n.Physics.P2.Material.prototype=Object.create(p2.Material.prototype),n.Physics.P2.Material.prototype.constructor=n.Physics.P2.Material, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.ContactMaterial=function(t,e,i){p2.ContactMaterial.call(this,t,e,i)},s.Physics.P2.ContactMaterial.prototype=Object.create(p2.ContactMaterial.prototype),s.Physics.P2.ContactMaterial.prototype.constructor=s.Physics.P2.ContactMaterial, +n.Physics.P2.ContactMaterial=function(t,e,i){p2.ContactMaterial.call(this,t,e,i)},n.Physics.P2.ContactMaterial.prototype=Object.create(p2.ContactMaterial.prototype),n.Physics.P2.ContactMaterial.prototype.constructor=n.Physics.P2.ContactMaterial, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.CollisionGroup=function(t){this.mask=t}, +n.Physics.P2.CollisionGroup=function(t){this.mask=t}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.DistanceConstraint=function(t,e,i,n,s,r,o){void 0===n&&(n=100),void 0===s&&(s=[0,0]),void 0===r&&(r=[0,0]),void 0===o&&(o=Number.MAX_VALUE),this.game=t.game,this.world=t;var a={distance:n=t.pxm(n),localAnchorA:s=[t.pxmi(s[0]),t.pxmi(s[1])],localAnchorB:r=[t.pxmi(r[0]),t.pxmi(r[1])],maxForce:o};p2.DistanceConstraint.call(this,e,i,a)},s.Physics.P2.DistanceConstraint.prototype=Object.create(p2.DistanceConstraint.prototype),s.Physics.P2.DistanceConstraint.prototype.constructor=s.Physics.P2.DistanceConstraint, +n.Physics.P2.DistanceConstraint=function(t,e,i,n,s,r,o){void 0===n&&(n=100),void 0===s&&(s=[0,0]),void 0===r&&(r=[0,0]),void 0===o&&(o=Number.MAX_VALUE),this.game=t.game,this.world=t;var a={distance:n=t.pxm(n),localAnchorA:s=[t.pxmi(s[0]),t.pxmi(s[1])],localAnchorB:r=[t.pxmi(r[0]),t.pxmi(r[1])],maxForce:o};p2.DistanceConstraint.call(this,e,i,a)},n.Physics.P2.DistanceConstraint.prototype=Object.create(p2.DistanceConstraint.prototype),n.Physics.P2.DistanceConstraint.prototype.constructor=n.Physics.P2.DistanceConstraint, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.GearConstraint=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=1),this.game=t.game,this.world=t;var r={angle:n,ratio:s};p2.GearConstraint.call(this,e,i,r)},s.Physics.P2.GearConstraint.prototype=Object.create(p2.GearConstraint.prototype),s.Physics.P2.GearConstraint.prototype.constructor=s.Physics.P2.GearConstraint, +n.Physics.P2.GearConstraint=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=1),this.game=t.game,this.world=t;var r={angle:n,ratio:s};p2.GearConstraint.call(this,e,i,r)},n.Physics.P2.GearConstraint.prototype=Object.create(p2.GearConstraint.prototype),n.Physics.P2.GearConstraint.prototype.constructor=n.Physics.P2.GearConstraint, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.LockConstraint=function(t,e,i,n,s,r){void 0===n&&(n=[0,0]),void 0===s&&(s=0),void 0===r&&(r=Number.MAX_VALUE),this.game=t.game,this.world=t;var o={localOffsetB:n=[t.pxm(n[0]),t.pxm(n[1])],localAngleB:s,maxForce:r};p2.LockConstraint.call(this,e,i,o)},s.Physics.P2.LockConstraint.prototype=Object.create(p2.LockConstraint.prototype),s.Physics.P2.LockConstraint.prototype.constructor=s.Physics.P2.LockConstraint, +n.Physics.P2.LockConstraint=function(t,e,i,n,s,r){void 0===n&&(n=[0,0]),void 0===s&&(s=0),void 0===r&&(r=Number.MAX_VALUE),this.game=t.game,this.world=t;var o={localOffsetB:n=[t.pxm(n[0]),t.pxm(n[1])],localAngleB:s,maxForce:r};p2.LockConstraint.call(this,e,i,o)},n.Physics.P2.LockConstraint.prototype=Object.create(p2.LockConstraint.prototype),n.Physics.P2.LockConstraint.prototype.constructor=n.Physics.P2.LockConstraint, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.PrismaticConstraint=function(t,e,i,n,s,r,o,a){void 0===n&&(n=!0),void 0===s&&(s=[0,0]),void 0===r&&(r=[0,0]),void 0===o&&(o=[0,0]),void 0===a&&(a=Number.MAX_VALUE),this.game=t.game,this.world=t;var h={localAnchorA:s=[t.pxmi(s[0]),t.pxmi(s[1])],localAnchorB:r=[t.pxmi(r[0]),t.pxmi(r[1])],localAxisA:o,maxForce:a,disableRotationalLock:!n};p2.PrismaticConstraint.call(this,e,i,h)},s.Physics.P2.PrismaticConstraint.prototype=Object.create(p2.PrismaticConstraint.prototype),s.Physics.P2.PrismaticConstraint.prototype.constructor=s.Physics.P2.PrismaticConstraint, +n.Physics.P2.PrismaticConstraint=function(t,e,i,n,s,r,o,a){void 0===n&&(n=!0),void 0===s&&(s=[0,0]),void 0===r&&(r=[0,0]),void 0===o&&(o=[0,0]),void 0===a&&(a=Number.MAX_VALUE),this.game=t.game,this.world=t;var h={localAnchorA:s=[t.pxmi(s[0]),t.pxmi(s[1])],localAnchorB:r=[t.pxmi(r[0]),t.pxmi(r[1])],localAxisA:o,maxForce:a,disableRotationalLock:!n};p2.PrismaticConstraint.call(this,e,i,h)},n.Physics.P2.PrismaticConstraint.prototype=Object.create(p2.PrismaticConstraint.prototype),n.Physics.P2.PrismaticConstraint.prototype.constructor=n.Physics.P2.PrismaticConstraint, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Physics.P2.RevoluteConstraint=function(t,e,i,n,s,r,o){void 0===r&&(r=Number.MAX_VALUE),void 0===o&&(o=null),this.game=t.game,this.world=t,i=[t.pxmi(i[0]),t.pxmi(i[1])],s=[t.pxmi(s[0]),t.pxmi(s[1])],o&&(o=[t.pxmi(o[0]),t.pxmi(o[1])]);var a={worldPivot:o,localPivotA:i,localPivotB:s,maxForce:r};p2.RevoluteConstraint.call(this,e,n,a)},s.Physics.P2.RevoluteConstraint.prototype=Object.create(p2.RevoluteConstraint.prototype),s.Physics.P2.RevoluteConstraint.prototype.constructor=s.Physics.P2.RevoluteConstraint, +n.Physics.P2.RevoluteConstraint=function(t,e,i,n,s,r,o){void 0===r&&(r=Number.MAX_VALUE),void 0===o&&(o=null),this.game=t.game,this.world=t,i=[t.pxmi(i[0]),t.pxmi(i[1])],s=[t.pxmi(s[0]),t.pxmi(s[1])],o&&(o=[t.pxmi(o[0]),t.pxmi(o[1])]);var a={worldPivot:o,localPivotA:i,localPivotB:s,maxForce:r};p2.RevoluteConstraint.call(this,e,n,a)},n.Physics.P2.RevoluteConstraint.prototype=Object.create(p2.RevoluteConstraint.prototype),n.Physics.P2.RevoluteConstraint.prototype.constructor=n.Physics.P2.RevoluteConstraint, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.ImageCollection=function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|n,this.imageMargin=0|s,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},s.ImageCollection.prototype={containsImageIndex:function(t){return t>=this.firstgid&&t=this.firstgid&&t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Tile=function(t,e,i,n,s,r){this.layer=t,this.index=e,this.x=i,this.y=n,this.rotation=0,this.flipped=!1,this.worldX=i*s,this.worldY=n*r,this.width=s,this.height=r,this.centerX=Math.abs(s/2),this.centerY=Math.abs(r/2),this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.debug=!1},s.Tile.prototype={containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},intersects:function(t,e,i,n){return!(i<=this.worldX)&&(!(n<=this.worldY)&&(!(t>=this.worldX+this.width)&&!(e>=this.worldY+this.height)))},setCollisionCallback:function(t,e){this.collisionCallback=t,this.collisionCallbackContext=e},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(t,e,i,n){this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(t,e){return t&&e?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:t?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:!!e&&(this.faceTop||this.faceBottom||this.faceLeft||this.faceRight)},copy:function(t){this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext}},s.Tile.prototype.constructor=s.Tile,Object.defineProperty(s.Tile.prototype,"collides",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(s.Tile.prototype,"canCollide",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(s.Tile.prototype,"left",{get:function(){return this.worldX}}),Object.defineProperty(s.Tile.prototype,"right",{get:function(){return this.worldX+this.width}}),Object.defineProperty(s.Tile.prototype,"top",{get:function(){return this.worldY}}),Object.defineProperty(s.Tile.prototype,"bottom",{get:function(){return this.worldY+this.height}}), +n.Tile=function(t,e,i,n,s,r){this.layer=t,this.index=e,this.x=i,this.y=n,this.rotation=0,this.flipped=!1,this.worldX=i*s,this.worldY=n*r,this.width=s,this.height=r,this.centerX=Math.abs(s/2),this.centerY=Math.abs(r/2),this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.debug=!1},n.Tile.prototype={containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},intersects:function(t,e,i,n){return!(i<=this.worldX)&&(!(n<=this.worldY)&&(!(t>=this.worldX+this.width)&&!(e>=this.worldY+this.height)))},setCollisionCallback:function(t,e){this.collisionCallback=t,this.collisionCallbackContext=e},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(t,e,i,n){this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(t,e){return t&&e?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:t?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:!!e&&(this.faceTop||this.faceBottom||this.faceLeft||this.faceRight)},copy:function(t){this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext}},n.Tile.prototype.constructor=n.Tile,Object.defineProperty(n.Tile.prototype,"collides",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(n.Tile.prototype,"canCollide",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(n.Tile.prototype,"left",{get:function(){return this.worldX}}),Object.defineProperty(n.Tile.prototype,"right",{get:function(){return this.worldX+this.width}}),Object.defineProperty(n.Tile.prototype,"top",{get:function(){return this.worldY}}),Object.defineProperty(n.Tile.prototype,"bottom",{get:function(){return this.worldY+this.height}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Tilemap=function(t,e,i,n,r,o){this.game=t,this.key=e;var a=s.TilemapParser.parse(this.game,e,i,n,r,o);null!==a&&(this.width=a.width,this.height=a.height,this.tileWidth=a.tileWidth,this.tileHeight=a.tileHeight,this.orientation=a.orientation,this.format=a.format,this.version=a.version,this.properties=a.properties,this.widthInPixels=a.widthInPixels,this.heightInPixels=a.heightInPixels,this.layers=a.layers,this.tilesets=a.tilesets,this.imagecollections=a.imagecollections,this.tiles=a.tiles,this.objects=a.objects,this.collideIndexes=[],this.collision=a.collision,this.images=a.images,this.enableDebug=!1,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},s.Tilemap.CSV=0,s.Tilemap.TILED_JSON=1,s.Tilemap.NORTH=0,s.Tilemap.EAST=1,s.Tilemap.SOUTH=2,s.Tilemap.WEST=3,s.Tilemap.prototype={create:function(t,e,i,n,s,r){return void 0===r&&(r=this.game.world),this.width=e,this.height=i,this.setTileSize(n,s),this.layers.length=0,this.createBlankLayer(t,e,i,n,s,r)},setTileSize:function(t,e){this.tileWidth=t,this.tileHeight=e,this.widthInPixels=this.width*t,this.heightInPixels=this.height*e},addTilesetImage:function(t,e,i,n,r,o,a){if(void 0===t)return null;void 0===i&&(i=this.tileWidth),void 0===n&&(n=this.tileHeight),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),0===i&&(i=32),0===n&&(n=32);var h=null;if(null==e&&(e=t),e instanceof s.BitmapData)h=e.canvas;else{if(!this.game.cache.checkImageKey(e))return console.warn('Phaser.Tilemap.addTilesetImage: Invalid image key given: "'+e+'"'),null;h=this.game.cache.getImage(e)}var l=this.getTilesetIndex(t);if(null===l&&this.format===s.Tilemap.TILED_JSON)return console.warn('Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "'+t+'"'),console.log("Tilesets: ",this.tilesets),null;if(this.tilesets[l])return this.tilesets[l].setImage(h),this.tilesets[l];var u=new s.Tileset(t,a,i,n,r,o,{});u.setImage(h),this.tilesets.push(u);for(var c=this.tilesets.length-1,d=r,p=r,f=0,g=0,m=0,y=a;y1)for(c=0;cthis.layers.length)return console.warn('Tilemap.createLayer: Invalid layer ID given: "'+t+'"'),void console.log("Layers: ",this.layers);void 0===e||e<=0?e=Math.min(this.game.width,this.layers[r].widthInPixels):e>this.game.width&&(e=this.game.width),void 0===i||i<=0?i=Math.min(this.game.height,this.layers[r].heightInPixels):i>this.game.height&&(i=this.game.height),this.enableDebug&&(console.group("Tilemap.createLayer"),console.log("Name:",this.layers[r].name),console.log("Size:",e,"x",i),console.log("Tileset:",this.tilesets[0].name,"index:",r));var o=n.add(new s.TilemapLayer(this.game,this,r,e,i));return this.enableDebug&&console.groupEnd(),o},createBlankLayer:function(t,e,i,n,r,o){if(void 0===o&&(o=this.game.world),null===this.getLayerIndex(t)){for(var a,h={name:t,x:0,y:0,width:e,height:i,widthInPixels:e*n,heightInPixels:i*r,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:null},l=[],u=0;uthis.game.width&&(d=this.game.width),p>this.game.height&&(p=this.game.height),(l=new s.TilemapLayer(this.game,this,this.layers.length-1,d,p)).name=t,o.add(l)}console.warn("Tilemap.createBlankLayer: Layer with matching name already exists: "+t)},getIndex:function(t,e){for(var i=0;ie)){for(var r=t;r<=e;r++)this.setCollisionByIndex(r,i,n,!1);s&&this.calculateFaces(n)}},setCollisionByExclusion:function(t,e,i,n){void 0===e&&(e=!0),void 0===n&&(n=!0),i=this.getLayer(i);for(var s=0,r=this.tiles.length;s-1&&this.collideIndexes.splice(s,1)}for(var r=0;r0?this.layers[t].data[i-1][e]:null},getTileBelow:function(t,e,i){return i0?this.layers[t].data[i][e-1]:null},getTileRight:function(t,e,i){return e-1},removeTile:function(t,e,i){if(i=this.getLayer(i),t>=0&&t=0&&e=0&&e=0&&i-1?this.layers[n].data[i][e].setCollision(!0,!0,!0,!0):this.layers[n].data[i][e].resetCollision(),this.layers[n].dirty=!0,this.calculateFaces(n),this.layers[n].data[i][e]):null);var r},putTileWorldXY:function(t,e,i,n,s,r){return r=this.getLayer(r),e=this.game.math.snapToFloor(e,n)/n,i=this.game.math.snapToFloor(i,s)/s,this.putTile(t,e,i,r)},searchTileIndex:function(t,e,i,n,s){void 0===e&&(e=0),void 0===i&&(i=!1),n=this.getLayer(n);var r,o,a=0,h=this.layers[n].height,l=this.layers[n].width,u=this.layers[n].data;if(s)var c=[];if(i)for(var d=h-1;d>=0;d--){r=u[d];for(var p=l-1;p>=0;p--)if((o=r[p]).index===t)if(a>=e){if(!s)return o;c.push(o)}else a++}else for(d=0;d=e){if(!s)return o;c.push(o)}else a++}return s?c:null},getTile:function(t,e,i,n){return void 0===n&&(n=!1),i=this.getLayer(i),t>=0&&t=0&&ethis.layers[s].width&&(i=this.layers[s].width),n>this.layers[s].height&&(n=this.layers[s].height),this._results.length=0,this._results.push({x:t,y:e,width:i,height:n,layer:s});for(var r=e;r1?this.debugMap[this.layers[this.currentLayer].data[i][n]]?e.push("background: "+this.debugMap[this.layers[this.currentLayer].data[i][n]]):e.push("background: #ffffff"):e.push("background: rgb(0, 0, 0)");t+="\n"}e[0]=t,console.log.apply(console,e)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},s.Tilemap.prototype.constructor=s.Tilemap,Object.defineProperty(s.Tilemap.prototype,"layer",{get:function(){return this.layers[this.currentLayer]},set:function(t){t!==this.currentLayer&&this.setLayer(t)}}), +n.Tilemap=function(t,e,i,s,r,o){this.game=t,this.key=e;var a=n.TilemapParser.parse(this.game,e,i,s,r,o);null!==a&&(this.width=a.width,this.height=a.height,this.tileWidth=a.tileWidth,this.tileHeight=a.tileHeight,this.orientation=a.orientation,this.format=a.format,this.version=a.version,this.properties=a.properties,this.widthInPixels=a.widthInPixels,this.heightInPixels=a.heightInPixels,this.layers=a.layers,this.tilesets=a.tilesets,this.imagecollections=a.imagecollections,this.tiles=a.tiles,this.objects=a.objects,this.collideIndexes=[],this.collision=a.collision,this.images=a.images,this.enableDebug=!1,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},n.Tilemap.CSV=0,n.Tilemap.TILED_JSON=1,n.Tilemap.NORTH=0,n.Tilemap.EAST=1,n.Tilemap.SOUTH=2,n.Tilemap.WEST=3,n.Tilemap.prototype={create:function(t,e,i,n,s,r){return void 0===r&&(r=this.game.world),this.width=e,this.height=i,this.setTileSize(n,s),this.layers.length=0,this.createBlankLayer(t,e,i,n,s,r)},setTileSize:function(t,e){this.tileWidth=t,this.tileHeight=e,this.widthInPixels=this.width*t,this.heightInPixels=this.height*e},addTilesetImage:function(t,e,i,s,r,o,a){if(void 0===t)return null;void 0===i&&(i=this.tileWidth),void 0===s&&(s=this.tileHeight),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),0===i&&(i=32),0===s&&(s=32);var h=null;if(null==e&&(e=t),e instanceof n.BitmapData)h=e.canvas;else{if(!this.game.cache.checkImageKey(e))return console.warn('Phaser.Tilemap.addTilesetImage: Invalid image key given: "'+e+'"'),null;h=this.game.cache.getImage(e)}var l=this.getTilesetIndex(t);if(null===l&&this.format===n.Tilemap.TILED_JSON)return console.warn('Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "'+t+'"'),console.log("Tilesets: ",this.tilesets),null;if(this.tilesets[l])return this.tilesets[l].setImage(h),this.tilesets[l];var c=new n.Tileset(t,a,i,s,r,o,{});c.setImage(h),this.tilesets.push(c);for(var u=this.tilesets.length-1,d=r,p=r,f=0,g=0,m=0,y=a;y1)for(u=0;uthis.layers.length)return console.warn('Tilemap.createLayer: Invalid layer ID given: "'+t+'"'),void console.log("Layers: ",this.layers);void 0===e||e<=0?e=Math.min(this.game.width,this.layers[r].widthInPixels):e>this.game.width&&(e=this.game.width),void 0===i||i<=0?i=Math.min(this.game.height,this.layers[r].heightInPixels):i>this.game.height&&(i=this.game.height),this.enableDebug&&(console.group("Tilemap.createLayer"),console.log("Name:",this.layers[r].name),console.log("Size:",e,"x",i),console.log("Tileset:",this.tilesets[0].name,"index:",r));var o=s.add(new n.TilemapLayer(this.game,this,r,e,i));return this.enableDebug&&console.groupEnd(),o},createBlankLayer:function(t,e,i,s,r,o){if(void 0===o&&(o=this.game.world),null===this.getLayerIndex(t)){for(var a,h={name:t,x:0,y:0,width:e,height:i,widthInPixels:e*s,heightInPixels:i*r,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:null},l=[],c=0;cthis.game.width&&(d=this.game.width),p>this.game.height&&(p=this.game.height),(l=new n.TilemapLayer(this.game,this,this.layers.length-1,d,p)).name=t,o.add(l)}console.warn("Tilemap.createBlankLayer: Layer with matching name already exists: "+t)},getIndex:function(t,e){for(var i=0;ie)){for(var r=t;r<=e;r++)this.setCollisionByIndex(r,i,n,!1);s&&this.calculateFaces(n)}},setCollisionByExclusion:function(t,e,i,n){void 0===e&&(e=!0),void 0===n&&(n=!0),i=this.getLayer(i);for(var s=0,r=this.tiles.length;s-1&&this.collideIndexes.splice(s,1)}for(var r=0;r0?this.layers[t].data[i-1][e]:null},getTileBelow:function(t,e,i){return i0?this.layers[t].data[i][e-1]:null},getTileRight:function(t,e,i){return e-1},removeTile:function(t,e,i){if(i=this.getLayer(i),t>=0&&t=0&&e=0&&e=0&&i-1?this.layers[s].data[i][e].setCollision(!0,!0,!0,!0):this.layers[s].data[i][e].resetCollision(),this.layers[s].dirty=!0,this.calculateFaces(s),this.layers[s].data[i][e]):null);var r},putTileWorldXY:function(t,e,i,n,s,r){return r=this.getLayer(r),e=this.game.math.snapToFloor(e,n)/n,i=this.game.math.snapToFloor(i,s)/s,this.putTile(t,e,i,r)},searchTileIndex:function(t,e,i,n,s){void 0===e&&(e=0),void 0===i&&(i=!1),n=this.getLayer(n);var r,o,a=0,h=this.layers[n].height,l=this.layers[n].width,c=this.layers[n].data;if(s)var u=[];if(i)for(var d=h-1;d>=0;d--){r=c[d];for(var p=l-1;p>=0;p--)if((o=r[p]).index===t)if(a>=e){if(!s)return o;u.push(o)}else a++}else for(d=0;d=e){if(!s)return o;u.push(o)}else a++}return s?u:null},getTile:function(t,e,i,n){return void 0===n&&(n=!1),i=this.getLayer(i),t>=0&&t=0&&ethis.layers[s].width&&(i=this.layers[s].width),n>this.layers[s].height&&(n=this.layers[s].height),this._results.length=0,this._results.push({x:t,y:e,width:i,height:n,layer:s});for(var r=e;r1?this.debugMap[this.layers[this.currentLayer].data[i][n]]?e.push("background: "+this.debugMap[this.layers[this.currentLayer].data[i][n]]):e.push("background: #ffffff"):e.push("background: rgb(0, 0, 0)");t+="\n"}e[0]=t,console.log.apply(console,e)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},n.Tilemap.prototype.constructor=n.Tilemap,Object.defineProperty(n.Tilemap.prototype,"layer",{get:function(){return this.layers[this.currentLayer]},set:function(t){t!==this.currentLayer&&this.setLayer(t)}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.TilemapLayer=function(t,e,i,n,r){n|=0,r|=0,s.Sprite.call(this,t,0,0),this.map=e,this.index=i,this.layer=e.layers[i],this.canvas=s.CanvasPool.create(this,n,r),this.context=this.canvas.getContext("2d"),this.setTexture(new PIXI.Texture(new PIXI.BaseTexture(this.canvas,null,this.game.resolution))),this.type=s.TILEMAPLAYER,this.physicsType=s.TILEMAPLAYER,this.renderSettings={enableScrollDelta:!0,overdrawRatio:.2,copyCanvas:null},this.debug=!1,this.exists=!0,this.debugSettings={missingImageFill:"rgb(255,255,255)",debuggedTileOverfill:"rgba(0,255,0,0.4)",forceFullRedraw:!0,debugAlpha:.5,facingEdgeStroke:"rgba(0,255,0,1)",collidingTileOverfill:"rgba(0,255,0,0.2)"},this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this.rayStepRate=4,this._wrap=!1,this._mc={scrollX:0,scrollY:0,renderWidth:0,renderHeight:0,tileWidth:e.tileWidth,tileHeight:e.tileHeight,cw:e.tileWidth,ch:e.tileHeight,tilesets:[]},this._scrollX=0,this._scrollY=0,this.tileOffset=new s.Point(this.layer.offsetX||0,this.layer.offsetY||0),this._results=[],t.device.canvasBitBltShift||(this.renderSettings.copyCanvas=s.TilemapLayer.ensureSharedCopyCanvas()),this.fixedToCamera=!0},s.TilemapLayer.prototype=Object.create(s.Sprite.prototype),s.TilemapLayer.prototype.constructor=s.TilemapLayer,s.TilemapLayer.prototype.preUpdateCore=s.Component.Core.preUpdate,s.TilemapLayer.sharedCopyCanvas=null,s.TilemapLayer.ensureSharedCopyCanvas=function(){return this.sharedCopyCanvas||(this.sharedCopyCanvas=s.CanvasPool.create(this,2,2)),this.sharedCopyCanvas},s.TilemapLayer.prototype.preUpdate=function(){return this.preUpdateCore()},s.TilemapLayer.prototype.postUpdate=function(){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y},s.TilemapLayer.prototype._renderCanvas=function(t){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y,this.render(),PIXI.Sprite.prototype._renderCanvas.call(this,t)},s.TilemapLayer.prototype._renderWebGL=function(t){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y,this.render(),PIXI.Sprite.prototype._renderWebGL.call(this,t)},s.TilemapLayer.prototype.destroy=function(){s.CanvasPool.remove(this),s.Component.Destroy.prototype.destroy.call(this)},s.TilemapLayer.prototype.resize=function(t,e){this.canvas.width=t,this.canvas.height=e,this.texture.frame.resize(t,e),this.texture.width=t,this.texture.height=e,this.texture.crop.width=t,this.texture.crop.height=e,this.texture.baseTexture.width=t,this.texture.baseTexture.height=e,this.texture.baseTexture.dirty(),this.texture.requiresUpdate=!0,this.texture._updateUvs(),this.dirty=!0},s.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels*this.scale.x,this.layer.heightInPixels*this.scale.y)},s.TilemapLayer.prototype.getTileOffsetX=function(){return this.tileOffset.x||(this.fixedToCamera?0:this.position.x)},s.TilemapLayer.prototype.getTileOffsetY=function(){return this.tileOffset.y||(this.fixedToCamera?0:this.position.y)},s.TilemapLayer.prototype._fixX=function(t){return 1===this.scrollFactorX||0===this.scrollFactorX&&0===this.position.x?t:0===this.scrollFactorX&&0!==this.position.x?t-this.position.x:this._scrollX+(t-this._scrollX/this.scrollFactorX)},s.TilemapLayer.prototype._unfixX=function(t){return 1===this.scrollFactorX?t:this._scrollX/this.scrollFactorX+(t-this._scrollX)},s.TilemapLayer.prototype._fixY=function(t){return 1===this.scrollFactorY||0===this.scrollFactorY&&0===this.position.y?t:0===this.scrollFactorY&&0!==this.position.y?t-this.position.y:this._scrollY+(t-this._scrollY/this.scrollFactorY)},s.TilemapLayer.prototype._unfixY=function(t){return 1===this.scrollFactorY?t:this._scrollY/this.scrollFactorY+(t-this._scrollY)},s.TilemapLayer.prototype.getTileX=function(t){return Math.floor(this._fixX(t)/this._mc.tileWidth)},s.TilemapLayer.prototype.getTileY=function(t){return Math.floor(this._fixY(t)/this._mc.tileHeight)},s.TilemapLayer.prototype.getTileXY=function(t,e,i){return i.x=this.getTileX(t),i.y=this.getTileY(e),i},s.TilemapLayer.prototype.getRayCastTiles=function(t,e,i,n){e||(e=this.rayStepRate),void 0===i&&(i=!1),void 0===n&&(n=!1);var s=this.getTiles(t.x,t.y,t.width,t.height,i,n);if(0===s.length)return[];for(var r=t.coordinatesOnLine(e),o=[],a=0;a=0;m++,v--,f+=u){m>=h&&(m-=h);var w=this.layer.data[m];for(g=b,y=s-i,p=x;y>=0;g++,y--,p+=l){g>=a&&(g-=a);var _=w[g];if(_&&!(_.index<0)){var C=_.index,S=c[C];void 0===S&&(S=this.resolveTileset(C)),_.alpha===d||this.debug||(o.globalAlpha=_.alpha,d=_.alpha),S?_.rotation||_.flipped?(o.save(),o.translate(p+_.centerX,f+_.centerY),o.rotate(_.rotation),_.flipped&&o.scale(-1,1),S.draw(o,-_.centerX,-_.centerY,C),o.restore()):S.draw(o,p,f,C):this.debugSettings.missingImageFill&&(o.fillStyle=this.debugSettings.missingImageFill,o.fillRect(p,f,l,u)),_.debug&&this.debugSettings.debuggedTileOverfill&&(o.fillStyle=this.debugSettings.debuggedTileOverfill,o.fillRect(p,f,l,u))}}}},s.TilemapLayer.prototype.renderDeltaScroll=function(t,e){var i=this._mc.scrollX,n=this._mc.scrollY,s=this.canvas.width,r=this.canvas.height,o=this._mc.tileWidth,a=this._mc.tileHeight,h=0,l=-o,u=0,c=-a;if(t<0?(h=s+t,l=s-1):t>0&&(l=t),e<0?(u=r+e,c=r-1):e>0&&(c=e),this.shiftCanvas(this.context,t,e),h=Math.floor((h+i)/o),l=Math.floor((l+i)/o),u=Math.floor((u+n)/a),c=Math.floor((c+n)/a),h<=l){this.context.clearRect(h*o-i,0,(l-h+1)*o,r);var d=Math.floor((0+n)/a),p=Math.floor((r-1+n)/a);this.renderRegion(i,n,h,d,l,p)}if(u<=c){this.context.clearRect(0,u*a-n,s,(c-u+1)*a);var f=Math.floor((0+i)/o),g=Math.floor((s-1+i)/o);this.renderRegion(i,n,f,u,g,c)}},s.TilemapLayer.prototype.renderFull=function(){var t=this._mc.scrollX,e=this._mc.scrollY,i=this.canvas.width,n=this.canvas.height,s=this._mc.tileWidth,r=this._mc.tileHeight,o=Math.floor(t/s),a=Math.floor((i-1+t)/s),h=Math.floor(e/r),l=Math.floor((n-1+e)/r);this.context.clearRect(0,0,i,n),this.renderRegion(t,e,o,h,a,l)},s.TilemapLayer.prototype.render=function(){var t=!1;if(this.visible){(this.dirty||this.layer.dirty)&&(this.layer.dirty=!1,t=!0);var e=this.canvas.width,i=this.canvas.height,n=0|this._scrollX,s=0|this._scrollY,r=this._mc,o=r.scrollX-n,a=r.scrollY-s;if(t||0!==o||0!==a||r.renderWidth!==e||r.renderHeight!==i)return this.context.save(),r.scrollX=n,r.scrollY=s,r.renderWidth===e&&r.renderHeight===i||(r.renderWidth=e,r.renderHeight=i),this.debug&&(this.context.globalAlpha=this.debugSettings.debugAlpha,this.debugSettings.forceFullRedraw&&(t=!0)),!t&&this.renderSettings.enableScrollDelta&&Math.abs(o)+Math.abs(a)=0;n++,r--,e+=f){n>=d&&(n-=d);var C=this.layer.data[n];for(i=w,s=m-g,t=x;s>=0;i++,s--,t+=p){i>=c&&(i-=c);var S=C[i];!S||S.index<0||!S.collides||(this.debugSettings.collidingTileOverfill&&(h.fillStyle=this.debugSettings.collidingTileOverfill,h.fillRect(t,e,this._mc.cw,this._mc.ch)),this.debugSettings.facingEdgeStroke&&(h.beginPath(),S.faceTop&&(h.moveTo(t,e),h.lineTo(t+this._mc.cw,e)),S.faceBottom&&(h.moveTo(t,e+this._mc.ch),h.lineTo(t+this._mc.cw,e+this._mc.ch)),S.faceLeft&&(h.moveTo(t,e),h.lineTo(t,e+this._mc.ch)),S.faceRight&&(h.moveTo(t+this._mc.cw,e),h.lineTo(t+this._mc.cw,e+this._mc.ch)),h.closePath(),h.stroke()))}}},Object.defineProperty(s.TilemapLayer.prototype,"wrap",{get:function(){return this._wrap},set:function(t){this._wrap=t,this.dirty=!0}}),Object.defineProperty(s.TilemapLayer.prototype,"scrollX",{get:function(){return this._scrollX},set:function(t){this._scrollX=t}}),Object.defineProperty(s.TilemapLayer.prototype,"scrollY",{get:function(){return this._scrollY},set:function(t){this._scrollY=t}}),Object.defineProperty(s.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._mc.cw},set:function(t){this._mc.cw=0|t,this.dirty=!0}}),Object.defineProperty(s.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._mc.ch},set:function(t){this._mc.ch=0|t,this.dirty=!0}}), +n.TilemapLayer=function(t,e,i,s,r){s|=0,r|=0,n.Sprite.call(this,t,0,0),this.map=e,this.index=i,this.layer=e.layers[i],this.canvas=n.CanvasPool.create(this,s,r),this.context=this.canvas.getContext("2d"),this.setTexture(new PIXI.Texture(new PIXI.BaseTexture(this.canvas,null,this.game.resolution))),this.type=n.TILEMAPLAYER,this.physicsType=n.TILEMAPLAYER,this.renderSettings={enableScrollDelta:!0,overdrawRatio:.2,copyCanvas:null},this.debug=!1,this.exists=!0,this.debugSettings={missingImageFill:"rgb(255,255,255)",debuggedTileOverfill:"rgba(0,255,0,0.4)",forceFullRedraw:!0,debugAlpha:.5,facingEdgeStroke:"rgba(0,255,0,1)",collidingTileOverfill:"rgba(0,255,0,0.2)"},this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this.rayStepRate=4,this._wrap=!1,this._mc={scrollX:0,scrollY:0,renderWidth:0,renderHeight:0,tileWidth:e.tileWidth,tileHeight:e.tileHeight,cw:e.tileWidth,ch:e.tileHeight,tilesets:[]},this._scrollX=0,this._scrollY=0,this.tileOffset=new n.Point(this.layer.offsetX||0,this.layer.offsetY||0),this._results=[],t.device.canvasBitBltShift||(this.renderSettings.copyCanvas=n.TilemapLayer.ensureSharedCopyCanvas()),this.fixedToCamera=!0},n.TilemapLayer.prototype=Object.create(n.Sprite.prototype),n.TilemapLayer.prototype.constructor=n.TilemapLayer,n.TilemapLayer.prototype.preUpdateCore=n.Component.Core.preUpdate,n.TilemapLayer.sharedCopyCanvas=null,n.TilemapLayer.ensureSharedCopyCanvas=function(){return this.sharedCopyCanvas||(this.sharedCopyCanvas=n.CanvasPool.create(this,2,2)),this.sharedCopyCanvas},n.TilemapLayer.prototype.preUpdate=function(){return this.preUpdateCore()},n.TilemapLayer.prototype.postUpdate=function(){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y},n.TilemapLayer.prototype._renderCanvas=function(t){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y,this.render(),PIXI.Sprite.prototype._renderCanvas.call(this,t)},n.TilemapLayer.prototype._renderWebGL=function(t){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y,this.render(),PIXI.Sprite.prototype._renderWebGL.call(this,t)},n.TilemapLayer.prototype.destroy=function(){n.CanvasPool.remove(this),n.Component.Destroy.prototype.destroy.call(this)},n.TilemapLayer.prototype.resize=function(t,e){this.canvas.width=t,this.canvas.height=e,this.texture.frame.resize(t,e),this.texture.width=t,this.texture.height=e,this.texture.crop.width=t,this.texture.crop.height=e,this.texture.baseTexture.width=t,this.texture.baseTexture.height=e,this.texture.baseTexture.dirty(),this.texture.requiresUpdate=!0,this.texture._updateUvs(),this.dirty=!0},n.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels*this.scale.x,this.layer.heightInPixels*this.scale.y)},n.TilemapLayer.prototype.getTileOffsetX=function(){return this.tileOffset.x||(this.fixedToCamera?0:this.position.x)},n.TilemapLayer.prototype.getTileOffsetY=function(){return this.tileOffset.y||(this.fixedToCamera?0:this.position.y)},n.TilemapLayer.prototype._fixX=function(t){return 1===this.scrollFactorX||0===this.scrollFactorX&&0===this.position.x?t:0===this.scrollFactorX&&0!==this.position.x?t-this.position.x:this._scrollX+(t-this._scrollX/this.scrollFactorX)},n.TilemapLayer.prototype._unfixX=function(t){return 1===this.scrollFactorX?t:this._scrollX/this.scrollFactorX+(t-this._scrollX)},n.TilemapLayer.prototype._fixY=function(t){return 1===this.scrollFactorY||0===this.scrollFactorY&&0===this.position.y?t:0===this.scrollFactorY&&0!==this.position.y?t-this.position.y:this._scrollY+(t-this._scrollY/this.scrollFactorY)},n.TilemapLayer.prototype._unfixY=function(t){return 1===this.scrollFactorY?t:this._scrollY/this.scrollFactorY+(t-this._scrollY)},n.TilemapLayer.prototype.getTileX=function(t){return Math.floor(this._fixX(t)/this._mc.tileWidth)},n.TilemapLayer.prototype.getTileY=function(t){return Math.floor(this._fixY(t)/this._mc.tileHeight)},n.TilemapLayer.prototype.getTileXY=function(t,e,i){return i.x=this.getTileX(t),i.y=this.getTileY(e),i},n.TilemapLayer.prototype.getRayCastTiles=function(t,e,i,n){e||(e=this.rayStepRate),void 0===i&&(i=!1),void 0===n&&(n=!1);var s=this.getTiles(t.x,t.y,t.width,t.height,i,n);if(0===s.length)return[];for(var r=t.coordinatesOnLine(e),o=[],a=0;a=0;m++,v--,f+=c){m>=h&&(m-=h);var w=this.layer.data[m];for(g=x,y=s-i,p=b;y>=0;g++,y--,p+=l){g>=a&&(g-=a);var _=w[g];if(_&&!(_.index<0)){var T=_.index,C=u[T];void 0===C&&(C=this.resolveTileset(T)),_.alpha===d||this.debug||(o.globalAlpha=_.alpha,d=_.alpha),C?_.rotation||_.flipped?(o.save(),o.translate(p+_.centerX,f+_.centerY),o.rotate(_.rotation),_.flipped&&o.scale(-1,1),C.draw(o,-_.centerX,-_.centerY,T),o.restore()):C.draw(o,p,f,T):this.debugSettings.missingImageFill&&(o.fillStyle=this.debugSettings.missingImageFill,o.fillRect(p,f,l,c)),_.debug&&this.debugSettings.debuggedTileOverfill&&(o.fillStyle=this.debugSettings.debuggedTileOverfill,o.fillRect(p,f,l,c))}}}},n.TilemapLayer.prototype.renderDeltaScroll=function(t,e){var i=this._mc.scrollX,n=this._mc.scrollY,s=this.canvas.width,r=this.canvas.height,o=this._mc.tileWidth,a=this._mc.tileHeight,h=0,l=-o,c=0,u=-a;if(t<0?(h=s+t,l=s-1):t>0&&(l=t),e<0?(c=r+e,u=r-1):e>0&&(u=e),this.shiftCanvas(this.context,t,e),h=Math.floor((h+i)/o),l=Math.floor((l+i)/o),c=Math.floor((c+n)/a),u=Math.floor((u+n)/a),h<=l){this.context.clearRect(h*o-i,0,(l-h+1)*o,r);var d=Math.floor((0+n)/a),p=Math.floor((r-1+n)/a);this.renderRegion(i,n,h,d,l,p)}if(c<=u){this.context.clearRect(0,c*a-n,s,(u-c+1)*a);var f=Math.floor((0+i)/o),g=Math.floor((s-1+i)/o);this.renderRegion(i,n,f,c,g,u)}},n.TilemapLayer.prototype.renderFull=function(){var t=this._mc.scrollX,e=this._mc.scrollY,i=this.canvas.width,n=this.canvas.height,s=this._mc.tileWidth,r=this._mc.tileHeight,o=Math.floor(t/s),a=Math.floor((i-1+t)/s),h=Math.floor(e/r),l=Math.floor((n-1+e)/r);this.context.clearRect(0,0,i,n),this.renderRegion(t,e,o,h,a,l)},n.TilemapLayer.prototype.render=function(){var t=!1;if(this.visible){(this.dirty||this.layer.dirty)&&(this.layer.dirty=!1,t=!0);var e=this.canvas.width,i=this.canvas.height,n=0|this._scrollX,s=0|this._scrollY,r=this._mc,o=r.scrollX-n,a=r.scrollY-s;if(t||0!==o||0!==a||r.renderWidth!==e||r.renderHeight!==i)return this.context.save(),r.scrollX=n,r.scrollY=s,r.renderWidth===e&&r.renderHeight===i||(r.renderWidth=e,r.renderHeight=i),this.debug&&(this.context.globalAlpha=this.debugSettings.debugAlpha,this.debugSettings.forceFullRedraw&&(t=!0)),!t&&this.renderSettings.enableScrollDelta&&Math.abs(o)+Math.abs(a)=0;n++,r--,e+=f){n>=d&&(n-=d);var T=this.layer.data[n];for(i=w,s=m-g,t=b;s>=0;i++,s--,t+=p){i>=u&&(i-=u);var C=T[i];!C||C.index<0||!C.collides||(this.debugSettings.collidingTileOverfill&&(h.fillStyle=this.debugSettings.collidingTileOverfill,h.fillRect(t,e,this._mc.cw,this._mc.ch)),this.debugSettings.facingEdgeStroke&&(h.beginPath(),C.faceTop&&(h.moveTo(t,e),h.lineTo(t+this._mc.cw,e)),C.faceBottom&&(h.moveTo(t,e+this._mc.ch),h.lineTo(t+this._mc.cw,e+this._mc.ch)),C.faceLeft&&(h.moveTo(t,e),h.lineTo(t,e+this._mc.ch)),C.faceRight&&(h.moveTo(t+this._mc.cw,e),h.lineTo(t+this._mc.cw,e+this._mc.ch)),h.closePath(),h.stroke()))}}},Object.defineProperty(n.TilemapLayer.prototype,"wrap",{get:function(){return this._wrap},set:function(t){this._wrap=t,this.dirty=!0}}),Object.defineProperty(n.TilemapLayer.prototype,"scrollX",{get:function(){return this._scrollX},set:function(t){this._scrollX=t}}),Object.defineProperty(n.TilemapLayer.prototype,"scrollY",{get:function(){return this._scrollY},set:function(t){this._scrollY=t}}),Object.defineProperty(n.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._mc.cw},set:function(t){this._mc.cw=0|t,this.dirty=!0}}),Object.defineProperty(n.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._mc.ch},set:function(t){this._mc.ch=0|t,this.dirty=!0}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.TilemapParser={INSERT_NULL:!1,parse:function(t,e,i,n,r,o){if(void 0===i&&(i=32),void 0===n&&(n=32),void 0===r&&(r=10),void 0===o&&(o=10),void 0===e)return this.getEmptyData();if(null===e)return this.getEmptyData(i,n,r,o);var a=t.cache.getTilemapData(e);if(a){if(a.format===s.Tilemap.CSV)return this.parseCSV(e,a.data,i,n);if(!a.format||a.format===s.Tilemap.TILED_JSON)return this.parseTiledJSON(a.data)}else console.warn('No map data found for key "%s"',e)},parseCSV:function(t,e,i,n){for(var r=this.getEmptyData(),o=[],a=(e=e.trim()).split("\n"),h=a.length,l=0,u=0;u1.1&&console.warn('Some features in this Tiled JSON map (version %s) may not work in Phaser CE. Enable the json1 plugin and reexport the map in "Tiled 1.1" format. https://github.com/photonstorm/phaser-ce/issues/623',t.version);for(var e={width:t.width,height:t.height,tileWidth:t.tilewidth,tileHeight:t.tileheight,orientation:t.orientation,format:s.Tilemap.TILED_JSON,version:t.version,properties:t.properties,widthInPixels:t.width*t.tilewidth,heightInPixels:t.height*t.tileheight},i=[],n=0;n>>0;r.data=h,delete r.encoding}else if(r.compression){console.warn('Layer compression is unsupported, skipping layer "%s".',r.name);continue}var u={name:r.name,x:r.x,y:r.y,width:r.width,height:r.height,widthInPixels:r.width*t.tilewidth,heightInPixels:r.height*t.tileheight,alpha:r.opacity,offsetX:r.offsetx,offsetY:r.offsety,visible:r.visible,properties:{},indexes:[],callbacks:[],bodies:[]};r.properties&&(u.properties=r.properties);var c,d,p,f=0,g=[],m=[],y=0;for(a=r.data.length;y536870912)switch(P>2147483648&&(P-=2147483648,p+=4),P>1073741824&&(P-=1073741824,p+=2),P>536870912&&(P-=536870912,p+=1),p){case 5:c=Math.PI/2;break;case 6:c=Math.PI;break;case 3:c=3*Math.PI/2;break;case 4:c=0,d=!0;break;case 7:c=Math.PI/2,d=!0;break;case 2:c=Math.PI,d=!0;break;case 1:c=3*Math.PI/2,d=!0}if(P>0)(D=new s.Tile(u,P,f,m.length,t.tilewidth,t.tileheight)).rotation=c,D.flipped=d,0!==p&&(D.flippedVal=p),g.push(D);else s.TilemapParser.INSERT_NULL?g.push(null):g.push(new s.Tile(u,-1,f,m.length,t.tilewidth,t.tileheight));++f===r.width&&(m.push(g),f=0,g=[])}u.data=m,i.push(u)}e.layers=i;var v=[];for(n=0;n1.1&&console.warn('Some features in this Tiled JSON map (version %s) may not work in Phaser CE. Enable the json1 plugin and reexport the map in "Tiled 1.1" format. https://github.com/photonstorm/phaser-ce/issues/623',t.version);for(var e={width:t.width,height:t.height,tileWidth:t.tilewidth,tileHeight:t.tileheight,orientation:t.orientation,format:n.Tilemap.TILED_JSON,version:t.version,properties:t.properties,widthInPixels:t.width*t.tilewidth,heightInPixels:t.height*t.tileheight},i=[],s=0;s>>0;r.data=h,delete r.encoding}else if(r.compression){console.warn('Layer compression is unsupported, skipping layer "%s".',r.name);continue}var c={name:r.name,x:r.x,y:r.y,width:r.width,height:r.height,widthInPixels:r.width*t.tilewidth,heightInPixels:r.height*t.tileheight,alpha:r.opacity,offsetX:r.offsetx,offsetY:r.offsety,visible:r.visible,properties:{},indexes:[],callbacks:[],bodies:[]};r.properties&&(c.properties=r.properties);var u,d,p,f=0,g=[],m=[],y=0;for(a=r.data.length;y536870912)switch(E>2147483648&&(E-=2147483648,p+=4),E>1073741824&&(E-=1073741824,p+=2),E>536870912&&(E-=536870912,p+=1),p){case 5:u=Math.PI/2;break;case 6:u=Math.PI;break;case 3:u=3*Math.PI/2;break;case 4:u=0,d=!0;break;case 7:u=Math.PI/2,d=!0;break;case 2:u=Math.PI,d=!0;break;case 1:u=3*Math.PI/2,d=!0}if(E>0)(M=new n.Tile(c,E,f,m.length,t.tilewidth,t.tileheight)).rotation=u,M.flipped=d,0!==p&&(M.flippedVal=p),g.push(M);else n.TilemapParser.INSERT_NULL?g.push(null):g.push(new n.Tile(c,-1,f,m.length,t.tilewidth,t.tileheight));++f===r.width&&(m.push(g),f=0,g=[])}c.data=m,i.push(c)}e.layers=i;var v=[];for(s=0;s * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Tileset=function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.tileWidth=0|i,this.tileHeight=0|n,this.tileMargin=0|s,this.tileSpacing=0|r,this.properties=o||{},this.image=null,this.rows=0,this.columns=0,this.total=0,this.drawCoords=[]},s.Tileset.prototype={draw:function(t,e,i,n){var s=n-this.firstgid<<1;s>=0&&s+1=this.firstgid&&t=0&&s+1=this.firstgid&&t * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Particle=function(t,e,i,n,r){s.Sprite.call(this,t,e,i,n,r),this.autoScale=!1,this.scaleData=null,this._s=0,this.autoAlpha=!1,this.alphaData=null,this._a=0},s.Particle.prototype=Object.create(s.Sprite.prototype),s.Particle.prototype.constructor=s.Particle,s.Particle.prototype.update=function(){this.autoScale&&(this._s--,this._s?this.scale.set(this.scaleData[this._s].x,this.scaleData[this._s].y):this.autoScale=!1),this.autoAlpha&&(this._a--,this._a?this.alpha=this.alphaData[this._a].v:this.autoAlpha=!1)},s.Particle.prototype.onEmit=function(){},s.Particle.prototype.setAlphaData=function(t){this.alphaData=t,this._a=t.length-1,this.alpha=this.alphaData[this._a].v,this.autoAlpha=!0},s.Particle.prototype.setScaleData=function(t){this.scaleData=t,this._s=t.length-1,this.scale.set(this.scaleData[this._s].x,this.scaleData[this._s].y),this.autoScale=!0},s.Particle.prototype.reset=function(t,e,i){return s.Component.Reset.prototype.reset.call(this,t,e,i),this.alpha=1,this.scale.set(1),this.autoScale=!1,this.autoAlpha=!1,this}, +n.Particle=function(t,e,i,s,r){n.Sprite.call(this,t,e,i,s,r),this.autoScale=!1,this.scaleData=null,this._s=0,this.autoAlpha=!1,this.alphaData=null,this._a=0},n.Particle.prototype=Object.create(n.Sprite.prototype),n.Particle.prototype.constructor=n.Particle,n.Particle.prototype.update=function(){this.autoScale&&(this._s--,this._s?this.scale.set(this.scaleData[this._s].x,this.scaleData[this._s].y):this.autoScale=!1),this.autoAlpha&&(this._a--,this._a?this.alpha=this.alphaData[this._a].v:this.autoAlpha=!1)},n.Particle.prototype.onEmit=function(){},n.Particle.prototype.setAlphaData=function(t){this.alphaData=t,this._a=t.length-1,this.alpha=this.alphaData[this._a].v,this.autoAlpha=!0},n.Particle.prototype.setScaleData=function(t){this.scaleData=t,this._s=t.length-1,this.scale.set(this.scaleData[this._s].x,this.scaleData[this._s].y),this.autoScale=!0},n.Particle.prototype.reset=function(t,e,i){return n.Component.Reset.prototype.reset.call(this,t,e,i),this.alpha=1,this.scale.set(1),this.autoScale=!1,this.autoAlpha=!1,this}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Particles=function(t){this.game=t,this.emitters={},this.ID=0},s.Particles.prototype={add:function(t){return this.emitters[t.id]=t,t},remove:function(t){delete this.emitters[t.id]}},s.Particles.prototype.constructor=s.Particles, +n.Particles=function(t){this.game=t,this.emitters={},this.ID=0},n.Particles.prototype={add:function(t){return this.emitters[t.id]=t,t},remove:function(t){delete this.emitters[t.id]}},n.Particles.prototype.constructor=n.Particles, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Particles.Arcade={}, +n.Particles.Arcade={}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Particles.Arcade.Emitter=function(t,e,i,n){this.maxParticles=n||50,s.Group.call(this,t),this._id=this.game.particles.ID++,this.name="emitter"+this.id,this.type=s.EMITTER,this.physicsType=s.GROUP,this.area=new s.Rectangle(e,i,1,1),this.minAngle=null,this.maxAngle=null,this.minSpeed=0,this.maxSpeed=100,this.minParticleSpeed=new s.Point(-100,-100),this.maxParticleSpeed=new s.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.scaleData=null,this.minRotation=-360,this.maxRotation=360,this.minParticleAlpha=1,this.maxParticleAlpha=1,this.alphaData=null,this.particleClass=s.Particle,this.particleDrag=new s.Point,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new s.Point,this.on=!1,this.particleAnchor=new s.Point(.5,.5),this.blendMode=s.blendModes.NORMAL,this.emitX=e,this.emitY=i,this.autoScale=!1,this.autoAlpha=!1,this.particleBringToTop=!1,this.particleSendToBack=!1,this.counts={emitted:0,failed:0,totalEmitted:0,totalFailed:0},this._gravity=new s.Point(0,100),this._minParticleScale=new s.Point(1,1),this._maxParticleScale=new s.Point(1,1),this._total=0,this._timer=0,this._counter=0,this._flowQuantity=0,this._flowTotal=0,this._explode=!0,this._frames=null},s.Particles.Arcade.Emitter.prototype=Object.create(s.Group.prototype),s.Particles.Arcade.Emitter.prototype.constructor=s.Particles.Arcade.Emitter,s.Particles.Arcade.Emitter.prototype.update=function(){if(this.counts.emitted=0,this.counts.failed=0,this.on&&this.game.time.time>=this._timer)if(this._timer=this.game.time.time+this.frequency*this.game.time.slowMotion,0!==this._flowTotal)if(this._flowQuantity>0){for(var t=0;t=this._flowTotal)){this.on=!1;break}}else this.emitParticle()&&(this._counter++,-1!==this._flowTotal&&this._counter>=this._flowTotal&&(this.on=!1));else this.emitParticle()&&(this._counter++,this._total>0&&this._counter>=this._total&&(this.on=!1));for(t=this.children.length;t--;)this.children[t].exists&&this.children[t].update()},s.Particles.Arcade.Emitter.prototype.makeParticles=function(t,e,i,n,s,r){var o;void 0===e&&(e=0),void 0===i&&(i=this.maxParticles),void 0===n&&(n=!1),void 0===s&&(s=!1),void 0===r&&(r=null);var a=0,h=t,l=e;for(this._frames=e,i>this.maxParticles&&(this.maxParticles=i);athis.maxParticles&&(i=this.maxParticles),this._counter=0,this._flowQuantity=i,this._flowTotal=n,s?(this.start(!0,t,e,i),this._counter+=i,this.on=!0,this._timer=this.game.time.time+e*this.game.time.slowMotion):this.start(!1,t,e,i),this},s.Particles.Arcade.Emitter.prototype.start=function(t,e,i,n,s){if(void 0===t&&(t=!0),void 0===e&&(e=0),null==i&&(i=250),void 0===n&&(n=0),void 0===s&&(s=!1),n>this.maxParticles&&(n=this.maxParticles),this.revive(),this.visible=!0,this.lifespan=e,this.frequency=i,t||s)for(var r=0;r1&&(o=r.between(this.left,this.right)),null!==e?a=e:this.height>1&&(a=r.between(this.top,this.bottom)),this.resetParticle(s,o,a),!0},s.Particles.Arcade.Emitter.prototype.getNextParticle=function(){for(var t=this.length;t--;){var e=this.next();if(!e.exists)return e}return null},s.Particles.Arcade.Emitter.prototype.resetParticle=function(t,e,i){var n=this.game.rnd;t.reset(e,i),t.angle=0,t.lifespan=this.lifespan,this.particleBringToTop?this.bringToTop(t):this.particleSendToBack&&this.sendToBack(t),this.autoScale?t.setScaleData(this.scaleData):1!==this.minParticleScale||1!==this.maxParticleScale?t.scale.set(n.realInRange(this.minParticleScale,this.maxParticleScale)):this._minParticleScale.x!==this._maxParticleScale.x||this._minParticleScale.y!==this._maxParticleScale.y?t.scale.set(n.realInRange(this._minParticleScale.x,this._maxParticleScale.x),n.realInRange(this._minParticleScale.y,this._maxParticleScale.y)):t.scale.set(this._minParticleScale.x,this._minParticleScale.y),this.autoAlpha?t.setAlphaData(this.alphaData):t.alpha=n.realInRange(this.minParticleAlpha,this.maxParticleAlpha),t.blendMode=this.blendMode;var s=t.body;s.updateBounds(),s.bounce.copyFrom(this.bounce),s.drag.copyFrom(this.particleDrag),null!=this.minAngle&&null!=this.maxAngle?this.game.physics.arcade.velocityFromAngle(this.minAngle===this.maxAngle?this.minAngle:n.between(this.minAngle,this.maxAngle),this.minSpeed===this.maxSpeed?this.minSpeed:n.between(this.minSpeed,this.maxSpeed),s.velocity):(s.velocity.x=n.between(this.minParticleSpeed.x,this.maxParticleSpeed.x),s.velocity.y=n.between(this.minParticleSpeed.y,this.maxParticleSpeed.y)),s.angularVelocity=n.between(this.minRotation,this.maxRotation),s.gravity.copyFrom(this.gravity),s.angularDrag=this.angularDrag,t.onEmit()},s.Particles.Arcade.Emitter.prototype.destroy=function(){this.game.particles.remove(this),s.Group.prototype.destroy.call(this,!0,!1)},s.Particles.Arcade.Emitter.prototype.setSize=function(t,e){return this.area.width=t,this.area.height=e,this},s.Particles.Arcade.Emitter.prototype.setXSpeed=function(t,e){return t=t||0,e=e||0,this.minParticleSpeed.x=t,this.maxParticleSpeed.x=e,this},s.Particles.Arcade.Emitter.prototype.setYSpeed=function(t,e){return t=t||0,e=e||0,this.minParticleSpeed.y=t,this.maxParticleSpeed.y=e,this},s.Particles.Arcade.Emitter.prototype.setRotation=function(t,e){return t=t||0,e=e||0,this.minRotation=t,this.maxRotation=e,this},s.Particles.Arcade.Emitter.prototype.setAlpha=function(t,e,i,n,r){if(void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=s.Easing.Linear.None),void 0===r&&(r=!1),this.minParticleAlpha=t,this.maxParticleAlpha=e,this.autoAlpha=!1,i>0&&t!==e){var o={v:t},a=this.game.make.tween(o).to({v:e},i,n);a.yoyo(r),this.alphaData=a.generateData(60),this.alphaData.reverse(),this.autoAlpha=!0}return this},s.Particles.Arcade.Emitter.prototype.setScale=function(t,e,i,n,r,o,a){if(void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=s.Easing.Linear.None),void 0===a&&(a=!1),this.minParticleScale=1,this.maxParticleScale=1,this._minParticleScale.set(t,i),this._maxParticleScale.set(e,n),this.autoScale=!1,r>0&&(t!==e||i!==n)){var h={x:t,y:i},l=this.game.make.tween(h).to({x:e,y:n},r,o);l.yoyo(a),this.scaleData=l.generateData(60),this.scaleData.reverse(),this.autoScale=!0}return this},s.Particles.Arcade.Emitter.prototype.setAngle=function(t,e,i,n){return this.minAngle=t,this.maxAngle=e,null!=i&&(this.minSpeed=i),null!=n&&(this.maxSpeed=n),this},s.Particles.Arcade.Emitter.prototype.at=function(t){return t.center?(this.emitX=t.center.x,this.emitY=t.center.y):(this.emitX=t.world.x+t.anchor.x*t.width,this.emitY=t.world.y+t.anchor.y*t.height),this},Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"gravity",{get:function(){return this._gravity},set:function(t){"number"==typeof t?this._gravity.y=t:this._gravity=t}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"id",{get:function(){return this._id}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"width",{get:function(){return this.area.width},set:function(t){this.area.width=t}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"height",{get:function(){return this.area.height},set:function(t){this.area.height=t}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(t){this.emitX=t}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(t){this.emitY=t}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.area.width/2)}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.area.width/2)}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.area.height/2)}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.area.height/2)}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"output",{get:function(){return 1e3*this._flowQuantity/this.frequency}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"lifespanOutput",{get:function(){return(0===this.lifespan?1/0:this.lifespan)*this._flowQuantity/this.frequency}}),Object.defineProperty(s.Particles.Arcade.Emitter.prototype,"remainder",{get:function(){return this.maxParticles-this.lifespanOutput}}), +n.Particles.Arcade.Emitter=function(t,e,i,s){this.maxParticles=s||50,n.Group.call(this,t),this._id=this.game.particles.ID++,this.name="emitter"+this.id,this.type=n.EMITTER,this.physicsType=n.GROUP,this.area=new n.Rectangle(e,i,1,1),this.minAngle=null,this.maxAngle=null,this.minSpeed=0,this.maxSpeed=100,this.minParticleSpeed=new n.Point(-100,-100),this.maxParticleSpeed=new n.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.scaleData=null,this.minRotation=-360,this.maxRotation=360,this.minParticleAlpha=1,this.maxParticleAlpha=1,this.alphaData=null,this.particleClass=n.Particle,this.particleDrag=new n.Point,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new n.Point,this.on=!1,this.particleAnchor=new n.Point(.5,.5),this.blendMode=n.blendModes.NORMAL,this.emitX=e,this.emitY=i,this.autoScale=!1,this.autoAlpha=!1,this.particleBringToTop=!1,this.particleSendToBack=!1,this.counts={emitted:0,failed:0,totalEmitted:0,totalFailed:0},this._gravity=new n.Point(0,100),this._minParticleScale=new n.Point(1,1),this._maxParticleScale=new n.Point(1,1),this._total=0,this._timer=0,this._counter=0,this._flowQuantity=0,this._flowTotal=0,this._explode=!0,this._frames=null},n.Particles.Arcade.Emitter.prototype=Object.create(n.Group.prototype),n.Particles.Arcade.Emitter.prototype.constructor=n.Particles.Arcade.Emitter,n.Particles.Arcade.Emitter.prototype.update=function(){if(this.counts.emitted=0,this.counts.failed=0,this.on&&this.game.time.time>=this._timer)if(this._timer=this.game.time.time+this.frequency*this.game.time.slowMotion,0!==this._flowTotal)if(this._flowQuantity>0){for(var t=0;t=this._flowTotal)){this.on=!1;break}}else this.emitParticle()&&(this._counter++,-1!==this._flowTotal&&this._counter>=this._flowTotal&&(this.on=!1));else this.emitParticle()&&(this._counter++,this._total>0&&this._counter>=this._total&&(this.on=!1));for(t=this.children.length;t--;)this.children[t].exists&&this.children[t].update()},n.Particles.Arcade.Emitter.prototype.makeParticles=function(t,e,i,n,s,r){var o;void 0===e&&(e=0),void 0===i&&(i=this.maxParticles),void 0===n&&(n=!1),void 0===s&&(s=!1),void 0===r&&(r=null);var a=0,h=t,l=e;for(this._frames=e,i>this.maxParticles&&(this.maxParticles=i);athis.maxParticles&&(i=this.maxParticles),this._counter=0,this._flowQuantity=i,this._flowTotal=n,s?(this.start(!0,t,e,i),this._counter+=i,this.on=!0,this._timer=this.game.time.time+e*this.game.time.slowMotion):this.start(!1,t,e,i),this},n.Particles.Arcade.Emitter.prototype.start=function(t,e,i,n,s){if(void 0===t&&(t=!0),void 0===e&&(e=0),null==i&&(i=250),void 0===n&&(n=0),void 0===s&&(s=!1),n>this.maxParticles&&(n=this.maxParticles),this.revive(),this.visible=!0,this.lifespan=e,this.frequency=i,t||s)for(var r=0;r1&&(o=r.between(this.left,this.right)),null!==e?a=e:this.height>1&&(a=r.between(this.top,this.bottom)),this.resetParticle(s,o,a),!0},n.Particles.Arcade.Emitter.prototype.getNextParticle=function(){for(var t=this.length;t--;){var e=this.next();if(!e.exists)return e}return null},n.Particles.Arcade.Emitter.prototype.resetParticle=function(t,e,i){var n=this.game.rnd;t.reset(e,i),t.angle=0,t.lifespan=this.lifespan,this.particleBringToTop?this.bringToTop(t):this.particleSendToBack&&this.sendToBack(t),this.autoScale?t.setScaleData(this.scaleData):1!==this.minParticleScale||1!==this.maxParticleScale?t.scale.set(n.realInRange(this.minParticleScale,this.maxParticleScale)):this._minParticleScale.x!==this._maxParticleScale.x||this._minParticleScale.y!==this._maxParticleScale.y?t.scale.set(n.realInRange(this._minParticleScale.x,this._maxParticleScale.x),n.realInRange(this._minParticleScale.y,this._maxParticleScale.y)):t.scale.set(this._minParticleScale.x,this._minParticleScale.y),this.autoAlpha?t.setAlphaData(this.alphaData):t.alpha=n.realInRange(this.minParticleAlpha,this.maxParticleAlpha),t.blendMode=this.blendMode;var s=t.body;s.updateBounds(),s.bounce.copyFrom(this.bounce),s.drag.copyFrom(this.particleDrag),null!=this.minAngle&&null!=this.maxAngle?this.game.physics.arcade.velocityFromAngle(this.minAngle===this.maxAngle?this.minAngle:n.between(this.minAngle,this.maxAngle),this.minSpeed===this.maxSpeed?this.minSpeed:n.between(this.minSpeed,this.maxSpeed),s.velocity):(s.velocity.x=n.between(this.minParticleSpeed.x,this.maxParticleSpeed.x),s.velocity.y=n.between(this.minParticleSpeed.y,this.maxParticleSpeed.y)),s.angularVelocity=n.between(this.minRotation,this.maxRotation),s.gravity.copyFrom(this.gravity),s.angularDrag=this.angularDrag,t.onEmit()},n.Particles.Arcade.Emitter.prototype.destroy=function(){this.game.particles.remove(this),n.Group.prototype.destroy.call(this,!0,!1)},n.Particles.Arcade.Emitter.prototype.setSize=function(t,e){return this.area.width=t,this.area.height=e,this},n.Particles.Arcade.Emitter.prototype.setXSpeed=function(t,e){return t=t||0,e=e||0,this.minParticleSpeed.x=t,this.maxParticleSpeed.x=e,this},n.Particles.Arcade.Emitter.prototype.setYSpeed=function(t,e){return t=t||0,e=e||0,this.minParticleSpeed.y=t,this.maxParticleSpeed.y=e,this},n.Particles.Arcade.Emitter.prototype.setRotation=function(t,e){return t=t||0,e=e||0,this.minRotation=t,this.maxRotation=e,this},n.Particles.Arcade.Emitter.prototype.setAlpha=function(t,e,i,s,r){if(void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=0),void 0===s&&(s=n.Easing.Linear.None),void 0===r&&(r=!1),this.minParticleAlpha=t,this.maxParticleAlpha=e,this.autoAlpha=!1,i>0&&t!==e){var o={v:t},a=this.game.make.tween(o).to({v:e},i,s);a.yoyo(r),this.alphaData=a.generateData(60),this.alphaData.reverse(),this.autoAlpha=!0}return this},n.Particles.Arcade.Emitter.prototype.setScale=function(t,e,i,s,r,o,a){if(void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===s&&(s=1),void 0===r&&(r=0),void 0===o&&(o=n.Easing.Linear.None),void 0===a&&(a=!1),this.minParticleScale=1,this.maxParticleScale=1,this._minParticleScale.set(t,i),this._maxParticleScale.set(e,s),this.autoScale=!1,r>0&&(t!==e||i!==s)){var h={x:t,y:i},l=this.game.make.tween(h).to({x:e,y:s},r,o);l.yoyo(a),this.scaleData=l.generateData(60),this.scaleData.reverse(),this.autoScale=!0}return this},n.Particles.Arcade.Emitter.prototype.setAngle=function(t,e,i,n){return this.minAngle=t,this.maxAngle=e,null!=i&&(this.minSpeed=i),null!=n&&(this.maxSpeed=n),this},n.Particles.Arcade.Emitter.prototype.at=function(t){return t.center?(this.emitX=t.center.x,this.emitY=t.center.y):(this.emitX=t.world.x+t.anchor.x*t.width,this.emitY=t.world.y+t.anchor.y*t.height),this},Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"gravity",{get:function(){return this._gravity},set:function(t){"number"==typeof t?this._gravity.y=t:this._gravity=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"id",{get:function(){return this._id}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"width",{get:function(){return this.area.width},set:function(t){this.area.width=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"height",{get:function(){return this.area.height},set:function(t){this.area.height=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(t){this.emitX=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(t){this.emitY=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.area.width/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.area.width/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.area.height/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.area.height/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"output",{get:function(){return 1e3*this._flowQuantity/this.frequency}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"lifespanOutput",{get:function(){return(0===this.lifespan?1/0:this.lifespan)*this._flowQuantity/this.frequency}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"remainder",{get:function(){return this.maxParticles-this.lifespanOutput}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Weapon=function(t,e){s.Plugin.call(this,t,e),this.bullets=null,this.autoExpandBulletsGroup=!1,this.autofire=!1,this.shots=0,this.fireLimit=0,this.fireRate=100,this.fireRateVariance=0,this.fireFrom=new s.Rectangle(0,0,1,1),this.fireAngle=s.ANGLE_UP,this.bulletInheritSpriteSpeed=!1,this.bulletAnimation="",this.bulletFrameRandom=!1,this.bulletFrameCycle=!1,this.bulletWorldWrap=!1,this.bulletWorldWrapPadding=0,this.bulletAngleOffset=0,this.bulletAngleVariance=0,this.bulletSpeed=200,this.bulletSpeedVariance=0,this.bulletLifespan=0,this.bulletKillDistance=0,this.bulletGravity=new s.Point(0,0),this.bulletRotateToVelocity=!1,this.bulletKey="",this.bulletFrame="",this._bulletClass=s.Bullet,this._bulletCollideWorldBounds=!1,this._bulletKillType=s.Weapon.KILL_WORLD_BOUNDS,this._data={customBody:!1,width:0,height:0,offsetX:0,offsetY:0},this.bounds=new s.Rectangle,this.bulletBounds=t.world.bounds,this.bulletFrames=[],this.bulletFrameIndex=0,this.anims={},this.onFire=new s.Signal,this.onKill=new s.Signal,this.onFireLimit=new s.Signal,this.trackedSprite=null,this.trackedPointer=null,this.multiFire=!1,this._hasFired=!1,this.trackRotation=!1,this.trackOffset=new s.Point,this._nextFire=0,this._tempNextFire=0,this._rotatedPoint=new s.Point},s.Weapon.prototype=Object.create(s.Plugin.prototype),s.Weapon.prototype.constructor=s.Weapon,s.Weapon.KILL_NEVER=0,s.Weapon.KILL_LIFESPAN=1,s.Weapon.KILL_DISTANCE=2,s.Weapon.KILL_WEAPON_BOUNDS=3,s.Weapon.KILL_CAMERA_BOUNDS=4,s.Weapon.KILL_WORLD_BOUNDS=5,s.Weapon.KILL_STATIC_BOUNDS=6,s.Weapon.prototype.createBullets=function(t,e,i,n){return void 0===t&&(t=1),void 0===n&&(n=this.game.world),this.bullets&&!this.bullets.game&&(this.bullets=null),this.bullets||(this.bullets=this.game.add.physicsGroup(s.Physics.ARCADE,n),this.bullets.classType=this._bulletClass),0!==t&&(-1===t&&(this.autoExpandBulletsGroup=!0,t=1),this.bullets.createMultiple(t,e,i),this.bullets.setAll("data.bulletManager",this),this.bulletKey=e,this.bulletFrame=i),this},s.Weapon.prototype.forEach=function(t,e){return this.bullets.forEachExists(t,e,arguments),this},s.Weapon.prototype.pauseAll=function(){return this.bullets.setAll("body.enable",!1),this},s.Weapon.prototype.resumeAll=function(){return this.bullets.setAll("body.enable",!0),this},s.Weapon.prototype.killAll=function(){return this.bullets.callAllExists("kill",!0),this.bullets.setAll("body.enable",!0),this},s.Weapon.prototype.resetShots=function(t){return this.shots=0,void 0!==t&&(this.fireLimit=t),this},s.Weapon.prototype.destroy=function(){this.parent.remove(this,!1),this.bullets.destroy(),this.game=null,this.parent=null,this.active=!1,this.visible=!1},s.Weapon.prototype.update=function(){this._bulletKillType===s.Weapon.KILL_WEAPON_BOUNDS&&(this.trackedSprite?(this.trackedSprite.updateTransform(),this.bounds.centerOn(this.trackedSprite.worldPosition.x,this.trackedSprite.worldPosition.y)):this.trackedPointer&&this.bounds.centerOn(this.trackedPointer.worldX,this.trackedPointer.worldY)),this.autofire&&this.fire()},s.Weapon.prototype.postRender=function(){this.multiFire&&this._hasFired&&(this._hasFired=!1,this._nextFire=this._tempNextFire)},s.Weapon.prototype.trackSprite=function(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.trackedPointer=null,this.trackedSprite=t,this.trackRotation=n,this.trackOffset.set(e,i),this},s.Weapon.prototype.trackPointer=function(t,e,i){return void 0===t&&(t=this.game.input.activePointer),void 0===e&&(e=0),void 0===i&&(i=0),this.trackedPointer=t,this.trackedSprite=null,this.trackRotation=!1,this.trackOffset.set(e,i),this},s.Weapon.prototype.fireMany=function(t,e){this.multiFire=!0;var i=[],n=this;return e||this.trackedSprite||this.trackedPointer?t.forEach((function(t){i.push(n.fire(e,null,null,t.x,t.y))})):t.forEach((function(t){i.push(n.fire(t))})),i},s.Weapon.prototype.fireOffset=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.fire(null,null,null,t,e)},s.Weapon.prototype.fire=function(t,e,i,n,r){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game.time.now0&&this.shots===this.fireLimit)return null;var o=this.bulletSpeed;0!==this.bulletSpeedVariance&&(o+=s.Math.between(-this.bulletSpeedVariance,this.bulletSpeedVariance)),t?this.fireFrom.width>1?this.fireFrom.centerOn(t.x,t.y):(this.fireFrom.x=t.x,this.fireFrom.y=t.y):this.trackedSprite?(this.trackRotation?(this._rotatedPoint.set(this.trackedSprite.world.x+this.trackOffset.x,this.trackedSprite.world.y+this.trackOffset.y),this._rotatedPoint.rotate(this.trackedSprite.world.x,this.trackedSprite.world.y,this.trackedSprite.worldRotation),this.fireFrom.width>1?this.fireFrom.centerOn(this._rotatedPoint.x,this._rotatedPoint.y):(this.fireFrom.x=this._rotatedPoint.x,this.fireFrom.y=this._rotatedPoint.y)):this.fireFrom.width>1?this.fireFrom.centerOn(this.trackedSprite.world.x+this.trackOffset.x,this.trackedSprite.world.y+this.trackOffset.y):(this.fireFrom.x=this.trackedSprite.world.x+this.trackOffset.x,this.fireFrom.y=this.trackedSprite.world.y+this.trackOffset.y),this.bulletInheritSpriteSpeed&&(o+=this.trackedSprite.body.speed)):this.trackedPointer&&(this.fireFrom.width>1?this.fireFrom.centerOn(this.trackedPointer.world.x+this.trackOffset.x,this.trackedPointer.world.y+this.trackOffset.y):(this.fireFrom.x=this.trackedPointer.world.x+this.trackOffset.x,this.fireFrom.y=this.trackedPointer.world.y+this.trackOffset.y)),void 0!==n&&(this.fireFrom.x+=n),void 0!==r&&(this.fireFrom.y+=r);var a=this.fireFrom.width>1?this.fireFrom.randomX:this.fireFrom.x,h=this.fireFrom.height>1?this.fireFrom.randomY:this.fireFrom.y,l=this.trackRotation?this.trackedSprite.angle:this.fireAngle;null!==e&&null!==i&&(l=this.game.math.radToDeg(Math.atan2(i-h,e-a))),0!==this.bulletAngleVariance&&(l+=s.Math.between(-this.bulletAngleVariance,this.bulletAngleVariance));var u=0,c=0;0===l||180===l?u=Math.cos(this.game.math.degToRad(l))*o:(90===l||270===l||(u=Math.cos(this.game.math.degToRad(l))*o),c=Math.sin(this.game.math.degToRad(l))*o);var d=null;if(this.autoExpandBulletsGroup?(d=this.bullets.getFirstExists(!1,!0,a,h,this.bulletKey,this.bulletFrame)).data.bulletManager=this:d=this.bullets.getFirstExists(!1),d){if(d.reset(a,h),d.data.fromX=a,d.data.fromY=h,d.data.killType=this.bulletKillType,d.data.killDistance=this.bulletKillDistance,d.data.rotateToVelocity=this.bulletRotateToVelocity,this.bulletKillType===s.Weapon.KILL_LIFESPAN&&(d.lifespan=this.bulletLifespan),d.angle=l+this.bulletAngleOffset,""!==this.bulletAnimation){if(null===d.animations.getAnimation(this.bulletAnimation)){var p=this.anims[this.bulletAnimation];d.animations.add(p.name,p.frames,p.frameRate,p.loop,p.useNumericIndex)}d.animations.play(this.bulletAnimation)}else this.bulletFrameCycle?(d.frame=this.bulletFrames[this.bulletFrameIndex],this.bulletFrameIndex++,this.bulletFrameIndex>=this.bulletFrames.length&&(this.bulletFrameIndex=0)):this.bulletFrameRandom&&(d.frame=this.bulletFrames[Math.floor(Math.random()*this.bulletFrames.length)]);d.data.bodyDirty&&(this._data.customBody&&d.body.setSize(this._data.width,this._data.height,this._data.offsetX,this._data.offsetY),d.body.collideWorldBounds=this.bulletCollideWorldBounds,d.data.bodyDirty=!1),d.body.velocity.set(u,c),d.body.gravity.set(this.bulletGravity.x,this.bulletGravity.y);var f=0;if(0!==this.bulletSpeedVariance){var g=this.fireRate;(g+=s.Math.between(-this.fireRateVariance,this.fireRateVariance))<0&&(g=0),f=this.game.time.now+g}else f=this.game.time.now+this.fireRate;this.multiFire?this._hasFired||(this._hasFired=!0,this._tempNextFire=f,this.shots++):(this._nextFire=f,this.shots++),this.onFire.dispatch(d,this,o),this.fireLimit>0&&this.shots===this.fireLimit&&this.onFireLimit.dispatch(this,this.fireLimit)}return d},s.Weapon.prototype.fireAtPointer=function(t){return void 0===t&&(t=this.game.input.activePointer),this.fire(null,t.worldX,t.worldY)},s.Weapon.prototype.fireAtSprite=function(t){return this.fire(null,t.world.x,t.world.y)},s.Weapon.prototype.fireAtXY=function(t,e){return this.fire(null,t,e)},s.Weapon.prototype.setBulletBodyOffset=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),this._data.customBody=!0,this._data.width=t,this._data.height=e,this._data.offsetX=i,this._data.offsetY=n,this.bullets.callAll("body.setSize","body",t,e,i,n),this.bullets.setAll("data.bodyDirty",!1),this},s.Weapon.prototype.setBulletFrames=function(t,e,i,n){return void 0===i&&(i=!0),void 0===n&&(n=!1),this.bulletFrames=s.ArrayUtils.numberArray(t,e),this.bulletFrameIndex=0,this.bulletFrameCycle=i,this.bulletFrameRandom=n,this},s.Weapon.prototype.addBulletAnimation=function(t,e,i,n,s){return this.anims[t]={name:t,frames:e,frameRate:i,loop:n,useNumericIndex:s},this.bullets.callAll("animations.add","animations",t,e,i,n,s),this.bulletAnimation=t,this},s.Weapon.prototype.debug=function(t,e,i){void 0===t&&(t=16),void 0===e&&(e=32),void 0===i&&(i=!1),this.game.debug.text("Weapon Plugin",t,e),this.game.debug.text("Bullets Alive: "+this.bullets.total+" - Total: "+this.bullets.length,t,e+24),i&&this.bullets.forEachExists(this.game.debug.body,this.game.debug,"rgba(255, 0, 255, 0.8)")},Object.defineProperty(s.Weapon.prototype,"bulletClass",{get:function(){return this._bulletClass},set:function(t){this._bulletClass=t,this.bullets&&(this.bullets.classType=this._bulletClass)}}),Object.defineProperty(s.Weapon.prototype,"bulletKillType",{get:function(){return this._bulletKillType},set:function(t){switch(t){case s.Weapon.KILL_STATIC_BOUNDS:case s.Weapon.KILL_WEAPON_BOUNDS:this.bulletBounds=this.bounds;break;case s.Weapon.KILL_CAMERA_BOUNDS:this.bulletBounds=this.game.camera.view;break;case s.Weapon.KILL_WORLD_BOUNDS:this.bulletBounds=this.game.world.bounds}this._bulletKillType=t}}),Object.defineProperty(s.Weapon.prototype,"bulletCollideWorldBounds",{get:function(){return this._bulletCollideWorldBounds},set:function(t){this._bulletCollideWorldBounds=t,this.bullets.setAll("body.collideWorldBounds",t),this.bullets.setAll("data.bodyDirty",!1)}}),Object.defineProperty(s.Weapon.prototype,"x",{get:function(){return this.fireFrom.x},set:function(t){this.fireFrom.x=t}}),Object.defineProperty(s.Weapon.prototype,"y",{get:function(){return this.fireFrom.y},set:function(t){this.fireFrom.y=t}}), +n.Weapon=function(t,e){n.Plugin.call(this,t,e),this.bullets=null,this.autoExpandBulletsGroup=!1,this.autofire=!1,this.shots=0,this.fireLimit=0,this.fireRate=100,this.fireRateVariance=0,this.fireFrom=new n.Rectangle(0,0,1,1),this.fireAngle=n.ANGLE_UP,this.bulletInheritSpriteSpeed=!1,this.bulletAnimation="",this.bulletFrameRandom=!1,this.bulletFrameCycle=!1,this.bulletWorldWrap=!1,this.bulletWorldWrapPadding=0,this.bulletAngleOffset=0,this.bulletAngleVariance=0,this.bulletSpeed=200,this.bulletSpeedVariance=0,this.bulletLifespan=0,this.bulletKillDistance=0,this.bulletGravity=new n.Point(0,0),this.bulletRotateToVelocity=!1,this.bulletKey="",this.bulletFrame="",this._bulletClass=n.Bullet,this._bulletCollideWorldBounds=!1,this._bulletKillType=n.Weapon.KILL_WORLD_BOUNDS,this._data={customBody:!1,width:0,height:0,offsetX:0,offsetY:0},this.bounds=new n.Rectangle,this.bulletBounds=t.world.bounds,this.bulletFrames=[],this.bulletFrameIndex=0,this.anims={},this.onFire=new n.Signal,this.onKill=new n.Signal,this.onFireLimit=new n.Signal,this.trackedSprite=null,this.trackedPointer=null,this.multiFire=!1,this._hasFired=!1,this.trackRotation=!1,this.trackOffset=new n.Point,this._nextFire=0,this._tempNextFire=0,this._rotatedPoint=new n.Point},n.Weapon.prototype=Object.create(n.Plugin.prototype),n.Weapon.prototype.constructor=n.Weapon,n.Weapon.KILL_NEVER=0,n.Weapon.KILL_LIFESPAN=1,n.Weapon.KILL_DISTANCE=2,n.Weapon.KILL_WEAPON_BOUNDS=3,n.Weapon.KILL_CAMERA_BOUNDS=4,n.Weapon.KILL_WORLD_BOUNDS=5,n.Weapon.KILL_STATIC_BOUNDS=6,n.Weapon.prototype.createBullets=function(t,e,i,s){return void 0===t&&(t=1),void 0===s&&(s=this.game.world),this.bullets&&!this.bullets.game&&(this.bullets=null),this.bullets||(this.bullets=this.game.add.physicsGroup(n.Physics.ARCADE,s),this.bullets.classType=this._bulletClass),0!==t&&(-1===t&&(this.autoExpandBulletsGroup=!0,t=1),this.bullets.createMultiple(t,e,i),this.bullets.setAll("data.bulletManager",this),this.bulletKey=e,this.bulletFrame=i),this},n.Weapon.prototype.forEach=function(t,e){return this.bullets.forEachExists(t,e,arguments),this},n.Weapon.prototype.pauseAll=function(){return this.bullets.setAll("body.enable",!1),this},n.Weapon.prototype.resumeAll=function(){return this.bullets.setAll("body.enable",!0),this},n.Weapon.prototype.killAll=function(){return this.bullets.callAllExists("kill",!0),this.bullets.setAll("body.enable",!0),this},n.Weapon.prototype.resetShots=function(t){return this.shots=0,void 0!==t&&(this.fireLimit=t),this},n.Weapon.prototype.destroy=function(){this.parent.remove(this,!1),this.bullets.destroy(),this.game=null,this.parent=null,this.active=!1,this.visible=!1},n.Weapon.prototype.update=function(){this._bulletKillType===n.Weapon.KILL_WEAPON_BOUNDS&&(this.trackedSprite?(this.trackedSprite.updateTransform(),this.bounds.centerOn(this.trackedSprite.worldPosition.x,this.trackedSprite.worldPosition.y)):this.trackedPointer&&this.bounds.centerOn(this.trackedPointer.worldX,this.trackedPointer.worldY)),this.autofire&&this.fire()},n.Weapon.prototype.postRender=function(){this.multiFire&&this._hasFired&&(this._hasFired=!1,this._nextFire=this._tempNextFire)},n.Weapon.prototype.trackSprite=function(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.trackedPointer=null,this.trackedSprite=t,this.trackRotation=n,this.trackOffset.set(e,i),this},n.Weapon.prototype.trackPointer=function(t,e,i){return void 0===t&&(t=this.game.input.activePointer),void 0===e&&(e=0),void 0===i&&(i=0),this.trackedPointer=t,this.trackedSprite=null,this.trackRotation=!1,this.trackOffset.set(e,i),this},n.Weapon.prototype.fireMany=function(t,e){this.multiFire=!0;var i=[],n=this;return e||this.trackedSprite||this.trackedPointer?t.forEach((function(t){i.push(n.fire(e,null,null,t.x,t.y))})):t.forEach((function(t){i.push(n.fire(t))})),i},n.Weapon.prototype.fireOffset=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.fire(null,null,null,t,e)},n.Weapon.prototype.fire=function(t,e,i,s,r){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game.time.now0&&this.shots===this.fireLimit)return null;var o=this.bulletSpeed;0!==this.bulletSpeedVariance&&(o+=n.Math.between(-this.bulletSpeedVariance,this.bulletSpeedVariance)),t?this.fireFrom.width>1?this.fireFrom.centerOn(t.x,t.y):(this.fireFrom.x=t.x,this.fireFrom.y=t.y):this.trackedSprite?(this.trackRotation?(this._rotatedPoint.set(this.trackedSprite.world.x+this.trackOffset.x,this.trackedSprite.world.y+this.trackOffset.y),this._rotatedPoint.rotate(this.trackedSprite.world.x,this.trackedSprite.world.y,this.trackedSprite.worldRotation),this.fireFrom.width>1?this.fireFrom.centerOn(this._rotatedPoint.x,this._rotatedPoint.y):(this.fireFrom.x=this._rotatedPoint.x,this.fireFrom.y=this._rotatedPoint.y)):this.fireFrom.width>1?this.fireFrom.centerOn(this.trackedSprite.world.x+this.trackOffset.x,this.trackedSprite.world.y+this.trackOffset.y):(this.fireFrom.x=this.trackedSprite.world.x+this.trackOffset.x,this.fireFrom.y=this.trackedSprite.world.y+this.trackOffset.y),this.bulletInheritSpriteSpeed&&(o+=this.trackedSprite.body.speed)):this.trackedPointer&&(this.fireFrom.width>1?this.fireFrom.centerOn(this.trackedPointer.world.x+this.trackOffset.x,this.trackedPointer.world.y+this.trackOffset.y):(this.fireFrom.x=this.trackedPointer.world.x+this.trackOffset.x,this.fireFrom.y=this.trackedPointer.world.y+this.trackOffset.y)),void 0!==s&&(this.fireFrom.x+=s),void 0!==r&&(this.fireFrom.y+=r);var a=this.fireFrom.width>1?this.fireFrom.randomX:this.fireFrom.x,h=this.fireFrom.height>1?this.fireFrom.randomY:this.fireFrom.y,l=this.trackRotation?this.trackedSprite.angle:this.fireAngle;null!==e&&null!==i&&(l=this.game.math.radToDeg(Math.atan2(i-h,e-a))),0!==this.bulletAngleVariance&&(l+=n.Math.between(-this.bulletAngleVariance,this.bulletAngleVariance));var c=0,u=0;0===l||180===l?c=Math.cos(this.game.math.degToRad(l))*o:(90===l||270===l||(c=Math.cos(this.game.math.degToRad(l))*o),u=Math.sin(this.game.math.degToRad(l))*o);var d=null;if(this.autoExpandBulletsGroup?(d=this.bullets.getFirstExists(!1,!0,a,h,this.bulletKey,this.bulletFrame)).data.bulletManager=this:d=this.bullets.getFirstExists(!1),d){if(d.reset(a,h),d.data.fromX=a,d.data.fromY=h,d.data.killType=this.bulletKillType,d.data.killDistance=this.bulletKillDistance,d.data.rotateToVelocity=this.bulletRotateToVelocity,this.bulletKillType===n.Weapon.KILL_LIFESPAN&&(d.lifespan=this.bulletLifespan),d.angle=l+this.bulletAngleOffset,""!==this.bulletAnimation){if(null===d.animations.getAnimation(this.bulletAnimation)){var p=this.anims[this.bulletAnimation];d.animations.add(p.name,p.frames,p.frameRate,p.loop,p.useNumericIndex)}d.animations.play(this.bulletAnimation)}else this.bulletFrameCycle?(d.frame=this.bulletFrames[this.bulletFrameIndex],this.bulletFrameIndex++,this.bulletFrameIndex>=this.bulletFrames.length&&(this.bulletFrameIndex=0)):this.bulletFrameRandom&&(d.frame=this.bulletFrames[Math.floor(Math.random()*this.bulletFrames.length)]);d.data.bodyDirty&&(this._data.customBody&&d.body.setSize(this._data.width,this._data.height,this._data.offsetX,this._data.offsetY),d.body.collideWorldBounds=this.bulletCollideWorldBounds,d.data.bodyDirty=!1),d.body.velocity.set(c,u),d.body.gravity.set(this.bulletGravity.x,this.bulletGravity.y);var f=0;if(0!==this.bulletSpeedVariance){var g=this.fireRate;(g+=n.Math.between(-this.fireRateVariance,this.fireRateVariance))<0&&(g=0),f=this.game.time.now+g}else f=this.game.time.now+this.fireRate;this.multiFire?this._hasFired||(this._hasFired=!0,this._tempNextFire=f,this.shots++):(this._nextFire=f,this.shots++),this.onFire.dispatch(d,this,o),this.fireLimit>0&&this.shots===this.fireLimit&&this.onFireLimit.dispatch(this,this.fireLimit)}return d},n.Weapon.prototype.fireAtPointer=function(t){return void 0===t&&(t=this.game.input.activePointer),this.fire(null,t.worldX,t.worldY)},n.Weapon.prototype.fireAtSprite=function(t){return this.fire(null,t.world.x,t.world.y)},n.Weapon.prototype.fireAtXY=function(t,e){return this.fire(null,t,e)},n.Weapon.prototype.setBulletBodyOffset=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),this._data.customBody=!0,this._data.width=t,this._data.height=e,this._data.offsetX=i,this._data.offsetY=n,this.bullets.callAll("body.setSize","body",t,e,i,n),this.bullets.setAll("data.bodyDirty",!1),this},n.Weapon.prototype.setBulletFrames=function(t,e,i,s){return void 0===i&&(i=!0),void 0===s&&(s=!1),this.bulletFrames=n.ArrayUtils.numberArray(t,e),this.bulletFrameIndex=0,this.bulletFrameCycle=i,this.bulletFrameRandom=s,this},n.Weapon.prototype.addBulletAnimation=function(t,e,i,n,s){return this.anims[t]={name:t,frames:e,frameRate:i,loop:n,useNumericIndex:s},this.bullets.callAll("animations.add","animations",t,e,i,n,s),this.bulletAnimation=t,this},n.Weapon.prototype.debug=function(t,e,i){void 0===t&&(t=16),void 0===e&&(e=32),void 0===i&&(i=!1),this.game.debug.text("Weapon Plugin",t,e),this.game.debug.text("Bullets Alive: "+this.bullets.total+" - Total: "+this.bullets.length,t,e+24),i&&this.bullets.forEachExists(this.game.debug.body,this.game.debug,"rgba(255, 0, 255, 0.8)")},Object.defineProperty(n.Weapon.prototype,"bulletClass",{get:function(){return this._bulletClass},set:function(t){this._bulletClass=t,this.bullets&&(this.bullets.classType=this._bulletClass)}}),Object.defineProperty(n.Weapon.prototype,"bulletKillType",{get:function(){return this._bulletKillType},set:function(t){switch(t){case n.Weapon.KILL_STATIC_BOUNDS:case n.Weapon.KILL_WEAPON_BOUNDS:this.bulletBounds=this.bounds;break;case n.Weapon.KILL_CAMERA_BOUNDS:this.bulletBounds=this.game.camera.view;break;case n.Weapon.KILL_WORLD_BOUNDS:this.bulletBounds=this.game.world.bounds}this._bulletKillType=t}}),Object.defineProperty(n.Weapon.prototype,"bulletCollideWorldBounds",{get:function(){return this._bulletCollideWorldBounds},set:function(t){this._bulletCollideWorldBounds=t,this.bullets.setAll("body.collideWorldBounds",t),this.bullets.setAll("data.bodyDirty",!1)}}),Object.defineProperty(n.Weapon.prototype,"x",{get:function(){return this.fireFrom.x},set:function(t){this.fireFrom.x=t}}),Object.defineProperty(n.Weapon.prototype,"y",{get:function(){return this.fireFrom.y},set:function(t){this.fireFrom.y=t}}), /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Bullet=function(t,e,i,n,r){s.Sprite.call(this,t,e,i,n,r),this.anchor.set(.5),this.data={bulletManager:null,fromX:0,fromY:0,bodyDirty:!0,rotateToVelocity:!1,killType:0,killDistance:0}},s.Bullet.prototype=Object.create(s.Sprite.prototype),s.Bullet.prototype.constructor=s.Bullet,s.Bullet.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.data.bulletManager.onKill.dispatch(this),this},s.Bullet.prototype.update=function(){this.exists&&(this.data.killType>s.Weapon.KILL_LIFESPAN&&(this.data.killType===s.Weapon.KILL_DISTANCE?this.game.physics.arcade.distanceToXY(this,this.data.fromX,this.data.fromY,!0)>this.data.killDistance&&this.kill():this.data.bulletManager.bulletBounds.intersects(this)||this.kill()),this.data.rotateToVelocity&&(this.rotation=this.body.velocity.atan()),this.data.bulletManager.bulletWorldWrap&&this.game.world.wrap(this,this.data.bulletManager.bulletWorldWrapPadding))}, +n.Bullet=function(t,e,i,s,r){n.Sprite.call(this,t,e,i,s,r),this.anchor.set(.5),this.data={bulletManager:null,fromX:0,fromY:0,bodyDirty:!0,rotateToVelocity:!1,killType:0,killDistance:0}},n.Bullet.prototype=Object.create(n.Sprite.prototype),n.Bullet.prototype.constructor=n.Bullet,n.Bullet.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.data.bulletManager.onKill.dispatch(this),this},n.Bullet.prototype.update=function(){this.exists&&(this.data.killType>n.Weapon.KILL_LIFESPAN&&(this.data.killType===n.Weapon.KILL_DISTANCE?this.game.physics.arcade.distanceToXY(this,this.data.fromX,this.data.fromY,!0)>this.data.killDistance&&this.kill():this.data.bulletManager.bulletBounds.intersects(this)||this.kill()),this.data.rotateToVelocity&&(this.rotation=this.body.velocity.atan()),this.data.bulletManager.bulletWorldWrap&&this.game.world.wrap(this,this.data.bulletManager.bulletWorldWrapPadding))}, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -s.Video=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game=t,this.key=e,this.width=0,this.height=0,this.type=s.VIDEO,this.disableTextureUpload=!1,this.touchLocked=!1,this.onPlay=new s.Signal,this.onChangeSource=new s.Signal,this.onComplete=new s.Signal,this.onAccess=new s.Signal,this.onError=new s.Signal,this.onTimeout=new s.Signal,this.onTouchUnlock=new s.Signal,this.playWhenUnlocked=!0,this.timeout=15e3,this._timeOutID=null,this.video=null,this.videoStream=null,this.isStreaming=!1,this.retryLimit=20,this.retry=0,this.retryInterval=500,this._retryID=null,this._codeMuted=!1,this._muted=!1,this._codePaused=!1,this._paused=!1,this._pending=!1,this._pendingChangeSource=!1,this._autoplay=!1,this._endCallback=null,this._playCallback=null,e&&this.game.cache.checkVideoKey(e)){var n=this.game.cache.getVideo(e);n.isBlob?this.createVideoFromBlob(n.data):this.video=n.data,this.width=this.video.videoWidth,this.height=this.video.videoHeight}else i&&this.createVideoFromURL(i,!1);this.video&&!i?(this.baseTexture=new PIXI.BaseTexture(this.video,null,this.game.resolution),this.baseTexture.forceLoaded(this.width,this.height)):(this.baseTexture=new PIXI.BaseTexture(s.Cache.DEFAULT.baseTexture.source,null,this.game.resolution),this.baseTexture.forceLoaded(this.width,this.height)),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new s.Frame(0,0,0,this.width,this.height,"video"),this.texture.setFrame(this.textureFrame),this.texture.valid=!1,null!==e&&this.video&&(this.texture.valid=this.video.canplay),this.snapshot=null,s.BitmapData&&(this.snapshot=new s.BitmapData(this.game,"",this.width,this.height)),this.game.device.needsTouchUnlock()?this.setTouchLock():n&&(n.locked=!1)},s.Video.prototype={connectToMediaStream:function(t,e){return t&&e&&(this.video=t,this.videoStream=e,this.isStreaming=!0,this.baseTexture.source=this.video,this.updateTexture(null,this.video.videoWidth,this.video.videoHeight),this.onAccess.dispatch(this)),this},startMediaStream:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=null),!this.game.device.getUserMedia)return this.onError.dispatch(this,"No getUserMedia"),!1;null!==this.videoStream&&(this.videoStream.active?this.videoStream.active=!1:this.videoStream.stop()),this.removeVideoElement(),this.video=document.createElement("video"),this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),null!==e&&(this.video.width=e),null!==i&&(this.video.height=i),this._timeOutID=window.setTimeout(this.getUserMediaTimeout.bind(this),this.timeout);try{navigator.getUserMedia({audio:t,video:!0},this.getUserMediaSuccess.bind(this),this.getUserMediaError.bind(this))}catch(t){this.getUserMediaError(t)}return this},getUserMediaTimeout:function(){clearTimeout(this._timeOutID),this.onTimeout.dispatch(this)},getUserMediaError:function(t){clearTimeout(this._timeOutID),this.onError.dispatch(this,t)},getUserMediaSuccess:function(t){clearTimeout(this._timeOutID),this.videoStream=t,void 0!==this.video.mozSrcObject?this.video.mozSrcObject=t:void 0!==this.video.srcObject?this.video.srcObject=t:this.video.src=window.URL&&window.URL.createObjectURL(t)||t;var e=this;this.video.onloadeddata=function(){var t=10;!function i(){if(t>0)if(e.video.videoWidth>0){var n=e.video.videoWidth,s=e.video.videoHeight;isNaN(e.video.videoHeight)&&(s=n/(4/3)),e.video.play(),e.isStreaming=!0,e.baseTexture.source=e.video,e.updateTexture(null,n,s),e.onAccess.dispatch(e)}else window.setTimeout(i,500);else console.warn("Unable to connect to video stream. Webcam error?");t--}()}},createVideoFromBlob:function(t){var e=this;return this.video=document.createElement("video"),this.video.controls=!1,this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),this.video.addEventListener("loadeddata",(function(t){e.updateTexture(t)}),!0),this.video.src=window.URL.createObjectURL(t),this.video.canplay=!0,this},createVideoFromURL:function(t,e){return void 0===e&&(e=!1),this.texture&&(this.texture.valid=!1),this.video=document.createElement("video"),this.video.controls=!1,e&&this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),this.video.src=t,this.video.canplay=!0,this.video.load(),this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval),this.key=t,this},updateTexture:function(t,e,i){var n=!1;null==e&&(e=this.video.videoWidth,n=!0),null==i&&(i=this.video.videoHeight),this.width=e,this.height=i,this.baseTexture.source!==this.video&&(this.baseTexture.source=this.video),this.baseTexture.forceLoaded(e,i),this.texture.frame.resize(e,i),this.texture.width=e,this.texture.height=i,this.texture.valid=!0,this.snapshot&&this.snapshot.resize(e,i),n&&null!==this.key&&(this.onChangeSource.dispatch(this,e,i),this._autoplay&&(this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate)))},complete:function(){this.onComplete.dispatch(this)},play:function(t,e){return this._pendingChangeSource||(void 0===t&&(t=!1),void 0===e&&(e=1),this.game.sound.onMute&&(this.game.sound.onMute.add(this.setMute,this),this.game.sound.onUnMute.add(this.unsetMute,this),this.game.sound.mute&&this.setMute()),this.game.onPause.add(this.setPause,this),this.game.onResume.add(this.setResume,this),this._endCallback=this.complete.bind(this),this.video.addEventListener("ended",this._endCallback,!0),this.video.addEventListener("webkitendfullscreen",this._endCallback,!0),this.video.loop=t?"loop":"",this.video.playbackRate=e,this.touchLocked?this._pending=!0:(this._pending=!1,null!==this.key&&(4!==this.video.readyState?(this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval)):(this._playCallback=this.playHandler.bind(this),this.video.addEventListener("playing",this._playCallback,!0))),this.video.play(),this.onPlay.dispatch(this,t,e))),this},playHandler:function(){this.video.removeEventListener("playing",this._playCallback,!0),this.updateTexture()},stop:function(){return this.game.sound.onMute&&(this.game.sound.onMute.remove(this.setMute,this),this.game.sound.onUnMute.remove(this.unsetMute,this)),this.game.onPause.remove(this.setPause,this),this.game.onResume.remove(this.setResume,this),this.isStreaming?(this.video.mozSrcObject?(this.video.mozSrcObject.stop(),this.video.src=null):this.video.srcObject?(this.video.srcObject.stop(),this.video.src=null):(this.video.src="",this.videoStream.active?this.videoStream.active=!1:this.videoStream.getTracks?this.videoStream.getTracks().forEach((function(t){t.stop()})):this.videoStream.stop()),this.videoStream=null,this.isStreaming=!1):(this.video.removeEventListener("ended",this._endCallback,!0),this.video.removeEventListener("webkitendfullscreen",this._endCallback,!0),this.video.removeEventListener("playing",this._playCallback,!0),this.touchLocked?this._pending=!1:this.video.pause()),this},add:function(t){if(Array.isArray(t))for(var e=0;e0?this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval):console.warn("Phaser.Video: Unable to start downloading video in time",this.isStreaming))},setTouchLock:function(){this.game.input.addTouchLockCallback(this.unlock,this,!0),this.touchLocked=!0},unlock:function(){if(this.touchLocked=!1,this.playWhenUnlocked&&(this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate)),this.key){var t=this.game.cache.getVideo(this.key);t&&!t.isBlob&&(t.locked=!1)}return this.onTouchUnlock.dispatch(this),!0},grab:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=1),void 0===i&&(i=null),null!==this.snapshot)return t&&this.snapshot.cls(),this.snapshot.copy(this.video,0,0,this.width,this.height,0,0,this.width,this.height,0,0,0,1,1,e,i),this.snapshot;console.warn("Video.grab cannot run because Phaser.BitmapData is unavailable")},removeVideoElement:function(){if(this.video){for(this.video.parentNode&&this.video.parentNode.removeChild(this.video);this.video.hasChildNodes();)this.video.removeChild(this.video.firstChild);this.video.removeAttribute("autoplay"),this.video.removeAttribute("src"),this.video=null}},destroy:function(){this.stop(),this.removeVideoElement(),this.touchLocked&&this.game.input.removeTouchLockCallback(this.unlock,this),this._retryID&&window.clearTimeout(this._retryID)}},Object.defineProperty(s.Video.prototype,"currentTime",{get:function(){return this.video?this.video.currentTime:0},set:function(t){this.video.currentTime=t}}),Object.defineProperty(s.Video.prototype,"duration",{get:function(){return this.video?this.video.duration:0}}),Object.defineProperty(s.Video.prototype,"progress",{get:function(){return this.video?this.video.currentTime/this.video.duration:0}}),Object.defineProperty(s.Video.prototype,"mute",{get:function(){return this._muted},set:function(t){if(t=t||null){if(this._muted)return;this._codeMuted=!0,this.setMute()}else{if(!this._muted)return;this._codeMuted=!1,this.unsetMute()}}}),Object.defineProperty(s.Video.prototype,"paused",{get:function(){return this._paused},set:function(t){if(t=t||null,!this.touchLocked)if(t){if(this._paused)return;this._codePaused=!0,this.setPause()}else{if(!this._paused)return;this._codePaused=!1,this.setResume()}}}),Object.defineProperty(s.Video.prototype,"volume",{get:function(){return this.video?this.video.volume:1},set:function(t){t<0?t=0:t>1&&(t=1),this.video&&(this.video.volume=t)}}),Object.defineProperty(s.Video.prototype,"playbackRate",{get:function(){return this.video?this.video.playbackRate:1},set:function(t){this.video&&(this.video.playbackRate=t)}}),Object.defineProperty(s.Video.prototype,"loop",{get:function(){return!!this.video&&this.video.loop},set:function(t){t&&this.video?this.video.loop="loop":this.video&&(this.video.loop="")}}),Object.defineProperty(s.Video.prototype,"playing",{get:function(){return!!this.video&&!(this.video.paused&&this.video.ended)}}),s.Video.prototype.constructor=s.Video, +n.Video=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game=t,this.key=e,this.width=0,this.height=0,this.type=n.VIDEO,this.disableTextureUpload=!1,this.touchLocked=!1,this.onPlay=new n.Signal,this.onChangeSource=new n.Signal,this.onComplete=new n.Signal,this.onAccess=new n.Signal,this.onError=new n.Signal,this.onTimeout=new n.Signal,this.onTouchUnlock=new n.Signal,this.playWhenUnlocked=!0,this.timeout=15e3,this._timeOutID=null,this.video=null,this.videoStream=null,this.isStreaming=!1,this.retryLimit=20,this.retry=0,this.retryInterval=500,this._retryID=null,this._codeMuted=!1,this._muted=!1,this._codePaused=!1,this._paused=!1,this._pending=!1,this._pendingChangeSource=!1,this._autoplay=!1,this._endCallback=null,this._playCallback=null,e&&this.game.cache.checkVideoKey(e)){var s=this.game.cache.getVideo(e);s.isBlob?this.createVideoFromBlob(s.data):this.video=s.data,this.width=this.video.videoWidth,this.height=this.video.videoHeight}else i&&this.createVideoFromURL(i,!1);this.video&&!i?(this.baseTexture=new PIXI.BaseTexture(this.video,null,this.game.resolution),this.baseTexture.forceLoaded(this.width,this.height)):(this.baseTexture=new PIXI.BaseTexture(n.Cache.DEFAULT.baseTexture.source,null,this.game.resolution),this.baseTexture.forceLoaded(this.width,this.height)),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new n.Frame(0,0,0,this.width,this.height,"video"),this.texture.setFrame(this.textureFrame),this.texture.valid=!1,null!==e&&this.video&&(this.texture.valid=this.video.canplay),this.snapshot=null,n.BitmapData&&(this.snapshot=new n.BitmapData(this.game,"",this.width,this.height)),this.game.device.needsTouchUnlock()?this.setTouchLock():s&&(s.locked=!1)},n.Video.prototype={connectToMediaStream:function(t,e){return t&&e&&(this.video=t,this.videoStream=e,this.isStreaming=!0,this.baseTexture.source=this.video,this.updateTexture(null,this.video.videoWidth,this.video.videoHeight),this.onAccess.dispatch(this)),this},startMediaStream:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=null),!this.game.device.getUserMedia)return this.onError.dispatch(this,"No getUserMedia"),!1;null!==this.videoStream&&(this.videoStream.active?this.videoStream.active=!1:this.videoStream.stop()),this.removeVideoElement(),this.video=document.createElement("video"),this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),null!==e&&(this.video.width=e),null!==i&&(this.video.height=i),this._timeOutID=window.setTimeout(this.getUserMediaTimeout.bind(this),this.timeout);try{navigator.getUserMedia({audio:t,video:!0},this.getUserMediaSuccess.bind(this),this.getUserMediaError.bind(this))}catch(t){this.getUserMediaError(t)}return this},getUserMediaTimeout:function(){clearTimeout(this._timeOutID),this.onTimeout.dispatch(this)},getUserMediaError:function(t){clearTimeout(this._timeOutID),this.onError.dispatch(this,t)},getUserMediaSuccess:function(t){clearTimeout(this._timeOutID),this.videoStream=t,void 0!==this.video.mozSrcObject?this.video.mozSrcObject=t:void 0!==this.video.srcObject?this.video.srcObject=t:this.video.src=window.URL&&window.URL.createObjectURL(t)||t;var e=this;this.video.onloadeddata=function(){var t=10;!function i(){if(t>0)if(e.video.videoWidth>0){var n=e.video.videoWidth,s=e.video.videoHeight;isNaN(e.video.videoHeight)&&(s=n/(4/3)),e.video.play(),e.isStreaming=!0,e.baseTexture.source=e.video,e.updateTexture(null,n,s),e.onAccess.dispatch(e)}else window.setTimeout(i,500);else console.warn("Unable to connect to video stream. Webcam error?");t--}()}},createVideoFromBlob:function(t){var e=this;return this.video=document.createElement("video"),this.video.controls=!1,this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),this.video.addEventListener("loadeddata",(function(t){e.updateTexture(t)}),!0),this.video.src=window.URL.createObjectURL(t),this.video.canplay=!0,this},createVideoFromURL:function(t,e){return void 0===e&&(e=!1),this.texture&&(this.texture.valid=!1),this.video=document.createElement("video"),this.video.controls=!1,e&&this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),this.video.src=t,this.video.canplay=!0,this.video.load(),this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval),this.key=t,this},updateTexture:function(t,e,i){var n=!1;null==e&&(e=this.video.videoWidth,n=!0),null==i&&(i=this.video.videoHeight),this.width=e,this.height=i,this.baseTexture.source!==this.video&&(this.baseTexture.source=this.video),this.baseTexture.forceLoaded(e,i),this.texture.frame.resize(e,i),this.texture.width=e,this.texture.height=i,this.texture.valid=!0,this.snapshot&&this.snapshot.resize(e,i),n&&null!==this.key&&(this.onChangeSource.dispatch(this,e,i),this._autoplay&&(this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate)))},complete:function(){this.onComplete.dispatch(this)},play:function(t,e){return this._pendingChangeSource||(void 0===t&&(t=!1),void 0===e&&(e=1),this.game.sound.onMute&&(this.game.sound.onMute.add(this.setMute,this),this.game.sound.onUnMute.add(this.unsetMute,this),this.game.sound.mute&&this.setMute()),this.game.onPause.add(this.setPause,this),this.game.onResume.add(this.setResume,this),this._endCallback=this.complete.bind(this),this.video.addEventListener("ended",this._endCallback,!0),this.video.addEventListener("webkitendfullscreen",this._endCallback,!0),this.video.loop=t?"loop":"",this.video.playbackRate=e,this.touchLocked?this._pending=!0:(this._pending=!1,null!==this.key&&(4!==this.video.readyState?(this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval)):(this._playCallback=this.playHandler.bind(this),this.video.addEventListener("playing",this._playCallback,!0))),this.video.play(),this.onPlay.dispatch(this,t,e))),this},playHandler:function(){this.video.removeEventListener("playing",this._playCallback,!0),this.updateTexture()},stop:function(){return this.game.sound.onMute&&(this.game.sound.onMute.remove(this.setMute,this),this.game.sound.onUnMute.remove(this.unsetMute,this)),this.game.onPause.remove(this.setPause,this),this.game.onResume.remove(this.setResume,this),this.isStreaming?(this.video.mozSrcObject?(this.video.mozSrcObject.stop(),this.video.src=null):this.video.srcObject?(this.video.srcObject.stop(),this.video.src=null):(this.video.src="",this.videoStream.active?this.videoStream.active=!1:this.videoStream.getTracks?this.videoStream.getTracks().forEach((function(t){t.stop()})):this.videoStream.stop()),this.videoStream=null,this.isStreaming=!1):(this.video.removeEventListener("ended",this._endCallback,!0),this.video.removeEventListener("webkitendfullscreen",this._endCallback,!0),this.video.removeEventListener("playing",this._playCallback,!0),this.touchLocked?this._pending=!1:this.video.pause()),this},add:function(t){if(Array.isArray(t))for(var e=0;e0?this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval):console.warn("Phaser.Video: Unable to start downloading video in time",this.isStreaming))},setTouchLock:function(){this.game.input.addTouchLockCallback(this.unlock,this,!0),this.touchLocked=!0},unlock:function(){if(this.touchLocked=!1,this.playWhenUnlocked&&(this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate)),this.key){var t=this.game.cache.getVideo(this.key);t&&!t.isBlob&&(t.locked=!1)}return this.onTouchUnlock.dispatch(this),!0},grab:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=1),void 0===i&&(i=null),null!==this.snapshot)return t&&this.snapshot.cls(),this.snapshot.copy(this.video,0,0,this.width,this.height,0,0,this.width,this.height,0,0,0,1,1,e,i),this.snapshot;console.warn("Video.grab cannot run because Phaser.BitmapData is unavailable")},removeVideoElement:function(){if(this.video){for(this.video.parentNode&&this.video.parentNode.removeChild(this.video);this.video.hasChildNodes();)this.video.removeChild(this.video.firstChild);this.video.removeAttribute("autoplay"),this.video.removeAttribute("src"),this.video=null}},destroy:function(){this.stop(),this.removeVideoElement(),this.touchLocked&&this.game.input.removeTouchLockCallback(this.unlock,this),this._retryID&&window.clearTimeout(this._retryID)}},Object.defineProperty(n.Video.prototype,"currentTime",{get:function(){return this.video?this.video.currentTime:0},set:function(t){this.video.currentTime=t}}),Object.defineProperty(n.Video.prototype,"duration",{get:function(){return this.video?this.video.duration:0}}),Object.defineProperty(n.Video.prototype,"progress",{get:function(){return this.video?this.video.currentTime/this.video.duration:0}}),Object.defineProperty(n.Video.prototype,"mute",{get:function(){return this._muted},set:function(t){if(t=t||null){if(this._muted)return;this._codeMuted=!0,this.setMute()}else{if(!this._muted)return;this._codeMuted=!1,this.unsetMute()}}}),Object.defineProperty(n.Video.prototype,"paused",{get:function(){return this._paused},set:function(t){if(t=t||null,!this.touchLocked)if(t){if(this._paused)return;this._codePaused=!0,this.setPause()}else{if(!this._paused)return;this._codePaused=!1,this.setResume()}}}),Object.defineProperty(n.Video.prototype,"volume",{get:function(){return this.video?this.video.volume:1},set:function(t){t<0?t=0:t>1&&(t=1),this.video&&(this.video.volume=t)}}),Object.defineProperty(n.Video.prototype,"playbackRate",{get:function(){return this.video?this.video.playbackRate:1},set:function(t){this.video&&(this.video.playbackRate=t)}}),Object.defineProperty(n.Video.prototype,"loop",{get:function(){return!!this.video&&this.video.loop},set:function(t){t&&this.video?this.video.loop="loop":this.video&&(this.video.loop="")}}),Object.defineProperty(n.Video.prototype,"playing",{get:function(){return!!this.video&&!(this.video.paused&&this.video.ended)}}),n.Video.prototype.constructor=n.Video, /** * @author Richard Davey * @copyright 2016 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -void 0===PIXI.blendModes&&(PIXI.blendModes=s.blendModes),void 0===PIXI.scaleModes&&(PIXI.scaleModes=s.scaleModes),void 0===PIXI.Texture.emptyTexture&&(PIXI.Texture.emptyTexture=new PIXI.Texture(new PIXI.BaseTexture)),void 0===PIXI.DisplayObject._tempMatrix&&(PIXI.DisplayObject._tempMatrix=new s.Matrix),PIXI.TextureSilentFail=!0,PIXI.canUseNewCanvasBlendModes=function(){return s.Device.canUseMultiply},t.exports&&(e=t.exports=s),e.Phaser=s,s}).call(this)}).call(this,i(33))},function(t,e){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var h,l=[],u=!1,c=-1;function d(){u&&h&&(u=!1,h.length?l=h.concat(l):c=-1,l.length&&p())}function p(){if(!u){var t=a(d);u=!0;for(var e=l.length;e;){for(h=l,l=[];++c1)for(var i=1;i>16),u((65280&s)>>8),u(255&s);return 2==r?u(255&(s=l(t.charAt(i))<<2|l(t.charAt(i+1))>>4)):1==r&&(u((s=l(t.charAt(i))<<10|l(t.charAt(i+1))<<4|l(t.charAt(i+2))>>2)>>8&255),u(255&s)),o},t.fromByteArray=function(t){var e,i,n,s,r=t.length%3,o="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,n=t.length-r;e>18&63)+a(s>>12&63)+a(s>>6&63)+a(63&s);switch(r){case 1:o+=a((i=t[t.length-1])>>2),o+=a(i<<4&63),o+="==";break;case 2:o+=a((i=(t[t.length-2]<<8)+t[t.length-1])>>10),o+=a(i>>4&63),o+=a(i<<2&63),o+="="}return o}}(void 0===i?this.base64js={}:i)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,i){(function(e,n,s,r,o,a,h,l,u){var c=t("base64-js"),d=t("ieee754");function s(t,e,i){if(!(this instanceof s))return new s(t,e,i);var n,r,o,a,h,l=typeof t;if("base64"===e&&"string"==l)for(t=(n=t).trim?n.trim():n.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==l)r=D(t);else if("string"==l)r=s.byteLength(t,e);else{if("object"!=l)throw new Error("First argument needs to be a number, array or string.");r=D(t.length)}if(s._useTypedArrays?o=s._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),s._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(k(h=t)||s.isBuffer(h)||h&&"object"==typeof h&&"number"==typeof h.length)for(a=0;a>>0)):(e+1>>0),s}function y(t,e,i,n){if(n||(N("boolean"==typeof i,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+1>>8*(n?o:1-o)}function _(t,e,i,n,s){s||(N(null!=e,"missing value"),N("boolean"==typeof n,"missing or invalid endian"),N(null!=i,"missing offset"),N(i+3>>8*(n?o:3-o)&255}function C(t,e,i,n,s){s||(N(null!=e,"missing value"),N("boolean"==typeof n,"missing or invalid endian"),N(null!=i,"missing offset"),N(i+1>8,n=e%256,s.push(n),s.push(i);return s}(e),t,i,n)}(this,t,e,i);break;default:throw new Error("Unknown encoding")}return o},s.prototype.toString=function(t,e,i){var n,s,r,o,a=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(i=void 0!==i?Number(i):i=a.length)===e)return"";switch(t){case"hex":n=function(t,e,i){var n=t.length;(!e||e<0)&&(e=0),(!i||i<0||nthis.length&&(n=this.length),t.length-e=this.length))return this[t]},s.prototype.readUInt16LE=function(t,e){return g(this,t,!0,e)},s.prototype.readUInt16BE=function(t,e){return g(this,t,!1,e)},s.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e)},s.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e)},s.prototype.readInt8=function(t,e){if(e||(N(null!=t,"missing offset"),N(t=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){return y(this,t,!0,e)},s.prototype.readInt16BE=function(t,e){return y(this,t,!1,e)},s.prototype.readInt32LE=function(t,e){return v(this,t,!0,e)},s.prototype.readInt32BE=function(t,e){return v(this,t,!1,e)},s.prototype.readFloatLE=function(t,e){return x(this,t,!0,e)},s.prototype.readFloatBE=function(t,e){return x(this,t,!1,e)},s.prototype.readDoubleLE=function(t,e){return b(this,t,!0,e)},s.prototype.readDoubleBE=function(t,e){return b(this,t,!1,e)},s.prototype.writeUInt8=function(t,e,i){i||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e=this.length||(this[e]=t)},s.prototype.writeUInt16LE=function(t,e,i){w(this,t,e,!0,i)},s.prototype.writeUInt16BE=function(t,e,i){w(this,t,e,!1,i)},s.prototype.writeUInt32LE=function(t,e,i){_(this,t,e,!0,i)},s.prototype.writeUInt32BE=function(t,e,i){_(this,t,e,!1,i)},s.prototype.writeInt8=function(t,e,i){i||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e=this.length||(0<=t?this.writeUInt8(t,e,i):this.writeUInt8(255+t+1,e,i))},s.prototype.writeInt16LE=function(t,e,i){C(this,t,e,!0,i)},s.prototype.writeInt16BE=function(t,e,i){C(this,t,e,!1,i)},s.prototype.writeInt32LE=function(t,e,i){S(this,t,e,!0,i)},s.prototype.writeInt32BE=function(t,e,i){S(this,t,e,!1,i)},s.prototype.writeFloatLE=function(t,e,i){T(this,t,e,!0,i)},s.prototype.writeFloatBE=function(t,e,i){T(this,t,e,!1,i)},s.prototype.writeDoubleLE=function(t,e,i){A(this,t,e,!0,i)},s.prototype.writeDoubleBE=function(t,e,i){A(this,t,e,!1,i)},s.prototype.fill=function(t,e,i){if(t=t||0,e=e||0,i=i||this.length,"string"==typeof t&&(t=t.charCodeAt(0)),N("number"==typeof t&&!isNaN(t),"value is not a number"),N(e<=i,"end < start"),i!==e&&0!==this.length){N(0<=e&&e"},s.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(s._useTypedArrays)return new s(this).buffer;for(var t=new Uint8Array(this.length),e=0,i=t.length;e=e.length||s>=t.length);s++)e[s+i]=t[s];return s}function L(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function O(t,e){N("number"==typeof t,"cannot write a non-number as a number"),N(0<=t,"specified a negative value for writing an unsigned value"),N(t<=e,"value is larger than maximum value for type"),N(Math.floor(t)===t,"value has a fractional component")}function R(t,e,i){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(i<=t,"value smaller than minimum allowed value"),N(Math.floor(t)===t,"value has a fractional component")}function U(t,e,i){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(i<=t,"value smaller than minimum allowed value")}function N(t,e){if(!t)throw new Error(e||"Failed assertion")}s._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=E.get,t.set=E.set,t.write=E.write,t.toString=E.toString,t.toLocaleString=E.toString,t.toJSON=E.toJSON,t.copy=E.copy,t.slice=E.slice,t.readUInt8=E.readUInt8,t.readUInt16LE=E.readUInt16LE,t.readUInt16BE=E.readUInt16BE,t.readUInt32LE=E.readUInt32LE,t.readUInt32BE=E.readUInt32BE,t.readInt8=E.readInt8,t.readInt16LE=E.readInt16LE,t.readInt16BE=E.readInt16BE,t.readInt32LE=E.readInt32LE,t.readInt32BE=E.readInt32BE,t.readFloatLE=E.readFloatLE,t.readFloatBE=E.readFloatBE,t.readDoubleLE=E.readDoubleLE,t.readDoubleBE=E.readDoubleBE,t.writeUInt8=E.writeUInt8,t.writeUInt16LE=E.writeUInt16LE,t.writeUInt16BE=E.writeUInt16BE,t.writeUInt32LE=E.writeUInt32LE,t.writeUInt32BE=E.writeUInt32BE,t.writeInt8=E.writeInt8,t.writeInt16LE=E.writeInt16LE,t.writeInt16BE=E.writeInt16BE,t.writeInt32LE=E.writeInt32LE,t.writeInt32BE=E.writeInt32BE,t.writeFloatLE=E.writeFloatLE,t.writeFloatBE=E.writeFloatBE,t.writeDoubleLE=E.writeDoubleLE,t.writeDoubleBE=E.writeDoubleBE,t.fill=E.fill,t.inspect=E.inspect,t.toArrayBuffer=E.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,i){(function(i,n,s,r,o,a,h,l,u){var c=new(s=t("buffer").Buffer)(4);c.fill(0),e.exports={hash:function(t,e,i,n){return s.isBuffer(t)||(t=new s(t)),function(t,e,i){for(var n=new s(e),r=i?n.writeInt32BE:n.writeInt32LE,o=0;og?e=t(e):e.length>5]|=128<>>9<<4)]=e;for(var i=1732584193,n=-271733879,s=-1732584194,r=271733878,o=0;o>>32-a,i);var o,a}function f(t,e,i,n,s,r,o){return p(e&i|~e&n,t,e,s,r,o)}function g(t,e,i,n,s,r,o){return p(e&n|i&~n,t,e,s,r,o)}function m(t,e,i,n,s,r,o){return p(e^i^n,t,e,s,r,o)}function y(t,e,i,n,s,r,o){return p(i^(e|~n),t,e,s,r,o)}function v(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}e.exports=function(t){return c.hash(t,d,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,i){(function(t,i,n,s,r,o,a,h,l){var u;u=function(t){for(var e,i=new Array(t),n=0;n>>((3&n)<<3)&255;return i},e.exports=u}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,i){(function(i,n,s,r,o,a,h,l,u){var c=t("./helpers");function d(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var i,n=Array(80),s=1732584193,r=-271733879,o=-1732584194,a=271733878,h=-1009589776,l=0;l>16)+(e>>16)+(i>>16)<<16|65535&i}function g(t,e){return t<>>32-e}e.exports=function(t){return c.hash(t,d,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,i){(function(i,n,s,r,o,a,h,l,u){function c(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function d(t,e){return t>>>e|t<<32-e}function p(t,e){return t>>>e}function f(t,e){var i,n,s,r,o,a,h,l,u,f,g,m,y,v,x,b,w,_,C=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),S=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),T=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var A=0;A>1,u=-7,c=i?s-1:0,d=i?-1:1,p=t[e+c];for(c+=d,r=p&(1<<-u)-1,p>>=-u,u+=a;0>=-u,u+=n;0>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),2<=(e+=1<=o+c?d/h:d*Math.pow(2,1-c))*h&&(o++,h/=2),u<=o+c?(a=0,o=u):1<=o+c?(a=(e*h-1)*Math.pow(2,s),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,s),o=0));8<=s;t[i+p]=255&a,p+=f,a/=256,s-=8);for(o=o<0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]":a.tag.startsWith("color")?(r.push("mark"),o+=""):"bold"===a.tag?(r.push("strong"),o+=""):"italic"===a.tag&&(r.push("em"),o+=""):o+=a.text}return o.replace(/\n/g,"
")}var o=function(){function t(t){var e=this;this.game=t,this.debug=!1,this.state={name:"",text:"",choices:[],buttons:[],sliders:[]},this.updateLayout=function(){e.updateLayoutContainer(),e.updateLayoutText(),e.updateLayoutChoices(),e.updateLayoutButtons(),e.updateLayoutSliders()},this.elContainer=document.createElement("div"),this.elContainer.style.position="fixed",this.elContainer.style.pointerEvents="none",this.debug&&(this.elContainer.style.border="solid 1px red"),this.elProgress=document.createElement("progress"),this.elProgress.max=100,this.elProgress.value=0,this.debug||(this.elProgress.style.opacity="0"),this.elChoices=document.createElement("ol"),this.elChoices.style.listStyle="none",this.elButtons=document.createElement("ul"),this.elButtons.style.listStyle="none",this.elSliders=document.createElement("ul"),this.elSliders.style.listStyle="none",this.elText=document.createElement("div"),this.elText.setAttribute("aria-live","polite"),this.elText.setAttribute("aria-atomic","true"),this.elText.setAttribute("aria-relevant","text"),this.elText.setAttribute("role","main"),this.elText.setAttribute("aria-roledescription","text"),this.elText.tabIndex=0,this.elText.onclick=function(){e.game.onTap(null)},this.elText.style.position="absolute",this.debug?(this.elText.style.color="red",this.elText.style.top="1rem",this.elText.style.left="1rem",this.elText.style.right="1rem",this.elText.style.bottom="1rem"):(this.elText.style.color="transparent",this.elText.style.fontSize="0",this.elText.style.outline="none",this.elText.style.top="0",this.elText.style.left="0",this.elText.style.right="0",this.elText.style.bottom="0"),this.elContainer.appendChild(this.elProgress),this.elContainer.appendChild(this.elText),this.elContainer.appendChild(this.elChoices),this.elContainer.appendChild(this.elSliders),this.elContainer.appendChild(this.elButtons)}return t.prototype.boot=function(){var t=this;this.game.canvas.setAttribute("aria-hidden","true"),this.game.scale.onSizeChange.add(this.updateLayout),this.updateLayout(),this.game.load.onLoadStart.add((function(){t.updateLayout(),t.busy(),t.progress(0)})),this.game.load.onLoadComplete.add((function(){t.progress(100),t.ready()})),this.game.load.onFileComplete.add((function(e){t.progress(e)})),document.body.appendChild(this.elContainer)},t.prototype.progress=function(t){void 0===t?delete this.elProgress.value:this.elProgress.value=Math.floor(t)},t.prototype.busy=function(){this.elText.setAttribute("aria-busy","true")},t.prototype.ready=function(){this.elText.setAttribute("aria-busy","false")},t.prototype.updateLayoutText=function(){var t,e=r("hud"!==(null===(t=this.game.gui)||void 0===t?void 0:t.currentMenu)?"":s(this.state.text).split("\n").map((function(t){return t.trim()})).filter((function(t){return t})).join("\n"));e.length>0&&this.state.name&&(e=s(this.state.name)+": "+e),this.elText.innerHTML=e},t.prototype.updateLayoutContainer=function(){this.elContainer.style.width=this.game.scale.width+"px",this.elContainer.style.height=this.game.scale.height+"px",this.elContainer.style.top=this.game.scale.margin.top+"px",this.elContainer.style.left=this.game.scale.margin.left+"px"},t.prototype.updateLayoutBounds=function(t,e){t.style.width=e.width*this.game.scale.scaleFactorInversed.x+"px",t.style.height=e.height*this.game.scale.scaleFactorInversed.y+"px",t.style.top=e.y*this.game.scale.scaleFactorInversed.y+"px",t.style.left=e.x*this.game.scale.scaleFactorInversed.x+"px"},t.prototype.updateLayoutList=function(t,e){var i=this;this.rescueFocus(t),e.forEach((function(e,n){var s=t.children[n];s.style.display=e.isActive()?null:"none",i.updateLayoutBounds(s,e.getBounds())}))},t.prototype.updateLayoutChoices=function(){this.updateLayoutList(this.elChoices,this.state.choices)},t.prototype.updateLayoutButtons=function(){this.updateLayoutList(this.elButtons,this.state.buttons)},t.prototype.updateLayoutSliders=function(){this.updateLayoutList(this.elSliders,this.state.sliders)},t.prototype.rescueFocus=function(t){var e=document.activeElement;t!==e&&(e&&!t.contains(e)||this.elText.focus())},t.prototype.text=function(t){void 0===t&&(t=""),this.state.text=t,this.updateLayoutText()},t.prototype.name=function(t){void 0===t&&(t=""),this.state.name=t,this.updateLayoutText()},t.prototype.button=function(t){var e,i,n;this.state.buttons.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("button");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.textContent=(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.buttons)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Button "+this.state.buttons.length,r.onclick=t.onclick,r.onfocus=t.onfocus,r.onblur=t.onblur,s.appendChild(r),this.elButtons.appendChild(s),this.updateLayoutButtons()},t.prototype.slider=function(t){var e,i,n;this.state.sliders.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("input");r.type="number",r.setAttribute("aria-label",(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.sliders)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Slider "+this.state.buttons.length),r.min=t.min.toString(10),r.max=t.max.toString(10),r.step=t.step.toString(10),r.value=t.get().toString(10),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.appearance="textfield",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.onchange=function(e){return t.set(Number(e.currentTarget.value))},r.onfocus=function(){r.value=t.get().toString(10)},s.appendChild(r),this.elSliders.appendChild(s),this.updateLayoutSliders()},t.prototype.choices=function(t){var e=this;void 0===t&&(t=[]),this.state.choices=t,this.rescueFocus(this.elChoices),this.elChoices.innerHTML="",t.forEach((function(t){var i,n,s,o=document.createElement("li");o.style.position="absolute";var a=document.createElement("button");a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.background="transparent",e.debug?(a.style.border="solid 1px red",a.style.color="red"):(a.style.border="none",a.style.color="transparent",a.style.fontSize="0"),a.innerHTML=r(null!==(s=null===(n=null===(i=e.game.storyAccessibility)||void 0===i?void 0:i.choices)||void 0===n?void 0:n[t.label])&&void 0!==s?s:t.label),a.onclick=t.onclick,a.onfocus=t.onfocus,a.onblur=t.onblur,o.appendChild(a),e.elChoices.appendChild(o)})),this.updateLayoutChoices()},t}();e.default=o},function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]2&&(l=parseInt(o[2],10)),this.cgs[t].animations.add(r,a,l)}n||(n={x:this.cgs[t].x,y:this.cgs[t].y}),i.zoom&&this.cgs[t].scale.set(i.zoom);var u=!1;if(void 0!==i.flipped){var c=this.cgs[t].scale.x<0;"flip"===i.flipped?(this.cgs[t].scale.x*=-1,u=!c):(u=i.flipped)!==c&&(this.cgs[t].scale.x*=-1)}return i.angle&&(this.cgs[t].angle=i.angle),this.current[t]={name:t,position:n,zoom:i.zoom,angle:i.angle,layer:i.layer,flipped:u},this.transition.get(e)(s,this.cgs[t],n)},t.prototype.animate=function(t,e){return s(this,void 0,void 0,(function(){var i,s,o=this;return r(this,(function(r){return i=e.time,s={},void 0!==e.alpha&&null!==e.alpha&&(s.alpha=e.alpha),void 0!==e.angle&&null!==e.angle&&(s.angle=e.angle),void 0!==e.position&&null!==e.position&&(s.x=e.position.x,s.y=e.position.y),void 0!==e.zoom&&null!==e.zoom&&(this.cgs[t].originalScale||(this.cgs[t].originalScale={width:this.cgs[t].width,height:this.cgs[t].height}),s.height=this.cgs[t].originalScale.height*e.zoom,s.width=this.cgs[t].originalScale.width*e.zoom),this.current[t]=n(n({},this.current[t]),e),[2,new Promise((function(n){var r=n;if(e.spritesheet){var a=function(){o.cgs[t].animations.stop(),n()};if("STOP"===e.spritesheet)o.cgs[t].frame=0,a();else{var h=e.spritesheet.split(" "),l=h[0],u=h.includes("LOOPED"),c=o.cgs[t].animations.getAnimation(l);if(h.includes("BACKWARDS")&&c.reverseOnce(),c.play(null,u),0===Object.keys(s).length)return u?i?o.game.waitTimeout(i,a.bind(o)):n():o.game.control.skipping?a():c.onComplete.addOnce(a.bind(o));r=a.bind(o)}}o.game.managers.tween.tween(o.cgs[t],s,r,i,!0)}))]}))}))},t.prototype.hide=function(t,e){return s(this,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return[4,this.transition.get(e)(this.cgs[t],null)];case 1:return i.sent(),this.cgs[t].destroy(),delete this.cgs[t],delete this.current[t],[2]}}))}))},t.prototype.isCGS=function(t){return this.game.setup.cgs&&t in this.game.setup.cgs},t}();e.default=l},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0,e.range=function(t,e,i){void 0===i&&(i=1);for(var n=[t],s=t;s0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&(n.available=this.evalExpression(s[1]),n.choiceText=s[0].trim()),e.interrupt&&(n.interrupt=!0,n.origin=e.interrupt),n},LogicManager.prototype.choose=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:return e=this.currentChoices[t],this.updateChoiceLog(e.index),this.game.storyConfig.keepStoryLog&&this.game.storyLog.push({message:e.choiceText,choice:!0}),i=e.actions,this.game.managers.story.currentScene=i.concat(this.game.managers.story.currentScene),this.showingText&&t++,this.interrupting?this.game.control.execStack.stack("interrupt",i.length,e.index,e.origin):this.game.control.execStack.stack("choice",i.length,e.index),this.game.config.debugMode&&console.log("Choice taken "+t+" : "+e.choiceText),[4,this.clearChoices()];case 1:return n.sent(),this.interrupting?this.interrupting=null:this.game.resolveAction(),[2]}}))}))},LogicManager.prototype.getExecStackId=function(){var t=this.game.control.execStack.hash();return this.choicesLog[t]||(this.choicesLog[t]=[]),t},LogicManager.prototype.checkTextAction=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i,n=this;return __generator(this,(function(s){return!(e=this.game.managers.story.parseAction(__assign({},t)))||"say"!==e.actionType&&"text"!==e.actionType?[2,!1]:((i=e).dontHide=!0,[2,new Promise((function(t){i.resolve=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(i){switch(i.label){case 0:return[4,e];case 1:return i.sent(),t(!0),[2]}}))}))},i.execute()}))])}))}))},LogicManager.prototype.showChoices=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i,n,s=this;return __generator(this,(function(r){switch(r.label){case 0:return i=this,[4,this.checkTextAction(e[0])];case 1:return i.showingText=r.sent(),this.showingText&&e.shift(),this.currentChoices=e.map((function(t,e){return s.parseChoice(e,t)})),this.currentChoices=this.currentChoices.filter((function(t){return t.available})),n=-1,t||(t="default"),"visualChoices"!==t?[3,3]:[4,this.game.gui.hud.showVisualChoices(this.currentChoices)];case 2:return n=r.sent(),[3,5];case 3:return[4,this.game.gui.hud.showChoices(t,this.currentChoices)];case 4:n=r.sent(),r.label=5;case 5:return this.choose(n),[2]}}))}))},LogicManager.prototype.interrupt=function(t,e){this.interrupting={origin:this.game.control.execStack.top().c,execId:this.getExecStackId()},this.showChoices(t,e),this.game.resolveAction()},LogicManager.prototype.clearChoices=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.game.gui.hud.clear()];case 1:return t.sent(),this.currentChoices=[],this.showingText=!1,[2]}}))}))},LogicManager}();exports.default=LogicManager},function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&"says"===r[1];if("show"===a||"play"===a||h){var l=this.game.managers.story.parseAction(n);this.assetsPerScene[e]||(this.assetsPerScene[e]={}),this.assetsPerScene[e][l.actor]=l.actorType}if("if"!==a&&"else"!==a||i.unshift.apply(i,n[s]),"choice"===a||"interrupt"===a||"visualChoice"===a)for(var c=0,d=n[s];c0?[4,this.game.managers.audio.decodeAudio(i)]:[3,2];case 1:s.sent(),s.label=2;case 2:return this.loadingScreen&&(this.loadingScreen.destroy(this.game),this.loadingScreen=null),this.backgroundLoading&&(this.backgroundLoading=null),this.game.config.debugMode&&console.log("All assets loaded."),e(!0),[2]}}))}))}),u),u.loading=!0,u.loadingScreen&&u.loadingScreen.setLoadingBar(u.game),u.game.load.start()}))]}}))}))},t}();e.default=c},function(t,e,i){"use strict";var n=i(49),s=i(72);function r(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}t.exports.Type=i(0),t.exports.Schema=i(4),t.exports.FAILSAFE_SCHEMA=i(15),t.exports.JSON_SCHEMA=i(22),t.exports.CORE_SCHEMA=i(21),t.exports.DEFAULT_SAFE_SCHEMA=i(7),t.exports.DEFAULT_FULL_SCHEMA=i(9),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.safeLoad=n.safeLoad,t.exports.safeLoadAll=n.safeLoadAll,t.exports.dump=s.dump,t.exports.safeDump=s.safeDump,t.exports.YAMLException=i(6),t.exports.MINIMAL_SCHEMA=i(15),t.exports.SAFE_SCHEMA=i(7),t.exports.DEFAULT_SCHEMA=i(9),t.exports.scan=r("scan"),t.exports.parse=r("parse"),t.exports.compose=r("compose"),t.exports.addConstructor=r("addConstructor")},function(t,e,i){"use strict";var n=i(3),s=i(6),r=i(50),o=i(7),a=i(9),h=Object.prototype.hasOwnProperty,l=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,u=/[\x85\u2028\u2029]/,c=/[,\[\]\{\}]/,d=/^(?:!|!!|![a-z\-]+!)$/i,p=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function f(t){return Object.prototype.toString.call(t)}function g(t){return 10===t||13===t}function m(t){return 9===t||32===t}function y(t){return 9===t||32===t||10===t||13===t}function v(t){return 44===t||91===t||93===t||123===t||125===t}function x(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function b(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"…":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function w(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var _=new Array(256),C=new Array(256),S=0;S<256;S++)_[S]=b(S)?1:0,C[S]=b(S);function T(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||a,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function A(t,e){return new s(e,new r(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function E(t,e){throw A(t,e)}function P(t,e){t.onWarning&&t.onWarning.call(null,A(t,e))}var D={YAML:function(t,e,i){var n,s,r;null!==t.version&&E(t,"duplication of %YAML directive"),1!==i.length&&E(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&E(t,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),r=parseInt(n[2],10),1!==s&&E(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=r<2,1!==r&&2!==r&&P(t,"unsupported YAML version of the document")},TAG:function(t,e,i){var n,s;2!==i.length&&E(t,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],d.test(n)||E(t,"ill-formed tag handle (first argument) of the TAG directive"),h.call(t.tagMap,n)&&E(t,'there is a previously declared suffix for "'+n+'" tag handle'),p.test(s)||E(t,"ill-formed tag prefix (second argument) of the TAG directive"),t.tagMap[n]=s}};function k(t,e,i,n){var s,r,o,a;if(e1&&(t.result+=n.repeat("\n",e-1))}function R(t,e){var i,n,s=t.tag,r=t.anchor,o=[],a=!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=o),n=t.input.charCodeAt(t.position);0!==n&&45===n&&y(t.input.charCodeAt(t.position+1));)if(a=!0,t.position++,I(t,!0,-1)&&t.lineIndent<=e)o.push(null),n=t.input.charCodeAt(t.position);else if(i=t.line,G(t,e,3,!1,!0),o.push(t.result),I(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>e)&&0!==n)E(t,"bad indentation of a sequence entry");else if(t.lineIndente?b=1:t.lineIndent===e?b=0:t.lineIndente?b=1:t.lineIndent===e?b=0:t.lineIndente)&&(G(t,e,4,!0,s)&&(g?p=t.result:f=t.result),g||(B(t,u,c,d,p,f,r,o),d=p=f=null),I(t,!0,-1),a=t.input.charCodeAt(t.position)),t.lineIndent>e&&0!==a)E(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===r?E(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?E(t,"repeat of an indentation width identifier"):(c=e+r-1,u=!0)}if(m(o)){do{o=t.input.charCodeAt(++t.position)}while(m(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!g(o)&&0!==o)}for(;0!==o;){for(F(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!u||t.lineIndentc&&(c=t.lineIndent),g(o))d++;else{if(t.lineIndent0){for(s=o,r=0;s>0;s--)(o=x(a=t.input.charCodeAt(++t.position)))>=0?r=(r<<4)+o:E(t,"expected hexadecimal character");t.result+=w(r),t.position++}else E(t,"unknown escape sequence");i=n=t.position}else g(a)?(k(t,i,n,!0),O(t,I(t,!1,e)),i=n=t.position):t.position===t.lineStart&&L(t)?E(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}E(t,"unexpected end of the stream within a double quoted scalar")}(t,p)?T=!0:!function(t){var e,i,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!y(n)&&!v(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&E(t,"name of an alias node must contain at least one character"),i=t.input.slice(e,t.position),t.anchorMap.hasOwnProperty(i)||E(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],I(t,!0,-1),!0}(t)?function(t,e,i){var n,s,r,o,a,h,l,u,c=t.kind,d=t.result;if(y(u=t.input.charCodeAt(t.position))||v(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(y(n=t.input.charCodeAt(t.position+1))||i&&v(n)))return!1;for(t.kind="scalar",t.result="",s=r=t.position,o=!1;0!==u;){if(58===u){if(y(n=t.input.charCodeAt(t.position+1))||i&&v(n))break}else if(35===u){if(y(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&L(t)||i&&v(u))break;if(g(u)){if(a=t.line,h=t.lineStart,l=t.lineIndent,I(t,!1,-1),t.lineIndent>=e){o=!0,u=t.input.charCodeAt(t.position);continue}t.position=r,t.line=a,t.lineStart=h,t.lineIndent=l;break}}o&&(k(t,s,r,!1),O(t,t.line-a),s=r=t.position,o=!1),m(u)||(r=t.position+1),u=t.input.charCodeAt(++t.position)}return k(t,s,r,!1),!!t.result||(t.kind=c,t.result=d,!1)}(t,p,1===i)&&(T=!0,null===t.tag&&(t.tag="?")):(T=!0,null===t.tag&&null===t.anchor||E(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===b&&(T=l&&R(t,f))),null!==t.tag&&"!"!==t.tag)if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&E(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),u=0,c=t.implicitTypes.length;u tag; it should be "'+d.kind+'", not "'+t.kind+'"'),d.resolve(t.result)?(t.result=d.construct(t.result),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):E(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")):E(t,"unknown tag !<"+t.tag+">");return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||T}function j(t){var e,i,n,s,r=t.position,o=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap={},t.anchorMap={};0!==(s=t.input.charCodeAt(t.position))&&(I(t,!0,-1),s=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==s));){for(o=!0,s=t.input.charCodeAt(++t.position),e=t.position;0!==s&&!y(s);)s=t.input.charCodeAt(++t.position);for(n=[],(i=t.input.slice(e,t.position)).length<1&&E(t,"directive name must not be less than one character in length");0!==s;){for(;m(s);)s=t.input.charCodeAt(++t.position);if(35===s){do{s=t.input.charCodeAt(++t.position)}while(0!==s&&!g(s));break}if(g(s))break;for(e=t.position;0!==s&&!y(s);)s=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==s&&F(t),h.call(D,i)?D[i](t,i,n):P(t,'unknown document directive "'+i+'"')}I(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,I(t,!0,-1)):o&&E(t,"directives end mark is expected"),G(t,t.lineIndent-1,4,!1,!0),I(t,!0,-1),t.checkLineBreaks&&u.test(t.input.slice(r,t.position))&&P(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&L(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,I(t,!0,-1)):t.position0&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(s-1));)if(s-=1,this.position-s>e/2-1){i=" ... ",s+=5;break}for(r="",o=this.position;oe/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(s,o),n.repeat(" ",t)+i+a+r+"\n"+n.repeat(" ",t+this.position-s+i.length)+"^"},s.prototype.toString=function(t){var e,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),t||(e=this.getSnippet())&&(i+=":\n"+e),i},t.exports=s},function(t,e,i){"use strict";var n=i(0);t.exports=new n("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}})},function(t,e,i){"use strict";var n=i(0);t.exports=new n("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}})},function(t,e,i){"use strict";var n=i(0);t.exports=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}})},function(t,e,i){"use strict";var n=i(0);t.exports=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)},construct:function(){return null},predicate:function(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},function(t,e,i){"use strict";var n=i(0);t.exports=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)},construct:function(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})},function(t,e,i){"use strict";var n=i(3),s=i(0);function r(t){return 48<=t&&t<=55}function o(t){return 48<=t&&t<=57}t.exports=new s("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,i,n=t.length,s=0,a=!1;if(!n)return!1;if("-"!==(e=t[s])&&"+"!==e||(e=t[++s]),"0"===e){if(s+1===n)return!0;if("b"===(e=t[++s])){for(s++;s=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0"+t.toString(8):"-0"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},function(t,e,i){"use strict";var n=i(3),s=i(0),r=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var o=/^[-+]?[0-9]+e/;t.exports=new s("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!r.test(t)||"_"===t[t.length-1])},construct:function(t){var e,i,n,s;return i="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,s=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:e.indexOf(":")>=0?(e.split(":").forEach((function(t){s.unshift(parseFloat(t,10))})),e=0,n=1,s.forEach((function(t){e+=t*n,n*=60})),i*e):i*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||n.isNegativeZero(t))},represent:function(t,e){var i;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(t))return"-0.0";return i=t.toString(10),o.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})},function(t,e,i){"use strict";var n=i(0),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),r=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new n("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==s.exec(t)||null!==r.exec(t))},construct:function(t){var e,i,n,o,a,h,l,u,c=0,d=null;if(null===(e=s.exec(t))&&(e=r.exec(t)),null===e)throw new Error("Date resolve error");if(i=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(i,n,o));if(a=+e[4],h=+e[5],l=+e[6],e[7]){for(c=e[7].slice(0,3);c.length<3;)c+="0";c=+c}return e[9]&&(d=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(d=-d)),u=new Date(Date.UTC(i,n,o,a,h,l,c)),d&&u.setTime(u.getTime()-d),u},instanceOf:Date,represent:function(t){return t.toISOString()}})},function(t,e,i){"use strict";var n=i(0);t.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}})},function(t,e,i){"use strict";var n;try{n=i(61).Buffer}catch(t){}var s=i(0),r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,i,n=0,s=t.length,o=r;for(i=0;i64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,i,s=t.replace(/[\r\n=]/g,""),o=s.length,a=r,h=0,l=[];for(e=0;e>16&255),l.push(h>>8&255),l.push(255&h)),h=h<<6|a.indexOf(s.charAt(e));return 0===(i=o%4*6)?(l.push(h>>16&255),l.push(h>>8&255),l.push(255&h)):18===i?(l.push(h>>10&255),l.push(h>>2&255)):12===i&&l.push(h>>4&255),n?n.from?n.from(l):new n(l):l},predicate:function(t){return n&&n.isBuffer(t)},represent:function(t){var e,i,n="",s=0,o=t.length,a=r;for(e=0;e>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]),s=(s<<8)+t[e];return 0===(i=o%3)?(n+=a[s>>18&63],n+=a[s>>12&63],n+=a[s>>6&63],n+=a[63&s]):2===i?(n+=a[s>>10&63],n+=a[s>>4&63],n+=a[s<<2&63],n+=a[64]):1===i&&(n+=a[s>>2&63],n+=a[s<<4&63],n+=a[64],n+=a[64]),n}})},function(t,e,i){"use strict";(function(t){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT +void 0===PIXI.blendModes&&(PIXI.blendModes=n.blendModes),void 0===PIXI.scaleModes&&(PIXI.scaleModes=n.scaleModes),void 0===PIXI.Texture.emptyTexture&&(PIXI.Texture.emptyTexture=new PIXI.Texture(new PIXI.BaseTexture)),void 0===PIXI.DisplayObject._tempMatrix&&(PIXI.DisplayObject._tempMatrix=new n.Matrix),PIXI.TextureSilentFail=!0,PIXI.canUseNewCanvasBlendModes=function(){return n.Device.canUseMultiply},t.exports&&(e=t.exports=n),e.Phaser=n,n}).call(this)},4674:function(t,e){ +/** +* @author Richard Davey +* @copyright 2020 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser-ce/blob/master/license.txt|MIT License} +* +* @overview +* +* Phaser CE - https://github.com/photonstorm/phaser-ce +* +* v2.16.0 "2020-06-01" - Built: Mon Jun 01 2020 11:17:52 +* +* By Richard Davey http://www.photonstorm.com @photonstorm and Phaser CE contributors +* +* Phaser - http://phaser.io +*/ +(function(){var i=i||{}; +/** + * @author Mat Groves http://matgroves.com @Doormat23 + * @author Richard Davey + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -var n=i(62),s=i(63),r=i(64);function o(){return h.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function f(t,e){if(h.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return j(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function g(t,e,i){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return D(this,e,i);case"utf8":case"utf-8":return A(this,e,i);case"ascii":return E(this,e,i);case"latin1":case"binary":return P(this,e,i);case"base64":return T(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function m(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function y(t,e,i,n,s){if(0===t.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=h.from(e,n)),h.isBuffer(e))return 0===e.length?-1:v(t,e,i,n,s);if("number"==typeof e)return e&=255,h.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):v(t,[e],i,n,s);throw new TypeError("val must be string, number or Buffer")}function v(t,e,i,n,s){var r,o=1,a=t.length,h=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,h/=2,i/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(s){var u=-1;for(r=i;ra&&(i=a-h),r=i;r>=0;r--){for(var c=!0,d=0;ds&&(n=s):n=s;var r=e.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var o=0;o>8,s=i%256,r.push(s),r.push(n);return r}(e,t.length-i),t,i,n)}function T(t,e,i){return 0===e&&i===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,i))}function A(t,e,i){i=Math.min(t.length,i);for(var n=[],s=e;s239?4:l>223?3:l>191?2:1;if(s+c<=i)switch(c){case 1:l<128&&(u=l);break;case 2:128==(192&(r=t[s+1]))&&(h=(31&l)<<6|63&r)>127&&(u=h);break;case 3:r=t[s+1],o=t[s+2],128==(192&r)&&128==(192&o)&&(h=(15&l)<<12|(63&r)<<6|63&o)>2047&&(h<55296||h>57343)&&(u=h);break;case 4:r=t[s+1],o=t[s+2],a=t[s+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(h=(15&l)<<18|(63&r)<<12|(63&o)<<6|63&a)>65535&&h<1114112&&(u=h)}null===u?(u=65533,c=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),s+=c}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var i="",n=0;for(;n0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},h.prototype.compare=function(t,e,i,n,s){if(!h.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),e<0||i>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=i)return 0;if(n>=s)return-1;if(e>=i)return 1;if(this===t)return 0;for(var r=(s>>>=0)-(n>>>=0),o=(i>>>=0)-(e>>>=0),a=Math.min(r,o),l=this.slice(n,s),u=t.slice(e,i),c=0;cs)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return x(this,t,e,i);case"utf8":case"utf-8":return b(this,t,e,i);case"ascii":return w(this,t,e,i);case"latin1":case"binary":return _(this,t,e,i);case"base64":return C(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,i);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function E(t,e,i){var n="";i=Math.min(t.length,i);for(var s=e;sn)&&(i=n);for(var s="",r=e;ri)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,i,n,s,r){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||et.length)throw new RangeError("Index out of range")}function F(t,e,i,n){e<0&&(e=65535+e+1);for(var s=0,r=Math.min(t.length-i,2);s>>8*(n?s:1-s)}function I(t,e,i,n){e<0&&(e=4294967295+e+1);for(var s=0,r=Math.min(t.length-i,4);s>>8*(n?s:3-s)&255}function L(t,e,i,n,s,r){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function O(t,e,i,n,r){return r||L(t,0,i,4),s.write(t,e,i,n,23,4),i+4}function R(t,e,i,n,r){return r||L(t,0,i,8),s.write(t,e,i,n,52,8),i+8}h.prototype.slice=function(t,e){var i,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(s*=256);)n+=this[t+--e]*s;return n},h.prototype.readUInt8=function(t,e){return e||M(t,1,this.length),this[t]},h.prototype.readUInt16LE=function(t,e){return e||M(t,2,this.length),this[t]|this[t+1]<<8},h.prototype.readUInt16BE=function(t,e){return e||M(t,2,this.length),this[t]<<8|this[t+1]},h.prototype.readUInt32LE=function(t,e){return e||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},h.prototype.readUInt32BE=function(t,e){return e||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},h.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||M(t,e,this.length);for(var n=this[t],s=1,r=0;++r=(s*=128)&&(n-=Math.pow(2,8*e)),n},h.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||M(t,e,this.length);for(var n=e,s=1,r=this[t+--n];n>0&&(s*=256);)r+=this[t+--n]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*e)),r},h.prototype.readInt8=function(t,e){return e||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},h.prototype.readInt16LE=function(t,e){e||M(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},h.prototype.readInt16BE=function(t,e){e||M(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},h.prototype.readInt32LE=function(t,e){return e||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},h.prototype.readInt32BE=function(t,e){return e||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},h.prototype.readFloatLE=function(t,e){return e||M(t,4,this.length),s.read(this,t,!0,23,4)},h.prototype.readFloatBE=function(t,e){return e||M(t,4,this.length),s.read(this,t,!1,23,4)},h.prototype.readDoubleLE=function(t,e){return e||M(t,8,this.length),s.read(this,t,!0,52,8)},h.prototype.readDoubleBE=function(t,e){return e||M(t,8,this.length),s.read(this,t,!1,52,8)},h.prototype.writeUIntLE=function(t,e,i,n){(t=+t,e|=0,i|=0,n)||B(this,t,e,i,Math.pow(2,8*i)-1,0);var s=1,r=0;for(this[e]=255&t;++r=0&&(r*=256);)this[e+s]=t/r&255;return e+i},h.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,1,255,0),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},h.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},h.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,2,65535,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},h.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):I(this,t,e,!0),e+4},h.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,4,4294967295,0),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},h.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);B(this,t,e,i,s-1,-s)}var r=0,o=1,a=0;for(this[e]=255&t;++r>0)-a&255;return e+i},h.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);B(this,t,e,i,s-1,-s)}var r=i-1,o=1,a=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===a&&0!==this[e+r+1]&&(a=1),this[e+r]=(t/o>>0)-a&255;return e+i},h.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,1,127,-128),h.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},h.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):F(this,t,e,!0),e+2},h.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,2,32767,-32768),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):F(this,t,e,!1),e+2},h.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,4,2147483647,-2147483648),h.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):I(this,t,e,!0),e+4},h.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),h.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},h.prototype.writeFloatLE=function(t,e,i){return O(this,t,e,!0,i)},h.prototype.writeFloatBE=function(t,e,i){return O(this,t,e,!1,i)},h.prototype.writeDoubleLE=function(t,e,i){return R(this,t,e,!0,i)},h.prototype.writeDoubleBE=function(t,e,i){return R(this,t,e,!1,i)},h.prototype.copy=function(t,e,i,n){if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+i];else if(r<1e3||!h.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(r=e;r55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&r.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&r.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(e-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;r.push(i)}else if(i<2048){if((e-=2)<0)break;r.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;r.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return r}function j(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,i,n){for(var s=0;s=e.length||s>=t.length);++s)e[s+i]=t[s];return s}}).call(this,i(18))},function(t,e,i){"use strict";e.byteLength=function(t){var e=l(t),i=e[0],n=e[1];return 3*(i+n)/4-n},e.toByteArray=function(t){var e,i,n=l(t),o=n[0],a=n[1],h=new r(function(t,e,i){return 3*(e+i)/4-i}(0,o,a)),u=0,c=a>0?o-4:o;for(i=0;i>16&255,h[u++]=e>>8&255,h[u++]=255&e;2===a&&(e=s[t.charCodeAt(i)]<<2|s[t.charCodeAt(i+1)]>>4,h[u++]=255&e);1===a&&(e=s[t.charCodeAt(i)]<<10|s[t.charCodeAt(i+1)]<<4|s[t.charCodeAt(i+2)]>>2,h[u++]=e>>8&255,h[u++]=255&e);return h},e.fromByteArray=function(t){for(var e,i=t.length,s=i%3,r=[],o=0,a=i-s;oa?a:o+16383));1===s?(e=t[i-1],r.push(n[e>>2]+n[e<<4&63]+"==")):2===s&&(e=(t[i-2]<<8)+t[i-1],r.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return r.join("")};for(var n=[],s=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,h=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function u(t,e,i){for(var s,r,o=[],a=e;a>18&63]+n[r>>12&63]+n[r>>6&63]+n[63&r]);return o.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,i,n,s){var r,o,a=8*s-n-1,h=(1<>1,u=-7,c=i?s-1:0,d=i?-1:1,p=t[e+c];for(c+=d,r=p&(1<<-u)-1,p>>=-u,u+=a;u>0;r=256*r+t[e+c],c+=d,u-=8);for(o=r&(1<<-u)-1,r>>=-u,u+=n;u>0;o=256*o+t[e+c],c+=d,u-=8);if(0===r)r=1-l;else{if(r===h)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),r-=l}return(p?-1:1)*o*Math.pow(2,r-n)},e.write=function(t,e,i,n,s,r){var o,a,h,l=8*r-s-1,u=(1<>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+c>=1?d/h:d*Math.pow(2,1-c))*h>=2&&(o++,h/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*h-1)*Math.pow(2,s),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,s),o=0));s>=8;t[i+p]=255&a,p+=f,a/=256,s-=8);for(o=o<0;t[i+p]=255&o,p+=f,o/=256,l-=8);t[i+p-f]|=128*g}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){"use strict";var n=i(0),s=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,i,n,o,a,h=[],l=t;for(e=0,i=l.length;e3)return!1;if("/"!==e[e.length-n.length-1])return!1}return!0},construct:function(t){var e=t,i=/\/([gim]*)$/.exec(t),n="";return"/"===e[0]&&(i&&(n=i[1]),e=e.slice(1,e.length-n.length-1)),new RegExp(e,n)},predicate:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},represent:function(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}})},function(t,e,i){"use strict";var n;try{n=i(71)}catch(t){"undefined"!=typeof window&&(n=window.esprima)}var s=i(0);t.exports=new s("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(t){if(null===t)return!1;try{var e="("+t+")",i=n.parse(e,{range:!0});return"Program"===i.type&&1===i.body.length&&"ExpressionStatement"===i.body[0].type&&("ArrowFunctionExpression"===i.body[0].expression.type||"FunctionExpression"===i.body[0].expression.type)}catch(t){return!1}},construct:function(t){var e,i="("+t+")",s=n.parse(i,{range:!0}),r=[];if("Program"!==s.type||1!==s.body.length||"ExpressionStatement"!==s.body[0].type||"ArrowFunctionExpression"!==s.body[0].expression.type&&"FunctionExpression"!==s.body[0].expression.type)throw new Error("Failed to resolve function");return s.body[0].expression.params.forEach((function(t){r.push(t.name)})),e=s.body[0].expression.body.range,"BlockStatement"===s.body[0].expression.body.type?new Function(r,i.slice(e[0]+1,e[1]-1)):new Function(r,"return "+i.slice(e[0],e[1]))},predicate:function(t){return"[object Function]"===Object.prototype.toString.call(t)},represent:function(t){return t.toString()}})},function(t,e,i){var n;n=function(){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={exports:{},id:n,loaded:!1};return t[n].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}return i.m=t,i.c=e,i.p="",i(0)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(1),s=i(3),r=i(8),o=i(15);function a(t,e,i){var o=null,a=function(t,e){i&&i(t,e),o&&o.visit(t,e)},h="function"==typeof i?a:null,l=!1;if(e){l="boolean"==typeof e.comment&&e.comment;var u="boolean"==typeof e.attachComment&&e.attachComment;(l||u)&&((o=new n.CommentHandler).attach=u,e.comment=!0,h=a)}var c,d=!1;e&&"string"==typeof e.sourceType&&(d="module"===e.sourceType),c=e&&"boolean"==typeof e.jsx&&e.jsx?new s.JSXParser(t,e,h):new r.Parser(t,e,h);var p=d?c.parseModule():c.parseScript();return l&&o&&(p.comments=o.comments),c.config.tokens&&(p.tokens=c.tokens),c.config.tolerant&&(p.errors=c.errorHandler.errors),p}e.parse=a,e.parseModule=function(t,e,i){var n=e||{};return n.sourceType="module",a(t,n,i)},e.parseScript=function(t,e,i){var n=e||{};return n.sourceType="script",a(t,n,i)},e.tokenize=function(t,e,i){var n,s=new o.Tokenizer(t,e);n=[];try{for(;;){var r=s.getNextToken();if(!r)break;i&&(r=i(r)),n.push(r)}}catch(t){s.errorHandler.tolerate(t)}return s.errorHandler.tolerant&&(n.errors=s.errors()),n};var h=i(2);e.Syntax=h.Syntax,e.version="4.0.1"},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(2),s=function(){function t(){this.attach=!1,this.comments=[],this.stack=[],this.leading=[],this.trailing=[]}return t.prototype.insertInnerComments=function(t,e){if(t.type===n.Syntax.BlockStatement&&0===t.body.length){for(var i=[],s=this.leading.length-1;s>=0;--s){var r=this.leading[s];e.end.offset>=r.start&&(i.unshift(r.comment),this.leading.splice(s,1),this.trailing.splice(s,1))}i.length&&(t.innerComments=i)}},t.prototype.findTrailingComments=function(t){var e=[];if(this.trailing.length>0){for(var i=this.trailing.length-1;i>=0;--i){var n=this.trailing[i];n.start>=t.end.offset&&e.unshift(n.comment)}return this.trailing.length=0,e}var s=this.stack[this.stack.length-1];if(s&&s.node.trailingComments){var r=s.node.trailingComments[0];r&&r.range[0]>=t.end.offset&&(e=s.node.trailingComments,delete s.node.trailingComments)}return e},t.prototype.findLeadingComments=function(t){for(var e,i=[];this.stack.length>0&&((r=this.stack[this.stack.length-1])&&r.start>=t.start.offset);)e=r.node,this.stack.pop();if(e){for(var n=(e.leadingComments?e.leadingComments.length:0)-1;n>=0;--n){var s=e.leadingComments[n];s.range[1]<=t.start.offset&&(i.unshift(s),e.leadingComments.splice(n,1))}return e.leadingComments&&0===e.leadingComments.length&&delete e.leadingComments,i}for(n=this.leading.length-1;n>=0;--n){var r;(r=this.leading[n]).start<=t.start.offset&&(i.unshift(r.comment),this.leading.splice(n,1))}return i},t.prototype.visitNode=function(t,e){if(!(t.type===n.Syntax.Program&&t.body.length>0)){this.insertInnerComments(t,e);var i=this.findTrailingComments(e),s=this.findLeadingComments(e);s.length>0&&(t.leadingComments=s),i.length>0&&(t.trailingComments=i),this.stack.push({node:t,start:e.start.offset})}},t.prototype.visitComment=function(t,e){var i="L"===t.type[0]?"Line":"Block",n={type:i,value:t.value};if(t.range&&(n.range=t.range),t.loc&&(n.loc=t.loc),this.comments.push(n),this.attach){var s={comment:{type:i,value:t.value,range:[e.start.offset,e.end.offset]},start:e.start.offset};t.loc&&(s.comment.loc=t.loc),t.type=i,this.leading.push(s),this.trailing.push(s)}},t.prototype.visit=function(t,e){"LineComment"===t.type||"BlockComment"===t.type?this.visitComment(t,e):this.attach&&this.visitNode(t,e)},t}();e.CommentHandler=s},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Syntax={AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AwaitExpression:"AwaitExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForOfStatement:"ForOfStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"}},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=i(4),o=i(5),a=i(6),h=i(7),l=i(8),u=i(13),c=i(14);function d(t){var e;switch(t.type){case a.JSXSyntax.JSXIdentifier:e=t.name;break;case a.JSXSyntax.JSXNamespacedName:var i=t;e=d(i.namespace)+":"+d(i.name);break;case a.JSXSyntax.JSXMemberExpression:var n=t;e=d(n.object)+"."+d(n.property)}return e}u.TokenName[100]="JSXIdentifier",u.TokenName[101]="JSXText";var p=function(t){function e(e,i,n){return t.call(this,e,i,n)||this}return s(e,t),e.prototype.parsePrimaryExpression=function(){return this.match("<")?this.parseJSXRoot():t.prototype.parsePrimaryExpression.call(this)},e.prototype.startJSX=function(){this.scanner.index=this.startMarker.index,this.scanner.lineNumber=this.startMarker.line,this.scanner.lineStart=this.startMarker.index-this.startMarker.column},e.prototype.finishJSX=function(){this.nextToken()},e.prototype.reenterJSX=function(){this.startJSX(),this.expectJSX("}"),this.config.tokens&&this.tokens.pop()},e.prototype.createJSXNode=function(){return this.collectComments(),{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},e.prototype.createJSXChildNode=function(){return{index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}},e.prototype.scanXHTMLEntity=function(t){for(var e="&",i=!0,n=!1,s=!1,o=!1;!this.scanner.eof()&&i&&!n;){var a=this.scanner.source[this.scanner.index];if(a===t)break;if(n=";"===a,e+=a,++this.scanner.index,!n)switch(e.length){case 2:s="#"===a;break;case 3:s&&(i=(o="x"===a)||r.Character.isDecimalDigit(a.charCodeAt(0)),s=s&&!o);break;default:i=(i=i&&!(s&&!r.Character.isDecimalDigit(a.charCodeAt(0))))&&!(o&&!r.Character.isHexDigit(a.charCodeAt(0)))}}if(i&&n&&e.length>2){var h=e.substr(1,e.length-2);s&&h.length>1?e=String.fromCharCode(parseInt(h.substr(1),10)):o&&h.length>2?e=String.fromCharCode(parseInt("0"+h.substr(1),16)):s||o||!c.XHTMLEntities[h]||(e=c.XHTMLEntities[h])}return e},e.prototype.lexJSX=function(){var t=this.scanner.source.charCodeAt(this.scanner.index);if(60===t||62===t||47===t||58===t||61===t||123===t||125===t)return{type:7,value:a=this.scanner.source[this.scanner.index++],lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index-1,end:this.scanner.index};if(34===t||39===t){for(var e=this.scanner.index,i=this.scanner.source[this.scanner.index++],n="";!this.scanner.eof()&&(h=this.scanner.source[this.scanner.index++])!==i;)n+="&"===h?this.scanXHTMLEntity(i):h;return{type:8,value:n,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index}}if(46===t){var s=this.scanner.source.charCodeAt(this.scanner.index+1),o=this.scanner.source.charCodeAt(this.scanner.index+2),a=46===s&&46===o?"...":".";return e=this.scanner.index,this.scanner.index+=a.length,{type:7,value:a,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index}}if(96===t)return{type:10,value:"",lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:this.scanner.index,end:this.scanner.index};if(r.Character.isIdentifierStart(t)&&92!==t){for(e=this.scanner.index,++this.scanner.index;!this.scanner.eof();){var h=this.scanner.source.charCodeAt(this.scanner.index);if(r.Character.isIdentifierPart(h)&&92!==h)++this.scanner.index;else{if(45!==h)break;++this.scanner.index}}return{type:100,value:this.scanner.source.slice(e,this.scanner.index),lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:e,end:this.scanner.index}}return this.scanner.lex()},e.prototype.nextJSXToken=function(){this.collectComments(),this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;var t=this.lexJSX();return this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.config.tokens&&this.tokens.push(this.convertToken(t)),t},e.prototype.nextJSXText=function(){this.startMarker.index=this.scanner.index,this.startMarker.line=this.scanner.lineNumber,this.startMarker.column=this.scanner.index-this.scanner.lineStart;for(var t=this.scanner.index,e="";!this.scanner.eof();){var i=this.scanner.source[this.scanner.index];if("{"===i||"<"===i)break;++this.scanner.index,e+=i,r.Character.isLineTerminator(i.charCodeAt(0))&&(++this.scanner.lineNumber,"\r"===i&&"\n"===this.scanner.source[this.scanner.index]&&++this.scanner.index,this.scanner.lineStart=this.scanner.index)}this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart;var n={type:101,value:e,lineNumber:this.scanner.lineNumber,lineStart:this.scanner.lineStart,start:t,end:this.scanner.index};return e.length>0&&this.config.tokens&&this.tokens.push(this.convertToken(n)),n},e.prototype.peekJSXToken=function(){var t=this.scanner.saveState();this.scanner.scanComments();var e=this.lexJSX();return this.scanner.restoreState(t),e},e.prototype.expectJSX=function(t){var e=this.nextJSXToken();7===e.type&&e.value===t||this.throwUnexpectedToken(e)},e.prototype.matchJSX=function(t){var e=this.peekJSXToken();return 7===e.type&&e.value===t},e.prototype.parseJSXIdentifier=function(){var t=this.createJSXNode(),e=this.nextJSXToken();return 100!==e.type&&this.throwUnexpectedToken(e),this.finalize(t,new o.JSXIdentifier(e.value))},e.prototype.parseJSXElementName=function(){var t=this.createJSXNode(),e=this.parseJSXIdentifier();if(this.matchJSX(":")){var i=e;this.expectJSX(":");var n=this.parseJSXIdentifier();e=this.finalize(t,new o.JSXNamespacedName(i,n))}else if(this.matchJSX("."))for(;this.matchJSX(".");){var s=e;this.expectJSX(".");var r=this.parseJSXIdentifier();e=this.finalize(t,new o.JSXMemberExpression(s,r))}return e},e.prototype.parseJSXAttributeName=function(){var t,e=this.createJSXNode(),i=this.parseJSXIdentifier();if(this.matchJSX(":")){var n=i;this.expectJSX(":");var s=this.parseJSXIdentifier();t=this.finalize(e,new o.JSXNamespacedName(n,s))}else t=i;return t},e.prototype.parseJSXStringLiteralAttribute=function(){var t=this.createJSXNode(),e=this.nextJSXToken();8!==e.type&&this.throwUnexpectedToken(e);var i=this.getTokenRaw(e);return this.finalize(t,new h.Literal(e.value,i))},e.prototype.parseJSXExpressionAttribute=function(){var t=this.createJSXNode();this.expectJSX("{"),this.finishJSX(),this.match("}")&&this.tolerateError("JSX attributes must only be assigned a non-empty expression");var e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new o.JSXExpressionContainer(e))},e.prototype.parseJSXAttributeValue=function(){return this.matchJSX("{")?this.parseJSXExpressionAttribute():this.matchJSX("<")?this.parseJSXElement():this.parseJSXStringLiteralAttribute()},e.prototype.parseJSXNameValueAttribute=function(){var t=this.createJSXNode(),e=this.parseJSXAttributeName(),i=null;return this.matchJSX("=")&&(this.expectJSX("="),i=this.parseJSXAttributeValue()),this.finalize(t,new o.JSXAttribute(e,i))},e.prototype.parseJSXSpreadAttribute=function(){var t=this.createJSXNode();this.expectJSX("{"),this.expectJSX("..."),this.finishJSX();var e=this.parseAssignmentExpression();return this.reenterJSX(),this.finalize(t,new o.JSXSpreadAttribute(e))},e.prototype.parseJSXAttributes=function(){for(var t=[];!this.matchJSX("/")&&!this.matchJSX(">");){var e=this.matchJSX("{")?this.parseJSXSpreadAttribute():this.parseJSXNameValueAttribute();t.push(e)}return t},e.prototype.parseJSXOpeningElement=function(){var t=this.createJSXNode();this.expectJSX("<");var e=this.parseJSXElementName(),i=this.parseJSXAttributes(),n=this.matchJSX("/");return n&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new o.JSXOpeningElement(e,n,i))},e.prototype.parseJSXBoundaryElement=function(){var t=this.createJSXNode();if(this.expectJSX("<"),this.matchJSX("/")){this.expectJSX("/");var e=this.parseJSXElementName();return this.expectJSX(">"),this.finalize(t,new o.JSXClosingElement(e))}var i=this.parseJSXElementName(),n=this.parseJSXAttributes(),s=this.matchJSX("/");return s&&this.expectJSX("/"),this.expectJSX(">"),this.finalize(t,new o.JSXOpeningElement(i,s,n))},e.prototype.parseJSXEmptyExpression=function(){var t=this.createJSXChildNode();return this.collectComments(),this.lastMarker.index=this.scanner.index,this.lastMarker.line=this.scanner.lineNumber,this.lastMarker.column=this.scanner.index-this.scanner.lineStart,this.finalize(t,new o.JSXEmptyExpression)},e.prototype.parseJSXExpressionContainer=function(){var t,e=this.createJSXNode();return this.expectJSX("{"),this.matchJSX("}")?(t=this.parseJSXEmptyExpression(),this.expectJSX("}")):(this.finishJSX(),t=this.parseAssignmentExpression(),this.reenterJSX()),this.finalize(e,new o.JSXExpressionContainer(t))},e.prototype.parseJSXChildren=function(){for(var t=[];!this.scanner.eof();){var e=this.createJSXChildNode(),i=this.nextJSXText();if(i.start0))break;r=this.finalize(t.node,new o.JSXElement(t.opening,t.children,t.closing)),(t=e[e.length-1]).children.push(r),e.pop()}}return t},e.prototype.parseJSXElement=function(){var t=this.createJSXNode(),e=this.parseJSXOpeningElement(),i=[],n=null;if(!e.selfClosing){var s=this.parseComplexJSXElement({node:t,opening:e,closing:n,children:i});i=s.children,n=s.closing}return this.finalize(t,new o.JSXElement(e,i,n))},e.prototype.parseJSXRoot=function(){this.config.tokens&&this.tokens.pop(),this.startJSX();var t=this.parseJSXElement();return this.finishJSX(),t},e.prototype.isStartOfExpression=function(){return t.prototype.isStartOfExpression.call(this)||this.match("<")},e}(l.Parser);e.JSXParser=p},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/};e.Character={fromCodePoint:function(t){return t<65536?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10))+String.fromCharCode(56320+(t-65536&1023))},isWhiteSpace:function(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0},isLineTerminator:function(t){return 10===t||13===t||8232===t||8233===t},isIdentifierStart:function(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&i.NonAsciiIdentifierStart.test(e.Character.fromCodePoint(t))},isIdentifierPart:function(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&i.NonAsciiIdentifierPart.test(e.Character.fromCodePoint(t))},isDecimalDigit:function(t){return t>=48&&t<=57},isHexDigit:function(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102},isOctalDigit:function(t){return t>=48&&t<=55}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(6),s=function(t){this.type=n.JSXSyntax.JSXClosingElement,this.name=t};e.JSXClosingElement=s;var r=function(t,e,i){this.type=n.JSXSyntax.JSXElement,this.openingElement=t,this.children=e,this.closingElement=i};e.JSXElement=r;var o=function(){this.type=n.JSXSyntax.JSXEmptyExpression};e.JSXEmptyExpression=o;var a=function(t){this.type=n.JSXSyntax.JSXExpressionContainer,this.expression=t};e.JSXExpressionContainer=a;var h=function(t){this.type=n.JSXSyntax.JSXIdentifier,this.name=t};e.JSXIdentifier=h;var l=function(t,e){this.type=n.JSXSyntax.JSXMemberExpression,this.object=t,this.property=e};e.JSXMemberExpression=l;var u=function(t,e){this.type=n.JSXSyntax.JSXAttribute,this.name=t,this.value=e};e.JSXAttribute=u;var c=function(t,e){this.type=n.JSXSyntax.JSXNamespacedName,this.namespace=t,this.name=e};e.JSXNamespacedName=c;var d=function(t,e,i){this.type=n.JSXSyntax.JSXOpeningElement,this.name=t,this.selfClosing=e,this.attributes=i};e.JSXOpeningElement=d;var p=function(t){this.type=n.JSXSyntax.JSXSpreadAttribute,this.argument=t};e.JSXSpreadAttribute=p;var f=function(t,e){this.type=n.JSXSyntax.JSXText,this.value=t,this.raw=e};e.JSXText=f},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.JSXSyntax={JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXSpreadAttribute:"JSXSpreadAttribute",JSXText:"JSXText"}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(2),s=function(t){this.type=n.Syntax.ArrayExpression,this.elements=t};e.ArrayExpression=s;var r=function(t){this.type=n.Syntax.ArrayPattern,this.elements=t};e.ArrayPattern=r;var o=function(t,e,i){this.type=n.Syntax.ArrowFunctionExpression,this.id=null,this.params=t,this.body=e,this.generator=!1,this.expression=i,this.async=!1};e.ArrowFunctionExpression=o;var a=function(t,e,i){this.type=n.Syntax.AssignmentExpression,this.operator=t,this.left=e,this.right=i};e.AssignmentExpression=a;var h=function(t,e){this.type=n.Syntax.AssignmentPattern,this.left=t,this.right=e};e.AssignmentPattern=h;var l=function(t,e,i){this.type=n.Syntax.ArrowFunctionExpression,this.id=null,this.params=t,this.body=e,this.generator=!1,this.expression=i,this.async=!0};e.AsyncArrowFunctionExpression=l;var u=function(t,e,i){this.type=n.Syntax.FunctionDeclaration,this.id=t,this.params=e,this.body=i,this.generator=!1,this.expression=!1,this.async=!0};e.AsyncFunctionDeclaration=u;var c=function(t,e,i){this.type=n.Syntax.FunctionExpression,this.id=t,this.params=e,this.body=i,this.generator=!1,this.expression=!1,this.async=!0};e.AsyncFunctionExpression=c;var d=function(t){this.type=n.Syntax.AwaitExpression,this.argument=t};e.AwaitExpression=d;var p=function(t,e,i){var s="||"===t||"&&"===t;this.type=s?n.Syntax.LogicalExpression:n.Syntax.BinaryExpression,this.operator=t,this.left=e,this.right=i};e.BinaryExpression=p;var f=function(t){this.type=n.Syntax.BlockStatement,this.body=t};e.BlockStatement=f;var g=function(t){this.type=n.Syntax.BreakStatement,this.label=t};e.BreakStatement=g;var m=function(t,e){this.type=n.Syntax.CallExpression,this.callee=t,this.arguments=e};e.CallExpression=m;var y=function(t,e){this.type=n.Syntax.CatchClause,this.param=t,this.body=e};e.CatchClause=y;var v=function(t){this.type=n.Syntax.ClassBody,this.body=t};e.ClassBody=v;var x=function(t,e,i){this.type=n.Syntax.ClassDeclaration,this.id=t,this.superClass=e,this.body=i};e.ClassDeclaration=x;var b=function(t,e,i){this.type=n.Syntax.ClassExpression,this.id=t,this.superClass=e,this.body=i};e.ClassExpression=b;var w=function(t,e){this.type=n.Syntax.MemberExpression,this.computed=!0,this.object=t,this.property=e};e.ComputedMemberExpression=w;var _=function(t,e,i){this.type=n.Syntax.ConditionalExpression,this.test=t,this.consequent=e,this.alternate=i};e.ConditionalExpression=_;var C=function(t){this.type=n.Syntax.ContinueStatement,this.label=t};e.ContinueStatement=C;var S=function(){this.type=n.Syntax.DebuggerStatement};e.DebuggerStatement=S;var T=function(t,e){this.type=n.Syntax.ExpressionStatement,this.expression=t,this.directive=e};e.Directive=T;var A=function(t,e){this.type=n.Syntax.DoWhileStatement,this.body=t,this.test=e};e.DoWhileStatement=A;var E=function(){this.type=n.Syntax.EmptyStatement};e.EmptyStatement=E;var P=function(t){this.type=n.Syntax.ExportAllDeclaration,this.source=t};e.ExportAllDeclaration=P;var D=function(t){this.type=n.Syntax.ExportDefaultDeclaration,this.declaration=t};e.ExportDefaultDeclaration=D;var k=function(t,e,i){this.type=n.Syntax.ExportNamedDeclaration,this.declaration=t,this.specifiers=e,this.source=i};e.ExportNamedDeclaration=k;var M=function(t,e){this.type=n.Syntax.ExportSpecifier,this.exported=e,this.local=t};e.ExportSpecifier=M;var B=function(t){this.type=n.Syntax.ExpressionStatement,this.expression=t};e.ExpressionStatement=B;var F=function(t,e,i){this.type=n.Syntax.ForInStatement,this.left=t,this.right=e,this.body=i,this.each=!1};e.ForInStatement=F;var I=function(t,e,i){this.type=n.Syntax.ForOfStatement,this.left=t,this.right=e,this.body=i};e.ForOfStatement=I;var L=function(t,e,i,s){this.type=n.Syntax.ForStatement,this.init=t,this.test=e,this.update=i,this.body=s};e.ForStatement=L;var O=function(t,e,i,s){this.type=n.Syntax.FunctionDeclaration,this.id=t,this.params=e,this.body=i,this.generator=s,this.expression=!1,this.async=!1};e.FunctionDeclaration=O;var R=function(t,e,i,s){this.type=n.Syntax.FunctionExpression,this.id=t,this.params=e,this.body=i,this.generator=s,this.expression=!1,this.async=!1};e.FunctionExpression=R;var U=function(t){this.type=n.Syntax.Identifier,this.name=t};e.Identifier=U;var N=function(t,e,i){this.type=n.Syntax.IfStatement,this.test=t,this.consequent=e,this.alternate=i};e.IfStatement=N;var G=function(t,e){this.type=n.Syntax.ImportDeclaration,this.specifiers=t,this.source=e};e.ImportDeclaration=G;var j=function(t){this.type=n.Syntax.ImportDefaultSpecifier,this.local=t};e.ImportDefaultSpecifier=j;var X=function(t){this.type=n.Syntax.ImportNamespaceSpecifier,this.local=t};e.ImportNamespaceSpecifier=X;var W=function(t,e){this.type=n.Syntax.ImportSpecifier,this.local=t,this.imported=e};e.ImportSpecifier=W;var V=function(t,e){this.type=n.Syntax.LabeledStatement,this.label=t,this.body=e};e.LabeledStatement=V;var H=function(t,e){this.type=n.Syntax.Literal,this.value=t,this.raw=e};e.Literal=H;var z=function(t,e){this.type=n.Syntax.MetaProperty,this.meta=t,this.property=e};e.MetaProperty=z;var Y=function(t,e,i,s,r){this.type=n.Syntax.MethodDefinition,this.key=t,this.computed=e,this.value=i,this.kind=s,this.static=r};e.MethodDefinition=Y;var q=function(t){this.type=n.Syntax.Program,this.body=t,this.sourceType="module"};e.Module=q;var K=function(t,e){this.type=n.Syntax.NewExpression,this.callee=t,this.arguments=e};e.NewExpression=K;var J=function(t){this.type=n.Syntax.ObjectExpression,this.properties=t};e.ObjectExpression=J;var Q=function(t){this.type=n.Syntax.ObjectPattern,this.properties=t};e.ObjectPattern=Q;var Z=function(t,e,i,s,r,o){this.type=n.Syntax.Property,this.key=e,this.computed=i,this.value=s,this.kind=t,this.method=r,this.shorthand=o};e.Property=Z;var $=function(t,e,i,s){this.type=n.Syntax.Literal,this.value=t,this.raw=e,this.regex={pattern:i,flags:s}};e.RegexLiteral=$;var tt=function(t){this.type=n.Syntax.RestElement,this.argument=t};e.RestElement=tt;var et=function(t){this.type=n.Syntax.ReturnStatement,this.argument=t};e.ReturnStatement=et;var it=function(t){this.type=n.Syntax.Program,this.body=t,this.sourceType="script"};e.Script=it;var nt=function(t){this.type=n.Syntax.SequenceExpression,this.expressions=t};e.SequenceExpression=nt;var st=function(t){this.type=n.Syntax.SpreadElement,this.argument=t};e.SpreadElement=st;var rt=function(t,e){this.type=n.Syntax.MemberExpression,this.computed=!1,this.object=t,this.property=e};e.StaticMemberExpression=rt;var ot=function(){this.type=n.Syntax.Super};e.Super=ot;var at=function(t,e){this.type=n.Syntax.SwitchCase,this.test=t,this.consequent=e};e.SwitchCase=at;var ht=function(t,e){this.type=n.Syntax.SwitchStatement,this.discriminant=t,this.cases=e};e.SwitchStatement=ht;var lt=function(t,e){this.type=n.Syntax.TaggedTemplateExpression,this.tag=t,this.quasi=e};e.TaggedTemplateExpression=lt;var ut=function(t,e){this.type=n.Syntax.TemplateElement,this.value=t,this.tail=e};e.TemplateElement=ut;var ct=function(t,e){this.type=n.Syntax.TemplateLiteral,this.quasis=t,this.expressions=e};e.TemplateLiteral=ct;var dt=function(){this.type=n.Syntax.ThisExpression};e.ThisExpression=dt;var pt=function(t){this.type=n.Syntax.ThrowStatement,this.argument=t};e.ThrowStatement=pt;var ft=function(t,e,i){this.type=n.Syntax.TryStatement,this.block=t,this.handler=e,this.finalizer=i};e.TryStatement=ft;var gt=function(t,e){this.type=n.Syntax.UnaryExpression,this.operator=t,this.argument=e,this.prefix=!0};e.UnaryExpression=gt;var mt=function(t,e,i){this.type=n.Syntax.UpdateExpression,this.operator=t,this.argument=e,this.prefix=i};e.UpdateExpression=mt;var yt=function(t,e){this.type=n.Syntax.VariableDeclaration,this.declarations=t,this.kind=e};e.VariableDeclaration=yt;var vt=function(t,e){this.type=n.Syntax.VariableDeclarator,this.id=t,this.init=e};e.VariableDeclarator=vt;var xt=function(t,e){this.type=n.Syntax.WhileStatement,this.test=t,this.body=e};e.WhileStatement=xt;var bt=function(t,e){this.type=n.Syntax.WithStatement,this.object=t,this.body=e};e.WithStatement=bt;var wt=function(t,e){this.type=n.Syntax.YieldExpression,this.argument=t,this.delegate=e};e.YieldExpression=wt},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(9),s=i(10),r=i(11),o=i(7),a=i(12),h=i(2),l=i(13),u=function(){function t(t,e,i){void 0===e&&(e={}),this.config={range:"boolean"==typeof e.range&&e.range,loc:"boolean"==typeof e.loc&&e.loc,source:null,tokens:"boolean"==typeof e.tokens&&e.tokens,comment:"boolean"==typeof e.comment&&e.comment,tolerant:"boolean"==typeof e.tolerant&&e.tolerant},this.config.loc&&e.source&&null!==e.source&&(this.config.source=String(e.source)),this.delegate=i,this.errorHandler=new s.ErrorHandler,this.errorHandler.tolerant=this.config.tolerant,this.scanner=new a.Scanner(t,this.errorHandler),this.scanner.trackComment=this.config.comment,this.operatorPrecedence={")":0,";":0,",":0,"=":0,"]":0,"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":11,"/":11,"%":11},this.lookahead={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0},this.hasLineTerminator=!1,this.context={isModule:!1,await:!1,allowIn:!0,allowStrictDirective:!0,allowYield:!0,firstCoverInitializedNameError:null,isAssignmentTarget:!1,isBindingElement:!1,inFunctionBody:!1,inIteration:!1,inSwitch:!1,labelSet:{},strict:!1},this.tokens=[],this.startMarker={index:0,line:this.scanner.lineNumber,column:0},this.lastMarker={index:0,line:this.scanner.lineNumber,column:0},this.nextToken(),this.lastMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}return t.prototype.throwError=function(t){for(var e=[],i=1;i0&&this.delegate)for(var e=0;e>="===t||">>>="===t||"&="===t||"^="===t||"|="===t},t.prototype.isolateCoverGrammar=function(t){var e=this.context.isBindingElement,i=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var s=t.call(this);return null!==this.context.firstCoverInitializedNameError&&this.throwUnexpectedToken(this.context.firstCoverInitializedNameError),this.context.isBindingElement=e,this.context.isAssignmentTarget=i,this.context.firstCoverInitializedNameError=n,s},t.prototype.inheritCoverGrammar=function(t){var e=this.context.isBindingElement,i=this.context.isAssignmentTarget,n=this.context.firstCoverInitializedNameError;this.context.isBindingElement=!0,this.context.isAssignmentTarget=!0,this.context.firstCoverInitializedNameError=null;var s=t.call(this);return this.context.isBindingElement=this.context.isBindingElement&&e,this.context.isAssignmentTarget=this.context.isAssignmentTarget&&i,this.context.firstCoverInitializedNameError=n||this.context.firstCoverInitializedNameError,s},t.prototype.consumeSemicolon=function(){this.match(";")?this.nextToken():this.hasLineTerminator||(2===this.lookahead.type||this.match("}")||this.throwUnexpectedToken(this.lookahead),this.lastMarker.index=this.startMarker.index,this.lastMarker.line=this.startMarker.line,this.lastMarker.column=this.startMarker.column)},t.prototype.parsePrimaryExpression=function(){var t,e,i,n=this.createNode();switch(this.lookahead.type){case 3:(this.context.isModule||this.context.await)&&"await"===this.lookahead.value&&this.tolerateUnexpectedToken(this.lookahead),t=this.matchAsyncFunction()?this.parseFunctionExpression():this.finalize(n,new o.Identifier(this.nextToken().value));break;case 6:case 8:this.context.strict&&this.lookahead.octal&&this.tolerateUnexpectedToken(this.lookahead,r.Messages.StrictOctalLiteral),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,e=this.nextToken(),i=this.getTokenRaw(e),t=this.finalize(n,new o.Literal(e.value,i));break;case 1:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,e=this.nextToken(),i=this.getTokenRaw(e),t=this.finalize(n,new o.Literal("true"===e.value,i));break;case 5:this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,e=this.nextToken(),i=this.getTokenRaw(e),t=this.finalize(n,new o.Literal(null,i));break;case 10:t=this.parseTemplateLiteral();break;case 7:switch(this.lookahead.value){case"(":this.context.isBindingElement=!1,t=this.inheritCoverGrammar(this.parseGroupExpression);break;case"[":t=this.inheritCoverGrammar(this.parseArrayInitializer);break;case"{":t=this.inheritCoverGrammar(this.parseObjectInitializer);break;case"/":case"/=":this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.scanner.index=this.startMarker.index,e=this.nextRegexToken(),i=this.getTokenRaw(e),t=this.finalize(n,new o.RegexLiteral(e.regex,i,e.pattern,e.flags));break;default:t=this.throwUnexpectedToken(this.nextToken())}break;case 4:!this.context.strict&&this.context.allowYield&&this.matchKeyword("yield")?t=this.parseIdentifierName():!this.context.strict&&this.matchKeyword("let")?t=this.finalize(n,new o.Identifier(this.nextToken().value)):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.matchKeyword("function")?t=this.parseFunctionExpression():this.matchKeyword("this")?(this.nextToken(),t=this.finalize(n,new o.ThisExpression)):t=this.matchKeyword("class")?this.parseClassExpression():this.throwUnexpectedToken(this.nextToken()));break;default:t=this.throwUnexpectedToken(this.nextToken())}return t},t.prototype.parseSpreadElement=function(){var t=this.createNode();this.expect("...");var e=this.inheritCoverGrammar(this.parseAssignmentExpression);return this.finalize(t,new o.SpreadElement(e))},t.prototype.parseArrayInitializer=function(){var t=this.createNode(),e=[];for(this.expect("[");!this.match("]");)if(this.match(","))this.nextToken(),e.push(null);else if(this.match("...")){var i=this.parseSpreadElement();this.match("]")||(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1,this.expect(",")),e.push(i)}else e.push(this.inheritCoverGrammar(this.parseAssignmentExpression)),this.match("]")||this.expect(",");return this.expect("]"),this.finalize(t,new o.ArrayExpression(e))},t.prototype.parsePropertyMethod=function(t){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var e=this.context.strict,i=this.context.allowStrictDirective;this.context.allowStrictDirective=t.simple;var n=this.isolateCoverGrammar(this.parseFunctionSourceElements);return this.context.strict&&t.firstRestricted&&this.tolerateUnexpectedToken(t.firstRestricted,t.message),this.context.strict&&t.stricted&&this.tolerateUnexpectedToken(t.stricted,t.message),this.context.strict=e,this.context.allowStrictDirective=i,n},t.prototype.parsePropertyMethodFunction=function(){var t=this.createNode(),e=this.context.allowYield;this.context.allowYield=!0;var i=this.parseFormalParameters(),n=this.parsePropertyMethod(i);return this.context.allowYield=e,this.finalize(t,new o.FunctionExpression(null,i.params,n,!1))},t.prototype.parsePropertyMethodAsyncFunction=function(){var t=this.createNode(),e=this.context.allowYield,i=this.context.await;this.context.allowYield=!1,this.context.await=!0;var n=this.parseFormalParameters(),s=this.parsePropertyMethod(n);return this.context.allowYield=e,this.context.await=i,this.finalize(t,new o.AsyncFunctionExpression(null,n.params,s))},t.prototype.parseObjectPropertyKey=function(){var t,e=this.createNode(),i=this.nextToken();switch(i.type){case 8:case 6:this.context.strict&&i.octal&&this.tolerateUnexpectedToken(i,r.Messages.StrictOctalLiteral);var n=this.getTokenRaw(i);t=this.finalize(e,new o.Literal(i.value,n));break;case 3:case 1:case 5:case 4:t=this.finalize(e,new o.Identifier(i.value));break;case 7:"["===i.value?(t=this.isolateCoverGrammar(this.parseAssignmentExpression),this.expect("]")):t=this.throwUnexpectedToken(i);break;default:t=this.throwUnexpectedToken(i)}return t},t.prototype.isPropertyKey=function(t,e){return t.type===h.Syntax.Identifier&&t.name===e||t.type===h.Syntax.Literal&&t.value===e},t.prototype.parseObjectProperty=function(t){var e,i=this.createNode(),n=this.lookahead,s=null,a=null,h=!1,l=!1,u=!1,c=!1;if(3===n.type){var d=n.value;this.nextToken(),h=this.match("["),s=(c=!(this.hasLineTerminator||"async"!==d||this.match(":")||this.match("(")||this.match("*")||this.match(",")))?this.parseObjectPropertyKey():this.finalize(i,new o.Identifier(d))}else this.match("*")?this.nextToken():(h=this.match("["),s=this.parseObjectPropertyKey());var p=this.qualifiedPropertyName(this.lookahead);if(3===n.type&&!c&&"get"===n.value&&p)e="get",h=this.match("["),s=this.parseObjectPropertyKey(),this.context.allowYield=!1,a=this.parseGetterMethod();else if(3===n.type&&!c&&"set"===n.value&&p)e="set",h=this.match("["),s=this.parseObjectPropertyKey(),a=this.parseSetterMethod();else if(7===n.type&&"*"===n.value&&p)e="init",h=this.match("["),s=this.parseObjectPropertyKey(),a=this.parseGeneratorMethod(),l=!0;else if(s||this.throwUnexpectedToken(this.lookahead),e="init",this.match(":")&&!c)!h&&this.isPropertyKey(s,"__proto__")&&(t.value&&this.tolerateError(r.Messages.DuplicateProtoProperty),t.value=!0),this.nextToken(),a=this.inheritCoverGrammar(this.parseAssignmentExpression);else if(this.match("("))a=c?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),l=!0;else if(3===n.type)if(d=this.finalize(i,new o.Identifier(n.value)),this.match("=")){this.context.firstCoverInitializedNameError=this.lookahead,this.nextToken(),u=!0;var f=this.isolateCoverGrammar(this.parseAssignmentExpression);a=this.finalize(i,new o.AssignmentPattern(d,f))}else u=!0,a=d;else this.throwUnexpectedToken(this.nextToken());return this.finalize(i,new o.Property(e,s,h,a,l,u))},t.prototype.parseObjectInitializer=function(){var t=this.createNode();this.expect("{");for(var e=[],i={value:!1};!this.match("}");)e.push(this.parseObjectProperty(i)),this.match("}")||this.expectCommaSeparator();return this.expect("}"),this.finalize(t,new o.ObjectExpression(e))},t.prototype.parseTemplateHead=function(){n.assert(this.lookahead.head,"Template literal must start with a template head");var t=this.createNode(),e=this.nextToken(),i=e.value,s=e.cooked;return this.finalize(t,new o.TemplateElement({raw:i,cooked:s},e.tail))},t.prototype.parseTemplateElement=function(){10!==this.lookahead.type&&this.throwUnexpectedToken();var t=this.createNode(),e=this.nextToken(),i=e.value,n=e.cooked;return this.finalize(t,new o.TemplateElement({raw:i,cooked:n},e.tail))},t.prototype.parseTemplateLiteral=function(){var t=this.createNode(),e=[],i=[],n=this.parseTemplateHead();for(i.push(n);!n.tail;)e.push(this.parseExpression()),n=this.parseTemplateElement(),i.push(n);return this.finalize(t,new o.TemplateLiteral(i,e))},t.prototype.reinterpretExpressionAsPattern=function(t){switch(t.type){case h.Syntax.Identifier:case h.Syntax.MemberExpression:case h.Syntax.RestElement:case h.Syntax.AssignmentPattern:break;case h.Syntax.SpreadElement:t.type=h.Syntax.RestElement,this.reinterpretExpressionAsPattern(t.argument);break;case h.Syntax.ArrayExpression:t.type=h.Syntax.ArrayPattern;for(var e=0;e")||this.expect("=>"),t={type:"ArrowParameterPlaceHolder",params:[],async:!1};else{var e=this.lookahead,i=[];if(this.match("..."))t=this.parseRestElement(i),this.expect(")"),this.match("=>")||this.expect("=>"),t={type:"ArrowParameterPlaceHolder",params:[t],async:!1};else{var n=!1;if(this.context.isBindingElement=!0,t=this.inheritCoverGrammar(this.parseAssignmentExpression),this.match(",")){var s=[];for(this.context.isAssignmentTarget=!1,s.push(t);2!==this.lookahead.type&&this.match(",");){if(this.nextToken(),this.match(")")){this.nextToken();for(var r=0;r")||this.expect("=>"),this.context.isBindingElement=!1,r=0;r")&&(t.type===h.Syntax.Identifier&&"yield"===t.name&&(n=!0,t={type:"ArrowParameterPlaceHolder",params:[t],async:!1}),!n)){if(this.context.isBindingElement||this.throwUnexpectedToken(this.lookahead),t.type===h.Syntax.SequenceExpression)for(r=0;r")){for(var h=0;h0){this.nextToken(),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;for(var s=[t,this.lookahead],r=e,a=this.isolateCoverGrammar(this.parseExponentiationExpression),h=[r,i.value,a],l=[n];!((n=this.binaryPrecedence(this.lookahead))<=0);){for(;h.length>2&&n<=l[l.length-1];){a=h.pop();var u=h.pop();l.pop(),r=h.pop(),s.pop();var c=this.startNode(s[s.length-1]);h.push(this.finalize(c,new o.BinaryExpression(u,r,a)))}h.push(this.nextToken().value),l.push(n),s.push(this.lookahead),h.push(this.isolateCoverGrammar(this.parseExponentiationExpression))}var d=h.length-1;e=h[d];for(var p=s.pop();d>1;){var f=s.pop(),g=p&&p.lineStart;c=this.startNode(f,g),u=h[d-1],e=this.finalize(c,new o.BinaryExpression(u,h[d-2],e)),d-=2,p=f}}return e},t.prototype.parseConditionalExpression=function(){var t=this.lookahead,e=this.inheritCoverGrammar(this.parseBinaryExpression);if(this.match("?")){this.nextToken();var i=this.context.allowIn;this.context.allowIn=!0;var n=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowIn=i,this.expect(":");var s=this.isolateCoverGrammar(this.parseAssignmentExpression);e=this.finalize(this.startNode(t),new o.ConditionalExpression(e,n,s)),this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1}return e},t.prototype.checkPatternParam=function(t,e){switch(e.type){case h.Syntax.Identifier:this.validateParam(t,e,e.name);break;case h.Syntax.RestElement:this.checkPatternParam(t,e.argument);break;case h.Syntax.AssignmentPattern:this.checkPatternParam(t,e.left);break;case h.Syntax.ArrayPattern:for(var i=0;i")){this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1;var s=t.async,a=this.reinterpretAsCoverFormalsList(t);if(a){this.hasLineTerminator&&this.tolerateUnexpectedToken(this.lookahead),this.context.firstCoverInitializedNameError=null;var l=this.context.strict,u=this.context.allowStrictDirective;this.context.allowStrictDirective=a.simple;var c=this.context.allowYield,d=this.context.await;this.context.allowYield=!0,this.context.await=s;var p=this.startNode(e);this.expect("=>");var f=void 0;if(this.match("{")){var g=this.context.allowIn;this.context.allowIn=!0,f=this.parseFunctionSourceElements(),this.context.allowIn=g}else f=this.isolateCoverGrammar(this.parseAssignmentExpression);var m=f.type!==h.Syntax.BlockStatement;this.context.strict&&a.firstRestricted&&this.throwUnexpectedToken(a.firstRestricted,a.message),this.context.strict&&a.stricted&&this.tolerateUnexpectedToken(a.stricted,a.message),t=s?this.finalize(p,new o.AsyncArrowFunctionExpression(a.params,f,m)):this.finalize(p,new o.ArrowFunctionExpression(a.params,f,m)),this.context.strict=l,this.context.allowStrictDirective=u,this.context.allowYield=c,this.context.await=d}}else if(this.matchAssign()){if(this.context.isAssignmentTarget||this.tolerateError(r.Messages.InvalidLHSInAssignment),this.context.strict&&t.type===h.Syntax.Identifier){var y=t;this.scanner.isRestrictedWord(y.name)&&this.tolerateUnexpectedToken(i,r.Messages.StrictLHSAssignment),this.scanner.isStrictModeReservedWord(y.name)&&this.tolerateUnexpectedToken(i,r.Messages.StrictReservedWord)}this.match("=")?this.reinterpretExpressionAsPattern(t):(this.context.isAssignmentTarget=!1,this.context.isBindingElement=!1);var v=(i=this.nextToken()).value,x=this.isolateCoverGrammar(this.parseAssignmentExpression);t=this.finalize(this.startNode(e),new o.AssignmentExpression(v,t,x)),this.context.firstCoverInitializedNameError=null}}return t},t.prototype.parseExpression=function(){var t=this.lookahead,e=this.isolateCoverGrammar(this.parseAssignmentExpression);if(this.match(",")){var i=[];for(i.push(e);2!==this.lookahead.type&&this.match(",");)this.nextToken(),i.push(this.isolateCoverGrammar(this.parseAssignmentExpression));e=this.finalize(this.startNode(t),new o.SequenceExpression(i))}return e},t.prototype.parseStatementListItem=function(){var t;if(this.context.isAssignmentTarget=!0,this.context.isBindingElement=!0,4===this.lookahead.type)switch(this.lookahead.value){case"export":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,r.Messages.IllegalExportDeclaration),t=this.parseExportDeclaration();break;case"import":this.context.isModule||this.tolerateUnexpectedToken(this.lookahead,r.Messages.IllegalImportDeclaration),t=this.parseImportDeclaration();break;case"const":t=this.parseLexicalDeclaration({inFor:!1});break;case"function":t=this.parseFunctionDeclaration();break;case"class":t=this.parseClassDeclaration();break;case"let":t=this.isLexicalDeclaration()?this.parseLexicalDeclaration({inFor:!1}):this.parseStatement();break;default:t=this.parseStatement()}else t=this.parseStatement();return t},t.prototype.parseBlock=function(){var t=this.createNode();this.expect("{");for(var e=[];!this.match("}");)e.push(this.parseStatementListItem());return this.expect("}"),this.finalize(t,new o.BlockStatement(e))},t.prototype.parseLexicalBinding=function(t,e){var i=this.createNode(),n=this.parsePattern([],t);this.context.strict&&n.type===h.Syntax.Identifier&&this.scanner.isRestrictedWord(n.name)&&this.tolerateError(r.Messages.StrictVarName);var s=null;return"const"===t?this.matchKeyword("in")||this.matchContextualKeyword("of")||(this.match("=")?(this.nextToken(),s=this.isolateCoverGrammar(this.parseAssignmentExpression)):this.throwError(r.Messages.DeclarationMissingInitializer,"const")):(!e.inFor&&n.type!==h.Syntax.Identifier||this.match("="))&&(this.expect("="),s=this.isolateCoverGrammar(this.parseAssignmentExpression)),this.finalize(i,new o.VariableDeclarator(n,s))},t.prototype.parseBindingList=function(t,e){for(var i=[this.parseLexicalBinding(t,e)];this.match(",");)this.nextToken(),i.push(this.parseLexicalBinding(t,e));return i},t.prototype.isLexicalDeclaration=function(){var t=this.scanner.saveState();this.scanner.scanComments();var e=this.scanner.lex();return this.scanner.restoreState(t),3===e.type||7===e.type&&"["===e.value||7===e.type&&"{"===e.value||4===e.type&&"let"===e.value||4===e.type&&"yield"===e.value},t.prototype.parseLexicalDeclaration=function(t){var e=this.createNode(),i=this.nextToken().value;n.assert("let"===i||"const"===i,"Lexical declaration must be either let or const");var s=this.parseBindingList(i,t);return this.consumeSemicolon(),this.finalize(e,new o.VariableDeclaration(s,i))},t.prototype.parseBindingRestElement=function(t,e){var i=this.createNode();this.expect("...");var n=this.parsePattern(t,e);return this.finalize(i,new o.RestElement(n))},t.prototype.parseArrayPattern=function(t,e){var i=this.createNode();this.expect("[");for(var n=[];!this.match("]");)if(this.match(","))this.nextToken(),n.push(null);else{if(this.match("...")){n.push(this.parseBindingRestElement(t,e));break}n.push(this.parsePatternWithDefault(t,e)),this.match("]")||this.expect(",")}return this.expect("]"),this.finalize(i,new o.ArrayPattern(n))},t.prototype.parsePropertyPattern=function(t,e){var i,n,s=this.createNode(),r=!1,a=!1;if(3===this.lookahead.type){var h=this.lookahead;i=this.parseVariableIdentifier();var l=this.finalize(s,new o.Identifier(h.value));if(this.match("=")){t.push(h),a=!0,this.nextToken();var u=this.parseAssignmentExpression();n=this.finalize(this.startNode(h),new o.AssignmentPattern(l,u))}else this.match(":")?(this.expect(":"),n=this.parsePatternWithDefault(t,e)):(t.push(h),a=!0,n=l)}else r=this.match("["),i=this.parseObjectPropertyKey(),this.expect(":"),n=this.parsePatternWithDefault(t,e);return this.finalize(s,new o.Property("init",i,r,n,!1,a))},t.prototype.parseObjectPattern=function(t,e){var i=this.createNode(),n=[];for(this.expect("{");!this.match("}");)n.push(this.parsePropertyPattern(t,e)),this.match("}")||this.expect(",");return this.expect("}"),this.finalize(i,new o.ObjectPattern(n))},t.prototype.parsePattern=function(t,e){var i;return this.match("[")?i=this.parseArrayPattern(t,e):this.match("{")?i=this.parseObjectPattern(t,e):(!this.matchKeyword("let")||"const"!==e&&"let"!==e||this.tolerateUnexpectedToken(this.lookahead,r.Messages.LetInLexicalBinding),t.push(this.lookahead),i=this.parseVariableIdentifier(e)),i},t.prototype.parsePatternWithDefault=function(t,e){var i=this.lookahead,n=this.parsePattern(t,e);if(this.match("=")){this.nextToken();var s=this.context.allowYield;this.context.allowYield=!0;var r=this.isolateCoverGrammar(this.parseAssignmentExpression);this.context.allowYield=s,n=this.finalize(this.startNode(i),new o.AssignmentPattern(n,r))}return n},t.prototype.parseVariableIdentifier=function(t){var e=this.createNode(),i=this.nextToken();return 4===i.type&&"yield"===i.value?this.context.strict?this.tolerateUnexpectedToken(i,r.Messages.StrictReservedWord):this.context.allowYield||this.throwUnexpectedToken(i):3!==i.type?this.context.strict&&4===i.type&&this.scanner.isStrictModeReservedWord(i.value)?this.tolerateUnexpectedToken(i,r.Messages.StrictReservedWord):(this.context.strict||"let"!==i.value||"var"!==t)&&this.throwUnexpectedToken(i):(this.context.isModule||this.context.await)&&3===i.type&&"await"===i.value&&this.tolerateUnexpectedToken(i),this.finalize(e,new o.Identifier(i.value))},t.prototype.parseVariableDeclaration=function(t){var e=this.createNode(),i=this.parsePattern([],"var");this.context.strict&&i.type===h.Syntax.Identifier&&this.scanner.isRestrictedWord(i.name)&&this.tolerateError(r.Messages.StrictVarName);var n=null;return this.match("=")?(this.nextToken(),n=this.isolateCoverGrammar(this.parseAssignmentExpression)):i.type===h.Syntax.Identifier||t.inFor||this.expect("="),this.finalize(e,new o.VariableDeclarator(i,n))},t.prototype.parseVariableDeclarationList=function(t){var e={inFor:t.inFor},i=[];for(i.push(this.parseVariableDeclaration(e));this.match(",");)this.nextToken(),i.push(this.parseVariableDeclaration(e));return i},t.prototype.parseVariableStatement=function(){var t=this.createNode();this.expectKeyword("var");var e=this.parseVariableDeclarationList({inFor:!1});return this.consumeSemicolon(),this.finalize(t,new o.VariableDeclaration(e,"var"))},t.prototype.parseEmptyStatement=function(){var t=this.createNode();return this.expect(";"),this.finalize(t,new o.EmptyStatement)},t.prototype.parseExpressionStatement=function(){var t=this.createNode(),e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new o.ExpressionStatement(e))},t.prototype.parseIfClause=function(){return this.context.strict&&this.matchKeyword("function")&&this.tolerateError(r.Messages.StrictFunction),this.parseStatement()},t.prototype.parseIfStatement=function(){var t,e=this.createNode(),i=null;this.expectKeyword("if"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),t=this.finalize(this.createNode(),new o.EmptyStatement)):(this.expect(")"),t=this.parseIfClause(),this.matchKeyword("else")&&(this.nextToken(),i=this.parseIfClause())),this.finalize(e,new o.IfStatement(n,t,i))},t.prototype.parseDoWhileStatement=function(){var t=this.createNode();this.expectKeyword("do");var e=this.context.inIteration;this.context.inIteration=!0;var i=this.parseStatement();this.context.inIteration=e,this.expectKeyword("while"),this.expect("(");var n=this.parseExpression();return!this.match(")")&&this.config.tolerant?this.tolerateUnexpectedToken(this.nextToken()):(this.expect(")"),this.match(";")&&this.nextToken()),this.finalize(t,new o.DoWhileStatement(i,n))},t.prototype.parseWhileStatement=function(){var t,e=this.createNode();this.expectKeyword("while"),this.expect("(");var i=this.parseExpression();if(!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),t=this.finalize(this.createNode(),new o.EmptyStatement);else{this.expect(")");var n=this.context.inIteration;this.context.inIteration=!0,t=this.parseStatement(),this.context.inIteration=n}return this.finalize(e,new o.WhileStatement(i,t))},t.prototype.parseForStatement=function(){var t,e,i,n=null,s=null,a=null,l=!0,u=this.createNode();if(this.expectKeyword("for"),this.expect("("),this.match(";"))this.nextToken();else if(this.matchKeyword("var")){n=this.createNode(),this.nextToken();var c=this.context.allowIn;this.context.allowIn=!1;var d=this.parseVariableDeclarationList({inFor:!0});if(this.context.allowIn=c,1===d.length&&this.matchKeyword("in")){var p=d[0];p.init&&(p.id.type===h.Syntax.ArrayPattern||p.id.type===h.Syntax.ObjectPattern||this.context.strict)&&this.tolerateError(r.Messages.ForInOfLoopInitializer,"for-in"),n=this.finalize(n,new o.VariableDeclaration(d,"var")),this.nextToken(),t=n,e=this.parseExpression(),n=null}else 1===d.length&&null===d[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new o.VariableDeclaration(d,"var")),this.nextToken(),t=n,e=this.parseAssignmentExpression(),n=null,l=!1):(n=this.finalize(n,new o.VariableDeclaration(d,"var")),this.expect(";"))}else if(this.matchKeyword("const")||this.matchKeyword("let")){n=this.createNode();var f=this.nextToken().value;this.context.strict||"in"!==this.lookahead.value?(c=this.context.allowIn,this.context.allowIn=!1,d=this.parseBindingList(f,{inFor:!0}),this.context.allowIn=c,1===d.length&&null===d[0].init&&this.matchKeyword("in")?(n=this.finalize(n,new o.VariableDeclaration(d,f)),this.nextToken(),t=n,e=this.parseExpression(),n=null):1===d.length&&null===d[0].init&&this.matchContextualKeyword("of")?(n=this.finalize(n,new o.VariableDeclaration(d,f)),this.nextToken(),t=n,e=this.parseAssignmentExpression(),n=null,l=!1):(this.consumeSemicolon(),n=this.finalize(n,new o.VariableDeclaration(d,f)))):(n=this.finalize(n,new o.Identifier(f)),this.nextToken(),t=n,e=this.parseExpression(),n=null)}else{var g=this.lookahead;if(c=this.context.allowIn,this.context.allowIn=!1,n=this.inheritCoverGrammar(this.parseAssignmentExpression),this.context.allowIn=c,this.matchKeyword("in"))this.context.isAssignmentTarget&&n.type!==h.Syntax.AssignmentExpression||this.tolerateError(r.Messages.InvalidLHSInForIn),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseExpression(),n=null;else if(this.matchContextualKeyword("of"))this.context.isAssignmentTarget&&n.type!==h.Syntax.AssignmentExpression||this.tolerateError(r.Messages.InvalidLHSInForLoop),this.nextToken(),this.reinterpretExpressionAsPattern(n),t=n,e=this.parseAssignmentExpression(),n=null,l=!1;else{if(this.match(",")){for(var m=[n];this.match(",");)this.nextToken(),m.push(this.isolateCoverGrammar(this.parseAssignmentExpression));n=this.finalize(this.startNode(g),new o.SequenceExpression(m))}this.expect(";")}}if(void 0===t&&(this.match(";")||(s=this.parseExpression()),this.expect(";"),this.match(")")||(a=this.parseExpression())),!this.match(")")&&this.config.tolerant)this.tolerateUnexpectedToken(this.nextToken()),i=this.finalize(this.createNode(),new o.EmptyStatement);else{this.expect(")");var y=this.context.inIteration;this.context.inIteration=!0,i=this.isolateCoverGrammar(this.parseStatement),this.context.inIteration=y}return void 0===t?this.finalize(u,new o.ForStatement(n,s,a,i)):l?this.finalize(u,new o.ForInStatement(t,e,i)):this.finalize(u,new o.ForOfStatement(t,e,i))},t.prototype.parseContinueStatement=function(){var t=this.createNode();this.expectKeyword("continue");var e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var i=this.parseVariableIdentifier();e=i;var n="$"+i.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(r.Messages.UnknownLabel,i.name)}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.throwError(r.Messages.IllegalContinue),this.finalize(t,new o.ContinueStatement(e))},t.prototype.parseBreakStatement=function(){var t=this.createNode();this.expectKeyword("break");var e=null;if(3===this.lookahead.type&&!this.hasLineTerminator){var i=this.parseVariableIdentifier(),n="$"+i.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,n)||this.throwError(r.Messages.UnknownLabel,i.name),e=i}return this.consumeSemicolon(),null!==e||this.context.inIteration||this.context.inSwitch||this.throwError(r.Messages.IllegalBreak),this.finalize(t,new o.BreakStatement(e))},t.prototype.parseReturnStatement=function(){this.context.inFunctionBody||this.tolerateError(r.Messages.IllegalReturn);var t=this.createNode();this.expectKeyword("return");var e=(this.match(";")||this.match("}")||this.hasLineTerminator||2===this.lookahead.type)&&8!==this.lookahead.type&&10!==this.lookahead.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new o.ReturnStatement(e))},t.prototype.parseWithStatement=function(){this.context.strict&&this.tolerateError(r.Messages.StrictModeWith);var t,e=this.createNode();this.expectKeyword("with"),this.expect("(");var i=this.parseExpression();return!this.match(")")&&this.config.tolerant?(this.tolerateUnexpectedToken(this.nextToken()),t=this.finalize(this.createNode(),new o.EmptyStatement)):(this.expect(")"),t=this.parseStatement()),this.finalize(e,new o.WithStatement(i,t))},t.prototype.parseSwitchCase=function(){var t,e=this.createNode();this.matchKeyword("default")?(this.nextToken(),t=null):(this.expectKeyword("case"),t=this.parseExpression()),this.expect(":");for(var i=[];!(this.match("}")||this.matchKeyword("default")||this.matchKeyword("case"));)i.push(this.parseStatementListItem());return this.finalize(e,new o.SwitchCase(t,i))},t.prototype.parseSwitchStatement=function(){var t=this.createNode();this.expectKeyword("switch"),this.expect("(");var e=this.parseExpression();this.expect(")");var i=this.context.inSwitch;this.context.inSwitch=!0;var n=[],s=!1;for(this.expect("{");!this.match("}");){var a=this.parseSwitchCase();null===a.test&&(s&&this.throwError(r.Messages.MultipleDefaultsInSwitch),s=!0),n.push(a)}return this.expect("}"),this.context.inSwitch=i,this.finalize(t,new o.SwitchStatement(e,n))},t.prototype.parseLabelledStatement=function(){var t,e=this.createNode(),i=this.parseExpression();if(i.type===h.Syntax.Identifier&&this.match(":")){this.nextToken();var n=i,s="$"+n.name;Object.prototype.hasOwnProperty.call(this.context.labelSet,s)&&this.throwError(r.Messages.Redeclaration,"Label",n.name),this.context.labelSet[s]=!0;var a=void 0;if(this.matchKeyword("class"))this.tolerateUnexpectedToken(this.lookahead),a=this.parseClassDeclaration();else if(this.matchKeyword("function")){var l=this.lookahead,u=this.parseFunctionDeclaration();this.context.strict?this.tolerateUnexpectedToken(l,r.Messages.StrictFunction):u.generator&&this.tolerateUnexpectedToken(l,r.Messages.GeneratorInLegacyContext),a=u}else a=this.parseStatement();delete this.context.labelSet[s],t=new o.LabeledStatement(n,a)}else this.consumeSemicolon(),t=new o.ExpressionStatement(i);return this.finalize(e,t)},t.prototype.parseThrowStatement=function(){var t=this.createNode();this.expectKeyword("throw"),this.hasLineTerminator&&this.throwError(r.Messages.NewlineAfterThrow);var e=this.parseExpression();return this.consumeSemicolon(),this.finalize(t,new o.ThrowStatement(e))},t.prototype.parseCatchClause=function(){var t=this.createNode();this.expectKeyword("catch"),this.expect("("),this.match(")")&&this.throwUnexpectedToken(this.lookahead);for(var e=[],i=this.parsePattern(e),n={},s=0;s0&&this.tolerateError(r.Messages.BadGetterArity);var n=this.parsePropertyMethod(i);return this.context.allowYield=e,this.finalize(t,new o.FunctionExpression(null,i.params,n,!1))},t.prototype.parseSetterMethod=function(){var t=this.createNode(),e=this.context.allowYield;this.context.allowYield=!0;var i=this.parseFormalParameters();1!==i.params.length?this.tolerateError(r.Messages.BadSetterArity):i.params[0]instanceof o.RestElement&&this.tolerateError(r.Messages.BadSetterRestParameter);var n=this.parsePropertyMethod(i);return this.context.allowYield=e,this.finalize(t,new o.FunctionExpression(null,i.params,n,!1))},t.prototype.parseGeneratorMethod=function(){var t=this.createNode(),e=this.context.allowYield;this.context.allowYield=!0;var i=this.parseFormalParameters();this.context.allowYield=!1;var n=this.parsePropertyMethod(i);return this.context.allowYield=e,this.finalize(t,new o.FunctionExpression(null,i.params,n,!0))},t.prototype.isStartOfExpression=function(){var t=!0,e=this.lookahead.value;switch(this.lookahead.type){case 7:t="["===e||"("===e||"{"===e||"+"===e||"-"===e||"!"===e||"~"===e||"++"===e||"--"===e||"/"===e||"/="===e;break;case 4:t="class"===e||"delete"===e||"function"===e||"let"===e||"new"===e||"super"===e||"this"===e||"typeof"===e||"void"===e||"yield"===e}return t},t.prototype.parseYieldExpression=function(){var t=this.createNode();this.expectKeyword("yield");var e=null,i=!1;if(!this.hasLineTerminator){var n=this.context.allowYield;this.context.allowYield=!1,(i=this.match("*"))?(this.nextToken(),e=this.parseAssignmentExpression()):this.isStartOfExpression()&&(e=this.parseAssignmentExpression()),this.context.allowYield=n}return this.finalize(t,new o.YieldExpression(e,i))},t.prototype.parseClassElement=function(t){var e=this.lookahead,i=this.createNode(),n="",s=null,a=null,h=!1,l=!1,u=!1,c=!1;if(this.match("*"))this.nextToken();else if(h=this.match("["),"static"===(s=this.parseObjectPropertyKey()).name&&(this.qualifiedPropertyName(this.lookahead)||this.match("*"))&&(e=this.lookahead,u=!0,h=this.match("["),this.match("*")?this.nextToken():s=this.parseObjectPropertyKey()),3===e.type&&!this.hasLineTerminator&&"async"===e.value){var d=this.lookahead.value;":"!==d&&"("!==d&&"*"!==d&&(c=!0,e=this.lookahead,s=this.parseObjectPropertyKey(),3===e.type&&"constructor"===e.value&&this.tolerateUnexpectedToken(e,r.Messages.ConstructorIsAsync))}var p=this.qualifiedPropertyName(this.lookahead);return 3===e.type?"get"===e.value&&p?(n="get",h=this.match("["),s=this.parseObjectPropertyKey(),this.context.allowYield=!1,a=this.parseGetterMethod()):"set"===e.value&&p&&(n="set",h=this.match("["),s=this.parseObjectPropertyKey(),a=this.parseSetterMethod()):7===e.type&&"*"===e.value&&p&&(n="init",h=this.match("["),s=this.parseObjectPropertyKey(),a=this.parseGeneratorMethod(),l=!0),!n&&s&&this.match("(")&&(n="init",a=c?this.parsePropertyMethodAsyncFunction():this.parsePropertyMethodFunction(),l=!0),n||this.throwUnexpectedToken(this.lookahead),"init"===n&&(n="method"),h||(u&&this.isPropertyKey(s,"prototype")&&this.throwUnexpectedToken(e,r.Messages.StaticPrototype),!u&&this.isPropertyKey(s,"constructor")&&(("method"!==n||!l||a&&a.generator)&&this.throwUnexpectedToken(e,r.Messages.ConstructorSpecialMethod),t.value?this.throwUnexpectedToken(e,r.Messages.DuplicateConstructor):t.value=!0,n="constructor")),this.finalize(i,new o.MethodDefinition(s,h,a,n,u))},t.prototype.parseClassElementList=function(){var t=[],e={value:!1};for(this.expect("{");!this.match("}");)this.match(";")?this.nextToken():t.push(this.parseClassElement(e));return this.expect("}"),t},t.prototype.parseClassBody=function(){var t=this.createNode(),e=this.parseClassElementList();return this.finalize(t,new o.ClassBody(e))},t.prototype.parseClassDeclaration=function(t){var e=this.createNode(),i=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var n=t&&3!==this.lookahead.type?null:this.parseVariableIdentifier(),s=null;this.matchKeyword("extends")&&(this.nextToken(),s=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var r=this.parseClassBody();return this.context.strict=i,this.finalize(e,new o.ClassDeclaration(n,s,r))},t.prototype.parseClassExpression=function(){var t=this.createNode(),e=this.context.strict;this.context.strict=!0,this.expectKeyword("class");var i=3===this.lookahead.type?this.parseVariableIdentifier():null,n=null;this.matchKeyword("extends")&&(this.nextToken(),n=this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall));var s=this.parseClassBody();return this.context.strict=e,this.finalize(t,new o.ClassExpression(i,n,s))},t.prototype.parseModule=function(){this.context.strict=!0,this.context.isModule=!0,this.scanner.isModule=!0;for(var t=this.createNode(),e=this.parseDirectivePrologues();2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new o.Module(e))},t.prototype.parseScript=function(){for(var t=this.createNode(),e=this.parseDirectivePrologues();2!==this.lookahead.type;)e.push(this.parseStatementListItem());return this.finalize(t,new o.Script(e))},t.prototype.parseModuleSpecifier=function(){var t=this.createNode();8!==this.lookahead.type&&this.throwError(r.Messages.InvalidModuleSpecifier);var e=this.nextToken(),i=this.getTokenRaw(e);return this.finalize(t,new o.Literal(e.value,i))},t.prototype.parseImportSpecifier=function(){var t,e,i=this.createNode();return 3===this.lookahead.type?(e=t=this.parseVariableIdentifier(),this.matchContextualKeyword("as")&&(this.nextToken(),e=this.parseVariableIdentifier())):(e=t=this.parseIdentifierName(),this.matchContextualKeyword("as")?(this.nextToken(),e=this.parseVariableIdentifier()):this.throwUnexpectedToken(this.nextToken())),this.finalize(i,new o.ImportSpecifier(e,t))},t.prototype.parseNamedImports=function(){this.expect("{");for(var t=[];!this.match("}");)t.push(this.parseImportSpecifier()),this.match("}")||this.expect(",");return this.expect("}"),t},t.prototype.parseImportDefaultSpecifier=function(){var t=this.createNode(),e=this.parseIdentifierName();return this.finalize(t,new o.ImportDefaultSpecifier(e))},t.prototype.parseImportNamespaceSpecifier=function(){var t=this.createNode();this.expect("*"),this.matchContextualKeyword("as")||this.throwError(r.Messages.NoAsAfterImportNamespace),this.nextToken();var e=this.parseIdentifierName();return this.finalize(t,new o.ImportNamespaceSpecifier(e))},t.prototype.parseImportDeclaration=function(){this.context.inFunctionBody&&this.throwError(r.Messages.IllegalImportDeclaration);var t,e=this.createNode();this.expectKeyword("import");var i=[];if(8===this.lookahead.type)t=this.parseModuleSpecifier();else{if(this.match("{")?i=i.concat(this.parseNamedImports()):this.match("*")?i.push(this.parseImportNamespaceSpecifier()):this.isIdentifierName(this.lookahead)&&!this.matchKeyword("default")?(i.push(this.parseImportDefaultSpecifier()),this.match(",")&&(this.nextToken(),this.match("*")?i.push(this.parseImportNamespaceSpecifier()):this.match("{")?i=i.concat(this.parseNamedImports()):this.throwUnexpectedToken(this.lookahead))):this.throwUnexpectedToken(this.nextToken()),!this.matchContextualKeyword("from")){var n=this.lookahead.value?r.Messages.UnexpectedToken:r.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}this.nextToken(),t=this.parseModuleSpecifier()}return this.consumeSemicolon(),this.finalize(e,new o.ImportDeclaration(i,t))},t.prototype.parseExportSpecifier=function(){var t=this.createNode(),e=this.parseIdentifierName(),i=e;return this.matchContextualKeyword("as")&&(this.nextToken(),i=this.parseIdentifierName()),this.finalize(t,new o.ExportSpecifier(e,i))},t.prototype.parseExportDeclaration=function(){this.context.inFunctionBody&&this.throwError(r.Messages.IllegalExportDeclaration);var t,e=this.createNode();if(this.expectKeyword("export"),this.matchKeyword("default"))if(this.nextToken(),this.matchKeyword("function")){var i=this.parseFunctionDeclaration(!0);t=this.finalize(e,new o.ExportDefaultDeclaration(i))}else this.matchKeyword("class")?(i=this.parseClassDeclaration(!0),t=this.finalize(e,new o.ExportDefaultDeclaration(i))):this.matchContextualKeyword("async")?(i=this.matchAsyncFunction()?this.parseFunctionDeclaration(!0):this.parseAssignmentExpression(),t=this.finalize(e,new o.ExportDefaultDeclaration(i))):(this.matchContextualKeyword("from")&&this.throwError(r.Messages.UnexpectedToken,this.lookahead.value),i=this.match("{")?this.parseObjectInitializer():this.match("[")?this.parseArrayInitializer():this.parseAssignmentExpression(),this.consumeSemicolon(),t=this.finalize(e,new o.ExportDefaultDeclaration(i)));else if(this.match("*")){if(this.nextToken(),!this.matchContextualKeyword("from")){var n=this.lookahead.value?r.Messages.UnexpectedToken:r.Messages.MissingFromClause;this.throwError(n,this.lookahead.value)}this.nextToken();var s=this.parseModuleSpecifier();this.consumeSemicolon(),t=this.finalize(e,new o.ExportAllDeclaration(s))}else if(4===this.lookahead.type){switch(i=void 0,this.lookahead.value){case"let":case"const":i=this.parseLexicalDeclaration({inFor:!1});break;case"var":case"class":case"function":i=this.parseStatementListItem();break;default:this.throwUnexpectedToken(this.lookahead)}t=this.finalize(e,new o.ExportNamedDeclaration(i,[],null))}else if(this.matchAsyncFunction())i=this.parseFunctionDeclaration(),t=this.finalize(e,new o.ExportNamedDeclaration(i,[],null));else{var a=[],h=null,l=!1;for(this.expect("{");!this.match("}");)l=l||this.matchKeyword("default"),a.push(this.parseExportSpecifier()),this.match("}")||this.expect(",");this.expect("}"),this.matchContextualKeyword("from")?(this.nextToken(),h=this.parseModuleSpecifier(),this.consumeSemicolon()):l?(n=this.lookahead.value?r.Messages.UnexpectedToken:r.Messages.MissingFromClause,this.throwError(n,this.lookahead.value)):this.consumeSemicolon(),t=this.finalize(e,new o.ExportNamedDeclaration(null,a,h))}return t},t}();e.Parser=u},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.assert=function(t,e){if(!t)throw new Error("ASSERT: "+e)}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(){this.errors=[],this.tolerant=!1}return t.prototype.recordError=function(t){this.errors.push(t)},t.prototype.tolerate=function(t){if(!this.tolerant)throw t;this.recordError(t)},t.prototype.constructError=function(t,e){var i=new Error(t);try{throw i}catch(t){Object.create&&Object.defineProperty&&(i=Object.create(t),Object.defineProperty(i,"column",{value:e}))}return i},t.prototype.createError=function(t,e,i,n){var s="Line "+e+": "+n,r=this.constructError(s,i);return r.index=t,r.lineNumber=e,r.description=n,r},t.prototype.throwError=function(t,e,i,n){throw this.createError(t,e,i,n)},t.prototype.tolerateError=function(t,e,i,n){var s=this.createError(t,e,i,n);if(!this.tolerant)throw s;this.recordError(s)},t}();e.ErrorHandler=i},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Messages={BadGetterArity:"Getter must not have any formal parameters",BadSetterArity:"Setter must have exactly one formal parameter",BadSetterRestParameter:"Setter function argument must not be a rest parameter",ConstructorIsAsync:"Class constructor may not be an async method",ConstructorSpecialMethod:"Class constructor may not be an accessor",DeclarationMissingInitializer:"Missing initializer in %0 declaration",DefaultRestParameter:"Unexpected token =",DuplicateBinding:"Duplicate binding %0",DuplicateConstructor:"A class may only have one constructor",DuplicateProtoProperty:"Duplicate __proto__ fields are not allowed in object literals",ForInOfLoopInitializer:"%0 loop variable declaration may not have an initializer",GeneratorInLegacyContext:"Generator declarations are not allowed in legacy contexts",IllegalBreak:"Illegal break statement",IllegalContinue:"Illegal continue statement",IllegalExportDeclaration:"Unexpected token",IllegalImportDeclaration:"Unexpected token",IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list",IllegalReturn:"Illegal return statement",InvalidEscapedReservedWord:"Keyword must not contain escaped characters",InvalidHexEscapeSequence:"Invalid hexadecimal escape sequence",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",InvalidLHSInForLoop:"Invalid left-hand side in for-loop",InvalidModuleSpecifier:"Unexpected token",InvalidRegExp:"Invalid regular expression",LetInLexicalBinding:"let is disallowed as a lexically bound name",MissingFromClause:"Unexpected token",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NewlineAfterThrow:"Illegal newline after throw",NoAsAfterImportNamespace:"Unexpected token",NoCatchOrFinally:"Missing catch or finally after try",ParameterAfterRestParameter:"Rest parameter must be last formal parameter",Redeclaration:"%0 '%1' has already been declared",StaticPrototype:"Classes may not have static property named prototype",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictModeWith:"Strict mode code may not include a with statement",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictReservedWord:"Use of future reserved word in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",TemplateOctalLiteral:"Octal literals are not allowed in template strings.",UnexpectedEOS:"Unexpected end of input",UnexpectedIdentifier:"Unexpected identifier",UnexpectedNumber:"Unexpected number",UnexpectedReserved:"Unexpected reserved word",UnexpectedString:"Unexpected string",UnexpectedTemplate:"Unexpected quasi %0",UnexpectedToken:"Unexpected token %0",UnexpectedTokenIllegal:"Unexpected token ILLEGAL",UnknownLabel:"Undefined label '%0'",UnterminatedRegExp:"Invalid regular expression: missing /"}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(9),s=i(4),r=i(11);function o(t){return"0123456789abcdef".indexOf(t.toLowerCase())}function a(t){return"01234567".indexOf(t)}var h=function(){function t(t,e){this.source=t,this.errorHandler=e,this.trackComment=!1,this.isModule=!1,this.length=t.length,this.index=0,this.lineNumber=t.length>0?1:0,this.lineStart=0,this.curlyStack=[]}return t.prototype.saveState=function(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart}},t.prototype.restoreState=function(t){this.index=t.index,this.lineNumber=t.lineNumber,this.lineStart=t.lineStart},t.prototype.eof=function(){return this.index>=this.length},t.prototype.throwUnexpectedToken=function(t){return void 0===t&&(t=r.Messages.UnexpectedTokenIllegal),this.errorHandler.throwError(this.index,this.lineNumber,this.index-this.lineStart+1,t)},t.prototype.tolerateUnexpectedToken=function(t){void 0===t&&(t=r.Messages.UnexpectedTokenIllegal),this.errorHandler.tolerateError(this.index,this.lineNumber,this.index-this.lineStart+1,t)},t.prototype.skipSingleLineComment=function(t){var e,i,n=[];for(this.trackComment&&(n=[],e=this.index-t,i={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{}});!this.eof();){var r=this.source.charCodeAt(this.index);if(++this.index,s.Character.isLineTerminator(r)){if(this.trackComment){i.end={line:this.lineNumber,column:this.index-this.lineStart-1};var o={multiLine:!1,slice:[e+t,this.index-1],range:[e,this.index-1],loc:i};n.push(o)}return 13===r&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,n}}return this.trackComment&&(i.end={line:this.lineNumber,column:this.index-this.lineStart},o={multiLine:!1,slice:[e+t,this.index],range:[e,this.index],loc:i},n.push(o)),n},t.prototype.skipMultiLineComment=function(){var t,e,i=[];for(this.trackComment&&(i=[],t=this.index-2,e={start:{line:this.lineNumber,column:this.index-this.lineStart-2},end:{}});!this.eof();){var n=this.source.charCodeAt(this.index);if(s.Character.isLineTerminator(n))13===n&&10===this.source.charCodeAt(this.index+1)&&++this.index,++this.lineNumber,++this.index,this.lineStart=this.index;else if(42===n){if(47===this.source.charCodeAt(this.index+1)){if(this.index+=2,this.trackComment){e.end={line:this.lineNumber,column:this.index-this.lineStart};var r={multiLine:!0,slice:[t+2,this.index-2],range:[t,this.index],loc:e};i.push(r)}return i}++this.index}else++this.index}return this.trackComment&&(e.end={line:this.lineNumber,column:this.index-this.lineStart},r={multiLine:!0,slice:[t+2,this.index],range:[t,this.index],loc:e},i.push(r)),this.tolerateUnexpectedToken(),i},t.prototype.scanComments=function(){var t;this.trackComment&&(t=[]);for(var e=0===this.index;!this.eof();){var i=this.source.charCodeAt(this.index);if(s.Character.isWhiteSpace(i))++this.index;else if(s.Character.isLineTerminator(i))++this.index,13===i&&10===this.source.charCodeAt(this.index)&&++this.index,++this.lineNumber,this.lineStart=this.index,e=!0;else if(47===i)if(47===(i=this.source.charCodeAt(this.index+1))){this.index+=2;var n=this.skipSingleLineComment(2);this.trackComment&&(t=t.concat(n)),e=!0}else{if(42!==i)break;this.index+=2,n=this.skipMultiLineComment(),this.trackComment&&(t=t.concat(n))}else if(e&&45===i){if(45!==this.source.charCodeAt(this.index+1)||62!==this.source.charCodeAt(this.index+2))break;this.index+=3,n=this.skipSingleLineComment(3),this.trackComment&&(t=t.concat(n))}else{if(60!==i||this.isModule)break;if("!--"!==this.source.slice(this.index+1,this.index+4))break;this.index+=4,n=this.skipSingleLineComment(4),this.trackComment&&(t=t.concat(n))}}return t},t.prototype.isFutureReservedWord=function(t){switch(t){case"enum":case"export":case"import":case"super":return!0;default:return!1}},t.prototype.isStrictModeReservedWord=function(t){switch(t){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0;default:return!1}},t.prototype.isRestrictedWord=function(t){return"eval"===t||"arguments"===t},t.prototype.isKeyword=function(t){switch(t.length){case 2:return"if"===t||"in"===t||"do"===t;case 3:return"var"===t||"for"===t||"new"===t||"try"===t||"let"===t;case 4:return"this"===t||"else"===t||"case"===t||"void"===t||"with"===t||"enum"===t;case 5:return"while"===t||"break"===t||"catch"===t||"throw"===t||"const"===t||"yield"===t||"class"===t||"super"===t;case 6:return"return"===t||"typeof"===t||"delete"===t||"switch"===t||"export"===t||"import"===t;case 7:return"default"===t||"finally"===t||"extends"===t;case 8:return"function"===t||"continue"===t||"debugger"===t;case 10:return"instanceof"===t;default:return!1}},t.prototype.codePointAt=function(t){var e=this.source.charCodeAt(t);if(e>=55296&&e<=56319){var i=this.source.charCodeAt(t+1);i>=56320&&i<=57343&&(e=1024*(e-55296)+i-56320+65536)}return e},t.prototype.scanHexEscape=function(t){for(var e="u"===t?4:2,i=0,n=0;n1114111||"}"!==t)&&this.throwUnexpectedToken(),s.Character.fromCodePoint(e)},t.prototype.getIdentifier=function(){for(var t=this.index++;!this.eof();){var e=this.source.charCodeAt(this.index);if(92===e)return this.index=t,this.getComplexIdentifier();if(e>=55296&&e<57343)return this.index=t,this.getComplexIdentifier();if(!s.Character.isIdentifierPart(e))break;++this.index}return this.source.slice(t,this.index)},t.prototype.getComplexIdentifier=function(){var t,e=this.codePointAt(this.index),i=s.Character.fromCodePoint(e);for(this.index+=i.length,92===e&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):null!==(t=this.scanHexEscape("u"))&&"\\"!==t&&s.Character.isIdentifierStart(t.charCodeAt(0))||this.throwUnexpectedToken(),i=t);!this.eof()&&(e=this.codePointAt(this.index),s.Character.isIdentifierPart(e));)i+=t=s.Character.fromCodePoint(e),this.index+=t.length,92===e&&(i=i.substr(0,i.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),++this.index,"{"===this.source[this.index]?(++this.index,t=this.scanUnicodeCodePointEscape()):null!==(t=this.scanHexEscape("u"))&&"\\"!==t&&s.Character.isIdentifierPart(t.charCodeAt(0))||this.throwUnexpectedToken(),i+=t);return i},t.prototype.octalToDecimal=function(t){var e="0"!==t,i=a(t);return!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(e=!0,i=8*i+a(this.source[this.index++]),"0123".indexOf(t)>=0&&!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index))&&(i=8*i+a(this.source[this.index++]))),{code:i,octal:e}},t.prototype.scanIdentifier=function(){var t,e=this.index,i=92===this.source.charCodeAt(e)?this.getComplexIdentifier():this.getIdentifier();if(3!=(t=1===i.length?3:this.isKeyword(i)?4:"null"===i?5:"true"===i||"false"===i?1:3)&&e+i.length!==this.index){var n=this.index;this.index=e,this.tolerateUnexpectedToken(r.Messages.InvalidEscapedReservedWord),this.index=n}return{type:t,value:i,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.scanPunctuator=function(){var t=this.index,e=this.source[this.index];switch(e){case"(":case"{":"{"===e&&this.curlyStack.push("{"),++this.index;break;case".":++this.index,"."===this.source[this.index]&&"."===this.source[this.index+1]&&(this.index+=2,e="...");break;case"}":++this.index,this.curlyStack.pop();break;case")":case";":case",":case"[":case"]":case":":case"?":case"~":++this.index;break;default:">>>="===(e=this.source.substr(this.index,4))?this.index+=4:"==="===(e=e.substr(0,3))||"!=="===e||">>>"===e||"<<="===e||">>="===e||"**="===e?this.index+=3:"&&"===(e=e.substr(0,2))||"||"===e||"=="===e||"!="===e||"+="===e||"-="===e||"*="===e||"/="===e||"++"===e||"--"===e||"<<"===e||">>"===e||"&="===e||"|="===e||"^="===e||"%="===e||"<="===e||">="===e||"=>"===e||"**"===e?this.index+=2:(e=this.source[this.index],"<>=!+-*%&|^/".indexOf(e)>=0&&++this.index)}return this.index===t&&this.throwUnexpectedToken(),{type:7,value:e,lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},t.prototype.scanHexLiteral=function(t){for(var e="";!this.eof()&&s.Character.isHexDigit(this.source.charCodeAt(this.index));)e+=this.source[this.index++];return 0===e.length&&this.throwUnexpectedToken(),s.Character.isIdentifierStart(this.source.charCodeAt(this.index))&&this.throwUnexpectedToken(),{type:6,value:parseInt("0x"+e,16),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},t.prototype.scanBinaryLiteral=function(t){for(var e,i="";!this.eof()&&("0"===(e=this.source[this.index])||"1"===e);)i+=this.source[this.index++];return 0===i.length&&this.throwUnexpectedToken(),this.eof()||(e=this.source.charCodeAt(this.index),(s.Character.isIdentifierStart(e)||s.Character.isDecimalDigit(e))&&this.throwUnexpectedToken()),{type:6,value:parseInt(i,2),lineNumber:this.lineNumber,lineStart:this.lineStart,start:t,end:this.index}},t.prototype.scanOctalLiteral=function(t,e){var i="",n=!1;for(s.Character.isOctalDigit(t.charCodeAt(0))?(n=!0,i="0"+this.source[this.index++]):++this.index;!this.eof()&&s.Character.isOctalDigit(this.source.charCodeAt(this.index));)i+=this.source[this.index++];return n||0!==i.length||this.throwUnexpectedToken(),(s.Character.isIdentifierStart(this.source.charCodeAt(this.index))||s.Character.isDecimalDigit(this.source.charCodeAt(this.index)))&&this.throwUnexpectedToken(),{type:6,value:parseInt(i,8),octal:n,lineNumber:this.lineNumber,lineStart:this.lineStart,start:e,end:this.index}},t.prototype.isImplicitOctalLiteral=function(){for(var t=this.index+1;t=0&&(i=i.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g,(function(t,e,i){var s=parseInt(e||i,16);return s>1114111&&n.throwUnexpectedToken(r.Messages.InvalidRegExp),s<=65535?String.fromCharCode(s):"￿"})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"￿"));try{RegExp(i)}catch(t){this.throwUnexpectedToken(r.Messages.InvalidRegExp)}try{return new RegExp(t,e)}catch(t){return null}},t.prototype.scanRegExpBody=function(){var t=this.source[this.index];n.assert("/"===t,"Regular expression literal must start with a slash");for(var e=this.source[this.index++],i=!1,o=!1;!this.eof();)if(e+=t=this.source[this.index++],"\\"===t)t=this.source[this.index++],s.Character.isLineTerminator(t.charCodeAt(0))&&this.throwUnexpectedToken(r.Messages.UnterminatedRegExp),e+=t;else if(s.Character.isLineTerminator(t.charCodeAt(0)))this.throwUnexpectedToken(r.Messages.UnterminatedRegExp);else if(i)"]"===t&&(i=!1);else{if("/"===t){o=!0;break}"["===t&&(i=!0)}return o||this.throwUnexpectedToken(r.Messages.UnterminatedRegExp),e.substr(1,e.length-2)},t.prototype.scanRegExpFlags=function(){for(var t="";!this.eof();){var e=this.source[this.index];if(!s.Character.isIdentifierPart(e.charCodeAt(0)))break;if(++this.index,"\\"!==e||this.eof())t+=e;else if("u"===(e=this.source[this.index])){++this.index;var i=this.index,n=this.scanHexEscape("u");if(null!==n)for(t+=n;i=55296&&t<57343&&s.Character.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()},t}();e.Scanner=h},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenName={},e.TokenName[1]="Boolean",e.TokenName[2]="",e.TokenName[3]="Identifier",e.TokenName[4]="Keyword",e.TokenName[5]="Null",e.TokenName[6]="Numeric",e.TokenName[7]="Punctuator",e.TokenName[8]="String",e.TokenName[9]="RegularExpression",e.TokenName[10]="Template"},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.XHTMLEntities={quot:'"',amp:"&",apos:"'",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",lang:"⟨",rang:"⟩"}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),s=i(12),r=i(13),o=function(){function t(){this.values=[],this.curly=this.paren=-1}return t.prototype.beforeFunctionExpression=function(t){return["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","**=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","**","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="].indexOf(t)>=0},t.prototype.isRegexStart=function(){var t=this.values[this.values.length-1],e=null!==t;switch(t){case"this":case"]":e=!1;break;case")":var i=this.values[this.paren-1];e="if"===i||"while"===i||"for"===i||"with"===i;break;case"}":if(e=!1,"function"===this.values[this.curly-3])e=!!(n=this.values[this.curly-4])&&!this.beforeFunctionExpression(n);else if("function"===this.values[this.curly-4]){var n;e=!(n=this.values[this.curly-5])||!this.beforeFunctionExpression(n)}}return e},t.prototype.push=function(t){7===t.type||4===t.type?("{"===t.value?this.curly=this.values.length:"("===t.value&&(this.paren=this.values.length),this.values.push(t.value)):this.values.push(null)},t}(),a=function(){function t(t,e){this.errorHandler=new n.ErrorHandler,this.errorHandler.tolerant=!!e&&"boolean"==typeof e.tolerant&&e.tolerant,this.scanner=new s.Scanner(t,this.errorHandler),this.scanner.trackComment=!!e&&"boolean"==typeof e.comment&&e.comment,this.trackRange=!!e&&"boolean"==typeof e.range&&e.range,this.trackLoc=!!e&&"boolean"==typeof e.loc&&e.loc,this.buffer=[],this.reader=new o}return t.prototype.errors=function(){return this.errorHandler.errors},t.prototype.getNextToken=function(){if(0===this.buffer.length){var t=this.scanner.scanComments();if(this.scanner.trackComment)for(var e=0;e0?t.charCodeAt(r-1):null,p=p&&y(o,a)}else{for(r=0;rn&&" "!==t[d+1],d=r);else if(!m(o))return 5;a=r>0?t.charCodeAt(r-1):null,p=p&&y(o,a)}u=u||c&&r-d-1>n&&" "!==t[d+1]}return l||u?i>9&&v(t)?5:u?4:3:p&&!s(t)?1:2}function b(t,e,i,n){t.dump=function(){if(0===e.length)return"''";if(!t.noCompatMode&&-1!==u.indexOf(e))return"'"+e+"'";var r=t.indent*Math.max(1,i),o=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-r),a=n||t.flowLevel>-1&&i>=t.flowLevel;switch(x(e,a,t.indent,o,(function(e){return function(t,e){var i,n;for(i=0,n=t.implicitTypes.length;i"+w(e,t.indent)+_(p(function(t,e){var i,n,s=/(\n+)([^\n]*)/g,r=(a=t.indexOf("\n"),a=-1!==a?a:t.length,s.lastIndex=a,C(t.slice(0,a),e)),o="\n"===t[0]||" "===t[0];var a;for(;n=s.exec(t);){var h=n[1],l=n[2];i=" "===l[0],r+=h+(o||i||""===l?"":"\n")+C(l,e),o=i}return r}(e,o),r));case 5:return'"'+function(t){for(var e,i,n,s="",r=0;r=55296&&e<=56319&&(i=t.charCodeAt(r+1))>=56320&&i<=57343?(s+=c(1024*(e-55296)+i-56320+65536),r++):(n=l[e],s+=!n&&m(e)?t[r]:n||c(e));return s}(e)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function w(t,e){var i=v(t)?String(e):"",n="\n"===t[t.length-1];return i+(n&&("\n"===t[t.length-2]||"\n"===t)?"+":n?"":"-")+"\n"}function _(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function C(t,e){if(""===t||" "===t[0])return t;for(var i,n,s=/ [^ ]/g,r=0,o=0,a=0,h="";i=s.exec(t);)(a=i.index)-r>e&&(n=o>r?o:a,h+="\n"+t.slice(r,n),r=n+1),o=a;return h+="\n",t.length-r>e&&o>r?h+=t.slice(r,o)+"\n"+t.slice(o+1):h+=t.slice(r),h.slice(1)}function S(t,e,i){var n,r,o,l,u,c;for(o=0,l=(r=i?t.explicitTypes:t.implicitTypes).length;o tag resolver accepts not "'+c+'" style');n=u.represent[c](e,c)}t.dump=n}return!0}return!1}function T(t,e,i,n,r,o){t.tag=null,t.dump=i,S(t,i,!1)||S(t,i,!0);var h=a.call(t.dump);n&&(n=t.flowLevel<0||t.flowLevel>e);var l,u,c="[object Object]"===h||"[object Array]"===h;if(c&&(u=-1!==(l=t.duplicates.indexOf(i))),(null!==t.tag&&"?"!==t.tag||u||2!==t.indent&&e>0)&&(r=!1),u&&t.usedDuplicates[l])t.dump="*ref_"+l;else{if(c&&u&&!t.usedDuplicates[l]&&(t.usedDuplicates[l]=!0),"[object Object]"===h)n&&0!==Object.keys(t.dump).length?(!function(t,e,i,n){var r,o,a,h,l,u,c="",d=t.tag,p=Object.keys(i);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new s("sortKeys must be a boolean or a function");for(r=0,o=p.length;r1024)&&(t.dump&&10===t.dump.charCodeAt(0)?u+="?":u+="? "),u+=t.dump,l&&(u+=f(t,e)),T(t,e+1,h,!0,l)&&(t.dump&&10===t.dump.charCodeAt(0)?u+=":":u+=": ",c+=u+=t.dump));t.tag=d,t.dump=c||"{}"}(t,e,t.dump,r),u&&(t.dump="&ref_"+l+t.dump)):(!function(t,e,i){var n,s,r,o,a,h="",l=t.tag,u=Object.keys(i);for(n=0,s=u.length;n1024&&(a+="? "),a+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),T(t,e,o,!1,!1)&&(h+=a+=t.dump));t.tag=l,t.dump="{"+h+"}"}(t,e,t.dump),u&&(t.dump="&ref_"+l+" "+t.dump));else if("[object Array]"===h){var d=t.noArrayIndent&&e>0?e-1:e;n&&0!==t.dump.length?(!function(t,e,i,n){var s,r,o="",a=t.tag;for(s=0,r=i.length;s "+t.dump)}return!0}function A(t,e){var i,n,s=[],r=[];for(function t(e,i,n){var s,r,o;if(null!==e&&"object"==typeof e)if(-1!==(r=i.indexOf(e)))-1===n.indexOf(r)&&n.push(r);else if(i.push(e),Array.isArray(e))for(r=0,o=e.length;r2?s.keyParams[2]:null,s.game.managers.story.reservedWords.includes(s.look)&&(console.log("look is reserved word"),s.look=null),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({actor:this.actor,message:e})}t=this.game.managers.text.characterSays(this.actor,this.look,this.body,this.boxId,this.dontHide),this.resolve(t)},e}(r(i(23)).default);e.default=o},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.execute=function(){"click"===this.body?this.game.waitForClick():this.game.waitTimeout(parseInt(this.body,10))},e}(r(i(1)).default);e.default=o},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e0){var r=s.game.managers.story.currentScene[0];r&&"else"in r&&(s.branches.ISFALSE=r.else,s.game.managers.story.currentScene.shift())}return s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.branch(this.condition,this.branches),this.resolve()},e}(r(i(1)).default);e.default=o},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){var t=this.game.pluginsRJS[this.actor];this.properties.body=this.body,t.onCall(this.properties)},e}(r(i(1)).default);e.default=o},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.execute=function(){this.game.endGame()},e}(r(i(1)).default);e.default=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.clearFunctions=[],this.current=[],this.game=t,this.audioManager=t.managers.audio}return t.prototype.start=function(t){this.current.push(t),this[t]?this[t]():this.game.pluginsRJS[t]&&this.game.pluginsRJS[t].onCall()},t.prototype.set=function(t){if(t)for(var e=0,i=t;e0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]=0;i--)this.game.load.text("story"+i,h.preparePath(this.game.config.storyText[i],this.game))},e.prototype.create=function(t){var e=this;new p.default(this.game).setLoadingBar(this.game),this.input.onDown.addOnce((function(){"suspended"===e.sound.context.state&&e.sound.context.resume()})),this.game.tools.jsyaml=a.default,this.game.setup=a.default.load(this.game.cache.getText("storySetup")),t.setup||(this.game.setup={}),this.game.storyConfig=a.default.load(this.game.cache.getText("storyConfig")),this.game.storyAccessibility=a.default.load(this.game.cache.getText("storyAccessibility"));var i={};this.game.config.storyText.forEach((function(t,n){var s=a.default.load(e.game.cache.getText("story"+n));Object.assign(i,r({},s))})),this.game.story=i,this.game.guiSetup=a.default.load(this.game.cache.getText("guiConfig")),"2.0"===t.guiSetup.GUIVersion||"2.0"===t.guiSetup.madeWithRenJSBuilder?t.gui=new d.default(t):t.guiSetup.madeWithRenJSBuilder?t.gui=new c.default(t):(console.error("Old GUI configuration is deprecated!!!!"),console.error("Check the docs at http://renjs.net/docs-page.html")),t.state.add("preloadStory",u.default),t.state.start("preloadStory")},e}(l.default);e.default=f},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]parseInt(t[1],10)}else h=!1;return h}()){var f=new Promise((function(t,e){!function i(){(new Date).getTime()-d>=u?e(Error(u+"ms timeout exceeded")):document.fonts.load(p(s,'"'+s.family+'"'),o).then((function(e){1<=e.length?t():setTimeout(i,25)}),e)}()})),g=new Promise((function(t,e){l=setTimeout((function(){e(Error(u+"ms timeout exceeded"))}),u)}));Promise.race([g,f]).then((function(){clearTimeout(l),t(s)}),e)}else!function(t){document.body?t():document.addEventListener?document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e),t()})):document.attachEvent("onreadystatechange",(function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),t())}))}((function(){function h(){var e;(e=-1!=m&&-1!=y||-1!=m&&-1!=v||-1!=y&&-1!=v)&&((e=m!=y&&m!=v&&y!=v)||(null===a&&(e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),a=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))),e=a&&(m==x&&y==x&&v==x||m==b&&y==b&&v==b||m==w&&y==w&&v==w)),e=!e),e&&(_.parentNode&&_.parentNode.removeChild(_),clearTimeout(l),t(s))}var c=new i(o),f=new i(o),g=new i(o),m=-1,y=-1,v=-1,x=-1,b=-1,w=-1,_=document.createElement("div");_.dir="ltr",n(c,p(s,"sans-serif")),n(f,p(s,"serif")),n(g,p(s,"monospace")),_.appendChild(c.a),_.appendChild(f.a),_.appendChild(g.a),document.body.appendChild(_),x=c.a.offsetWidth,b=f.a.offsetWidth,w=g.a.offsetWidth,function t(){if((new Date).getTime()-d>=u)_.parentNode&&_.parentNode.removeChild(_),e(Error(u+"ms timeout exceeded"));else{var i=document.hidden;!0!==i&&void 0!==i||(m=c.a.offsetWidth,y=f.a.offsetWidth,v=g.a.offsetWidth,h()),l=setTimeout(t,50)}}(),r(c,(function(t){m=t,h()})),n(c,p(s,'"'+s.family+'",sans-serif')),r(f,(function(t){y=t,h()})),n(f,p(s,'"'+s.family+'",serif')),r(g,(function(t){v=t,h()})),n(g,p(s,'"'+s.family+'",monospace'))}))}))},t.exports=o}()},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(i(24)),a=r(i(14)),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.initAssets=function(e){t.prototype.initAssets.call(this,e),this.config.menus={};for(var i=["main","settings","hud","saveload"],n=0,s=i;n GUIVersion=='2.0'");var F=a.default.dump(JSON.parse(JSON.stringify(this.config)));console.log(F)}},e.prototype.convertText=function(t){return{x:t.isTextCentered?0:parseInt(t["offset-x"],10),y:t.isTextCentered?0:parseInt(t["offset-y"],10),lineSpacing:t.lineSpacing,style:this.convertTextStyle(t)}},e.prototype.convertTextStyle=function(t){var e={font:t.font,fontSize:t.size+"px",fill:t.color};return t.align&&(e.align=t.align),t["text-width"]&&(e.wordWrap=!0,e.wordWrapWidth=t["text-width"]),t.isTextCentered?(e.boundsAlignH="center",e.boundsAlignV="middle"):t["text-width"]||(e.boundsAlignH=t.align?t.align:"left",e.boundsAlignV="top"),e},e}(o.default);e.default=h},function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?f--:(r.text.text+=d[p],r.onCharacter&&r.onCharacter(d,p),e&&(" "===d[p]||"\n"===d[p]||r.punctuationMarks.includes(d[p])||m===g?m=-1:0===m&&(e.play(),e.volume=r.game.userPreferences.get("sfxv")),m++),r.punctuationMarks.includes(d[p])&&(f=r.punctuationWait),++p>=d.length&&i())}),s),[2]}}))}))}))},e.prototype.hide=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.game.accessibility.text(),this.visible?(t||(t=this.config.transition),[4,this.game.screenEffects.transition.get(t)(this,null)]):[2];case 1:return e.sent(),this.visible=!1,[2]}}))}))},e.prototype.clear=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.config.alwaysOn?[3,2]:[4,this.hide(t)];case 1:e.sent(),e.label=2;case 2:return this.text.setText("",!0),this.ctc&&(this.ctc.visible=!1),this.portrait&&(this.portrait.destroy(),this.portrait=null),[2]}}))}))},e}(h.Sprite);e.default=c},function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?Math.acos(i/u):-Math.acos(i/u),this.worldScale.x=u,this.worldScale.y=c/u}else if(s||r){var d=Math.sqrt(s*s+r*r);this.worldRotation=Phaser.Math.HALF_PI-(r>0?Math.acos(-s/d):-Math.acos(s/d)),this.worldScale.x=c/d,this.worldScale.y=d}else this.worldScale.x=0,this.worldScale.y=0;return this.worldAlpha=this.alpha*e.worldAlpha,this.worldPosition.x=l.tx,this.worldPosition.y=l.ty,this._currentBounds=null,this.transformCallback&&this.transformCallback.call(this.transformCallbackContext,l,h),this},preUpdate:function(){},generateTexture:function(t,e,n){var s=this.getLocalBounds(),r=new Phaser.RenderTexture(this.game,0|s.width,0|s.height,n,e,t);return i.DisplayObject._tempMatrix.tx=-s.x,i.DisplayObject._tempMatrix.ty=-s.y,r.render(this,i.DisplayObject._tempMatrix),r},updateCache:function(){return this._generateCachedSprite(),this},toGlobal:function(t){return this.updateTransform(),this.worldTransform.apply(t)},toLocal:function(t,e){return e&&(t=e.toGlobal(t)),this.updateTransform(),this.worldTransform.applyInverse(t)},_renderCachedSprite:function(t){this._cachedSprite.worldAlpha=this.worldAlpha,t.gl?i.Sprite.prototype._renderWebGL.call(this._cachedSprite,t):i.Sprite.prototype._renderCanvas.call(this._cachedSprite,t)},_generateCachedSprite:function(){this._cacheAsBitmap=!1;var t=this.getLocalBounds();if(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),this.updateTransform(),this._cachedSprite)this._cachedSprite.texture.resize(t.width,t.height);else{var e=0;this.texture&&this.texture.baseTexture&&i._enableMultiTextureToggle&&(e=this.texture.baseTexture.textureIndex);var n=new Phaser.RenderTexture(this.game,t.width,t.height,void 0,void 0,void 0,void 0,e);this._cachedSprite=new i.Sprite(n),this._cachedSprite.worldTransform=this.worldTransform}var s=this._filters;this._filters=null,this._cachedSprite.filters=s,i.DisplayObject._tempMatrix.tx=-t.x,i.DisplayObject._tempMatrix.ty=-t.y,this._cachedSprite.texture.render(this,i.DisplayObject._tempMatrix,!0),this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._filters=s,this._cacheAsBitmap=!0},_destroyCachedSprite:function(){this._cachedSprite&&(this._cachedSprite.texture.destroy(!0),this._cachedSprite=null)},_destroyTintedTexture:function(){this.tintedTexture&&(Phaser.CanvasPool.removeByCanvas(this.tintedTexture),this.tintedTexture=null)}},i.DisplayObject.prototype.displayObjectUpdateTransform=i.DisplayObject.prototype.updateTransform,Object.defineProperties(i.DisplayObject.prototype,{x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},worldVisible:{get:function(){if(this.visible){var t=this.parent;if(!t)return this.visible;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}return!1}},mask:{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,t&&(this._mask.isMask=!0)}},filters:{get:function(){return this._filters},set:function(t){if(Array.isArray(t)){for(var e=[],n=0;n=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},i.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);if(i<0||n<0)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[n]=t}},i.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},i.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},i.DisplayObjectContainer.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},i.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);if(-1!==e)return this.removeChildAt(e)},i.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(e.parent=void 0,this.children.splice(t,1)),e},i.DisplayObjectContainer.prototype.bringChildToTop=function(t){if(t.parent===this)return this.setChildIndex(t,this.children.length-1)},i.DisplayObjectContainer.prototype.sendChildToBack=function(t){if(t.parent===this)return this.setChildIndex(t,0)},i.DisplayObjectContainer.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i=e-t;if(i>0&&i<=e){for(var n=this.children.splice(t,i),s=0;s(a=o.width+o.x)?u:a,d=d>(h=o.height+o.y)?d:h)}var f=this._bounds;if(!p){var g=(f=new i.Rectangle).x,m=f.width+f.x,y=f.y,v=f.height+f.y,b=this.worldTransform,x=b.a,w=b.b,_=b.c,T=b.d,C=b.tx,S=b.ty,P=x*m+_*v+C,A=T*v+w*m+S,E=x*g+_*v+C,M=T*v+w*g+S,k=x*g+_*y+C,L=T*y+w*g+S,O=x*m+_*y+C,I=T*y+w*m+S;l=O<(l=k<(l=E<(l=P)?E:l)?k:l)?O:l,c=I<(c=L<(c=M<(c=A)?M:c)?L:c)?I:c,u=O>(u=k>(u=E>(u=P)?E:u)?k:u)?O:u,d=I>(d=L>(d=M>(d=A)?M:d)?L:d)?I:d}if(f.x=l,f.y=c,f.width=u-l,f.height=d-c,n)for(t.worldTransform=r,e=0;e(f=T>(f=w>(f=b>f?b:f)?w:f)?T:f)?S:f,g=P>(g=C>(g=_>(g=x>g?x:g)?_:g)?C:g)?P:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=y,A.height=g-y,this._currentBounds=A,A},i.Sprite.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=Phaser.identityMatrix;for(var e=0;e= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) { gl_FragColor = RED;return;}","}"];var s=i.compileProgram(t,this.vertexSrc||i.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(s),this.uSamplerArray=t.getUniformLocation(s,"uSamplerArray[0]"),this.projectionVector=t.getUniformLocation(s,"projectionVector"),this.offsetVector=t.getUniformLocation(s,"offsetVector"),this.dimensions=t.getUniformLocation(s,"dimensions"),this.aVertexPosition=t.getAttribLocation(s,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(s,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(s,"aColor"),this.aTextureIndex=t.getAttribLocation(s,"aTextureIndex");var r=[],o=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var a=0;a 0.0) gl_Position = vec4(0.0);"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);"," vTextureIndex = aTextureIndex;","}"],i.PixiFastShader=function(t){if(this._UID=Phaser._UID++,this.gl=t,this.program=null,i._enableMultiTextureToggle){t=this.gl;this.MAX_TEXTURES=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);for(var e="\tif (vTextureIndex == 0.0) { gl_FragColor = texture2D(uSamplerArray[0], vTextureCoord) * vColor;return;}\n",n=1;n= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["// PixiFastShader Fragment Shader.","precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;","}"];this.vertexSrc=["// PixiFastShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","attribute float aTextureIndex;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;"," vColor = aColor;","}"],this.textureCount=0,this.init()},i.PixiFastShader.prototype.constructor=i.PixiFastShader,i.PixiFastShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["//StripShader Fragment Shader.","precision mediump float;","varying vec2 vTextureCoord;","varying float vTextureIndex;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);","}"];this.vertexSrc=["//StripShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aTextureIndex;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying float vTextureIndex;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;","}"],this.init()},i.StripShader.prototype.constructor=i.StripShader,i.StripShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},n=this.gl,s=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),r=n.getParameter(n.MAX_TEXTURE_SIZE),o=this.game.cache._cache.image,a=null,h=0;h=this.size&&(this.flush(),this.currentBaseTexture=n.baseTexture);var a=n._uvs;if(a){var h,l,c,u,d=t.anchor.x,p=t.anchor.y;if(n.trim){var f=n.trim;h=(l=f.x-d*f.width)+n.crop.width,c=(u=f.y-p*f.height)+n.crop.height}else h=n.frame.width*(1-d),l=n.frame.width*-d,c=n.frame.height*(1-p),u=n.frame.height*-p;var g=this.currentBatchSize*this.vertexSize,m=n.baseTexture.resolution,y=n.baseTexture.textureIndex,v=o.a/m,b=o.b/m,x=o.c/m,w=o.d/m,_=o.tx,T=o.ty,C=n.crop.height;if(n.rotated){var S=o.a,P=o.b,A=o.c,E=o.d,M=l,k=h;_=o.c*C+_,T=o.d*C+T,v=6123233995736766e-32*S-A,b=6123233995736766e-32*P-E,x=S+6123233995736766e-32*A,w=P+6123233995736766e-32*E,n._updateUvsInverted(),h=c,l=u,c=k,u=M}var L=this.colors,O=this.positions,I=t.tint,B=(I>>16)+(65280&I)+((255&I)<<16)+(255*t.worldAlpha<<24);this.renderSession.roundPixels?(O[g++]=v*l+x*u+_|0,O[g++]=w*u+b*l+T|0,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_|0,O[g++]=w*u+b*h+T|0,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_|0,O[g++]=w*c+b*h+T|0,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_|0,O[g++]=w*c+b*l+T|0,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y):(O[g++]=v*l+x*u+_,O[g++]=w*u+b*l+T,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_,O[g++]=w*u+b*h+T,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_,O[g++]=w*c+b*h+T,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_,O[g++]=w*c+b*l+T,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y),this.sprites[this.currentBatchSize++]=t}},i.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var e=t.tilingTexture,n=e.baseTexture,s=this.gl,r=t.texture.baseTexture.textureIndex;i.WebGLRenderer.textureArray[r]!=n&&(this.flush(),s.activeTexture(s.TEXTURE0+r),s.bindTexture(s.TEXTURE_2D,n._glTextures[s.id]),i.WebGLRenderer.textureArray[r]=n),this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture),t._uvs||(t._uvs=new i.TextureUvs);var o=t._uvs,a=e.baseTexture.width,h=e.baseTexture.height;t.tilePosition.x%=a*t.tileScaleOffset.x,t.tilePosition.y%=h*t.tileScaleOffset.y;var l=t.tilePosition.x/(a*t.tileScaleOffset.x),c=t.tilePosition.y/(h*t.tileScaleOffset.y),u=t.width/a/(t.tileScale.x*t.tileScaleOffset.x),d=t.height/h/(t.tileScale.y*t.tileScaleOffset.y);o.x0=0-l,o.y0=0-c,o.x1=1*u-l,o.y1=0-c,o.x2=1*u-l,o.y2=1*d-c,o.x3=0-l,o.y3=1*d-c;var p=t.tint,f=(p>>16)+(65280&p)+((255&p)<<16)+(255*t.worldAlpha<<24),g=this.positions,m=this.colors,y=t.width,v=t.height,b=t.anchor.x,x=t.anchor.y,w=y*(1-b),_=y*-b,T=v*(1-x),C=v*-x,S=this.currentBatchSize*this.vertexSize,P=e.baseTexture.resolution,A=t.worldTransform,E=A.a/P,M=A.b/P,k=A.c/P,L=A.d/P,O=A.tx,I=A.ty;g[S++]=E*_+k*C+O,g[S++]=L*C+M*_+I,g[S++]=o.x0,g[S++]=o.y0,m[S++]=f,g[S++]=r,g[S++]=E*w+k*C+O,g[S++]=L*C+M*w+I,g[S++]=o.x1,g[S++]=o.y1,m[S++]=f,g[S++]=r,g[S++]=E*w+k*T+O,g[S++]=L*T+M*w+I,g[S++]=o.x2,g[S++]=o.y2,m[S++]=f,g[S++]=r,g[S++]=E*_+k*T+O,g[S++]=L*T+M*_+I,g[S++]=o.x3,g[S++]=o.y3,m[S++]=f,g[S++]=r,this.sprites[this.currentBatchSize++]=t},i.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e,n,s,r=this.gl;if(this.dirty){this.dirty=!1,t=this.defaultShader.shaders[r.id],r.activeTexture(r.TEXTURE0),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var o=this.vertexSize;r.vertexAttribPointer(t.aVertexPosition,2,r.FLOAT,!1,o,0),r.vertexAttribPointer(t.aTextureCoord,2,r.FLOAT,!1,o,8),r.vertexAttribPointer(t.colorAttribute,4,r.UNSIGNED_BYTE,!0,o,16),r.vertexAttribPointer(t.aTextureIndex,1,r.FLOAT,!1,o,20)}if(this.currentBatchSize>.5*this.size)r.bufferSubData(r.ARRAY_BUFFER,0,this.vertices);else{r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer);var a=this.positions.subarray(0,this.currentBatchSize*this.vertexSize);r.bufferSubData(r.ARRAY_BUFFER,0,a)}for(var h,l=0,c=0,u=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,y=this.currentBatchSize;m0&&(v=!1),(f||g)&&(this.renderBatch(u,l,c),c=m,l=0,u=e,f&&(d=n,this.renderSession.blendModeManager.setBlendMode(d)),g)){(t=(p=s).shaders[r.id])||((t=new i.PixiShader(r)).fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[r.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var b=this.renderSession.projection;r.uniform2f(t.projectionVector,b.x,b.y);var x=this.renderSession.offset;r.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(u,l,c),this.currentBatchSize=0}},i.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var n=this.gl;if(t._dirty[n.id]){if(!this.renderSession.renderer.updateTexture(t))return}else n.bindTexture(n.TEXTURE_2D,t._glTextures[n.id]);n.drawElements(n.TRIANGLES,6*e,n.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},i.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},i.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},i.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},i.WebGLFastSpriteBatch=function(t){this.vertSize=11,this.maxSize=6e3,this.size=this.maxSize;var e=4*this.size*this.vertSize,i=6*this.maxSize;this.vertices=new Float32Array(e),this.indices=new Uint16Array(i),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,s=0;n=this.size&&this.flush()}},i.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]){if(this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}else this.renderSession.renderer.updateTexture(this.currentBaseTexture,t)}},i.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},i.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36),t.vertexAttribPointer(this.shader.aTextureIndex,1,t.FLOAT,!1,i,40)},i.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},i.WebGLFilterManager.prototype.constructor=i.WebGLFilterManager,i.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},i.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},i.WebGLFilterManager.prototype.pushFilter=function(t){var e=this.gl,n=this.renderSession.projection,s=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),t._previous_stencil_mgr=this.renderSession.stencilManager,this.renderSession.stencilManager=new i.WebGLStencilManager,this.renderSession.stencilManager.setContext(e),e.disable(e.STENCIL_TEST),this.filterStack.push(t);var r=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var o=this.texturePool.pop();o?o.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution):o=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),e.bindTexture(e.TEXTURE_2D,o.texture);var a=t._filterArea,h=r.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),e.bindFramebuffer(e.FRAMEBUFFER,o.frameBuffer),e.viewport(0,0,a.width*this.renderSession.resolution,a.height*this.renderSession.resolution),n.x=a.width/2,n.y=-a.height/2,s.x=-a.x,s.y=-a.y,e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t._glFilterTexture=o},i.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,e=this.filterStack.pop(),n=e._filterArea,s=e._glFilterTexture,r=this.renderSession.projection,o=this.renderSession.offset;if(e.filterPasses.length>1){t.viewport(0,0,n.width*this.renderSession.resolution,n.height*this.renderSession.resolution),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=n.height,this.vertexArray[2]=n.width,this.vertexArray[3]=n.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=n.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=n.width/this.width,this.uvArray[5]=n.height/this.height,this.uvArray[6]=n.width/this.width,this.uvArray[7]=n.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=s,h=this.texturePool.pop();h||(h=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution)),h.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l0?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.applyFilterPass(d,n,p,f),this.texturePool.push(s),e._glFilterTexture=null},i.WebGLFilterManager.prototype.applyFilterPass=function(t,e,n,s){var r=this.gl,o=t.shaders[r.id];o||((o=new i.PixiShader(r)).fragmentSrc=t.fragmentSrc,o.uniforms=t.uniforms,o.init(!0),t.shaders[r.id]=o),this.renderSession.shaderManager.setShader(o),r.uniform2f(o.projectionVector,n/2,-s/2),r.uniform2f(o.offsetVector,0,0),t.uniforms.dimensions&&(t.uniforms.dimensions.value[0]=this.width,t.uniforms.dimensions.value[1]=this.height,t.uniforms.dimensions.value[2]=this.vertexArray[0],t.uniforms.dimensions.value[3]=this.vertexArray[5]),o.syncUniforms(),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.vertexAttribPointer(o.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.vertexAttribPointer(o.aTextureCoord,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.colorBuffer),r.vertexAttribPointer(o.colorAttribute,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),this.renderSession.drawCount++},i.WebGLFilterManager.prototype.initShaderBuffers=function(){var t=this.gl;this.vertexBuffer=t.createBuffer(),this.uvBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.vertexArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW),this.uvArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),t.bufferData(t.ARRAY_BUFFER,this.uvArray,t.STATIC_DRAW),this.colorArray=new Float32Array([1,16777215,1,16777215,1,16777215,1,16777215]),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,1,3,2]),t.STATIC_DRAW)},i.WebGLFilterManager.prototype.destroy=function(){var t=this.gl;this.filterStack=null,this.offsetX=0,this.offsetY=0;for(var e=0;e=0;t--){var e=this._glTextures[t],n=i.glContexts[t];n&&e&&n.deleteTexture(e)}this._glTextures.length=0,this.dirty()},i.BaseTexture.fromCanvas=function(t,e,n){return 0===t.width&&(t.width=1),0===t.height&&(t.height=1),n=n||1,new i.BaseTexture(t,e,n)},i.TextureSilentFail=!1,i.Texture=function(t,e,n,s){this.noFrame=!1,e||(this.noFrame=!0,e=new i.Rectangle(0,0,1,1)),t instanceof i.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=e,this.trim=s,this.valid=!1,this.isTiling=!1,this.requiresUpdate=!1,this.requiresReTint=!1,this._uvs=null,this.width=0,this.height=0,this.crop=n||new i.Rectangle(0,0,1,1),this.rotated=!1,t.hasLoaded&&(this.noFrame&&(e=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(e))},i.Texture.prototype.constructor=i.Texture,i.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;this.noFrame&&(this.frame=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame)},i.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},i.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,this.trim||!(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs();else{if(!i.TextureSilentFail)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=!1}},i.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.width)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.width)/e,this._uvs.y2=(t.y+t.height)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.height)/n},i.Texture.prototype._updateUvsInverted=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.height)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.height)/e,this._uvs.y2=(t.y+t.width)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.width)/n},i.Texture.fromCanvas=function(t,e){var n=i.BaseTexture.fromCanvas(t,e);return new i.Texture(n)},i.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},t.exports&&(e=t.exports=i),e.PIXI=i,i}).call(this)},9204:function(t,e,i){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e=0;r--){var o=i[e.c];switch((e=this.execStack[r]).scope){case"interrupt":o=i[e.origin];var a=Object.keys(o.interrupt[e.index])[0];i=o.interrupt[e.index][a];break;case"choice":var h=Object.keys(o.choice[e.index])[0];i=o.choice[e.index][h];break;case"if":i=o[Object.keys(o)[0]]}s=i.slice(e.c).concat(s)}return s||[]},t}();e.default=o},885:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.game=e,this.name=t}return t.prototype.onInit=function(){},t.prototype.onStart=function(){},t.prototype.onLoad=function(t,e){},t.prototype.onLoaded=function(){},t.prototype.onSave=function(t,e){},t.prototype.onCall=function(t){},t.prototype.onAction=function(t){},t.prototype.onEndScene=function(t){},t.prototype.onTeardown=function(){},t}();e.default=i},8811:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return o(e,t),e},h=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},l=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&"says"===r[1];if("show"===a||"play"===a||h){var l=this.game.managers.story.parseAction(n);this.assetsPerScene[e]||(this.assetsPerScene[e]={}),this.assetsPerScene[e][l.actor]=l.actorType}if("if"!==a&&"else"!==a||i.unshift.apply(i,n[s]),"choice"===a||"interrupt"===a||"visualChoice"===a)for(var u=0,d=n[s];u0?[4,this.game.managers.audio.decodeAudio(i)]:[3,2];case 1:s.sent(),s.label=2;case 2:return this.loadingScreen&&(this.loadingScreen.destroy(this.game),this.loadingScreen=null),this.backgroundLoading&&(this.backgroundLoading=null),this.game.config.debugMode&&console.log("All assets loaded."),e(!0),[2]}}))}))}),c),c.loading=!0,c.loadingScreen&&c.loadingScreen.setLoadingBar(c.game),c.game.load.start()}))]}}))}))},t}();e.default=u},3973:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(9204)),r=function(){this.skipping=!1,this.unskippable=!1,this.auto=!1,this.paused=!1,this.clickCooldown=200,this.clickLocked=!1,this.waitForClick=!1,this.execStack=new s.default,this.actionsCounter=0,this.nextAction=null};e.default=r},571:function(t,e){"use strict";var i,n=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.RangedUserPreference=e.UserPreference=void 0;var s=function(){function t(t){this.value=t}return t.prototype.set=function(t){this.value=t},t.prototype.get=function(){return this.value},t.prototype.toJSON=function(){return this.value},t}();e.UserPreference=s;var r=function(t){function e(e,i,n,s){void 0===s&&(s=!1);var r=t.call(this,e)||this;return r.min=i,r.max=n,r.inverted=s,r}return n(e,t),e.prototype.set=function(t){this.value=t*(this.max-this.min)+this.min},e.prototype.get=function(){return this.inverted?this.max-this.value:this.value},e}(s);e.RangedUserPreference=r;var o=function(){function t(t,e){this.game=t,this.preferences={textSpeed:new r(20,10,100,!0),autoSpeed:new r(150,50,300),bgmv:new r(.5,0,1),sfxv:new r(.5,0,1),muted:new s(!1)};var i=localStorage.getItem("RenJSUserPreferences"+t.config.name);i?this.setPreferences(JSON.parse(i)):this.setPreferences(e)}return t.prototype.setPreferences=function(t){if(t)for(var e in this.preferences)void 0!==t[e]&&(this.preferences[e].value=t[e])},t.prototype.set=function(t,e){this.preferences[t].set(e),this.savePreferences()},t.prototype.get=function(t){return this.preferences[t].get()},t.prototype.addPreference=function(t,e,i){this.preferences[t]="boolean"===i?new s(e):new r(e,i.min,i.max)},t.prototype.savePreferences=function(){var t=JSON.stringify(this.preferences);localStorage.setItem("RenJSUserPreferences"+this.game.config.name,t)},t}();e.default=o},9163:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i){this.game=t,this.actionType=e,this.properties=i,this.key=Object.keys(i)[0],this.keyParams=this.key.split(" "),this.body=i[this.key]}return t.prototype.resolve=function(t,e){var i=this;t&&!e?t.then((function(){return i.game.resolveAction()})):this.game.resolveAction()},t.prototype.execute=function(){},t.prototype.parseParams=function(t){return t?this.keyParams:(this.params||(this.params=this.body?this.body.split(" "):[]),this.params)},t.prototype.parseActor=function(){return this.keyParams[1]},t.prototype.parseParameter=function(t,e,i){void 0===e&&(e="boolean"),void 0===i&&(i=!1);var n=this.parseParams(i),s=n.indexOf(t);if("boolean"===e)return-1!==s;if(-1===s)return null;var r=n[s+1];if("coords"===e){if(r in this.game.storyConfig.positions)return this.game.storyConfig.positions[r];var o=r.split(",");return{x:parseInt(o[0],10),y:parseInt(o[1],10)}}return"number"===e?parseFloat(r):r},t}();e.default=i},423:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.screenEffects.ambient.start(this.actor),this.resolve()},e}(r(i(9163)).default);e.default=o},1156:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.contAfterTrans=s.parseParameter("CONTINUE"),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.cgs.animate(this.actor,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},2352:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.keyParams[1],s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),"play"===s.actionType?(s.looped=s.parseParameter("LOOPED"),s.looped&&(s.fromSeconds=s.parseParameter("FROM","number")),s.force=s.parseParameter("FORCE"),s.channel=s.parseParameter("IN","string"),s.parseParameter("BGS")&&(s.channel="bgs"),s.channel||(s.channel="bgm")):s.channel=s.actor,s}return s(e,t),e.prototype.execute=function(){"play"===this.actionType?"music"===this.actorType?this.game.managers.audio.play(this.actor,this.channel,this.looped,this.fromSeconds,this.transition,this.force):this.game.managers.audio.playSFX(this.actor):this.game.managers.audio.stop(this.channel,this.transition),this.resolve()},e}(r(i(9163)).default);e.default=o},1629:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){var t=this.game.pluginsRJS[this.actor];this.properties.body=this.body,t.onCall(this.properties)},e}(r(i(9163)).default);e.default=o},7519:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e0){var r=s.game.managers.story.currentScene[0];r&&"else"in r&&(s.branches.ISFALSE=r.else,s.game.managers.story.currentScene.shift())}return s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.branch(this.condition,this.branches),this.resolve()},e}(r(i(9163)).default);e.default=o},2028:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actorType="characters",s.actor=s.keyParams[0],s.look=s.keyParams.length>2?s.keyParams[2]:null,s.game.managers.story.reservedWords.includes(s.look)&&(console.log("look is reserved word"),s.look=null),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({actor:this.actor,message:e})}t=this.game.managers.text.characterSays(this.actor,this.look,this.body,this.boxId,this.dontHide),this.resolve(t)},e}(r(i(7068)).default);e.default=o},8998:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.scene=s.game.managers.logic.parseVars(s.body),s}return s(e,t),e.prototype.execute=function(){this.resolve(this.game.managers.story.startScene(this.scene))},e}(r(i(9163)).default);e.default=o},1929:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),s.transition||(s.transition=s.game.storyConfig.transitions.defaults[s.actorType]),s.contAfterTrans=s.parseParameter("CONTINUE");var r=s.parseParameter("AT","coords");r&&(s.properties.position=r),s.parseParameter("FLIP")&&(s.properties.flipped="flip"),"cgs"===s.actorType&&(s.properties.layer=s.parseParameter("BEHIND")?"behindCharactersSprites":"cgsSprites");var o=s.parseParameter("IN","string");return o&&(s.properties.layer=o),"characters"===s.actorType&&(s.properties.look=s.params[0],s.game.managers.story.reservedWords.includes(s.properties.look)&&(s.properties.look=null),s.properties.look||(s.properties.look="normal")),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.story.getManagerByActorType(this.actorType).show(this.actor,this.transition,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},7068:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.dontHide=!1,s.boxId=s.parseParameter("IN","string",!0),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({message:e})}t=this.game.managers.text.display(this.body,this.boxId,null,this.dontHide),this.resolve(t)},e}(r(i(9163)).default);e.default=o},733:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.setVar(this.actor,this.body),this.resolve()},e}(r(i(9163)).default);e.default=o},7843:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.execute=function(){"click"===this.body?this.game.waitForClick():this.game.waitTimeout(parseInt(this.body,10))},e}(r(i(9163)).default);e.default=o},5761:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i,n){this.game=t,this.keyName=e,this.config={displayName:"",color:"#FFFFFF",voice:"none",nameBox:"default",messageBox:"default"},this.currentLook=null,this.usePortraits=!1,this.voice=null,Object.assign(this.config,i),"none"!==this.config.voice&&(this.voice=this.game.add.audio(this.config.voice),this.voice.play(),this.voice.stop()),this.usePortraits=void 0!==n}return t.prototype.createPortrait=function(t,e){if(this.usePortraits&&e.config.portrait){var i=this.keyName+"_portrait_"+t,n=e.config.portrait,s=this.game.add.sprite(n.x,n.y,i);s.anchor.set(.5,1),e.addChild(s),e.portrait=s}},t.prototype.createLook=function(t){void 0===t&&(t={});var e=this.currentLook?this.getLookData():{look:"normal",position:this.game.storyConfig.positions.DEFAULT,flipped:!1};Object.assign(e,t);var i=this.keyName+"_"+e.look,n=this.game.managers.story.characterSprites.create(e.position.x,e.position.y,i);return n.name=e.look,"flip"===t.flipped&&(this.currentLook?e.flipped=!(-1===this.currentLook.scale.x):e.flipped=!0),n.scale.x=e.flipped?-1:1,n.anchor.set(.5,1),n.updateTransform(),n.alpha=0,this.currentLook=n,n},t.prototype.resetLook=function(){this.currentLook.destroy(),this.currentLook=null},t.prototype.getLookData=function(){return this.currentLook?{look:this.currentLook.name,position:{x:this.currentLook.x,y:this.currentLook.y},flipped:-1===this.currentLook.scale.x}:null},t}();e.default=i},2459:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1] GUIVersion=='2.0'");var I=a.default.dump(JSON.parse(JSON.stringify(this.config)));console.log(I)}},e.prototype.convertText=function(t){return{x:t.isTextCentered?0:parseInt(t["offset-x"],10),y:t.isTextCentered?0:parseInt(t["offset-y"],10),lineSpacing:t.lineSpacing,style:this.convertTextStyle(t)}},e.prototype.convertTextStyle=function(t){var e={font:t.font,fontSize:t.size+"px",fill:t.color};return t.align&&(e.align=t.align),t["text-width"]&&(e.wordWrap=!0,e.wordWrapWidth=t["text-width"]),t.isTextCentered?(e.boundsAlignH="center",e.boundsAlignV="middle"):t["text-width"]||(e.boundsAlignH=t.align?t.align:"left",e.boundsAlignV="top"),e},e}(o.default);e.default=h},4254:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.initAssets=function(t){var e=function(t,e,i){return Object.keys(t).map((function(n){return{key:n,file:i+t[n].fileName,type:e,w:t[n].w,h:t[n].h}}))},i=e(t.assets.images,"image",t.assetsPath),n=e(t.assets.audio,"audio",t.assetsPath),s=e(t.assets.spritesheets,"spritesheet",t.assetsPath);this.assets=i.concat(n).concat(s),this.fonts=Object.keys(t.assets.fonts),this.config=t.config},e}(r(i(2459)).default);e.default=o},5225:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(3572);function s(t){return t.replace(/\s+/g," ").trim()}function r(t){for(var e,i,s=n.tokenizeTextStyle((e=t,(i=document.createElement("div")).textContent=e,i.innerHTML)),r=[],o="";s.length;){var a=s.shift();a.tag?"end"===a.tag&&r.length?o+="":a.tag.startsWith("color")?(r.push("mark"),o+=""):"bold"===a.tag?(r.push("strong"),o+=""):"italic"===a.tag&&(r.push("em"),o+=""):o+=a.text}return o.replace(/\n/g,"
")}var o=function(){function t(t){var e=this;this.game=t,this.debug=!1,this.state={name:"",text:"",choices:[],buttons:[],sliders:[]},this.updateLayout=function(){e.updateLayoutContainer(),e.updateLayoutText(),e.updateLayoutChoices(),e.updateLayoutButtons(),e.updateLayoutSliders()},this.elContainer=document.createElement("div"),this.elContainer.style.position="fixed",this.elContainer.style.pointerEvents="none",this.debug&&(this.elContainer.style.border="solid 1px red"),this.elProgress=document.createElement("progress"),this.elProgress.max=100,this.elProgress.value=0,this.debug||(this.elProgress.style.opacity="0"),this.elChoices=document.createElement("ol"),this.elChoices.style.listStyle="none",this.elButtons=document.createElement("ul"),this.elButtons.style.listStyle="none",this.elSliders=document.createElement("ul"),this.elSliders.style.listStyle="none",this.elText=document.createElement("div"),this.elText.setAttribute("aria-live","polite"),this.elText.setAttribute("aria-atomic","true"),this.elText.setAttribute("aria-relevant","text"),this.elText.setAttribute("role","main"),this.elText.setAttribute("aria-roledescription","text"),this.elText.tabIndex=0,this.elText.onclick=function(){e.game.onTap(null)},this.elText.style.position="absolute",this.debug?(this.elText.style.color="red",this.elText.style.top="1rem",this.elText.style.left="1rem",this.elText.style.right="1rem",this.elText.style.bottom="1rem"):(this.elText.style.color="transparent",this.elText.style.fontSize="0",this.elText.style.outline="none",this.elText.style.top="0",this.elText.style.left="0",this.elText.style.right="0",this.elText.style.bottom="0"),this.elContainer.appendChild(this.elProgress),this.elContainer.appendChild(this.elText),this.elContainer.appendChild(this.elChoices),this.elContainer.appendChild(this.elSliders),this.elContainer.appendChild(this.elButtons)}return t.prototype.boot=function(){var t=this;this.game.canvas.setAttribute("aria-hidden","true"),this.game.scale.onSizeChange.add(this.updateLayout),this.updateLayout(),this.game.load.onLoadStart.add((function(){t.updateLayout(),t.busy(),t.progress(0)})),this.game.load.onLoadComplete.add((function(){t.progress(100),t.ready()})),this.game.load.onFileComplete.add((function(e){t.progress(e)})),document.body.appendChild(this.elContainer)},t.prototype.progress=function(t){void 0===t?delete this.elProgress.value:this.elProgress.value=Math.floor(t)},t.prototype.busy=function(){this.elText.setAttribute("aria-busy","true")},t.prototype.ready=function(){this.elText.setAttribute("aria-busy","false")},t.prototype.updateLayoutText=function(){var t,e=r("hud"!==(null===(t=this.game.gui)||void 0===t?void 0:t.currentMenu)?"":s(this.state.text).split("\n").map((function(t){return t.trim()})).filter((function(t){return t})).join("\n"));e.length>0&&this.state.name&&(e=s(this.state.name)+": "+e),this.elText.innerHTML=e},t.prototype.updateLayoutContainer=function(){this.elContainer.style.width=this.game.scale.width+"px",this.elContainer.style.height=this.game.scale.height+"px",this.elContainer.style.top=this.game.scale.margin.top+"px",this.elContainer.style.left=this.game.scale.margin.left+"px"},t.prototype.updateLayoutBounds=function(t,e){t.style.width=e.width*this.game.scale.scaleFactorInversed.x+"px",t.style.height=e.height*this.game.scale.scaleFactorInversed.y+"px",t.style.top=e.y*this.game.scale.scaleFactorInversed.y+"px",t.style.left=e.x*this.game.scale.scaleFactorInversed.x+"px"},t.prototype.updateLayoutList=function(t,e){var i=this;this.rescueFocus(t),e.forEach((function(e,n){var s=t.children[n];s.style.display=e.isActive()?null:"none",i.updateLayoutBounds(s,e.getBounds())}))},t.prototype.updateLayoutChoices=function(){this.updateLayoutList(this.elChoices,this.state.choices)},t.prototype.updateLayoutButtons=function(){this.updateLayoutList(this.elButtons,this.state.buttons)},t.prototype.updateLayoutSliders=function(){this.updateLayoutList(this.elSliders,this.state.sliders)},t.prototype.rescueFocus=function(t){var e=document.activeElement;t!==e&&(e&&!t.contains(e)||this.elText.focus())},t.prototype.text=function(t){void 0===t&&(t=""),this.state.text=t,this.updateLayoutText()},t.prototype.name=function(t){void 0===t&&(t=""),this.state.name=t,this.updateLayoutText()},t.prototype.button=function(t){var e,i,n;this.state.buttons.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("button");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.textContent=(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.buttons)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Button "+this.state.buttons.length,r.onclick=t.onclick,r.onfocus=t.onfocus,r.onblur=t.onblur,s.appendChild(r),this.elButtons.appendChild(s),this.updateLayoutButtons()},t.prototype.slider=function(t){var e,i,n;this.state.sliders.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("input");r.type="number",r.setAttribute("aria-label",(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.sliders)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Slider "+this.state.buttons.length),r.min=t.min.toString(10),r.max=t.max.toString(10),r.step=t.step.toString(10),r.value=t.get().toString(10),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.appearance="textfield",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.onchange=function(e){return t.set(Number(e.currentTarget.value))},r.onfocus=function(){r.value=t.get().toString(10)},s.appendChild(r),this.elSliders.appendChild(s),this.updateLayoutSliders()},t.prototype.choices=function(t){var e=this;void 0===t&&(t=[]),this.state.choices=t,this.rescueFocus(this.elChoices),this.elChoices.innerHTML="",t.forEach((function(t){var i,n,s,o=document.createElement("li");o.style.position="absolute";var a=document.createElement("button");a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.background="transparent",e.debug?(a.style.border="solid 1px red",a.style.color="red"):(a.style.border="none",a.style.color="transparent",a.style.fontSize="0"),a.innerHTML=r(null!==(s=null===(n=null===(i=e.game.storyAccessibility)||void 0===i?void 0:i.choices)||void 0===n?void 0:n[t.label])&&void 0!==s?s:t.label),a.onclick=t.onclick,a.onfocus=t.onfocus,a.onblur=t.onblur,o.appendChild(a),e.elChoices.appendChild(o)})),this.updateLayoutChoices()},t}();e.default=o},150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(i,n){var s=t.call(this,i,n.x,n.y,n.asset,(function(){s.onClick()}))||this;return s.setFrames.apply(s,e.getButtonFrames(s.animations.frameTotal)),s.config=n,s.game=i,s}return s(e,t),e.getButtonFrames=function(t,e){void 0===e&&(e=!1);return{1:{normal:[0,0,0,0],pushed:[1,1,1,1]},2:{normal:[1,0,1,0],pushed:[3,2,3,2]},3:{normal:[1,0,2,0],pushed:[4,3,5,3]},4:{normal:[1,0,2,3],pushed:[5,4,6,7]}}[t][e?"pushed":"normal"]},e.prototype.onClick=function(){this.config.sfx&&"none"!==this.config.sfx&&this.game.managers.audio.playSFX(this.config.sfx),this.game.gui.bindingActions[this.config.binding](this.config,this)},e}(i(9747).Button);e.default=r},812:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?f--:(r.text.text+=d[p],r.onCharacter&&r.onCharacter(d,p),e&&(" "===d[p]||"\n"===d[p]||r.punctuationMarks.includes(d[p])||m===g?m=-1:0===m&&(e.play(),e.volume=r.game.userPreferences.get("sfxv")),m++),r.punctuationMarks.includes(d[p])&&(f=r.punctuationWait),++p>=d.length&&i())}),s),[2]}}))}))}))},e.prototype.hide=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.game.accessibility.text(),this.visible?(t||(t=this.config.transition),[4,this.game.screenEffects.transition.get(t)(this,null)]):[2];case 1:return e.sent(),this.visible=!1,[2]}}))}))},e.prototype.clear=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.config.alwaysOn?[3,2]:[4,this.hide(t)];case 1:e.sent(),e.label=2;case 2:return this.text.setText("",!0),this.ctc&&(this.ctc.visible=!1),this.portrait&&(this.portrait.destroy(),this.portrait=null),[2]}}))}))},e}(h.Sprite);e.default=u},5148:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.game=t,this.container=t.add.group(),this.container.alpha=0;var e=t.config.loadingScreen;if(e.background&&(this.background=this.container.create(t.world.centerX,t.world.centerY,"loadingScreenBg"),this.background.anchor.set(.5)),e.loadingBar){var i=e.loadingBar.position;this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar"),this.loadingBar.animations.frameTotal>1&&(this.loadingBarBg=this.loadingBar,this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar",1))}e.fade?t.add.tween(this.container).to({alpha:1},500).start():this.container.alpha=1}return t.prototype.setLoadingBar=function(t){if(this.loadingBar){var e=t.config.loadingScreen.loadingBar.direction?t.config.loadingScreen.loadingBar.direction:0;t.load.setPreloadSprite(this.loadingBar,e)}},t.prototype.waitingScreen=function(){this.loadingBar&&this.game.add.tween(this.loadingBar).to({alpha:1},600,null,!0,0,-1,!0)},t.prototype.destroy=function(t){var e=this;if(t.config.loadingScreen.fade){var i=t.add.tween(this.container).to({alpha:0},500);i.onComplete.addOnce((function(){e.container.destroy()})),i.start()}else this.container.destroy()},t}();e.default=i},7898:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(e,i){var n=t.call(this,e,i.x,i.y,i.asset)||this;n.game=e,n.config=i;var s=n.game.getSlotThumbnail(n.config.slot);return s&&n.loadThumbnail(s),n}return s(e,t),e.prototype.loadThumbnail=function(t){var e=this,i="thumbnail"+Math.floor(5e3*Math.random());this.game.load.image(i,t),this.game.load.onLoadComplete.addOnce((function(){var t=e.game.add.sprite(e.config.thumbnail.x,e.config.thumbnail.y,i);t.width=e.config.thumbnail.width,t.height=e.config.thumbnail.height,e.addChild(t)}),this),this.game.load.start()},e.prototype.destroy=function(){this.thumbnail.destroy(),t.prototype.destroy.call(this)},e}(i(9747).Sprite);e.default=r},3607:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Plugin=e.game=void 0;var s=n(i(8811)),r=n(i(885));e.game=s.default,e.Plugin=r.default},6041:function(t,e){"use strict";var i=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]2&&(l=parseInt(o[2],10)),this.cgs[t].animations.add(r,a,l)}n||(n={x:this.cgs[t].x,y:this.cgs[t].y}),i.zoom&&this.cgs[t].scale.set(i.zoom);var c=!1;if(void 0!==i.flipped){var u=this.cgs[t].scale.x<0;"flip"===i.flipped?(this.cgs[t].scale.x*=-1,c=!u):(c=i.flipped)!==u&&(this.cgs[t].scale.x*=-1)}return i.angle&&(this.cgs[t].angle=i.angle),this.current[t]={name:t,position:n,zoom:i.zoom,angle:i.angle,layer:i.layer,flipped:c},this.transition.get(e)(s,this.cgs[t],n)},t.prototype.animate=function(t,e){return s(this,void 0,void 0,(function(){var i,s,o=this;return r(this,(function(r){return i=e.time,s={},void 0!==e.alpha&&null!==e.alpha&&(s.alpha=e.alpha),void 0!==e.angle&&null!==e.angle&&(s.angle=e.angle),void 0!==e.position&&null!==e.position&&(s.x=e.position.x,s.y=e.position.y),void 0!==e.zoom&&null!==e.zoom&&(this.cgs[t].originalScale||(this.cgs[t].originalScale={width:this.cgs[t].width,height:this.cgs[t].height}),s.height=this.cgs[t].originalScale.height*e.zoom,s.width=this.cgs[t].originalScale.width*e.zoom),this.current[t]=n(n({},this.current[t]),e),[2,new Promise((function(n){var r=n;if(e.spritesheet){var a=function(){o.cgs[t].animations.stop(),n()};if("STOP"===e.spritesheet)o.cgs[t].frame=0,a();else{var h=e.spritesheet.split(" "),l=h[0],c=h.includes("LOOPED"),u=o.cgs[t].animations.getAnimation(l);if(h.includes("BACKWARDS")&&u.reverseOnce(),u.play(null,c),0===Object.keys(s).length)return c?i?o.game.waitTimeout(i,a.bind(o)):n():o.game.control.skipping?a():u.onComplete.addOnce(a.bind(o));r=a.bind(o)}}o.game.managers.tween.tween(o.cgs[t],s,r,i,!0)}))]}))}))},t.prototype.hide=function(t,e){return s(this,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return[4,this.transition.get(e)(this.cgs[t],null)];case 1:return i.sent(),this.cgs[t].destroy(),delete this.cgs[t],delete this.current[t],[2]}}))}))},t.prototype.isCGS=function(t){return this.game.setup.cgs&&t in this.game.setup.cgs},t}();e.default=l},878:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&(n.available=this.evalExpression(s[1]),n.choiceText=s[0].trim()),e.interrupt&&(n.interrupt=!0,n.origin=e.interrupt),n},LogicManager.prototype.choose=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:return e=this.currentChoices[t],this.updateChoiceLog(e.index),this.game.storyConfig.keepStoryLog&&this.game.storyLog.push({message:e.choiceText,choice:!0}),i=e.actions,this.game.managers.story.currentScene=i.concat(this.game.managers.story.currentScene),this.showingText&&t++,this.interrupting?this.game.control.execStack.stack("interrupt",i.length,e.index,e.origin):this.game.control.execStack.stack("choice",i.length,e.index),this.game.config.debugMode&&console.log("Choice taken "+t+" : "+e.choiceText),[4,this.clearChoices()];case 1:return n.sent(),this.interrupting?this.interrupting=null:this.game.resolveAction(),[2]}}))}))},LogicManager.prototype.getExecStackId=function(){var t=this.game.control.execStack.hash();return this.choicesLog[t]||(this.choicesLog[t]=[]),t},LogicManager.prototype.checkTextAction=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i,n=this;return __generator(this,(function(s){return!(e=this.game.managers.story.parseAction(__assign({},t)))||"say"!==e.actionType&&"text"!==e.actionType?[2,!1]:((i=e).dontHide=!0,[2,new Promise((function(t){i.resolve=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(i){switch(i.label){case 0:return[4,e];case 1:return i.sent(),t(!0),[2]}}))}))},i.execute()}))])}))}))},LogicManager.prototype.showChoices=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i,n,s=this;return __generator(this,(function(r){switch(r.label){case 0:return i=this,[4,this.checkTextAction(e[0])];case 1:return i.showingText=r.sent(),this.showingText&&e.shift(),this.currentChoices=e.map((function(t,e){return s.parseChoice(e,t)})),this.currentChoices=this.currentChoices.filter((function(t){return t.available})),n=-1,t||(t="default"),"visualChoices"!==t?[3,3]:[4,this.game.gui.hud.showVisualChoices(this.currentChoices)];case 2:return n=r.sent(),[3,5];case 3:return[4,this.game.gui.hud.showChoices(t,this.currentChoices)];case 4:n=r.sent(),r.label=5;case 5:return this.choose(n),[2]}}))}))},LogicManager.prototype.interrupt=function(t,e){this.interrupting={origin:this.game.control.execStack.top().c,execId:this.getExecStackId()},this.showChoices(t,e),this.game.resolveAction()},LogicManager.prototype.clearChoices=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.game.gui.hud.clear()];case 1:return t.sent(),this.currentChoices=[],this.showingText=!1,[2]}}))}))},LogicManager}();exports.default=LogicManager},7745:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.current=[],this.game=t}return t.prototype.tween=function(t,e,i,n,s,r,o){var a=this;void 0===r&&(r=0),void 0===o&&(o=!1);var h=this.game.add.tween(t);return h.to(e,n,Phaser.Easing.Linear.None,!1,r),i&&(h.onComplete.addOnce(i,this),h.callbackOnComplete=i),h.tweenables=e,s&&(this.current=[],h.start(),this.canSkip()&&!o?this.game.waitForClick((function(){return a.skip()})):(this.game.input.enabled=!1,h.onComplete.addOnce((function(){a.game.input.enabled=!0}),this))),this.current.push(h),this.game.control.skipping&&(this.game.input.enabled=!0,this.skip()),h},t.prototype.chain=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[];var s=null;t.forEach((function(e){var r=e.time?e.time:i/t.length,o=n.tween(e.sprite,e.tweenables,e.callback,r,!1,e.delay);s&&s.chain(o),s=o})),this.game.control.skipping?this.canSkip()&&!e&&this.game.waitForClick((function(){return n.skip()})):this.current[0].start()},t.prototype.parallel=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[],t.forEach((function(t){n.tween(t.sprite,t.tweenables,t.callback,i,!0,t.delay)})),this.canSkip()||e||this.game.waitForClick((function(){return n.skip()}))},t.prototype.canSkip=function(){return this.game.storyConfig.transitions.skippable&&!this.game.control.unskippable},t.prototype.skip=function(){this.game.control.unskippable||(this.current.forEach((function(t){for(var e in t.stop(!1),t.tweenables)t.target[e]=t.tweenables[e];t.callbackOnComplete&&t.callbackOnComplete()})),this.current=[])},t}();e.default=i},4664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.clearFunctions=[],this.current=[],this.game=t,this.audioManager=t.managers.audio}return t.prototype.start=function(t){this.current.push(t),this[t]?this[t]():this.game.pluginsRJS[t]&&this.game.pluginsRJS[t].onCall()},t.prototype.set=function(t){if(t)for(var e=0,i=t;e0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]=0;i--)this.game.load.text("story"+i,h.preparePath(this.game.config.storyText[i],this.game))},e.prototype.create=function(t){var e=this;new p.default(this.game).setLoadingBar(this.game),this.input.onDown.addOnce((function(){"suspended"===e.sound.context.state&&e.sound.context.resume()})),this.game.tools.jsyaml=a.default,this.game.setup=a.default.load(this.game.cache.getText("storySetup")),t.setup||(this.game.setup={}),this.game.storyConfig=a.default.load(this.game.cache.getText("storyConfig")),this.game.storyAccessibility=a.default.load(this.game.cache.getText("storyAccessibility"));var i={};this.game.config.storyText.forEach((function(t,n){var s=a.default.load(e.game.cache.getText("story"+n));Object.assign(i,r({},s))})),this.game.story=i,this.game.guiSetup=a.default.load(this.game.cache.getText("guiConfig")),"2.0"===t.guiSetup.GUIVersion||"2.0"===t.guiSetup.madeWithRenJSBuilder?t.gui=new d.default(t):t.guiSetup.madeWithRenJSBuilder?t.gui=new u.default(t):(console.error("Old GUI configuration is deprecated!!!!"),console.error("Check the docs at http://renjs.net/docs-page.html")),t.state.add("preloadStory",c.default),t.state.start("preloadStory")},e}(l.default);e.default=f},8171:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return t.call(this)||this}return s(e,t),e.prototype.init=function(){this.game.setupScreen()},e.prototype.preload=function(){for(var t in this.game.config.i18n.background&&this.game.load.image("langChooserBg",this.game.config.i18n.background),this.game.config.i18n.langs){var e=this.game.config.i18n.langs[t];this.game.load.spritesheet("languageTag"+t,e.asset,e.size.w,e.size.h)}},e.prototype.create=function(){var t=this;this.game.config.i18n.background&&this.game.add.image(0,0,"langChooserBg");var e=function(e){var n=i.game.config.i18n.langs[e];i.game.add.button(n.position.x,n.position.y,"languageTag"+e,(function(){t.game.config.i18n.current=e,localStorage.setItem("RenJS_I18N"+t.game.config.name,e),t.game.state.start("bootstrap")}),i,1,0,1,0)},i=this;for(var n in this.game.config.i18n.langs)e(n)},e}(r(i(4015)).default);e.default=o},1150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";function i(t,e){return e.config.i18n?t.replace("LANG",e.config.i18n.current):t}function n(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}Object.defineProperty(e,"__esModule",{value:!0}),e.loadStyle=e.guid=e.preloadExtra=e.preloadCharacter=e.preloadAudio=e.preloadCGS=e.preloadBackground=e.preparePath=void 0,e.preparePath=i,e.preloadBackground=function(t,e){var n=e.setup.backgrounds[t].split(" ");1===n.length?e.load.image(t,i(n[0],e)):e.load.spritesheet(t,i(n[0],e),parseInt(n[1],10),parseInt(n[2],10))},e.preloadCGS=function(t,e){var n=e.setup.cgs[t];if("string"==typeof n)e.load.image(t,i(n,e));else{var s=n.spritesheet.split(" ");e.load.spritesheet(t,i(s[0],e),parseInt(s[1],10),parseInt(s[2],10))}},e.preloadAudio=function(t,e,n){n.load.audio(t,i(n.setup[e][t],n))},e.preloadCharacter=function(t,e){var n=e.setup.characters[t];for(var s in n.looks)e.load.image(t+"_"+s,i(n.looks[s],e));for(var r in n.portraits)e.load.image(t+"_portrait_"+r,i(n.portraits[r],e))},e.preloadExtra=function(t,e,n){if("spritesheets"===e){var s=n.setup.extra[e][t].split(" ");n.load.spritesheet(t,i(s[0],n),parseInt(s[1],10),parseInt(s[2],10))}else n.load[e](t,i(n.setup.extra[e][t],n))},e.guid=function(){return"ss".replace(/s/g,n)},e.loadStyle=function(t,e){for(var i=0,n=Array.from(document.styleSheets);i{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0,e.range=function(t,e,i){void 0===i&&(i=1);for(var n=[t],s=t;s{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hudSort=e.setTextStyles=e.changeInputEnabled=void 0;var n=i(3572);e.changeInputEnabled=function t(e,i){e.input&&(e.input.enabled=i);for(var n=0,s=e.children;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenizeTextStyle=void 0;var i=/\((?:color:(?:\w+|#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6})|italic|bold|end)\)/;e.tokenizeTextStyle=function(t){for(var e=[];;){var n=i.exec(t);if(!n)return e.push({text:t}),e;var s=n.index,r=n[0];e.push({text:t.substr(0,s)}),e.push({tag:r.slice(1,-1)}),t=t.substr(s+r.length)}}},4147:t=>{"use strict";t.exports=JSON.parse('{"name":"renjs","version":"2.7.2","description":"RenJS is a videogame library for making Visual Novels that run directly in the web browser","author":"lunafromthemoon","contributors":["RockDaFox","Sean S. LeBlanc"],"license":"CC-BY-SA-4.0","repository":{"type":"git","url":"git+https://github.com/lunafromthemoon/RenJS-V2.git"},"bugs":{"url":"https://github.com/lunafromthemoon/RenJS-V2/issues"},"homepage":"https://renjs.net","keywords":["engine","visual","novel","phaser"],"files":["dist"],"main":"dist/renjs.js","types":"dist/types/index.d.ts","scripts":{"start":"webpack-dev-server --config webpack.dev.js --hot --progress","build":"webpack --config webpack.prod.js","build:docs":"./scripts/build-docs.sh","build:demo":"./scripts/build-demo.sh","lint":"eslint \\"./src/**/*.{j,t}s\\"","postversion":"npm run build && npm run build:docs"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm",["@semantic-release/github",{"assets":"dist/renjs.js"}],["@semantic-release/git",{"assets":["docs/**/*","dist/**/*","CHANGELOG.md","package.json","package-lock.json"]}]]},"dependencies":{"fontfaceobserver":"^2.1.0","js-yaml":"^4.1.0","object-hash":"^2.0.3","phaser-ce":"^2.16.0"},"devDependencies":{"@types/fontfaceobserver":"^2.1.0","@types/js-yaml":"^4.0.5","@typescript-eslint/eslint-plugin":"^5.5.0","@typescript-eslint/parser":"^5.5.0","bestzip":"^2.2.0","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^10.0.0","eslint":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-promise":"^5.2.0","eslint-plugin-standard":"^5.0.0","expose-loader":"^3.1.0","terser-webpack-plugin":"^5.2.5","ts-loader":"^9.2.6","typescript":"^3.9.7","webpack":"^5.64.4","webpack-cli":"^4.9.1","webpack-dev-server":"^4.6.0","webpack-merge":"^5.8.0"}}')}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(3607);RenJS=__webpack_exports__})(); \ No newline at end of file diff --git a/docs/downloads/RenJSQuickstart.zip b/docs/downloads/RenJSQuickstart.zip index 537b005a..73f64427 100644 Binary files a/docs/downloads/RenJSQuickstart.zip and b/docs/downloads/RenJSQuickstart.zip differ diff --git a/docs/downloads/releases/renjs-v2.7.2.js b/docs/downloads/releases/renjs-v2.7.2.js new file mode 100644 index 00000000..c755b944 --- /dev/null +++ b/docs/downloads/releases/renjs-v2.7.2.js @@ -0,0 +1,900 @@ +var RenJS;(()=>{var __webpack_modules__={2288:(t,e,i)=>{var n=i(4674),s=i(7672);void 0===s.PIXI&&(s.PIXI=n),t.exports=n},9747:(t,e,i)=>{var n=i(6405),s=i(7672);void 0===s.Phaser&&(s.Phaser=n),t.exports=n},8279:(t,e,i)=>{var n=i(4969),s=i(7672);void 0===s.p2&&(s.p2=n),t.exports=n},7672:(t,e,i)=>{"use strict";t.exports=function(){if("object"==typeof globalThis)return globalThis;var t;try{t=this||new Function("return this")()}catch(t){if("object"==typeof window)return window;if("object"==typeof self)return self;if(void 0!==i.g)return i.g}return t}()},7347:t=>{!function(){function e(t,e){document.addEventListener?t.addEventListener("scroll",e,!1):t.attachEvent("scroll",e)}function i(t){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(t)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function n(t,e){t.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+e+";"}function s(t){var e=t.a.offsetWidth,i=e+100;return t.f.style.width=i+"px",t.c.scrollLeft=i,t.b.scrollLeft=t.b.scrollWidth+100,t.g!==e&&(t.g=e,!0)}function r(t,i){function n(){var t=r;s(t)&&t.a.parentNode&&i(t.g)}var r=t;e(t.b,n),e(t.c,n),s(t)}function o(t,e){var i=e||{};this.family=t,this.style=i.style||"normal",this.weight=i.weight||"normal",this.stretch=i.stretch||"normal"}var a=null,h=null,l=null,c=null;function u(){return null===c&&(c=!!document.fonts),c}function d(){if(null===l){var t=document.createElement("div");try{t.style.font="condensed 100px sans-serif"}catch(t){}l=""!==t.style.font}return l}function p(t,e){return[t.style,t.weight,d()?t.stretch:"","100px",e].join(" ")}o.prototype.load=function(t,e){var s=this,o=t||"BESbswy",l=0,c=e||3e3,d=(new Date).getTime();return new Promise((function(t,e){if(u()&&!function(){if(null===h)if(u()&&/Apple/.test(window.navigator.vendor)){var t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent);h=!!t&&603>parseInt(t[1],10)}else h=!1;return h}()){var f=new Promise((function(t,e){!function i(){(new Date).getTime()-d>=c?e(Error(c+"ms timeout exceeded")):document.fonts.load(p(s,'"'+s.family+'"'),o).then((function(e){1<=e.length?t():setTimeout(i,25)}),e)}()})),g=new Promise((function(t,e){l=setTimeout((function(){e(Error(c+"ms timeout exceeded"))}),c)}));Promise.race([g,f]).then((function(){clearTimeout(l),t(s)}),e)}else!function(t){document.body?t():document.addEventListener?document.addEventListener("DOMContentLoaded",(function e(){document.removeEventListener("DOMContentLoaded",e),t()})):document.attachEvent("onreadystatechange",(function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),t())}))}((function(){function h(){var e;(e=-1!=m&&-1!=y||-1!=m&&-1!=v||-1!=y&&-1!=v)&&((e=m!=y&&m!=v&&y!=v)||(null===a&&(e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),a=!!e&&(536>parseInt(e[1],10)||536===parseInt(e[1],10)&&11>=parseInt(e[2],10))),e=a&&(m==b&&y==b&&v==b||m==x&&y==x&&v==x||m==w&&y==w&&v==w)),e=!e),e&&(_.parentNode&&_.parentNode.removeChild(_),clearTimeout(l),t(s))}var u=new i(o),f=new i(o),g=new i(o),m=-1,y=-1,v=-1,b=-1,x=-1,w=-1,_=document.createElement("div");_.dir="ltr",n(u,p(s,"sans-serif")),n(f,p(s,"serif")),n(g,p(s,"monospace")),_.appendChild(u.a),_.appendChild(f.a),_.appendChild(g.a),document.body.appendChild(_),b=u.a.offsetWidth,x=f.a.offsetWidth,w=g.a.offsetWidth,function t(){if((new Date).getTime()-d>=c)_.parentNode&&_.parentNode.removeChild(_),e(Error(c+"ms timeout exceeded"));else{var i=document.hidden;!0!==i&&void 0!==i||(m=u.a.offsetWidth,y=f.a.offsetWidth,v=g.a.offsetWidth,h()),l=setTimeout(t,50)}}(),r(u,(function(t){m=t,h()})),n(u,p(s,'"'+s.family+'",sans-serif')),r(f,(function(t){y=t,h()})),n(f,p(s,'"'+s.family+'",serif')),r(g,(function(t){v=t,h()})),n(g,p(s,'"'+s.family+'",monospace'))}))}))},t.exports=o}()},3320:(t,e,i)=>{"use strict";var n=i(7990),s=i(3150);function r(t,e){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}t.exports.Type=i(1364),t.exports.Schema=i(7657),t.exports.FAILSAFE_SCHEMA=i(4795),t.exports.JSON_SCHEMA=i(5966),t.exports.CORE_SCHEMA=i(9471),t.exports.DEFAULT_SCHEMA=i(6601),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.dump=s.dump,t.exports.YAMLException=i(8425),t.exports.types={binary:i(3531),float:i(5215),map:i(945),null:i(151),pairs:i(6879),set:i(4982),timestamp:i(2156),bool:i(8771),int:i(1518),merge:i(7452),omap:i(1605),seq:i(6451),str:i(48)},t.exports.safeLoad=r("safeLoad","load"),t.exports.safeLoadAll=r("safeLoadAll","loadAll"),t.exports.safeDump=r("safeDump","dump")},8347:t=>{"use strict";function e(t){return null==t}t.exports.isNothing=e,t.exports.isObject=function(t){return"object"==typeof t&&null!==t},t.exports.toArray=function(t){return Array.isArray(t)?t:e(t)?[]:[t]},t.exports.repeat=function(t,e){var i,n="";for(i=0;i{"use strict";var n=i(8347),s=i(8425),r=i(6601),o=Object.prototype.toString,a=Object.prototype.hasOwnProperty,h=65279,l={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},c=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],u=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function d(t){var e,i,r;if(e=t.toString(16).toUpperCase(),t<=255)i="x",r=2;else if(t<=65535)i="u",r=4;else{if(!(t<=4294967295))throw new s("code point within a string may not be greater than 0xFFFFFFFF");i="U",r=8}return"\\"+i+n.repeat("0",r-e.length)+e}function p(t){this.schema=t.schema||r,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=n.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=function(t,e){var i,n,s,r,o,h,l;if(null===e)return{};for(i={},s=0,r=(n=Object.keys(e)).length;s=55296&&n<=56319&&e+1=56320&&i<=57343?1024*(n-55296)+i-56320+65536:n}function w(t){return/^\n* /.test(t)}function _(t,e,i,n,s,r,o,a){var l,c,u=0,d=null,p=!1,f=!1,g=-1!==n,v=-1,_=y(c=x(t,0))&&c!==h&&!m(c)&&45!==c&&63!==c&&58!==c&&44!==c&&91!==c&&93!==c&&123!==c&&125!==c&&35!==c&&38!==c&&42!==c&&33!==c&&124!==c&&61!==c&&62!==c&&39!==c&&34!==c&&37!==c&&64!==c&&96!==c&&function(t){return!m(t)&&58!==t}(x(t,t.length-1));if(e||o)for(l=0;l=65536?l+=2:l++){if(!y(u=x(t,l)))return 5;_=_&&b(u,d,a),d=u}else{for(l=0;l=65536?l+=2:l++){if(10===(u=x(t,l)))p=!0,g&&(f=f||l-v-1>n&&" "!==t[v+1],v=l);else if(!y(u))return 5;_=_&&b(u,d,a),d=u}f=f||g&&l-v-1>n&&" "!==t[v+1]}return p||f?i>9&&w(t)?5:o?2===r?5:2:f?4:3:!_||o||s(t)?2===r?5:2:1}function T(t,e,i,n,r){t.dump=function(){if(0===e.length)return 2===t.quotingType?'""':"''";if(!t.noCompatMode&&(-1!==c.indexOf(e)||u.test(e)))return 2===t.quotingType?'"'+e+'"':"'"+e+"'";var o=t.indent*Math.max(1,i),a=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-o),h=n||t.flowLevel>-1&&i>=t.flowLevel;switch(_(e,h,t.indent,a,(function(e){return function(t,e){var i,n;for(i=0,n=t.implicitTypes.length;i"+C(e,t.indent)+S(f(function(t,e){var i,n,s=/(\n+)([^\n]*)/g,r=(a=t.indexOf("\n"),a=-1!==a?a:t.length,s.lastIndex=a,P(t.slice(0,a),e)),o="\n"===t[0]||" "===t[0];var a;for(;n=s.exec(t);){var h=n[1],l=n[2];i=" "===l[0],r+=h+(o||i||""===l?"":"\n")+P(l,e),o=i}return r}(e,a),o));case 5:return'"'+function(t){for(var e,i="",n=0,s=0;s=65536?s+=2:s++)n=x(t,s),!(e=l[n])&&y(n)?(i+=t[s],n>=65536&&(i+=t[s+1])):i+=e||d(n);return i}(e)+'"';default:throw new s("impossible error: invalid scalar style")}}()}function C(t,e){var i=w(t)?String(e):"",n="\n"===t[t.length-1];return i+(n&&("\n"===t[t.length-2]||"\n"===t)?"+":n?"":"-")+"\n"}function S(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function P(t,e){if(""===t||" "===t[0])return t;for(var i,n,s=/ [^ ]/g,r=0,o=0,a=0,h="";i=s.exec(t);)(a=i.index)-r>e&&(n=o>r?o:a,h+="\n"+t.slice(r,n),r=n+1),o=a;return h+="\n",t.length-r>e&&o>r?h+=t.slice(r,o)+"\n"+t.slice(o+1):h+=t.slice(r),h.slice(1)}function A(t,e,i,n){var s,r,o,a="",h=t.tag;for(s=0,r=i.length;s tag resolver accepts not "'+u+'" style');n=c.represent[u](e,u)}t.dump=n}return!0}return!1}function M(t,e,i,n,r,a,h){t.tag=null,t.dump=i,E(t,i,!1)||E(t,i,!0);var l,c=o.call(t.dump),u=n;n&&(n=t.flowLevel<0||t.flowLevel>e);var d,p,f="[object Object]"===c||"[object Array]"===c;if(f&&(p=-1!==(d=t.duplicates.indexOf(i))),(null!==t.tag&&"?"!==t.tag||p||2!==t.indent&&e>0)&&(r=!1),p&&t.usedDuplicates[d])t.dump="*ref_"+d;else{if(f&&p&&!t.usedDuplicates[d]&&(t.usedDuplicates[d]=!0),"[object Object]"===c)n&&0!==Object.keys(t.dump).length?(!function(t,e,i,n){var r,o,a,h,l,c,u="",d=t.tag,p=Object.keys(i);if(!0===t.sortKeys)p.sort();else if("function"==typeof t.sortKeys)p.sort(t.sortKeys);else if(t.sortKeys)throw new s("sortKeys must be a boolean or a function");for(r=0,o=p.length;r1024)&&(t.dump&&10===t.dump.charCodeAt(0)?c+="?":c+="? "),c+=t.dump,l&&(c+=g(t,e)),M(t,e+1,h,!0,l)&&(t.dump&&10===t.dump.charCodeAt(0)?c+=":":c+=": ",u+=c+=t.dump));t.tag=d,t.dump=u||"{}"}(t,e,t.dump,r),p&&(t.dump="&ref_"+d+t.dump)):(!function(t,e,i){var n,s,r,o,a,h="",l=t.tag,c=Object.keys(i);for(n=0,s=c.length;n1024&&(a+="? "),a+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),M(t,e,o,!1,!1)&&(h+=a+=t.dump));t.tag=l,t.dump="{"+h+"}"}(t,e,t.dump),p&&(t.dump="&ref_"+d+" "+t.dump));else if("[object Array]"===c)n&&0!==t.dump.length?(t.noArrayIndent&&!h&&e>0?A(t,e-1,t.dump,r):A(t,e,t.dump,r),p&&(t.dump="&ref_"+d+t.dump)):(!function(t,e,i){var n,s,r,o="",a=t.tag;for(n=0,s=i.length;n",t.dump=l+" "+t.dump)}return!0}function k(t,e){var i,n,s=[],r=[];for(L(t,s,r),i=0,n=r.length;i{"use strict";function e(t,e){var i="",n=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(i+='in "'+t.mark.name+'" '),i+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!e&&t.mark.snippet&&(i+="\n\n"+t.mark.snippet),n+" "+i):n}function i(t,i){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=i,this.message=e(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){return this.name+": "+e(this,t)},t.exports=i},7990:(t,e,i)=>{"use strict";var n=i(8347),s=i(8425),r=i(192),o=i(6601),a=Object.prototype.hasOwnProperty,h=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,l=/[\x85\u2028\u2029]/,c=/[,\[\]\{\}]/,u=/^(?:!|!!|![a-z\-]+!)$/i,d=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function p(t){return Object.prototype.toString.call(t)}function f(t){return 10===t||13===t}function g(t){return 9===t||32===t}function m(t){return 9===t||32===t||10===t||13===t}function y(t){return 44===t||91===t||93===t||123===t||125===t}function v(t){var e;return 48<=t&&t<=57?t-48:97<=(e=32|t)&&e<=102?e-97+10:-1}function b(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"…":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function x(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var w=new Array(256),_=new Array(256),T=0;T<256;T++)w[T]=b(T)?1:0,_[T]=b(T);function C(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||o,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function S(t,e){var i={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return i.snippet=r(i),new s(e,i)}function P(t,e){throw S(t,e)}function A(t,e){t.onWarning&&t.onWarning.call(null,S(t,e))}var E={YAML:function(t,e,i){var n,s,r;null!==t.version&&P(t,"duplication of %YAML directive"),1!==i.length&&P(t,"YAML directive accepts exactly one argument"),null===(n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]))&&P(t,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),r=parseInt(n[2],10),1!==s&&P(t,"unacceptable YAML version of the document"),t.version=i[0],t.checkLineBreaks=r<2,1!==r&&2!==r&&A(t,"unsupported YAML version of the document")},TAG:function(t,e,i){var n,s;2!==i.length&&P(t,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],u.test(n)||P(t,"ill-formed tag handle (first argument) of the TAG directive"),a.call(t.tagMap,n)&&P(t,'there is a previously declared suffix for "'+n+'" tag handle'),d.test(s)||P(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch(e){P(t,"tag prefix is malformed: "+s)}t.tagMap[n]=s}};function M(t,e,i,n){var s,r,o,a;if(e1&&(t.result+=n.repeat("\n",e-1))}function F(t,e){var i,n,s=t.tag,r=t.anchor,o=[],a=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=o),n=t.input.charCodeAt(t.position);0!==n&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,P(t,"tab characters must not be used in indentation")),45===n)&&m(t.input.charCodeAt(t.position+1));)if(a=!0,t.position++,I(t,!0,-1)&&t.lineIndent<=e)o.push(null),n=t.input.charCodeAt(t.position);else if(i=t.line,G(t,e,3,!1,!0),o.push(t.result),I(t,!0,-1),n=t.input.charCodeAt(t.position),(t.line===i||t.lineIndent>e)&&0!==n)P(t,"bad indentation of a sequence entry");else if(t.lineIndente?C=1:t.lineIndent===e?C=0:t.lineIndente?C=1:t.lineIndent===e?C=0:t.lineIndente)&&(b&&(o=t.line,a=t.lineStart,h=t.position),G(t,e,4,!0,s)&&(b?y=t.result:v=t.result),b||(L(t,d,p,f,y,v,o,a,h),f=y=v=null),I(t,!0,-1),l=t.input.charCodeAt(t.position)),(t.line===r||t.lineIndent>e)&&0!==l)P(t,"bad indentation of a mapping entry");else if(t.lineIndent=0))break;0===r?P(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?P(t,"repeat of an indentation width identifier"):(u=e+r-1,c=!0)}if(g(o)){do{o=t.input.charCodeAt(++t.position)}while(g(o));if(35===o)do{o=t.input.charCodeAt(++t.position)}while(!f(o)&&0!==o)}for(;0!==o;){for(O(t),t.lineIndent=0,o=t.input.charCodeAt(t.position);(!c||t.lineIndentu&&(u=t.lineIndent),f(o))d++;else{if(t.lineIndent0){for(s=o,r=0;s>0;s--)(o=v(a=t.input.charCodeAt(++t.position)))>=0?r=(r<<4)+o:P(t,"expected hexadecimal character");t.result+=x(r),t.position++}else P(t,"unknown escape sequence");i=n=t.position}else f(a)?(M(t,i,n,!0),R(t,I(t,!1,e)),i=n=t.position):t.position===t.lineStart&&B(t)?P(t,"unexpected end of the document within a double quoted scalar"):(t.position++,n=t.position)}P(t,"unexpected end of the stream within a double quoted scalar")}(t,b)?A=!0:!function(t){var e,i,n;if(42!==(n=t.input.charCodeAt(t.position)))return!1;for(n=t.input.charCodeAt(++t.position),e=t.position;0!==n&&!m(n)&&!y(n);)n=t.input.charCodeAt(++t.position);return t.position===e&&P(t,"name of an alias node must contain at least one character"),i=t.input.slice(e,t.position),a.call(t.anchorMap,i)||P(t,'unidentified alias "'+i+'"'),t.result=t.anchorMap[i],I(t,!0,-1),!0}(t)?function(t,e,i){var n,s,r,o,a,h,l,c,u=t.kind,d=t.result;if(m(c=t.input.charCodeAt(t.position))||y(c)||35===c||38===c||42===c||33===c||124===c||62===c||39===c||34===c||37===c||64===c||96===c)return!1;if((63===c||45===c)&&(m(n=t.input.charCodeAt(t.position+1))||i&&y(n)))return!1;for(t.kind="scalar",t.result="",s=r=t.position,o=!1;0!==c;){if(58===c){if(m(n=t.input.charCodeAt(t.position+1))||i&&y(n))break}else if(35===c){if(m(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&B(t)||i&&y(c))break;if(f(c)){if(a=t.line,h=t.lineStart,l=t.lineIndent,I(t,!1,-1),t.lineIndent>=e){o=!0,c=t.input.charCodeAt(t.position);continue}t.position=r,t.line=a,t.lineStart=h,t.lineIndent=l;break}}o&&(M(t,s,r,!1),R(t,t.line-a),s=r=t.position,o=!1),g(c)||(r=t.position+1),c=t.input.charCodeAt(++t.position)}return M(t,s,r,!1),!!t.result||(t.kind=u,t.result=d,!1)}(t,b,1===i)&&(A=!0,null===t.tag&&(t.tag="?")):(A=!0,null===t.tag&&null===t.anchor||P(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===C&&(A=l&&F(t,T))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&P(t,'unacceptable node kind for ! tag; it should be "scalar", not "'+t.kind+'"'),c=0,u=t.implicitTypes.length;c"),null!==t.result&&p.kind!==t.kind&&P(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+p.kind+'", not "'+t.kind+'"'),p.resolve(t.result,t.tag)?(t.result=p.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):P(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||A}function N(t){var e,i,n,s,r=t.position,o=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(s=t.input.charCodeAt(t.position))&&(I(t,!0,-1),s=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==s));){for(o=!0,s=t.input.charCodeAt(++t.position),e=t.position;0!==s&&!m(s);)s=t.input.charCodeAt(++t.position);for(n=[],(i=t.input.slice(e,t.position)).length<1&&P(t,"directive name must not be less than one character in length");0!==s;){for(;g(s);)s=t.input.charCodeAt(++t.position);if(35===s){do{s=t.input.charCodeAt(++t.position)}while(0!==s&&!f(s));break}if(f(s))break;for(e=t.position;0!==s&&!m(s);)s=t.input.charCodeAt(++t.position);n.push(t.input.slice(e,t.position))}0!==s&&O(t),a.call(E,i)?E[i](t,i,n):A(t,'unknown document directive "'+i+'"')}I(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,I(t,!0,-1)):o&&P(t,"directives end mark is expected"),G(t,t.lineIndent-1,4,!1,!0),I(t,!0,-1),t.checkLineBreaks&&l.test(t.input.slice(r,t.position))&&A(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&B(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,I(t,!0,-1)):t.position{"use strict";var n=i(8425),s=i(1364);function r(t,e){var i=[];return t[e].forEach((function(t){var e=i.length;i.forEach((function(i,n){i.tag===t.tag&&i.kind===t.kind&&i.multi===t.multi&&(e=n)})),i[e]=t})),i}function o(t){return this.extend(t)}o.prototype.extend=function(t){var e=[],i=[];if(t instanceof s)i.push(t);else if(Array.isArray(t))i=i.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new n("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(e=e.concat(t.implicit)),t.explicit&&(i=i.concat(t.explicit))}e.forEach((function(t){if(!(t instanceof s))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new n("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new n("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),i.forEach((function(t){if(!(t instanceof s))throw new n("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(o.prototype);return a.implicit=(this.implicit||[]).concat(e),a.explicit=(this.explicit||[]).concat(i),a.compiledImplicit=r(a,"implicit"),a.compiledExplicit=r(a,"explicit"),a.compiledTypeMap=function(){var t,e,i={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function n(t){t.multi?(i.multi[t.kind].push(t),i.multi.fallback.push(t)):i[t.kind][t.tag]=i.fallback[t.tag]=t}for(t=0,e=arguments.length;t{"use strict";t.exports=i(5966)},6601:(t,e,i)=>{"use strict";t.exports=i(9471).extend({implicit:[i(2156),i(7452)],explicit:[i(3531),i(1605),i(6879),i(4982)]})},4795:(t,e,i)=>{"use strict";var n=i(7657);t.exports=new n({explicit:[i(48),i(6451),i(945)]})},5966:(t,e,i)=>{"use strict";t.exports=i(4795).extend({implicit:[i(151),i(8771),i(1518),i(5215)]})},192:(t,e,i)=>{"use strict";var n=i(8347);function s(t,e,i,n,s){var r="",o="",a=Math.floor(s/2)-1;return n-e>a&&(e=n-a+(r=" ... ").length),i-n>a&&(i=n+a-(o=" ...").length),{str:r+t.slice(e,i).replace(/\t/g,"→")+o,pos:n-e+r.length}}function r(t,e){return n.repeat(" ",e-t.length)+t}t.exports=function(t,e){if(e=Object.create(e||null),!t.buffer)return null;e.maxLength||(e.maxLength=79),"number"!=typeof e.indent&&(e.indent=1),"number"!=typeof e.linesBefore&&(e.linesBefore=3),"number"!=typeof e.linesAfter&&(e.linesAfter=2);for(var i,o=/\r?\n|\r|\0/g,a=[0],h=[],l=-1;i=o.exec(t.buffer);)h.push(i.index),a.push(i.index+i[0].length),t.position<=i.index&&l<0&&(l=a.length-2);l<0&&(l=a.length-1);var c,u,d="",p=Math.min(t.line+e.linesAfter,h.length).toString().length,f=e.maxLength-(e.indent+p+3);for(c=1;c<=e.linesBefore&&!(l-c<0);c++)u=s(t.buffer,a[l-c],h[l-c],t.position-(a[l]-a[l-c]),f),d=n.repeat(" ",e.indent)+r((t.line-c+1).toString(),p)+" | "+u.str+"\n"+d;for(u=s(t.buffer,a[l],h[l],t.position,f),d+=n.repeat(" ",e.indent)+r((t.line+1).toString(),p)+" | "+u.str+"\n",d+=n.repeat("-",e.indent+p+3+u.pos)+"^\n",c=1;c<=e.linesAfter&&!(l+c>=h.length);c++)u=s(t.buffer,a[l+c],h[l+c],t.position-(a[l]-a[l+c]),f),d+=n.repeat(" ",e.indent)+r((t.line+c+1).toString(),p)+" | "+u.str+"\n";return d.replace(/\n$/,"")}},1364:(t,e,i)=>{"use strict";var n=i(8425),s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],r=["scalar","sequence","mapping"];t.exports=function(t,e){var i,o;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===s.indexOf(e))throw new n('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.options=e,this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=(i=e.styleAliases||null,o={},null!==i&&Object.keys(i).forEach((function(t){i[t].forEach((function(e){o[String(e)]=t}))})),o),-1===r.indexOf(this.kind))throw new n('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},3531:(t,e,i)=>{"use strict";var n=i(1364),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new n("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,i,n=0,r=t.length,o=s;for(i=0;i64)){if(e<0)return!1;n+=6}return n%8==0},construct:function(t){var e,i,n=t.replace(/[\r\n=]/g,""),r=n.length,o=s,a=0,h=[];for(e=0;e>16&255),h.push(a>>8&255),h.push(255&a)),a=a<<6|o.indexOf(n.charAt(e));return 0===(i=r%4*6)?(h.push(a>>16&255),h.push(a>>8&255),h.push(255&a)):18===i?(h.push(a>>10&255),h.push(a>>2&255)):12===i&&h.push(a>>4&255),new Uint8Array(h)},predicate:function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function(t){var e,i,n="",r=0,o=t.length,a=s;for(e=0;e>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[63&r]),r=(r<<8)+t[e];return 0===(i=o%3)?(n+=a[r>>18&63],n+=a[r>>12&63],n+=a[r>>6&63],n+=a[63&r]):2===i?(n+=a[r>>10&63],n+=a[r>>4&63],n+=a[r<<2&63],n+=a[64]):1===i&&(n+=a[r>>2&63],n+=a[r<<4&63],n+=a[64],n+=a[64]),n}})},8771:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e=t.length;return 4===e&&("true"===t||"True"===t||"TRUE"===t)||5===e&&("false"===t||"False"===t||"FALSE"===t)},construct:function(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})},5215:(t,e,i)=>{"use strict";var n=i(8347),s=i(1364),r=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var o=/^[-+]?[0-9]+e/;t.exports=new s("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(t){return null!==t&&!(!r.test(t)||"_"===t[t.length-1])},construct:function(t){var e,i;return i="-"===(e=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),".inf"===e?1===i?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===e?NaN:i*parseFloat(e,10)},predicate:function(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||n.isNegativeZero(t))},represent:function(t,e){var i;if(isNaN(t))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(t))return"-0.0";return i=t.toString(10),o.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"})},1518:(t,e,i)=>{"use strict";var n=i(8347),s=i(1364);function r(t){return 48<=t&&t<=55}function o(t){return 48<=t&&t<=57}t.exports=new s("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(t){if(null===t)return!1;var e,i,n=t.length,s=0,a=!1;if(!n)return!1;if("-"!==(e=t[s])&&"+"!==e||(e=t[++s]),"0"===e){if(s+1===n)return!0;if("b"===(e=t[++s])){for(s++;s=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},945:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}})},7452:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(t){return"<<"===t||null===t}})},151:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(t){if(null===t)return!0;var e=t.length;return 1===e&&"~"===t||4===e&&("null"===t||"Null"===t||"NULL"===t)},construct:function(){return null},predicate:function(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})},1605:(t,e,i)=>{"use strict";var n=i(1364),s=Object.prototype.hasOwnProperty,r=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,i,n,o,a,h=[],l=t;for(e=0,i=l.length;e{"use strict";var n=i(1364),s=Object.prototype.toString;t.exports=new n("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(t){if(null===t)return!0;var e,i,n,r,o,a=t;for(o=new Array(a.length),e=0,i=a.length;e{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}})},4982:(t,e,i)=>{"use strict";var n=i(1364),s=Object.prototype.hasOwnProperty;t.exports=new n("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(t){if(null===t)return!0;var e,i=t;for(e in i)if(s.call(i,e)&&null!==i[e])return!1;return!0},construct:function(t){return null!==t?t:{}}})},48:(t,e,i)=>{"use strict";var n=i(1364);t.exports=new n("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}})},2156:(t,e,i)=>{"use strict";var n=i(1364),s=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),r=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new n("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(t){return null!==t&&(null!==s.exec(t)||null!==r.exec(t))},construct:function(t){var e,i,n,o,a,h,l,c,u=0,d=null;if(null===(e=s.exec(t))&&(e=r.exec(t)),null===e)throw new Error("Date resolve error");if(i=+e[1],n=+e[2]-1,o=+e[3],!e[4])return new Date(Date.UTC(i,n,o));if(a=+e[4],h=+e[5],l=+e[6],e[7]){for(u=e[7].slice(0,3);u.length<3;)u+="0";u=+u}return e[9]&&(d=6e4*(60*+e[10]+ +(e[11]||0)),"-"===e[9]&&(d=-d)),c=new Date(Date.UTC(i,n,o,a,h,l,u)),d&&c.setTime(c.getTime()-d),c},instanceOf:Date,represent:function(t){return t.toISOString()}})},705:t=>{t.exports=function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=i[o]={exports:{}};e[o][0].call(h.exports,(function(t){return s(e[o][1][t]||t)}),h,h.exports,t,e,i,n)}return i[o].exports}for(var r=void 0,o=0;o>16),c((65280&s)>>8),c(255&s);return 2==r?c(255&(s=l(t.charAt(i))<<2|l(t.charAt(i+1))>>4)):1==r&&(c((s=l(t.charAt(i))<<10|l(t.charAt(i+1))<<4|l(t.charAt(i+2))>>2)>>8&255),c(255&s)),o},t.fromByteArray=function(t){var e,i,n,s,r=t.length%3,o="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,n=t.length-r;e>18&63)+a(s>>12&63)+a(s>>6&63)+a(63&s);switch(r){case 1:o+=a((i=t[t.length-1])>>2),o+=a(i<<4&63),o+="==";break;case 2:o+=a((i=(t[t.length-2]<<8)+t[t.length-1])>>10),o+=a(i>>4&63),o+=a(i<<2&63),o+="="}return o}}(void 0===i?this.base64js={}:i)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:10}],3:[function(t,e,i){(function(e,n,s,r,o,a,h,l,c){var u=t("base64-js"),d=t("ieee754");function s(t,e,i){if(!(this instanceof s))return new s(t,e,i);var n,r,o,a,h,l=typeof t;if("base64"===e&&"string"==l)for(t=(n=t).trim?n.trim():n.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==l)r=k(t);else if("string"==l)r=s.byteLength(t,e);else{if("object"!=l)throw new Error("First argument needs to be a number, array or string.");r=k(t.length)}if(s._useTypedArrays?o=s._augment(new Uint8Array(r)):((o=this).length=r,o._isBuffer=!0),s._useTypedArrays&&"number"==typeof t.byteLength)o._set(t);else if(L(h=t)||s.isBuffer(h)||h&&"object"==typeof h&&"number"==typeof h.length)for(a=0;a>8,n=e%256,s.push(n),s.push(i);return s}(e),t,i,n)}function g(t,e,i){var n="";i=Math.min(t.length,i);for(var s=e;s>>0)):(e+1>>0),s}function v(t,e,i,n){if(n||(N("boolean"==typeof i,"missing or invalid endian"),N(null!=e,"missing offset"),N(e+1>>8*(n?o:1-o)}function T(t,e,i,n,s){s||(N(null!=e,"missing value"),N("boolean"==typeof n,"missing or invalid endian"),N(null!=i,"missing offset"),N(i+3>>8*(n?o:3-o)&255}function C(t,e,i,n,s){s||(N(null!=e,"missing value"),N("boolean"==typeof n,"missing or invalid endian"),N(null!=i,"missing offset"),N(i+1this.length&&(n=this.length),t.length-e=this.length))return this[t]},s.prototype.readUInt16LE=function(t,e){return m(this,t,!0,e)},s.prototype.readUInt16BE=function(t,e){return m(this,t,!1,e)},s.prototype.readUInt32LE=function(t,e){return y(this,t,!0,e)},s.prototype.readUInt32BE=function(t,e){return y(this,t,!1,e)},s.prototype.readInt8=function(t,e){if(e||(N(null!=t,"missing offset"),N(t=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){return v(this,t,!0,e)},s.prototype.readInt16BE=function(t,e){return v(this,t,!1,e)},s.prototype.readInt32LE=function(t,e){return b(this,t,!0,e)},s.prototype.readInt32BE=function(t,e){return b(this,t,!1,e)},s.prototype.readFloatLE=function(t,e){return x(this,t,!0,e)},s.prototype.readFloatBE=function(t,e){return x(this,t,!1,e)},s.prototype.readDoubleLE=function(t,e){return w(this,t,!0,e)},s.prototype.readDoubleBE=function(t,e){return w(this,t,!1,e)},s.prototype.writeUInt8=function(t,e,i){i||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e=this.length||(this[e]=t)},s.prototype.writeUInt16LE=function(t,e,i){_(this,t,e,!0,i)},s.prototype.writeUInt16BE=function(t,e,i){_(this,t,e,!1,i)},s.prototype.writeUInt32LE=function(t,e,i){T(this,t,e,!0,i)},s.prototype.writeUInt32BE=function(t,e,i){T(this,t,e,!1,i)},s.prototype.writeInt8=function(t,e,i){i||(N(null!=t,"missing value"),N(null!=e,"missing offset"),N(e=this.length||(0<=t?this.writeUInt8(t,e,i):this.writeUInt8(255+t+1,e,i))},s.prototype.writeInt16LE=function(t,e,i){C(this,t,e,!0,i)},s.prototype.writeInt16BE=function(t,e,i){C(this,t,e,!1,i)},s.prototype.writeInt32LE=function(t,e,i){S(this,t,e,!0,i)},s.prototype.writeInt32BE=function(t,e,i){S(this,t,e,!1,i)},s.prototype.writeFloatLE=function(t,e,i){P(this,t,e,!0,i)},s.prototype.writeFloatBE=function(t,e,i){P(this,t,e,!1,i)},s.prototype.writeDoubleLE=function(t,e,i){A(this,t,e,!0,i)},s.prototype.writeDoubleBE=function(t,e,i){A(this,t,e,!1,i)},s.prototype.fill=function(t,e,i){if(t=t||0,e=e||0,i=i||this.length,"string"==typeof t&&(t=t.charCodeAt(0)),N("number"==typeof t&&!isNaN(t),"value is not a number"),N(e<=i,"end < start"),i!==e&&0!==this.length){N(0<=e&&e"},s.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(s._useTypedArrays)return new s(this).buffer;for(var t=new Uint8Array(this.length),e=0,i=t.length;e=e.length||s>=t.length);s++)e[s+i]=t[s];return s}function F(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function D(t,e){N("number"==typeof t,"cannot write a non-number as a number"),N(0<=t,"specified a negative value for writing an unsigned value"),N(t<=e,"value is larger than maximum value for type"),N(Math.floor(t)===t,"value has a fractional component")}function U(t,e,i){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(i<=t,"value smaller than minimum allowed value"),N(Math.floor(t)===t,"value has a fractional component")}function G(t,e,i){N("number"==typeof t,"cannot write a non-number as a number"),N(t<=e,"value larger than maximum allowed value"),N(i<=t,"value smaller than minimum allowed value")}function N(t,e){if(!t)throw new Error(e||"Failed assertion")}s._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=E.get,t.set=E.set,t.write=E.write,t.toString=E.toString,t.toLocaleString=E.toString,t.toJSON=E.toJSON,t.copy=E.copy,t.slice=E.slice,t.readUInt8=E.readUInt8,t.readUInt16LE=E.readUInt16LE,t.readUInt16BE=E.readUInt16BE,t.readUInt32LE=E.readUInt32LE,t.readUInt32BE=E.readUInt32BE,t.readInt8=E.readInt8,t.readInt16LE=E.readInt16LE,t.readInt16BE=E.readInt16BE,t.readInt32LE=E.readInt32LE,t.readInt32BE=E.readInt32BE,t.readFloatLE=E.readFloatLE,t.readFloatBE=E.readFloatBE,t.readDoubleLE=E.readDoubleLE,t.readDoubleBE=E.readDoubleBE,t.writeUInt8=E.writeUInt8,t.writeUInt16LE=E.writeUInt16LE,t.writeUInt16BE=E.writeUInt16BE,t.writeUInt32LE=E.writeUInt32LE,t.writeUInt32BE=E.writeUInt32BE,t.writeInt8=E.writeInt8,t.writeInt16LE=E.writeInt16LE,t.writeInt16BE=E.writeInt16BE,t.writeInt32LE=E.writeInt32LE,t.writeInt32BE=E.writeInt32BE,t.writeFloatLE=E.writeFloatLE,t.writeFloatBE=E.writeFloatBE,t.writeDoubleLE=E.writeDoubleLE,t.writeDoubleBE=E.writeDoubleBE,t.fill=E.fill,t.inspect=E.inspect,t.toArrayBuffer=E.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:11,lYpoI2:10}],4:[function(t,e,i){(function(i,n,s,r,o,a,h,l,c){s=t("buffer").Buffer;var u=4,d=new s(u);d.fill(0),e.exports={hash:function(t,e,i,n){return s.isBuffer(t)||(t=new s(t)),function(t,e,i){for(var n=new s(e),r=i?n.writeInt32BE:n.writeInt32LE,o=0;og?e=t(e):e.length>5]|=128<>>9<<4)]=e;for(var i=1732584193,n=-271733879,s=-1732584194,r=271733878,o=0;o>>32-a,i);var o,a}function f(t,e,i,n,s,r,o){return p(e&i|~e&n,t,e,s,r,o)}function g(t,e,i,n,s,r,o){return p(e&n|i&~n,t,e,s,r,o)}function m(t,e,i,n,s,r,o){return p(e^i^n,t,e,s,r,o)}function y(t,e,i,n,s,r,o){return p(i^(e|~n),t,e,s,r,o)}function v(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}e.exports=function(t){return u.hash(t,d,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],7:[function(t,e,i){(function(t,i,n,s,r,o,a,h,l){var c,u;c=function(t){for(var e,i=new Array(t),n=0;n>>((3&n)<<3)&255;return i},e.exports=u||c}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:10}],8:[function(t,e,i){(function(i,n,s,r,o,a,h,l,c){var u=t("./helpers");function d(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var i,n=Array(80),s=1732584193,r=-271733879,o=-1732584194,a=271733878,h=-1009589776,l=0;l>16)+(e>>16)+(i>>16)<<16|65535&i}function g(t,e){return t<>>32-e}e.exports=function(t){return u.hash(t,d,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:10}],9:[function(t,e,i){(function(i,n,s,r,o,a,h,l,c){function u(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function d(t,e){return t>>>e|t<<32-e}function p(t,e){return t>>>e}function f(t,e){var i,n,s,r,o,a,h,l,c,f,g,m,y,v,b,x,w,_,T=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),C=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),S=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var P=0;P>1,c=-7,u=i?s-1:0,d=i?-1:1,p=t[e+u];for(u+=d,r=p&(1<<-c)-1,p>>=-c,c+=a;0>=-c,c+=n;0>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:r-1,f=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),2<=(e+=1<=o+u?d/h:d*Math.pow(2,1-u))*h&&(o++,h/=2),c<=o+u?(a=0,o=c):1<=o+u?(a=(e*h-1)*Math.pow(2,s),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,s),o=0));8<=s;t[i+p]=255&a,p+=f,a/=256,s-=8);for(o=o<{t.exports=function t(e,i,n){function s(o,a){if(!i[o]){if(!e[o]){if(r)return r(o,!0);throw new Error("Cannot find module '"+o+"'")}var h=i[o]={exports:{}};e[o][0].call(h.exports,(function(t){var i=e[o][1][t];return s(i||t)}),h,h.exports,t,e,i,n)}return i[o].exports}for(var r=void 0,o=0;o=0&&h<=1&&l>=0&&l<=1}},{"./Scalar":4}],2:[function(t,e,i){function n(){}e.exports=n,n.area=function(t,e,i){return(e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1])},n.left=function(t,e,i){return n.area(t,e,i)>0},n.leftOn=function(t,e,i){return n.area(t,e,i)>=0},n.right=function(t,e,i){return n.area(t,e,i)<0},n.rightOn=function(t,e,i){return n.area(t,e,i)<=0};var s=[],r=[];n.collinear=function(t,e,i,o){if(o){var a=s,h=r;a[0]=e[0]-t[0],a[1]=e[1]-t[1],h[0]=i[0]-e[0],h[1]=i[1]-e[1];var l=a[0]*h[0]+a[1]*h[1],c=Math.sqrt(a[0]*a[0]+a[1]*a[1]),u=Math.sqrt(h[0]*h[0]+h[1]*h[1]);return Math.acos(l/(c*u))t.vertices.length)throw new Error("lol2");if(e<0)throw new Error("lol3");for(var n=e;ne[t][0])&&(t=i);s.left(this.at(t-1),this.at(t),this.at(t+1))||this.reverse()},o.prototype.reverse=function(){for(var t=[],e=0,i=this.vertices.length;e!==i;e++)t.push(this.vertices.pop());this.vertices=t},o.prototype.isReflex=function(t){return s.right(this.at(t-1),this.at(t),this.at(t+1))};var a=[],h=[];function l(t,e,i,n,s){s=s||0;var o=e[1]-t[1],a=t[0]-e[0],h=o*t[0]+a*t[1],l=n[1]-i[1],c=i[0]-n[0],u=l*i[0]+c*i[1],d=o*c-l*a;return r.eq(d,0,s)?[0,0]:[(c*h-a*u)/d,(o*u-l*h)/d]}o.prototype.canSee=function(t,e){var i,r,o=a,l=h;if(s.leftOn(this.at(t+1),this.at(t),this.at(e))&&s.rightOn(this.at(t-1),this.at(t),this.at(e)))return!1;r=s.sqdist(this.at(t),this.at(e));for(var c=0;c!==this.vertices.length;++c)if((c+1)%this.vertices.length!==t&&c!==t&&s.leftOn(this.at(t),this.at(e),this.at(c+1))&&s.rightOn(this.at(t),this.at(e),this.at(c))&&(o[0]=this.at(t),o[1]=this.at(e),l[0]=this.at(c),l[1]=this.at(c+1),i=n.lineInt(o,l),s.sqdist(this.at(t),i)0?this.slice(t):[this]},o.prototype.slice=function(t){if(0==t.length)return[this];if(t instanceof Array&&t.length&&t[0]instanceof Array&&2==t[0].length&&t[0][0]instanceof Array){for(var e=[this],i=0;ir)return console.warn("quickDecomp: max level ("+r+") reached."),t;for(var T=0;Tm&&(m+=this.vertices.length),g=Number.MAX_VALUE,m3&&i>=0;--i)s.collinear(this.at(i-1),this.at(i),this.at(i+1),t)&&(this.vertices.splice(i%this.vertices.length,1),i--,e++);return e}},{"./Line":1,"./Point":2,"./Scalar":4}],4:[function(t,e,i){function n(){}e.exports=n,n.eq=function(t,e,i){return i=i||0,Math.abs(t-e) (http://steffe.se)",keywords:["p2.js","p2","physics","engine","2d"],main:"./src/p2.js",engines:{node:"*"},repository:{type:"git",url:"https://github.com/schteppe/p2.js.git"},bugs:{url:"https://github.com/schteppe/p2.js/issues"},licenses:[{type:"MIT"}],devDependencies:{grunt:"^0.4.5","grunt-contrib-jshint":"^0.11.2","grunt-contrib-nodeunit":"^0.4.1","grunt-contrib-uglify":"~0.4.0","grunt-contrib-watch":"~0.5.0","grunt-browserify":"~2.0.1","grunt-contrib-concat":"^0.4.0"},dependencies:{"poly-decomp":"0.1.1"}}},{}],7:[function(t,e,i){var n=t("../math/vec2");function s(t){this.lowerBound=n.create(),t&&t.lowerBound&&n.copy(this.lowerBound,t.lowerBound),this.upperBound=n.create(),t&&t.upperBound&&n.copy(this.upperBound,t.upperBound)}t("../utils/Utils"),e.exports=s;var r=n.create();s.prototype.setFromPoints=function(t,e,i,s){var o=this.lowerBound,a=this.upperBound;"number"!=typeof i&&(i=0),0!==i?n.rotate(o,t[0],i):n.copy(o,t[0]),n.copy(a,o);for(var h=Math.cos(i),l=Math.sin(i),c=1;ca[f]&&(a[f]=u[f]),u[f]i&&(this.lowerBound[e]=i);var n=t.upperBound[e];this.upperBound[e]h?-1:a}},{"../math/vec2":30,"../utils/Utils":57}],8:[function(t,e,i){var n=t("../math/vec2"),s=t("../objects/Body");function r(t){this.type=t,this.result=[],this.world=null,this.boundingVolumeType=r.AABB}e.exports=r,r.AABB=1,r.BOUNDING_CIRCLE=2,r.prototype.setWorld=function(t){this.world=t},r.prototype.getCollisionPairs=function(t){};var o=n.create();r.boundingRadiusCheck=function(t,e){n.sub(o,t.position,e.position);var i=n.squaredLength(o),s=t.boundingRadius+e.boundingRadius;return i<=s*s},r.aabbCheck=function(t,e){return t.getAABB().overlaps(e.getAABB())},r.prototype.boundingVolumeCheck=function(t,e){var i;switch(this.boundingVolumeType){case r.BOUNDING_CIRCLE:i=r.boundingRadiusCheck(t,e);break;case r.AABB:i=r.aabbCheck(t,e);break;default:throw new Error("Bounding volume type not recognized: "+this.boundingVolumeType)}return i},r.canCollide=function(t,e){var i=s.KINEMATIC,n=s.STATIC;return!(t.type===n&&e.type===n||t.type===i&&e.type===n||t.type===n&&e.type===i||t.type===i&&e.type===i||t.sleepState===s.SLEEPING&&e.sleepState===s.SLEEPING||t.sleepState===s.SLEEPING&&e.type===n||e.sleepState===s.SLEEPING&&t.type===n)},r.NAIVE=1,r.SAP=2},{"../math/vec2":30,"../objects/Body":31}],9:[function(t,e,i){t("../shapes/Circle"),t("../shapes/Plane"),t("../shapes/Shape"),t("../shapes/Particle");var n=t("../collision/Broadphase");function s(){n.call(this,n.NAIVE)}t("../math/vec2"),e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.prototype.getCollisionPairs=function(t){var e=t.bodies,i=this.result;i.length=0;for(var s=0,r=e.length;s!==r;s++)for(var o=e[s],a=0;az&&Y0)for(U=0;UMath.pow(g,2))return 0;if(u)return!0;var y=this.createContactEquation(t,a,e,h);return s(y.normalA,l,i),n.normalize(y.normalA,y.normalA),n.scale(y.contactPointA,y.normalA,d),n.scale(y.contactPointB,y.normalA,-p),r(y.contactPointA,y.contactPointA,i),s(y.contactPointA,y.contactPointA,t.position),r(y.contactPointB,y.contactPointB,l),s(y.contactPointB,y.contactPointB,a.position),this.contactEquations.push(y),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(y)),1},R.prototype[p.PLANE|p.CONVEX]=R.prototype[p.PLANE|p.BOX]=R.prototype.planeConvex=function(t,e,i,a,h,l,c,u,d){var p=m,f=y,b=v,x=0;n.rotate(f,g,a);for(var w=0;w!==l.vertices.length;w++){var _=l.vertices[w];if(n.rotate(p,_,u),r(p,p,c),s(b,p,i),o(b,f)<=0){if(d)return!0;x++;var T=this.createContactEquation(t,h,e,l);s(b,p,i),n.copy(T.normalA,f);var C=o(b,T.normalA);n.scale(b,T.normalA,C),s(T.contactPointB,p,h.position),s(T.contactPointA,p,b),s(T.contactPointA,T.contactPointA,t.position),this.contactEquations.push(T),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(T))}}return this.enableFrictionReduction&&this.enableFriction&&x&&this.frictionEquations.push(this.createFrictionFromAverage(x)),x},R.prototype[p.PARTICLE|p.PLANE]=R.prototype.particlePlane=function(t,e,i,r,a,h,l,c,u){var d=m,p=y;c=c||0,s(d,i,l),n.rotate(p,g,c);var f=o(d,p);if(f>0)return 0;if(u)return!0;var v=this.createContactEquation(a,t,h,e);return n.copy(v.normalA,p),n.scale(d,v.normalA,f),s(v.contactPointA,i,d),s(v.contactPointA,v.contactPointA,a.position),s(v.contactPointB,i,t.position),this.contactEquations.push(v),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(v)),1},R.prototype[p.CIRCLE|p.PARTICLE]=R.prototype.circleParticle=function(t,e,i,o,a,h,l,c,u){var d=m;if(s(d,l,i),n.squaredLength(d)>Math.pow(e.radius,2))return 0;if(u)return!0;var p=this.createContactEquation(t,a,e,h);return n.copy(p.normalA,d),n.normalize(p.normalA,p.normalA),n.scale(p.contactPointA,p.normalA,e.radius),r(p.contactPointA,p.contactPointA,i),s(p.contactPointA,p.contactPointA,t.position),s(p.contactPointB,l,a.position),this.contactEquations.push(p),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(p)),1};var K=new u({radius:1}),J=n.create(),Q=n.create();n.create(),R.prototype[p.PLANE|p.CAPSULE]=R.prototype.planeCapsule=function(t,e,i,s,o,a,h,l,c){var u,d=J,p=Q,f=K;n.set(d,-a.length/2,0),n.rotate(d,d,l),r(d,d,h),n.set(p,a.length/2,0),n.rotate(p,p,l),r(p,p,h),f.radius=a.radius,this.enableFrictionReduction&&(u=this.enableFriction,this.enableFriction=!1);var g=this.circlePlane(o,f,d,0,t,e,i,s,c),m=this.circlePlane(o,f,p,0,t,e,i,s,c);if(this.enableFrictionReduction&&(this.enableFriction=u),c)return g||m;var y=g+m;return this.enableFrictionReduction&&y&&this.frictionEquations.push(this.createFrictionFromAverage(y)),y},R.prototype[p.CIRCLE|p.PLANE]=R.prototype.circlePlane=function(t,e,i,a,h,l,c,u,d){var p=t,f=e,b=i,x=h,w=c,_=u;_=_||0;var T=m,C=y,S=v;s(T,b,w),n.rotate(C,g,_);var P=o(C,T);if(P>f.radius)return 0;if(d)return!0;var A=this.createContactEquation(x,p,l,e);return n.copy(A.normalA,C),n.scale(A.contactPointB,A.normalA,-f.radius),r(A.contactPointB,A.contactPointB,b),s(A.contactPointB,A.contactPointB,p.position),n.scale(S,A.normalA,P),s(A.contactPointA,T,S),r(A.contactPointA,A.contactPointA,w),s(A.contactPointA,A.contactPointA,x.position),this.contactEquations.push(A),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(A)),1},R.prototype[p.CONVEX]=R.prototype[p.CONVEX|p.BOX]=R.prototype[p.BOX]=R.prototype.convexConvex=function(t,e,i,a,h,l,c,u,d,p){var f=m,g=y,w=v,S=b,P=x,A=_,E=T,M=C,k=0;if(p="number"==typeof p?p:0,!R.findSeparatingAxis(e,i,a,l,c,u,f))return 0;s(E,c,i),o(f,E)>0&&n.scale(f,f,-1);var L=R.getClosestEdge(e,a,f,!0),O=R.getClosestEdge(l,u,f);if(-1===L||-1===O)return 0;for(var I=0;I<2;I++){var B,F=L,D=O,U=e,G=l,N=i,j=c,W=a,X=u,V=t,H=h;0===I&&(B=F,F=D,D=B,B=U,U=G,G=B,B=N,N=j,j=B,B=W,W=X,X=B,B=V,V=H,H=B);for(var q=D;q=3){if(d)return!0;var $=this.createContactEquation(V,H,U,G);k++,J=U.vertices[F%U.vertices.length],Q=U.vertices[(F+1)%U.vertices.length],n.rotate(w,J,W),n.rotate(S,Q,W),r(w,w,N),r(S,S,N),s(P,S,w),n.rotate90cw($.normalA,P),n.normalize($.normalA,$.normalA),s(E,g,w),Z=o($.normalA,E),n.scale(A,$.normalA,Z),s($.contactPointA,g,N),s($.contactPointA,$.contactPointA,A),r($.contactPointA,$.contactPointA,N),s($.contactPointA,$.contactPointA,V.position),s($.contactPointB,g,j),r($.contactPointB,$.contactPointB,j),s($.contactPointB,$.contactPointB,H.position),this.contactEquations.push($),this.enableFrictionReduction||this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact($))}}}return this.enableFrictionReduction&&this.enableFriction&&k&&this.frictionEquations.push(this.createFrictionFromAverage(k)),k};var Z=n.fromValues(0,0);R.projectConvexOntoAxis=function(t,e,i,s,r){var a,h,l=null,c=null,u=Z;n.rotate(u,s,-i);for(var d=0;dl)&&(l=h),(null===c||hl){var p=c;c=l,l=p}var f=o(e,s);n.set(r,c+f,l+f)};var $=n.fromValues(0,0),tt=n.fromValues(0,0),et=n.fromValues(0,0),it=n.fromValues(0,0),nt=n.fromValues(0,0),st=n.fromValues(0,0);R.findSeparatingAxis=function(t,e,i,r,o,a,h){var l=null,c=!1,u=!1,d=$,p=tt,g=et,m=it,y=nt,v=st;if(t instanceof f&&r instanceof f)for(var b=0;2!==b;b++){var x=t,w=i;1===b&&(x=r,w=a);for(var _=0;2!==_;_++){0===_?n.set(m,0,1):1===_&&n.set(m,1,0),0!==w&&n.rotate(m,m,w),R.projectConvexOntoAxis(t,e,i,m,y),R.projectConvexOntoAxis(r,o,a,m,v);var T=y,C=v;y[0]>v[0]&&(C=y,T=v),c=(S=C[0]-T[1])<=0,(null===l||S>l)&&(n.copy(h,m),l=S,u=c)}}else for(b=0;2!==b;b++)for(x=t,w=i,1===b&&(x=r,w=a),_=0;_!==x.vertices.length;_++){var S;n.rotate(p,x.vertices[_],w),n.rotate(g,x.vertices[(_+1)%x.vertices.length],w),s(d,g,p),n.rotate90cw(m,d),n.normalize(m,m),R.projectConvexOntoAxis(t,e,i,m,y),R.projectConvexOntoAxis(r,o,a,m,v),T=y,C=v,y[0]>v[0]&&(C=y,T=v),c=(S=C[0]-T[1])<=0,(null===l||S>l)&&(n.copy(h,m),l=S,u=c)}return u};var rt=n.fromValues(0,0),ot=n.fromValues(0,0),at=n.fromValues(0,0);R.getClosestEdge=function(t,e,i,r){var a=rt,h=ot,l=at;n.rotate(a,i,-e),r&&n.scale(a,a,-1);for(var c=-1,u=t.vertices.length,d=-1,p=0;p!==u;p++){s(h,t.vertices[(p+1)%u],t.vertices[p%u]),n.rotate90cw(l,h),n.normalize(l,l);var f=o(l,a);(-1===c||f>d)&&(c=p%u,d=f)}return c};var ht=n.create(),lt=n.create(),ct=n.create(),ut=n.create(),dt=n.create(),pt=n.create(),ft=n.create();R.prototype[p.CIRCLE|p.HEIGHTFIELD]=R.prototype.circleHeightfield=function(t,e,i,o,a,h,l,c,u,d){var p=h.heights,f=(d=d||e.radius,h.elementWidth),g=lt,m=ht,y=dt,v=ft,b=pt,x=ct,w=ut,_=Math.floor((i[0]-d-l[0])/f),T=Math.ceil((i[0]+d-l[0])/f);_<0&&(_=0),T>=p.length&&(T=p.length-1);for(var C=p[_],S=p[T],P=_;PC&&(C=p[P]);if(i[1]-d>C)return!u&&0;var A=!1;for(P=_;P=x[0]&&m[0]0)for(P=_;P<=T;P++)if(n.set(x,P*f,p[P]),n.add(x,x,l),n.sub(g,i,x),n.squaredLength(g)=c.length&&(y=c.length-1);for(var v=c[m],b=c[y],x=m;xv&&(v=c[x]);if(t.aabb.lowerBound[1]>v)return!l&&0;var w=0;for(x=m;x=0||r.containsPoint(this.from))&&this.intersectBody(t,s)}};var r=n.create();s.prototype.intersectBody=function(t,e){var i=this.checkCollisionResponse;if(!i||e.collisionResponse)for(var s=r,o=0,a=e.shapes.length;oe.boundingRadius*e.boundingRadius||(this._currentBody=s,this._currentShape=e,e.raycast(t,this,n,i),this._currentBody=this._currentShape=null)},s.prototype.getAABB=function(t){var e=this.to,i=this.from;n.set(t.lowerBound,Math.min(e[0],i[0]),Math.min(e[1],i[1])),n.set(t.upperBound,Math.max(e[0],i[0]),Math.max(e[1],i[1]))},n.create(),s.prototype.reportIntersection=function(t,e,i,r){this.from,this.to;var o=this._currentShape,a=this._currentBody;if(!(this.skipBackfaces&&n.dot(i,this.direction)>0))switch(this.mode){case s.ALL:t.set(i,o,a,e,r),this.callback(t);break;case s.CLOSEST:(e=0&&!(t[r].aabb.lowerBound[e]<=s.aabb.lowerBound[e]);r--)t[r+1]=t[r];t[r+1]=s}return t},r.prototype.sortList=function(){var t=this.axisList,e=this.axisIndex;r.sortAxisList(t,e)},r.prototype.getCollisionPairs=function(t){var e=this.axisList,i=this.result,n=this.axisIndex;i.length=0;for(var r=e.length;r--;){var o=e[r];o.aabbNeedsUpdate&&o.updateAABB()}this.sortList();for(var a=0,h=0|e.length;a!==h;a++)for(var l=e[a],c=a+1;cthis.upperLimit&&(o.maxForce=0,o.minForce=-this.maxForce,this.distance=this.upperLimit,u=!0),this.lowerLimitEnabled&&this.positioni?(o.scale(s.normalA,l,-1),o.sub(s.contactPointA,c,a.position),o.sub(s.contactPointB,u,h.position),o.scale(f,l,i),o.add(s.contactPointA,s.contactPointA,f),-1===t.indexOf(s)&&t.push(s)):-1!==(v=t.indexOf(s))&&t.splice(v,1),this.lowerLimitEnabled&&bp?(g.angle=p,-1===r.indexOf(g)&&r.push(g)):-1!==(t=r.indexOf(g))&&r.splice(t,1),this.lowerLimitEnabled&&y>1;if(e<3)return[];for(var i=[],s=[],r=0;r3;){var a=s[(r+0)%o],h=s[(r+1)%o],l=s[(r+2)%o],c=t[2*a],u=t[2*a+1],d=t[2*h],p=t[2*h+1],f=t[2*l],g=t[2*l+1],m=!1;if(n._convex(c,u,d,p,f,g)){m=!0;for(var y=0;y3*o)break}return i.push(s[0],s[1],s[2]),i},_PointInTriangle:function(t,e,i,n,s,r,o,a){var h=o-i,l=a-n,c=s-i,u=r-n,d=t-i,p=e-n,f=h*h+l*l,g=h*c+l*u,m=h*d+l*p,y=c*c+u*u,v=c*d+u*p,b=1/(f*y-g*g),x=(y*m-g*v)*b,w=(f*v-g*m)*b;return x>=0&&w>=0&&x+w<1},_convex:function(t,e,i,n,s,r){return(e-n)*(s-i)+(i-t)*(r-n)>=0}};e.exports=n},{}],30:[function(t,e,i){var n=e.exports={},s=t("../utils/Utils");n.crossLength=function(t,e){return t[0]*e[1]-t[1]*e[0]},n.crossVZ=function(t,e,i){return n.rotate(t,e,-Math.PI/2),n.scale(t,t,i),t},n.crossZV=function(t,e,i){return n.rotate(t,i,Math.PI/2),n.scale(t,t,e),t},n.rotate=function(t,e,i){if(0!==i){var n=Math.cos(i),s=Math.sin(i),r=e[0],o=e[1];t[0]=n*r-s*o,t[1]=s*r+n*o}else t[0]=e[0],t[1]=e[1]},n.rotate90cw=function(t,e){var i=e[0],n=e[1];t[0]=n,t[1]=-i},n.toLocalFrame=function(t,e,i,s){n.copy(t,e),n.sub(t,t,i),n.rotate(t,t,-s)},n.toGlobalFrame=function(t,e,i,s){n.copy(t,e),n.rotate(t,t,s),n.add(t,t,i)},n.vectorToLocalFrame=function(t,e,i){n.rotate(t,e,-i)},n.vectorToGlobalFrame=function(t,e,i){n.rotate(t,e,i)},n.centroid=function(t,e,i,s){return n.add(t,e,i),n.add(t,t,s),n.scale(t,t,1/3),t},n.create=function(){var t=new s.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},n.clone=function(t){var e=new s.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},n.fromValues=function(t,e){var i=new s.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},n.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},n.set=function(t,e,i){return t[0]=e,t[1]=i,t},n.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},n.subtract=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t},n.sub=n.subtract,n.multiply=function(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t},n.mul=n.multiply,n.divide=function(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t},n.div=n.divide,n.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},n.distance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(i*i+n*n)},n.dist=n.distance,n.squaredDistance=function(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n},n.sqrDist=n.squaredDistance,n.length=function(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)},n.len=n.length,n.squaredLength=function(t){var e=t[0],i=t[1];return e*e+i*i},n.sqrLen=n.squaredLength,n.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},n.normalize=function(t,e){var i=e[0],n=e[1],s=i*i+n*n;return s>0&&(s=1/Math.sqrt(s),t[0]=e[0]*s,t[1]=e[1]*s),t},n.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},n.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},n.lerp=function(t,e,i,n){var s=e[0],r=e[1];return t[0]=s+n*(i[0]-s),t[1]=r+n*(i[1]-r),t},n.reflect=function(t,e,i){var n=e[0]*i[0]+e[1]*i[1];t[0]=e[0]-2*i[0]*n,t[1]=e[1]-2*i[1]*n},n.getLineSegmentsIntersection=function(t,e,i,s,r){var o=n.getLineSegmentsIntersectionFraction(e,i,s,r);return!(o<0||(t[0]=e[0]+o*(i[0]-e[0]),t[1]=e[1]+o*(i[1]-e[1]),0))},n.getLineSegmentsIntersectionFraction=function(t,e,i,n){var s,r,o=e[0]-t[0],a=e[1]-t[1],h=n[0]-i[0],l=n[1]-i[1];return s=(-a*(t[0]-i[0])+o*(t[1]-i[1]))/(-h*a+o*l),r=(h*(t[1]-i[1])-l*(t[0]-i[0]))/(-h*a+o*l),s>=0&&s<=1&&r>=0&&r<=1?r:-1}},{"../utils/Utils":57}],31:[function(t,e,i){var n=t("../math/vec2"),s=t("poly-decomp"),r=t("../shapes/Convex"),o=t("../collision/RaycastResult"),a=t("../collision/Ray"),h=t("../collision/AABB"),l=t("../events/EventEmitter");function c(t){t=t||{},l.call(this),this.id=t.id||++c._idCounter,this.world=null,this.shapes=[],this.mass=t.mass||0,this.invMass=0,this.inertia=0,this.invInertia=0,this.invMassSolve=0,this.invInertiaSolve=0,this.fixedRotation=!!t.fixedRotation,this.fixedX=!!t.fixedX,this.fixedY=!!t.fixedY,this.massMultiplier=n.create(),this.position=n.fromValues(0,0),t.position&&n.copy(this.position,t.position),this.interpolatedPosition=n.fromValues(0,0),this.interpolatedAngle=0,this.previousPosition=n.fromValues(0,0),this.previousAngle=0,this.velocity=n.fromValues(0,0),t.velocity&&n.copy(this.velocity,t.velocity),this.vlambda=n.fromValues(0,0),this.wlambda=0,this.angle=t.angle||0,this.angularVelocity=t.angularVelocity||0,this.force=n.create(),t.force&&n.copy(this.force,t.force),this.angularForce=t.angularForce||0,this.damping="number"==typeof t.damping?t.damping:.1,this.angularDamping="number"==typeof t.angularDamping?t.angularDamping:.1,this.type=c.STATIC,void 0!==t.type?this.type=t.type:t.mass?this.type=c.DYNAMIC:this.type=c.STATIC,this.boundingRadius=0,this.aabb=new h,this.aabbNeedsUpdate=!0,this.allowSleep=void 0===t.allowSleep||t.allowSleep,this.wantsToSleep=!1,this.sleepState=c.AWAKE,this.sleepSpeedLimit=void 0!==t.sleepSpeedLimit?t.sleepSpeedLimit:.2,this.sleepTimeLimit=void 0!==t.sleepTimeLimit?t.sleepTimeLimit:1,this.gravityScale=void 0!==t.gravityScale?t.gravityScale:1,this.collisionResponse=void 0===t.collisionResponse||t.collisionResponse,this.idleTime=0,this.timeLastSleepy=0,this.ccdSpeedThreshold=void 0!==t.ccdSpeedThreshold?t.ccdSpeedThreshold:-1,this.ccdIterations=void 0!==t.ccdIterations?t.ccdIterations:10,this.concavePath=null,this._wakeUpAfterNarrowphase=!1,this.updateMassProperties()}e.exports=c,c.prototype=new l,c.prototype.constructor=c,c._idCounter=0,c.prototype.updateSolveMassProperties=function(){this.sleepState===c.SLEEPING||this.type===c.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve=0):(this.invMassSolve=this.invMass,this.invInertiaSolve=this.invInertia)},c.prototype.setDensity=function(t){var e=this.getArea();this.mass=e*t,this.updateMassProperties()},c.prototype.getArea=function(){for(var t=0,e=0;ei&&(i=o+a)}this.boundingRadius=i},c.prototype.addShape=function(t,e,i){if(t.body)throw new Error("A shape can only be added to one body.");t.body=this,e?n.copy(t.position,e):n.set(t.position,0,0),t.angle=i||0,this.shapes.push(t),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},c.prototype.removeShape=function(t){var e=this.shapes.indexOf(t);return-1!==e&&(this.shapes.splice(e,1),this.aabbNeedsUpdate=!0,t.body=null,!0)},c.prototype.updateMassProperties=function(){if(this.type===c.STATIC||this.type===c.KINEMATIC)this.mass=Number.MAX_VALUE,this.invMass=0,this.inertia=Number.MAX_VALUE,this.invInertia=0;else{var t=this.shapes,e=t.length,i=this.mass/e,s=0;if(this.fixedRotation)this.inertia=Number.MAX_VALUE,this.invInertia=0;else{for(var r=0;r0?1/s:0}this.invMass=1/this.mass,n.set(this.massMultiplier,this.fixedX?0:1,this.fixedY?0:1)}},n.create(),c.prototype.applyForce=function(t,e){if(n.add(this.force,this.force,t),e){var i=n.crossLength(e,t);this.angularForce+=i}};var p=n.create(),f=n.create(),g=n.create();c.prototype.applyForceLocal=function(t,e){e=e||g;var i=p,n=f;this.vectorToWorldFrame(i,t),this.vectorToWorldFrame(n,e),this.applyForce(i,n)};var m=n.create();c.prototype.applyImpulse=function(t,e){if(this.type===c.DYNAMIC){var i=m;if(n.scale(i,t,this.invMass),n.multiply(i,this.massMultiplier,i),n.add(this.velocity,i,this.velocity),e){var s=n.crossLength(e,t);s*=this.invInertia,this.angularVelocity+=s}}};var y=n.create(),v=n.create(),b=n.create();c.prototype.applyImpulseLocal=function(t,e){e=e||b;var i=y,n=v;this.vectorToWorldFrame(i,t),this.vectorToWorldFrame(n,e),this.applyImpulse(i,n)},c.prototype.toLocalFrame=function(t,e){n.toLocalFrame(t,e,this.position,this.angle)},c.prototype.toWorldFrame=function(t,e){n.toGlobalFrame(t,e,this.position,this.angle)},c.prototype.vectorToLocalFrame=function(t,e){n.vectorToLocalFrame(t,e,this.angle)},c.prototype.vectorToWorldFrame=function(t,e){n.vectorToGlobalFrame(t,e,this.angle)},c.prototype.fromPolygon=function(t,e){e=e||{};for(var i=this.shapes.length;i>=0;--i)this.removeShape(this.shapes[i]);var o,a=new s.Polygon;if(a.vertices=t,a.makeCCW(),"number"==typeof e.removeCollinearPoints&&a.removeCollinearPoints(e.removeCollinearPoints),void 0===e.skipSimpleCheck&&!a.isSimple())return!1;for(this.concavePath=a.vertices.slice(0),i=0;i=Math.pow(this.sleepSpeedLimit,2)?(this.idleTime=0,this.sleepState=c.AWAKE):(this.idleTime+=i,this.sleepState=c.SLEEPY),this.idleTime>this.sleepTimeLimit&&(e?this.wantsToSleep=!0:this.sleep()))},c.prototype.overlaps=function(t){return this.world.overlapKeeper.bodiesAreOverlapping(this,t)};var T=n.create(),C=n.create();c.prototype.integrate=function(t){var e=this.invMass,i=this.force,s=this.position,r=this.velocity;n.copy(this.previousPosition,this.position),this.previousAngle=this.angle,this.fixedRotation||(this.angularVelocity+=this.angularForce*this.invInertia*t),n.scale(T,i,t*e),n.multiply(T,this.massMultiplier,T),n.add(r,T,r),this.integrateToTimeOfImpact(t)||(n.scale(C,r,t),n.add(s,s,C),this.fixedRotation||(this.angle+=this.angularVelocity*t)),this.aabbNeedsUpdate=!0};var S=new o,P=new a({mode:a.ALL}),A=n.create(),E=n.create(),M=n.create(),k=n.create();c.prototype.integrateToTimeOfImpact=function(t){if(this.ccdSpeedThreshold<0||n.squaredLength(this.velocity)=l&&h=0&&(s.rotate(p,u,n),s.scale(p,p,2*y-1),e.reportIntersection(t,x,p,-1),t.shouldStop(e)))return}var b=Math.pow(this.radius,2)+Math.pow(m,2);for(y=0;y<2;y++){s.set(f,m*(2*y-1),0),s.toGlobalFrame(f,f,i,n);var x,w=Math.pow(o[0]-r[0],2)+Math.pow(o[1]-r[1],2),_=2*((o[0]-r[0])*(r[0]-f[0])+(o[1]-r[1])*(r[1]-f[1])),T=Math.pow(r[0]-f[0],2)+Math.pow(r[1]-f[1],2)-Math.pow(this.radius,2);if(!((x=Math.pow(_,2)-4*w*T)<0))if(0===x){if(s.lerp(d,r,o,x),s.squaredDistance(d,i)>b&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,x,p,-1),t.shouldStop(e)))return}else{var C=Math.sqrt(x),S=1/(2*w),P=(-_-C)*S,A=(-_+C)*S;if(P>=0&&P<=1&&(s.lerp(d,r,o,P),s.squaredDistance(d,i)>b&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,P,p,-1),t.shouldStop(e))))return;if(A>=0&&A<=1&&(s.lerp(d,r,o,A),s.squaredDistance(d,i)>b&&(s.sub(p,d,f),s.normalize(p,p),e.reportIntersection(t,A,p,-1),t.shouldStop(e))))return}}}},{"../math/vec2":30,"./Shape":45}],39:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){"number"==typeof arguments[0]&&(t={radius:arguments[0]},console.warn("The Circle constructor signature has changed. Please use the following format: new Circle({ radius: 1 })")),t=t||{},this.radius=t.radius||1,t.type=n.CIRCLE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){var e=this.radius;return t*e*e/2},r.prototype.updateBoundingRadius=function(){this.boundingRadius=this.radius},r.prototype.updateArea=function(){this.area=Math.PI*this.radius*this.radius},r.prototype.computeAABB=function(t,e,i){var n=this.radius;s.set(t.upperBound,n,n),s.set(t.lowerBound,-n,-n),e&&(s.add(t.lowerBound,t.lowerBound,e),s.add(t.upperBound,t.upperBound,e))};var o=s.create(),a=s.create();r.prototype.raycast=function(t,e,i,n){var r=e.from,h=e.to,l=this.radius,c=Math.pow(h[0]-r[0],2)+Math.pow(h[1]-r[1],2),u=2*((h[0]-r[0])*(r[0]-i[0])+(h[1]-r[1])*(r[1]-i[1])),d=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2)-Math.pow(l,2),p=Math.pow(u,2)-4*c*d,f=o,g=a;if(!(p<0))if(0===p)s.lerp(f,r,h,p),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,p,g,-1);else{var m=Math.sqrt(p),y=1/(2*c),v=(-u-m)*y,b=(-u+m)*y;if(v>=0&&v<=1&&(s.lerp(f,r,h,v),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,v,g,-1),t.shouldStop(e)))return;b>=0&&b<=1&&(s.lerp(f,r,h,b),s.sub(g,f,i),s.normalize(g,g),e.reportIntersection(t,b,g,-1))}}},{"../math/vec2":30,"./Shape":45}],40:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2"),r=t("../math/polyk");function o(t){Array.isArray(arguments[0])&&(t={vertices:arguments[0],axes:arguments[1]},console.warn("The Convex constructor signature has changed. Please use the following format: new Convex({ vertices: [...], ... })")),t=t||{},this.vertices=[];for(var e=void 0!==t.vertices?t.vertices:[],i=0;ir)&&(r=n),(null===o||nr){var l=o;o=r,r=l}s.set(e,o,r)},o.prototype.projectOntoWorldAxis=function(t,e,i,n){var r=h;this.projectOntoLocalAxis(t,n),0!==i?s.rotate(r,t,i):r=t;var o=s.dot(e,r);s.set(n,n[0]+o,n[1]+o)},o.prototype.updateTriangles=function(){this.triangles.length=0;for(var t=[],e=0;ee&&(e=n)}this.boundingRadius=Math.sqrt(e)},o.triangleArea=function(t,e,i){return.5*((e[0]-t[0])*(i[1]-t[1])-(i[0]-t[0])*(e[1]-t[1]))},o.prototype.updateArea=function(){this.updateTriangles(),this.area=0;for(var t=this.triangles,e=this.vertices,i=0;i!==t.length;i++){var n=t[i],s=e[n[0]],r=e[n[1]],a=e[n[2]],h=o.triangleArea(s,r,a);this.area+=h}},o.prototype.computeAABB=function(t,e,i){t.setFromPoints(this.vertices,e,i,0)};var f=s.create(),g=s.create(),m=s.create();o.prototype.raycast=function(t,e,i,n){var r=f,o=g,a=m,h=this.vertices;s.toLocalFrame(r,e.from,i,n),s.toLocalFrame(o,e.to,i,n);for(var l=h.length,c=0;c=0&&(s.sub(a,d,u),s.rotate(a,a,-Math.PI/2+n),s.normalize(a,a),e.reportIntersection(t,p,a,c))}}},{"../math/polyk":29,"../math/vec2":30,"./Shape":45,"poly-decomp":5}],41:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){if(Array.isArray(arguments[0])){if(t={heights:arguments[0]},"object"==typeof arguments[1])for(var e in arguments[1])t[e]=arguments[1][e];console.warn("The Heightfield constructor signature has changed. Please use the following format: new Heightfield({ heights: [...], ... })")}t=t||{},this.heights=t.heights?t.heights.slice(0):[],this.maxValue=t.maxValue||null,this.minValue=t.minValue||null,this.elementWidth=t.elementWidth||.1,void 0!==t.maxValue&&void 0!==t.minValue||this.updateMaxMinValues(),t.type=n.HEIGHTFIELD,n.call(this,t)}t("../utils/Utils"),e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.updateMaxMinValues=function(){for(var t=this.heights,e=t[0],i=t[0],n=0;n!==t.length;n++){var s=t[n];s>e&&(e=s),sv){var b=y;y=v,v=b}for(var x=0;x=0&&(s.sub(d,f,p),s.rotate(d,d,n+Math.PI/2),s.normalize(d,d),e.reportIntersection(t,w,d,-1),t.shouldStop(e)))return}}},{"../math/vec2":30,"../utils/Utils":57,"./Shape":45}],42:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){"number"==typeof arguments[0]&&(t={length:arguments[0]},console.warn("The Line constructor signature has changed. Please use the following format: new Line({ length: 1, ... })")),t=t||{},this.length=t.length||1,t.type=n.LINE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return t*Math.pow(this.length,2)/12},r.prototype.updateBoundingRadius=function(){this.boundingRadius=this.length/2};var o=[s.create(),s.create()];r.prototype.computeAABB=function(t,e,i){var n=this.length/2;s.set(o[0],-n,0),s.set(o[1],n,0),t.setFromPoints(o,e,i,0)},s.create();var a=s.create(),h=s.create(),l=s.create(),c=s.fromValues(0,1);r.prototype.raycast=function(t,e,i,n){var r=e.from,o=e.to,u=h,d=l,p=this.length/2;s.set(u,-p,0),s.set(d,p,0),s.toGlobalFrame(u,u,i,n),s.toGlobalFrame(d,d,i,n);var f=s.getLineSegmentsIntersectionFraction(u,d,r,o);if(f>=0){var g=a;s.rotate(g,c,n),e.reportIntersection(t,f,g,-1)}}},{"../math/vec2":30,"./Shape":45}],43:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){(t=t||{}).type=n.PARTICLE,n.call(this,t)}e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return 0},r.prototype.updateBoundingRadius=function(){this.boundingRadius=0},r.prototype.computeAABB=function(t,e,i){s.copy(t.lowerBound,e),s.copy(t.upperBound,e)}},{"../math/vec2":30,"./Shape":45}],44:[function(t,e,i){var n=t("./Shape"),s=t("../math/vec2");function r(t){(t=t||{}).type=n.PLANE,n.call(this,t)}t("../utils/Utils"),e.exports=r,r.prototype=new n,r.prototype.constructor=r,r.prototype.computeMomentOfInertia=function(t){return 0},r.prototype.updateBoundingRadius=function(){this.boundingRadius=Number.MAX_VALUE},r.prototype.computeAABB=function(t,e,i){var n=i%(2*Math.PI),r=s.set,o=1e7,a=t.lowerBound,h=t.upperBound;r(a,-o,-o),r(h,o,o),0===n?h[1]=0:n===Math.PI/2?a[0]=0:n===Math.PI?a[1]=0:n===3*Math.PI/2&&(h[0]=0)},r.prototype.updateArea=function(){this.area=Number.MAX_VALUE};var o=s.create(),a=(s.create(),s.create(),s.create()),h=s.create();r.prototype.raycast=function(t,e,i,n){var r=e.from,l=e.to,c=e.direction,u=o,d=a,p=h;s.set(d,0,1),s.rotate(d,d,n),s.sub(p,r,i);var f=s.dot(p,d);if(s.sub(p,l,i),!(f*s.dot(p,d)>0||s.squaredDistance(r,l)p*a&&(g=p*a-u),r[t]+=g,e.addToWlambda(g),g}},{"../equations/FrictionEquation":23,"../math/vec2":30,"../utils/Utils":57,"./Solver":47}],47:[function(t,e,i){t("../utils/Utils");var n=t("../events/EventEmitter");function s(t,e){t=t||{},n.call(this),this.type=e,this.equations=[],this.equationSortFunction=t.equationSortFunction||!1}e.exports=s,s.prototype=new n,s.prototype.constructor=s,s.prototype.solve=function(t,e){throw new Error("Solver.solve should be implemented by subclasses!")};var r={bodies:[]};s.prototype.solveIsland=function(t,e){this.removeAllEquations(),e.equations.length&&(this.addEquations(e.equations),r.bodies.length=0,e.getBodies(r.bodies),r.bodies.length&&this.solve(t,r))},s.prototype.sortEquations=function(){this.equationSortFunction&&this.equations.sort(this.equationSortFunction)},s.prototype.addEquation=function(t){t.enabled&&this.equations.push(t)},s.prototype.addEquations=function(t){for(var e=0,i=t.length;e!==i;e++){var n=t[e];n.enabled&&this.equations.push(n)}},s.prototype.removeEquation=function(t){var e=this.equations.indexOf(t);-1!==e&&this.equations.splice(e,1)},s.prototype.removeAllEquations=function(){this.equations.length=0},s.GS=1,s.ISLAND=2},{"../events/EventEmitter":26,"../utils/Utils":57}],48:[function(t,e,i){var n=t("../equations/ContactEquation"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=null,this}},{"../equations/ContactEquation":21,"./Pool":55}],49:[function(t,e,i){var n=t("../equations/FrictionEquation"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=null,this}},{"../equations/FrictionEquation":23,"./Pool":55}],50:[function(t,e,i){var n=t("../world/IslandNode"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.reset(),this}},{"../world/IslandNode":60,"./Pool":55}],51:[function(t,e,i){var n=t("../world/Island"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.reset(),this}},{"../world/Island":58,"./Pool":55}],52:[function(t,e,i){var n=t("./TupleDictionary"),s=(t("./OverlapKeeperRecord"),t("./OverlapKeeperRecordPool"));function r(){this.overlappingShapesLastState=new n,this.overlappingShapesCurrentState=new n,this.recordPool=new s({size:16}),this.tmpDict=new n,this.tmpArray1=[]}t("./Utils"),e.exports=r,r.prototype.tick=function(){for(var t=this.overlappingShapesLastState,e=this.overlappingShapesCurrentState,i=t.keys.length;i--;){var n=t.keys[i],s=t.getByKey(n);e.getByKey(n),s&&this.recordPool.release(s)}t.reset(),t.copy(e),e.reset()},r.prototype.setOverlapping=function(t,e,i,n){this.overlappingShapesLastState;var s=this.overlappingShapesCurrentState;if(!s.get(e.id,n.id)){var r=this.recordPool.get();r.set(t,e,i,n),s.set(e.id,n.id,r)}},r.prototype.getNewOverlaps=function(t){return this.getDiff(this.overlappingShapesLastState,this.overlappingShapesCurrentState,t)},r.prototype.getEndOverlaps=function(t){return this.getDiff(this.overlappingShapesCurrentState,this.overlappingShapesLastState,t)},r.prototype.bodiesAreOverlapping=function(t,e){for(var i=this.overlappingShapesCurrentState,n=i.keys.length;n--;){var s=i.keys[n],r=i.data[s];if(r.bodyA===t&&r.bodyB===e||r.bodyA===e&&r.bodyB===t)return!0}return!1},r.prototype.getDiff=function(t,e,i){var n=t,s=e;(i=i||[]).length=0;for(var r=s.keys.length;r--;){var o=s.keys[r],a=s.data[o];if(!a)throw new Error("Key "+o+" had no data!");n.data[o]||i.push(a)}return i},r.prototype.isNewOverlap=function(t,e){var i=0|t.id,n=0|e.id,s=this.overlappingShapesLastState,r=this.overlappingShapesCurrentState;return!s.get(i,n)&&!!r.get(i,n)},r.prototype.getNewBodyOverlaps=function(t){this.tmpArray1.length=0;var e=this.getNewOverlaps(this.tmpArray1);return this.getBodyDiff(e,t)},r.prototype.getEndBodyOverlaps=function(t){this.tmpArray1.length=0;var e=this.getEndOverlaps(this.tmpArray1);return this.getBodyDiff(e,t)},r.prototype.getBodyDiff=function(t,e){e=e||[];for(var i=this.tmpDict,n=t.length;n--;){var s=t[n];i.set(0|s.bodyA.id,0|s.bodyB.id,s)}for(n=i.keys.length;n--;)(s=i.getByKey(i.keys[n]))&&e.push(s.bodyA,s.bodyB);return i.reset(),e}},{"./OverlapKeeperRecord":53,"./OverlapKeeperRecordPool":54,"./TupleDictionary":56,"./Utils":57}],53:[function(t,e,i){function n(t,e,i,n){this.shapeA=e,this.shapeB=n,this.bodyA=t,this.bodyB=i}e.exports=n,n.prototype.set=function(t,e,i,s){n.call(this,t,e,i,s)}},{}],54:[function(t,e,i){var n=t("./OverlapKeeperRecord"),s=t("./Pool");function r(){s.apply(this,arguments)}e.exports=r,r.prototype=new s,r.prototype.constructor=r,r.prototype.create=function(){return new n},r.prototype.destroy=function(t){return t.bodyA=t.bodyB=t.shapeA=t.shapeB=null,this}},{"./OverlapKeeperRecord":53,"./Pool":55}],55:[function(t,e,i){function n(t){t=t||{},this.objects=[],void 0!==t.size&&this.resize(t.size)}e.exports=n,n.prototype.resize=function(t){for(var e=this.objects;e.length>t;)e.pop();for(;e.length(0|e)?t<<16|65535&e:e<<16|65535&t)},s.prototype.getByKey=function(t){return t|=0,this.data[t]},s.prototype.get=function(t,e){return this.data[this.getKey(t,e)]},s.prototype.set=function(t,e,i){if(!i)throw new Error("No data!");var n=this.getKey(t,e);return this.data[n]||this.keys.push(n),this.data[n]=i,n},s.prototype.reset=function(){for(var t=this.data,e=this.keys,i=e.length;i--;)delete t[e[i]];e.length=0},s.prototype.copy=function(t){this.reset(),n.appendArray(this.keys,t.keys);for(var e=t.keys.length;e--;){var i=t.keys[e];this.data[i]=t.data[i]}}},{"./Utils":57}],57:[function(t,e,i){function n(){}e.exports=n,n.appendArray=function(t,e){if(e.length<15e4)t.push.apply(t,e);else for(var i=0,n=e.length;i!==n;++i)t.push(e[i])},n.splice=function(t,e,i){i=i||1;for(var n=e,s=t.length-i;n=t&&n=0;m-=2)for(var S=_.length-2;S>=0;S-=2)(T[m]===_[S]&&T[m+1]===_[S+1]||T[m+1]===_[S]&&T[m]===_[S+1])&&_.splice(S,2);var P=c.length;for(m=0;m!==P;m++){var A=c[m];if(!A.collideConnected)for(S=_.length-2;S>=0;S-=2)(A.bodyA===_[S]&&A.bodyB===_[S+1]||A.bodyB===_[S]&&A.bodyA===_[S+1])&&_.splice(S,2)}this.postBroadphaseEvent.pairs=_,this.emit(this.postBroadphaseEvent),this.postBroadphaseEvent.pairs=null,l.reset(this),m=0;for(var E=_.length;m!==E;m+=2)for(var M=_[m],k=_[m+1],L=0,O=M.shapes.length;L!==O;L++)for(var I=M.shapes[L],B=I.position,R=I.angle,F=0,D=k.shapes.length;F!==D;F++){var U=k.shapes[F],G=U.position,N=U.angle,j=this.defaultContactMaterial;if(I.material&&U.material){var W=this.getContactMaterial(I.material,U.material);W&&(j=W)}this.runNarrowphase(l,M,I,B,R,k,U,G,N,j,this.frictionGravity)}for(m=0;m!==a;m++)(q=n[m])._wakeUpAfterNarrowphase&&(q.wakeUp(),q._wakeUpAfterNarrowphase=!1);if(this.has("endContact")){this.overlapKeeper.getEndOverlaps(C);var X=this.endContactEvent;for(F=C.length;F--;){var V=C[F];X.shapeA=V.shapeA,X.shapeB=V.shapeB,X.bodyA=V.bodyA,X.bodyB=V.bodyB,this.emit(X)}C.length=0}var H=this.preSolveEvent;for(H.contactEquations=l.contactEquations,H.frictionEquations=l.frictionEquations,this.emit(H),H.contactEquations=H.frictionEquations=null,P=c.length,m=0;m!==P;m++)c[m].update();if(l.contactEquations.length||l.frictionEquations.length||P)if(this.islandSplit){for(f.equations.length=0,y.appendArray(f.equations,l.contactEquations),y.appendArray(f.equations,l.frictionEquations),m=0;m!==P;m++)y.appendArray(f.equations,c[m].equations);for(f.split(this),m=0;m!==f.islands.length;m++)(K=f.islands[m]).equations.length&&o.solveIsland(t,K)}else{for(o.addEquations(l.contactEquations),o.addEquations(l.frictionEquations),m=0;m!==P;m++)o.addEquations(c[m].equations);this.solveConstraints&&o.solve(t,this),o.removeAllEquations()}for(m=0;m!==a;m++){var q;(q=n[m]).integrate(t)}for(m=0;m!==a;m++)n[m].setZeroForce();if(this.emitImpactEvent&&this.has("impact")){var Y=this.impactEvent;for(m=0;m!==l.contactEquations.length;m++){var z=l.contactEquations[m];z.firstImpact&&(Y.bodyA=z.bodyA,Y.bodyB=z.bodyB,Y.shapeA=z.shapeA,Y.shapeB=z.shapeB,Y.contactEquation=z,this.emit(Y))}}if(this.sleepMode===x.BODY_SLEEPING)for(m=0;m!==a;m++)n[m].sleepTick(this.time,!1,t);else if(this.sleepMode===x.ISLAND_SLEEPING&&this.islandSplit){for(m=0;m!==a;m++)n[m].sleepTick(this.time,!0,t);for(m=0;m0,t.frictionCoefficient=c.friction,p=e.type===u.STATIC||e.type===u.KINEMATIC?o.mass:o.type===u.STATIC||o.type===u.KINEMATIC?e.mass:e.mass*o.mass/(e.mass+o.mass),t.slipForce=c.friction*d*p,t.restitution=c.restitution,t.surfaceVelocity=c.surfaceVelocity,t.frictionStiffness=c.frictionStiffness,t.frictionRelaxation=c.frictionRelaxation,t.stiffness=c.stiffness,t.relaxation=c.relaxation,t.contactSkinSize=c.contactSkinSize,t.enabledEquations=e.collisionResponse&&o.collisionResponse&&i.collisionResponse&&a.collisionResponse;var m=t[i.type|a.type],y=0;if(m){var v=i.sensor||a.sensor,b=t.frictionEquations.length;y=i.type=2*Math.pow(o.sleepSpeedLimit,2)&&(e._wakeUpAfterNarrowphase=!0),o.allowSleep&&o.type===u.DYNAMIC&&o.sleepState===u.SLEEPING&&e.sleepState===u.AWAKE&&e.type!==u.STATIC&&s.squaredLength(e.velocity)+Math.pow(e.angularVelocity,2)>=2*Math.pow(e.sleepSpeedLimit,2)&&(o._wakeUpAfterNarrowphase=!0),this.overlapKeeper.setOverlapping(e,i,o,a),this.has("beginContact")&&this.overlapKeeper.isNewOverlap(i,a)){var w=this.beginContactEvent;if(w.shapeA=i,w.shapeB=a,w.bodyA=e,w.bodyB=o,w.contactEquations.length=0,"number"==typeof y)for(var C=t.contactEquations.length-y;C1)for(C=t.frictionEquations.length-x;C=0;e--)this.removeConstraint(t[e]);var i=this.bodies;for(e=i.length-1;e>=0;e--)this.removeBody(i[e]);var n=this.springs;for(e=n.length-1;e>=0;e--)this.removeSpring(n[e]);var s=this.contactMaterials;for(e=s.length-1;e>=0;e--)this.removeContactMaterial(s[e]);x.apply(this)};var S=s.create(),P=(s.fromValues(0,0),s.fromValues(0,0));x.prototype.hitTest=function(t,e,i){i=i||0;var n=new u({position:t}),c=new l,d=t,p=0,f=S,g=P;n.addShape(c);for(var m=this.narrowphase,y=[],v=0,b=e.length;v!==b;v++)for(var x=e[v],w=0,_=x.shapes.length;w!==_;w++){var T=x.shapes[w];s.rotate(f,T.position,x.angle),s.add(f,f,x.position);var C=T.angle+x.angle;(T instanceof r&&m.circleParticle(x,T,f,C,n,c,d,p,!0)||T instanceof o&&m.particleConvex(n,c,d,p,x,T,f,C,!0)||T instanceof a&&m.particlePlane(n,c,d,p,x,T,f,C,!0)||T instanceof h&&m.particleCapsule(n,c,d,p,x,T,f,C,!0)||T instanceof l&&s.squaredLength(s.sub(g,f,t)) +* @copyright 2020 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser-ce/blob/master/license.txt|MIT License} +* +* @overview +* +* Phaser CE - https://github.com/photonstorm/phaser-ce +* +* v2.16.0 "2020-06-01" - Built: Mon Jun 01 2020 11:17:47 +* +* By Richard Davey http://www.photonstorm.com @photonstorm and Phaser CE contributors +* +* Phaser - http://phaser.io +*/ +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +(function(){var i,n=n||{VERSION:"2.16.0",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,HEADLESS:3,WEBGL_MULTI:4,NONE:0,LEFT:1,RIGHT:2,UP:3,DOWN:4,SPRITE:0,BUTTON:1,IMAGE:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11,POLYGON:12,BITMAPDATA:13,CANVAS_FILTER:14,WEBGL_FILTER:15,ELLIPSE:16,SPRITEBATCH:17,RETROFONT:18,POINTER:19,ROPE:20,CIRCLE:21,RECTANGLE:22,LINE:23,MATRIX:24,POINT:25,ROUNDEDRECTANGLE:26,CREATURE:27,VIDEO:28,PENDING_ATLAS:-1,HORIZONTAL:0,VERTICAL:1,LANDSCAPE:0,PORTRAIT:1,ANGLE_UP:270,ANGLE_DOWN:90,ANGLE_LEFT:180,ANGLE_RIGHT:0,ANGLE_NORTH_EAST:315,ANGLE_NORTH_WEST:225,ANGLE_SOUTH_EAST:45,ANGLE_SOUTH_WEST:135,TOP_LEFT:0,TOP_CENTER:1,TOP_RIGHT:2,LEFT_TOP:3,LEFT_CENTER:4,LEFT_BOTTOM:5,CENTER:6,RIGHT_TOP:7,RIGHT_CENTER:8,RIGHT_BOTTOM:9,BOTTOM_LEFT:10,BOTTOM_CENTER:11,BOTTOM_RIGHT:12,blendModes:{NORMAL:0,ADD:1,MULTIPLY:2,SCREEN:3,OVERLAY:4,DARKEN:5,LIGHTEN:6,COLOR_DODGE:7,COLOR_BURN:8,HARD_LIGHT:9,SOFT_LIGHT:10,DIFFERENCE:11,EXCLUSION:12,HUE:13,SATURATION:14,COLOR:15,LUMINOSITY:16},scaleModes:{DEFAULT:0,LINEAR:0,NEAREST:1},PIXI:PIXI||{},_UID:0}; +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */if( +/** + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +"undefined"!=typeof AudioBufferSourceNode&&(AudioBufferSourceNode.prototype.start||(AudioBufferSourceNode.prototype.start=AudioBufferSourceNode.prototype.noteGrainOn),AudioBufferSourceNode.prototype.stop||(AudioBufferSourceNode.prototype.stop=AudioBufferSourceNode.prototype.noteOff)),Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Function.prototype.bind||(Function.prototype.bind=(i=Array.prototype.slice,function(t){var e=this,n=i.call(arguments,1);if("function"!=typeof e)throw new TypeError;function s(){var r=n.concat(i.call(arguments));e.apply(this instanceof s?this:t,r)}return s.prototype=function t(e){if(e&&(t.prototype=e),!(this instanceof t))return new t}(e.prototype),s})),Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),Array.prototype.forEach||(Array.prototype.forEach=function(t){"use strict";if(null==this)throw new TypeError;var e=Object(this),i=e.length>>>0;if("function"!=typeof t)throw new TypeError;for(var n=arguments.length>=2?arguments[1]:void 0,s=0;s + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */,n.Utils={defaults:function(t,e){for(var i=Object.keys(e),n=0,s=i.length;n0&&100*Math.random()<=t},randomChoice:function(t,e){return Math.random()<.5?t:e},parseDimension:function(t,e){var i=0,n=0;return"string"==typeof t?"%"===t.substr(-1)?(i=parseInt(t,10)/100,n=0===e?window.innerWidth*i:window.innerHeight*i):n=parseInt(t,10):n=t,n},pad:function(t,e,i,n){if(void 0===e)e=0;if(void 0===i)i=" ";if(void 0===n)n=3;var s=0;if(e+1>=(t=t.toString()).length)switch(n){case 1:t=new Array(e+1-t.length).join(i)+t;break;case 3:var r=Math.ceil((s=e-t.length)/2);t=new Array(s-r+1).join(i)+t+new Array(r+1).join(i);break;default:t+=new Array(e+1-t.length).join(i)}return t},isPlainObject:function(t){if("object"!=typeof t||t.nodeType||t===t.window)return!1;try{if(t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(t){return!1}return!0},extend:function(){var t,e,i,s,r,o,a=arguments[0]||{},h=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},h=2),l===h&&(a=this,--h);h + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Circle=function(t,e,i){t=t||0,e=e||0,i=i||0,this.x=t,this.y=e,this._diameter=i,this._radius=0,i>0&&(this._radius=.5*i),this.type=n.CIRCLE},n.Circle.prototype={circumference:function(){return Math.PI*this._radius*2},random:function(t){void 0===t&&(t=new n.Point);var e=2*Math.PI*Math.random(),i=Math.random()+Math.random(),s=i>1?2-i:i,r=s*Math.cos(e),o=s*Math.sin(e);return t.x=this.x+r*this.radius,t.y=this.y+o*this.radius,t},getBounds:function(){return new n.Rectangle(this.x-this.radius,this.y-this.radius,this.diameter,this.diameter)},setTo:function(t,e,i){return this.x=t,this.y=e,this._diameter=i,this._radius=.5*i,this},copyFrom:function(t){return this.setTo(t.x,t.y,t.diameter)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.diameter=this._diameter,t},distance:function(t,e){var i=n.Math.distance(this.x,this.y,t.x,t.y);return e?Math.round(i):i},clone:function(t){return null==t?t=new n.Circle(this.x,this.y,this.diameter):t.setTo(this.x,this.y,this.diameter),t},contains:function(t,e){return n.Circle.contains(this,t,e)},circumferencePoint:function(t,e,i){return n.Circle.circumferencePoint(this,t,e,i)},sample:function(t,e,i,s,r){t||(t=60),null==e&&(e=0),null==i&&(i=n.Math.PI2),r||(r=[]);for(var o=0;o0&&(this._diameter=t,this._radius=.5*t)}}),Object.defineProperty(n.Circle.prototype,"radius",{get:function(){return this._radius},set:function(t){t>0&&(this._radius=t,this._diameter=2*t)}}),Object.defineProperty(n.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(t){t>this.x?(this._radius=0,this._diameter=0):this.radius=this.x-t}}),Object.defineProperty(n.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(t){tthis.y?(this._radius=0,this._diameter=0):this.radius=this.y-t}}),Object.defineProperty(n.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(t){t0?Math.PI*this._radius*this._radius:0}}),Object.defineProperty(n.Circle.prototype,"empty",{get:function(){return 0===this._diameter},set:function(t){!0===t&&this.setTo(0,0,0)}}),n.Circle.contains=function(t,e,i){return t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius},n.Circle.equals=function(t,e){return t.x===e.x&&t.y===e.y&&t.diameter===e.diameter},n.Circle.intersects=function(t,e){return n.Math.distance(t.x,t.y,e.x,e.y)<=t.radius+e.radius},n.Circle.circumferencePoint=function(t,e,i,s){return void 0===i&&(i=!1),void 0===s&&(s=new n.Point),!0===i&&(e=n.Math.degToRad(e)),s.x=t.x+t.radius*Math.cos(e),s.y=t.y+t.radius*Math.sin(e),s},n.Circle.intersectsRectangle=function(t,e){var i=Math.abs(t.x-e.x-e.halfWidth);if(i>e.halfWidth+t.radius)return!1;var n=Math.abs(t.y-e.y-e.halfHeight);if(n>e.halfHeight+t.radius)return!1;if(i<=e.halfWidth||n<=e.halfHeight)return!0;var s=i-e.halfWidth,r=n-e.halfHeight;return s*s+r*r<=t.radius*t.radius},n.Circle.intersectsLine=function(t,e,i){var s=t.x,r=t.y,o=(e.end.y-e.start.y)/(e.end.x-e.start.x),a=e.end.y-o*e.end.x,h=t.radius,l=t.radius,c=a+o*s,u=(s*(l*l)-o*(h*h)*(a-r)+h*l*Math.sqrt(h*h*(o*o)+l*l-c*c-r*r+2*c*r))/(h*h*(o*o)+l*l),d=(s*(l*l)-o*(h*h)*(a-r)-h*l*Math.sqrt(h*h*(o*o)+l*l-c*c-r*r+2*c*r))/(h*h*(o*o)+l*l),p=o*u+a,f=o*d+a,g=new n.Point(u,p),m=new n.Point(d,f),y=e.pointOnSegment(g.x,g.y,.01),v=e.pointOnSegment(m.x,m.y,.01);return y&&v?!i||[g,m]:y?!i||[g]:v?!i||[m]:!!i&&[]},PIXI.Circle=n.Circle, +/** + * @author Richard Davey + * @author Chad Engler + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Ellipse=function(t,e,i,s){t=t||0,e=e||0,i=i||0,s=s||0,this.x=t,this.y=e,this.width=i,this.height=s,this.type=n.ELLIPSE},n.Ellipse.prototype={setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},getBounds:function(){return new n.Rectangle(this.x-this.width,this.y-this.height,this.width,this.height)},copyFrom:function(t){return this.setTo(t.x,t.y,t.width,t.height)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},clone:function(t){return null==t?t=new n.Ellipse(this.x,this.y,this.width,this.height):t.setTo(this.x,this.y,this.width,this.height),t},contains:function(t,e){return n.Ellipse.contains(this,t,e)},random:function(t){void 0===t&&(t=new n.Point);var e=Math.random()*Math.PI*2,i=Math.sqrt(Math.random());return t.x=this.centerX+.5*i*Math.cos(e)*this.width,t.y=this.centerY+.5*i*Math.sin(e)*this.height,t},toString:function(){return"[{Phaser.Ellipse (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+")}]"}},n.Ellipse.prototype.constructor=n.Ellipse,Object.defineProperty(n.Ellipse.prototype,"left",{get:function(){return this.x},set:function(t){this.x=t}}),Object.defineProperty(n.Ellipse.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Line=function(t,e,i,s){t=t||0,e=e||0,i=i||0,s=s||0,this.start=new n.Point(t,e),this.end=new n.Point(i,s),this.type=n.LINE},n.Line.prototype={setTo:function(t,e,i,n){return this.start.setTo(t,e),this.end.setTo(i,n),this},fromPoints:function(t,e){return this.setTo(t.x,t.y,e.x,e.y),this},fromSprite:function(t,e,i){return void 0===i&&(i=!1),i?this.setTo(t.centerX,t.centerY,e.centerX,e.centerY):this.fromPoints(t,e)},fromAngle:function(t,e,i,n){return this.start.setTo(t,e),this.end.setTo(t+Math.cos(i)*n,e+Math.sin(i)*n),this},rotate:function(t,e){var i=(this.start.x+this.end.x)/2,n=(this.start.y+this.end.y)/2;return this.start.rotate(i,n,t,e),this.end.rotate(i,n,t,e),this},rotateAround:function(t,e,i,n){return this.start.rotate(t,e,i,n),this.end.rotate(t,e,i,n),this},intersects:function(t,e,i){return n.Line.intersectsPoints(this.start,this.end,t.start,t.end,e,i)},reflect:function(t){return n.Line.reflect(this,t)},midPoint:function(t){return void 0===t&&(t=new n.Point),t.x=(this.start.x+this.end.x)/2,t.y=(this.start.y+this.end.y)/2,t},centerOn:function(t,e){var i=t-(this.start.x+this.end.x)/2,n=e-(this.start.y+this.end.y)/2;this.start.add(i,n),this.end.add(i,n)},pointOnLine:function(t,e,i){return n.Math.fuzzyEqual((t-this.start.x)*(this.end.y-this.start.y),(this.end.x-this.start.x)*(e-this.start.y),i||0)},pointOnSegment:function(t,e,i){var n=Math.min(this.start.x,this.end.x),s=Math.max(this.start.x,this.end.x),r=Math.min(this.start.y,this.end.y),o=Math.max(this.start.y,this.end.y);return this.pointOnLine(t,e,i)&&t>=n&&t<=s&&e>=r&&e<=o},random:function(t){void 0===t&&(t=new n.Point);var e=Math.random();return t.x=this.start.x+e*(this.end.x-this.start.x),t.y=this.start.y+e*(this.end.y-this.start.y),t},coordinatesOnLine:function(t,e){void 0===t&&(t=1),void 0===e&&(e=[]);var i=Math.round(this.start.x),n=Math.round(this.start.y),s=Math.round(this.end.x),r=Math.round(this.end.y),o=Math.abs(s-i),a=Math.abs(r-n),h=i-a&&(c-=a,i+=h),d=0&&g<=1&&m>=0&&m<=1?o:null}return o},n.Line.intersects=function(t,e,i,s){return n.Line.intersectsPoints(t.start,t.end,e.start,e.end,i,s)},n.Line.intersectsRectangle=function(t,e){if(0===t.length||e.empty)return!1;var i=t.start.x,n=t.start.y,s=t.end.x,r=t.end.y,o=e.x,a=e.y,h=e.right,l=e.bottom,c=0;if(i>=o&&i<=h&&n>=a&&n<=l||s>=o&&s<=h&&r>=a&&r<=l)return!0;if(i=o){if((c=n+(r-n)*(o-i)/(s-i))>a&&c<=l)return!0}else if(i>h&&s<=h&&(c=n+(r-n)*(h-i)/(s-i))>=a&&c<=l)return!0;if(n=a){if((c=i+(s-i)*(a-n)/(r-n))>=o&&c<=h)return!0}else if(n>l&&r<=l&&(c=i+(s-i)*(l-n)/(r-n))>=o&&c<=h)return!0;return!1},n.Line.intersectionWithRectangle=function(t,e,i){var s=n.Line.intersectionWithRectangle;i||(i=new n.Point),s.edges||(s.edges=[new n.Line,new n.Line,new n.Line,new n.Line]),s.edgeIntersection||(s.edgeIntersection=new n.Point);var r=s.edges,o=s.edgeIntersection.set(0),a=e.x,h=e.y,l=e.right,c=e.bottom,u=1/0;r[0].setTo(a,h,l,h),r[1].setTo(a,c,l,c),r[2].setTo(a,h,a,c),r[3].setTo(l,h,l,c);for(var d,p=0;d=r[p];p++)if(t.intersects(d,!0,o)){var f=t.start.distance(o);f + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Matrix=function(t,e,i,s,r,o){null==t&&(t=1),null==e&&(e=0),null==i&&(i=0),null==s&&(s=1),null==r&&(r=0),null==o&&(o=0),this.a=t,this.b=e,this.c=i,this.d=s,this.tx=r,this.ty=o,this.type=n.MATRIX},n.Matrix.prototype={fromArray:function(t){return this.setTo(t[0],t[1],t[3],t[4],t[2],t[5])},setTo:function(t,e,i,n,s,r){return this.a=t,this.b=e,this.c=i,this.d=n,this.tx=s,this.ty=r,this},clone:function(t){return null==t?t=new n.Matrix(this.a,this.b,this.c,this.d,this.tx,this.ty):(t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty),t},copyTo:function(t){return t.copyFrom(this),t},copyFrom:function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},toArray:function(t,e){return void 0===e&&(e=new Float32Array(9)),t?(e[0]=this.a,e[1]=this.b,e[2]=0,e[3]=this.c,e[4]=this.d,e[5]=0,e[6]=this.tx,e[7]=this.ty,e[8]=1):(e[0]=this.a,e[1]=this.c,e[2]=this.tx,e[3]=this.b,e[4]=this.d,e[5]=this.ty,e[6]=0,e[7]=0,e[8]=1),e},apply:function(t,e){return void 0===e&&(e=new n.Point),e.x=this.a*t.x+this.c*t.y+this.tx,e.y=this.b*t.x+this.d*t.y+this.ty,e},applyInverse:function(t,e){void 0===e&&(e=new n.Point);var i=1/(this.a*this.d+this.c*-this.b),s=t.x,r=t.y;return e.x=this.d*i*s+-this.c*i*r+(this.ty*this.c-this.tx*this.d)*i,e.y=this.a*i*r+-this.b*i*s+(-this.ty*this.a+this.tx*this.b)*i,e},translate:function(t,e){return this.tx+=t,this.ty+=e,this},scale:function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=this.a,s=this.c,r=this.tx;return this.a=n*e-this.b*i,this.b=n*i+this.b*e,this.c=s*e-this.d*i,this.d=s*i+this.d*e,this.tx=r*e-this.ty*i,this.ty=r*i+this.ty*e,this},append:function(t){var e=this.a,i=this.b,n=this.c,s=this.d;return this.a=t.a*e+t.b*n,this.b=t.a*i+t.b*s,this.c=t.c*e+t.d*n,this.d=t.c*i+t.d*s,this.tx=t.tx*e+t.ty*n+this.tx,this.ty=t.tx*i+t.ty*s+this.ty,this},identity:function(){return this.setTo(1,0,0,1,0,0)}},n.identityMatrix=new n.Matrix, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Point=function(t,e){t=t||0,e=e||0,this.x=t,this.y=e,this.type=n.POINT},n.Point.prototype={copyFrom:function(t){return this.setTo(t.x,t.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(t,e){return n.Point.set(this,t,e)},set:function(t,e){return n.Point.set(this,t,e)},setToPolar:function(t,e,i){return null==e&&(e=1),i&&(t=n.Math.degToRad(t)),this.setTo(Math.cos(t)*e,Math.sin(t)*e)},add:function(t,e){return this.x+=t,this.y+=e,this},subtract:function(t,e){return this.x-=t,this.y-=e,this},multiply:function(t,e){return this.x*=t,this.y*=e,this},divide:function(t,e){return this.x/=t,this.y/=e,this},clampX:function(t,e){return this.x=n.Math.clamp(this.x,t,e),this},clampY:function(t,e){return this.y=n.Math.clamp(this.y,t,e),this},clamp:function(t,e){return this.x=n.Math.clamp(this.x,t,e),this.y=n.Math.clamp(this.y,t,e),this},clip:function(t){var e=t.left,i=t.top,n=t.right,s=t.bottom;return this.xn&&(this.x=n),this.ys&&(this.y=s),this},clone:function(t){return null==t?t=new n.Point(this.x,this.y):t.setTo(this.x,this.y),t},copyTo:function(t){return t.x=this.x,t.y=this.y,t},distance:function(t,e){return n.Point.distance(this,t,e)},equals:function(t){return t.x===this.x&&t.y===this.y},equalsXY:function(t,e){return this.x===t&&this.y===e},fuzzyEquals:function(t,e){return n.Point.fuzzyEquals(this,t,e)},fuzzyEqualsXY:function(t,e,i){return n.Point.fuzzyEqualsXY(this,t,e,i)},angle:function(t,e){return this.angleXY(t.x,t.y,e)},angleXY:function(t,e,i){var s=Math.atan2(e-this.y,t-this.x);return i?n.Math.radToDeg(s):s},atan:function(t){var e=Math.atan2(this.y,this.x);return t?n.Math.radToDeg(e):e},rotate:function(t,e,i,s,r){return n.Point.rotate(this,t,e,i,s,r)},getMagnitude:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},getMagnitudeSq:function(){return this.x*this.x+this.y*this.y},setMagnitude:function(t){return this.normalize().multiply(t,t)},normalize:function(){if(!this.isZero()){var t=this.getMagnitude();this.x/=t,this.y/=t}return this},limit:function(t){return this.getMagnitudeSq()>t*t&&this.setMagnitude(t),this},expand:function(t){return this.getMagnitudeSq()=0&&e.x-i<0)return-1;if(t.x-i<0&&e.x-i>=0)return 1;if(t.x-i==0&&e.x-i==0)return t.y-n>=0||e.y-n>=0?t.y>e.y?1:-1:e.y>t.y?1:-1;var s=(t.x-i)*-(e.y-n)-(e.x-i)*-(t.y-n);return s<0?-1:s>0?1:(t.x-i)*(t.x-i)+(t.y-n)*(t.y-n)>(e.x-i)*(e.x-i)+(e.y-n)*(e.y-n)?-1:1}))},PIXI.Point=n.Point, +/** + * @author Richard Davey + * @author Adrien Brault + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Polygon=function(){this.area=0,this._points=[],arguments.length>0&&this.setTo.apply(this,arguments),this.closed=!0,this.flattened=!1,this.type=n.POLYGON},n.Polygon.prototype={toNumberArray:function(t){void 0===t&&(t=[]);for(var e=0;e0){Array.isArray(t)||(t=Array.prototype.slice.call(arguments));for(var e=Number.MAX_VALUE,i=0,n=t.length;i + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Rectangle=function(t,e,i,s){t=t||0,e=e||0,i=i||0,s=s||0,this.x=t,this.y=e,this.width=i,this.height=s,this.type=n.RECTANGLE},n.Rectangle.prototype={offset:function(t,e){return this.x+=t,this.y+=e,this},offsetPoint:function(t){return this.offset(t.x,t.y)},setTo:function(t,e,i,n){return this.x=t,this.y=e,this.width=i,this.height=n,this},scale:function(t,e){return void 0===e&&(e=t),this.width*=t,this.height*=e,this},centerOn:function(t,e){return this.centerX=t,this.centerY=e,this},floor:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y)},floorAll:function(){this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.width=Math.floor(this.width),this.height=Math.floor(this.height)},ceil:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y)},ceilAll:function(){this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.width=Math.ceil(this.width),this.height=Math.ceil(this.height)},copyFrom:function(t){return this.setTo(t.x,t.y,t.width,t.height)},copyFromBounds:function(t){return this.setTo(t.left,t.top,t.width,t.height)},copyTo:function(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},inflate:function(t,e){return n.Rectangle.inflate(this,t,e)},size:function(t){return n.Rectangle.size(this,t)},resize:function(t,e){return this.width=t,this.height=e,this},clone:function(t){return n.Rectangle.clone(this,t)},contains:function(t,e){return n.Rectangle.contains(this,t,e)},containsRect:function(t){return n.Rectangle.containsRect(t,this)},equals:function(t){return n.Rectangle.equals(this,t)},intersection:function(t,e){return n.Rectangle.intersection(this,t,e)},intersects:function(t){return n.Rectangle.intersects(this,t)},intersectsRaw:function(t,e,i,s,r){return n.Rectangle.intersectsRaw(this,t,e,i,s,r)},union:function(t,e){return n.Rectangle.union(this,t,e)},random:function(t){return void 0===t&&(t=new n.Point),t.x=this.randomX,t.y=this.randomY,t},getPoint:function(t,e){switch(void 0===e&&(e=new n.Point),t){default:case n.TOP_LEFT:return e.set(this.x,this.y);case n.TOP_CENTER:return e.set(this.centerX,this.y);case n.TOP_RIGHT:return e.set(this.right,this.y);case n.LEFT_CENTER:return e.set(this.x,this.centerY);case n.CENTER:return e.set(this.centerX,this.centerY);case n.RIGHT_CENTER:return e.set(this.right,this.centerY);case n.BOTTOM_LEFT:return e.set(this.x,this.bottom);case n.BOTTOM_CENTER:return e.set(this.centerX,this.bottom);case n.BOTTOM_RIGHT:return e.set(this.right,this.bottom)}},sides:function(t,e,i,s){arguments.length||(t=new n.Line,e=new n.Line,i=new n.Line,s=new n.Line);var r=this.x,o=this.y,a=this.right,h=this.bottom;return t.setTo(r,o,a,o),e.setTo(a,o,a,h),i.setTo(r,h,a,h),s.setTo(r,o,r,h),arguments.length?null:[t,e,i,s]},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}},Object.defineProperty(n.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}}),Object.defineProperty(n.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}}),Object.defineProperty(n.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(t){t<=this.y?this.height=0:this.height=t-this.y}}),Object.defineProperty(n.Rectangle.prototype,"bottomLeft",{get:function(){return new n.Point(this.x,this.bottom)},set:function(t){this.x=t.x,this.bottom=t.y}}),Object.defineProperty(n.Rectangle.prototype,"bottomRight",{get:function(){return new n.Point(this.right,this.bottom)},set:function(t){this.right=t.x,this.bottom=t.y}}),Object.defineProperty(n.Rectangle.prototype,"left",{get:function(){return this.x},set:function(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}}),Object.defineProperty(n.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(t){t<=this.x?this.width=0:this.width=t-this.x}}),Object.defineProperty(n.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}}),Object.defineProperty(n.Rectangle.prototype,"perimeter",{get:function(){return 2*this.width+2*this.height}}),Object.defineProperty(n.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(t){this.x=t-this.halfWidth}}),Object.defineProperty(n.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(t){this.y=t-this.halfHeight}}),Object.defineProperty(n.Rectangle.prototype,"randomX",{get:function(){return this.x+Math.random()*this.width}}),Object.defineProperty(n.Rectangle.prototype,"randomY",{get:function(){return this.y+Math.random()*this.height}}),Object.defineProperty(n.Rectangle.prototype,"top",{get:function(){return this.y},set:function(t){t>=this.bottom?(this.height=0,this.y=t):this.height=this.bottom-t}}),Object.defineProperty(n.Rectangle.prototype,"topLeft",{get:function(){return new n.Point(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}}),Object.defineProperty(n.Rectangle.prototype,"topRight",{get:function(){return new n.Point(this.x+this.width,this.y)},set:function(t){this.right=t.x,this.y=t.y}}),Object.defineProperty(n.Rectangle.prototype,"empty",{get:function(){return!this.width||!this.height},set:function(t){!0===t&&this.setTo(0,0,0,0)}}),n.Rectangle.prototype.constructor=n.Rectangle,n.Rectangle.inflate=function(t,e,i){return t.x-=e,t.width+=2*e,t.y-=i,t.height+=2*i,t},n.Rectangle.inflatePoint=function(t,e){return n.Rectangle.inflate(t,e.x,e.y)},n.Rectangle.size=function(t,e){return null==e?e=new n.Point(t.width,t.height):e.setTo(t.width,t.height),e},n.Rectangle.clone=function(t,e){return null==e?e=new n.Rectangle(t.x,t.y,t.width,t.height):e.setTo(t.x,t.y,t.width,t.height),e},n.Rectangle.createFromBounds=function(t,e){return null==e&&(e=new n.Rectangle(t.x,t.y,t.width,t.height)),e.copyFromBounds(t)},n.Rectangle.contains=function(t,e,i){return!(t.width<=0||t.height<=0)&&(e>=t.x&&e=t.y&&i=t&&s=e&&re.volume)&&(t.x>=e.x&&t.y>=e.y&&t.righte.right||t.y>e.bottom)},n.Rectangle.intersectsRaw=function(t,e,i,n,s,r){return void 0===r&&(r=0),!(e>t.right+r||it.bottom+r||si&&(i=t.x),t.xr&&(r=t.y),t.y + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.RoundedRectangle=function(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=20),this.x=t,this.y=e,this.width=i,this.height=s,this.radius=r||20,this.type=n.ROUNDEDRECTANGLE},n.RoundedRectangle.prototype={clone:function(){return new n.RoundedRectangle(this.x,this.y,this.width,this.height,this.radius)},contains:function(t,e){if(this.width<=0||this.height<=0)return!1;var i=this.x;if(t>=i&&t<=i+this.width){var n=this.y;if(e>=n&&e<=n+this.height)return!0}return!1}},n.RoundedRectangle.prototype.constructor=n.RoundedRectangle,PIXI.RoundedRectangle=n.RoundedRectangle, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Camera=function(t,e,i,s,r,o){this.game=t,this.world=t.world,this.id=0,this.view=new n.Rectangle(i,s,r,o),this.bounds=new n.Rectangle(i,s,r,o),this.deadzone=null,this.visible=!0,this.roundPx=!0,this.atLimit={x:!1,y:!1},this.target=null,this.displayObject=null,this.scale=null,this.totalInView=0,this.lerp=new n.Point(1,1),this.onShakeComplete=new n.Signal,this.onFlashComplete=new n.Signal,this.onFadeComplete=new n.Signal,this.fx=null,this._targetPosition=new n.Point,this._edge=0,this._position=new n.Point,this._shake={intensity:0,duration:0,horizontal:!1,vertical:!1,shakeBounds:!0,x:0,y:0},this._fxDuration=0,this._fxType=0,this._fixedView=new n.Rectangle},n.Camera.FOLLOW_LOCKON=0,n.Camera.FOLLOW_PLATFORMER=1,n.Camera.FOLLOW_TOPDOWN=2,n.Camera.FOLLOW_TOPDOWN_TIGHT=3,n.Camera.SHAKE_BOTH=4,n.Camera.SHAKE_HORIZONTAL=5,n.Camera.SHAKE_VERTICAL=6,n.Camera.ENABLE_FX=!0,n.Camera.FLASH=0,n.Camera.FADE_OUT=1,n.Camera.FADE_IN=2,n.Camera.prototype={boot:function(){this.displayObject=this.game.world,this.scale=this.game.world.scale,this.game.camera=this,n.Graphics&&n.Camera.ENABLE_FX&&(this.fx=new n.Graphics(this.game),this.game.stage.addChild(this.fx))},preUpdate:function(){this.totalInView=0},follow:function(t,e,i,s){var r;switch(void 0===e&&(e=n.Camera.FOLLOW_LOCKON),void 0===i&&(i=1),void 0===s&&(s=1),this.target=t,this.lerp.set(i,s),e){case n.Camera.FOLLOW_PLATFORMER:var o=this.width/8,a=this.height/3;this.deadzone=new n.Rectangle((this.width-o)/2,(this.height-a)/2-.25*a,o,a);break;case n.Camera.FOLLOW_TOPDOWN:r=Math.max(this.width,this.height)/4,this.deadzone=new n.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case n.Camera.FOLLOW_TOPDOWN_TIGHT:r=Math.max(this.width,this.height)/8,this.deadzone=new n.Rectangle((this.width-r)/2,(this.height-r)/2,r,r);break;case n.Camera.FOLLOW_LOCKON:default:this.deadzone=null}},unfollow:function(){this.target=null},focusOn:function(t){this.setPosition(Math.round(t.x-this.view.halfWidth),Math.round(t.y-this.view.halfHeight))},focusOnXY:function(t,e){this.setPosition(Math.round(t-this.view.halfWidth),Math.round(e-this.view.halfHeight))},shake:function(t,e,i,s,r){return void 0===t&&(t=.05),void 0===e&&(e=500),void 0===i&&(i=!0),void 0===s&&(s=n.Camera.SHAKE_BOTH),void 0===r&&(r=!0),!(!i&&this._shake.duration>0)&&(this._shake.intensity=t,this._shake.duration=e,this._shake.shakeBounds=r,this._shake.x=0,this._shake.y=0,this._shake.horizontal=s===n.Camera.SHAKE_BOTH||s===n.Camera.SHAKE_HORIZONTAL,this._shake.vertical=s===n.Camera.SHAKE_BOTH||s===n.Camera.SHAKE_VERTICAL,!0)},flash:function(t,e,i,n){return void 0===t&&(t=16777215),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===n&&(n=1),!(!this.fx||!i&&this._fxDuration>0)&&(this.fx.clear(),this.fx.beginFill(t,n),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),this.fx.alpha=1,this._fxDuration=e,this._fxType=0,!0)},fade:function(t,e,i,s){return this.fadeEffect(t,e,i,s,n.Camera.FADE_OUT)},fadeIn:function(t,e,i,s){return this.fadeEffect(t,e,i,s,n.Camera.FADE_IN)},fadeEffect:function(t,e,i,s,r){if(void 0===t&&(t=0),void 0===e&&(e=500),void 0===i&&(i=!1),void 0===s&&(s=1),!this.fx||!i&&this._fxDuration>0)return!1;if(this.fx.clear(),this.fx.beginFill(t,s),this.fx.drawRect(0,0,this.width,this.height),this.fx.endFill(),r<1||r>2)throw new Error("Wrong `type` argument");return this.fx.alpha=r===n.Camera.FADE_IN?1:0,this._fxDuration=e,this._fxType=r,!0},update:function(){this._fxDuration>0&&this.updateFX(),this._shake.duration>0&&this.updateShake(),this.bounds&&this.checkBounds(),this.roundPx&&(this.view.floor(),this._shake.x=Math.floor(this._shake.x),this._shake.y=Math.floor(this._shake.y)),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},updateFX:function(){this._fxType===n.Camera.FLASH?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFlashComplete.dispatch())):this._fxType===n.Camera.FADE_IN?(this.fx.alpha-=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha<=0&&(this._fxDuration=0,this.fx.alpha=0,this.onFadeComplete.dispatch())):(this.fx.alpha+=this.game.time.elapsedMS/this._fxDuration,this.fx.alpha>=1&&(this._fxDuration=0,this.fx.alpha=1,this.onFadeComplete.dispatch()))},updateShake:function(){this._shake.duration-=this.game.time.elapsedMS,this._shake.duration<=0?(this.onShakeComplete.dispatch(),this._shake.x=0,this._shake.y=0):(this._shake.horizontal&&(this._shake.x=this.game.rnd.frac()*this._shake.intensity*this.view.width*2-this._shake.intensity*this.view.width),this._shake.vertical&&(this._shake.y=this.game.rnd.frac()*this._shake.intensity*this.view.height*2-this._shake.intensity*this.view.height))},updateTarget:function(){this._targetPosition.x=this.view.x+this.target.worldPosition.x,this._targetPosition.y=this.view.y+this.target.worldPosition.y,this.deadzone?(this._edge=this._targetPosition.x-this.view.x,this._edgethis.deadzone.right&&(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.deadzone.right,this.lerp.x)),this._edge=this._targetPosition.y-this.view.y,this._edgethis.deadzone.bottom&&(this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.deadzone.bottom,this.lerp.y))):(this.view.x=this.game.math.linear(this.view.x,this._targetPosition.x-this.view.halfWidth,this.lerp.x),this.view.y=this.game.math.linear(this.view.y,this._targetPosition.y-this.view.halfHeight,this.lerp.y)),this.bounds&&this.checkBounds(),this.roundPx&&this.view.floor(),this.displayObject.position.x=-this.view.x,this.displayObject.position.y=-this.view.y},setBoundsToWorld:function(){this.bounds&&this.bounds.copyFrom(this.game.world.bounds)},checkBounds:function(){this.atLimit.x=!1,this.atLimit.y=!1;var t=this.view.x+this._shake.x,e=this.view.right+this._shake.x,i=this.view.y+this._shake.y,n=this.view.bottom+this._shake.y;t<=this.bounds.x*this.scale.x?(this.atLimit.x=!0,this.view.x=this.bounds.x*this.scale.x,this._shake.shakeBounds||(this._shake.x=0)):e>=this.bounds.right*this.scale.x&&(this.atLimit.x=!0,this.view.x=this.bounds.right*this.scale.x-this.width,this._shake.shakeBounds||(this._shake.x=0)),i<=this.bounds.top*this.scale.y?(this.atLimit.y=!0,this.view.y=this.bounds.top*this.scale.y,this._shake.shakeBounds||(this._shake.y=0)):n>=this.bounds.bottom*this.scale.y&&(this.atLimit.y=!0,this.view.y=this.bounds.bottom*this.scale.y-this.height,this._shake.shakeBounds||(this._shake.y=0))},setPosition:function(t,e){this.view.x=t,this.view.y=e,this.bounds&&this.checkBounds()},setSize:function(t,e){this.view.width=t,this.view.height=e},reset:function(){this.target=null,this.view.x=0,this.view.y=0,this._shake.duration=0,this._shake.x=0,this._shake.y=0,this.resetFX()},resetFX:function(){this.fx&&(this.fx.clear(),this.fx.alpha=0),this._fxDuration=0}},n.Camera.prototype.constructor=n.Camera,Object.defineProperty(n.Camera.prototype,"x",{get:function(){return this.view.x},set:function(t){this.view.x=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(n.Camera.prototype,"y",{get:function(){return this.view.y},set:function(t){this.view.y=t,this.bounds&&this.checkBounds()}}),Object.defineProperty(n.Camera.prototype,"position",{get:function(){return this._position.set(this.view.x,this.view.y),this._position},set:function(t){void 0!==t.x&&(this.view.x=t.x),void 0!==t.y&&(this.view.y=t.y),this.bounds&&this.checkBounds()}}),Object.defineProperty(n.Camera.prototype,"width",{get:function(){return this.view.width},set:function(t){this.view.width=t}}),Object.defineProperty(n.Camera.prototype,"height",{get:function(){return this.view.height},set:function(t){this.view.height=t}}),Object.defineProperty(n.Camera.prototype,"shakeIntensity",{get:function(){return this._shake.intensity},set:function(t){this._shake.intensity=t}}),Object.defineProperty(n.Camera.prototype,"fixedView",{get:function(){return this._fixedView.setTo(0,0,this.view.width,this.view.height),this._fixedView}}),Object.defineProperty(n.Camera.prototype,"centerX",{get:function(){return this.x+.5*this.width}}),Object.defineProperty(n.Camera.prototype,"centerY",{get:function(){return this.y+.5*this.height}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.State=function(){this.game=null,this.key="",this.add=null,this.make=null,this.camera=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.sound=null,this.scale=null,this.stage=null,this.state=null,this.time=null,this.tweens=null,this.world=null,this.particles=null,this.physics=null,this.rnd=null},n.State.prototype={init:function(){},preload:function(){},loadUpdate:function(){},loadRender:function(){},create:function(){},update:function(){},postUpdate:function(){},preRender:function(){},render:function(){},resize:function(){},paused:function(){},resumed:function(){},pauseUpdate:function(){},shutdown:function(){}},n.State.prototype.constructor=n.State, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.StateManager=function(t,e){this.game=t,this.states={},this._pendingState=null,null!=e&&(this._pendingState=e),this._clearWorld=!1,this._clearCache=!1,this._created=!1,this._args=[],this.current="",this.onStateChange=new n.Signal,this.onInitCallback=null,this.onPreloadCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPreRenderCallback=null,this.onLoadUpdateCallback=null,this.onLoadRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.onShutDownCallback=null},n.StateManager.prototype={boot:function(){this.game.onPause.add(this.pause,this),this.game.onResume.add(this.resume,this),null!==this._pendingState&&"string"!=typeof this._pendingState&&this.add("default",this._pendingState,!0)},add:function(t,e,i){var s;return void 0===i&&(i=!1),e instanceof n.State?s=e:"object"==typeof e?(s=e).game=this.game:"function"==typeof e&&(s=new e(this.game)),this.states[t]=s,i&&(this.game.isBooted?this.start(t):this._pendingState=t),s},remove:function(t){this.current===t&&(this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPreRenderCallback=null,this.onRenderCallback=null,this.onResizeCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null),delete this.states[t]},start:function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1),this.checkState(t)&&(this._pendingState=t,this._clearWorld=e,this._clearCache=i,arguments.length>3&&(this._args=Array.prototype.splice.call(arguments,3)))},restart:function(t,e){void 0===t&&(t=!0),void 0===e&&(e=!1),this._pendingState=this.current,this._clearWorld=t,this._clearCache=e,arguments.length>2&&(this._args=Array.prototype.slice.call(arguments,2))},dummy:function(){},preUpdate:function(){if(this._pendingState&&this.game.isBooted){if(this.clearCurrentState(),this.setCurrentState(this._pendingState),this.current!==this._pendingState)return;this._pendingState=null,this.onPreloadCallback?(this.game.load.reset(!0),this.onPreloadCallback.call(this.callbackContext,this.game),0===this.game.load.totalQueuedFiles()&&0===this.game.load.totalQueuedPacks()?this.loadComplete():this.game.load.start()):this.loadComplete()}},clearCurrentState:function(){this.current&&(this.onShutDownCallback&&this.onShutDownCallback.call(this.callbackContext,this.game),this.game.tweens.removeAll(),this.game.camera.reset(),this.game.input.reset(!0),this.game.physics.clear(),this.game.time.removeAll(),this.game.scale.reset(this._clearWorld),this.game.debug&&this.game.debug.reset(),this._clearWorld&&(this.game.world.shutdown(),this._clearCache&&this.game.cache.destroy()))},checkState:function(t){var e=this.states[t];return e?!!(e.preload||e.create||e.update||e.render)||(console.warn("Invalid Phaser State object given. Must contain at least one of the required functions: preload, create, update or render"),!1):(console.warn("Phaser.StateManager - No state found with the key: "+t),!1)},link:function(t){var e=this.states[t];e.game=this.game,e.add=this.game.add,e.make=this.game.make,e.camera=this.game.camera,e.cache=this.game.cache,e.input=this.game.input,e.load=this.game.load,e.math=this.game.math,e.sound=this.game.sound,e.scale=this.game.scale,e.state=this,e.stage=this.game.stage,e.time=this.game.time,e.tweens=this.game.tweens,e.world=this.game.world,e.particles=this.game.particles,e.rnd=this.game.rnd,e.physics=this.game.physics,e.key=t},unlink:function(t){var e=this.states[t];e&&(e.game=null,e.add=null,e.make=null,e.camera=null,e.cache=null,e.input=null,e.load=null,e.math=null,e.sound=null,e.scale=null,e.state=null,e.stage=null,e.time=null,e.tweens=null,e.world=null,e.particles=null,e.rnd=null,e.physics=null)},setCurrentState:function(t){var e=this.current,i=this.states[t];this.callbackContext=i,this.link(t),this.onInitCallback=i.init||this.dummy,this.onPreloadCallback=i.preload||null,this.onLoadRenderCallback=i.loadRender||null,this.onLoadUpdateCallback=i.loadUpdate||null,this.onCreateCallback=i.create||null,this.onUpdateCallback=i.update||null,this.onPostUpdateCallback=i.postUpdate||null,this.onPreRenderCallback=i.preRender||null,this.onRenderCallback=i.render||null,this.onResizeCallback=i.resize||null,this.onPausedCallback=i.paused||null,this.onResumedCallback=i.resumed||null,this.onPauseUpdateCallback=i.pauseUpdate||null,this.onShutDownCallback=i.shutdown||this.dummy,""!==this.current&&this.game.physics.reset(),this.current=t,this._created=!1,this.onStateChange.dispatch(this.current,e),this.onInitCallback.apply(this.callbackContext,this._args),t===this._pendingState&&(this._args=[]),this.game._kickstart=!0},getCurrentState:function(){return this.states[this.current]},loadComplete:function(){!1===this._created&&this.onCreateCallback?(this._created=!0,this.onCreateCallback.call(this.callbackContext,this.game)):this._created=!0},loadUpdate:function(){!1===this._created&&this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},pause:function(){this._created&&this.onPausedCallback&&this.onPausedCallback.call(this.callbackContext,this.game)},resume:function(){this._created&&this.onResumedCallback&&this.onResumedCallback.call(this.callbackContext,this.game)},update:function(){this._created?this.onUpdateCallback&&this.onUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},postUpdate:function(){this._created&&this.onPostUpdateCallback&&this.onPostUpdateCallback.call(this.callbackContext,this.game)},pauseUpdate:function(){this._created?this.onPauseUpdateCallback&&this.onPauseUpdateCallback.call(this.callbackContext,this.game):this.onLoadUpdateCallback&&this.onLoadUpdateCallback.call(this.callbackContext,this.game)},preRender:function(t){this._created&&this.onPreRenderCallback&&this.onPreRenderCallback.call(this.callbackContext,this.game,t)},resize:function(t,e){this.onResizeCallback&&this.onResizeCallback.call(this.callbackContext,t,e)},render:function(){this._created?this.onRenderCallback&&(this.game.renderType===n.CANVAS?(this.game.context.save(),this.game.context.setTransform(1,0,0,1,0,0),this.onRenderCallback.call(this.callbackContext,this.game),this.game.context.restore()):this.onRenderCallback.call(this.callbackContext,this.game)):this.onLoadRenderCallback&&this.onLoadRenderCallback.call(this.callbackContext,this.game)},destroy:function(){this._clearWorld=!0,this._clearCache=!0,this.clearCurrentState(),this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onPostUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.game=null,this.states={},this._pendingState=null,this.current=""}},n.StateManager.prototype.constructor=n.StateManager,Object.defineProperty(n.StateManager.prototype,"created",{get:function(){return this._created}}), +/** + * @author Miller Medeiros http://millermedeiros.github.com/js-signals/ + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Signal=function(){},n.Signal.prototype={_bindings:null,_prevParams:null,memorize:!1,_shouldPropagate:!0,active:!0,_boundDispatch:!1,validateListener:function(t,e){if("function"!=typeof t)throw new Error("Phaser.Signal: listener is a required param of {fn}() and should be a Function.".replace("{fn}",e))},_registerListener:function(t,e,i,s,r){var o,a=this._indexOfListener(t,i);if(-1!==a){if((o=this._bindings[a]).isOnce()!==e)throw new Error("You cannot add"+(e?"":"Once")+"() then add"+(e?"Once":"")+"() the same listener without removing the relationship first.")}else o=new n.SignalBinding(this,t,e,i,s,r),this._addBinding(o);return this.memorize&&this._prevParams&&o.execute(this._prevParams),o},_addBinding:function(t){this._bindings||(this._bindings=[]);var e=this._bindings.length;do{e--}while(this._bindings[e]&&t._priority<=this._bindings[e]._priority);this._bindings.splice(e+1,0,t)},_indexOfListener:function(t,e){if(!this._bindings)return-1;void 0===e&&(e=null);for(var i,n=this._bindings.length;n--;)if((i=this._bindings[n])._listener===t&&i.context===e)return n;return-1},has:function(t,e){return-1!==this._indexOfListener(t,e)},add:function(t,e,i){this.validateListener(t,"add");var n=[];if(arguments.length>3)for(var s=3;s3)for(var s=3;s + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.SignalBinding=function(t,e,i,n,s,r){this._listener=e,i&&(this._isOnce=!0),null!=n&&(this.context=n),this._signal=t,s&&(this._priority=s),r&&r.length&&(this._args=r)},n.SignalBinding.prototype={context:null,_isOnce:!1,_priority:0,_args:null,callCount:0,active:!0,params:null,execute:function(t){var e,i;return this.active&&this._listener&&(i=this.params?this.params.concat(t):t,this._args&&(i=i.concat(this._args)),e=this._listener.apply(this.context,i),this.callCount++,this._isOnce&&this.detach()),e},detach:function(){return this.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){return this._isOnce},getListener:function(){return this._listener},getSignal:function(){return this._signal},_destroy:function(){delete this._signal,delete this._listener,delete this.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},n.SignalBinding.prototype.constructor=n.SignalBinding, +/** + * @author Richard Davey + * @author Mat Groves (@Doormat23) + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Filter=function(t,e,i){this.game=t,this.type=n.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.prevPoint=new n.Point;var s=new Date;if(this.uniforms={resolution:{type:"2f",value:{x:256,y:256}},time:{type:"1f",value:0},mouse:{type:"2f",value:{x:0,y:0}},date:{type:"4fv",value:[s.getFullYear(),s.getMonth(),s.getDate(),60*s.getHours()*60+60*s.getMinutes()+s.getSeconds()]},sampleRate:{type:"1f",value:44100},iChannel0:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel1:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel2:{type:"sampler2D",value:null,textureData:{repeat:!0}},iChannel3:{type:"sampler2D",value:null,textureData:{repeat:!0}}},e)for(var r in e)this.uniforms[r]=e[r];"string"==typeof i&&(i=i.split("\n")),this.fragmentSrc=i||[]},n.Filter.prototype={init:function(){},setResolution:function(t,e){this.uniforms.resolution.value.x=t,this.uniforms.resolution.value.y=e},update:function(t){if(t){var e=t.x/this.game.width,i=1-t.y/this.game.height;e===this.prevPoint.x&&i===this.prevPoint.y||(this.uniforms.mouse.value.x=e.toFixed(2),this.uniforms.mouse.value.y=i.toFixed(2),this.prevPoint.set(e,i))}this.uniforms.time.value=this.game.time.totalElapsedSeconds()},addToWorld:function(t,e,i,s,r,o){void 0===r&&(r=0),void 0===o&&(o=0),null!=i?this.width=i:i=this.width,null!=s?this.height=s:s=this.height;var a=this.game.add.image(t,e,n.Cache.DEFAULT);return a.width=i,a.height=s,a.anchor.set(r,o),a.filters=[this],a},syncUniforms:function(){for(var t=0;t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Plugin=function(t,e){void 0===e&&(e=null),this.game=t,this.parent=e,this.active=!1,this.visible=!1,this.hasPreUpdate=!1,this.hasUpdate=!1,this.hasPostUpdate=!1,this.hasRender=!1,this.hasPostRender=!1},n.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null,this.parent=null,this.active=!1,this.visible=!1}},n.Plugin.prototype.constructor=n.Plugin, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.PluginManager=function(t){this.game=t,this.plugins=[],this._len=0,this._i=0},n.PluginManager.prototype={add:function(t){var e=Array.prototype.slice.call(arguments,1),i=!1;return"function"==typeof t?t=new t(this.game,this):(t.game=this.game,t.parent=this),"function"==typeof t.preUpdate&&(t.hasPreUpdate=!0,i=!0),"function"==typeof t.update&&(t.hasUpdate=!0,i=!0),"function"==typeof t.postUpdate&&(t.hasPostUpdate=!0,i=!0),"function"==typeof t.render&&(t.hasRender=!0,i=!0),"function"==typeof t.postRender&&(t.hasPostRender=!0,i=!0),i?((t.hasPreUpdate||t.hasUpdate||t.hasPostUpdate)&&(t.active=!0),(t.hasRender||t.hasPostRender)&&(t.visible=!0),this._len=this.plugins.push(t),"function"==typeof t.init&&t.init.apply(t,e),t):null},remove:function(t,e){for(void 0===e&&(e=!0),this._i=this._len;this._i--;)if(this.plugins[this._i]===t)return e&&t.destroy(),this.plugins.splice(this._i,1),void this._len--},removeAll:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].destroy();this.plugins.length=0,this._len=0},preUpdate:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasPreUpdate&&this.plugins[this._i].preUpdate()},update:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasUpdate&&this.plugins[this._i].update()},postUpdate:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].active&&this.plugins[this._i].hasPostUpdate&&this.plugins[this._i].postUpdate()},render:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].visible&&this.plugins[this._i].hasRender&&this.plugins[this._i].render()},postRender:function(){for(this._i=this._len;this._i--;)this.plugins[this._i].visible&&this.plugins[this._i].hasPostRender&&this.plugins[this._i].postRender()},destroy:function(){this.removeAll(),this.game=null}},n.PluginManager.prototype.constructor=n.PluginManager, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Stage=function(t){this.game=t,PIXI.DisplayObjectContainer.call(this),this.name="_stage_root",this.disableVisibilityChange=!1,this.exists=!0,this.worldTransform=new n.Matrix,this.stage=this,this.currentRenderOrderID=0,this._hiddenVar="hidden",this._onChange=null,this._bgColor={r:0,g:0,b:0,a:0,color:0,rgba:"#000000"},this.game.transparent||(this._bgColor.a=1),t.config&&this.parseConfig(t.config)},n.Stage.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.Stage.prototype.constructor=n.Stage,n.Stage.prototype.parseConfig=function(t){t.disableVisibilityChange&&(this.disableVisibilityChange=t.disableVisibilityChange),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor)},n.Stage.prototype.boot=function(){n.DOM.getOffset(this.game.canvas,this.offset),n.Canvas.setUserSelect(this.game.canvas,"none"),n.Canvas.setTouchAction(this.game.canvas,"none"),this.checkVisibility()},n.Stage.prototype.preUpdate=function(){this.currentRenderOrderID=0;for(var t=0;t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Group=function(t,e,i,s,r,o){void 0===s&&(s=!1),void 0===r&&(r=!1),void 0===o&&(o=n.Physics.ARCADE),this.game=t,void 0===e&&(e=t.world),this.name=i||"group",this.z=0,PIXI.DisplayObjectContainer.call(this),s?(this.game.stage.addChild(this),this.z=this.game.stage.children.length):e&&(e.addChild(this),this.z=e.children.length),this.type=n.GROUP,this.physicsType=n.GROUP,this.alive=!0,this.exists=!0,this.ignoreDestroy=!1,this.pendingDestroy=!1,this.classType=n.Sprite,this.cursor=null,this.inputEnableChildren=!1,this.updateOnlyExistingChildren=!1,this.onChildInputDown=new n.Signal,this.onChildInputUp=new n.Signal,this.onChildInputOver=new n.Signal,this.onChildInputOut=new n.Signal,this.enableBody=r,this.enableBodyDebug=!1,this.physicsBodyType=o,this.physicsSortDirection=null,this.onDestroy=new n.Signal,this.cursorIndex=0,this.fixedToCamera=!1,this.cameraOffset=new n.Point,this.hash=[],this._sortProperty="z"},n.Group.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.Group.prototype.constructor=n.Group,n.Group.RETURN_NONE=0,n.Group.RETURN_TOTAL=1,n.Group.RETURN_CHILD=2,n.Group.RETURN_ALL=3,n.Group.SORT_ASCENDING=-1,n.Group.SORT_DESCENDING=1,n.Group.prototype.add=function(t,e,i){return void 0===e&&(e=!1),t.parent===this||(t.body&&t.parent&&t.parent.hash&&t.parent.removeFromHash(t),void 0===i?(t.z=this.children.length,this.addChild(t)):(this.addChildAt(t,i),this.updateZ()),this.enableBody&&t.hasOwnProperty("body")&&null===t.body?this.game.physics.enable(t,this.physicsBodyType):t.body&&this.addToHash(t),!this.inputEnableChildren||t.input&&!t.inputEnabled||(t.inputEnabled=!0),!e&&t.events&&t.events.onAddedToGroup$dispatch(t,this),null===this.cursor&&(this.cursor=t)),t},n.Group.prototype.addAt=function(t,e,i){return this.add(t,i,e)},n.Group.prototype.addToHash=function(t){if(t.parent===this&&-1===this.hash.indexOf(t))return this.hash.push(t),!0;return!1},n.Group.prototype.removeFromHash=function(t){if(t){var e=this.hash.indexOf(t);if(-1!==e)return this.hash.splice(e,1),!0}return!1},n.Group.prototype.addMultiple=function(t,e){if(t instanceof n.Group)t.moveAll(this,e);else if(Array.isArray(t))for(var i=0;i=this.children.length?-1:this.getChildAt(t)},n.Group.prototype.create=function(t,e,i,n,s,r){void 0===s&&(s=!0);var o=new this.classType(this.game,t,e,i,n);return o.exists=s,o.visible=s,o.alive=s,this.add(o,!1,r)},n.Group.prototype.createMultiple=function(t,e,i,n,s,r){void 0===i&&(i=0),void 0===n&&(n=!1),Array.isArray(e)||(e=[e]),Array.isArray(i)||(i=[i]);var o=this,a=[];return e.forEach((function(e){i.forEach((function(i){for(var h=0;hthis.children.length||-1===t&&-1===e)return!1;for(var a=new n.Rectangle(0,0,i,s),h=t*i,l=e*s,c=o;cthis.children.length-1&&(t=0),this.cursor)return this.cursorIndex=t,this.cursor=this.children[this.cursorIndex],this.cursor},n.Group.prototype.next=function(){if(this.cursor)return this.cursorIndex>=this.children.length-1?this.cursorIndex=0:this.cursorIndex++,this.cursor=this.children[this.cursorIndex],this.cursor},n.Group.prototype.previous=function(){if(this.cursor)return 0===this.cursorIndex?this.cursorIndex=this.children.length-1:this.cursorIndex--,this.cursor=this.children[this.cursorIndex],this.cursor},n.Group.prototype.swap=function(t,e){this.swapChildren(t,e),this.updateZ()},n.Group.prototype.bringToTop=function(t){return t.parent===this&&this.getIndex(t)0&&(this.remove(t,!1,!0),this.addAt(t,0,!0)),t},n.Group.prototype.sendChildToBack=n.Group.prototype.sendToBack,n.Group.prototype.moveUp=function(t){if(t.parent===this&&this.getIndex(t)0){var e=this.getIndex(t),i=this.getAt(e-1);i&&this.swap(t,i)}return t},n.Group.prototype.xy=function(t,e,i){if(t<0||t>this.children.length)return-1;this.getChildAt(t).x=e,this.getChildAt(t).y=i},n.Group.prototype.reverse=function(){this.children.reverse(),this.updateZ()},n.Group.prototype.getIndex=function(t){return this.children.indexOf(t)},n.Group.prototype.getByName=function(t){return this.getFirst("name",t)},n.Group.prototype.replace=function(t,e){var i=this.getIndex(t);if(-1!==i)return e.parent&&(e.parent instanceof n.Group?e.parent.remove(e):e.parent.removeChild(e)),this.remove(t),this.addAt(e,i),t},n.Group.prototype.hasProperty=function(t,e){var i=e.length;return 1===i&&e[0]in t||(2===i&&e[0]in t&&e[1]in t[e[0]]||(3===i&&e[0]in t&&e[1]in t[e[0]]&&e[2]in t[e[0]][e[1]]||4===i&&e[0]in t&&e[1]in t[e[0]]&&e[2]in t[e[0]][e[1]]&&e[3]in t[e[0]][e[1]][e[2]]))},n.Group.prototype.setProperty=function(t,e,i,n,s){if(void 0===s&&(s=!1),n=n||0,!this.hasProperty(t,e)&&(!s||n>0))return!1;var r=e.length;return 1===r?0===n?t[e[0]]=i:1===n?t[e[0]]+=i:2===n?t[e[0]]-=i:3===n?t[e[0]]*=i:4===n&&(t[e[0]]/=i):2===r?0===n?t[e[0]][e[1]]=i:1===n?t[e[0]][e[1]]+=i:2===n?t[e[0]][e[1]]-=i:3===n?t[e[0]][e[1]]*=i:4===n&&(t[e[0]][e[1]]/=i):3===r?0===n?t[e[0]][e[1]][e[2]]=i:1===n?t[e[0]][e[1]][e[2]]+=i:2===n?t[e[0]][e[1]][e[2]]-=i:3===n?t[e[0]][e[1]][e[2]]*=i:4===n&&(t[e[0]][e[1]][e[2]]/=i):4===r&&(0===n?t[e[0]][e[1]][e[2]][e[3]]=i:1===n?t[e[0]][e[1]][e[2]][e[3]]+=i:2===n?t[e[0]][e[1]][e[2]][e[3]]-=i:3===n?t[e[0]][e[1]][e[2]][e[3]]*=i:4===n&&(t[e[0]][e[1]][e[2]][e[3]]/=i)),!0},n.Group.prototype.checkProperty=function(t,e,i,s){if(void 0===s&&(s=!1),this!==t.parent)return!1;var r=n.Utils.getProperty(t,e);return!(void 0===r&&s||r!==i)},n.Group.prototype.set=function(t,e,i,n,s,r,o){if(void 0===o&&(o=!1),e=e.split("."),void 0===n&&(n=!1),void 0===s&&(s=!1),(!1===n||n&&t.alive)&&(!1===s||s&&t.visible))return this.setProperty(t,e,i,r,o)},n.Group.prototype.setAll=function(t,e,i,n,s,r){void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=!1),t=t.split("."),s=s||0;for(var o=this.children.length,a=0;a2){i=[];for(var n=2;n2){i=[];for(var r=2;r=e&&(t=e-1);var i=this.children[t];this.updateOnlyExistingChildren&&!i.exists||i.update()}},n.Group.prototype.postUpdate=function(){this.fixedToCamera&&(this.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y);for(var t=0;t2){i=[null];for(var s=2;s2){i=[null];for(var s=2;s2){i=[null];for(var s=2;se[this._sortProperty]?1:t.ze[this._sortProperty]?-1:0},n.Group.prototype.iterate=function(t,e,i,s,r,o){if(0===this.children.length){if(i===n.Group.RETURN_TOTAL)return 0;if(i===n.Group.RETURN_ALL)return[]}var a=0;if(i===n.Group.RETURN_ALL)var h=[];for(var l=0;l0)return this.children[this.children.length-1]},n.Group.prototype.getBottom=function(){if(this.children.length>0)return this.children[0]},n.Group.prototype.getClosestTo=function(t,e,i){for(var s=Number.MAX_VALUE,r=0,o=null,a=0;as&&(!e||e.call(i,h,r))&&(s=r,o=h)}return o},n.Group.prototype.count=function(t,e){return this.iterate(t,e,n.Group.RETURN_TOTAL)},n.Group.prototype.countLiving=function(){return this.count("alive",!0)},n.Group.prototype.countDead=function(){return this.count("alive",!1)},n.Group.prototype.getRandom=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=this.children.length),0===e?null:n.ArrayUtils.getRandomItem(this.children,t,e)},n.Group.prototype.getRandomExists=function(t,e){var i=this.getAll("exists",!0,t,e);return this.game.rnd.pick(i)},n.Group.prototype.getAll=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=this.children.length);for(var s=[],r=i;r0&&t instanceof n.Group){do{t.add(this.children[0],e)}while(this.children.length>0);this.hash=[],this.cursor=null}return t},n.Group.prototype.removeAll=function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1),0!==this.children.length){do{!e&&this.children[0].events&&this.children[0].events.onRemovedFromGroup$dispatch(this.children[0],this);var n=this.removeChild(this.children[0]);this.removeFromHash(n),t&&n&&n.destroy(!0,i)}while(this.children.length>0);this.hash=[],this.cursor=null}},n.Group.prototype.removeBetween=function(t,e,i,n){if(void 0===e&&(e=this.children.length-1),void 0===i&&(i=!1),void 0===n&&(n=!1),0!==this.children.length){if(t>e||t<0||e>this.children.length)return!1;for(var s=e;s>=t;){!n&&this.children[s].events&&this.children[s].events.onRemovedFromGroup$dispatch(this.children[s],this);var r=this.removeChild(this.children[s]);this.removeFromHash(r),i&&r&&r.destroy(!0),this.cursor===this.children[s]&&(this.cursor=null),s--}this.updateZ()}},n.Group.prototype.scatter=function(t,e){null==t&&(t=this.game.world.bounds),this.forEach((function(e){e.position.set(t.randomX,t.randomY)}),null,e)},n.Group.prototype.shuffle=function(){n.ArrayUtils.shuffle(this.children),this.updateZ()},n.Group.prototype.destroy=function(t,e){null===this.game||this.ignoreDestroy||(void 0===t&&(t=!0),void 0===e&&(e=!1),this.onDestroy.dispatch(this,t,e),this.removeAll(t),this.cursor=null,this.filters=null,this.pendingDestroy=!1,e||(this.parent&&this.parent.removeChild(this),this.game=null,this.exists=!1))},Object.defineProperty(n.Group.prototype,"total",{get:function(){return this.iterate("exists",!0,n.Group.RETURN_TOTAL)}}),Object.defineProperty(n.Group.prototype,"length",{get:function(){return this.children.length}}),Object.defineProperty(n.Group.prototype,"angle",{get:function(){return n.Math.radToDeg(this.rotation)},set:function(t){this.rotation=n.Math.degToRad(t)}}),Object.defineProperty(n.Group.prototype,"centerX",{get:function(){return this.getBounds(this.parent).centerX},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.halfWidth}}),Object.defineProperty(n.Group.prototype,"centerY",{get:function(){return this.getBounds(this.parent).centerY},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.halfHeight}}),Object.defineProperty(n.Group.prototype,"left",{get:function(){return this.getBounds(this.parent).left},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i}}),Object.defineProperty(n.Group.prototype,"right",{get:function(){return this.getBounds(this.parent).right},set:function(t){var e=this.getBounds(this.parent),i=this.x-e.x;this.x=t+i-e.width}}),Object.defineProperty(n.Group.prototype,"top",{get:function(){return this.getBounds(this.parent).top},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i}}),Object.defineProperty(n.Group.prototype,"bottom",{get:function(){return this.getBounds(this.parent).bottom},set:function(t){var e=this.getBounds(this.parent),i=this.y-e.y;this.y=t+i-e.height}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.World=function(t){n.Group.call(this,t,null,"__world",!1),this.bounds=new n.Rectangle(0,0,t.width,t.height),this.camera=null,this._definedSize=!1,this._width=t.width,this._height=t.height,this.game.state.onStateChange.add(this.stateChange,this)},n.World.prototype=Object.create(n.Group.prototype),n.World.prototype.constructor=n.World,n.World.prototype.boot=function(){this.camera=new n.Camera(this.game,0,0,0,this.game.width,this.game.height),this.game.stage.addChild(this),this.camera.boot()},n.World.prototype.stateChange=function(){this.x=0,this.y=0,this.camera.reset()},n.World.prototype.setBounds=function(t,e,i,n){this._definedSize=!0,this._width=i,this._height=n,this.bounds.setTo(t,e,i,n),this.x=t,this.y=e,this.camera.bounds&&this.camera.bounds.setTo(t,e,Math.max(i,this.game.width),Math.max(n,this.game.height)),this.game.physics.setBoundsToWorld()},n.World.prototype.resize=function(t,e){this._definedSize&&(tthis.bounds.right&&(t.x=this.bounds.left)),s&&(t.y+t._currentBounds.heightthis.bounds.bottom&&(t.y=this.bounds.top))):(n&&t.x+ethis.bounds.right&&(t.x=this.bounds.left-e),s&&t.y+ethis.bounds.bottom&&(t.y=this.bounds.top-e))},n.World.prototype.wrapAll=function(t,e,i,n,s,r){t.forEach(this.wrap,this,e,i,n,s,r)},Object.defineProperty(n.World.prototype,"width",{get:function(){return this.bounds.width},set:function(t){t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Game=function(t,e,i,s,r,o,a,h){return this.id=n.GAMES.push(this)-1,this.config=null,this.physicsConfig=h,this.parent="",this.width=800,this.height=600,this.resolution=1,this._width=800,this._height=600,this.transparent=!1,this.antialias=!0,this.multiTexture=!1,this.preserveDrawingBuffer=!1,this.clearBeforeRender=!0,this.renderer=null,this.renderType=n.AUTO,this.state=null,this.isBooted=!1,this.isRunning=!1,this.raf=null,this.add=null,this.make=null,this.cache=null,this.input=null,this.load=null,this.math=null,this.net=null,this.scale=null,this.sound=null,this.stage=null,this.time=null,this.tweens=null,this.world=null,this.physics=null,this.plugins=null,this.rnd=null,this.device=n.Device,this.camera=null,this.canvas=null,this.context=null,this.debug=null,this.particles=null,this.create=null,this.lockRender=!1,this.pendingDestroy=!1,this.stepping=!1,this.pendingStep=!1,this.stepCount=0,this.onPause=null,this.onResume=null,this.onBlur=null,this.onFocus=null,this._paused=!1,this._codePaused=!1,this.currentUpdateID=0,this.updatesThisFrame=1,this.rendersThisFrame=1,this._deltaTime=0,this._lastCount=0,this._spiraling=0,this._kickstart=!0,this.fpsProblemNotifier=new n.Signal,this.forceSingleUpdate=!0,this.forceSingleRender=!0,this.dropFrames=!1,this.maxUpdates=3,this.powerPreference="default",this._nextFpsNotification=0,1===arguments.length&&"object"==typeof arguments[0]?this.parseConfig(arguments[0]):(this.config={enableDebug:!0},void 0!==t&&(this._width=t),void 0!==e&&(this._height=e),void 0!==i&&(this.renderType=i),void 0!==s&&(this.parent=s),void 0!==o&&(this.transparent=o),void 0!==a&&(this.antialias=a),this.rnd=new n.RandomDataGenerator([(Date.now()*Math.random()).toString()]),this.state=new n.StateManager(this,r)),this.device.whenReady(this.boot,this),this},n.Game.prototype={parseConfig:function(t){this.config=t,void 0===t.enableDebug&&(this.config.enableDebug=!0),t.width&&(this._width=t.width),t.height&&(this._height=t.height),t.renderer&&(this.renderType=t.renderer),t.parent&&(this.parent=t.parent),void 0!==t.transparent&&(this.transparent=t.transparent),void 0!==t.antialias&&(this.antialias=t.antialias),void 0!==t.clearBeforeRender&&(this.clearBeforeRender=t.clearBeforeRender),void 0!==t.multiTexture&&(this.multiTexture=t.multiTexture),t.resolution&&(this.resolution=t.resolution),void 0!==t.preserveDrawingBuffer&&(this.preserveDrawingBuffer=t.preserveDrawingBuffer),void 0!==t.powerPreference&&(this.powerPreference=t.powerPreference),t.physicsConfig&&(this.physicsConfig=t.physicsConfig);var e=[(Date.now()*Math.random()).toString()];t.seed&&(e=t.seed),this.rnd=new n.RandomDataGenerator(e);var i=null;t.state&&(i=t.state),this.state=new n.StateManager(this,i)},boot:function(){if(!this.isBooted){if(this.onPause=new n.Signal,this.onResume=new n.Signal,this.onBlur=new n.Signal,this.onFocus=new n.Signal,this.isBooted=!0,PIXI.game=this,this.math=n.Math,this.scale=new n.ScaleManager(this,this._width,this._height),this.stage=new n.Stage(this),this.setUpRenderer(),this.world=new n.World(this),this.add=new n.GameObjectFactory(this),this.make=new n.GameObjectCreator(this),this.cache=new n.Cache(this),this.load=new n.Loader(this),this.time=new n.Time(this),this.tweens=new n.TweenManager(this),this.input=new n.Input(this),this.sound=new n.SoundManager(this),this.physics=new n.Physics(this,this.physicsConfig),this.particles=new n.Particles(this),this.create=new n.Create(this),this.plugins=new n.PluginManager(this),this.net=new n.Net(this),this.time.boot(),this.stage.boot(),this.world.boot(),this.scale.boot(),this.input.boot(this.config),this.sound.boot(),this.state.boot(),this.config.enableDebug)this.debug=new n.Utils.Debug(this),this.debug.boot();else{var t=function(){};this.debug={preUpdate:t,update:t,reset:t,destroy:t,isDisabled:!0}}this.showDebugHeader(),this.isRunning=!0,this.config&&this.config.forceSetTimeOut?this.raf=new n.RequestAnimationFrame(this,this.config.forceSetTimeOut):this.raf=new n.RequestAnimationFrame(this,!1),this._kickstart=!0,this.focusWindow(),this.config.disableStart||(this.cache.isReady?this.raf.start():this.cache.onReady.addOnce((function(){this.raf.start()}),this))}},showDebugHeader:function(){if(!window.PhaserGlobal||!window.PhaserGlobal.hideBanner){var t=n.VERSION,e="Canvas",i="HTML Audio",s=1;if(this.renderType===n.WEBGL?(e="WebGL",s++):this.renderType===n.HEADLESS&&(e="Headless"),this.device.webAudio&&(i="WebAudio",s++),this.device.ie)window.console&&console.log("Phaser v"+t+" | Pixi.js | "+e+" | "+i+" | http://phaser.io");else{for(var r=["%c %c %c Phaser CE v"+t+" | Pixi.js | "+e+" | "+i+" %c %c %c http://phaser.io %c♥%c♥%c♥","background: #fb8cb3","background: #d44a52","color: #ffffff; background: #871905;","background: #d44a52","background: #fb8cb3","background: #ffffff"],o=0;o<3;o++)o1&&!this.forceSingleUpdate)this.time.time>this._nextFpsNotification&&(this._nextFpsNotification=this.time.time+1e4,this.fpsProblemNotifier.dispatch()),this._deltaTime=0,this._spiraling=0,this.dropFrames?this.rendersThisFrame=0:(this.updateRender(this.time.slowMotion*this.time.desiredFps),this.rendersThisFrame=1);else{var e=1e3*this.time.slowMotion/this.time.desiredFps;this._deltaTime+=Math.max(Math.min(e*this.maxUpdates,this.time.elapsed),0);var i=0;for(this.updatesThisFrame=Math.floor(this._deltaTime/e),this.forceSingleUpdate&&(this.updatesThisFrame=Math.min(1,this.updatesThisFrame)),this.forceSingleRender?this.rendersThisFrame=1:this.rendersThisFrame=Math.min(1,this.updatesThisFrame);this._deltaTime>=e&&(this._deltaTime-=e,this.currentUpdateID=i,this.updateLogic(this.time.desiredFpsMult),i++,!this.forceSingleUpdate||1!==i);)this.time.refresh();i>this._lastCount?this._spiraling++:i0&&this.updateRender(this._deltaTime/e)}this.renderer.type===n.WEBGL&&this.renderer.gl.flush()}},updateLogic:function(t){this._paused||this.pendingStep?(this.scale.pauseUpdate(),this.state.pauseUpdate(t),this.debug.preUpdate(),this.input.pauseUpdate()):(this.stepping&&(this.pendingStep=!0),this.time.preUpdate(),this.scale.preUpdate(),this.debug.preUpdate(),this.camera.preUpdate(),this.physics.preUpdate(),this.state.preUpdate(t),this.plugins.preUpdate(t),this.stage.preUpdate(),this.state.update(),this.stage.update(),this.tweens.update(),this.sound.update(),this.input.update(),this.physics.update(),this.plugins.update(),this.stage.postUpdate(),this.state.postUpdate(),this.plugins.postUpdate()),this.stage.updateTransform()},updateRender:function(t){this.lockRender||this.renderType===n.HEADLESS||(this.time.preRender(),this.state.preRender(t),this.renderer.render(this.stage),this.plugins.render(t),this.state.render(t),this.plugins.postRender(t))},enableStep:function(){this.stepping=!0,this.pendingStep=!1,this.stepCount=0},disableStep:function(){this.stepping=!1,this.pendingStep=!1},step:function(){this.pendingStep=!1,this.stepCount++},destroy:function(){this.raf.stop(),this.debug.destroy(),this.state.destroy(),this.sound.destroy(),this.scale.destroy(),this.stage.destroy(),this.input.destroy(),this.physics.destroy(),this.plugins.destroy(),this.tweens.destroy(),this.debug=null,this.state=null,this.sound=null,this.scale=null,this.stage=null,this.input=null,this.physics=null,this.plugins=null,this.tweens=null,this.cache=null,this.load=null,this.time=null,this.world=null,this.isBooted=!1,this.renderer.destroy(!1),n.Canvas.removeFromDOM(this.canvas),PIXI.game===this&&(PIXI.game=null),PIXI.defaultRenderer=null,n.GAMES[this.id]=null},gamePaused:function(t){this._paused||(this._paused=!0,this.time.gamePaused(),this.sound.gamePaused(),this.onPause.dispatch(t),this.device.cordova&&this.device.iOS&&(this.lockRender=!0))},gameResumed:function(t){this._paused&&!this._codePaused&&(this._paused=!1,this.time.gameResumed(),this.input.reset(),this.sound.gameResumed(),this.onResume.dispatch(t),this.device.cordova&&this.device.iOS&&(this.lockRender=!1))},focusLoss:function(t){this.onBlur.dispatch(t),this.stage.disableVisibilityChange||this.gamePaused(t)},focusGain:function(t){this.focusWindow(),this.onFocus.dispatch(t),this.stage.disableVisibilityChange||this.gameResumed(t)},focusWindow:function(){window.focus&&(!window.PhaserGlobal||window.PhaserGlobal&&!window.PhaserGlobal.stopFocus)&&window.focus()}},n.Game.prototype.constructor=n.Game,Object.defineProperty(n.Game.prototype,"paused",{get:function(){return this._paused},set:function(t){!0===t?(!1===this._paused&&(this._paused=!0,this.sound.muteOnPause&&this.sound.setMute(),this.time.gamePaused(),this.onPause.dispatch(this)),this._codePaused=!0):(this._paused&&(this._paused=!1,this.input.reset(),this.sound.unsetMute(),this.time.gameResumed(),this.onResume.dispatch(this)),this._codePaused=!1)}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Input=function(t){this.game=t,this.hitCanvas=null,this.hitContext=null,this.moveCallbacks=[],this.customCandidateHandler=null,this.customCandidateHandlerContext=null,this.pollRate=0,this.enabled=!0,this.multiInputOverride=n.Input.MOUSE_TOUCH_COMBINE,this.position=null,this.speed=null,this.circle=null,this.scale=null,this.maxPointers=-1,this.tapRate=200,this.doubleTapRate=300,this.holdRate=2e3,this.justPressedRate=200,this.justReleasedRate=200,this.recordPointerHistory=!1,this.recordRate=100,this.recordLimit=100,this.touchLockCallbacks=[],this.pointer1=null,this.pointer2=null,this.pointer3=null,this.pointer4=null,this.pointer5=null,this.pointer6=null,this.pointer7=null,this.pointer8=null,this.pointer9=null,this.pointer10=null,this.pointers=[],this.activePointer=null,this.mousePointer=null,this.mouse=null,this.keyboard=null,this.touch=null,this.mspointer=null,this.gamepad=null,this.resetLocked=!1,this.onDown=null,this.onUp=null,this.onTap=null,this.onHold=null,this.minPriorityID=0,this.interactiveItems=new n.ArraySet,this._localPoint=new n.Point,this._pollCounter=0,this._oldPosition=null,this._x=0,this._y=0},n.Input.MOUSE_OVERRIDES_TOUCH=0,n.Input.TOUCH_OVERRIDES_MOUSE=1,n.Input.MOUSE_TOUCH_COMBINE=2,n.Input.MAX_POINTERS=10,n.Input.prototype={boot:function(t){"maxPointers"in t&&(this.maxPointers=t.maxPointers),this.mousePointer=new n.Pointer(this.game,0,n.PointerMode.CURSOR),this.addPointer(),this.addPointer(),this.mouse=new n.Mouse(this.game),this.touch=new n.Touch(this.game),this.mspointer=new n.MSPointer(this.game),this.mouseWheel=new n.MouseWheel(this.game),this.pointerLock=new n.PointerLock(this.game),n.Keyboard&&(this.keyboard=new n.Keyboard(this.game)),n.Gamepad&&(this.gamepad=new n.Gamepad(this.game)),this.onDown=new n.Signal,this.onUp=new n.Signal,this.onTap=new n.Signal,this.onHold=new n.Signal,this.scale=new n.Point(1,1),this.speed=new n.Point,this.position=new n.Point,this._oldPosition=new n.Point,this.circle=new n.Circle(0,0,45),this.activePointer=this.mousePointer,this.hitCanvas=n.CanvasPool.create(this,1,1),this.hitContext=this.hitCanvas.getContext("2d"),this.game.device.mspointer&&!1!==t.mspointer?this.mspointer.start():this.game.device.touch&&!1!==t.touch&&this.touch.start(),this.mspointer.active||!1===t.mouse||this.mouse.start(),this.mousePointer.active=!0,!0===t.mouseWheel&&this.mouseWheel.start(),!1!==t.pointerLock&&this.pointerLock.start(),this.keyboard&&!1!==t.keyboard&&this.keyboard.start();var e=this;this._onClickTrampoline=function(t){e.onClickTrampoline(t)},this.game.canvas.addEventListener("click",this._onClickTrampoline,!1)},destroy:function(){this.mouse.stop(),this.mouseWheel.stop(),this.touch.stop(),this.mspointer.stop(),this.pointerLock.stop(),this.keyboard&&this.keyboard.stop(),this.gamepad&&this.gamepad.stop(),this.moveCallbacks=[],n.CanvasPool.remove(this),this.game.canvas.removeEventListener("click",this._onClickTrampoline)},setInteractiveCandidateHandler:function(t,e){this.customCandidateHandler=t,this.customCandidateHandlerContext=e},addMoveCallback:function(t,e){this.moveCallbacks.push({callback:t,context:e})},addTouchLockCallback:function(t,e,i){void 0===i&&(i=!1),this.touchLockCallbacks.push({callback:t,context:e,onEnd:i})},removeTouchLockCallback:function(t,e){for(var i=this.touchLockCallbacks.length;i--;)if(this.touchLockCallbacks[i].callback===t&&this.touchLockCallbacks[i].context===e)return this.touchLockCallbacks.splice(i,1),!0;return!1},executeTouchLockCallbacks:function(t,e){for(var i=this.touchLockCallbacks.length;i--;){var n=this.touchLockCallbacks[i];n.onEnd===t&&n.callback.call(n.context,this,e)&&this.touchLockCallbacks.splice(i,1)}},deleteMoveCallback:function(t,e){for(var i=this.moveCallbacks.length;i--;)if(this.moveCallbacks[i].callback===t&&this.moveCallbacks[i].context===e)return void this.moveCallbacks.splice(i,1)},addPointer:function(){if(this.pointers.length>=n.Input.MAX_POINTERS)return console.warn("Phaser.Input.addPointer: Maximum limit of "+n.Input.MAX_POINTERS+" pointers reached."),null;var t=this.pointers.length+1,e=new n.Pointer(this.game,t,n.PointerMode.CONTACT);return this.pointers.push(e),this["pointer"+t]=e,e},update:function(){if(this.keyboard&&this.keyboard.update(),this.pollRate>0&&this._pollCounter=0&&this.countActivePointers(this.maxPointers)>=this.maxPointers)return null;if(!this.pointer1.active)return this.pointer1.start(t);if(!this.pointer2.active)return this.pointer2.start(t);for(var e=2;e0;i++){this.pointers[i].active&&e--}return t-e},getPointer:function(t){void 0===t&&(t=!1);for(var e=0;e=o&&this.game.camera.x+e.x=a&&this.game.camera.y+e.y=o&&this._localPoint.x=a&&this._localPoint.y=o&&this._localPoint.x=a&&this._localPoint.y0&&this._pollCounter + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Mouse=function(t){this.game=t,this.input=t.input,this.callbackContext=this.game,this.mouseDownCallback=null,this.mouseUpCallback=null,this.mouseOutCallback=null,this.mouseOverCallback=null,this.capture=!1,this.active=!1,this.enabled=!0,this.stopOnGameOut=!1,this.event=null,this._onMouseDown=null,this._onMouseMove=null,this._onMouseUp=null,this._onMouseOut=null,this._onMouseOver=null},n.Mouse.NO_BUTTON=-1,n.Mouse.LEFT_BUTTON=0,n.Mouse.MIDDLE_BUTTON=1,n.Mouse.RIGHT_BUTTON=2,n.Mouse.BACK_BUTTON=3,n.Mouse.FORWARD_BUTTON=4,n.Mouse.prototype={start:function(){var t=this.game.device;if(t.isAndroidStockBrowser()&&this.input.touch.active)return!1;if(null!==this._onMouseDown)return!1;var e=this;this._onMouseDown=function(t){return e.onMouseDown(t)},this._onMouseMove=function(t){return e.onMouseMove(t)},this._onMouseUp=function(t){return e.onMouseUp(t)},this._onMouseUpGlobal=function(t){return e.onMouseUpGlobal(t)},this._onMouseOutGlobal=function(t){return e.onMouseOutGlobal(t)},this._onMouseOut=function(t){return e.onMouseOut(t)},this._onMouseOver=function(t){return e.onMouseOver(t)};var i=this.game.canvas;return i.addEventListener("mousedown",this._onMouseDown,!0),i.addEventListener("mousemove",this._onMouseMove,!0),i.addEventListener("mouseup",this._onMouseUp,!0),t.cocoonJS||(window.addEventListener("mouseup",this._onMouseUpGlobal,!0),window.addEventListener("mouseout",this._onMouseOutGlobal,!0),i.addEventListener("mouseover",this._onMouseOver,!0),i.addEventListener("mouseout",this._onMouseOut,!0)),this.active=!0,!0},onMouseDown:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseDownCallback&&this.mouseDownCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.start(t))},onMouseMove:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseMoveCallback&&this.mouseMoveCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.move(t))},onMouseUp:function(t){this.event=t,this.capture&&t.preventDefault(),this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=0,this.input.mousePointer.stop(t))},onMouseUpGlobal:function(t){this.input.mousePointer.withinGame||(this.mouseUpCallback&&this.mouseUpCallback.call(this.callbackContext,t),t.identifier=0,this.input.mousePointer.stop(t))},onMouseOutGlobal:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!1,this.input.enabled&&this.enabled&&(this.input.mousePointer.stop(t),this.input.mousePointer.resetButtons())},onMouseOut:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!1,this.mouseOutCallback&&this.mouseOutCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(this.input.mousePointer.updateButtons(t),this.stopOnGameOut&&(t.identifier=0,this.input.mousePointer.stop(t),this.input.callAll("_pointerOutHandler",this.input.mousePointer)))},onMouseOver:function(t){this.event=t,this.capture&&t.preventDefault(),this.input.mousePointer.withinGame=!0,this.mouseOverCallback&&this.mouseOverCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&this.input.mousePointer.updateButtons(t)},stop:function(){var t=this.game.canvas;t.removeEventListener("mousedown",this._onMouseDown,!0),t.removeEventListener("mousemove",this._onMouseMove,!0),t.removeEventListener("mouseup",this._onMouseUp,!0),t.removeEventListener("mouseover",this._onMouseOver,!0),t.removeEventListener("mouseout",this._onMouseOut,!0),window.removeEventListener("mouseup",this._onMouseUpGlobal,!0),window.removeEventListener("mouseout",this._onMouseOutGlobal,!0),this.active=!1}},n.Mouse.prototype.constructor=n.Mouse,n.MouseWheel=function(t){this.game=t,this.input=t.input,this.element=t.canvas,this.preventDefault=!0,this.active=!1,this.callback=null,this.callbackContext=t,this.delta=0,this.wheelEventName=t.device.wheelEvent,this.boundOnWheelHandler=this.onWheelHandler.bind(this),this.eventProxy=null},n.MouseWheel.UP=1,n.MouseWheel.DOWN=-1,n.MouseWheel.prototype.start=function(){return!(!this.wheelEventName||this.active)&&(this.element.addEventListener(this.wheelEventName,this.boundOnWheelHandler,!0),"mousewheel"===this.wheelEventName?this.eventProxy=new n.WheelEventProxy(-1/40,1):"DOMMouseScroll"===this.wheelEventName&&(this.eventProxy=new n.WheelEventProxy(1,1)),this.active=!0,!0)},n.MouseWheel.prototype.stop=function(){this.active&&(this.element.removeEventListener(this.wheelEventName,this.boundOnWheelHandler,!0),this.active=!1)},n.MouseWheel.prototype.onWheelHandler=function(t){this.eventProxy&&(t=this.eventProxy.bindEvent(t)),this.preventDefault&&t.preventDefault(),this.delta=n.Math.clamp(-t.deltaY,-1,1),this.callback&&this.callback.call(this.callbackContext,t)}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.MSPointer=function(t){this.game=t,this.input=t.input,this.callbackContext=this.game,this.pointerDownCallback=null,this.pointerMoveCallback=null,this.pointerUpCallback=null,this.pointerOutCallback=null,this.pointerOverCallback=null,this.pointerCancelCallback=null,this.capture=!1,this.event=null,this.active=!1,this.enabled=!0,this.stopOnGameOut=!1,this._onMSPointerDown=null,this._onMSPointerMove=null,this._onMSPointerUp=null,this._onMSPointerUpGlobal=null,this._onMSPointerOut=null,this._onMSPointerOver=null},n.MSPointer.prototype={start:function(){if(!this.game.device.mspointer)return!1;if(null!==this._onMSPointerDown)return!1;var t=this;this._onMSPointerDown=function(e){return t.onPointerDown(e)},this._onMSPointerMove=function(e){return t.onPointerMove(e)},this._onMSPointerUp=function(e){return t.onPointerUp(e)},this._onMSPointerUpGlobal=function(e){return t.onPointerUpGlobal(e)},this._onMSPointerOut=function(e){return t.onPointerOut(e)},this._onMSPointerOver=function(e){return t.onPointerOver(e)},this._onMSPointerCancel=function(e){return t.onPointerCancel(e)};var e=this.game.canvas;return e.addEventListener("MSPointerDown",this._onMSPointerDown,!1),e.addEventListener("MSPointerMove",this._onMSPointerMove,!1),e.addEventListener("MSPointerUp",this._onMSPointerUp,!1),e.addEventListener("MSPointerCancel",this._onMSPointerCancel,!1),e.addEventListener("pointerdown",this._onMSPointerDown,!1),e.addEventListener("pointermove",this._onMSPointerMove,!1),e.addEventListener("pointerup",this._onMSPointerUp,!1),e.addEventListener("pointercancel",this._onMSPointerCancel,!1),e.style["-ms-content-zooming"]="none",e.style["-ms-touch-action"]="none",this.game.device.cocoonJS||(window.addEventListener("MSPointerUp",this._onMSPointerUpGlobal,!0),e.addEventListener("MSPointerOver",this._onMSPointerOver,!0),e.addEventListener("MSPointerOut",this._onMSPointerOut,!0),window.addEventListener("pointerup",this._onMSPointerUpGlobal,!0),e.addEventListener("pointerover",this._onMSPointerOver,!0),e.addEventListener("pointerout",this._onMSPointerOut,!0)),this.active=!0,!0},onPointerDown:function(t){this.game.input.executeTouchLockCallbacks(!1,t),this.event=t,this.capture&&t.preventDefault(),this.pointerDownCallback&&this.pointerDownCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.start(t):this.input.startPointer(t))},onPointerMove:function(t){this.event=t,this.capture&&t.preventDefault(),this.pointerMoveCallback&&this.pointerMoveCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.move(t):this.input.updatePointer(t))},onPointerUp:function(t){this.game.input.executeTouchLockCallbacks(!0,t),this.event=t,this.capture&&t.preventDefault(),this.pointerUpCallback&&this.pointerUpCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.stop(t):this.input.stopPointer(t))},onPointerUpGlobal:function(t){if(t.identifier=t.pointerId,this.isMousePointerEvent(t)&&!this.input.mousePointer.withinGame)this.onPointerUp(t);else{var e=this.input.getPointerFromIdentifier(t.identifier);e&&e.withinGame&&this.onPointerUp(t)}},onPointerOut:function(t){this.event=t,this.capture&&t.preventDefault(),t.identifier=t.pointerId;var e=this.getPointerFromEvent(t);e&&(e.withinGame=!1),this.pointerOutCallback&&this.pointerOutCallback.call(this.callbackContext,t),this.input.enabled&&this.enabled&&this.stopOnGameOut&&(t.identifier=0,e||(e=this.input.mousePointer),e.stop(t),this.input.callAll("_pointerOutHandler",e))},onPointerOver:function(t){this.event=t,this.capture&&t.preventDefault(),t.identifier=t.pointerId;var e=this.getPointerFromEvent(t);e&&(e.withinGame=!0),this.pointerOverCallback&&this.pointerOverCallback.call(this.callbackContext,t)},onPointerCancel:function(t){this.event=t,this.pointerCancelCallback&&this.pointerCancelCallback.call(this.callbackContext,t),this.game.input.enabled&&this.enabled&&(t.identifier=t.pointerId,this.isMousePointerEvent(t)?this.input.mousePointer.stop(t):this.input.stopPointer(t))},stop:function(){var t=this.game.canvas;t.removeEventListener("MSPointerDown",this._onMSPointerDown,!1),t.removeEventListener("MSPointerMove",this._onMSPointerMove,!1),t.removeEventListener("MSPointerUp",this._onMSPointerUp,!1),t.removeEventListener("pointerdown",this._onMSPointerDown,!1),t.removeEventListener("pointermove",this._onMSPointerMove,!1),t.removeEventListener("pointerup",this._onMSPointerUp,!1),window.removeEventListener("MSPointerUp",this._onMSPointerUpGlobal,!0),t.removeEventListener("MSPointerOver",this._onMSPointerOver,!0),t.removeEventListener("MSPointerOut",this._onMSPointerOut,!0),window.removeEventListener("pointerup",this._onMSPointerUpGlobal,!0),t.removeEventListener("pointerover",this._onMSPointerOver,!0),t.removeEventListener("pointerout",this._onMSPointerOut,!0),this.active=!1},isMousePointerEvent:function(t){return"mouse"===t.pointerType||4===t.pointerType},getPointerFromEvent:function(t){return this.isMousePointerEvent(t)?this.input.mousePointer:this.input.getPointerFromIdentifier(t.identifier)}},n.MSPointer.prototype.constructor=n.MSPointer, +/** + * @author Richard Davey + * @author @karlmacklin + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.DeviceButton=function(t,e){this.parent=t,this.game=t.game,this.event=null,this.isDown=!1,this.isUp=!0,this.timeDown=0,this.timeUp=0,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1,this.value=0,this.buttonCode=e,this.onDown=new n.Signal,this.onUp=new n.Signal,this.onFloat=new n.Signal},n.DeviceButton.prototype={start:function(t,e){this.isDown||(this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.time,this.repeats=0,this.event=t,this.value=e,t&&(this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.ctrlKey=t.ctrlKey),this.onDown.dispatch(this,e))},stop:function(t,e){this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.event=t,this.value=e,t&&(this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.ctrlKey=t.ctrlKey),this.onUp.dispatch(this,e))},startStop:function(t,e,i){t?this.start(e,i):this.stop(e,i)},padFloat:function(t){this.isDown=!1,this.isUp=!1,this.value=t,this.onFloat.dispatch(this,t)},justPressed:function(t){return t=t||250,this.isDown&&this.timeDown+t>this.game.time.time},justReleased:function(t){return t=t||250,this.isUp&&this.timeUp+t>this.game.time.time},reset:function(){this.isDown=!1,this.isUp=!0,this.timeDown=this.game.time.time,this.repeats=0,this.altKey=!1,this.shiftKey=!1,this.ctrlKey=!1},destroy:function(){this.onDown.dispose(),this.onUp.dispose(),this.onFloat.dispose(),this.parent=null,this.game=null}},n.DeviceButton.prototype.constructor=n.DeviceButton,Object.defineProperty(n.DeviceButton.prototype,"duration",{get:function(){return this.isUp?-1:this.game.time.time-this.timeDown}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Pointer=function(t,e,i){this.game=t,this.id=e,this.type=n.POINTER,this.exists=!0,this.identifier=0,this.pointerId=null,this.pointerMode=i||n.PointerMode.CURSOR|n.PointerMode.CONTACT,this.target=null,this.button=null,this.leftButton=new n.DeviceButton(this,n.Pointer.LEFT_BUTTON),this.middleButton=new n.DeviceButton(this,n.Pointer.MIDDLE_BUTTON),this.rightButton=new n.DeviceButton(this,n.Pointer.RIGHT_BUTTON),this.backButton=new n.DeviceButton(this,n.Pointer.BACK_BUTTON),this.forwardButton=new n.DeviceButton(this,n.Pointer.FORWARD_BUTTON),this.eraserButton=new n.DeviceButton(this,n.Pointer.ERASER_BUTTON),this._holdSent=!1,this._history=[],this._nextDrop=0,this._stateReset=!1,this.withinGame=!1,this.clientX=-1,this.clientY=-1,this.pageX=-1,this.pageY=-1,this.screenX=-1,this.screenY=-1,this.rawMovementX=0,this.rawMovementY=0,this.movementX=0,this.movementY=0,this.x=-1,this.y=-1,this.isMouse=0===e,this.isDown=!1,this.isUp=!0,this.timeDown=0,this.timeUp=0,this.previousTapTime=0,this.totalTouches=0,this.msSinceLastClick=Number.MAX_VALUE,this.targetObject=null,this.interactiveCandidates=[],this.active=!1,this.dirty=!1,this.position=new n.Point,this.positionDown=new n.Point,this.positionUp=new n.Point,this.circle=new n.Circle(0,0,44),this._clickTrampolines=null,this._trampolineTargetObject=null},n.Pointer.NO_BUTTON=0,n.Pointer.LEFT_BUTTON=1,n.Pointer.RIGHT_BUTTON=2,n.Pointer.MIDDLE_BUTTON=4,n.Pointer.BACK_BUTTON=8,n.Pointer.FORWARD_BUTTON=16,n.Pointer.ERASER_BUTTON=32,n.Pointer.prototype={resetButtons:function(){this.isDown=!1,this.isUp=!0,this.isMouse&&(this.leftButton.reset(),this.middleButton.reset(),this.rightButton.reset(),this.backButton.reset(),this.forwardButton.reset(),this.eraserButton.reset())},processButtonsDown:function(t,e){switch(t){case n.Mouse.LEFT_BUTTON:this.leftButton.start(e);break;case n.Mouse.RIGHT_BUTTON:this.rightButton.start(e);break;case n.Mouse.MIDDLE_BUTTON:this.middleButton.start(e);break;case n.Mouse.BACK_BUTTON:this.backButton.start(e);break;case n.Mouse.FORWARD_BUTTON:this.forwardButton.start(e)}},processButtonsUp:function(t,e){switch(t){case n.Mouse.LEFT_BUTTON:this.leftButton.stop(e);break;case n.Mouse.RIGHT_BUTTON:this.rightButton.stop(e);break;case n.Mouse.MIDDLE_BUTTON:this.middleButton.stop(e);break;case n.Mouse.BACK_BUTTON:this.backButton.stop(e);break;case n.Mouse.FORWARD_BUTTON:this.forwardButton.stop(e)}},processButtonsUpDown:function(t,e){var i=e.type.toLowerCase().substr(-4),s="down"===i,r="move"===i;void 0!==t?(s&&1===t&&e.ctrlKey&&(t=2),this.leftButton.startStop(n.Pointer.LEFT_BUTTON&t,e),this.rightButton.startStop(n.Pointer.RIGHT_BUTTON&t,e),this.middleButton.startStop(n.Pointer.MIDDLE_BUTTON&t,e),this.backButton.startStop(n.Pointer.BACK_BUTTON&t,e),this.forwardButton.startStop(n.Pointer.FORWARD_BUTTON&t,e),this.eraserButton.startStop(n.Pointer.ERASER_BUTTON&t,e)):void 0!==e.button?s&&e.ctrlKey&&0===e.button?this.rightButton.start(e):s?this.processButtonsDown(e.button,e):r||this.processButtonsUp(e.button,e):s?e.ctrlKey?this.rightButton.start(e):this.leftButton.start(e):(this.leftButton.stop(e),this.rightButton.stop(e))},updateButtons:function(t){this.button=t.button,this.processButtonsUpDown(t.buttons,t),this.isUp=!0,this.isDown=!1,(this.leftButton.isDown||this.rightButton.isDown||this.middleButton.isDown||this.backButton.isDown||this.forwardButton.isDown||this.eraserButton.isDown)&&(this.isUp=!1,this.isDown=!0)},start:function(t){var e=this.game.input;return t.pointerId&&(this.pointerId=t.pointerId),this.identifier=t.identifier,this.target=t.target,this.isMouse?this.updateButtons(t):(this.isDown=!0,this.isUp=!1),this.active=!0,this.withinGame=!0,this.dirty=!1,this._history=[],this._clickTrampolines=null,this._trampolineTargetObject=null,this.msSinceLastClick=this.game.time.time-this.timeDown,this.timeDown=this.game.time.time,this._holdSent=!1,this.move(t,!0),this.positionDown.setTo(this.x,this.y),(e.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||e.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||e.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===e.totalActivePointers)&&(e.x=this.x,e.y=this.y,e.position.setTo(this.x,this.y),e.onDown.dispatch(this,t),e.resetSpeed(this.x,this.y)),this._stateReset=!1,this.totalTouches++,null!==this.targetObject&&this.targetObject._touchedHandler(this),this},update:function(){var t=this.game.input;this.active&&(this.dirty&&(t.interactiveItems.total>0&&this.processInteractiveObjects(!1),this.dirty=!1),!1===this._holdSent&&this.duration>=t.holdRate&&((t.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||t.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||t.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===t.totalActivePointers)&&t.onHold.dispatch(this),this._holdSent=!0),t.recordPointerHistory&&this.game.time.time>=this._nextDrop&&(this._nextDrop=this.game.time.time+t.recordRate,this._history.push({x:this.position.x,y:this.position.y}),this._history.length>t.recordLimit&&this._history.shift()))},move:function(t,e){var i=this.game.input;if(!i.pollLocked){void 0===e&&(e=!1),void 0!==t.button&&(this.button=t.button),this.isMouse&&this.updateButtons(t),this.clientX=t.clientX,this.clientY=t.clientY,this.pageX=t.pageX,this.pageY=t.pageY,this.screenX=t.screenX,this.screenY=t.screenY,this.isMouse&&i.pointerLock.locked&&!e&&(this.rawMovementX=t.movementX||t.mozMovementX||t.webkitMovementX||0,this.rawMovementY=t.movementY||t.mozMovementY||t.webkitMovementY||0,this.movementX+=this.rawMovementX,this.movementY+=this.rawMovementY),this.x=(this.pageX-this.game.scale.offset.x)*i.scale.x,this.y=(this.pageY-this.game.scale.offset.y)*i.scale.y,this.position.setTo(this.x,this.y),this.circle.x=this.x,this.circle.y=this.y,(i.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||i.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||i.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===i.totalActivePointers)&&(i.activePointer=this,i.x=this.x,i.y=this.y,i.position.setTo(i.x,i.y),i.circle.x=i.x,i.circle.y=i.y),this.withinGame=this.game.scale.bounds.contains(this.pageX,this.pageY);for(var s=i.moveCallbacks.length;s--;)i.moveCallbacks[s].callback.call(i.moveCallbacks[s].context,this,this.x,this.y,e,t);return null===this.targetObject||this.game.paused&&!this.targetObject.noPause||!0!==this.targetObject.isDragged?i.interactiveItems.total>0&&this.processInteractiveObjects(e):!1===this.targetObject.update(this)&&(this.targetObject=null),this}},processInteractiveObjects:function(t){var e=0,i=-1,n=null,s=this.game.input.interactiveItems.first;for(this.interactiveCandidates=[];s;)s.checked=!1,!s.validForInput(i,e,!1)||this.game.paused&&!s.sprite.noPause||(s.checked=!0,(t&&s.checkPointerDown(this,!0)||!t&&s.checkPointerOver(this,!0))&&(e=s.sprite.renderOrderID,i=s.priorityID,n=s,this.interactiveCandidates.push(s))),s=this.game.input.interactiveItems.next;for(s=this.game.input.interactiveItems.first;s;)!s.checked&&s.validForInput(i,e,!0)&&(t&&s.checkPointerDown(this,!1)||!t&&s.checkPointerOver(this,!1))&&(e=s.sprite.renderOrderID,i=s.priorityID,n=s,this.interactiveCandidates.push(s)),s=this.game.input.interactiveItems.next;return this.game.input.customCandidateHandler&&(n=this.game.input.customCandidateHandler.call(this.game.input.customCandidateHandlerContext,this,this.interactiveCandidates,n)),this.swapTarget(n,!1),null!==this.targetObject},swapTarget:function(t,e){void 0===e&&(e=!1),null===t?this.targetObject&&(this.targetObject._pointerOutHandler(this,e),this.targetObject=null):null===this.targetObject?(this.targetObject=t,t._pointerOverHandler(this,e)):this.targetObject===t?!1===t.update(this)&&(this.targetObject=null):(this.targetObject._pointerOutHandler(this,e),this.targetObject=t,this.targetObject._pointerOverHandler(this,e))},leave:function(t){this.withinGame=!1,this.move(t,!1)},stop:function(t){var e=this.game.input;if(!this._stateReset||!this.withinGame){if(this.timeUp=this.game.time.time,(e.multiInputOverride===n.Input.MOUSE_OVERRIDES_TOUCH||e.multiInputOverride===n.Input.MOUSE_TOUCH_COMBINE||e.multiInputOverride===n.Input.TOUCH_OVERRIDES_MOUSE&&0===e.totalActivePointers)&&(e.onUp.dispatch(this,t),this.duration>=0&&this.duration<=e.tapRate)){var i=this.timeUp-this.previousTapTime0&&(this.active=!1),this.withinGame=this.game.scale.bounds.contains(t.pageX,t.pageY),this.pointerId=null,this.identifier=null,this.positionUp.setTo(this.x,this.y),!1===this.isMouse&&e.currentPointers--,e.callAll("_releasedHandler",this),this._clickTrampolines&&(this._trampolineTargetObject=this.targetObject),this.targetObject=null,this}t.preventDefault()},justPressed:function(t){return t=t||this.game.input.justPressedRate,!0===this.isDown&&this.timeDown+t>this.game.time.time},justReleased:function(t){return t=t||this.game.input.justReleasedRate,this.isUp&&this.timeUp+t>this.game.time.time},addClickTrampoline:function(t,e,i,n){if(this.isDown){for(var s=this._clickTrampolines=this._clickTrampolines||[],r=0;r + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Touch=function(t){this.game=t,this.active=!1,this.enabled=!0,this.callbackContext=this.game,this.touchStartCallback=null,this.touchMoveCallback=null,this.touchEndCallback=null,this.touchEnterCallback=null,this.touchLeaveCallback=null,this.touchCancelCallback=null,this.preventDefault=!0,this.event=null,this._onTouchStart=null,this._onTouchMove=null,this._onTouchEnd=null,this._onTouchEnter=null,this._onTouchLeave=null,this._onTouchCancel=null,this._onTouchMove=null},n.Touch.prototype={start:function(){if(!this.game.device.touch)return!1;if(null!==this._onTouchStart)return!1;var t=this;return this._onTouchStart=function(e){return t.onTouchStart(e)},this._onTouchMove=function(e){return t.onTouchMove(e)},this._onTouchEnd=function(e){return t.onTouchEnd(e)},this._onTouchEnter=function(e){return t.onTouchEnter(e)},this._onTouchLeave=function(e){return t.onTouchLeave(e)},this._onTouchCancel=function(e){return t.onTouchCancel(e)},this.game.canvas.addEventListener("touchstart",this._onTouchStart,!1),this.game.canvas.addEventListener("touchmove",this._onTouchMove,!1),this.game.canvas.addEventListener("touchend",this._onTouchEnd,!1),this.game.canvas.addEventListener("touchcancel",this._onTouchCancel,!1),this.game.device.cocoonJS||(this.game.canvas.addEventListener("touchenter",this._onTouchEnter,!1),this.game.canvas.addEventListener("touchleave",this._onTouchLeave,!1)),this.active=!0,!0},consumeDocumentTouches:function(){this._documentTouchMove=function(t){t.preventDefault()},document.addEventListener("touchmove",this._documentTouchMove,!1)},onTouchStart:function(t){if(this.game.input.executeTouchLockCallbacks(!1,t),this.event=t,this.game.input.enabled&&this.enabled){this.touchStartCallback&&this.touchStartCallback.call(this.callbackContext,t),this.preventDefault&&t.preventDefault();for(var e=0;e + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.InputHandler=function(t){this.sprite=t,this.game=t.game,this.enabled=!1,this.checked=!1,this.priorityID=0,this.useHandCursor=!1,this._setHandCursor=!1,this.isDragged=!1,this.allowHorizontalDrag=!0,this.allowVerticalDrag=!0,this.bringToTop=!1,this.snapOffset=null,this.snapOnDrag=!1,this.snapOnRelease=!1,this.snapX=0,this.snapY=0,this.snapOffsetX=0,this.snapOffsetY=0,this.pixelPerfectOver=!1,this.pixelPerfectClick=!1,this.pixelPerfectAlpha=255,this.draggable=!1,this.boundsRect=null,this.boundsSprite=null,this.scaleLayer=!1,this.dragOffset=new n.Point,this.dragFromCenter=!1,this.dragStopBlocksInputUp=!1,this.dragStartPoint=new n.Point,this.dragDistanceThreshold=0,this.dragTimeThreshold=0,this.downPoint=new n.Point,this.snapPoint=new n.Point,this._dragPoint=new n.Point,this._dragPhase=!1,this._pendingDrag=!1,this._dragTimePass=!1,this._dragDistancePass=!1,this._wasEnabled=!1,this._tempPoint=new n.Point,this._pointerData=[],this._pointerData.push({id:0,x:0,y:0,camX:0,camY:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1})},n.InputHandler.prototype={start:function(t,e){if(t=t||0,void 0===e&&(e=!1),!1===this.enabled){this.game.input.interactiveItems.add(this),this.useHandCursor=e,this.priorityID=t;for(var i=0;i<10;i++)this._pointerData[i]={id:i,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1};this.snapOffset=new n.Point,this.enabled=!0,this._wasEnabled=!0}return this.sprite.events.onAddedToGroup.add(this.addedToGroup,this),this.sprite.events.onRemovedFromGroup.add(this.removedFromGroup,this),this.sprite},addedToGroup:function(){this._dragPhase||this._wasEnabled&&!this.enabled&&this.start()},removedFromGroup:function(){this._dragPhase||(this.enabled?(this._wasEnabled=!0,this.stop()):this._wasEnabled=!1)},reset:function(){this.enabled=!1;for(var t=0;t<10;t++)this._pointerData[t]={id:t,x:0,y:0,isDown:!1,isUp:!1,isOver:!1,isOut:!1,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:!1}},stop:function(){!1!==this.enabled&&(this.enabled=!1,this.game.input.interactiveItems.remove(this))},destroy:function(){this.sprite&&(this._setHandCursor&&(this.game.canvas.style.cursor="",this._setHandCursor=!1),this.enabled=!1,this.game.input.interactiveItems.remove(this),this._pointerData.length=0,this.boundsRect=null,this.boundsSprite=null,this.sprite=null)},validForInput:function(t,e,i){return void 0===i&&(i=!0),!(!this.enabled||0===this.sprite.scale.x||0===this.sprite.scale.y||this.priorityIDt||this.priorityID===t&&this.sprite.renderOrderID>e))},isPixelPerfect:function(){return this.pixelPerfectClick||this.pixelPerfectOver},pointerX:function(t){return t=t||0,this._pointerData[t].x},pointerY:function(t){return t=t||0,this._pointerData[t].y},pointerDown:function(t){return t=t||0,this._pointerData[t].isDown},pointerUp:function(t){return t=t||0,this._pointerData[t].isUp},pointerTimeDown:function(t){return t=t||0,this._pointerData[t].timeDown},pointerTimeUp:function(t){return t=t||0,this._pointerData[t].timeUp},pointerOver:function(t){if(!this.enabled)return!1;if(void 0===t){for(var e=0;e<10;e++)if(this._pointerData[e].isOver)return!0;return!1}return this._pointerData[t].isOver},pointerOut:function(t){if(!this.enabled)return!1;if(void 0!==t)return this._pointerData[t].isOut;for(var e=0;e<10;e++)if(this._pointerData[e].isOut)return!0},pointerTimeOver:function(t){return t=t||0,this._pointerData[t].timeOver},pointerTimeOut:function(t){return t=t||0,this._pointerData[t].timeOut},pointerDragged:function(t){return t=t||0,this._pointerData[t].isDragged},checkPointerDown:function(t,e){return!!(t.isDown&&this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectClick)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPointerOver:function(t,e){return!!(this.enabled&&this.sprite&&this.sprite.parent&&this.sprite.visible&&this.sprite.parent.visible&&0!==this.sprite.worldScale.x&&0!==this.sprite.worldScale.y)&&(!!this.game.input.hitTest(this.sprite,t,this._tempPoint)&&(void 0===e&&(e=!1),!(!e&&this.pixelPerfectOver)||this.checkPixel(this._tempPoint.x,this._tempPoint.y)))},checkPixel:function(t,e,i){if(this.sprite.texture.baseTexture.source){if(null===t&&null===e){this.game.input.getLocalPosition(this.sprite,i,this._tempPoint);t=this._tempPoint.x,e=this._tempPoint.y}if(0!==this.sprite.anchor.x&&(t-=-this.sprite.texture.frame.width*this.sprite.anchor.x),0!==this.sprite.anchor.y&&(e-=-this.sprite.texture.frame.height*this.sprite.anchor.y),t+=this.sprite.texture.frame.x,e+=this.sprite.texture.frame.y,this.sprite.texture.trim&&(t-=this.sprite.texture.trim.x,e-=this.sprite.texture.trim.y,tthis.sprite.texture.crop.right||ethis.sprite.texture.crop.bottom))return this._dx=t,this._dy=e,!1;if(this._dx=t,this._dy=e,this.game.input.hitContext.clearRect(0,0,1,1),this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,t,e,1,1,0,0,1,1),this.game.input.hitContext.getImageData(0,0,1,1).data[3]>=this.pixelPerfectAlpha)return!0}return!1},update:function(t){if(null!==this.sprite&&void 0!==this.sprite.parent)return this.enabled&&this.sprite.visible&&this.sprite.parent.visible?this._pendingDrag?(this._dragDistancePass||(this._dragDistancePass=n.Math.distance(t.x,t.y,this.downPoint.x,this.downPoint.y)>=this.dragDistanceThreshold),this._dragDistancePass&&this._dragTimePass&&this.startDrag(t),!0):this.draggable&&this._draggedPointerID===t.id?this.updateDrag(t,!1):this._pointerData[t.id].isOver?this.checkPointerOver(t)?(this._pointerData[t.id].x=t.x-this.sprite.x,this._pointerData[t.id].y=t.y-this.sprite.y,!0):(this._pointerOutHandler(t),!1):void 0:(this._pointerOutHandler(t),!1)},_pointerOverHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];if(!1===i.isOver||t.dirty){var n=!1===i.isOver;i.isOver=!0,i.isOut=!1,i.timeOver=this.game.time.time,i.x=t.x-this.sprite.x,i.y=t.y-this.sprite.y,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="pointer",this._setHandCursor=!0),!e&&n&&this.sprite&&this.sprite.events&&this.sprite.events.onInputOver$dispatch(this.sprite,t),this.sprite.parent&&this.sprite.parent.onChildInputOver&&this.sprite.parent.onChildInputOver.dispatch(this.sprite,t)}}},_pointerOutHandler:function(t,e){if(null!==this.sprite){var i=this._pointerData[t.id];i.isOver=!1,i.isOut=!0,i.timeOut=this.game.time.time,this.useHandCursor&&!1===i.isDragged&&(this.game.canvas.style.cursor="",this._setHandCursor=!1),!e&&this.sprite&&this.sprite.events&&(this.sprite.events.onInputOut$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputOut&&this.sprite.parent.onChildInputOut.dispatch(this.sprite,t))}},_touchedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(!e.isDown&&e.isOver){if(this.pixelPerfectClick&&!this.checkPixel(null,null,t))return;if(e.isDown=!0,e.isUp=!1,e.timeDown=this.game.time.time,this.downPoint.set(t.x,t.y),t.dirty=!0,this.sprite&&this.sprite.events&&(this.sprite.events.onInputDown$dispatch(this.sprite,t),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputDown&&this.sprite.parent.onChildInputDown.dispatch(this.sprite,t),null===this.sprite))return;this.draggable&&!1===this.isDragged&&(0===this.dragTimeThreshold&&0===this.dragDistanceThreshold?this.startDrag(t):(this._pendingDrag=!0,this._dragDistancePass=0===this.dragDistanceThreshold,this.dragTimeThreshold>0?(this._dragTimePass=!1,this.game.time.events.add(this.dragTimeThreshold,this.dragTimeElapsed,this,t)):this._dragTimePass=!0)),this.bringToTop&&this.sprite.bringToTop()}}},dragTimeElapsed:function(t){this._dragTimePass=!0,this._pendingDrag&&this.sprite&&this._dragDistancePass&&this.startDrag(t)},_releasedHandler:function(t){if(null!==this.sprite){var e=this._pointerData[t.id];if(e.isDown&&t.isUp){e.isDown=!1,e.isUp=!0,e.timeUp=this.game.time.time,e.downDuration=e.timeUp-e.timeDown;var i=this.checkPointerOver(t);this.sprite&&this.sprite.events&&(this.dragStopBlocksInputUp&&(!this.dragStopBlocksInputUp||this.draggable&&this.isDragged&&this._draggedPointerID===t.id)||this.sprite.events.onInputUp$dispatch(this.sprite,t,i),this.sprite&&this.sprite.parent&&this.sprite.parent.onChildInputUp&&this.sprite.parent.onChildInputUp.dispatch(this.sprite,t,i),i&&(i=this.checkPointerOver(t))),e.isOver=i,!i&&this.useHandCursor&&(this.game.canvas.style.cursor="default",this._setHandCursor=!1),t.dirty=!0,this._pendingDrag=!1,this.draggable&&this.isDragged&&this._draggedPointerID===t.id&&this.stopDrag(t)}}},updateDrag:function(t,e){var i=this.game.camera,n=this.dragOffset,s=this._dragPoint,r=this._pointerData[t.id],o=this.snapPoint,a=this.sprite;if(void 0===e&&(e=!1),t.isUp)return this.stopDrag(t),!1;var h=this.globalToLocal(t);if(a.fixedToCamera)var l=i.scale.x*h.x+s.x+n.x,c=i.scale.y*h.y+s.y+n.y;else l=h.x+s.x+n.x,c=h.y+s.y+n.y;if(a.fixedToCamera){var u=a.cameraOffset,d=u.x,p=u.y;this.allowHorizontalDrag&&(u.x=l-i.x),this.allowVerticalDrag&&(u.y=c-i.y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(u.x=Math.round((u.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,u.y=Math.round((u.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,o.set(u.x,u.y));var f=u.x-d,g=u.y-p}else{var m=i.x-r.camX,y=i.y-r.camY;d=a.x,p=a.y;this.allowHorizontalDrag&&(a.x=l+m),this.allowVerticalDrag&&(a.y=c+y),this.boundsRect&&this.checkBoundsRect(),this.boundsSprite&&this.checkBoundsSprite(),this.snapOnDrag&&(a.x=Math.round((a.x-this.snapOffsetX%this.snapX)/this.snapX)*this.snapX+this.snapOffsetX%this.snapX,a.y=Math.round((a.y-this.snapOffsetY%this.snapY)/this.snapY)*this.snapY+this.snapOffsetY%this.snapY,o.set(a.x,a.y));f=a.x-d,g=a.y-p}return this.sprite.events.onDragUpdate.dispatch(a,t,l,c,o,e,f,g),!0},justOver:function(t,e){return t=t||0,e=e||500,this._pointerData[t].isOver&&this.overDuration(t)this.boundsRect.right&&(this.sprite.cameraOffset.x=this.boundsRect.right-this.sprite.width),this.sprite.cameraOffset.ythis.boundsRect.bottom&&(this.sprite.cameraOffset.y=this.boundsRect.bottom-this.sprite.height)):(this.sprite.leftthis.boundsRect.right&&(this.sprite.x=this.boundsRect.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsRect.bottom&&(this.sprite.y=this.boundsRect.bottom-(this.sprite.height-this.sprite.offsetY)))},checkBoundsSprite:function(){this.sprite.fixedToCamera&&this.boundsSprite.fixedToCamera?(this.sprite.cameraOffset.xthis.boundsSprite.cameraOffset.x+this.boundsSprite.width&&(this.sprite.cameraOffset.x=this.boundsSprite.cameraOffset.x+this.boundsSprite.width-this.sprite.width),this.sprite.cameraOffset.ythis.boundsSprite.cameraOffset.y+this.boundsSprite.height&&(this.sprite.cameraOffset.y=this.boundsSprite.cameraOffset.y+this.boundsSprite.height-this.sprite.height)):(this.sprite.leftthis.boundsSprite.right&&(this.sprite.x=this.boundsSprite.right-(this.sprite.width-this.sprite.offsetX)),this.sprite.topthis.boundsSprite.bottom&&(this.sprite.y=this.boundsSprite.bottom-(this.sprite.height-this.sprite.offsetY)))}},n.InputHandler.prototype.constructor=n.InputHandler,n.PointerLock=function(t){this.game=t,this.input=t.input,this.element=t.canvas,this.active=!1,this.locked=!1,this.onChange=new n.Signal,this.onError=new n.Signal,this.boundOnChangeHandler=this.onChangeHandler.bind(this),this.boundOnErrorHandler=this.onErrorHandler.bind(this);var e=t.device;this.pointerLockElement=e.pointerLockElement,this.pointerlockchange=e.pointerlockchange,this.pointerlockerror=e.pointerlockerror},n.PointerLock.prototype.start=function(){return!(!this.game.device.pointerLock||this.active)&&(this.element.requestPointerLock||(this.element.requestPointerLock=this.element.mozRequestPointerLock||this.element.webkitRequestPointerLock),document.exitPointerLock||(document.exitPointerLock=document.mozExitPointerLock||document.webkitExitPointerLock),document.addEventListener(this.pointerlockchange,this.boundOnChangeHandler,!0),document.addEventListener(this.pointerlockerror,this.boundOnErrorHandler,!0),this.active=!0,!0)},n.PointerLock.prototype.stop=function(){this.active&&(document.removeEventListener(this.pointerlockchange,this.boundOnChangeHandler,!0),document.removeEventListener(this.pointerlockerror,this.boundOnErrorHandler,!0),this.active=!1)},n.PointerLock.prototype.request=function(){this.active&&!this.locked&&this.element.requestPointerLock()},n.PointerLock.prototype.exit=function(){document.exitPointerLock()},n.PointerLock.prototype.onChangeHandler=function(t){this.locked=document[this.pointerLockElement]===this.element,this.onChange.dispatch(this.locked,t)},n.PointerLock.prototype.onErrorHandler=function(t){this.onError.dispatch(t)}, +/** + * @author @karlmacklin + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Gamepad=function(t){this.game=t,this._gamepadIndexMap={},this._rawPads=[],this._active=!1,this.enabled=!0,this._gamepadSupportAvailable=!!navigator.webkitGetGamepads||!!navigator.webkitGamepads||-1!==navigator.userAgent.indexOf("Firefox/")||!!navigator.getGamepads,this._prevRawGamepadTypes=[],this._prevTimestamps=[],this.callbackContext=this,this.onConnectCallback=null,this.onDisconnectCallback=null,this.onDownCallback=null,this.onUpCallback=null,this.onAxisCallback=null,this.onFloatCallback=null,this._ongamepadconnected=null,this._gamepaddisconnected=null,this._gamepads=[new n.SinglePad(t,this),new n.SinglePad(t,this),new n.SinglePad(t,this),new n.SinglePad(t,this)]},n.Gamepad.prototype={addCallbacks:function(t,e){void 0!==e&&(this.onConnectCallback="function"==typeof e.onConnect?e.onConnect:this.onConnectCallback,this.onDisconnectCallback="function"==typeof e.onDisconnect?e.onDisconnect:this.onDisconnectCallback,this.onDownCallback="function"==typeof e.onDown?e.onDown:this.onDownCallback,this.onUpCallback="function"==typeof e.onUp?e.onUp:this.onUpCallback,this.onAxisCallback="function"==typeof e.onAxis?e.onAxis:this.onAxisCallback,this.onFloatCallback="function"==typeof e.onFloat?e.onFloat:this.onFloatCallback,this.callbackContext=t)},start:function(){if(!this._active){this._active=!0;var t=this;this._onGamepadConnected=function(e){return t.onGamepadConnected(e)},this._onGamepadDisconnected=function(e){return t.onGamepadDisconnected(e)},window.addEventListener("gamepadconnected",this._onGamepadConnected,!1),window.addEventListener("gamepaddisconnected",this._onGamepadDisconnected,!1)}},onGamepadConnected:function(t){var e=t.gamepad;this._rawPads.push(e),this._gamepads[e.index].connect(e)},onGamepadDisconnected:function(t){var e=t.gamepad;for(var i in this._rawPads)this._rawPads[i].index===e.index&&this._rawPads.splice(i,1);this._gamepads[e.index].disconnect()},update:function(){this._pollGamepads(),this.pad1.pollStatus(),this.pad2.pollStatus(),this.pad3.pollStatus(),this.pad4.pollStatus()},_pollGamepads:function(){if(this._active){if(navigator.getGamepads)var t=navigator.getGamepads();else if(navigator.webkitGetGamepads)t=navigator.webkitGetGamepads();else if(navigator.webkitGamepads)t=navigator.webkitGamepads();if(t){this._rawPads=[];for(var e=!1,i=0;i + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.SinglePad=function(t,e){this.game=t,this.index=null,this.connected=!1,this.callbackContext=this,this.onConnectCallback=null,this.onDisconnectCallback=null,this.onDownCallback=null,this.onUpCallback=null,this.onAxisCallback=null,this.onFloatCallback=null,this.deadZone=.26,this._padParent=e,this._rawPad=null,this._prevTimestamp=null,this._buttons=[],this._buttonsLen=0,this._axes=[],this._axesLen=0},n.SinglePad.prototype={addCallbacks:function(t,e){void 0!==e&&(this.onConnectCallback="function"==typeof e.onConnect?e.onConnect:this.onConnectCallback,this.onDisconnectCallback="function"==typeof e.onDisconnect?e.onDisconnect:this.onDisconnectCallback,this.onDownCallback="function"==typeof e.onDown?e.onDown:this.onDownCallback,this.onUpCallback="function"==typeof e.onUp?e.onUp:this.onUpCallback,this.onAxisCallback="function"==typeof e.onAxis?e.onAxis:this.onAxisCallback,this.onFloatCallback="function"==typeof e.onFloat?e.onFloat:this.onFloatCallback,this.callbackContext=t)},getButton:function(t){return this._buttons[t]?this._buttons[t]:null},pollStatus:function(){if(this.connected&&this.game.input.enabled&&this.game.input.gamepad.enabled&&this._rawPad&&(!this._rawPad.timestamp||this._rawPad.timestamp!==this._prevTimestamp)){for(var t=0;t0&&n>this.deadZone||n<0&&n<-this.deadZone?this.processAxisChange(i,n):this.processAxisChange(i,0)}this._prevTimestamp=this._rawPad.timestamp}},connect:function(t){var e=!this.connected;this.connected=!0,this.index=t.index,this._rawPad=t,this._buttons=[],this._buttonsLen=t.buttons.length,this._axes=[],this._axesLen=t.axes.length;for(var i=0;i + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Key=function(t,e){this.game=t,this._enabled=!0,this.event=null,this.isDown=!1,this.isUp=!0,this.altKey=!1,this.ctrlKey=!1,this.shiftKey=!1,this.timeDown=0,this.duration=0,this.timeUp=-2500,this.durationUp=-2500,this.repeats=0,this.keyCode=e,this.onDown=new n.Signal,this.onHoldCallback=null,this.onHoldContext=null,this.onUp=new n.Signal,this._justDown=!1,this._justUp=!1},n.Key.prototype={update:function(){this._enabled&&(this.isDown?(this.duration=this.game.time.time-this.timeDown,this.repeats++,this.onHoldCallback&&this.onHoldCallback.call(this.onHoldContext,this)):this.durationUp=this.game.time.time-this.timeUp)},processKeyDown:function(t){this._enabled&&(this.event=t,this.isDown||(this.altKey=t.altKey,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.isDown=!0,this.isUp=!1,this.timeDown=this.game.time.time,this.duration=0,this.durationUp=this.game.time.time-this.timeUp,this.repeats=0,this._justDown=!0,this.onDown.dispatch(this)))},processKeyUp:function(t){this._enabled&&(this.event=t,this.isUp||(this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.duration=this.game.time.time-this.timeDown,this.durationUp=0,this._justUp=!0,this.onUp.dispatch(this)))},reset:function(t){void 0===t&&(t=!0),this.isDown=!1,this.isUp=!0,this.timeUp=this.game.time.time,this.duration=0,this.durationUp=-2500,this._enabled=!0,this._justDown=!1,this._justUp=!1,t&&(this.onDown.removeAll(),this.onUp.removeAll(),this.onHoldCallback=null,this.onHoldContext=null)},downDuration:function(t){return void 0===t&&(t=50),this.isDown&&this.duration + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Keyboard=function(t){this.game=t,this.active=!1,this.enabled=!0,this.event=null,this.pressEvent=null,this.callbackContext=this,this.onDownCallback=null,this.onPressCallback=null,this.onUpCallback=null,this._keys=[],this._capture=[],this._onKeyDown=null,this._onKeyPress=null,this._onKeyUp=null,this._i=0,this._k=0},n.Keyboard.prototype={addCallbacks:function(t,e,i,n){this.callbackContext=t,null!=e&&(this.onDownCallback=e),null!=i&&(this.onUpCallback=i),null!=n&&(this.onPressCallback=n)},removeCallbacks:function(){this.callbackContext=this,this.onDownCallback=null,this.onUpCallback=null,this.onPressCallback=null},addKey:function(t){return this._keys[t]||(this._keys[t]=new n.Key(this.game,t),this.addKeyCapture(t)),this._keys[t]},addKeys:function(t){var e={};for(var i in t)e[i]=this.addKey(t[i]);return e},removeKey:function(t){this._keys[t]&&(this._keys[t]=null,this.removeKeyCapture(t))},createCursorKeys:function(){return this.addKeys({up:n.KeyCode.UP,down:n.KeyCode.DOWN,left:n.KeyCode.LEFT,right:n.KeyCode.RIGHT})},start:function(){if(this.game.device.cocoonJS)return!1;if(this.active)return!1;var t=this;return this._onKeyDown=function(e){return t.processKeyDown(e)},this._onKeyUp=function(e){return t.processKeyUp(e)},this._onKeyPress=function(e){return t.processKeyPress(e)},window.addEventListener("keydown",this._onKeyDown,!1),window.addEventListener("keyup",this._onKeyUp,!1),window.addEventListener("keypress",this._onKeyPress,!1),this.active=!0,!0},stop:function(){window.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("keyup",this._onKeyUp),window.removeEventListener("keypress",this._onKeyPress),this._onKeyDown=null,this._onKeyUp=null,this._onKeyPress=null,this.active=!1},destroy:function(){this.stop(),this.clearCaptures(),this._keys.length=0,this._i=0},addKeyCapture:function(t){if("object"==typeof t)for(var e in t)this._capture[t[e]]=!0;else this._capture[t]=!0},removeKeyCapture:function(t){delete this._capture[t]},clearCaptures:function(){this._capture={}},update:function(){for(this._i=this._keys.length;this._i--;)this._keys[this._i]&&this._keys[this._i].update()},processKeyDown:function(t){if(this.event=t,this.game.input.enabled&&this.enabled){var e=t.keyCode;this._capture[e]&&t.preventDefault(),this._keys[e]||(this._keys[e]=new n.Key(this.game,e)),this._keys[e].processKeyDown(t),this._k=e,this.onDownCallback&&this.onDownCallback.call(this.callbackContext,t)}},processKeyPress:function(t){this.pressEvent=t,this.game.input.enabled&&this.enabled&&this.onPressCallback&&this.onPressCallback.call(this.callbackContext,String.fromCharCode(t.charCode),t)},processKeyUp:function(t){if(this.event=t,this.game.input.enabled&&this.enabled){var e=t.keyCode;this._capture[e]&&t.preventDefault(),this._keys[e]||(this._keys[e]=new n.Key(this.game,e)),this._keys[e].processKeyUp(t),this.onUpCallback&&this.onUpCallback.call(this.callbackContext,t)}},reset:function(t){void 0===t&&(t=!0),this.event=null;for(var e=this._keys.length;e--;)this._keys[e]&&this._keys[e].reset(t)},downDuration:function(t,e){return this._keys[t]?this._keys[t].downDuration(e):null},upDuration:function(t,e){return this._keys[t]?this._keys[t].upDuration(e):null},justPressed:function(t){return this._keys[t]?this._keys[t].justPressed():null},justReleased:function(t){return this._keys[t]?this._keys[t].justReleased():null},isDown:function(t){return this._keys[t]?this._keys[t].isDown:null}},Object.defineProperty(n.Keyboard.prototype,"lastChar",{get:function(){return this.event&&32===this.event.charCode?"":this.pressEvent?String.fromCharCode(this.pressEvent.charCode):null}}),Object.defineProperty(n.Keyboard.prototype,"lastKey",{get:function(){return this._keys[this._k]}}),n.Keyboard.prototype.constructor=n.Keyboard,n.KeyCode={A:"A".charCodeAt(0),B:"B".charCodeAt(0),C:"C".charCodeAt(0),D:"D".charCodeAt(0),E:"E".charCodeAt(0),F:"F".charCodeAt(0),G:"G".charCodeAt(0),H:"H".charCodeAt(0),I:"I".charCodeAt(0),J:"J".charCodeAt(0),K:"K".charCodeAt(0),L:"L".charCodeAt(0),M:"M".charCodeAt(0),N:"N".charCodeAt(0),O:"O".charCodeAt(0),P:"P".charCodeAt(0),Q:"Q".charCodeAt(0),R:"R".charCodeAt(0),S:"S".charCodeAt(0),T:"T".charCodeAt(0),U:"U".charCodeAt(0),V:"V".charCodeAt(0),W:"W".charCodeAt(0),X:"X".charCodeAt(0),Y:"Y".charCodeAt(0),Z:"Z".charCodeAt(0),ZERO:"0".charCodeAt(0),ONE:"1".charCodeAt(0),TWO:"2".charCodeAt(0),THREE:"3".charCodeAt(0),FOUR:"4".charCodeAt(0),FIVE:"5".charCodeAt(0),SIX:"6".charCodeAt(0),SEVEN:"7".charCodeAt(0),EIGHT:"8".charCodeAt(0),NINE:"9".charCodeAt(0),NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,NUMPAD_MULTIPLY:106,NUMPAD_ADD:107,NUMPAD_ENTER:108,NUMPAD_SUBTRACT:109,NUMPAD_DECIMAL:110,NUMPAD_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,F13:124,F14:125,F15:126,COLON:186,EQUALS:187,COMMA:188,UNDERSCORE:189,PERIOD:190,QUESTION_MARK:191,TILDE:192,OPEN_BRACKET:219,BACKWARD_SLASH:220,CLOSED_BRACKET:221,QUOTES:222,BACKSPACE:8,TAB:9,CLEAR:12,ENTER:13,SHIFT:16,CONTROL:17,ALT:18,CAPS_LOCK:20,ESC:27,SPACEBAR:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PLUS:43,MINUS:44,INSERT:45,DELETE:46,HELP:47,NUM_LOCK:144},n.KeyCode)n.KeyCode.hasOwnProperty(r)&&!r.match(/[a-z]/)&&(n.Keyboard[r]=n.KeyCode[r]); +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */for(var o in n.Component=function(){}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Angle=function(){},n.Component.Angle.prototype={angle:{get:function(){return n.Math.wrapAngle(n.Math.radToDeg(this.rotation))},set:function(t){this.rotation=n.Math.degToRad(n.Math.wrapAngle(t))}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Animation=function(){},n.Component.Animation.prototype={play:function(t,e,i,n){if(this.animations)return this.animations.play(t,e,i,n)}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.AutoCull=function(){},n.Component.AutoCull.prototype={autoCull:!1,inCamera:{get:function(){return this.autoCull||this.checkWorldBounds||(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y),this.game.world.camera.view.intersects(this._bounds)}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Bounds=function(){},n.Component.Bounds.prototype={offsetX:{get:function(){return this.anchor.x*this.width}},offsetY:{get:function(){return this.anchor.y*this.height}},centerX:{get:function(){return this.x-this.offsetX+.5*this.width},set:function(t){this.x=t+this.offsetX-.5*this.width}},centerY:{get:function(){return this.y-this.offsetY+.5*this.height},set:function(t){this.y=t+this.offsetY-.5*this.height}},left:{get:function(){return this.x-this.offsetX},set:function(t){this.x=t+this.offsetX}},right:{get:function(){return this.x+this.width-this.offsetX},set:function(t){this.x=t-this.width+this.offsetX}},top:{get:function(){return this.y-this.offsetY},set:function(t){this.y=t+this.offsetY}},bottom:{get:function(){return this.y+this.height-this.offsetY},set:function(t){this.y=t-this.height+this.offsetY}},alignIn:function(t,e,i,s){switch(void 0===i&&(i=0),void 0===s&&(s=0),e){default:case n.TOP_LEFT:this.left=t.left-i,this.top=t.top-s;break;case n.TOP_CENTER:this.centerX=t.centerX+i,this.top=t.top-s;break;case n.TOP_RIGHT:this.right=t.right+i,this.top=t.top-s;break;case n.LEFT_CENTER:this.left=t.left-i,this.centerY=t.centerY+s;break;case n.CENTER:this.centerX=t.centerX+i,this.centerY=t.centerY+s;break;case n.RIGHT_CENTER:this.right=t.right+i,this.centerY=t.centerY+s;break;case n.BOTTOM_LEFT:this.left=t.left-i,this.bottom=t.bottom+s;break;case n.BOTTOM_CENTER:this.centerX=t.centerX+i,this.bottom=t.bottom+s;break;case n.BOTTOM_RIGHT:this.right=t.right+i,this.bottom=t.bottom+s}return this},alignTo:function(t,e,i,s){switch(void 0===i&&(i=0),void 0===s&&(s=0),e){default:case n.TOP_LEFT:this.left=t.left-i,this.bottom=t.top-s;break;case n.TOP_CENTER:this.centerX=t.centerX+i,this.bottom=t.top-s;break;case n.TOP_RIGHT:this.right=t.right+i,this.bottom=t.top-s;break;case n.LEFT_TOP:this.right=t.left-i,this.top=t.top-s;break;case n.LEFT_CENTER:this.right=t.left-i,this.centerY=t.centerY+s;break;case n.LEFT_BOTTOM:this.right=t.left-i,this.bottom=t.bottom+s;break;case n.RIGHT_TOP:this.left=t.right+i,this.top=t.top-s;break;case n.RIGHT_CENTER:this.left=t.right+i,this.centerY=t.centerY+s;break;case n.RIGHT_BOTTOM:this.left=t.right+i,this.bottom=t.bottom+s;break;case n.BOTTOM_LEFT:this.left=t.left-i,this.top=t.bottom+s;break;case n.BOTTOM_CENTER:this.centerX=t.centerX+i,this.top=t.bottom+s;break;case n.BOTTOM_RIGHT:this.right=t.right+i,this.top=t.bottom+s}return this}},n.Group.prototype.alignIn=n.Component.Bounds.prototype.alignIn,n.Group.prototype.alignTo=n.Component.Bounds.prototype.alignTo, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.BringToTop=function(){},n.Component.BringToTop.prototype.bringToTop=function(){return this.parent&&this.parent.bringChildToTop&&this.parent.bringChildToTop(this),this},n.Component.BringToTop.prototype.sendToBack=function(){return this.parent&&this.parent.sendChildToBack&&this.parent.sendChildToBack(this),this},n.Component.BringToTop.prototype.moveUp=function(){return this.parent&&this.parent.moveUp(this),this},n.Component.BringToTop.prototype.moveDown=function(){return this.parent&&this.parent.moveDown(this),this}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Core=function(){},n.Component.Core.install=function(t){n.Utils.mixinPrototype(this,n.Component.Core.prototype),this.components={};for(var e=0;e + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Crop=function(){},n.Component.Crop.prototype={cropRect:null,_crop:null,crop:function(t,e){void 0===e&&(e=!1),t?(e&&null!==this.cropRect?this.cropRect.setTo(t.x,t.y,t.width,t.height):e&&null===this.cropRect?this.cropRect=new n.Rectangle(t.x,t.y,t.width,t.height):this.cropRect=t,this.updateCrop()):(this._crop=null,this.cropRect=null,this.resetFrame())},updateCrop:function(){if(this.cropRect){var t=this.texture.crop.x,e=this.texture.crop.y,i=this.texture.crop.width,s=this.texture.crop.height;this._crop=n.Rectangle.clone(this.cropRect,this._crop),this._crop.x+=this._frame.x,this._crop.y+=this._frame.y;var r=Math.max(this._frame.x,this._crop.x),o=Math.max(this._frame.y,this._crop.y),a=Math.min(this._frame.right,this._crop.right)-r,h=Math.min(this._frame.bottom,this._crop.bottom)-o;this.texture.crop.x=r,this.texture.crop.y=o,this.texture.crop.width=a,this.texture.crop.height=h,this.texture.frame.width=Math.min(a,this.cropRect.width),this.texture.frame.height=Math.min(h,this.cropRect.height),this.texture.width=this.texture.frame.width,this.texture.height=this.texture.frame.height,this.texture._updateUvs(),16777215===this.tint||t===r&&e===o&&i===a&&s===h||(this.texture.requiresReTint=!0)}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Delta=function(){},n.Component.Delta.prototype={deltaX:{get:function(){return this.world.x-this.previousPosition.x}},deltaY:{get:function(){return this.world.y-this.previousPosition.y}},deltaZ:{get:function(){return this.rotation-this.previousRotation}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Destroy=function(){},n.Component.Destroy.prototype={destroyPhase:!1,destroy:function(t,e){if(null!==this.game&&!this.destroyPhase){void 0===t&&(t=!0),void 0===e&&(e=!1),this.destroyPhase=!0,this.events&&this.events.onDestroy$dispatch(this),this.parent&&(this.parent instanceof n.Group?this.parent.remove(this):this.parent.removeChild(this)),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy(),this.game.tweens.removeFrom(this);var i=this.children.length;if(t)for(;i--;)this.children[i].destroy(t);else for(;i--;)this.removeChild(this.children[i]);this._crop&&(this._crop=null,this.cropRect=null),this._frame&&(this._frame=null),n.Video&&this.key instanceof n.Video&&this.key.onChangeSource.remove(this.resizeFrame,this),n.BitmapText&&this._glyphs&&(this._glyphs=[]),this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null,this.data={},this.renderable=!1,this.transformCallback&&(this.transformCallback=null,this.transformCallbackContext=null),this.hitArea=null,this.parent=null,this.stage=null,this.worldTransform=null,this.filterArea=null,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture(),e&&this.texture.destroy(!0),this.destroyPhase=!1,this.pendingDestroy=!1}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Events=function(t){this.parent=t},n.Events.prototype={destroy:function(){this._parent=null,this._onDestroy&&this._onDestroy.dispose(),this._onAddedToGroup&&this._onAddedToGroup.dispose(),this._onRemovedFromGroup&&this._onRemovedFromGroup.dispose(),this._onKilled&&this._onKilled.dispose(),this._onRevived&&this._onRevived.dispose(),this._onEnterBounds&&this._onEnterBounds.dispose(),this._onOutOfBounds&&this._onOutOfBounds.dispose(),this._onInputOver&&this._onInputOver.dispose(),this._onInputOut&&this._onInputOut.dispose(),this._onInputDown&&this._onInputDown.dispose(),this._onInputUp&&this._onInputUp.dispose(),this._onDragStart&&this._onDragStart.dispose(),this._onDragUpdate&&this._onDragUpdate.dispose(),this._onDragStop&&this._onDragStop.dispose(),this._onAnimationStart&&this._onAnimationStart.dispose(),this._onAnimationComplete&&this._onAnimationComplete.dispose(),this._onAnimationLoop&&this._onAnimationLoop.dispose()},onAddedToGroup:null,onRemovedFromGroup:null,onDestroy:null,onKilled:null,onRevived:null,onOutOfBounds:null,onEnterBounds:null,onInputOver:null,onInputOut:null,onInputDown:null,onInputUp:null,onDragStart:null,onDragUpdate:null,onDragStop:null,onAnimationStart:null,onAnimationComplete:null,onAnimationLoop:null},n.Events.prototype.constructor=n.Events,n.Events.prototype)n.Events.prototype.hasOwnProperty(o)&&0===o.indexOf("on")&&null===n.Events.prototype[o]&&function(t,e){"use strict";Object.defineProperty(n.Events.prototype,t,{get:function(){return this[e]||(this[e]=new n.Signal)}}),n.Events.prototype[t+"$dispatch"]=function(){return this[e]?this[e].dispatch.apply(this[e],arguments):null}}(o,"_"+o); +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */n.Component.FixedToCamera=function(){},n.Component.FixedToCamera.postUpdate=function(){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y)},n.Component.FixedToCamera.prototype={_fixedToCamera:!1,fixedToCamera:{get:function(){return this._fixedToCamera},set:function(t){t?(this._fixedToCamera=!0,this.cameraOffset.set(this.x,this.y)):this._fixedToCamera=!1}},cameraOffset:new n.Point}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Health=function(){},n.Component.Health.prototype={health:1,maxHealth:100,damage:function(t){return this.alive&&(this.health-=t,this.health<=0&&this.kill()),this},setHealth:function(t){return this.health=t,this.health>this.maxHealth&&(this.health=this.maxHealth),this},heal:function(t){return this.alive&&(this.health+=t,this.health>this.maxHealth&&(this.health=this.maxHealth)),this}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.InCamera=function(){},n.Component.InCamera.prototype={inCamera:{get:function(){return this.game.world.camera.view.intersects(this._bounds)}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.InputEnabled=function(){},n.Component.InputEnabled.prototype={input:null,inputEnabled:{get:function(){return this.input&&this.input.enabled},set:function(t){t?null===this.input?(this.input=new n.InputHandler(this),this.input.start()):this.input&&!this.input.enabled&&this.input.start():this.input&&this.input.enabled&&this.input.stop()}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.InWorld=function(){},n.Component.InWorld.preUpdate=function(){if(this.pendingDestroy)return this.destroy(),!1;if(this.autoCull||this.checkWorldBounds){if(this._bounds.copyFrom(this.getBounds()),this._bounds.x+=this.game.camera.view.x,this._bounds.y+=this.game.camera.view.y,this.autoCull)if(this.game.world.camera.view.intersects(this._bounds))this.renderable=!0,this.game.world.camera.totalInView++;else if(this.renderable=!1,this.outOfCameraBoundsKill)return this.kill(),!1;if(this.checkWorldBounds)if(this._outOfBoundsFired&&this.game.world.bounds.intersects(this._bounds))this._outOfBoundsFired=!1,this.events.onEnterBounds$dispatch(this);else if(!this._outOfBoundsFired&&!this.game.world.bounds.intersects(this._bounds)&&(this._outOfBoundsFired=!0,this.events.onOutOfBounds$dispatch(this),this.outOfBoundsKill))return this.kill(),!1}return!0},n.Component.InWorld.prototype={checkWorldBounds:!1,outOfBoundsKill:!1,outOfCameraBoundsKill:!1,_outOfBoundsFired:!1,inWorld:{get:function(){return this.game.world.bounds.intersects(this.getBounds())}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.LifeSpan=function(){},n.Component.LifeSpan.preUpdate=function(){return this.pendingDestroy?(this.destroy(),!1):!(this.lifespan>0&&(this.lifespan-=this.game.time.physicsElapsedMS,this.lifespan<=0))||(this.kill(),!1)},n.Component.LifeSpan.prototype={alive:!0,lifespan:0,revive:function(t){return void 0===t&&(t=100),this.alive=!0,this.exists=!0,this.visible=!0,"function"==typeof this.setHealth&&this.setHealth(t),this.events&&this.events.onRevived$dispatch(this),this},kill:function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled$dispatch(this),this}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.LoadTexture=function(){},n.Component.LoadTexture.prototype={customRender:!1,_frame:null,loadTexture:function(t,e,i){t===n.PENDING_ATLAS?(t=e,e=0):e=e||0,(i||void 0===i)&&this.animations&&this.animations.stop(),this.key=t,this.customRender=!1;var s=this.game.cache,r=!0,o=this.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR;if(n.RenderTexture&&t instanceof n.RenderTexture)this.key=t.key,this.setTexture(t);else if(n.BitmapData&&t instanceof n.BitmapData)this.customRender=!0,this.setTexture(t.texture),r=s.hasFrameData(t.key,n.Cache.BITMAPDATA)?!this.animations.loadFrameData(s.getFrameData(t.key,n.Cache.BITMAPDATA),e):!this.animations.loadFrameData(t.frameData,0);else if(n.Video&&t instanceof n.Video){this.customRender=!0;var a=t.texture.valid;this.setTexture(t.texture),this.setFrame(t.texture.frame.clone()),t.onChangeSource.add(this.resizeFrame,this),this.texture.valid=a}else if(n.Tilemap&&t instanceof n.TilemapLayer)this.setTexture(PIXI.Texture.fromCanvas(t.canvas));else if(t instanceof PIXI.Texture)o=t.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,this.setTexture(t);else{var h=s.getImage(t,!0);this.key=h.key,this.setTexture(new PIXI.Texture(h.base)),this.texture.baseTexture.skipRender="__default"===t,r=!this.animations.loadFrameData(h.frameData,e)}r&&(this._frame=n.Rectangle.clone(this.texture.frame)),o||(this.texture.baseTexture.scaleMode=1)},setFrame:function(t){this._frame=t,this.texture.frame.x=t.x,this.texture.frame.y=t.y,this.texture.frame.width=t.width,this.texture.frame.height=t.height,this.texture.crop.x=t.x,this.texture.crop.y=t.y,this.texture.crop.width=t.width,this.texture.crop.height=t.height,t.trimmed?(this.texture.trim?(this.texture.trim.x=t.spriteSourceSizeX,this.texture.trim.y=t.spriteSourceSizeY,this.texture.trim.width=t.sourceSizeW,this.texture.trim.height=t.sourceSizeH):this.texture.trim={x:t.spriteSourceSizeX,y:t.spriteSourceSizeY,width:t.sourceSizeW,height:t.sourceSizeH},this.texture.width=t.sourceSizeW,this.texture.height=t.sourceSizeH,this.texture.frame.width=t.sourceSizeW,this.texture.frame.height=t.sourceSizeH):!t.trimmed&&this.texture.trim&&(this.texture.trim=null),t.rotated&&(this.texture.rotated=!0),this.cropRect&&this.updateCrop(),this.texture.requiresReTint=!0,this.texture._updateUvs(),this.tilingTexture&&(this.refreshTexture=!0)},resizeFrame:function(t,e,i){this.texture.frame.resize(e,i),this.texture.setFrame(this.texture.frame)},resetFrame:function(){this._frame&&this.setFrame(this._frame)},frame:{get:function(){return this.animations.frame},set:function(t){this.animations.frame=t}},frameName:{get:function(){return this.animations.frameName},set:function(t){this.animations.frameName=t}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Overlap=function(){},n.Component.Overlap.prototype={overlap:function(t){return n.Rectangle.intersects(this.getBounds(),t.getBounds())}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.PhysicsBody=function(){},n.Component.PhysicsBody.preUpdate=function(){return this.pendingDestroy?(this.destroy(),!1):this.fresh&&this.exists?(this.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,this.body&&this.body.preUpdate(),this.fresh=!1,this.preUpdateChildren(),!1):(this.previousPosition.set(this.world.x,this.world.y),this.previousRotation=this.rotation,!(!this._exists||!this.parent.exists)||(this.renderOrderID=-1,!1))},n.Component.PhysicsBody.postUpdate=function(){this.exists&&this.body&&this.body.postUpdate()},n.Component.PhysicsBody.prototype={body:null,x:{get:function(){return this.position.x},set:function(t){this.position.x=t,this.body&&!this.body.dirty&&(this.body._reset=!0)}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t,this.body&&!this.body.dirty&&(this.body._reset=!0)}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Reset=function(){},n.Component.Reset.prototype.reset=function(t,e,i){return void 0===i&&(i=1),this.world.set(t,e),this.position.set(t,e),this.fresh=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this.components.InWorld&&(this._outOfBoundsFired=!1),this.components.LifeSpan&&(this.alive=!0,this.health=i),this.components.PhysicsBody&&this.body&&this.body.reset(t,e,!1,!1),this}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.ScaleMinMax=function(){},n.Component.ScaleMinMax.prototype={transformCallback:null,transformCallbackContext:this,scaleMin:null,scaleMax:null,checkTransform:function(t){this.scaleMin&&(t.athis.scaleMax.x&&(t.a=this.scaleMax.x),t.d>this.scaleMax.y&&(t.d=this.scaleMax.y))},setScaleMinMax:function(t,e,i,s){void 0===e?e=i=s=t:void 0===i&&(i=s=e,e=t),null===t?this.scaleMin=null:this.scaleMin?this.scaleMin.set(t,e):this.scaleMin=new n.Point(t,e),null===i?this.scaleMax=null:this.scaleMax?this.scaleMax.set(i,s):this.scaleMax=new n.Point(i,s),null===this.scaleMin?this.transformCallback=null:(this.transformCallback=this.checkTransform,this.transformCallbackContext=this)}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Component.Smoothed=function(){},n.Component.Smoothed.prototype={smoothed:{get:function(){return!this.texture.baseTexture.scaleMode},set:function(t){t?this.texture&&0!==this.texture.baseTexture.scaleMode&&(this.texture.baseTexture.scaleMode=0,this.texture.baseTexture.dirty()):this.texture&&1!==this.texture.baseTexture.scaleMode&&(this.texture.baseTexture.scaleMode=1,this.texture.baseTexture.dirty())}}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.GameObjectFactory=function(t){this.game=t,this.world=this.game.world},n.GameObjectFactory.prototype={existing:function(t){return this.world.add(t)},weapon:function(t,e,i,s,r){var o=this.game.plugins.add(n.Weapon);return r&&(o.bulletClass=r),o.createBullets(t,e,i,s),o},image:function(t,e,i,s,r){return void 0===r&&(r=this.world),r.add(new n.Image(this.game,t,e,i,s))},sprite:function(t,e,i,s,r){return void 0===r&&(r=this.world),r.add(new n.Sprite(this.game,t,e,i,s))},creature:function(t,e,i,s,r,o,a){void 0===r&&(r=this.world);var h=new n.Creature(this.game,t,e,i,s,o,a);return r.add(h),h},tween:function(t){return this.game.tweens.create(t)},group:function(t,e,i,s,r){return new n.Group(this.game,t,e,i,s,r)},physicsGroup:function(t,e,i,s){return new n.Group(this.game,e,i,s,!0,t)},spriteBatch:function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e="group"),void 0===i&&(i=!1),new n.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},sound:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},audioSprite:function(t){return this.game.sound.addSprite(t)},tileSprite:function(t,e,i,s,r,o,a){return void 0===a&&(a=this.world),a.add(new n.TileSprite(this.game,t,e,i,s,r,o))},rope:function(t,e,i,s,r,o){return void 0===o&&(o=this.world),o.add(new n.Rope(this.game,t,e,i,s,r))},text:function(t,e,i,s,r){return void 0===r&&(r=this.world),r.add(new n.Text(this.game,t,e,i,s))},button:function(t,e,i,s,r,o,a,h,l,c){return void 0===c&&(c=this.world),c.add(new n.Button(this.game,t,e,i,s,r,o,a,h,l))},graphics:function(t,e,i){return void 0===i&&(i=this.world),i.add(new n.Graphics(this.game,t,e))},emitter:function(t,e,i){return this.game.particles.add(new n.Particles.Arcade.Emitter(this.game,t,e,i))},retroFont:function(t,e,i,s,r,o,a,h,l){return new n.RetroFont(this.game,t,e,i,s,r,o,a,h,l)},bitmapText:function(t,e,i,s,r,o){return void 0===o&&(o=this.world),o.add(new n.BitmapText(this.game,t,e,i,s,r))},tilemap:function(t,e,i,s,r){return new n.Tilemap(this.game,t,e,i,s,r)},renderTexture:function(t,e,i,s){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===s&&(s=!1);var r=new n.RenderTexture(this.game,t,e,i);return s&&this.game.cache.addRenderTexture(i,r),r},video:function(t,e){return new n.Video(this.game,t,e)},bitmapData:function(t,e,i,s){void 0===s&&(s=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var r=new n.BitmapData(this.game,i,t,e);return s&&this.game.cache.addBitmapData(i,r),r},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new n.Filter[t](this.game)).init.apply(t,e),t},plugin:function(){return this.game.plugins.add.apply(this.game.plugins,arguments)}},n.GameObjectFactory.prototype.constructor=n.GameObjectFactory, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.GameObjectCreator=function(t){this.game=t,this.world=this.game.world},n.GameObjectCreator.prototype={image:function(t,e,i,s){return new n.Image(this.game,t,e,i,s)},sprite:function(t,e,i,s){return new n.Sprite(this.game,t,e,i,s)},tween:function(t){return new n.Tween(t,this.game,this.game.tweens)},group:function(t,e,i,s,r){return new n.Group(this.game,t||null,e,i,s,r)},spriteBatch:function(t,e,i){return void 0===e&&(e="group"),void 0===i&&(i=!1),new n.SpriteBatch(this.game,t,e,i)},audio:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},audioSprite:function(t){return this.game.sound.addSprite(t)},sound:function(t,e,i,n){return this.game.sound.add(t,e,i,n)},tileSprite:function(t,e,i,s,r,o){return new n.TileSprite(this.game,t,e,i,s,r,o)},rope:function(t,e,i,s,r){return new n.Rope(this.game,t,e,i,s,r)},text:function(t,e,i,s){return new n.Text(this.game,t,e,i,s)},button:function(t,e,i,s,r,o,a,h,l){return new n.Button(this.game,t,e,i,s,r,o,a,h,l)},graphics:function(t,e){return new n.Graphics(this.game,t,e)},emitter:function(t,e,i){return new n.Particles.Arcade.Emitter(this.game,t,e,i)},retroFont:function(t,e,i,s,r,o,a,h,l){return new n.RetroFont(this.game,t,e,i,s,r,o,a,h,l)},bitmapText:function(t,e,i,s,r,o){return new n.BitmapText(this.game,t,e,i,s,r,o)},tilemap:function(t,e,i,s,r){return new n.Tilemap(this.game,t,e,i,s,r)},renderTexture:function(t,e,i,s){void 0!==i&&""!==i||(i=this.game.rnd.uuid()),void 0===s&&(s=!1);var r=new n.RenderTexture(this.game,t,e,i);return s&&this.game.cache.addRenderTexture(i,r),r},bitmapData:function(t,e,i,s){void 0===s&&(s=!1),void 0!==i&&""!==i||(i=this.game.rnd.uuid());var r=new n.BitmapData(this.game,i,t,e);return s&&this.game.cache.addBitmapData(i,r),r},filter:function(t){var e=Array.prototype.slice.call(arguments,1);return(t=new n.Filter[t](this.game)).init.apply(t,e),t}},n.GameObjectCreator.prototype.constructor=n.GameObjectCreator, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Sprite=function(t,e,i,s,r){e=e||0,i=i||0,s=s||null,r=r||null,this.type=n.SPRITE,this.physicsType=n.SPRITE,PIXI.Sprite.call(this,n.Cache.DEFAULT),n.Component.Core.init.call(this,t,e,i,s,r)},n.Sprite.prototype=Object.create(PIXI.Sprite.prototype),n.Sprite.prototype.constructor=n.Sprite,n.Component.Core.install.call(n.Sprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Delta","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","ScaleMinMax","Smoothed"]),n.Sprite.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.Sprite.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Sprite.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Sprite.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Sprite.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Image=function(t,e,i,s,r){e=e||0,i=i||0,s=s||null,r=r||null,this.type=n.IMAGE,PIXI.Sprite.call(this,n.Cache.DEFAULT),n.Component.Core.init.call(this,t,e,i,s,r)},n.Image.prototype=Object.create(PIXI.Sprite.prototype),n.Image.prototype.constructor=n.Image,n.Component.Core.install.call(n.Image.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Destroy","FixedToCamera","InputEnabled","LifeSpan","LoadTexture","Overlap","Reset","ScaleMinMax","Smoothed"]),n.Image.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Image.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Image.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Image.prototype.preUpdate=function(){return!(!this.preUpdateInWorld()||!this.preUpdateLifeSpan())&&this.preUpdateCore()}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Button=function(t,e,i,s,r,o,a,h,l,c){e=e||0,i=i||0,s=s||null,r=r||null,o=o||this,n.Image.call(this,t,e,i,s,h),this.type=n.BUTTON,this.physicsType=n.SPRITE,this._onOverFrame=null,this._onOutFrame=null,this._onDownFrame=null,this._onUpFrame=null,this.onOverSound=null,this.onOutSound=null,this.onDownSound=null,this.onUpSound=null,this.onOverSoundMarker="",this.onOutSoundMarker="",this.onDownSoundMarker="",this.onUpSoundMarker="",this.onInputOver=new n.Signal,this.onInputOut=new n.Signal,this.onInputDown=new n.Signal,this.onInputUp=new n.Signal,this.onOverMouseOnly=!0,this.justReleasedPreventsOver=n.PointerMode.CONTACT,this.freezeFrames=!1,this.forceOut=!1,this.inputEnabled=!0,this.input.start(0,!0),this.input.useHandCursor=!0,this.setFrames(a,h,l,c),null!==r&&this.onInputUp.add(r,o),this.events.onInputOver.add(this.onInputOverHandler,this),this.events.onInputOut.add(this.onInputOutHandler,this),this.events.onInputDown.add(this.onInputDownHandler,this),this.events.onInputUp.add(this.onInputUpHandler,this)},n.Button.prototype=Object.create(n.Image.prototype),n.Button.prototype.constructor=n.Button;var a="Over",h="Out",l="Down",c="Up";return n.Button.prototype.clearFrames=function(){this.setFrames(null,null,null,null)},n.Button.prototype.setStateFrame=function(t,e,i){var n="_on"+t+"Frame";null!==e?(this[n]=e,i&&this.changeStateFrame(t)):this[n]=null},n.Button.prototype.changeStateFrame=function(t){if(this.freezeFrames)return!1;var e=this["_on"+t+"Frame"];return"string"==typeof e?(this.frameName=e,!0):"number"==typeof e&&(this.frame=e,!0)},n.Button.prototype.setFrames=function(t,e,i,n){this.setStateFrame(a,t,this.input.pointerOver()),this.setStateFrame(h,e,!this.input.pointerOver()),this.setStateFrame(l,i,this.input.pointerDown()),this.setStateFrame(c,n,this.input.pointerUp())},n.Button.prototype.setStateSound=function(t,e,i){var s="on"+t+"Sound",r="on"+t+"SoundMarker";e instanceof n.Sound||e instanceof n.AudioSprite?(this[s]=e,this[r]="string"==typeof i?i:""):(this[s]=null,this[r]="")},n.Button.prototype.playStateSound=function(t){var e=this["on"+t+"Sound"];if(e){var i=this["on"+t+"SoundMarker"];return e.play(i),!0}return!1},n.Button.prototype.setSounds=function(t,e,i,n,s,r,o,u){this.setStateSound(a,t,e),this.setStateSound(h,s,r),this.setStateSound(l,i,n),this.setStateSound(c,o,u)},n.Button.prototype.setOverSound=function(t,e){this.setStateSound(a,t,e)},n.Button.prototype.setOutSound=function(t,e){this.setStateSound(h,t,e)},n.Button.prototype.setDownSound=function(t,e){this.setStateSound(l,t,e)},n.Button.prototype.setUpSound=function(t,e){this.setStateSound(c,t,e)},n.Button.prototype.onInputOverHandler=function(t,e){e.justReleased()&&(this.justReleasedPreventsOver&e.pointerMode)===e.pointerMode||(this.changeStateFrame(a),this.onOverMouseOnly&&!e.isMouse||(this.playStateSound(a),this.onInputOver&&this.onInputOver.dispatch(this,e)))},n.Button.prototype.onInputOutHandler=function(t,e){this.changeStateFrame(h),this.playStateSound(h),this.onInputOut&&this.onInputOut.dispatch(this,e)},n.Button.prototype.onInputDownHandler=function(t,e){this.changeStateFrame(l),this.playStateSound(l),this.onInputDown&&this.onInputDown.dispatch(this,e)},n.Button.prototype.onInputUpHandler=function(t,e,i){(this.playStateSound(c),this.onInputUp&&this.onInputUp.dispatch(this,e,i),this.freezeFrames)||(!0===this.forceOut||(this.forceOut&e.pointerMode)===e.pointerMode?this.changeStateFrame(h):this.changeStateFrame(c)||(i?this.changeStateFrame(a):this.changeStateFrame(h)))}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.SpriteBatch=function(t,e,i,s){null==e&&(e=t.world),n.Group.call(this,t,e,i,s),this.type=n.SPRITEBATCH,this.fastSpriteBatch=null,this.ready=!1},n.SpriteBatch.prototype=Object.create(n.Group.prototype),n.SpriteBatch.prototype.constructor=n.SpriteBatch,n.SpriteBatch.prototype._renderWebGL=function(t){!this.visible||this.alpha<=0||!this.children.length||(this.ready||(this.fastSpriteBatch=new PIXI.WebGLFastSpriteBatch(t.gl),this.ready=!0),this.fastSpriteBatch.gl!==t.gl&&this.fastSpriteBatch.setContext(t.gl),t.spriteBatch.stop(),t.shaderManager.setShader(t.shaderManager.fastShader),this.fastSpriteBatch.begin(this,t),this.fastSpriteBatch.render(this),t.spriteBatch.start())},n.SpriteBatch.prototype._renderCanvas=function(t){if(this.visible&&!(this.alpha<=0)&&this.children.length){var e=t.context;e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var i=this.worldTransform,n=!0,s=0;s + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.BitmapData=function(t,e,i,s,r){void 0!==i&&0!==i||(i=256),void 0!==s&&0!==s||(s=256),void 0===r&&(r=!1),this.game=t,this.key=e,this.width=i,this.height=s,this.canvas=n.Canvas.create(this,i,s,null,r),this.context=this.canvas.getContext("2d",{alpha:!0}),this.ctx=this.context,this.smoothProperty=t.renderType===n.CANVAS?t.renderer.renderSession.smoothProperty:n.Canvas.getSmoothingPrefix(this.context),this.imageData=this.context.getImageData(0,0,i,s),this.data=null,this.imageData&&(this.data=this.imageData.data),this.pixels=null,this.data&&(this.imageData.data.buffer?(this.buffer=this.imageData.data.buffer,this.pixels=new Uint32Array(this.buffer)):window.ArrayBuffer?(this.buffer=new ArrayBuffer(this.imageData.data.length),this.pixels=new Uint32Array(this.buffer)):this.pixels=this.imageData.data),this.baseTexture=new PIXI.BaseTexture(this.canvas,null,this.game.resolution),this.texture=new PIXI.Texture(this.baseTexture),this.frameData=new n.FrameData,this.textureFrame=this.frameData.addFrame(new n.Frame(0,0,0,i,s,"bitmapData")),this.texture.frame=this.textureFrame,this.type=n.BITMAPDATA,this.disableTextureUpload=!1,this.dirty=!1,this.cls=this.clear,this._image=null,this._pos=new n.Point,this._size=new n.Point,this._scale=new n.Point,this._rotate=0,this._alpha={prev:1,current:1},this._anchor=new n.Point,this._tempR=0,this._tempG=0,this._tempB=0,this._circle=new n.Circle,this._swapCanvas=void 0},n.BitmapData.prototype={move:function(t,e,i){return 0!==t&&this.moveH(t,i),0!==e&&this.moveV(e,i),this},moveH:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=n.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),s=this.height,r=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var o=this.width-t;e&&i.drawImage(r,0,0,t,s,o,0,t,s),i.drawImage(r,t,0,o,s,0,0,o,s)}else{o=this.width-t;e&&i.drawImage(r,o,0,t,s,0,0,t,s),i.drawImage(r,0,0,o,s,t,0,o,s)}return this.clear(),this.copy(this._swapCanvas)},moveV:function(t,e){void 0===e&&(e=!0),void 0===this._swapCanvas&&(this._swapCanvas=n.CanvasPool.create(this,this.width,this.height));var i=this._swapCanvas.getContext("2d"),s=this.width,r=this.canvas;if(i.clearRect(0,0,this.width,this.height),t<0){t=Math.abs(t);var o=this.height-t;e&&i.drawImage(r,0,0,s,t,0,o,s,t),i.drawImage(r,0,t,s,o,0,0,s,o)}else{o=this.height-t;e&&i.drawImage(r,0,o,s,t,0,0,s,t),i.drawImage(r,0,0,s,o,0,t,s,o)}return this.clear(),this.copy(this._swapCanvas)},add:function(t){if(Array.isArray(t))for(var e=0;e=0&&t<=this.width&&e>=0&&e<=this.height&&(n.Device.LITTLE_ENDIAN?this.pixels[e*this.width+t]=o<<24|r<<16|s<<8|i:this.pixels[e*this.width+t]=i<<24|s<<16|r<<8|o,a&&(this.context.putImageData(this.imageData,0,0),this.dirty=!0)),this},setPixel:function(t,e,i,n,s,r){return this.setPixel32(t,e,i,n,s,255,r)},getPixel:function(t,e,i){i||(i=n.Color.createColor());var s=~~(t+e*this.width);return s*=4,i.r=this.data[s],i.g=this.data[++s],i.b=this.data[++s],i.a=this.data[++s],i},getPixel32:function(t,e){if(t>=0&&t<=this.width&&e>=0&&e<=this.height)return this.pixels[e*this.width+t]},getPixelRGB:function(t,e,i,s,r){return n.Color.unpackPixel(this.getPixel32(t,e),i,s,r)},getPixels:function(t){return this.context.getImageData(t.x,t.y,t.width,t.height)},getFirstPixel:function(t){void 0===t&&(t=0);var e=n.Color.createColor(),i=0,s=0,r=1,o=!1;1===t?(r=-1,s=this.height):3===t&&(r=-1,i=this.width);do{n.Color.unpackPixel(this.getPixel32(i,s),e),0===t||1===t?++i===this.width&&(i=0,((s+=r)>=this.height||s<=0)&&(o=!0)):2!==t&&3!==t||++s===this.height&&(s=0,((i+=r)>=this.width||i<=0)&&(o=!0))}while(0===e.a&&!o);return e.x=i,e.y=s,e},getBounds:function(t){return void 0===t&&(t=new n.Rectangle),t.x=this.getFirstPixel(2).x,t.x===this.width?t.setTo(0,0,0,0):(t.y=this.getFirstPixel(0).y,t.width=this.getFirstPixel(3).x-t.x+1,t.height=this.getFirstPixel(1).y-t.y+1,t)},addToWorld:function(t,e,i,n,s,r){s=s||1,r=r||1;var o=this.game.add.image(t,e,this);return o.anchor.set(i,n),o.scale.set(s,r),o},copy:function(t,e,i,s,r,o,a,h,l,c,u,d,p,f,g,m,y){if(null==t&&(t=this),t instanceof n.RenderTexture&&(t=t.getCanvas()),this._image=t,t instanceof n.Sprite||t instanceof n.Image||t instanceof n.Text||t instanceof PIXI.Sprite)this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),this._scale.set(t.scale.x,t.scale.y),this._anchor.set(t.anchor.x,t.anchor.y),this._rotate=t.rotation,this._alpha.current=t.alpha,t.texture instanceof n.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source,null==o&&(o=t.x),null==a&&(a=t.y),t.texture.trim&&(o+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,a+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0));else{if(this._pos.set(0),this._scale.set(1),this._anchor.set(0),this._rotate=0,this._alpha.current=1,t instanceof n.BitmapData)this._image=t.canvas;else if("string"==typeof t){if(null===(t=this.game.cache.getImage(t)))return this;this._image=t}this._size.set(this._image.width,this._image.height)}if(null==e&&(e=0),null==i&&(i=0),s&&(this._size.x=s),r&&(this._size.y=r),null==o&&(o=e),null==a&&(a=i),null==h&&(h=this._size.x),null==l&&(l=this._size.y),"number"==typeof c&&(this._rotate=c),"number"==typeof u&&(this._anchor.x=u),"number"==typeof d&&(this._anchor.y=d),"number"==typeof p&&(this._scale.x=p),"number"==typeof f&&(this._scale.y=f),"number"==typeof g&&(this._alpha.current=g),void 0===m&&(m=null),void 0===y&&(y=!1),this._alpha.current<=0||0===this._scale.x||0===this._scale.y||0===this._size.x||0===this._size.y)return this;var v=this.context;return this._alpha.prev=v.globalAlpha,v.save(),v.globalAlpha=this._alpha.current,m&&(this.op=m),y&&(o|=0,a|=0),v.translate(o,a),v.scale(this._scale.x,this._scale.y),v.rotate(this._rotate),v.drawImage(this._image,this._pos.x+e,this._pos.y+i,this._size.x,this._size.y,-h*this._anchor.x,-l*this._anchor.y,h,l),v.restore(),v.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyTransform:function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=!1),!t.hasOwnProperty("worldTransform")||!t.worldVisible||0===t.worldAlpha)return this;var s=t.worldTransform;if(this._pos.set(t.texture.crop.x,t.texture.crop.y),this._size.set(t.texture.crop.width,t.texture.crop.height),0===s.a||0===s.d||0===this._size.x||0===this._size.y)return this;t.texture instanceof n.RenderTexture?this._image=t.texture.getCanvas():this._image=t.texture.baseTexture.source;var r=s.tx,o=s.ty;t.texture.trim&&(r+=t.texture.trim.x-t.anchor.x*t.texture.trim.width,o+=t.texture.trim.y-t.anchor.y*t.texture.trim.height),16777215!==t.tint&&(t.cachedTint!==t.tint&&(t.cachedTint=t.tint,t.tintedTexture=PIXI.CanvasTinter.getTintedTexture(t,t.tint)),this._image=t.tintedTexture,this._pos.set(0)),i&&(r|=0,o|=0);var a=this.context;return this._alpha.prev=a.globalAlpha,a.save(),a.globalAlpha=this._alpha.current,e&&(this.op=e),a[this.smoothProperty]=t.texture.baseTexture.scaleMode===PIXI.scaleModes.LINEAR,a.setTransform(s.a,s.b,s.c,s.d,r,o),a.drawImage(this._image,this._pos.x,this._pos.y,this._size.x,this._size.y,-this._size.x*t.anchor.x,-this._size.y*t.anchor.y,this._size.x,this._size.y),a.restore(),a.globalAlpha=this._alpha.prev,this.dirty=!0,this},copyRect:function(t,e,i,n,s,r,o){return this.copy(t,e.x,e.y,e.width,e.height,i,n,e.width,e.height,0,0,0,1,1,s,r,o)},draw:function(t,e,i,n,s,r,o){return this.copy(t,null,null,null,null,e,i,n,s,null,null,null,null,null,null,r,o)},drawGroup:function(t,e,i){return t.total>0&&t.forEachExists(this.drawGroupProxy,this,e,i),this},drawGroupProxy:function(t,e,i){if(t.hasOwnProperty("texture")&&this.copyTransform(t,e,i),t.type===n.GROUP&&t.exists)this.drawGroup(t,e,i);else if(t.hasOwnProperty("children")&&t.children.length>0)for(var s=0;se.width&&(s=e.width);var r=this.context;return r.fillStyle=r.createPattern(e,i),this._circle=new n.Circle(t.start.x,t.start.y,e.height),this._circle.circumferencePoint(t.angle-1.5707963267948966,!1,this._pos),r.save(),r.translate(this._pos.x,this._pos.y),r.rotate(t.angle),r.fillRect(0,0,s,e.height),r.restore(),this.dirty=!0,this}},render:function(){return!this.disableTextureUpload&&this.dirty&&(this.baseTexture.dirty(),this.dirty=!1),this},destroy:function(){this.frameData.destroy(),this.texture.destroy(!0),n.CanvasPool.remove(this)},blendReset:function(){return this.op="source-over",this},blendSourceOver:function(){return this.op="source-over",this},blendSourceIn:function(){return this.op="source-in",this},blendSourceOut:function(){return this.op="source-out",this},blendSourceAtop:function(){return this.op="source-atop",this},blendDestinationOver:function(){return this.op="destination-over",this},blendDestinationIn:function(){return this.op="destination-in",this},blendDestinationOut:function(){return this.op="destination-out",this},blendDestinationAtop:function(){return this.op="destination-atop",this},blendXor:function(){return this.op="xor",this},blendAdd:function(){return this.op="lighter",this},blendMultiply:function(){return this.op="multiply",this},blendScreen:function(){return this.op="screen",this},blendOverlay:function(){return this.op="overlay",this},blendDarken:function(){return this.op="darken",this},blendLighten:function(){return this.op="lighten",this},blendColorDodge:function(){return this.op="color-dodge",this},blendColorBurn:function(){return this.op="color-burn",this},blendHardLight:function(){return this.op="hard-light",this},blendSoftLight:function(){return this.op="soft-light",this},blendDifference:function(){return this.op="difference",this},blendExclusion:function(){return this.op="exclusion",this},blendHue:function(){return this.op="hue",this},blendSaturation:function(){return this.op="saturation",this},blendColor:function(){return this.op="color",this},blendLuminosity:function(){return this.op="luminosity",this},copyBitmapData:function(t,e,i){t.update();for(var n,s=0;s80*i){s=o=t[0],r=a=t[1];for(var g=i;go&&(o=h),l>a&&(a=l);c=Math.max(o-s,a-r)}return n.EarCut.earcutLinked(p,f,i,s,r,c),f},n.EarCut.linkedList=function(t,e,i,s,r){var o,a,h,l=0;for(o=e,a=i-s;o0)for(o=e;o=e;o-=s)h=n.EarCut.insertNode(o,t[o],t[o+1],h);return h},n.EarCut.filterPoints=function(t,e){if(!t)return t;e||(e=t);var i,s=t;do{if(i=!1,s.steiner||!n.EarCut.equals(s,s.next)&&0!==n.EarCut.area(s.prev,s,s.next))s=s.next;else{if(n.EarCut.removeNode(s),(s=e=s.prev)===s.next)return null;i=!0}}while(i||s!==e);return e},n.EarCut.earcutLinked=function(t,e,i,s,r,o,a){if(t){!a&&o&&n.EarCut.indexCurve(t,s,r,o);for(var h,l,c=t;t.prev!==t.next;)if(h=t.prev,l=t.next,o?n.EarCut.isEarHashed(t,s,r,o):n.EarCut.isEar(t))e.push(h.i/i),e.push(t.i/i),e.push(l.i/i),n.EarCut.removeNode(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?(t=n.EarCut.cureLocalIntersections(t,e,i),n.EarCut.earcutLinked(t,e,i,s,r,o,2)):2===a&&n.EarCut.splitEarcut(t,e,i,s,r,o):n.EarCut.earcutLinked(n.EarCut.filterPoints(t),e,i,s,r,o,1);break}}},n.EarCut.isEar=function(t){var e=t.prev,i=t,s=t.next;if(n.EarCut.area(e,i,s)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(n.EarCut.pointInTriangle(e.x,e.y,i.x,i.y,s.x,s.y,r.x,r.y)&&n.EarCut.area(r.prev,r,r.next)>=0)return!1;r=r.next}return!0},n.EarCut.isEarHashed=function(t,e,i,s){var r=t.prev,o=t,a=t.next;if(n.EarCut.area(r,o,a)>=0)return!1;for(var h=r.xo.x?r.x>a.x?r.x:a.x:o.x>a.x?o.x:a.x,u=r.y>o.y?r.y>a.y?r.y:a.y:o.y>a.y?o.y:a.y,d=n.EarCut.zOrder(h,l,e,i,s),p=n.EarCut.zOrder(c,u,e,i,s),f=t.nextZ;f&&f.z<=p;){if(f!==t.prev&&f!==t.next&&n.EarCut.pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&n.EarCut.area(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=d;){if(f!==t.prev&&f!==t.next&&n.EarCut.pointInTriangle(r.x,r.y,o.x,o.y,a.x,a.y,f.x,f.y)&&n.EarCut.area(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0},n.EarCut.cureLocalIntersections=function(t,e,i){var s=t;do{var r=s.prev,o=s.next.next;n.EarCut.intersects(r,s,s.next,o)&&n.EarCut.locallyInside(r,o)&&n.EarCut.locallyInside(o,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(o.i/i),n.EarCut.removeNode(s),n.EarCut.removeNode(s.next),s=t=o),s=s.next}while(s!==t);return s},n.EarCut.splitEarcut=function(t,e,i,s,r,o){var a=t;do{for(var h=a.next.next;h!==a.prev;){if(a.i!==h.i&&n.EarCut.isValidDiagonal(a,h)){var l=n.EarCut.splitPolygon(a,h);return a=n.EarCut.filterPoints(a,a.next),l=n.EarCut.filterPoints(l,l.next),n.EarCut.earcutLinked(a,e,i,s,r,o),void n.EarCut.earcutLinked(l,e,i,s,r,o)}h=h.next}a=a.next}while(a!==t)},n.EarCut.eliminateHoles=function(t,e,i,s){var r,o,a,h,l,c=[];for(r=0,o=e.length;r=s.next.y){var h=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);h<=r&&h>a&&(a=h,i=s.x=s.x&&s.x>=i.x&&n.EarCut.pointInTriangle(oi.x)&&n.EarCut.locallyInside(s,t)&&(i=s,u=l),s=s.next;return i},n.EarCut.indexCurve=function(t,e,i,s){var r=t;do{null===r.z&&(r.z=n.EarCut.zOrder(r.x,r.y,e,i,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,n.EarCut.sortLinked(r)},n.EarCut.sortLinked=function(t){var e,i,n,s,r,o,a,h,l=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||h>0&&n;)0===a?(s=n,n=n.nextZ,h--):0!==h&&n?i.z<=n.z?(s=i,i=i.nextZ,a--):(s=n,n=n.nextZ,h--):(s=i,i=i.nextZ,a--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,l*=2}while(o>1);return t},n.EarCut.zOrder=function(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)/s)|e<<8))|e<<4))|e<<2))|e<<1))<<1},n.EarCut.getLeftmost=function(t){var e=t,i=t;do{e.x=0&&(t-o)*(n-a)-(i-o)*(e-a)>=0&&(i-o)*(r-a)-(s-o)*(n-a)>=0},n.EarCut.isValidDiagonal=function(t,e){return n.EarCut.equals(t,e)||t.next.i!==e.i&&t.prev.i!==e.i&&!n.EarCut.intersectsPolygon(t,e)&&n.EarCut.locallyInside(t,e)&&n.EarCut.locallyInside(e,t)&&n.EarCut.middleInside(t,e)},n.EarCut.area=function(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)},n.EarCut.equals=function(t,e){return t.x===e.x&&t.y===e.y},n.EarCut.intersects=function(t,e,i,s){return n.EarCut.area(t,e,i)>0!=n.EarCut.area(t,e,s)>0&&n.EarCut.area(i,s,t)>0!=n.EarCut.area(i,s,e)>0},n.EarCut.intersectsPolygon=function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&n.EarCut.intersects(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1},n.EarCut.locallyInside=function(t,e){return n.EarCut.area(t.prev,t,t.next)<0?n.EarCut.area(t,e,t.next)>=0&&n.EarCut.area(t,t.prev,e)>=0:n.EarCut.area(t,e,t.prev)<0||n.EarCut.area(t,t.next,e)<0},n.EarCut.middleInside=function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n},n.EarCut.splitPolygon=function(t,e){var i=new n.EarCut.Node(t.i,t.x,t.y),s=new n.EarCut.Node(e.i,e.x,e.y),r=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,s.next=i,i.prev=s,o.next=s,s.prev=o,s},n.EarCut.insertNode=function(t,e,i,s){var r=new n.EarCut.Node(t,e,i);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r},n.EarCut.removeNode=function(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)},n.EarCut.Node=function(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1},PIXI.WebGLGraphics=function(){},PIXI.WebGLGraphics.stencilBufferLimit=6,PIXI.WebGLGraphics.renderGraphics=function(t,e){var i,s=e.gl,r=e.projection,o=e.offset,a=e.shaderManager.primitiveShader;t.dirty&&PIXI.WebGLGraphics.updateGraphics(t,s);var h=t._webGL[s.id];if(h)for(var l=0;l=PIXI.WebGLGraphics.stencilBufferLimit)if(a.points.length<2*PIXI.WebGLGraphics.stencilBufferLimit)s=PIXI.WebGLGraphics.switchMode(r,0),PIXI.WebGLGraphics.buildPoly(a,s)||(s=PIXI.WebGLGraphics.switchMode(r,1),PIXI.WebGLGraphics.buildComplexPoly(a,s));else s=PIXI.WebGLGraphics.switchMode(r,1),PIXI.WebGLGraphics.buildComplexPoly(a,s);a.lineWidth>0&&(s=PIXI.WebGLGraphics.switchMode(r,0),PIXI.WebGLGraphics.buildLine(a,s))}else s=PIXI.WebGLGraphics.switchMode(r,0),a.type===n.RECTANGLE?PIXI.WebGLGraphics.buildRectangle(a,s):a.type===n.CIRCLE||a.type===n.ELLIPSE?PIXI.WebGLGraphics.buildCircle(a,s):a.type===n.ROUNDEDRECTANGLE&&PIXI.WebGLGraphics.buildRoundedRectangle(a,s);r.lastIndex++}for(i=0;i19600?(w=y-b,_=v-x,w/=k=Math.sqrt(w*w+_*_),_/=k,w*=F,_*=F,L.push(p-w,f-_),L.push(G,N,j,U),L.push(p+w,f+_),L.push(G,N,j,U),L.push(p-w,f-_),L.push(G,N,j,U),B++):(L.push(l,c),L.push(G,N,j,U),L.push(p-(l-p),f-(c-f)),L.push(G,N,j,U));for(u=s[2*(I-2)],d=s[2*(I-2)+1],p=s[2*(I-1)],y=-(d-(f=s[2*(I-1)+1])),v=u-p,y/=k=Math.sqrt(y*y+v*v),v/=k,y*=F,v*=F,L.push(p-y,f-v),L.push(G,N,j,U),L.push(p+y,f+v),L.push(G,N,j,U),O.push(R),i=0;ih?r:h,l=(o=i[u+1])c?o:c;i.push(a,l,h,l,h,c,a,c);var d=i.length/2;for(u=0;uA?A:P,e.beginPath(),e.moveTo(_,T+P),e.lineTo(_,T+S-P),e.quadraticCurveTo(_,T+S,_+P,T+S),e.lineTo(_+C-P,T+S),e.quadraticCurveTo(_+C,T+S,_+C,T+S-P),e.lineTo(_+C,T+P),e.quadraticCurveTo(_+C,T,_+C-P,T),e.lineTo(_+P,T),e.quadraticCurveTo(_,T,_,T+P),e.closePath(),(r.fillColor||0===r.fillColor)&&(e.globalAlpha=r.fillAlpha*i,e.fillStyle="#"+("00000"+(0|a).toString(16)).substr(-6),e.fill()),r.lineWidth&&(e.globalAlpha=r.lineAlpha*i,e.strokeStyle="#"+("00000"+(0|h).toString(16)).substr(-6),e.stroke())}}},PIXI.CanvasGraphics.renderGraphicsMask=function(t,e){var i=t.graphicsData.length;if(0!==i){e.beginPath();for(var s=0;sS?S:C,e.moveTo(x,w+C),e.lineTo(x,w+T-C),e.quadraticCurveTo(x,w+T,x+C,w+T),e.lineTo(x+_-C,w+T),e.quadraticCurveTo(x+_,w+T,x+_,w+T-C),e.lineTo(x+_,w+C),e.quadraticCurveTo(x+_,w,x+_-C,w),e.lineTo(x+C,w),e.quadraticCurveTo(x,w,x,w+C),e.closePath()}}}},PIXI.CanvasGraphics.updateGraphicsTint=function(t){if(16777215!==t.tint)for(var e=(t.tint>>16&255)/255,i=(t.tint>>8&255)/255,n=(255&t.tint)/255,s=0;s>16&255)/255*e*255<<16)+((o>>8&255)/255*i*255<<8)+(255&o)/255*n*255,r._lineTint=((a>>16&255)/255*e*255<<16)+((a>>8&255)/255*i*255<<8)+(255&a)/255*n*255}},n.GraphicsData=function(t,e,i,n,s,r,o){this.lineWidth=t,this.lineColor=e,this.lineAlpha=i,this._lineTint=e,this.fillColor=n,this.fillAlpha=s,this._fillTint=n,this.fill=r,this.shape=o,this.type=o.type},n.GraphicsData.prototype.constructor=n.GraphicsData,n.GraphicsData.prototype.clone=function(){return new n.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.fill,this.shape)}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Graphics=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.type=n.GRAPHICS,this.physicsType=n.SPRITE,this.anchor=new n.Point,PIXI.DisplayObjectContainer.call(this),this.renderable=!0,this.fillAlpha=1,this.lineWidth=0,this.lineColor=0,this.graphicsData=[],this.tint=16777215,this.blendMode=PIXI.blendModes.NORMAL,this.currentPath=null,this._webGL=[],this.isMask=!1,this.boundsPadding=0,this._localBounds=new n.Rectangle(0,0,1,1),this.dirty=!0,this._boundsDirty=!1,this.webGLDirty=!1,this.cachedSpriteDirty=!1,n.Component.Core.init.call(this,t,e,i,"",null)},n.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.Graphics.prototype.constructor=n.Graphics,n.Component.Core.install.call(n.Graphics.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),n.Graphics.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.Graphics.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Graphics.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Graphics.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Graphics.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.Graphics.prototype.postUpdate=function(){n.Component.PhysicsBody.postUpdate.call(this),n.Component.FixedToCamera.postUpdate.call(this),this._boundsDirty&&(this.updateLocalBounds(),this._boundsDirty=!1);for(var t=0;t0&&this.drawPolygon(i)}else this.drawPolygon(i)},n.Graphics.prototype.drawTriangles=function(t,e,i){void 0===i&&(i=!1);var s,r=new n.Point,o=new n.Point,a=new n.Point,h=[];if(e)if(t[0]instanceof n.Point)for(s=0;sc*a)}return this.dirty=!0,this._boundsDirty=!0,this},n.Graphics.prototype.arc=function(t,e,i,n,s,r,o){if(n===s)return this;void 0===r&&(r=!1),void 0===o&&(o=40),!r&&s<=n?s+=2*Math.PI:r&&n<=s&&(n+=2*Math.PI);var a=r?-1*(n-s):s-n,h=Math.ceil(Math.abs(a)/(2*Math.PI))*o;if(0===a)return this;var l=t+Math.cos(n)*i,c=e+Math.sin(n)*i;r&&this.filling?this.moveTo(t,e):this.moveTo(l,c);for(var u=this.currentPath.shape.points,d=a/(2*h),p=2*d,f=Math.cos(d),g=Math.sin(d),m=h-1,y=m%1/m,v=0;v<=m;v++){var b=d+n+p*(v+y*v),x=Math.cos(b),w=-Math.sin(b);u.push((f*x+g*w)*i+t,(f*-w+g*x)*i+e)}return this.dirty=!0,this._boundsDirty=!0,this},n.Graphics.prototype.beginFill=function(t,e){return this.filling=!0,this.fillColor=t||0,this.fillAlpha=void 0===e?1:e,this.currentPath&&this.currentPath.shape.points.length<=2&&(this.currentPath.fill=this.filling,this.currentPath.fillColor=this.fillColor,this.currentPath.fillAlpha=this.fillAlpha),this},n.Graphics.prototype.endFill=function(){return this.filling=!1,this.fillColor=null,this.fillAlpha=1,this},n.Graphics.prototype.drawRect=function(t,e,i,s){return this.drawShape(new n.Rectangle(t,e,i,s)),this},n.Graphics.prototype.drawRoundedRect=function(t,e,i,s,r){return this.drawShape(new n.RoundedRectangle(t,e,i,s,r)),this},n.Graphics.prototype.drawCircle=function(t,e,i){return this.drawShape(new n.Circle(t,e,i)),this},n.Graphics.prototype.drawEllipse=function(t,e,i,s){return this.drawShape({x:t,y:e,width:i,height:s,type:n.ELLIPSE}),this},n.Graphics.prototype.drawPolygon=function(t){t instanceof n.Polygon&&(t=t.points);var e=t;if(!Array.isArray(e)){e=new Array(arguments.length);for(var i=0;i(_=v>(_=m>_?m:_)?v:_)?x:_,T=w>(T=b>(T=y>T?y:T)?b:T)?w:T,this._bounds.x=C,this._bounds.width=_-C,this._bounds.y=S,this._bounds.height=T-S,this._currentBounds=this._bounds,this._currentBounds},n.Graphics.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=n.identityMatrix;for(var e=0;ee?a+l:e,i=hs?h+c:s;else if(p===n.CIRCLE)a=r.x,h=r.y,t=a-(l=r.radius+f/2)e?a+l:e,i=h-(c=r.radius+f/2)s?h+c:s;else if(p===n.ELLIPSE)a=r.x,h=r.y,t=a-(l=r.width+f/2)e?a+l:e,i=h-(c=r.height+f/2)s?h+c:s;else{o=r.points;for(var g=0;ge?a+f:e,i=h-fs?h+f:s}}else t=0,e=0,i=0,s=0;var m=this.boundsPadding;this._localBounds.x=t-m,this._localBounds.width=e-t+2*m,this._localBounds.y=i-m,this._localBounds.height=s-i+2*m},n.Graphics.prototype._generateCachedSprite=function(){var t=this.getLocalBounds();if(this._cachedSprite)this._cachedSprite.buffer.resize(t.width,t.height);else{var e=new PIXI.CanvasBuffer(t.width,t.height),i=PIXI.Texture.fromCanvas(e.canvas);this._cachedSprite=new PIXI.Sprite(i),this._cachedSprite.buffer=e,this._cachedSprite.worldTransform=this.worldTransform}this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._cachedSprite.buffer.context.translate(-t.x,-t.y),this.worldAlpha=1,PIXI.CanvasGraphics.renderGraphics(this,this._cachedSprite.buffer.context),this._cachedSprite.alpha=this.alpha},n.Graphics.prototype.updateCachedSpriteTexture=function(){var t=this._cachedSprite,e=t.texture,i=t.buffer.canvas;e.baseTexture.width=i.width,e.baseTexture.height=i.height,e.crop.width=e.frame.width=i.width,e.crop.height=e.frame.height=i.height,t._width=i.width,t._height=i.height,e.baseTexture.dirty()},n.Graphics.prototype.destroyCachedSprite=function(){this._cachedSprite.texture.destroy(!0),this._cachedSprite=null},n.Graphics.prototype.drawShape=function(t){this.currentPath&&this.currentPath.shape.points.length<=2&&this.graphicsData.pop(),this.currentPath=null,t instanceof n.Polygon&&(t=t.clone()).flatten();var e=new n.GraphicsData(this.lineWidth,this.lineColor,this.lineAlpha,this.fillColor,this.fillAlpha,this.filling,t);return this.graphicsData.push(e),e.type===n.POLYGON&&(e.shape.closed=this.filling,this.currentPath=e),this.dirty=!0,this._boundsDirty=!0,e},Object.defineProperty(n.Graphics.prototype,"cacheAsBitmap",{get:function(){return this._cacheAsBitmap},set:function(t){this._cacheAsBitmap=t,this._cacheAsBitmap?this._generateCachedSprite():this.destroyCachedSprite(),this.dirty=!0,this.webGLDirty=!0}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.RenderTexture=function(t,e,i,s,r,o,a,h){if(void 0===e&&(e=100),void 0===i&&(i=100),void 0===s&&(s=""),void 0===r&&(r=n.scaleModes.DEFAULT),void 0===o&&(o=1),void 0===a&&(a=PIXI.defaultRenderer),void 0===h&&(h=0),this.game=t,this.key=s,this.type=n.RENDERTEXTURE,this._tempMatrix=new n.Matrix,this.width=e,this.height=i,this.resolution=o,this.frame=new n.Rectangle(0,0,this.width*this.resolution,this.height*this.resolution),this.crop=this.frame.clone(),this.baseTexture=new PIXI.BaseTexture,this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution,this.baseTexture._glTextures=[],this.baseTexture.resolution=this.resolution,this.baseTexture.scaleMode=r,this.baseTexture.hasLoaded=!0,PIXI.Texture.call(this,this.baseTexture,this.frame.clone()),this.renderer=a,this.renderer.type===n.WEBGL){var l=this.renderer.gl;this.baseTexture.textureIndex=h,this.baseTexture._dirty[l.id]=!1,this.textureBuffer=new PIXI.FilterTexture(l,this.width,this.height,this.baseTexture.scaleMode,h),this.baseTexture._glTextures[l.id]=this.textureBuffer.texture,this.projection=new n.Point(.5*this.width,.5*-this.height)}else this.textureBuffer=new PIXI.CanvasBuffer(this.width*this.resolution,this.height*this.resolution),this.baseTexture.source=this.textureBuffer.canvas;this.valid=!0,this.tempMatrix=new n.Matrix,this._updateUvs()},n.RenderTexture.prototype=Object.create(PIXI.Texture.prototype),n.RenderTexture.prototype.constructor=n.RenderTexture,n.RenderTexture.prototype.renderXY=function(t,e,i,s){t.updateTransform(),this._tempMatrix.copyFrom(t.worldTransform),this._tempMatrix.tx=e,this._tempMatrix.ty=i,this.renderer.type===n.WEBGL?this._renderWebGL(t,this._tempMatrix,s):this._renderCanvas(t,this._tempMatrix,s)},n.RenderTexture.prototype.renderRawXY=function(t,e,i,s){this._tempMatrix.identity().translate(e,i),this.renderer.type===n.WEBGL?this._renderWebGL(t,this._tempMatrix,s):this._renderCanvas(t,this._tempMatrix,s)},n.RenderTexture.prototype.render=function(t,e,i){null==e?this._tempMatrix.copyFrom(t.worldTransform):this._tempMatrix.copyFrom(e),this.renderer.type===n.WEBGL?this._renderWebGL(t,this._tempMatrix,i):this._renderCanvas(t,this._tempMatrix,i)},n.RenderTexture.prototype.resize=function(t,e,i){t===this.width&&e===this.height||(this.valid=t>0&&e>0,this.width=t,this.height=e,this.frame.width=this.crop.width=t*this.resolution,this.frame.height=this.crop.height=e*this.resolution,i&&(this.baseTexture.width=this.width*this.resolution,this.baseTexture.height=this.height*this.resolution),this.renderer.type===n.WEBGL&&(this.projection.x=this.width/2,this.projection.y=-this.height/2),this.valid&&this.textureBuffer.resize(this.width,this.height))},n.RenderTexture.prototype.clear=function(){this.valid&&(this.renderer.type===n.WEBGL&&this.renderer.gl.bindFramebuffer(this.renderer.gl.FRAMEBUFFER,this.textureBuffer.frameBuffer),this.textureBuffer.clear())},n.RenderTexture.prototype._renderWebGL=function(t,e,i){if(this.valid&&0!==t.alpha){var n=t.worldTransform;n.identity(),n.translate(0,2*this.projection.y),e&&n.append(e),n.scale(1,-1);for(var s=0;s + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Text=function(t,e,i,s,r){e=e||0,i=i||0,s=null==s?"":s.toString(),this.canvas=n.CanvasPool.create(this),n.Sprite.call(this,t,e,i,PIXI.Texture.fromCanvas(this.canvas)),this.type=n.TEXT,this.physicsType=n.SPRITE,this.padding=new n.Point,this.textBounds=null,this.context=this.canvas.getContext("2d"),this.colors=[],this.strokeColors=[],this.fontStyles=[],this.fontWeights=[],this.autoRound=!1,this.useAdvancedWrap=!1,this.splitRegExp=/(?:\r\n|\r|\n)/,this.characterLimitSize=-1,this.characterLimitSuffix="",this._testString="|MÉq",this._res=t.renderer.resolution,this._text=s,this._fontComponents=null,this._lineSpacing=0,this._charCount=0,this._width=0,this._height=0,this.style={},this.setStyle(r||{}),""!==s&&this.updateText()},n.Text.prototype=Object.create(n.Sprite.prototype),n.Text.prototype.constructor=n.Text,n.Text.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.Text.prototype.update=function(){},n.Text.prototype.destroy=function(t){this.texture.destroy(!0),n.Component.Destroy.prototype.destroy.call(this,t)},n.Text.prototype.setShadow=function(t,e,i,n,s,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i="rgba(0, 0, 0, 1)"),void 0===n&&(n=0),void 0===s&&(s=!0),void 0===r&&(r=!0),this.style.shadowOffsetX=t,this.style.shadowOffsetY=e,this.style.shadowColor=i,this.style.shadowBlur=n,this.style.shadowStroke=s,this.style.shadowFill=r,this.dirty=!0,this},n.Text.prototype.setStyle=function(t,e){void 0===e&&(e=!1);var i=Object.assign({},t);i.font=t.font||"bold 20pt Arial",i.backgroundColor=t.backgroundColor||null,i.fill=t.fill||"black",i.align=(t.align||"left").toLowerCase(),i.boundsAlignH=(t.boundsAlignH||"left").toLowerCase(),i.boundsAlignV=(t.boundsAlignV||"top").toLowerCase(),i.stroke=t.stroke||"black",i.strokeThickness=Number(t.strokeThickness)||0,i.wordWrap=t.wordWrap||!1,i.wordWrapWidth=t.wordWrapWidth||100,i.maxLines=t.maxLines||0,i.shadowOffsetX=t.shadowOffsetX||0,i.shadowOffsetY=t.shadowOffsetY||0,i.shadowColor=t.shadowColor||"rgba(0,0,0,0)",i.shadowBlur=t.shadowBlur||0,i.tabs=t.tabs||0;var n=this.fontToComponents(i.font);return i.fontStyle&&(n.fontStyle=i.fontStyle),i.fontVariant&&(n.fontVariant=i.fontVariant),i.fontWeight&&(n.fontWeight=i.fontWeight),i.fontSize&&("number"==typeof i.fontSize&&(i.fontSize=i.fontSize+"px"),n.fontSize=i.fontSize),this._fontComponents=n,i.font=this.componentsToFont(this._fontComponents),this.style=i,this.dirty=!0,e&&this.updateText(),this},n.Text.prototype.updateText=function(){this.texture.baseTexture.resolution=this._res,this.context.font=this.style.font;var t=this.text;this.characterLimitSize>-1&&this.characterLimitSize0&&this.style.maxLines0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?h+=this.measureLine(e[a]):h+=this.context.measureText(e[a]).width,this.style.wordWrap&&(h-=this.context.measureText(" ").width)}else{var l=e[a].split(/(?:\t)/);h=this.padding.x+this.style.strokeThickness;if(Array.isArray(i))for(var c=0,u=0;u0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?this.measureLine(l[u]):Math.ceil(this.context.measureText(l[u]).width),u>0&&(c+=i[u-1]),h=c+d}else for(u=0;u0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?h+=this.measureLine(l[u]):h+=Math.ceil(this.context.measureText(l[u]).width),h+=this.game.math.snapToCeil(h,i)-h}}n[a]=Math.ceil(h),s=Math.max(s,n[a])}this.canvas.width=s*this._res;var p,f,g=r.fontSize+this.style.strokeThickness+this.padding.y,m=g*o,y=this._lineSpacing;for(y<0&&Math.abs(y)>g&&(y=-g),0!==y&&(m+=y>0?y*e.length:y*(e.length-1)),this.canvas.height=m*this._res,this.context.scale(this._res,this._res),navigator.isCocoonJS&&this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.style.backgroundColor&&(this.context.fillStyle=this.style.backgroundColor,this.context.fillRect(0,0,this.canvas.width,this.canvas.height)),this.context.fillStyle=this.style.fill,this.context.font=this.style.font,this.context.strokeStyle=this.style.stroke,this.context.textBaseline="alphabetic",this.context.lineWidth=this.style.strokeThickness,this.context.lineCap="round",this.context.lineJoin="round",this._charCount=0,a=0;a0&&(f+=y*a),"right"===this.style.align?p+=s-n[a]:"center"===this.style.align&&(p+=(s-n[a])/2),this.autoRound&&(p=Math.round(p),f=Math.round(f)),this.colors.length>0||this.strokeColors.length>0||this.fontWeights.length>0||this.fontStyles.length>0?this.updateLine(e[a],p,f):(this.style.stroke&&this.style.strokeThickness&&(this.updateShadow(this.style.shadowStroke),0===i?this.context.strokeText(e[a],p,f):this.renderTabLine(e[a],p,f,!1)),this.style.fill&&(this.updateShadow(this.style.shadowFill),0===i?this.context.fillText(e[a],p,f):this.renderTabLine(e[a],p,f,!0)));this.updateTexture(),this.dirty=!1},n.Text.prototype.renderTabLine=function(t,e,i,n){var s=t.split(/(?:\t)/),r=this.style.tabs,o=0;if(Array.isArray(r))for(var a=0,h=0;h0&&(a+=r[h-1]),o=e+a,n?this.context.fillText(s[h],o,i):this.context.strokeText(s[h],o,i);else for(h=0;h0||this.fontStyles.length>0){var s=this.fontToComponents(this.context.font);this.fontStyles[this._charCount]&&(s.fontStyle=this.fontStyles[this._charCount]),this.fontWeights[this._charCount]&&(s.fontWeight=this.fontWeights[this._charCount]),this.context.font=this.componentsToFont(s)}this.style.stroke&&this.style.strokeThickness&&(this.strokeColors[this._charCount]&&(this.context.strokeStyle=this.strokeColors[this._charCount]),this.updateShadow(this.style.shadowStroke)),this.style.fill&&(this.colors[this._charCount]&&(this.context.fillStyle=this.colors[this._charCount]),this.updateShadow(this.style.shadowFill)),e+=this.context.measureText(n).width,this._charCount++}return Math.ceil(e)},n.Text.prototype.updateLine=function(t,e,i){for(var n=0;n0||this.fontStyles.length>0){var r=this.fontToComponents(this.context.font);this.fontStyles[this._charCount]&&(r.fontStyle=this.fontStyles[this._charCount]),this.fontWeights[this._charCount]&&(r.fontWeight=this.fontWeights[this._charCount]),this.context.font=this.componentsToFont(r)}this.style.stroke&&this.style.strokeThickness&&(this.strokeColors[this._charCount]&&(this.context.strokeStyle=this.strokeColors[this._charCount]),this.updateShadow(this.style.shadowStroke),this.context.strokeText(s,e,i)),this.style.fill&&(this.colors[this._charCount]&&(this.context.fillStyle=this.colors[this._charCount]),this.updateShadow(this.style.shadowFill),this.context.fillText(s,e,i)),e+=this.context.measureText(s).width,this._charCount++}},n.Text.prototype.clearColors=function(){return this.colors=[],this.strokeColors=[],this.dirty=!0,this},n.Text.prototype.clearFontValues=function(){return this.fontStyles=[],this.fontWeights=[],this.dirty=!0,this},n.Text.prototype.addColor=function(t,e){return this.colors[e]=t,this.dirty=!0,this},n.Text.prototype.addStrokeColor=function(t,e){return this.strokeColors[e]=t,this.dirty=!0,this},n.Text.prototype.addFontStyle=function(t,e){return this.fontStyles[e]=t,this.dirty=!0,this},n.Text.prototype.addFontWeight=function(t,e){return this.fontWeights[e]=t,this.dirty=!0,this},n.Text.prototype.precalculateWordWrap=function(t){return this.texture.baseTexture.resolution=this._res,this.context.font=this.style.font,this.runWordWrap(t).split(/(?:\r\n|\r|\n)/)},n.Text.prototype.runWordWrap=function(t){return this.useAdvancedWrap?this.advancedWordWrap(t):this.basicWordWrap(t)},n.Text.prototype.advancedWordWrap=function(t){for(var e=this.context,i=this.style.wordWrapWidth,n="",s=t.replace(/ +/gi," ").split(/\r?\n/gi),r=s.length,o=0;ol){if(0===u){for(var g=p;g.length&&(g=g.slice(0,-1),!((f=e.measureText(g).width)<=l)););if(!g.length)throw new Error("This text's wordWrapWidth setting is less than a single character!");var m=d.substr(g.length);c[u]=m,h+=g}var y=c[u].length?u:u+1,v=c.slice(y).join(" ").replace(/[ \n]*$/gi,"");s[o+1]=v+" "+(s[o+1]||""),r=s.length;break}h+=p,l-=f}n+=h.replace(/[ \n]*$/gi,"")+"\n"}}return n=n.replace(/[\s|\n]*$/gi,"")},n.Text.prototype.basicWordWrap=function(t){for(var e="",i=t.split("\n"),n=0;ns?(o>0&&(e+="\n"),e+=r[o]+" ",s=this.style.wordWrapWidth-a):(s-=h,e+=r[o]+" ")}ni&&(this.style.wordWrapWidth=i)),this.updateTexture(),this},n.Text.prototype.updateTexture=function(){var t=this.texture.baseTexture,e=this.texture.crop,i=this.texture.frame,n=this.canvas.width,s=this.canvas.height;if(t.width=n,t.height=s,e.width=n,e.height=s,i.width=n,i.height=s,this.texture.width=n,this.texture.height=s,this._width=n,this._height=s,this.textBounds){var r=this.textBounds.x,o=this.textBounds.y;"right"===this.style.boundsAlignH?r+=this.textBounds.width-this.canvas.width/this.resolution:"center"===this.style.boundsAlignH&&(r+=this.textBounds.halfWidth-this.canvas.width/this.resolution/2),"bottom"===this.style.boundsAlignV?o+=this.textBounds.height-this.canvas.height/this.resolution:"middle"===this.style.boundsAlignV&&(o+=this.textBounds.halfHeight-this.canvas.height/this.resolution/2),this.pivot.x=-r,this.pivot.y=-o}this.renderable=0!==n&&0!==s,this.texture.requiresReTint=!0,this.texture.baseTexture.dirty()},n.Text.prototype._renderWebGL=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderWebGL.call(this,t)},n.Text.prototype._renderCanvas=function(t){this.dirty&&(this.updateText(),this.dirty=!1),PIXI.Sprite.prototype._renderCanvas.call(this,t)},n.Text.prototype.determineFontProperties=function(t){var e=n.Text.fontPropertiesCache[t],i=this.testString||"|MÉq";if(!e){e={};var s=n.Text.fontPropertiesCanvas,r=n.Text.fontPropertiesContext;r.font=t;var o=Math.ceil(r.measureText(i).width),a=Math.ceil(r.measureText(i).width),h=2*a;if(a=1.4*a|0,s.width=o,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,o,h),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(i,0,a),!r.getImageData(0,0,o,h))return e.ascent=a,e.descent=a+6,e.fontSize=e.ascent+e.descent,n.Text.fontPropertiesCache[t]=e,e;var l,c,u=r.getImageData(0,0,o,h).data,d=u.length,p=4*o,f=0,g=!1;for(l=0;la;l--){for(c=0;c + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.BitmapText=function(t,e,i,s,r,o,a){e=e||0,i=i||0,s=s||"",r=r||"",o=o||32,a=a||"left",PIXI.DisplayObjectContainer.call(this),this.type=n.BITMAPTEXT,this.physicsType=n.SPRITE,this.textWidth=0,this.textHeight=0,this.anchor=new n.Point,this._prevAnchor=new n.Point,this._glyphs=[],this._maxWidth=0,this._text=r.toString()||"",this._data=t.cache.getBitmapFont(s),this._font=s,this._fontSize=o,this._align=a,this._letterSpacing=0,this._tint=16777215,this.updateText(),this.dirty=!1,n.Component.Core.init.call(this,t,e,i,"",null)},n.BitmapText.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.BitmapText.prototype.constructor=n.BitmapText,n.Component.Core.install.call(n.BitmapText.prototype,["Angle","AutoCull","Bounds","Destroy","FixedToCamera","InputEnabled","InWorld","LifeSpan","PhysicsBody","Reset"]),n.BitmapText.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.BitmapText.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.BitmapText.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.BitmapText.prototype.preUpdateCore=n.Component.Core.preUpdate,n.BitmapText.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.BitmapText.prototype.postUpdate=function(){n.Component.PhysicsBody.postUpdate.call(this),n.Component.FixedToCamera.postUpdate.call(this),this.body&&this.body.type===n.Physics.ARCADE&&(this.textWidth===this.body.sourceWidth&&this.textHeight===this.body.sourceHeight||this.body.setSize(this.textWidth,this.textHeight))},n.BitmapText.prototype.setText=function(t){this.text=t},n.BitmapText.prototype.scanLine=function(t,e,i){for(var n=0,s=0,r=-1,o=0,a=null,h=this._maxWidth>0?this._maxWidth:null,l=[],c=0;c=h&&r>-1)return{width:o||s,text:i.substr(0,c-(c-r)),end:!1,chars:l};s+=(f.xAdvance+g+this.letterSpacing)*e,l.push(n+(f.xOffset+g+this.letterSpacing)*e),n+=(f.xAdvance+g+this.letterSpacing)*e,a=p}return{width:s,text:i,end:u,chars:l}},n.BitmapText.prototype.cleanText=function(t,e){void 0===e&&(e="");var i=this._data.font;if(!i)return"";for(var n=t.replace(/\r\n|\n\r|\n|\r/g,"\n").split("\n"),s=0;sthis.textWidth&&(this.textWidth=c.width),s+=t.lineHeight*i,e=e.substr(c.text.length+1)}while(!1===c.end);this.textHeight=s;for(var r=0,o=0,a=this.textWidth*this.anchor.x,h=this.textHeight*this.anchor.y,l=0;l0&&(this._fontSize=t,this.updateText())}}),Object.defineProperty(n.BitmapText.prototype,"text",{get:function(){return this._text},set:function(t){t!==this._text&&(this._text=t.toString()||"",this.updateText())}}),Object.defineProperty(n.BitmapText.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(t){t!==this._maxWidth&&(this._maxWidth=t,this.updateText())}}),Object.defineProperty(n.BitmapText.prototype,"smoothed",{get:function(){return!this._data.base.scaleMode},set:function(t){this._data.base.scaleMode=t?0:1,this._data.base.dirty()}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.RetroFont=function(t,e,i,s,r,o,a,h,l,c){if(!t.cache.checkImageKey(e))return!1;null==o&&(o=t.cache.getImage(e).width/i),this.characterWidth=i,this.characterHeight=s,this.characterSpacingX=a||0,this.characterSpacingY=h||0,this.characterPerRow=o,this.offsetX=l||0,this.offsetY=c||0,this.align="left",this.multiLine=!1,this.autoUpperCase=!0,this.customSpacingX=0,this.customSpacingY=0,this.fixedWidth=0,this.fontSet=t.cache.getImage(e),this._text="",this.grabData=[],this.frameData=new n.FrameData;for(var u=this.offsetX,d=this.offsetY,p=0,f=0;f?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",n.RetroFont.TEXT_SET2=" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ",n.RetroFont.TEXT_SET3="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ",n.RetroFont.TEXT_SET4="ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789",n.RetroFont.TEXT_SET5="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,/() '!?-*:0123456789",n.RetroFont.TEXT_SET6="ABCDEFGHIJKLMNOPQRSTUVWXYZ!?:;0123456789\"(),-.' ",n.RetroFont.TEXT_SET7="AGMSY+:4BHNTZ!;5CIOU.?06DJPV,(17EKQW\")28FLRX-'39",n.RetroFont.TEXT_SET8="0123456789 .ABCDEFGHIJKLMNOPQRSTUVWXYZ",n.RetroFont.TEXT_SET9="ABCDEFGHIJKLMNOPQRSTUVWXYZ()-0123456789.:,'\"?!",n.RetroFont.TEXT_SET10="ABCDEFGHIJKLMNOPQRSTUVWXYZ",n.RetroFont.TEXT_SET11="ABCDEFGHIJKLMNOPQRSTUVWXYZ.,\"-+!?()':;0123456789",n.RetroFont.prototype.setFixedWidth=function(t,e){void 0===e&&(e="left"),this.fixedWidth=t,this.align=e},n.RetroFont.prototype.setText=function(t,e,i,n,s,r){this.multiLine=e||!1,this.customSpacingX=i||0,this.customSpacingY=n||0,this.align=s||"left",this.autoUpperCase=!r,t.length>0&&(this.text=t)},n.RetroFont.prototype.buildRetroFontText=function(){var t=0,e=0;if(this.clear(),this.multiLine){var i=this._text.split("\n");this.fixedWidth>0?this.resize(this.fixedWidth,i.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY,!0):this.resize(this.getLongestLine()*(this.characterWidth+this.customSpacingX),i.length*(this.characterHeight+this.customSpacingY)-this.customSpacingY,!0);for(var s=0;s0?this.resize(this.fixedWidth,this.characterHeight,!0):this.resize(this._text.length*(this.characterWidth+this.customSpacingX),this.characterHeight,!0),t=0,this.align===n.RetroFont.ALIGN_RIGHT?t=this.width-this._text.length*(this.characterWidth+this.customSpacingX):this.align===n.RetroFont.ALIGN_CENTER&&(t=this.width/2-this._text.length*(this.characterWidth+this.customSpacingX)/2,t+=this.customSpacingX/2),t<0&&(t=0),this.pasteLine(this._text,t,0,this.customSpacingX);this.requiresReTint=!0},n.RetroFont.prototype.pasteLine=function(t,e,i,n){for(var s=0;s=0&&(this.stamp.frame=this.grabData[t.charCodeAt(s)],this.renderXY(this.stamp,e,i,!1),(e+=this.characterWidth+n)>this.width))break},n.RetroFont.prototype.getLongestLine=function(){var t=0;if(this._text.length>0)for(var e=this._text.split("\n"),i=0;it&&(t=e[i].length);return t},n.RetroFont.prototype.removeUnsupportedCharacters=function(t){for(var e="",i=0;i=0||!t&&"\n"===n)&&(e=e.concat(n))}return e},n.RetroFont.prototype.updateOffset=function(t,e){if(this.offsetX!==t||this.offsetY!==e){for(var i=t-this.offsetX,n=e-this.offsetY,s=this.game.cache.getFrameData(this.stamp.key).getFrames(),r=s.length;r--;)s[r].x+=i,s[r].y+=n;this.buildRetroFontText()}},Object.defineProperty(n.RetroFont.prototype,"text",{get:function(){return this._text},set:function(t){var e;(e=this.autoUpperCase?t.toUpperCase():t)!==this._text&&(this._text=e,this.removeUnsupportedCharacters(this.multiLine),this.buildRetroFontText())}}),Object.defineProperty(n.RetroFont.prototype,"smoothed",{get:function(){return this.stamp.smoothed},set:function(t){this.stamp.smoothed=t,this.buildRetroFontText()}}), +/** + * @author Richard Davey + * @author Mat Groves (@Doormat23) + * @author Rovanion Luckey + * @copyright 2016 Photon Storm Ltd, Richard Davey + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Rope=function(t,e,i,s,r,o){this.points=o||[],this._hasUpdateAnimation=!1,this._updateAnimationCallback=null,e=e||0,i=i||0,s=s||null,r=r||null,this.type=n.ROPE,PIXI.DisplayObjectContainer.call(this),this.texture=n.Cache.DEFAULT,this.uvs=new Float32Array([0,1,1,1,1,0,0,1]),this.vertices=new Float32Array([0,0,100,0,100,100,0,100]),this.colors=new Float32Array([1,1,1,1]),this.indices=new Uint16Array([0,1,2,3]),o&&(this.vertices=new Float32Array(4*o.length),this.uvs=new Float32Array(4*o.length),this.colors=new Float32Array(2*o.length),this.indices=new Uint16Array(2*o.length)),this.dirty=!0,this.canvasPadding=0,this.drawMode=n.Rope.TRIANGLE_STRIP,n.Component.Core.init.call(this,t,e,i,s,r),this.refresh()},n.Rope.prototype=Object.create(PIXI.DisplayObjectContainer.prototype),n.Rope.prototype.constructor=n.Rope,n.Component.Core.install.call(n.Rope.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Crop","Delta","Destroy","FixedToCamera","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","ScaleMinMax","Smoothed"]),n.Rope.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.Rope.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.Rope.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.Rope.prototype.preUpdateCore=n.Component.Core.preUpdate,n.Rope.TRIANGLE_STRIP=0,n.Rope.TRIANGLES=1,n.Rope.prototype.preUpdate=function(){return!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.Rope.prototype.update=function(){this._hasUpdateAnimation&&this.updateAnimation.call(this)},n.Rope.prototype.reset=function(t,e){return n.Component.Reset.prototype.reset.call(this,t,e),this},n.Rope.prototype.refresh=function(){var t=this.points;if(!(t.length<1)){var e=this.uvs,i=this.indices,n=this.colors;this.count-=.2;for(var s=t.length,r=0,o=0,a=0;a0){var w=this.canvasPadding/this.worldTransform.a,_=this.canvasPadding/this.worldTransform.d,T=(l+c+u)/3,C=(d+p+f)/3,S=l-T,P=d-C,A=Math.sqrt(S*S+P*P);l=T+S/A*(A+w),d=C+P/A*(A+_),P=p-C,c=T+(S=c-T)/(A=Math.sqrt(S*S+P*P))*(A+w),p=C+P/A*(A+_),P=f-C,u=T+(S=u-T)/(A=Math.sqrt(S*S+P*P))*(A+w),f=C+P/A*(A+_)}t.save(),t.beginPath(),t.moveTo(l,d),t.lineTo(c,p),t.lineTo(u,f),t.closePath(),t.clip();var E=g*b+v*y+m*x-b*y-v*m-g*x,M=l*b+v*u+c*x-b*u-v*c-l*x,k=g*c+l*y+m*u-c*y-l*m-g*u,L=g*b*u+v*c*y+l*m*x-l*b*y-v*m*u-g*c*x,O=d*b+v*f+p*x-b*f-v*p-d*x,I=g*p+d*y+m*f-p*y-d*m-g*f,B=g*b*f+v*p*y+d*m*x-d*b*y-v*m*f-g*p*x;t.transform(M/E,O/E,k/E,I/E,L/E,B/E),t.drawImage(o,0,0),t.restore()},n.Rope.prototype.renderStripFlat=function(t){var e=this.context,i=t.vertices,n=i.length/2;this.count++,e.beginPath();for(var s=1;sl?y:l,c=v>c?v:c}if(u===-1/0||c===1/0)return n.EmptyRectangle;var b=this._bounds;return b.x=u,b.width=l-u,b.y=d,b.height=c-d,this._currentBounds=b,b},Object.defineProperty(n.Rope.prototype,"updateAnimation",{get:function(){return this._updateAnimation},set:function(t){t&&"function"==typeof t?(this._hasUpdateAnimation=!0,this._updateAnimation=t):(this._hasUpdateAnimation=!1,this._updateAnimation=null)}}),Object.defineProperty(n.Rope.prototype,"segments",{get:function(){for(var t,e,i,s,r,o,a,h,l=[],c=0;c + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.TileSprite=function(t,e,i,s,r,o,a){e=e||0,i=i||0,s=s||256,r=r||256,o=o||null,a=a||null,PIXI.Sprite.call(this,new PIXI.Texture(n.Cache.DEFAULT.baseTexture),s,r),this.type=n.TILESPRITE,this.physicsType=n.SPRITE,this._scroll=new n.Point,this.tileScale=new n.Point(1,1),this.tileScaleOffset=new n.Point(1,1),this.tilePosition=new n.Point,this.textureDebug=!1,this.canvasBuffer=null,this.tilingTexture=null,this.tilePattern=null,this.refreshTexture=!0,this.frameWidth=0,this.frameHeight=0,this._width=s,this._height=r,n.Component.Core.init.call(this,t,e,i,o,a)},n.TileSprite.prototype=Object.create(PIXI.Sprite.prototype),n.TileSprite.prototype.constructor=n.TileSprite,n.Component.Core.install.call(n.TileSprite.prototype,["Angle","Animation","AutoCull","Bounds","BringToTop","Destroy","FixedToCamera","Health","InCamera","InputEnabled","InWorld","LifeSpan","LoadTexture","Overlap","PhysicsBody","Reset","Smoothed"]),n.TileSprite.prototype.preUpdatePhysics=n.Component.PhysicsBody.preUpdate,n.TileSprite.prototype.preUpdateLifeSpan=n.Component.LifeSpan.preUpdate,n.TileSprite.prototype.preUpdateInWorld=n.Component.InWorld.preUpdate,n.TileSprite.prototype.preUpdateCore=n.Component.Core.preUpdate,n.TileSprite.prototype.preUpdate=function(){return 0!==this._scroll.x&&(this.tilePosition.x+=this._scroll.x*this.game.time.physicsElapsed),0!==this._scroll.y&&(this.tilePosition.y+=this._scroll.y*this.game.time.physicsElapsed),!!(this.preUpdatePhysics()&&this.preUpdateLifeSpan()&&this.preUpdateInWorld())&&this.preUpdateCore()},n.TileSprite.prototype.autoScroll=function(t,e){return this._scroll.set(t,e),this},n.TileSprite.prototype.stopScroll=function(){return this._scroll.set(0,0),this},n.TileSprite.prototype.destroy=function(t){n.Component.Destroy.prototype.destroy.call(this,t),PIXI.Sprite.prototype.destroy.call(this),this.canvasBuffer&&(this.canvasBuffer.destroy(),this.canvasBuffer=null),this.tileScale=null,this.tileScaleOffset=null,this.tilePosition=null,this.tilingTexture&&(this.tilingTexture.destroy(!0),this.tilingTexture=null)},n.TileSprite.prototype.reset=function(t,e){return n.Component.Reset.prototype.reset.call(this,t,e),this.tilePosition.x=0,this.tilePosition.y=0,this},n.TileSprite.prototype.setTexture=function(t){return this.texture!==t&&(this.texture=t,this.refreshTexture=!0,this.cachedTint=16777215),this},n.TileSprite.prototype._renderWebGL=function(t){if(this.visible&&this.renderable&&0!==this.alpha){if(this._mask&&(t.spriteBatch.stop(),t.maskManager.pushMask(this.mask,t),t.spriteBatch.start()),this._filters&&(t.spriteBatch.flush(),t.filterManager.pushFilter(this._filterBlock)),this.refreshTexture){if(this.generateTilingTexture(!0,t),!this.tilingTexture)return;this.tilingTexture.needsUpdate&&(this.tilingTexture.baseTexture.textureIndex=this.texture.baseTexture.textureIndex,t.renderer.updateTexture(this.tilingTexture.baseTexture),this.tilingTexture.needsUpdate=!1)}t.spriteBatch.renderTilingSprite(this);for(var e=0;e(w=y>(w=g>(w=p>w?p:w)?g:w)?y:w)?b:w,_=x>(_=v>(_=m>(_=f>_?f:_)?m:_)?v:_)?x:_;var S=this._bounds;return S.x=T,S.width=w-T,S.y=C,S.height=_-C,this._currentBounds=S,S},Object.defineProperty(n.TileSprite.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t}}),Object.defineProperty(n.TileSprite.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.CanvasPool={create:function(t,e,i){var s,r=n.CanvasPool.getFirst();if(-1===r){var o={parent:t,canvas:document.createElement("canvas")};n.CanvasPool.pool.push(o),s=o.canvas}else n.CanvasPool.pool[r].parent=t,s=n.CanvasPool.pool[r].canvas;return void 0!==e&&(s.width=e,s.height=i),s},getFirst:function(){for(var t=n.CanvasPool.pool,e=0;e + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Device=function(){this.deviceReadyAt=0,this.initialized=!1,this.desktop=!1,this.iOS=!1,this.iOSVersion=0,this.cocoonJS=!1,this.cocoonJSApp=!1,this.cordova=!1,this.node=!1,this.nodeWebkit=!1,this.electron=!1,this.ejecta=!1,this.crosswalk=!1,this.android=!1,this.chromeOS=!1,this.linux=!1,this.macOS=!1,this.windows=!1,this.windowsPhone=!1,this.canvas=!1,this.canvasBitBltShift=null,this.canHandleAlpha=!1,this.canUseMultiply=!1,this.webGL=!1,this.file=!1,this.fileSystem=!1,this.localStorage=!1,this.worker=!1,this.css3D=!1,this.pointerLock=!1,this.typedArray=!1,this.vibration=!1,this.getUserMedia=!0,this.quirksMode=!1,this.touch=!1,this.mspointer=!1,this.wheelEvent=null,this.arora=!1,this.chrome=!1,this.chromeVersion=0,this.epiphany=!1,this.firefox=!1,this.firefoxVersion=0,this.ie=!1,this.ieVersion=0,this.trident=!1,this.tridentVersion=0,this.edge=!1,this.mobileSafari=!1,this.midori=!1,this.opera=!1,this.safari=!1,this.safariVersion=0,this.webApp=!1,this.silk=!1,this.audioData=!1,this.webAudio=!1,this.ogg=!1,this.opus=!1,this.mp3=!1,this.wav=!1,this.m4a=!1,this.webm=!1,this.dolby=!1,this.oggVideo=!1,this.h264Video=!1,this.mp4Video=!1,this.webmVideo=!1,this.vp9Video=!1,this.hlsVideo=!1,this.iPhone=!1,this.iPhone4=!1,this.iPad=!1,this.pixelRatio=0,this.littleEndian=!1,this.LITTLE_ENDIAN=!1,this.support32bit=!1,this.fullscreen=!1,this.requestFullscreen="",this.cancelFullscreen="",this.fullscreenKeyboard=!1},n.Device=new n.Device,n.Device.onInitialized=new n.Signal,n.Device.whenReady=function(t,e,i){var n=this._readyCheck;if(this.deviceReadyAt||!n)t.call(e,this);else if(n._monitor||i)n._queue=n._queue||[],n._queue.push([t,e]);else{n._monitor=n.bind(this),n._queue=n._queue||[],n._queue.push([t,e]);var s=void 0!==window.cordova,r=navigator.isCocoonJS;"complete"===document.readyState||"interactive"===document.readyState?window.setTimeout(n._monitor,0):s&&!r?document.addEventListener("deviceready",n._monitor,!1):(document.addEventListener("DOMContentLoaded",n._monitor,!1),window.addEventListener("load",n._monitor,!1))}},n.Device._readyCheck=function(){var t=this._readyCheck;if(document.body){if(!this.deviceReadyAt){var e;for(this.deviceReadyAt=Date.now(),document.removeEventListener("deviceready",t._monitor),document.removeEventListener("DOMContentLoaded",t._monitor),window.removeEventListener("load",t._monitor),this._initialize(),this.initialized=!0,this.onInitialized.dispatch(this);e=t._queue.shift();){var i=e[0],n=e[1];i.call(n,this)}this._readyCheck=null,this._initialize=null,this.onInitialized=null}}else window.setTimeout(t._monitor,20)},n.Device._initialize=function(){var t,e,i,s=this;!function(){var t=navigator.userAgent;/Playstation Vita/.test(t)?s.vita=!0:/Kindle/.test(t)||/\bKF[A-Z][A-Z]+/.test(t)||/Silk.*Mobile Safari/.test(t)?s.kindle=!0:/Android/.test(t)?s.android=!0:/CrOS/.test(t)?s.chromeOS=!0:/iP[ao]d|iPhone/i.test(t)?(s.iOS=!0,navigator.appVersion.match(/OS (\d+)/),s.iOSVersion=parseInt(RegExp.$1,10)):/Linux/.test(t)?s.linux=!0:/Mac OS/.test(t)?s.macOS=!0:/Windows/.test(t)&&(s.windows=!0),(/Windows Phone/i.test(t)||/IEMobile/i.test(t))&&(s.android=!1,s.iOS=!1,s.macOS=!1,s.windows=!0,s.windowsPhone=!0);var e=/Silk/.test(t);(s.windows||s.macOS||s.linux&&!e||s.chromeOS)&&(s.desktop=!0),(s.windowsPhone||/Windows NT/i.test(t)&&/Touch/i.test(t))&&(s.desktop=!1)}(),function(){var t=navigator.userAgent;if(/Arora/.test(t)?s.arora=!0:/Edge\/\d+/.test(t)?s.edge=!0:/Chrome\/(\d+)/.test(t)&&!s.windowsPhone?(s.chrome=!0,s.chromeVersion=parseInt(RegExp.$1,10)):/Epiphany/.test(t)?s.epiphany=!0:/Firefox\D+(\d+)/.test(t)?(s.firefox=!0,s.firefoxVersion=parseInt(RegExp.$1,10)):/AppleWebKit/.test(t)&&s.iOS?s.mobileSafari=!0:/MSIE (\d+\.\d+);/.test(t)?(s.ie=!0,s.ieVersion=parseInt(RegExp.$1,10)):/Midori/.test(t)?s.midori=!0:/Opera/.test(t)?s.opera=!0:/Safari\/(\d+)/.test(t)&&!s.windowsPhone?(s.safari=!0,/Version\/(\d+)\./.test(t)&&(s.safariVersion=parseInt(RegExp.$1,10))):/Trident\/(\d+\.\d+)(.*)rv:(\d+\.\d+)/.test(t)&&(s.ie=!0,s.trident=!0,s.tridentVersion=parseInt(RegExp.$1,10),s.ieVersion=parseInt(RegExp.$3,10)),/Silk/.test(t)&&(s.silk=!0),navigator.standalone&&(s.webApp=!0),void 0!==window.cordova&&(s.cordova=!0),"undefined"!=typeof process&&(s.node=!0),s.node&&"object"==typeof process.versions&&(s.nodeWebkit=!!process.versions["node-webkit"],s.electron=!!process.versions.electron),navigator.isCocoonJS&&(s.cocoonJS=!0),s.cocoonJS)try{s.cocoonJSApp="undefined"!=typeof CocoonJS}catch(t){s.cocoonJSApp=!1}void 0!==window.ejecta&&(s.ejecta=!0),/Crosswalk/.test(t)&&(s.crosswalk=!0)}(),function(){s.audioData=!!window.Audio,s.webAudio=!(!window.AudioContext&&!window.webkitAudioContext);var t=document.createElement("audio");try{if(t.canPlayType&&(t.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(s.ogg=!0),(t.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")||t.canPlayType("audio/opus;").replace(/^no$/,""))&&(s.opus=!0),t.canPlayType("audio/mpeg;").replace(/^no$/,"")&&(s.mp3=!0),t.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")&&(s.wav=!0),(t.canPlayType("audio/x-m4a;")||t.canPlayType("audio/aac;").replace(/^no$/,""))&&(s.m4a=!0),t.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")&&(s.webm=!0),""!==t.canPlayType('audio/mp4;codecs="ec-3"')))if(s.edge)s.dolby=!0;else if(s.safari&&s.safariVersion>=9&&/Mac OS X (\d+)_(\d+)/.test(navigator.userAgent)){var e=parseInt(RegExp.$1,10),i=parseInt(RegExp.$2,10);(10===e&&i>=11||e>10)&&(s.dolby=!0)}}catch(t){}}(),function(){var t=document.createElement("video");try{t.canPlayType&&(t.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,"")&&(s.oggVideo=!0),t.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,"")&&(s.h264Video=!0,s.mp4Video=!0),t.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")&&(s.webmVideo=!0),t.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,"")&&(s.vp9Video=!0),t.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,"")&&(s.hlsVideo=!0))}catch(t){}}(),function(){var t,e=document.createElement("p"),i={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var n in document.body.insertBefore(e,null),i)void 0!==e.style[n]&&(e.style[n]="translate3d(1px,1px,1px)",t=window.getComputedStyle(e).getPropertyValue(i[n]));document.body.removeChild(e),s.css3D=void 0!==t&&t.length>0&&"none"!==t}(),s.pixelRatio=window.devicePixelRatio||1,s.iPhone=-1!==navigator.userAgent.toLowerCase().indexOf("iphone"),s.iPhone4=2===s.pixelRatio&&s.iPhone,s.iPad=-1!==navigator.userAgent.toLowerCase().indexOf("ipad"),"undefined"!=typeof Int8Array?s.typedArray=!0:s.typedArray=!1,"undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint32Array&&(s.littleEndian=(t=new ArrayBuffer(4),e=new Uint8Array(t),i=new Uint32Array(t),e[0]=161,e[1]=178,e[2]=195,e[3]=212,3569595041===i[0]||2712847316!==i[0]&&null),s.LITTLE_ENDIAN=s.littleEndian),s.support32bit="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof Int32Array&&null!==s.littleEndian&&function(){if(void 0===Uint8ClampedArray)return!1;var t=n.CanvasPool.create(this,1,1).getContext("2d");if(!t)return!1;var e=t.createImageData(1,1);return n.CanvasPool.remove(this),e.data instanceof Uint8ClampedArray}(),navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate,navigator.vibrate&&(s.vibration=!0),function(){s.canvas=!!window.CanvasRenderingContext2D||s.cocoonJS;try{s.localStorage=!!localStorage.getItem}catch(t){s.localStorage=!1}s.file=!!(window.File&&window.FileReader&&window.FileList&&window.Blob),s.fileSystem=!!window.requestFileSystem,s.webGL=!!window.WebGLRenderingContext,s.worker=!!window.Worker,s.pointerLockElement=("pointerLockElement"in document?"pointerLockElement":"mozPointerLockElement"in document&&"mozPointerLockElement")||"webkitPointerLockElement"in document&&"webkitPointerLockElement",s.pointerlockchange=("onpointerlockchange"in document?"pointerlockchange":"onmozpointerlockchange"in document&&"mozpointerlockchange")||"onwebkitpointerlockchange"in document&&"webkitpointerlockchange",s.pointerlockerror=("onpointerlockerror"in document?"pointerlockerror":"onmozpointerlockerror"in document&&"mozpointerlockerror")||"onwebkitpointerlockerror"in document&&"webkitpointerlockerror",s.pointerLock=!!s.pointerLockElement,s.quirksMode="CSS1Compat"!==document.compatMode,navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia||navigator.oGetUserMedia,window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,s.getUserMedia=s.getUserMedia&&!!navigator.getUserMedia&&!!window.URL,s.firefox&&s.firefoxVersion<21&&(s.getUserMedia=!1),!s.iOS&&(s.ie||s.firefox||s.chrome)&&(s.canvasBitBltShift=!0),(s.safari||s.mobileSafari)&&(s.canvasBitBltShift=!1)}(),function(){var t=n.CanvasPool.create(this,6,1),e=t.getContext("2d");e.fillStyle="rgba(10, 20, 30, 0.5)",e.fillRect(0,0,1,1);var i=e.getImageData(0,0,1,1);if(i){e.putImageData(i,1,0);var r=e.getImageData(1,0,1,1);s.canHandleAlpha=r.data[0]===i.data[0]&&r.data[1]===i.data[1]&&r.data[2]===i.data[2]&&r.data[3]===i.data[3]}e.globalCompositeOperation="multiply",s.canUseMultiply="multiply"===e.globalCompositeOperation,n.CanvasPool.removeByCanvas(t),PIXI.CanvasTinter.tintMethod=s.canUseMultiply?PIXI.CanvasTinter.tintWithMultiply:PIXI.CanvasTinter.tintWithPerPixel}(),function(){for(var t=["requestFullscreen","requestFullScreen","webkitRequestFullscreen","webkitRequestFullScreen","msRequestFullscreen","msRequestFullScreen","mozRequestFullScreen","mozRequestFullscreen"],e=document.createElement("div"),i=0;i=1)&&(s.touch=!0),(window.PointerEvent||window.MSPointerEvent||window.navigator.msPointerEnabled||window.navigator.pointerEnabled)&&(s.mspointer=!0),s.cocoonJS||("onwheel"in window||s.ie&&"WheelEvent"in window?s.wheelEvent="wheel":"onmousewheel"in window?s.wheelEvent="mousewheel":s.firefox&&"MouseScrollEvent"in window&&(s.wheelEvent="DOMMouseScroll"))},n.Device.canPlayAudio=function(t){return!("mp3"!==t||!this.mp3)||(!("ogg"!==t||!this.ogg&&!this.opus)||(!("m4a"!==t||!this.m4a)||(!("opus"!==t||!this.opus)||(!("wav"!==t||!this.wav)||(!("webm"!==t||!this.webm)||!("mp4"!==t||!this.dolby))))))},n.Device.canPlayVideo=function(t){return!("webm"!==t||!this.webmVideo&&!this.vp9Video)||(!("mp4"!==t||!this.mp4Video&&!this.h264Video)||(!("ogg"!==t&&"ogv"!==t||!this.oggVideo)||!("mpeg"!==t||!this.hlsVideo)))},n.Device.needsTouchUnlock=function(){return!!(!this.cocoonJS&&(this.iOS||this.android)||window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)},n.Device.isAndroidStockBrowser=function(){var t=window.navigator.userAgent.match(/Android.*AppleWebKit\/([\d.]+)/);return t&&t[1]<537}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Canvas={create:function(t,e,i,s,r){e=e||256,i=i||256;var o=r?document.createElement("canvas"):n.CanvasPool.create(t,e,i);return"string"==typeof s&&""!==s&&(o.id=s),o.width=e,o.height=i,o.style.display="block",o},setBackgroundColor:function(t,e){return e=e||"rgb(0,0,0)",t.style.backgroundColor=e,t},setTouchAction:function(t,e){return e=e||"none",t.style.msTouchAction=e,t.style["ms-touch-action"]=e,t.style["touch-action"]=e,t},setUserSelect:function(t,e){return e=e||"none",t.style["-webkit-touch-callout"]=e,t.style["-webkit-user-select"]=e,t.style["-khtml-user-select"]=e,t.style["-moz-user-select"]=e,t.style["-ms-user-select"]=e,t.style["user-select"]=e,t.style["-webkit-tap-highlight-color"]="rgba(0, 0, 0, 0)",t},addToDOM:function(t,e,i){var n;return void 0===i&&(i=!0),e&&("string"==typeof e?n=document.getElementById(e):"object"==typeof e&&1===e.nodeType&&(n=e)),n||(n=document.body),i&&n.style&&(n.style.overflow="hidden"),n.appendChild(t),t},removeFromDOM:function(t){t.parentNode&&t.parentNode.removeChild(t)},setTransform:function(t,e,i,n,s,r,o){return t.setTransform(n,r,o,s,e,i),t},setSmoothingEnabled:function(t,e){var i=n.Canvas.getSmoothingPrefix(t);return i&&(t[i]=e),t},getSmoothingPrefix:function(t){var e=["i","webkitI","msI","mozI","oI"];for(var i in e){var n=e[i]+"mageSmoothingEnabled";if(n in t)return n}return null},getSmoothingEnabled:function(t){var e=n.Canvas.getSmoothingPrefix(t);if(e)return t[e]},setImageRenderingCrisp:function(t){for(var e=["-webkit-optimize-contrast","-moz-crisp-edges","crisp-edges","pixelated"],i=0;i + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.RequestAnimationFrame=function(t,e){void 0===e&&(e=!1),this.game=t,this.isRunning=!1,this.forceSetTimeOut=e;for(var i=["ms","moz","webkit","o"],n=0;n + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Math={PI2:2*Math.PI,HALF_PI:.5*Math.PI,DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI,degToRad:function(t){return t*n.Math.DEG_TO_RAD},radToDeg:function(t){return t*n.Math.RAD_TO_DEG},getNextPowerOfTwo:function(t){if(t>0&&0==(t&t-1))return t;for(var e=1;e0&&0==(t&t-1)&&e>0&&0==(e&e-1)},random:function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=1),t===e)return t;if(t>e){var i=t;t=e,e=i}return Math.random()*(e-t)+t},between:function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=1),t===e)return t;if(t>e){var i=t;t=e,e=i}return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t},fuzzyEqual:function(t,e,i){return void 0===i&&(i=1e-4),Math.abs(t-e)e-i},fuzzyCeil:function(t,e){return void 0===e&&(e=1e-4),Math.ceil(t-e)},fuzzyFloor:function(t,e){return void 0===e&&(e=1e-4),Math.floor(t+e)},average:function(){for(var t=0,e=arguments.length,i=0;i=n.Math.PI2-i?t=e:(Math.abs(e-t)>Math.PI&&(et?t+=i:e=0?t:t+2*Math.PI},maxAdd:function(t,e,i){return Math.min(t+e,i)},minSub:function(t,e,i){return Math.max(t-e,i)},wrap:function(t,e,i){var n=i-e;if(n<=0)return 0;var s=(t-e)%n;return s<0&&(s+=n),s+e},wrapValue:function(t,e,i){return((t=Math.abs(t))+(e=Math.abs(e)))%(i=Math.abs(i))},isOdd:function(t){return!!(1&t)},isEven:function(t){return!(1&t)},min:function(){if(1===arguments.length&&"object"==typeof arguments[0])var t=arguments[0];else t=arguments;for(var e=1,i=0,n=t.length;et[i]&&(i=e);return t[i]},minProperty:function(t){if(2===arguments.length&&"object"==typeof arguments[1])var e=arguments[1];else e=arguments.slice(1);for(var i=1,n=0,s=e.length;ie[n][t]&&(n=i);return e[n][t]},wrapAngle:function(t,e){return e?this.wrap(t,-Math.PI,Math.PI):this.wrap(t,-180,180)},linearInterpolation:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n);return e<0?this.linear(t[0],t[1],n):e>1?this.linear(t[i],t[i-1],i-n):this.linear(t[s],t[s+1>i?i:s+1],n-s)},bezierInterpolation:function(t,e){for(var i=0,n=t.length-1,s=0;s<=n;s++)i+=Math.pow(1-e,n-s)*Math.pow(e,s)*t[s]*this.bernstein(n,s);return i},catmullRomInterpolation:function(t,e){var i=t.length-1,n=i*e,s=Math.floor(n);return t[0]===t[i]?(e<0&&(s=Math.floor(n=i*(1+e))),this.catmullRom(t[(s-1+i)%i],t[s],t[(s+1)%i],t[(s+2)%i],n-s)):e<0?t[0]-(this.catmullRom(t[0],t[0],t[1],t[1],-n)-t[0]):e>1?t[i]-(this.catmullRom(t[i],t[i],t[i-1],t[i-1],n-i)-t[i]):this.catmullRom(t[s?s-1:0],t[s],t[i0?Math.ceil(t):Math.floor(t)},sinCosGenerator:function(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1);for(var s=e,r=i,o=n*Math.PI/t,a=[],h=[],l=0;l0?1:0},percent:function(t,e,i){return void 0===i&&(i=0),t>e||i>e?1:tt?0:(t-i)/e}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.RandomDataGenerator=function(t){void 0===t&&(t=[]),this.c=1,this.s0=0,this.s1=0,this.s2=0,"string"==typeof t?this.state(t):this.sow(t)},n.RandomDataGenerator.prototype={rnd:function(){var t=2091639*this.s0+2.3283064365386963e-10*this.c;return this.c=0|t,this.s0=this.s1,this.s1=this.s2,this.s2=t-this.c,this.s2},sow:function(t){if(this.s0=this.hash(" "),this.s1=this.hash(this.s0),this.s2=this.hash(this.s1),this.c=1,t)for(var e=0;e>>0,n=(e*=n)>>>0,n+=4294967296*(e-=n);return 2.3283064365386963e-10*(n>>>0)},integer:function(){return 4294967296*this.rnd.apply(this)},frac:function(){return this.rnd.apply(this)+11102230246251565e-32*(2097152*this.rnd.apply(this)|0)},real:function(){return this.integer()+this.frac()},integerInRange:function(t,e){return Math.floor(this.realInRange(0,e-t+1)+t)},between:function(t,e){return this.integerInRange(t,e)},realInRange:function(t,e){return this.frac()*(e-t)+t},normal:function(){return 1-2*this.frac()},uuid:function(){var t="",e="";for(e=t="";t++<36;e+=~t%5|3*t&4?(15^t?8^this.frac()*(20^t?16:4):4).toString(16):"-");return e},pick:function(t){return t[this.integerInRange(0,t.length-1)]},sign:function(){return this.pick([-1,1])},weightedPick:function(t){return t[~~(Math.pow(this.frac(),2)*(t.length-1)+.5)]},timestamp:function(t,e){return this.realInRange(t||9466848e5,e||1577862e6)},angle:function(){return this.integerInRange(-180,180)},state:function(t){return"string"==typeof t&&t.match(/^!rnd/)&&(t=t.split(","),this.c=parseFloat(t[1]),this.s0=parseFloat(t[2]),this.s1=parseFloat(t[3]),this.s2=parseFloat(t[4])),["!rnd",this.c,this.s0,this.s1,this.s2].join(",")}},n.RandomDataGenerator.prototype.constructor=n.RandomDataGenerator, +/** + * @author Timo Hausmann + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.QuadTree=function(t,e,i,n,s,r,o){this.maxObjects=10,this.maxLevels=4,this.level=0,this.bounds={},this.objects=[],this.nodes=[],this._empty=[],this.reset(t,e,i,n,s,r,o)},n.QuadTree.prototype={reset:function(t,e,i,n,s,r,o){this.maxObjects=s||10,this.maxLevels=r||4,this.level=o||0,this.bounds={x:Math.round(t),y:Math.round(e),width:i,height:n,subWidth:Math.floor(i/2),subHeight:Math.floor(n/2),right:Math.round(t)+Math.floor(i/2),bottom:Math.round(e)+Math.floor(n/2)},this.objects.length=0,this.nodes.length=0},populate:function(t){t.forEach(this.populateHandler,this,!0)},populateHandler:function(t){t.body&&t.exists&&this.insert(t.body)},split:function(){this.nodes[0]=new n.QuadTree(this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[1]=new n.QuadTree(this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[2]=new n.QuadTree(this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1),this.nodes[3]=new n.QuadTree(this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level+1)},insert:function(t){var e,i=0;if(null==this.nodes[0]||-1===(e=this.getIndex(t))){if(this.objects.push(t),this.objects.length>this.maxObjects&&this.levelthis.bounds.bottom&&(e=2):t.x>this.bounds.right&&(t.ythis.bounds.bottom&&(e=3)),e},retrieve:function(t){if(t instanceof n.Rectangle)var e=this.objects,i=this.getIndex(t);else{if(!t.body)return this._empty;e=this.objects,i=this.getIndex(t.body)}return this.nodes[0]&&(e=-1!==i?e.concat(this.nodes[i].retrieve(t)):(e=(e=(e=e.concat(this.nodes[0].retrieve(t))).concat(this.nodes[1].retrieve(t))).concat(this.nodes[2].retrieve(t))).concat(this.nodes[3].retrieve(t))),e},clear:function(){this.objects.length=0;for(var t=this.nodes.length;t--;)this.nodes[t].clear(),this.nodes.splice(t,1);this.nodes.length=0}},n.QuadTree.prototype.constructor=n.QuadTree, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Net=function(t){this.game=t},n.Net.prototype={getHostName:function(){return window.location&&window.location.hostname?window.location.hostname:null},checkDomainName:function(t){return-1!==window.location.hostname.indexOf(t)},updateQueryString:function(t,e,i,n){void 0===i&&(i=!1),void 0!==n&&""!==n||(n=window.location.href);var s="",r=new RegExp("([?|&])"+t+"=.*?(&|#|$)(.*)","gi");if(r.test(n))s=null!=e?n.replace(r,"$1"+t+"="+e+"$2$3"):n.replace(r,"$1$3").replace(/(&|\?)$/,"");else if(null!=e){var o=-1!==n.indexOf("?")?"&":"?",a=n.split("#");n=a[0]+o+t+"="+e,a[1]&&(n+="#"+a[1]),s=n}else s=n;if(!i)return s;window.location.href=s},getQueryString:function(t){void 0===t&&(t="");var e={},i=location.search.substring(1).split("&");for(var n in i){var s=i[n].split("=");if(s.length>1){if(t&&t===this.decodeURI(s[0]))return this.decodeURI(s[1]);e[this.decodeURI(s[0])]=this.decodeURI(s[1])}}return e},decodeURI:function(t){return decodeURIComponent(t.replace(/\+/g," "))}},n.Net.prototype.constructor=n.Net, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.TweenManager=function(t){this.game=t,this.frameBased=!1,this._tweens=[],this._add=[],this.easeMap={Power0:n.Easing.Power0,Power1:n.Easing.Power1,Power2:n.Easing.Power2,Power3:n.Easing.Power3,Power4:n.Easing.Power4,Linear:n.Easing.Linear.None,Quad:n.Easing.Quadratic.Out,Cubic:n.Easing.Cubic.Out,Quart:n.Easing.Quartic.Out,Quint:n.Easing.Quintic.Out,Sine:n.Easing.Sinusoidal.Out,Expo:n.Easing.Exponential.Out,Circ:n.Easing.Circular.Out,Elastic:n.Easing.Elastic.Out,Back:n.Easing.Back.Out,Bounce:n.Easing.Bounce.Out,"Quad.easeIn":n.Easing.Quadratic.In,"Cubic.easeIn":n.Easing.Cubic.In,"Quart.easeIn":n.Easing.Quartic.In,"Quint.easeIn":n.Easing.Quintic.In,"Sine.easeIn":n.Easing.Sinusoidal.In,"Expo.easeIn":n.Easing.Exponential.In,"Circ.easeIn":n.Easing.Circular.In,"Elastic.easeIn":n.Easing.Elastic.In,"Back.easeIn":n.Easing.Back.In,"Bounce.easeIn":n.Easing.Bounce.In,"Quad.easeOut":n.Easing.Quadratic.Out,"Cubic.easeOut":n.Easing.Cubic.Out,"Quart.easeOut":n.Easing.Quartic.Out,"Quint.easeOut":n.Easing.Quintic.Out,"Sine.easeOut":n.Easing.Sinusoidal.Out,"Expo.easeOut":n.Easing.Exponential.Out,"Circ.easeOut":n.Easing.Circular.Out,"Elastic.easeOut":n.Easing.Elastic.Out,"Back.easeOut":n.Easing.Back.Out,"Bounce.easeOut":n.Easing.Bounce.Out,"Quad.easeInOut":n.Easing.Quadratic.InOut,"Cubic.easeInOut":n.Easing.Cubic.InOut,"Quart.easeInOut":n.Easing.Quartic.InOut,"Quint.easeInOut":n.Easing.Quintic.InOut,"Sine.easeInOut":n.Easing.Sinusoidal.InOut,"Expo.easeInOut":n.Easing.Exponential.InOut,"Circ.easeInOut":n.Easing.Circular.InOut,"Elastic.easeInOut":n.Easing.Elastic.InOut,"Back.easeInOut":n.Easing.Back.InOut,"Bounce.easeInOut":n.Easing.Bounce.InOut},this.game.onPause.add(this._pauseAll,this),this.game.onResume.add(this._resumeAll,this)},n.TweenManager.prototype={getAll:function(){return this._tweens},removeAll:function(){for(var t=0;t0&&(this._tweens=this._tweens.concat(this._add),this._add.length=0),!0},isTweening:function(t,e){return e||(e=!1),this._tweens.some((function(i){return i.target===t&&(!e||i.isRunning&&!i.pendingDelete)}))},_pauseAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t]._pause()},_resumeAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t]._resume()},pauseAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t].pause()},resumeAll:function(){for(var t=this._tweens.length-1;t>=0;t--)this._tweens[t].resume(!0)},destroy:function(){this.game.onPause.remove(this._pauseAll,this),this.game.onResume.remove(this._resumeAll,this),this.game=null,this._add=null,this._tweens=null}},n.TweenManager.prototype.constructor=n.TweenManager, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Tween=function(t,e,i){this.game=e,this.target=t,this.manager=i,this.timeline=[],this.reverse=!1,this.timeScale=1,this.repeatCounter=0,this.pendingDelete=!1,this.onStart=new n.Signal,this.onLoop=new n.Signal,this.onRepeat=new n.Signal,this.onChildComplete=new n.Signal,this.onComplete=new n.Signal,this.isRunning=!1,this.current=0,this.properties={},this.chainedTween=null,this.isPaused=!1,this.frameBased=i.frameBased,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,this._pausedTime=0,this._codePaused=!1,this._hasStarted=!1},n.Tween.updateColor=function(t){n.Color.updateColor(t.target)},n.Tween.prototype={to:function(t,e,i,s,r,o,a){return(void 0===e||e<=0)&&(e=1e3),null==i&&(i=n.Easing.Default),void 0===s&&(s=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=!1),"string"==typeof i&&this.manager.easeMap[i]&&(i=this.manager.easeMap[i]),this.isRunning?(console.warn("Phaser.Tween.to cannot be called after Tween.start"),this):(this.timeline.push(new n.TweenData(this).to(t,e,i,r,o,a)),s&&this.start(),this)},from:function(t,e,i,s,r,o,a){return void 0===e&&(e=1e3),null==i&&(i=n.Easing.Default),void 0===s&&(s=!1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=!1),"string"==typeof i&&this.manager.easeMap[i]&&(i=this.manager.easeMap[i]),this.isRunning?(console.warn("Phaser.Tween.from cannot be called after Tween.start"),this):(this.timeline.push(new n.TweenData(this).from(t,e,i,r,o,a)),s&&this.start(),this)},start:function(t){if(void 0===t&&(t=0),this.pendingDelete)return console.warn("Phaser.Tween.start cannot be called after Tween.stop"),this;if(null===this.game||null===this.target||0===this.timeline.length||this.isRunning)return this;for(var e=0;ethis.timeline.length-1)&&(t=0),this.current=t,this.timeline[this.current].start(),this},stop:function(t){return void 0===t&&(t=!1),this.isRunning=!1,this._onUpdateCallback=null,this._onUpdateCallbackContext=null,t&&(this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start()),this.manager.remove(this),this},updateTweenData:function(t,e,i){if(0===this.timeline.length)return this;if(void 0===i&&(i=0),-1===i)for(var n=0;n0?arguments[t-1].chainedTween=arguments[t]:this.chainedTween=arguments[t];return this},loop:function(t){return void 0===t&&(t=!0),this.repeatCounter=t?-1:0,this},onUpdateCallback:function(t,e){return this._onUpdateCallback=t,this._onUpdateCallbackContext=e,this},pause:function(){this.isPaused=!0,this._codePaused=!0,this._pausedTime=this.game.time.time},_pause:function(){this._codePaused||(this.isPaused=!0,this._pausedTime=this.game.time.time)},resume:function(){if(this.isPaused){this.isPaused=!1,this._codePaused=!1;for(var t=0;t0?(this.repeatCounter--,this.timeline[this.current].start(),this.onRepeat.dispatch(this.target,this),!0):(this.isRunning=!1,this.onComplete.dispatch(this.target,this),this._hasStarted=!1,this.chainedTween&&this.chainedTween.start(),!1):(this.onChildComplete.dispatch(this.target,this),this.timeline[this.current].start(),!0)}},generateData:function(t,e){if(null===this.game||null===this.target)return null;void 0===t&&(t=60),void 0===e&&(e=[]);for(var i=0;i + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.TweenData=function(t){this.parent=t,this.game=t.game,this.vStart={},this.vStartCache={},this.vEnd={},this.vEndCache={},this.duration=1e3,this.percent=0,this.value=0,this.repeatCounter=0,this.repeatDelay=0,this.repeatTotal=0,this.interpolate=!1,this.yoyo=!1,this.yoyoDelay=0,this.inReverse=!1,this.delay=0,this.dt=0,this.startTime=null,this.easingFunction=n.Easing.Default,this.interpolationFunction=n.Math.linearInterpolation,this.interpolationContext=n.Math,this.isRunning=!1,this.isFrom=!1},n.TweenData.PENDING=0,n.TweenData.RUNNING=1,n.TweenData.LOOPED=2,n.TweenData.COMPLETE=3,n.TweenData.prototype={to:function(t,e,i,n,s,r){return this.vEnd=t,this.duration=e,this.easingFunction=i,this.delay=n,this.repeatTotal=s,this.yoyo=r,this.isFrom=!1,this},from:function(t,e,i,n,s,r){return this.vEnd=t,this.duration=e,this.easingFunction=i,this.delay=n,this.repeatTotal=s,this.yoyo=r,this.isFrom=!0,this},start:function(){if(this.startTime=this.game.time.time+this.delay,this.parent.reverse?this.dt=this.duration:this.dt=0,this.delay>0?this.isRunning=!1:this.isRunning=!0,this.isFrom)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t],this.parent.target[t]=this.vStart[t];return this.value=0,this.repeatCounter=this.repeatTotal,this},loadValues:function(){for(var t in this.parent.properties){if(this.vStart[t]=this.parent.properties[t],Array.isArray(this.vEnd[t])){if(0===this.vEnd[t].length)continue;0===this.percent&&(this.vEnd[t]=[this.vStart[t]].concat(this.vEnd[t]))}void 0!==this.vEnd[t]?("string"==typeof this.vEnd[t]&&(this.vEnd[t]=this.vStart[t]+parseFloat(this.vEnd[t])),this.parent.properties[t]=this.vEnd[t]):this.vEnd[t]=this.vStart[t],this.vStartCache[t]=this.vStart[t],this.vEndCache[t]=this.vEnd[t]}return this},update:function(t){if(this.isRunning){if(t=this.startTime))return n.TweenData.PENDING;this.isRunning=!0}var e=this.parent.frameBased?this.game.time.physicsElapsedMS:this.game.time.elapsedMS;for(var i in this.parent.reverse?(this.dt-=e*this.parent.timeScale,this.dt=Math.max(this.dt,0)):(this.dt+=e*this.parent.timeScale,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent),this.vEnd){var s=this.vStart[i],r=this.vEnd[i];Array.isArray(r)?this.parent.target[i]=this.interpolationFunction.call(this.interpolationContext,r,this.value):this.parent.target[i]=s+(r-s)*this.value}return!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent?this.repeat():n.TweenData.RUNNING},generateData:function(t){this.parent.reverse?this.dt=this.duration:this.dt=0;var e=[],i=!1,n=1/t*1e3;do{this.parent.reverse?(this.dt-=n,this.dt=Math.max(this.dt,0)):(this.dt+=n,this.dt=Math.min(this.dt,this.duration)),this.percent=this.dt/this.duration,this.value=this.easingFunction(this.percent);var s={};for(var r in this.vEnd){var o=this.vStart[r],a=this.vEnd[r];Array.isArray(a)?s[r]=this.interpolationFunction.call(this.interpolationContext,a,this.value):s[r]=o+(a-o)*this.value}e.push(s),(!this.parent.reverse&&1===this.percent||this.parent.reverse&&0===this.percent)&&(i=!0)}while(!i);if(this.yoyo){var h=e.slice();h.reverse(),e=e.concat(h)}return e},repeat:function(){if(this.yoyo){if(this.inReverse&&0===this.repeatCounter){for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];return this.inReverse=!1,n.TweenData.COMPLETE}this.inReverse=!this.inReverse}else if(0===this.repeatCounter)return n.TweenData.COMPLETE;if(this.inReverse)for(var t in this.vStartCache)this.vStart[t]=this.vEndCache[t],this.vEnd[t]=this.vStartCache[t];else{for(var t in this.vStartCache)this.vStart[t]=this.vStartCache[t],this.vEnd[t]=this.vEndCache[t];this.repeatCounter>0&&this.repeatCounter--}return this.startTime=this.game.time.time,this.yoyo&&this.inReverse?this.startTime+=this.yoyoDelay:this.inReverse||(this.startTime+=this.repeatDelay),this.parent.reverse?this.dt=this.duration:this.dt=0,n.TweenData.LOOPED}},n.TweenData.prototype.constructor=n.TweenData, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Easing={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 0===t?0:1===t?1:1-Math.cos(t*Math.PI/2)},Out:function(t){return 0===t?0:1===t?1:Math.sin(t*Math.PI/2)},InOut:function(t){return 0===t?0:1===t?1:.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:(.1,-1*Math.pow(2,10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4))},Out:function(t){return 0===t?0:1===t?1:(.1,1*Math.pow(2,-10*t)*Math.sin((t-.1)*(2*Math.PI)/.4)+1)},InOut:function(t){return 0===t?0:1===t?1:(.1,(t*=2)<1?1*Math.pow(2,10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4)*-.5:1*Math.pow(2,-10*(t-=1))*Math.sin((t-.1)*(2*Math.PI)/.4)*.5+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-n.Easing.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*n.Easing.Bounce.In(2*t):.5*n.Easing.Bounce.Out(2*t-1)+.5}}},n.Easing.Default=n.Easing.Linear.None,n.Easing.Power0=n.Easing.Linear.None,n.Easing.Power1=n.Easing.Quadratic.Out,n.Easing.Power2=n.Easing.Cubic.Out,n.Easing.Power3=n.Easing.Quartic.Out,n.Easing.Power4=n.Easing.Quintic.Out, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Time=function(t){this.game=t,this.time=0,this.prevTime=0,this.now=0,this.elapsed=0,this.elapsedMS=0,this.physicsElapsed=1/60,this.physicsElapsedMS=1/60*1e3,this.desiredFpsMult=1/60,this._desiredFps=60,this.suggestedFps=this.desiredFps,this.slowMotion=1,this.advancedTiming=!1,this.frames=0,this.updates=0,this.renders=0,this.fps=0,this.ups=0,this.rps=0,this.fpsMin=1e3,this.fpsMax=0,this.msMin=1e3,this.msMax=0,this.pauseDuration=0,this.timeToCall=0,this.timeExpected=0,this.events=new n.Timer(this.game,!1),this._frameCount=0,this._elapsedAccumulator=0,this._started=0,this._timeLastSecond=0,this._pauseStarted=0,this._justResumed=!1,this._timers=[]},n.Time.prototype={boot:function(){this._started=Date.now(),this.time=Date.now(),this.events.start(),this.timeExpected=this.time},add:function(t){return this._timers.push(t),t},create:function(t){void 0===t&&(t=!0);var e=new n.Timer(this.game,t);return this._timers.push(e),e},removeAll:function(){for(var t=0;t=2*this._desiredFps&&(this.suggestedFps=5*Math.floor(200/(this._elapsedAccumulator/this._frameCount)),this._frameCount=0,this._elapsedAccumulator=0),this.msMin=Math.min(this.msMin,this.elapsed),this.msMax=Math.max(this.msMax,this.elapsed),this.frames++,this.now>this._timeLastSecond+1e3){var t=this.now-this._timeLastSecond;this.fps=Math.round(1e3*this.frames/t),this.ups=Math.round(1e3*this.updates/t),this.rps=Math.round(1e3*this.renders/t),this.fpsMin=Math.min(this.fpsMin,this.fps),this.fpsMax=Math.max(this.fpsMax,this.fps),this._timeLastSecond=this.now,this.frames=0,this.updates=0,this.renders=0}},preUpdate:function(){this.advancedTiming&&this.updates++},preRender:function(){this.advancedTiming&&this.renders++},gamePaused:function(){this._pauseStarted=Date.now(),this.events.pause();for(var t=this._timers.length;t--;)this._timers[t]._pause()},gameResumed:function(){this.time=Date.now(),this.pauseDuration=this.time-this._pauseStarted,this.events.resume();for(var t=this._timers.length;t--;)this._timers[t]._resume()},totalElapsedSeconds:function(){return.001*(this.time-this._started)},elapsedSince:function(t){return this.time-t},elapsedSecondsSince:function(t){return.001*(this.time-t)},reset:function(){this._started=this.time,this.removeAll()}},Object.defineProperty(n.Time.prototype,"desiredFps",{get:function(){return this._desiredFps},set:function(t){this._desiredFps=t,this.physicsElapsed=1/t,this.physicsElapsedMS=1e3*this.physicsElapsed,this.desiredFpsMult=1/t}}),n.Time.prototype.constructor=n.Time, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Timer=function(t,e){void 0===e&&(e=!0),this.game=t,this.running=!1,this.autoDestroy=e,this.expired=!1,this.elapsed=0,this.events=[],this.onComplete=new n.Signal,this.nextTick=0,this.timeCap=1e3,this.paused=!1,this._codePaused=!1,this._started=0,this._pauseStarted=0,this._pauseTotal=0,this._now=Date.now(),this._len=0,this._marked=0,this._i=0,this._diff=0,this._newTick=0},n.Timer.MINUTE=6e4,n.Timer.SECOND=1e3,n.Timer.HALF=500,n.Timer.QUARTER=250,n.Timer.prototype={create:function(t,e,i,s,r,o){var a=t=Math.round(t);0===this._now?a+=this.game.time.time:a+=this._now;var h=new n.TimerEvent(this,t,a,i,e,s,r,o);return this.events.push(h),this.order(),this.expired=!1,h},add:function(t,e,i){return this.create(t,!1,0,e,i,Array.prototype.slice.call(arguments,3))},repeat:function(t,e,i,n){return this.create(t,!1,e,i,n,Array.prototype.slice.call(arguments,4))},loop:function(t,e,i){return this.create(t,!0,0,e,i,Array.prototype.slice.call(arguments,3))},start:function(t){if(!this.running){this._started=this.game.time.time+(t||0),this.running=!0;for(var e=0;e0&&(this.events.sort(this.sortHandler),this.nextTick=this.events[0].tick)},sortHandler:function(t,e){return t.ticke.tick?1:0},clearPendingEvents:function(){for(this._i=this.events.length;this._i--;)this.events[this._i].pendingDelete&&this.events.splice(this._i,1);this._len=this.events.length,this._i=0},update:function(t){if(this.paused)return!0;if(this.elapsed=t-this._now,this._now=t,this.elapsed>this.timeCap&&this.adjustEvents(t-this.elapsed),this._marked=0,this.clearPendingEvents(),this.running&&this._now>=this.nextTick&&this._len>0){for(;this._i=e.tick)||e.pendingDelete)break;this._newTick=this._now+e.delay-(this._now-e.tick),this._newTick<0&&(this._newTick=this._now+e.delay),!0===e.loop?(e.tick=this._newTick,e.callback.apply(e.callbackContext,e.args)):e.repeatCount>0?(e.repeatCount--,e.tick=this._newTick,e.callback.apply(e.callbackContext,e.args)):(this._marked++,e.pendingDelete=!0,e.callback.apply(e.callbackContext,e.args)),this._i++}this.events.length>this._marked?this.order():(this.expired=!0,this.onComplete.dispatch(this))}return!this.expired||!this.autoDestroy},pause:function(){this.running&&(this._codePaused=!0,this.paused||(this._pauseStarted=this.game.time.time,this.paused=!0))},_pause:function(){!this.paused&&this.running&&(this._pauseStarted=this.game.time.time,this.paused=!0)},adjustEvents:function(t){for(var e=0;ethis._now?this.nextTick-this._now:0}}),Object.defineProperty(n.Timer.prototype,"length",{get:function(){return this.events.length}}),Object.defineProperty(n.Timer.prototype,"ms",{get:function(){return this.running?this._now-this._started-this._pauseTotal:0}}),Object.defineProperty(n.Timer.prototype,"seconds",{get:function(){return this.running?.001*this.ms:0}}),n.Timer.prototype.constructor=n.Timer, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.TimerEvent=function(t,e,i,n,s,r,o,a){this.timer=t,this.delay=e,this.tick=i,this.repeatCount=n-1,this.loop=s,this.callback=r,this.callbackContext=o,this.args=a,this.pendingDelete=!1},n.TimerEvent.prototype.constructor=n.TimerEvent, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.AnimationManager=function(t){this.sprite=t,this.game=t.game,this.currentFrame=null,this.currentAnim=null,this.updateIfVisible=!0,this.isLoaded=!1,this._frameData=null,this._anims={},this._outputFrames=[]},n.AnimationManager.prototype={loadFrameData:function(t,e){if(void 0===t)return!1;if(this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(t);return this._frameData=t,null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0,!0},copyFrameData:function(t,e){if(this._frameData=t.clone(),this.isLoaded)for(var i in this._anims)this._anims[i].updateFrameData(this._frameData);return null==e?this.frame=0:"string"==typeof e?this.frameName=e:this.frame=e,this.isLoaded=!0,!0},add:function(t,e,i,s,r){return e=e||[],i=i||60,void 0===s&&(s=!1),void 0===r&&(r=!(!e||"number"!=typeof e[0])),this._outputFrames=[],this._frameData.getFrameIndexes(e,r,this._outputFrames),this._anims[t]=new n.Animation(this.game,this.sprite,t,this._frameData,this._outputFrames,i,s),this.currentAnim=this._anims[t],this.sprite.tilingTexture&&(this.sprite.refreshTexture=!0),this._anims[t]},validateFrames:function(t,e){void 0===e&&(e=!0);for(var i=0;ithis._frameData.total)return!1}else if(!1===this._frameData.checkFrameName(t[i]))return!1;return!0},play:function(t,e,i,n){if(this._anims[t])return this.currentAnim===this._anims[t]?!1===this.currentAnim.isPlaying?(this.currentAnim.paused=!1,this.currentAnim.play(e,i,n)):this.currentAnim:(this.currentAnim&&this.currentAnim.isPlaying&&this.currentAnim.stop(),this.currentAnim=this._anims[t],this.currentAnim.paused=!1,this.currentFrame=this.currentAnim.currentFrame,this.currentAnim.play(e,i,n))},stop:function(t,e){void 0===e&&(e=!1),!this.currentAnim||"string"==typeof t&&t!==this.currentAnim.name||this.currentAnim.stop(e)},update:function(){return!(this.updateIfVisible&&!this.sprite.visible)&&(!(!this.currentAnim||!this.currentAnim.update())&&(this.currentFrame=this.currentAnim.currentFrame,!0))},next:function(t){this.currentAnim&&(this.currentAnim.next(t),this.currentFrame=this.currentAnim.currentFrame)},previous:function(t){this.currentAnim&&(this.currentAnim.previous(t),this.currentFrame=this.currentAnim.currentFrame)},getAnimation:function(t){return"string"==typeof t&&this._anims[t]?this._anims[t]:null},refreshFrame:function(){},destroy:function(){var t=null;for(var t in this._anims)this._anims.hasOwnProperty(t)&&this._anims[t].destroy();this._anims={},this._outputFrames=[],this._frameData=null,this.currentAnim=null,this.currentFrame=null,this.sprite=null,this.game=null}},n.AnimationManager.prototype.constructor=n.AnimationManager,Object.defineProperty(n.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}}),Object.defineProperty(n.AnimationManager.prototype,"frameTotal",{get:function(){return this._frameData.total}}),Object.defineProperty(n.AnimationManager.prototype,"paused",{get:function(){return this.currentAnim.isPaused},set:function(t){this.currentAnim.paused=t}}),Object.defineProperty(n.AnimationManager.prototype,"name",{get:function(){return this.currentAnim?this.currentAnim.name:void 0}}),Object.defineProperty(n.AnimationManager.prototype,"frame",{get:function(){return this.currentFrame?this.currentFrame.index:void 0},set:function(t){var e;"number"==typeof t&&this._frameData&&(e=this._frameData.getFrame(t))&&(this.currentFrame=e,this.sprite.setFrame(this.currentFrame))}}),Object.defineProperty(n.AnimationManager.prototype,"frameName",{get:function(){return this.currentFrame?this.currentFrame.name:void 0},set:function(t){var e;"string"==typeof t&&this._frameData&&(e=this._frameData.getFrameByName(t))?(this.currentFrame=e,this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame)):console.warn("Cannot set frameName: "+t)}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Animation=function(t,e,i,s,r,o,a){void 0===a&&(a=!1),this.game=t,this._parent=e,this._frameData=s,this.name=i,this._frames=[],this._frames=this._frames.concat(r),this.delay=1e3/o,this.loop=a,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=new n.Signal,this.onUpdate=null,this.onComplete=new n.Signal,this.onLoop=new n.Signal,this.isReversed=!1,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},n.Animation.prototype={play:function(t,e,i){return"number"==typeof t&&(this.delay=1e3/t),"boolean"==typeof e&&(this.loop=e),void 0!==i&&(this.killOnComplete=i),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=this.isReversed?this._frames.length-1:0,this.updateCurrentFrame(!1,!0),this._parent.events.onAnimationStart$dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,this._timeLastFrame=this.game.time.time,this._timeNextFrame=this.game.time.time+this.delay,this._frameIndex=0,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this._parent.setFrame(this.currentFrame),this._parent.animations.currentAnim=this,this._parent.animations.currentFrame=this.currentFrame,this.onStart.dispatch(this._parent,this)},reverse:function(){return this.reversed=!this.reversed,this},reverseOnce:function(){return this.onComplete.addOnce(this.reverse,this),this.reverse()},setFrame:function(t,e){var i;if(void 0===e&&(e=!1),"string"==typeof t)for(var n=0;n=0)&&(this._frameSkip=1,this._frameDiff=e,this._timeLastFrame=t,this._frameDiff>this.delay&&(this._frameSkip=Math.floor(this._frameDiff/this.delay),this._frameDiff-=this._frameSkip*this.delay),this._timeNextFrame=t+(this.delay-this._frameDiff),this.isReversed?this._frameIndex-=this._frameSkip:this._frameIndex+=this._frameSkip,!this.isReversed&&this._frameIndex>=this._frames.length||this.isReversed&&this._frameIndex<=-1?this.loop?(this._frameIndex=Math.abs(this._frameIndex)%this._frames.length,this.isReversed&&(this._frameIndex=this._frames.length-1-this._frameIndex),this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&this._parent.setFrame(this.currentFrame),this.loopCount++,this._parent.events.onAnimationLoop$dispatch(this._parent,this),this.onLoop.dispatch(this._parent,this),!this.onUpdate||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)):(this.complete(),!1):this.updateCurrentFrame(!0))},updateCurrentFrame:function(t,e){if(void 0===e&&(e=!1),!this._frameData)return!1;var i=this.currentFrame.index;return this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.currentFrame&&(e||i!==this.currentFrame.index)&&this._parent.setFrame(this.currentFrame),!this.onUpdate||!t||(this.onUpdate.dispatch(this,this.currentFrame),!!this._frameData)},next:function(t){void 0===t&&(t=1);var e=this._frameIndex+t;e>=this._frames.length&&(this.loop?e%=this._frames.length:e=this._frames.length-1),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},previous:function(t){void 0===t&&(t=1);var e=this._frameIndex-t;e<0&&(this.loop?e=this._frames.length+e:e++),e!==this._frameIndex&&(this._frameIndex=e,this.updateCurrentFrame(!0))},updateFrameData:function(t){this._frameData=t,this.currentFrame=this._frameData?this._frameData.getFrame(this._frames[this._frameIndex%this._frames.length]):null},destroy:function(){this._frameData&&(this.game.onPause.remove(this.onPause,this),this.game.onResume.remove(this.onResume,this),this.game=null,this._parent=null,this._frames=null,this._frameData=null,this.currentFrame=null,this.isPlaying=!1,this.onStart.dispose(),this.onLoop.dispose(),this.onComplete.dispose(),this.onUpdate&&this.onUpdate.dispose())},complete:function(){this._frameIndex=this._frames.length-1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.updateCurrentFrame(!1),this.isPlaying=!1,this.isFinished=!0,this.paused=!1,this._parent.events.onAnimationComplete$dispatch(this._parent,this),this.onComplete.dispatch(this._parent,this),this.killOnComplete&&this._parent.kill()}},n.Animation.prototype.constructor=n.Animation,Object.defineProperty(n.Animation.prototype,"paused",{get:function(){return this.isPaused},set:function(t){this.isPaused=t,t?this._pauseStartTime=this.game.time.time:this.isPlaying&&(this._timeNextFrame=this.game.time.time+this.delay)}}),Object.defineProperty(n.Animation.prototype,"reversed",{get:function(){return this.isReversed},set:function(t){this.isReversed=t}}),Object.defineProperty(n.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}}),Object.defineProperty(n.Animation.prototype,"frame",{get:function(){return null!==this.currentFrame?this.currentFrame.index:this._frameIndex},set:function(t){this.currentFrame=this._frameData.getFrame(this._frames[t]),null!==this.currentFrame&&(this._frameIndex=t,this._parent.setFrame(this.currentFrame),this.onUpdate&&this.onUpdate.dispatch(this,this.currentFrame))}}),Object.defineProperty(n.Animation.prototype,"speed",{get:function(){return 1e3/this.delay},set:function(t){t>0&&(this.delay=1e3/t)}}),Object.defineProperty(n.Animation.prototype,"enableUpdate",{get:function(){return null!==this.onUpdate},set:function(t){t&&null===this.onUpdate?this.onUpdate=new n.Signal:t||null===this.onUpdate||(this.onUpdate.dispose(),this.onUpdate=null)}}),n.Animation.generateFrameNames=function(t,e,i,s,r){void 0===s&&(s="");var o=[],a="";if(e=i;h--)a=t+(a="number"==typeof r?n.Utils.pad(h.toString(),r,"0",1):h.toString())+s,o.push(a);return o}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Frame=function(t,e,i,s,r,o){this.index=t,this.x=e,this.y=i,this.width=s,this.height=r,0!==this.width&&0!==this.height||console.warn('Phaser.Frame: Frame "'+this.name+'" has a width or height of zero'),this.name=o,this.centerX=Math.floor(s/2),this.centerY=Math.floor(r/2),this.distance=n.Math.distance(0,0,s,r),this.rotated=!1,this.trimmed=!1,this.sourceSizeW=s,this.sourceSizeH=r,this.spriteSourceSizeX=0,this.spriteSourceSizeY=0,this.spriteSourceSizeW=0,this.spriteSourceSizeH=0,this.right=this.x+this.width,this.bottom=this.y+this.height},n.Frame.prototype={resize:function(t,e){this.width=t,this.height=e,this.centerX=Math.floor(t/2),this.centerY=Math.floor(e/2),this.distance=n.Math.distance(0,0,t,e),this.sourceSizeW=t,this.sourceSizeH=e,this.right=this.x+t,this.bottom=this.y+e},setTrim:function(t,e,i,n,s,r,o){this.trimmed=t,t&&(this.sourceSizeW=e,this.sourceSizeH=i,this.centerX=Math.floor(e/2),this.centerY=Math.floor(i/2),this.spriteSourceSizeX=n,this.spriteSourceSizeY=s,this.spriteSourceSizeW=r,this.spriteSourceSizeH=o)},clone:function(){var t=new n.Frame(this.index,this.x,this.y,this.width,this.height,this.name);for(var e in this)this.hasOwnProperty(e)&&(t[e]=this[e]);return t},getRect:function(t){return void 0===t?t=new n.Rectangle(this.x,this.y,this.width,this.height):t.setTo(this.x,this.y,this.width,this.height),t}},n.Frame.prototype.constructor=n.Frame, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.FrameData=function(){this._frames=[],this._frameNames=[]},n.FrameData.prototype={addFrame:function(t){return t.index=this._frames.length,this._frames.push(t),""!==t.name&&(this._frameNames[t.name]=t.index),t},getFrame:function(t){return t>=this._frames.length&&(t=0),this._frames[t]},getFrameByName:function(t){return"number"==typeof this._frameNames[t]?this._frames[this._frameNames[t]]:null},checkFrameName:function(t){return null!=this._frameNames[t]},clone:function(){for(var t=new n.FrameData,e=0;e + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.AnimationParser={spriteSheet:function(t,e,i,s,r,o,a,h){void 0===r&&(r=-1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===h&&(h=0);var l=e;if("string"==typeof e?l=t.cache.getImage(e):e=l.name,null===l)return null;if(i<=0||s<=0)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' frameWidth (%s) or frameHeight (%s) must be positive",e,i,s),null;var c=l.width,u=l.height;if(0===c||0===u)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' width (%s) or height (%s) is zero",e,c,u),null;if(cf||h<-f)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' skipFrames = %s is larger than the frame total %s",e,h,f),null;if(r>-1&&(v=(f=r)-1),d<1&&console.warn("Phaser.AnimationParser.spriteSheet: image '%s' has width %d, but it should be at least %d (frameWidth=%s, margin=%s, spacing=%s)",e,c,i+o+a,i,o,a),p<1&&console.warn("Phaser.AnimationParser.spriteSheet: image '%s' has height %d, but it should be at least %d (frameHeight=%s, margin=%s, spacing=%s)",e,u,s+o+a,s,o,a),0===g)return console.warn("Phaser.AnimationParser.spriteSheet: '%s' zero frames were produced",e),null;if(h>0?v=(y=h)+(f=Math.min(f,g-h))-1:h<0&&(y=(v=m+h)-(f=Math.min(f,g+h))+1),y<0)return console.warn("First frame index %s is outside of range [0, %d]",y,m),null;if(v>m)return console.warn("Last frame index %s is outside of range [0, %d]",v,m),null;for(var b=new n.FrameData,x=o,w=o,_=0,T=0;Tv);T++)T>=y&&b.addFrame(new n.Frame(_++,x,w,i,s,"")),(x+=i+a)+i>c&&(x=o,w+=s+a);return b},JSONData:function(t,e){if(!e.frames)return console.warn("Phaser.AnimationParser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array"),void console.log(e);for(var i,s=new n.FrameData,r=e.frames,o=0;o tag")}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Cache=function(t){this.game=t,this.autoResolveURL=!1,this._cache={canvas:{},image:{},texture:{},sound:{},video:{},text:{},json:{},xml:{},physics:{},tilemap:{},binary:{},bitmapData:{},bitmapFont:{},shader:{},renderTexture:{},compressedTexture:{},data:{}},this._urlMap={},this._urlResolver=new Image,this._urlTemp=null,this.onSoundUnlock=new n.Signal,this._cacheMap=[],this._cacheMap[n.Cache.CANVAS]=this._cache.canvas,this._cacheMap[n.Cache.IMAGE]=this._cache.image,this._cacheMap[n.Cache.TEXTURE]=this._cache.texture,this._cacheMap[n.Cache.SOUND]=this._cache.sound,this._cacheMap[n.Cache.TEXT]=this._cache.text,this._cacheMap[n.Cache.PHYSICS]=this._cache.physics,this._cacheMap[n.Cache.TILEMAP]=this._cache.tilemap,this._cacheMap[n.Cache.BINARY]=this._cache.binary,this._cacheMap[n.Cache.BITMAPDATA]=this._cache.bitmapData,this._cacheMap[n.Cache.BITMAPFONT]=this._cache.bitmapFont,this._cacheMap[n.Cache.JSON]=this._cache.json,this._cacheMap[n.Cache.XML]=this._cache.xml,this._cacheMap[n.Cache.VIDEO]=this._cache.video,this._cacheMap[n.Cache.SHADER]=this._cache.shader,this._cacheMap[n.Cache.RENDER_TEXTURE]=this._cache.renderTexture,this._cacheMap[n.Cache.DATA]=this._cache.data,this._pendingCount=0,this.onReady=new n.Signal,this._addImages()},n.Cache.CANVAS=1,n.Cache.IMAGE=2,n.Cache.TEXTURE=3,n.Cache.SOUND=4,n.Cache.TEXT=5,n.Cache.PHYSICS=6,n.Cache.TILEMAP=7,n.Cache.BINARY=8,n.Cache.BITMAPDATA=9,n.Cache.BITMAPFONT=10,n.Cache.JSON=11,n.Cache.XML=12,n.Cache.VIDEO=13,n.Cache.SHADER=14,n.Cache.RENDER_TEXTURE=15,n.Cache.DATA=16,n.Cache.DEFAULT=null,n.Cache.DEFAULT_KEY="__default",n.Cache.DEFAULT_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==",n.Cache.MISSING=null,n.Cache.MISSING_KEY="__missing",n.Cache.MISSING_SRC="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==",n.Cache.READY_TIMEOUT=1e3,n.Cache.prototype={addCompressedTextureMetaData:function(t,e,i,s){this.checkImageKey(t)&&this.removeImage(t);var r=i in n.LoaderParser?n.LoaderParser[i](s):s,o={key:t,url:e,data:r,base:new PIXI.BaseTexture(r,null,this.game.resolution),frame:new n.Frame(0,0,0,r.width,r.height,t),frameData:new n.FrameData,fileFormat:i};return o.frameData.addFrame(new n.Frame(0,0,0,r.width,r.height,e)),this._cache.image[t]=o,this._resolveURL(e,o),o},addCanvas:function(t,e,i){void 0===i&&(i=e.getContext("2d")),this._cache.canvas[t]={canvas:e,context:i}},addImage:function(t,e,i){this.checkImageKey(t)&&this.removeImage(t),!1===i.complete&&console.warn('Phaser.Cache.addImage: Image "%s" is not complete',t);var s={key:t,url:e,data:i,base:new PIXI.BaseTexture(i,null,this.game.resolution),frame:new n.Frame(0,0,0,i.width,i.height,t),frameData:new n.FrameData};return s.frameData.addFrame(new n.Frame(0,0,0,i.width,i.height,e)),this._cache.image[t]=s,this._resolveURL(e,s),"__default"===t?n.Cache.DEFAULT=new PIXI.Texture(s.base):"__missing"===t&&(n.Cache.MISSING=new PIXI.Texture(s.base)),s},addImageAsync:function(t,e,i){var n=this,s=new Image;s.onload=function(){i.call(this,n.addImage(t,null,s)),n._removePending(),s.onload=null},this._addPending(),s.src=e},addDefaultImage:function(){this.addImageAsync(n.Cache.DEFAULT_KEY,n.Cache.DEFAULT_SRC,(function(t){t.base.skipRender=!0,n.Cache.DEFAULT=new PIXI.Texture(t.base)}))},addMissingImage:function(){this.addImageAsync(n.Cache.MISSING_KEY,n.Cache.MISSING_SRC,(function(t){n.Cache.MISSING=new PIXI.Texture(t.base)}))},addSound:function(t,e,i,n,s){void 0===n&&(n=!0,s=!1),void 0===s&&(n=!1,s=!0);var r=!1;s&&(r=!0),this._cache.sound[t]={url:e,data:i,isDecoding:!1,decoded:r,webAudio:n,audioTag:s,locked:this.game.sound.touchLocked},this._resolveURL(e,this._cache.sound[t])},addText:function(t,e,i){this._cache.text[t]={url:e,data:i},this._resolveURL(e,this._cache.text[t])},addPhysicsData:function(t,e,i,n){this._cache.physics[t]={url:e,data:i,format:n},this._resolveURL(e,this._cache.physics[t])},addTilemap:function(t,e,i,n){this._cache.tilemap[t]={url:e,data:i,format:n},this._resolveURL(e,this._cache.tilemap[t])},addBinary:function(t,e){this._cache.binary[t]=e},addBitmapData:function(t,e,i){return e.key=t,void 0===i&&(i=new n.FrameData).addFrame(e.textureFrame),this._cache.bitmapData[t]={data:e,frameData:i},e},addBitmapFont:function(t,e,i,s,r,o,a){var h={url:e,data:i,font:null,base:new PIXI.BaseTexture(i,null,this.game.resolution)};void 0===o&&(o=0),void 0===a&&(a=0),h.font="json"===r?n.LoaderParser.jsonBitmapFont(s,h.base,o,a,!1,this.game.resolution):n.LoaderParser.xmlBitmapFont(s,h.base,o,a,!1,this.game.resolution),this._cache.bitmapFont[t]=h,this._resolveURL(e,h)},addBitmapFontFromAtlas:function(t,e,i,s,r,o,a){var h=this.getFrameByName(e,i);if(h){var l,c={font:null,base:this.getBaseTexture(e),frame:h};void 0===o&&(o=0),void 0===a&&(a=0),"json"===r?(l=this.getJSON(s),c.font=n.LoaderParser.jsonBitmapFont(l,c.base,o,a,h,this.game.resolution)):(l=this.getXML(s),c.font=n.LoaderParser.xmlBitmapFont(l,c.base,o,a,h,this.game.resolution)),this._cache.bitmapFont[t]=c}},addJSON:function(t,e,i){this._cache.json[t]={url:e,data:i},this._resolveURL(e,this._cache.json[t])},addXML:function(t,e,i){this._cache.xml[t]={url:e,data:i},this._resolveURL(e,this._cache.xml[t])},addVideo:function(t,e,i,n){this._cache.video[t]={url:e,data:i,isBlob:n,locked:!0},this._resolveURL(e,this._cache.video[t])},addShader:function(t,e,i){this._cache.shader[t]={url:e,data:i},this._resolveURL(e,this._cache.shader[t])},addRenderTexture:function(t,e){this._cache.renderTexture[t]={texture:e,frame:new n.Frame(0,0,0,e.width,e.height,"","")}},addSpriteSheet:function(t,e,i,s,r,o,a,h,l){void 0===o&&(o=-1),void 0===a&&(a=0),void 0===h&&(h=0);var c={key:t,url:e,data:i,frameWidth:s,frameHeight:r,margin:a,spacing:h,base:new PIXI.BaseTexture(i,null,this.game.resolution),frameData:n.AnimationParser.spriteSheet(this.game,i,s,r,o,a,h,l)};this._cache.image[t]=c,this._resolveURL(e,c)},addTextureAtlas:function(t,e,i,s,r){var o={key:t,url:e,data:i,base:new PIXI.BaseTexture(i,null,this.game.resolution)};r===n.Loader.TEXTURE_ATLAS_XML_STARLING?o.frameData=n.AnimationParser.XMLData(this.game,s,t):r===n.Loader.TEXTURE_ATLAS_JSON_PYXEL?o.frameData=n.AnimationParser.JSONDataPyxel(this.game,s,t):Array.isArray(s.frames)?o.frameData=n.AnimationParser.JSONData(this.game,s,t):o.frameData=n.AnimationParser.JSONDataHash(this.game,s,t),this._cache.image[t]=o,this._resolveURL(e,o)},addData:function(t,e){this._cache.data[t]=e},reloadSound:function(t){var e=this,i=this.getSound(t);i&&(i.data.src=i.url,i.data.addEventListener("canplaythrough",(function(){return e.reloadSoundComplete(t)}),!1),i.data.load())},reloadSoundComplete:function(t){var e=this.getSound(t);e&&(e.locked=!1,this.onSoundUnlock.dispatch(t))},updateSound:function(t,e,i){var n=this.getSound(t);n&&(n[e]=i)},decodedSound:function(t,e){var i=this.getSound(t);i.data=e,i.decoded=!0,i.isDecoding=!1},isSoundDecoded:function(t){var e=this.getItem(t,n.Cache.SOUND,"isSoundDecoded");if(e)return e.decoded},isSoundReady:function(t){var e=this.getItem(t,n.Cache.SOUND,"isSoundDecoded");if(e)return e.decoded&&!this.game.sound.touchLocked},checkKey:function(t,e){return!!this._cacheMap[t][e]},checkURL:function(t){return!!this._urlMap[this._resolveURL(t)]},checkCanvasKey:function(t){return this.checkKey(n.Cache.CANVAS,t)},checkDataKey:function(t){return this.checkKey(n.Cache.DATA,t)},checkImageKey:function(t){return this.checkKey(n.Cache.IMAGE,t)},checkTextureKey:function(t){return this.checkKey(n.Cache.TEXTURE,t)},checkSoundKey:function(t){return this.checkKey(n.Cache.SOUND,t)},checkTextKey:function(t){return this.checkKey(n.Cache.TEXT,t)},checkPhysicsKey:function(t){return this.checkKey(n.Cache.PHYSICS,t)},checkTilemapKey:function(t){return this.checkKey(n.Cache.TILEMAP,t)},checkBinaryKey:function(t){return this.checkKey(n.Cache.BINARY,t)},checkBitmapDataKey:function(t){return this.checkKey(n.Cache.BITMAPDATA,t)},checkBitmapFontKey:function(t){return this.checkKey(n.Cache.BITMAPFONT,t)},checkJSONKey:function(t){return this.checkKey(n.Cache.JSON,t)},checkXMLKey:function(t){return this.checkKey(n.Cache.XML,t)},checkVideoKey:function(t){return this.checkKey(n.Cache.VIDEO,t)},checkShaderKey:function(t){return this.checkKey(n.Cache.SHADER,t)},checkRenderTextureKey:function(t){return this.checkKey(n.Cache.RENDER_TEXTURE,t)},getItem:function(t,e,i,n){return this.checkKey(e,t)?void 0===n?this._cacheMap[e][t]:this._cacheMap[e][t][n]:(i&&console.warn("Phaser.Cache."+i+': Key "'+t+'" not found in Cache.'),null)},getCanvas:function(t){return this.getItem(t,n.Cache.CANVAS,"getCanvas","canvas")},getImage:function(t,e){null==t&&(t="__default"),void 0===e&&(e=!1);var i=this.getItem(t,n.Cache.IMAGE,"getImage");return null===i&&(i=this.getItem("__missing",n.Cache.IMAGE,"getImage")),e?i:i.data},getTextureFrame:function(t){return this.getItem(t,n.Cache.TEXTURE,"getTextureFrame","frame")},getSound:function(t){return this.getItem(t,n.Cache.SOUND,"getSound")},getSoundData:function(t){return this.getItem(t,n.Cache.SOUND,"getSoundData","data")},getText:function(t){return this.getItem(t,n.Cache.TEXT,"getText","data")},getPhysicsData:function(t,e,i){var s=this.getItem(t,n.Cache.PHYSICS,"getPhysicsData","data");if(null===s||null==e)return s;if(s[e]){var r=s[e];if(!r||!i)return r;for(var o in r)if((o=r[o]).fixtureKey===i)return o;console.warn('Phaser.Cache.getPhysicsData: Could not find given fixtureKey: "'+i+" in "+t+'"')}else console.warn('Phaser.Cache.getPhysicsData: Invalid key/object: "'+t+" / "+e+'"');return null},getTilemapData:function(t){return this.getItem(t,n.Cache.TILEMAP,"getTilemapData")},getBinary:function(t){return this.getItem(t,n.Cache.BINARY,"getBinary")},getBitmapData:function(t){return this.getItem(t,n.Cache.BITMAPDATA,"getBitmapData","data")},getBitmapFont:function(t){return this.getItem(t,n.Cache.BITMAPFONT,"getBitmapFont")},getJSON:function(t,e){var i=this.getItem(t,n.Cache.JSON,"getJSON","data");return i?e?n.Utils.extend(!0,Array.isArray(i)?[]:{},i):i:null},getXML:function(t){return this.getItem(t,n.Cache.XML,"getXML","data")},getVideo:function(t){return this.getItem(t,n.Cache.VIDEO,"getVideo")},getShader:function(t){return this.getItem(t,n.Cache.SHADER,"getShader","data")},getRenderTexture:function(t){return this.getItem(t,n.Cache.RENDER_TEXTURE,"getRenderTexture")},getData:function(t){return this.getItem(t,n.Cache.DATA,"getData")},getBaseTexture:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),this.getItem(t,e,"getBaseTexture","base")},getFrame:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),this.getItem(t,e,"getFrame","frame")},getFrameCount:function(t,e){var i=this.getFrameData(t,e);return i?i.total:0},getFrameData:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),this.getItem(t,e,"getFrameData","frameData")},hasFrameData:function(t,e){return void 0===e&&(e=n.Cache.IMAGE),null!==this.getItem(t,e,"","frameData")},updateFrameData:function(t,e,i){void 0===i&&(i=n.Cache.IMAGE),this._cacheMap[i][t]&&(this._cacheMap[i][t].frameData=e)},getFrameByIndex:function(t,e,i){var n=this.getFrameData(t,i);return n?n.getFrame(e):null},getFrameByName:function(t,e,i){var n=this.getFrameData(t,i);return n?n.getFrameByName(e):null},getURL:function(t){return(t=this._resolveURL(t))?this._urlMap[t]:(console.warn('Phaser.Cache.getUrl: Invalid url: "'+t+'" or Cache.autoResolveURL was false'),null)},getKeys:function(t){void 0===t&&(t=n.Cache.IMAGE);var e=[];if(this._cacheMap[t])for(var i in this._cacheMap[t])"__default"!==i&&"__missing"!==i&&e.push(i);return e},removeCanvas:function(t){delete this._cache.canvas[t]},removeImage:function(t,e){void 0===e&&(e=!0);var i=this.getImage(t,!0);e&&i.base&&i.base.destroy(),delete this._cache.image[t]},removeSound:function(t){delete this._cache.sound[t]},removeText:function(t){delete this._cache.text[t]},removePhysics:function(t){delete this._cache.physics[t]},removeTilemap:function(t){delete this._cache.tilemap[t]},removeBinary:function(t){delete this._cache.binary[t]},removeBitmapData:function(t){delete this._cache.bitmapData[t]},removeBitmapFont:function(t){delete this._cache.bitmapFont[t]},removeJSON:function(t){delete this._cache.json[t]},removeXML:function(t){delete this._cache.xml[t]},removeVideo:function(t){delete this._cache.video[t]},removeShader:function(t){delete this._cache.shader[t]},removeRenderTexture:function(t){delete this._cache.renderTexture[t]},removeSpriteSheet:function(t){delete this._cache.spriteSheet[t]},removeTextureAtlas:function(t){delete this._cache.image[t]},removeData:function(t){delete this._cache.data[t]},clearGLTextures:function(){for(var t in this._cache.image)this._cache.image[t].base._glTextures=[]},_resolveURL:function(t,e){return this.autoResolveURL?(this._urlResolver.src=this.game.load.baseURL+t,this._urlTemp=this._urlResolver.src,this._urlResolver.src="",e&&(this._urlMap[this._urlTemp]=e),this._urlTemp):null},destroy:function(){for(var t=0;t0?setTimeout((function(){t.isReady||(console.warn("Phaser.Cache: Still waiting for images after %s ms.",e),t._ready())}),n.Cache.READY_TIMEOUT):this._ready()},_addPending:function(){this._pendingCount+=1},_removePending:function(){this._pendingCount-=1,this._checkReady()},_checkReady:function(){this.isReady&&this._ready()},_ready:function(){this._pendingCount=0,this.onReady.dispatch(this)}},n.Cache.prototype.constructor=n.Cache,Object.defineProperty(n.Cache.prototype,"isReady",{get:function(){return this._pendingCount<=0}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Loader=function(t){this.game=t,this.cache=t.cache,this.resetLocked=!1,this.isLoading=!1,this.hasLoaded=!1,this.preloadSprite=null,this.crossOrigin=!1,this.baseURL="",this.path="",this.headers={requestedWith:!1,json:"application/json",xml:"application/xml"},this.onLoadStart=new n.Signal,this.onBeforeLoadComplete=new n.Signal,this.onLoadComplete=new n.Signal,this.onPackComplete=new n.Signal,this.onFileStart=new n.Signal,this.onFileComplete=new n.Signal,this.onFileError=new n.Signal,this.enableParallel=!0,this.maxParallelDownloads=4,this._withSyncPointDepth=0,this._fileList=[],this._flightQueue=[],this._processingHead=0,this._fileLoadStarted=!1,this._totalPackCount=0,this._totalFileCount=0,this._loadedPackCount=0,this._loadedFileCount=0},n.Loader.TEXTURE_ATLAS_JSON_ARRAY=0,n.Loader.TEXTURE_ATLAS_JSON_HASH=1,n.Loader.TEXTURE_ATLAS_XML_STARLING=2,n.Loader.PHYSICS_LIME_CORONA_JSON=3,n.Loader.PHYSICS_PHASER_JSON=4,n.Loader.TEXTURE_ATLAS_JSON_PYXEL=5,n.Loader.prototype={setPreloadSprite:function(t,e){e=e||0,this.preloadSprite={sprite:t,direction:e,width:t.width,height:t.height,rect:null},this.preloadSprite.rect=0===e?new n.Rectangle(0,0,1,t.height):new n.Rectangle(0,0,t.width,1),t.crop(this.preloadSprite.rect),t.visible=!0},resize:function(){this.preloadSprite&&this.preloadSprite.height!==this.preloadSprite.sprite.height&&(this.preloadSprite.rect.height=this.preloadSprite.sprite.height)},checkKeyExists:function(t,e){return this.getAssetIndex(t,e)>-1},getAssetIndex:function(t,e){for(var i=-1,n=0;n-1&&{index:i,file:this._fileList[i]}},reset:function(t,e){void 0===e&&(e=!1),this.resetLocked||(t&&(this.preloadSprite=null),this.isLoading=!1,this._processingHead=0,this._fileList.length=0,this._flightQueue.length=0,this._fileLoadStarted=!1,this._totalFileCount=0,this._totalPackCount=0,this._loadedPackCount=0,this._loadedFileCount=0,e&&(this.onLoadStart.removeAll(),this.onLoadComplete.removeAll(),this.onPackComplete.removeAll(),this.onFileStart.removeAll(),this.onFileComplete.removeAll(),this.onFileError.removeAll()))},addToFileList:function(t,e,i,n,s,r){if(void 0===s&&(s=!1),void 0===e||""===e)return console.warn("Phaser.Loader: Invalid or no key given of type "+t),this;if(null==i){if(!r)return console.warn("Phaser.Loader: No URL given for file type: "+t+" key: "+e),this;i=e+r}var o={type:t,key:e,path:this.path,url:i,syncPoint:this._withSyncPointDepth>0,data:null,loading:!1,loaded:!1,error:!1};if(n)for(var a in n)o[a]=n[a];var h=this.getAssetIndex(t,e);if(s&&h>-1){var l=this._fileList[h];l.loading||l.loaded?(this._fileList.push(o),this._totalFileCount++):this._fileList[h]=o}else-1===h&&(this._fileList.push(o),this._totalFileCount++);return this},replaceInFileList:function(t,e,i,n){return this.addToFileList(t,e,i,n,!0)},pack:function(t,e,i,n){if(void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),!e&&!i)return console.warn("Phaser.Loader.pack - Both url and data are null. One must be set."),this;var s={type:"packfile",key:t,url:e,path:this.path,syncPoint:!0,data:null,loading:!1,loaded:!1,error:!1,callbackContext:n};i&&("string"==typeof i&&(i=JSON.parse(i)),s.data=i||{},s.loaded=!0);for(var r=0;r=i||e&&this._loadedPackCount===this._totalPackCount)break}if(this.updateProgress(),this._processingHead>=this._fileList.length)this.finishedLoading();else if(!this._flightQueue.length){console.warn("Phaser.Loader - aborting: processing queue empty, loading may have stalled");var s=this;setTimeout((function(){s.finishedLoading(!0)}),2e3)}},finishedLoading:function(t){!this.hasLoaded&&this.game.state&&(this.hasLoaded=!0,this.isLoading=!1,t||this._fileLoadStarted||(this._fileLoadStarted=!0,this.onLoadStart.dispatch()),this.game.state.loadUpdate(),this.onBeforeLoadComplete.dispatch(),this.reset(),this.onLoadComplete.dispatch(),this.game.state.loadComplete())},asyncComplete:function(t,e){void 0===e&&(e=""),t.loaded=!0,t.error=!!e,e&&(t.errorMessage=e,console.warn("Phaser.Loader - "+t.type+"["+t.key+"]: "+e)),this.processLoadQueue()},processPack:function(t){var e=t.data[t.key];if(e)for(var i=0;i=400&&r.status<=599?s.call(o,t,r):n.call(o,t,r)}catch(e){o.hasLoaded?window.console&&console.error(e):o.asyncComplete(t,e.message||"Exception")}},r.onerror=function(){try{return s.call(o,t,r)}catch(e){o.hasLoaded?window.console&&console.error(e):o.asyncComplete(t,e.message||"Exception")}},t.requestObject=r,t.requestUrl=e,r.send()},getVideoURL:function(t){for(var e=0;e=0&&(n=n.substr(0,n.indexOf("?"))),i=n.substr((Math.max(0,n.lastIndexOf("."))||1/0)+1).toLowerCase(),this.game.device.canPlayVideo(i))return t[e]}}return null},getAudioURL:function(t){if(this.game.sound.noAudio)return null;for(var e=0;e=0&&(n=n.substr(0,n.indexOf("?"))),i=n.substr((Math.max(0,n.lastIndexOf("."))||1/0)+1).toLowerCase(),this.game.device.canPlayAudio(i))return t[e]}}return null},fileError:function(t,e,i){var n="error loading asset from URL "+(t.requestUrl||this.transformUrl(t.url,t));!i&&e&&(i=e.status),i&&(n=n+" ("+i+")"),this.asyncComplete(t,n)},fileComplete:function(t,e){var i=!0;switch(t.type){case"packfile":var s=JSON.parse(e.responseText);t.data=s||{};break;case"texture":var r=/\.([^.]+)$/.exec(t.url.split("?",1)[0])[1].toLowerCase();null!==t.data?this.cache.addCompressedTextureMetaData(t.key,t.url,r,t.data):this.cache.addCompressedTextureMetaData(t.key,t.url,r,e.response);break;case"image":this.cache.addImage(t.key,t.url,t.data);break;case"spritesheet":this.cache.addSpriteSheet(t.key,t.url,t.data,t.frameWidth,t.frameHeight,t.frameMax,t.margin,t.spacing,t.skipFrames);break;case"textureatlas":if(null==t.atlasURL)this.cache.addTextureAtlas(t.key,t.url,t.data,t.atlasData,t.format);else if(i=!1,t.format===n.Loader.TEXTURE_ATLAS_JSON_ARRAY||t.format===n.Loader.TEXTURE_ATLAS_JSON_HASH||t.format===n.Loader.TEXTURE_ATLAS_JSON_PYXEL)this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",this.jsonLoadComplete);else{if(t.format!==n.Loader.TEXTURE_ATLAS_XML_STARLING)throw new Error("Phaser.Loader. Invalid Texture Atlas format: "+t.format);this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",this.xmlLoadComplete)}break;case"bitmapfont":t.atlasURL?(i=!1,this.xhrLoad(t,this.transformUrl(t.atlasURL,t),"text",(function(t,e){var i;try{i=JSON.parse(e.responseText)}catch(t){}i?(t.atlasType="json",this.jsonLoadComplete(t,e)):(t.atlasType="xml",this.xmlLoadComplete(t,e))}))):this.cache.addBitmapFont(t.key,t.url,t.data,t.atlasData,t.atlasType,t.xSpacing,t.ySpacing);break;case"video":if(t.asBlob)try{t.data=e.response}catch(e){throw new Error("Phaser.Loader. Unable to parse video file as Blob: "+t.key)}this.cache.addVideo(t.key,t.url,t.data,t.asBlob);break;case"audio":this.game.sound.usingWebAudio?(t.data=e.response,this.cache.addSound(t.key,t.url,t.data,!0,!1),t.autoDecode&&this.game.sound.decode(t.key)):this.cache.addSound(t.key,t.url,t.data,!1,!0);break;case"text":t.data=e.responseText,this.cache.addText(t.key,t.url,t.data);break;case"shader":t.data=e.responseText,this.cache.addShader(t.key,t.url,t.data);break;case"physics":s=JSON.parse(e.responseText);this.cache.addPhysicsData(t.key,t.url,s,t.format);break;case"script":t.data=document.createElement("script"),t.data.language="javascript",t.data.type="text/javascript",t.data.defer=!1,t.data.text=e.responseText,document.head.appendChild(t.data),t.callback&&(t.data=t.callback.call(t.callbackContext,t.key,e.responseText));break;case"binary":t.callback?t.data=t.callback.call(t.callbackContext,t.key,e.response):t.data=e.response,this.cache.addBinary(t.key,t.data)}i&&this.asyncComplete(t)},jsonLoadComplete:function(t,e){var i=JSON.parse(e.responseText);"tilemap"===t.type?this.cache.addTilemap(t.key,t.url,i,t.format):"bitmapfont"===t.type?this.cache.addBitmapFont(t.key,t.url,t.data,i,t.atlasType,t.xSpacing,t.ySpacing):"json"===t.type?this.cache.addJSON(t.key,t.url,i):this.cache.addTextureAtlas(t.key,t.url,t.data,i,t.format),this.asyncComplete(t)},csvLoadComplete:function(t,e){var i=e.responseText;this.cache.addTilemap(t.key,t.url,i,t.format),this.asyncComplete(t)},xmlLoadComplete:function(t,e){var i=e.responseText,n=this.parseXml(i);if(!n){var s=e.responseType||e.contentType;return console.warn("Phaser.Loader - "+t.key+": invalid XML ("+s+")"),void this.asyncComplete(t,"invalid XML")}"bitmapfont"===t.type?this.cache.addBitmapFont(t.key,t.url,t.data,n,t.atlasType,t.xSpacing,t.ySpacing):"textureatlas"===t.type?this.cache.addTextureAtlas(t.key,t.url,t.data,n,t.format):"xml"===t.type&&this.cache.addXML(t.key,t.url,n),this.asyncComplete(t)},parseXml:function(t){var e;try{if(window.DOMParser)e=(new DOMParser).parseFromString(t,"text/xml");else(e=new ActiveXObject("Microsoft.XMLDOM")).async="false",e.loadXML(t)}catch(t){e=null}return e&&e.documentElement&&!e.getElementsByTagName("parsererror").length?e:null},updateProgress:function(){this.preloadSprite&&(0===this.preloadSprite.direction?this.preloadSprite.rect.width=Math.floor(this.preloadSprite.width/100*this.progress):this.preloadSprite.rect.height=Math.floor(this.preloadSprite.height/100*this.progress),this.preloadSprite.sprite?this.preloadSprite.sprite.updateCrop():this.preloadSprite=null)},totalLoadedFiles:function(){return this._loadedFileCount},totalQueuedFiles:function(){return this._totalFileCount-this._loadedFileCount},totalLoadedPacks:function(){return this._totalPackCount},totalQueuedPacks:function(){return this._totalPackCount-this._loadedPackCount}},Object.defineProperty(n.Loader.prototype,"progressFloat",{get:function(){var t=this._loadedFileCount/this._totalFileCount*100;return n.Math.clamp(t||0,0,100)}}),Object.defineProperty(n.Loader.prototype,"progress",{get:function(){return Math.round(this.progressFloat)}}),n.Loader.prototype.constructor=n.Loader, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.LoaderParser={bitmapFont:function(t,e,i,n,s,r){return this.xmlBitmapFont(t,e,i,n,s,r)},xmlBitmapFont:function(t,e,i,n,s,r){null==r&&(r=1);var o={},a=t.getElementsByTagName("info")[0],h=t.getElementsByTagName("common")[0];o.font=a.getAttribute("face"),o.size=parseInt(a.getAttribute("size"),10),o.lineHeight=parseInt(h.getAttribute("lineHeight"),10)+n,o.chars={};for(var l=t.getElementsByTagName("char"),c=s?s.x:0,u=s?s.y:0,d=0;ds.spriteSourceSizeX+s.spriteSourceSizeW&&(f.width-=f.x+f.width-s.spriteSourceSizeX-s.spriteSourceSizeW),f.y+f.height>s.spriteSourceSizeY+s.spriteSourceSizeH&&(f.height-=f.y+f.height-s.spriteSourceSizeY-s.spriteSourceSizeH),f.xs.spriteSourceSizeX+s.spriteSourceSizeW&&(n.width-=n.x+n.width-s.spriteSourceSizeX-s.spriteSourceSizeW),n.y+n.height>s.spriteSourceSizeY+s.spriteSourceSizeH&&(n.height-=n.y+n.height-s.spriteSourceSizeY-s.spriteSourceSizeH),n.x=0){switch(r>=0&&r<=3?e="PVRTC":r>=7&&r<=11?e="S3TC":6===r&&(e="ETC1"),r){case 0:o=35841;break;case 1:o=35843;break;case 2:o=35840;break;case 3:o=35842;break;case 6:o=36196;break;case 7:o=33777;break;case 9:o=33778;break;case 11:o=33779;break;default:o=-1}s={complete:!0,fileFormat:"PVR",compressionAlgorithm:e,flags:i[1],pixelFormat:r,colorSpace:i[4],channelType:i[5],height:i[6],width:i[7],depth:i[8],numberOfSurfaces:i[9],numberOfFaces:i[10],numberOfMipmaps:i[11],metaDataSize:i[12],textureData:n.subarray(52+i[12],n.byteLength),glExtensionFormat:o}}return s},dds:function(t){var e=new Uint8Array(t),i=new Uint32Array(t),n=null;return 68===e[0]&&68===e[1]&&83===e[2]&&32===e[3]&&("DX10"===(n={complete:!0,fileFormat:"DDS",compressionAlgorithm:"S3TC",size:i[1],flags:i[2],height:i[3],width:i[4],pitch:i[5],depth:i[6],mipmapCount:i[7],formatSize:i[19],formatFlag:i[19],formatFourCC:[String.fromCharCode(e[84]),String.fromCharCode(e[85]),String.fromCharCode(e[86]),String.fromCharCode(e[87])].join(""),formatBitCount:i[21],formatRBitMask:i[22],formatGBitMask:i[23],formatBBitMask:i[24],formatABitMask:i[25],caps1:i[26],caps2:i[27],caps3:i[28],caps4:i[29],reserved2:i[30],DXGIFormat:null,resourceDimension:null,miscFlag:null,arraySize:null,textureData:e.subarray(i[1]+4,e.byteLength)}).formatFourCC?(n.DXGIFormat=i[31],n.resourceDimension=i[32],n.miscFlag=i[33],n.arraySize=i[34],n.miscFlag=i[35]):"DXT5"===n.formatFourCC?n.glExtensionFormat=33779:"DXT3"===n.formatFourCC&&(n.glExtensionFormat=33778)),n},ktx:function(t){var e=new Uint8Array(t),i=new Uint32Array(t),n=null,s=16+i[15]/4|0,r=i[s],o=i[7],a=0;if(171===e[0]&&75===e[1]&&84===e[2]&&88===e[3]&&32===e[4]&&49===e[5]&&49===e[6]&&187===e[7]&&13===e[8]&&10===e[9]&&26===e[10]&&10===e[11]&&[36196,35840,35841,35842,35843,33776,33777,33778,33779].indexOf(o)>=0){switch(o){case 36196:a="ETC1";break;case 35840:case 35841:case 35842:case 35843:a="PVRTC";break;case 33776:case 33777:case 33778:case 33779:a="S3TC"}n={complete:!0,fileFormat:"KTX",compressionAlgorithm:a,endianness:i[3],glType:i[4],glTypeSize:i[5],glFormat:i[6],glInternalFormat:i[7],glBaseInternalFormat:i[8],width:i[9],height:i[10],pixelDepth:i[11],numberOfArrayElements:i[12],numberOfFaces:i[13],numberOfMipmapLevels:i[14],bytesOfKeyValueData:i[15],keyAndValueByteSize:i[16],imageSize:r,textureData:e.subarray(4*(s+1),r+100)}}return n},pkm:function(t){var e=new Uint8Array(t),i=null;return 80===e[0]&&75===e[1]&&77===e[2]&&32===e[3]&&(i={complete:!0,fileFormat:"PKM",compressionAlgorithm:"ETC1",format:65535&(e[6]<<8|e[7]),width:65535&(e[8]<<8|e[9]),height:65535&(e[10]<<8|e[11]),originalWidth:65535&(e[12]<<8|e[13]),originalHeight:65535&(e[14]<<8|e[15]),textureData:e.subarray(16,e.length)}),i}}, +/** + * @author Jeremy Dowell + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.AudioSprite=function(t,e){for(var i in this.game=t,this.key=e,this.config=this.game.cache.getJSON(e+"-audioatlas"),this.autoplayKey=null,this.autoplay=!1,this.sounds={},this.config.spritemap){var n=this.config.spritemap[i],s=this.game.add.sound(this.key);s.addMarker(i,n.start,n.end-n.start,null,n.loop),this.sounds[i]=s}this.config.autoplay&&(this.autoplayKey=this.config.autoplay,this.play(this.autoplayKey),this.autoplay=this.sounds[this.autoplayKey])},n.AudioSprite.prototype={play:function(t,e){return void 0===e&&(e=1),this.sounds[t].play(t,null,e)},stop:function(t){if(t)this.sounds[t].stop();else for(var e in this.sounds)this.sounds[e].stop()},get:function(t){return this.sounds[t]}},n.AudioSprite.prototype.constructor=n.AudioSprite, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Sound=function(t,e,i,s,r){void 0===i&&(i=1),void 0===s&&(s=!1),void 0===r&&(r=t.sound.connectToMaster),this.game=t,this.name=e,this.key=e,this.loop=s,this.markers={},this.context=null,this.autoplay=!1,this.totalDuration=0,this.startTime=0,this.currentTime=0,this.duration=0,this.durationMS=0,this.position=0,this.stopTime=0,this.paused=!1,this.pausedPosition=0,this.pausedTime=0,this.isPlaying=!1,this.currentMarker="",this.fadeTween=null,this.pendingPlayback=!1,this.override=!1,this.allowMultiple=!1,this.playOnce=!1,this.usingWebAudio=this.game.sound.usingWebAudio,this.usingAudioTag=this.game.sound.usingAudioTag,this.externalNode=null,this.masterGainNode=null,this.gainNode=null,this._sound=null,this._globalVolume=1,this._markedToDelete=!1,this._pendingStart=!1,this._removeFromSoundManager=!1,this._sourceId=0,this.usingWebAudio?(this.context=this.game.sound.context,this.masterGainNode=this.game.sound.masterGain,void 0===this.context.createGain?this.gainNode=this.context.createGainNode():this.gainNode=this.context.createGain(),this.gainNode.gain.value=i,r&&this.gainNode.connect(this.masterGainNode)):this.usingAudioTag&&(this.game.cache.getSound(e)&&this.game.cache.isSoundReady(e)?(this._sound=this.game.cache.getSoundData(e),this.totalDuration=0,this._sound.duration&&(this.totalDuration=this._sound.duration)):this.game.cache.onSoundUnlock.add(this.soundHasUnlocked,this)),this.onDecoded=new n.Signal,this.onPlay=new n.Signal,this.onPause=new n.Signal,this.onResume=new n.Signal,this.onLoop=new n.Signal,this.onStop=new n.Signal,this.onMute=new n.Signal,this.onMarkerComplete=new n.Signal,this.onFadeComplete=new n.Signal,this._volume=i,this._buffer=null,this._muted=!1,this._tempMarker=0,this._tempPosition=0,this._tempVolume=0,this._tempPause=0,this._muteVolume=0,this._tempLoop=0,this._paused=!1,this._onDecodedEventDispatched=!1},n.Sound.prototype={soundHasUnlocked:function(t){t===this.key&&(this._sound=this.game.cache.getSoundData(this.key),this.totalDuration=this._sound.duration)},addMarker:function(t,e,i,n,s){null==i&&(i=1),null==n&&(n=1),void 0===s&&(s=!1),this.markers[t]={name:t,start:e,stop:e+i,volume:n,duration:i,durationMS:1e3*i,loop:s}},removeMarker:function(t){delete this.markers[t]},onEndedHandler:function(){this._removeOnEndedHandler(),this.isPlaying=!1,this.currentTime=this.durationMS,this.stop(),this.playOnce&&(this._markedToDelete=!0,this._removeFromSoundManager=!0),this._markedToDelete&&(this._disconnectSource(),this._removeFromSoundManager?this.game.sound.remove(this):(this.markers={},this.context=null,this._buffer=null,this.externalNode=null,this.onDecoded.dispose(),this.onPlay.dispose(),this.onPause.dispose(),this.onResume.dispose(),this.onLoop.dispose(),this.onStop.dispose(),this.onMute.dispose(),this.onMarkerComplete.dispose()))},update:function(){if(this.game.cache.checkSoundKey(this.key)){this.isDecoded&&!this._onDecodedEventDispatched&&(this.onDecoded.dispatch(this),this._onDecodedEventDispatched=!0),this.pendingPlayback&&this.game.cache.isSoundReady(this.key)&&(this.pendingPlayback=!1,this.play(this._tempMarker,this._tempPosition,this._tempVolume,this._tempLoop));var t=this.game.time.time;if(this.isPlaying){if(this._pendingStart){var e=this._sound.currentTime;if(!(e>((this.paused?this._tempPause:0)||this.position||0)))return;this._pendingStart=!1,this.startTime=t-1e3*e,this.stopTime=this.startTime+this.durationMS}this.currentTime=t-this.startTime,this.currentTime>=this.durationMS&&(this.usingWebAudio?this.loop?(this.onLoop.dispatch(this),this.isPlaying=!1,""===this.currentMarker?(this.currentTime=0,this.startTime=t,this.isPlaying=!0):(this.onMarkerComplete.dispatch(this.currentMarker,this),this.play(this.currentMarker,0,this.volume,!0,!0,!1))):""!==this.currentMarker&&this.stop():this.loop?(this.onLoop.dispatch(this),""===this.currentMarker&&(this.currentTime=0,this.startTime=t),this.isPlaying=!1,this.play(this.currentMarker,0,this.volume,!0,!0,!1)):this.stop())}}else this.destroy()},loopFull:function(t){return this.play(null,0,t,!0)},play:function(t,e,i,n,s,r){if(void 0!==t&&!1!==t&&null!==t||(t=""),void 0===s&&(s=!0),void 0===r&&(r=!0),this.isPlaying&&!this.allowMultiple&&!s&&!this.override)return this;if(this._sound&&this.isPlaying&&!this.allowMultiple&&(this.override||s)&&(this.usingWebAudio?this._stopSourceAndDisconnect():this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0),this.isPlaying=!1),""===t&&Object.keys(this.markers).length>0)return this;if(""!==t){if(!this.markers[t])return console.warn("Phaser.Sound.play: audio marker "+t+" doesn't exist"),this;this.currentMarker=t,this.position=this.markers[t].start,this.volume=this.markers[t].volume,this.loop=this.markers[t].loop,this.duration=this.markers[t].duration,this.durationMS=this.markers[t].durationMS,void 0!==i&&(this.volume=i),void 0!==n&&(this.loop=n),this._tempMarker=t,this._tempPosition=this.position,this._tempVolume=this.volume,this._tempLoop=this.loop}else e=e||0,void 0===i&&(i=this._volume),void 0===n&&(n=this.loop),this.position=Math.max(0,e),this.volume=i,this.loop=n,this.duration=0,this.durationMS=0,this._tempMarker=t,this._tempPosition=e,this._tempVolume=i,this._tempLoop=n;return this.usingWebAudio?this.game.cache.isSoundDecoded(this.key)?(this._createSourceAndConnect(),this.loop&&""===t&&(this._sound.loop=!0),this.loop||""!==t||this._addOnEndedHandler(),this.totalDuration=this._sound.buffer.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=Math.ceil(1e3*this.totalDuration)),this.loop&&""===t?this._startSource(0,0):this._startSource(0,this.position,this.duration),this.isPlaying=!0,this.paused=!1,this.startTime=this.game.time.time,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,r&&this.onPlay.dispatch(this)):(this.pendingPlayback=!0,this.game.cache.getSound(this.key)&&!1===this.game.cache.getSound(this.key).isDecoding&&this.game.sound.decode(this.key,this)):this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked?(this.game.cache.reloadSound(this.key),this.pendingPlayback=!0):this._sound&&(this.game.device.cocoonJS||4===this._sound.readyState)?(this._sound.play(),this._sound.loop=this.loop,this.totalDuration=this._sound.duration,0===this.duration&&(this.duration=this.totalDuration,this.durationMS=1e3*this.totalDuration),this._globalVolume=this.game.sound.volume,this._sound.currentTime=this.position,this._sound.muted=this._muted,this._muted||this.game.sound.mute?this._sound.volume=0:this._sound.volume=this._volume*this._globalVolume,this._pendingStart=!this.currentMarker,this.isPlaying=!0,this.paused=!1,this._tempPause=0,this.startTime=this.game.time.time,this.currentTime=0,this.stopTime=this.startTime+this.durationMS,r&&this.onPlay.dispatch(this)):this.pendingPlayback=!0,this.playOnce&&(this.loop&&console.warn("Phaser.Sound.play: audio clip "+this.name+" cannot be deleted while looping."),this._markedToDelete=!0,this._removeFromSoundManager=!0),this},restart:function(t,e,i,n){t=t||"",e=e||0,i=i||1,void 0===n&&(n=!1),this.play(t,e,i,n,!0)},pause:function(){this.isPlaying&&(this.paused=!0,this.pausedPosition=this.currentTime,this.pausedTime=this.game.time.time,this._tempPause=this._sound.currentTime,this.onPause.dispatch(this),this.stop())},resume:function(){if(this.paused){if(this.usingWebAudio){var t=Math.max(0,this.position+this.pausedPosition/1e3);this._createSourceAndConnect(),""===this.currentMarker&&(this.loop?this._sound.loop=!0:this._addOnEndedHandler());var e=this.duration-this.pausedPosition/1e3;this.loop&&""===this.currentMarker?this._startSource(0,t):this._startSource(0,t,e)}else this._pendingStart=!this.currentMarker,this._sound.currentTime=this._tempPause,this._tempPause=0,this._sound.play();this.isPlaying=!0,this.paused=!1,this.startTime+=this.game.time.time-this.pausedTime,this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound&&(this.usingWebAudio?this._stopSourceAndDisconnect():this.usingAudioTag&&(this._sound.pause(),this._sound.currentTime=0)),this.pendingPlayback=!1,this.isPlaying=!1,!this.paused){var t=this.currentMarker;""!==this.currentMarker&&this.onMarkerComplete.dispatch(this.currentMarker,this),this.currentMarker="",null!==this.fadeTween&&this.fadeTween.stop(),this.onStop.dispatch(this,t)}},fadeIn:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=this.currentMarker),this.paused||(this.play(i,0,0,e),this.fadeTo(t,1))},fadeOut:function(t){this.fadeTo(t,0)},fadeTo:function(t,e){this.isPlaying&&!this.paused&&e!==this.volume&&(void 0===t&&(t=1e3),void 0!==e?(this.fadeTween=this.game.add.tween(this).to({volume:e},t,n.Easing.Linear.None,!0),this.fadeTween.onComplete.add(this.fadeComplete,this)):console.warn("Phaser.Sound.fadeTo: No Volume Specified."))},fadeComplete:function(){this.onFadeComplete.dispatch(this,this.volume),0===this.volume&&this.stop()},updateGlobalVolume:function(t){this.usingAudioTag&&this._sound&&(this._globalVolume=t,this._sound.volume=this._globalVolume*this._volume)},destroy:function(t){void 0===t&&(t=!0),this._markedToDelete=!0,this._removeFromSoundManager=t,this.stop(),t?this.game.sound.remove(this):(this.markers={},this.context=null,this._buffer=null,this.externalNode=null,this.onDecoded.dispose(),this.onPlay.dispose(),this.onPause.dispose(),this.onResume.dispose(),this.onLoop.dispose(),this.onStop.dispose(),this.onMute.dispose(),this.onMarkerComplete.dispose())},_createSourceAndConnect:function(){this._sound=this.context.createBufferSource(),this._sound.connect(this.externalNode||this.gainNode),this._buffer=this.game.cache.getSoundData(this.key),this._sound.buffer=this._buffer,this._sourceId++},_disconnectSource:function(){this._sound.disconnect(this.externalNode||this.gainNode)},_startSource:function(t,e,i){void 0===i?this._sound.start(t||0,e||0):this._sound.start(t||0,e||0,i)},_stopSourceAndDisconnect:function(){this._removeOnEndedHandler();try{this._sound.stop(0)}catch(t){}this._disconnectSource(),this._sound=null},_addOnEndedHandler:function(){this._sound.onended=this.onEndedHandler.bind(this)},_removeOnEndedHandler:function(){this._sound.onended=null}},n.Sound.prototype.constructor=n.Sound,Object.defineProperty(n.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}}),Object.defineProperty(n.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}}),Object.defineProperty(n.Sound.prototype,"mute",{get:function(){return this._muted||this.game.sound.mute},set:function(t){(t=t||!1)!==this._muted&&(t?(this._muted=!0,this._muteVolume=this._tempVolume,this.usingWebAudio?this.gainNode.gain.value=0:this.usingAudioTag&&this._sound&&(this._sound.volume=0)):(this._muted=!1,this.usingWebAudio?this.gainNode.gain.value=this._muteVolume:this.usingAudioTag&&this._sound&&(this._sound.volume=this._muteVolume)),this.onMute.dispatch(this))}}),Object.defineProperty(n.Sound.prototype,"volume",{get:function(){return this._volume},set:function(t){this.usingAudioTag&&(t=this.game.math.clamp(t,0,1)),this._muted?this._muteVolume=t:(this._tempVolume=t,this._volume=t,this.usingWebAudio?this.gainNode.gain.value=t:this.usingAudioTag&&this._sound&&(this._sound.volume=this._globalVolume*t))}}),Object.defineProperty(n.Sound.prototype,"sourceId",{get:function(){return this._sound?this._sourceId:null}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.SoundManager=function(t){this.game=t,this.onSoundDecode=new n.Signal,this.onVolumeChange=new n.Signal,this.onMute=new n.Signal,this.onUnMute=new n.Signal,this.onTouchUnlock=new n.Signal,this.onStateChange=new n.Signal,this.context=null,this.baseLatency=null,this.usingWebAudio=!1,this.usingAudioTag=!1,this.noAudio=!1,this.connectToMaster=!0,this.touchLocked=!1,this.channels=32,this.muteOnPause=!0,this._codeMuted=!1,this._muted=!1,this._unlockSource=null,this._volume=1,this._sounds=[],this._watchList=new n.ArraySet,this._watching=!1,this._watchCallback=null,this._watchContext=null,this._onClick=this._onClick.bind(this),this._onStateChange=this._onStateChange.bind(this)},n.SoundManager.prototype={boot:function(){var t=this.game.device,e=window.PhaserGlobal;if(t.iOS&&!1===t.webAudio&&(this.channels=1),e){if(!0===e.disableAudio)return this.noAudio=!0,void(this.touchLocked=!1);if(!0===e.disableWebAudio)return this.usingAudioTag=!0,void(this.touchLocked=!1)}if(e&&e.audioContext)this.context=e.audioContext;else{var i=window.AudioContext||window.webkitAudioContext;if(i)try{this.context=new i}catch(t){this.context=null,this.usingWebAudio=!1,this.touchLocked=!1,console.warn(t)}}if(null===this.context){if(void 0===window.Audio)return void(this.noAudio=!0);this.usingAudioTag=!0}else this.usingWebAudio=!0,this.baseLatency=this.context.baseLatency||256/(this.context.sampleRate||44100),void 0===this.context.createGain?this.masterGain=this.context.createGainNode():this.masterGain=this.context.createGain(),this.masterGain.gain.value=1,this.masterGain.connect(this.context.destination),this.context.onstatechange=this._onStateChange,"suspended"===this.context.state&&this.game.canvas.addEventListener("click",this._onClick);this.noAudio||t.needsTouchUnlock()&&this.setTouchLock(),this.usingWebAudio&&t.chrome&&t.chromeVersion<=65&&console.log('A "GainNode.gain.value setter smoothing is deprecated" notice in Chrome is normal. ')},setTouchLock:function(){this.noAudio||window.PhaserGlobal&&!0===window.PhaserGlobal.disableAudio||(this.game.input.addTouchLockCallback(this.unlock,this,!0),this.touchLocked=!0)},setTouchUnlock:function(){this.touchLocked=!1,this._unlockSource=null,this.onTouchUnlock.dispatch()},resumeWebAudio:function(){if(this.usingWebAudio)return this.context.resume()},resumeWebAudioIfSuspended:function(){if(this.usingWebAudio&&"suspended"===this.context.state)return this.context.resume()},unlock:function(){if(this.noAudio||!this.touchLocked||null!==this._unlockSource)return!0;if(this.usingAudioTag)this.setTouchUnlock();else if(this.usingWebAudio){var t=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource(),this._unlockSource.buffer=t,this._unlockSource.connect(this.context.destination);var e=this;this._unlockSource.onended=function(){e.setTouchUnlock(),e.resumeWebAudioIfSuspended()},void 0===this._unlockSource.start?this._unlockSource.noteOn(0):this._unlockSource.start(0),this.resumeWebAudioIfSuspended()}return!0},stopAll:function(){if(!this.noAudio)for(var t=0;t1&&(t=1),this._volume!==t){if(this._volume=t,this.usingWebAudio)this.masterGain.gain.value=t;else for(var e=0;e + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.ScaleManager=function(t,e,i){this.game=t,this.dom=n.DOM,this.grid=null,this.width=0,this.height=0,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.offset=new n.Point,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this._pageAlignHorizontally=!1,this._pageAlignVertically=!1,this.onOrientationChange=new n.Signal,this.enterIncorrectOrientation=new n.Signal,this.leaveIncorrectOrientation=new n.Signal,this.hasPhaserSetFullScreen=!1,this.fullScreenTarget=null,this._createdFullScreenTarget=null,this.onFullScreenInit=new n.Signal,this.onFullScreenChange=new n.Signal,this.onFullScreenError=new n.Signal,this.screenOrientation=this.dom.getScreenOrientation(),this.scaleFactor=new n.Point(1,1),this.scaleFactorInversed=new n.Point(1,1),this.margin={left:0,top:0,right:0,bottom:0,x:0,y:0},this.bounds=new n.Rectangle,this.aspectRatio=0,this.sourceAspectRatio=0,this.event=null,this.windowConstraints={right:"layout",bottom:""},this.compatibility={supportsFullScreen:!1,orientationFallback:null,noMargins:!1,scrollTo:null,forceMinimumDocumentHeight:!1,canExpandParent:!0,clickTrampoline:""},this._scaleMode=n.ScaleManager.NO_SCALE,this._fullScreenScaleMode=n.ScaleManager.NO_SCALE,this.parentIsWindow=!1,this.parentNode=null,this.parentScaleFactor=new n.Point(1,1),this.trackParentInterval=2e3,this.onSizeChange=new n.Signal,this.onResize=null,this.onResizeContext=null,this._pendingScaleMode=null,this._fullScreenRestore=null,this._gameSize=new n.Rectangle,this._userScaleFactor=new n.Point(1,1),this._userScaleTrim=new n.Point(0,0),this._lastUpdate=0,this._updateThrottle=0,this._updateThrottleReset=100,this._parentBounds=new n.Rectangle,this._tempBounds=new n.Rectangle,this._lastReportedCanvasSize=new n.Rectangle,this._lastReportedGameSize=new n.Rectangle,this._booted=!1,t.config&&this.parseConfig(t.config),this.setupScale(e,i)},n.ScaleManager.EXACT_FIT=0,n.ScaleManager.NO_SCALE=1,n.ScaleManager.SHOW_ALL=2,n.ScaleManager.RESIZE=3,n.ScaleManager.USER_SCALE=4,n.ScaleManager.MODES=["EXACT_FIT","NO_SCALE","SHOW_ALL","RESIZE","USER_SCALE"],n.ScaleManager.prototype={boot:function(){var t=this.compatibility;t.supportsFullScreen=this.game.device.fullscreen&&!this.game.device.cocoonJS,this.game.device.iPad||this.game.device.webApp||this.game.device.desktop||(this.game.device.android&&!this.game.device.chrome?t.scrollTo=new n.Point(0,1):t.scrollTo=new n.Point(0,0)),this.game.device.desktop?(t.orientationFallback="screen",t.clickTrampoline="when-not-mouse"):(t.orientationFallback="",t.clickTrampoline="");var e=this;this._orientationChange=function(t){return e.orientationChange(t)},this._windowResize=function(t){return e.windowResize(t)},window.addEventListener("orientationchange",this._orientationChange,!1),window.addEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(this._fullScreenChange=function(t){return e.fullScreenChange(t)},this._fullScreenError=function(t){return e.fullScreenError(t)},document.addEventListener("webkitfullscreenchange",this._fullScreenChange,!1),document.addEventListener("mozfullscreenchange",this._fullScreenChange,!1),document.addEventListener("MSFullscreenChange",this._fullScreenChange,!1),document.addEventListener("fullscreenchange",this._fullScreenChange,!1),document.addEventListener("webkitfullscreenerror",this._fullScreenError,!1),document.addEventListener("mozfullscreenerror",this._fullScreenError,!1),document.addEventListener("MSFullscreenError",this._fullScreenError,!1),document.addEventListener("fullscreenerror",this._fullScreenError,!1)),this.game.onResume.add(this._gameResumed,this),this.dom.getOffset(this.game.canvas,this.offset),this.bounds.setTo(this.offset.x,this.offset.y,this.width,this.height),this.setGameSize(this.game.width,this.game.height),this.screenOrientation=this.dom.getScreenOrientation(this.compatibility.orientationFallback),n.FlexGrid&&(this.grid=new n.FlexGrid(this,this.width,this.height)),this._booted=!0,null!==this._pendingScaleMode&&(this.scaleMode=this._pendingScaleMode,this._pendingScaleMode=null)},parseConfig:function(t){void 0!==t.scaleMode&&(this._booted?this.scaleMode=t.scaleMode:this._pendingScaleMode=t.scaleMode),void 0!==t.fullScreenScaleMode&&(this.fullScreenScaleMode=t.fullScreenScaleMode),t.fullScreenTarget&&(this.fullScreenTarget=t.fullScreenTarget),this.pageAlignHorizontally=t.alignH||!1,this.pageAlignVertically=t.alignV||!1,t.scaleH&&t.scaleV&&this.setUserScale(t.scaleH,t.scaleV,t.trimH,t.trimV)},setupScale:function(t,e){var i,s=new n.Rectangle;""!==this.game.parent&&("string"==typeof this.game.parent?i=document.getElementById(this.game.parent):this.game.parent&&1===this.game.parent.nodeType&&(i=this.game.parent)),i?(this.parentNode=i,this.parentIsWindow=!1,this.getParentBounds(this._parentBounds,this.parentNode),s.width=this._parentBounds.width,s.height=this._parentBounds.height,this.offset.set(this._parentBounds.x,this._parentBounds.y)):(this.parentNode=null,this.parentIsWindow=!0,s.width=this.dom.visualBounds.width,s.height=this.dom.visualBounds.height,this.offset.set(0,0));var r=0,o=0;"number"==typeof t?r=t:(this.parentScaleFactor.x=parseInt(t,10)/100,r=s.width*this.parentScaleFactor.x),"number"==typeof e?o=e:(this.parentScaleFactor.y=parseInt(e,10)/100,o=s.height*this.parentScaleFactor.y),r=Math.floor(r),o=Math.floor(o),this._gameSize.setTo(0,0,r,o),this.updateDimensions(r,o,!1)},_gameResumed:function(){this.queueUpdate(!0)},setGameSize:function(t,e){this._gameSize.setTo(0,0,t,e),this.currentScaleMode!==n.ScaleManager.RESIZE&&this.updateDimensions(t,e,!0),this.queueUpdate(!0)},setUserScale:function(t,e,i,n,s,r){this._userScaleFactor.setTo(t,e),this._userScaleTrim.setTo(0|i,0|n),void 0===s&&(s=!0),void 0===r&&(r=!0),s&&this.queueUpdate(r)},setResizeCallback:function(t,e){this.onResize=t,this.onResizeContext=e},signalSizeChange:function(){if(!n.Rectangle.sameDimensions(this,this._lastReportedCanvasSize)||!n.Rectangle.sameDimensions(this.game,this._lastReportedGameSize)){var t=this.width,e=this.height;this._lastReportedCanvasSize.setTo(0,0,t,e),this._lastReportedGameSize.setTo(0,0,this.game.width,this.game.height),this.grid&&this.grid.onResize(t,e),this.onSizeChange.dispatch(this,t,e),this.currentScaleMode===n.ScaleManager.RESIZE&&(this.game.state.resize(t,e),this.game.load.resize(t,e))}},setMinMax:function(t,e,i,n){this.minWidth=t,this.minHeight=e,void 0!==i&&(this.maxWidth=i),void 0!==n&&(this.maxHeight=n)},preUpdate:function(){if(!(this.game.time.time=400?0:100,this.dom.getOffset(this.game.canvas,this.offset);var e=this._parentBounds.width,i=this._parentBounds.height,s=this.getParentBounds(this._parentBounds),r=s.width!==e||s.height!==i,o=this.updateOrientationState();(r||o)&&(this.onResize&&this.onResize.call(this.onResizeContext,this,s),this.updateLayout(),this.signalSizeChange());var a=2*this._updateThrottle;this._updateThrottlee;return(h=h?n:!n)?(t.width=Math.floor(s),t.height=Math.floor(r)):(t.width=Math.floor(o),t.height=Math.floor(a)),t},destroy:function(){this.game.onResume.remove(this._gameResumed,this),window.removeEventListener("orientationchange",this._orientationChange,!1),window.removeEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(document.removeEventListener("webkitfullscreenchange",this._fullScreenChange,!1),document.removeEventListener("mozfullscreenchange",this._fullScreenChange,!1),document.removeEventListener("MSFullscreenChange",this._fullScreenChange,!1),document.removeEventListener("fullscreenchange",this._fullScreenChange,!1),document.removeEventListener("webkitfullscreenerror",this._fullScreenError,!1),document.removeEventListener("mozfullscreenerror",this._fullScreenError,!1),document.removeEventListener("MSFullscreenError",this._fullScreenError,!1),document.removeEventListener("fullscreenerror",this._fullScreenError,!1))}},n.ScaleManager.prototype.constructor=n.ScaleManager,Object.defineProperty(n.ScaleManager.prototype,"boundingParent",{get:function(){return this.parentIsWindow||this.isFullScreen&&this.hasPhaserSetFullScreen&&!this._createdFullScreenTarget?null:this.game.canvas&&this.game.canvas.parentNode||null}}),Object.defineProperty(n.ScaleManager.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){return t!==this._scaleMode&&(this.isFullScreen||(this.updateDimensions(this._gameSize.width,this._gameSize.height,!0),this.queueUpdate(!0)),this._scaleMode=t),this._scaleMode}}),Object.defineProperty(n.ScaleManager.prototype,"fullScreenScaleMode",{get:function(){return this._fullScreenScaleMode},set:function(t){return t!==this._fullScreenScaleMode&&(this.isFullScreen?(this.prepScreenMode(!1),this._fullScreenScaleMode=t,this.prepScreenMode(!0),this.queueUpdate(!0)):this._fullScreenScaleMode=t),this._fullScreenScaleMode}}),Object.defineProperty(n.ScaleManager.prototype,"currentScaleMode",{get:function(){return this.isFullScreen?this._fullScreenScaleMode:this._scaleMode}}),Object.defineProperty(n.ScaleManager.prototype,"pageAlignHorizontally",{get:function(){return this._pageAlignHorizontally},set:function(t){t!==this._pageAlignHorizontally&&(this._pageAlignHorizontally=t,this.queueUpdate(!0))}}),Object.defineProperty(n.ScaleManager.prototype,"pageAlignVertically",{get:function(){return this._pageAlignVertically},set:function(t){t!==this._pageAlignVertically&&(this._pageAlignVertically=t,this.queueUpdate(!0))}}),Object.defineProperty(n.ScaleManager.prototype,"isFullScreen",{get:function(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)}}),Object.defineProperty(n.ScaleManager.prototype,"isPortrait",{get:function(){return"portrait"===this.classifyOrientation(this.screenOrientation)}}),Object.defineProperty(n.ScaleManager.prototype,"isLandscape",{get:function(){return"landscape"===this.classifyOrientation(this.screenOrientation)}}),Object.defineProperty(n.ScaleManager.prototype,"isGamePortrait",{get:function(){return this.height>this.width}}),Object.defineProperty(n.ScaleManager.prototype,"isGameLandscape",{get:function(){return this.width>this.height}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Utils.Debug=function(t){this.game=t,this.sprite=null,this.bmd=null,this.canvas=null,this.context=null,this.font="14px monospace",this.columnWidth=100,this.lineHeight=16,this.lineWidth=1,this.renderShadow=!0,this.currentColor=null,this.currentX=0,this.currentY=0,this.currentAlpha=1,this.dirty=!1,this.isDisabled=!1,this._line=null,this._rect=null},n.Utils.Debug.GEOM_AUTO=0,n.Utils.Debug.GEOM_RECTANGLE=1,n.Utils.Debug.GEOM_CIRCLE=2,n.Utils.Debug.GEOM_POINT=3,n.Utils.Debug.GEOM_LINE=4,n.Utils.Debug.GEOM_ELLIPSE=5,n.Utils.Debug.prototype={boot:function(){this.game.renderType===n.CANVAS?this.context=this.game.context:(this.bmd=new n.BitmapData(this.game,"__DEBUG",this.game.width,this.game.height,!0),this.sprite=this.game.make.image(0,0,this.bmd),this.game.stage.addChild(this.sprite),this.game.scale.onSizeChange.add(this.resize,this),this.canvas=n.CanvasPool.create(this,this.game.width,this.game.height),this.context=this.canvas.getContext("2d")),this._line=new n.Line,this._rect=new n.Rectangle},resize:function(){this.bmd.resize(this.game.width,this.game.height),this.canvas.width=this.game.width,this.canvas.height=this.game.height},preUpdate:function(){this.dirty&&this.sprite&&(this.bmd.clear(),this.bmd.draw(this.canvas,0,0),this.context.clearRect(0,0,this.game.width,this.game.height),this.dirty=!1)},reset:function(){this.context&&this.context.clearRect(0,0,this.game.width,this.game.height),this.sprite&&this.bmd.clear()},start:function(t,e,i,n){"number"!=typeof t&&(t=0),"number"!=typeof e&&(e=0),i=i||"rgb(255,255,255)",void 0===n&&(n=0),this.currentX=t,this.currentY=e,this.currentColor=i,this.columnWidth=n,this.dirty=!0,this.context.save(),this.context.setTransform(1,0,0,1,0,0),this.context.strokeStyle=i,this.context.fillStyle=i,this.context.font=this.font,this.context.globalAlpha=this.currentAlpha},stop:function(){this.context.restore()},line:function(){for(var t=this.currentX,e=0;e ")+o):o===n._pendingState?this.line("+ "+o):this.line(" "+o)}this.stop()},sound:function(t,e,i){var n=this.game.sound;this.start(t,e,i),n.noAudio?this.line("Audio is disabled"):(this.line("Volume: "+n.volume.toFixed(2)+(n.mute?" (Mute)":"")),this.line("Mute on pause: "+n.muteOnPause),this.line("Using: "+(n.usingWebAudio?"Web Audio - "+n.context.state:"Audio Tag")),this.line("Touch locked: "+n.touchLocked),this.line("Sounds: "+n._sounds.length)),this.stop()},soundInfo:function(t,e,i,n){if(this.start(e,i,n),this.line("Sound: "+t.key+" Touch locked: "+t.game.sound.touchLocked),this.line("Is Ready?: "+this.game.cache.isSoundReady(t.key)+" Pending Playback: "+t.pendingPlayback),this.line("Decoded: "+t.isDecoded+" Decoding: "+t.isDecoding),this.line("Playing: "+t.isPlaying+" Loop: "+t.loop),this.line("Time: "+(t.currentTime/1e3).toFixed(3)+"s Total: "+t.totalDuration.toFixed(3)+"s"),this.line("Volume: "+t.volume.toFixed(2)+(t.mute?" (Mute)":"")),this.line("Using: "+(t.usingWebAudio?"Web Audio":"Audio Tag")),t.usingWebAudio&&this.line(" Source: "+(t.sourceId||"none")),t.usingAudioTag&&t._sound){var s=t._sound;this.line(" currentSrc: "+s.currentSrc),this.line(" currentTime: "+s.currentTime),this.line(" duration: "+s.duration),this.line(" ended: "+s.ended),this.line(" loop: "+s.loop),this.line(" muted: "+s.muted),this.line(" paused: "+s.paused)}""!==t.currentMarker&&(this.line("Marker: "+t.currentMarker+" Duration: "+t.duration.toFixed(3)+"s ("+t.durationMS+"ms)"),this.line("Start: "+t.markers[t.currentMarker].start.toFixed(3)+" Stop: "+t.markers[t.currentMarker].stop.toFixed(3)),this.line("Position: "+t.position.toFixed(3))),this.stop()},camera:function(t,e,i){var n=t.deadzone,s=t.target,r=t.view;n&&(this._rect.setTo(r.x+n.x,r.y+n.y,n.width,n.height),this.rectangle(this._rect,e,i)),s&&(this._line.setTo(r.centerX,r.centerY,s.x,s.y),this.geom(this._line,e,i),this.geom(s,e,!1,3))},cameraInfo:function(t,e,i,n){var s=t.bounds,r=t.deadzone,o=t.target,a=t.view;this.start(e,i,n),this.line("Camera ("+t.width+" x "+t.height+")"),this.line("x: "+t.x+" y: "+t.y),this.line("Bounds: "+(s?"x: "+s.x+" y: "+s.y+" w: "+s.width+" h: "+s.height:"none")),this.line("View: x: "+a.x+" y: "+a.y+" w: "+a.width+" h: "+a.height),this.line("Center: x: "+t.centerX+" y: "+t.centerY),this.line("Deadzone: "+(r?"x: "+r.x+" y: "+r.y+" w: "+r.width+" h: "+r.height:r)),this.line("Total in view: "+t.totalInView),this.line("At limit: x: "+t.atLimit.x+" y: "+t.atLimit.y),this.line("Target: "+(o?o.name||o:"none")),this.stop()},timer:function(t,e,i,n){this.start(e,i,n),this.line("Timer (running: "+t.running+" expired: "+t.expired+")"),this.line("Next Tick: "+t.next+" Duration: "+t.duration),this.line("Paused: "+t.paused+" Length: "+t.length),this.stop()},pointer:function(t,e,i,n,s,r){if(null!=t&&(void 0===e&&(e=!1),i=i||"rgba(0,255,0,0.5)",n=n||"rgba(255,255,0,0.5)",r=r||"rgba(255,0,0,0.5)",!0!==e||!0!==t.isUp)){this.start(t.x,t.y-150,s),this.context.beginPath(),this.context.arc(t.x,t.y,t.circle.radius,0,2*Math.PI),t.active?this.context.fillStyle=t.isDown?i:n:this.context.fillStyle=r,this.context.fill(),this.context.closePath(),this.context.beginPath(),this.context.moveTo(t.positionDown.x,t.positionDown.y),this.context.lineTo(t.position.x,t.position.y),this.context.lineWidth=2,this.context.stroke(),this.context.closePath();var o=t.movementX,a=t.movementY;(o||a)&&(this.context.beginPath(),this.context.moveTo(o+t.position.x,a+t.position.y),this.context.lineTo(t.position.x,t.position.y),this.context.lineWidth=2,this.context.stroke(),this.context.closePath()),this.line("ID: "+t.id+" Active: "+t.active),this.line("World X: "+t.worldX.toFixed(1)+" World Y: "+t.worldY.toFixed(1)),this.line("Screen X: "+t.x.toFixed(1)+" Screen Y: "+t.y.toFixed(1)+" In: "+t.withinGame),this.line("Movement: X: "+o+" Y: "+a),this.line("Duration: "+t.duration+" ms"),this.line("is Down: "+t.isDown+" is Up: "+t.isUp),this.line("Identifier: "+t.identifier+" Pointer ID: "+t.pointerId),t.isMouse&&this.line("Buttons: "+this._pointerButtonIcon(t.leftButton)+" "+this._pointerButtonIcon(t.middleButton)+" "+this._pointerButtonIcon(t.rightButton)),this.stop()}},_pointerButtonIcon:function(t){return t.isDown?"x":t.isUp?"o":"-"},spriteInputInfo:function(t,e,i,n){this.start(e,i,n),this.line("Sprite Input: ("+t.width+" x "+t.height+")"),this.line("x: "+t.input.pointerX().toFixed(1)+" y: "+t.input.pointerY().toFixed(1)),this.line("over: "+t.input.pointerOver()+" duration: "+t.input.overDuration().toFixed(0)),this.line("down: "+t.input.pointerDown()+" duration: "+t.input.downDuration().toFixed(0)),this.line("just over: "+t.input.justOver()+" just out: "+t.input.justOut()),this.stop()},key:function(t,e,i,n){this.start(e,i,n,150),this.line("Key:",t.keyCode,"isDown:",t.isDown),this.line("justDown:",t.justDown,"justUp:",t.justUp),this.line("Time Down:",t.timeDown.toFixed(0),"duration:",t.duration.toFixed(0)),this.stop()},inputInfo:function(t,e,i,s){var r=this.game.input;if(void 0===s&&(s=!0),this.start(t,e,i),this.line("Input"),this.line("X: "+r.x+" Y: "+r.y),this.line("World X: "+r.worldX+" World Y: "+r.worldY),this.line("Scale X: "+r.scale.x.toFixed(2)+" Scale Y: "+r.scale.x.toFixed(2)),this.line("Screen X: "+r.activePointer.screenX.toFixed(1)+" Screen Y: "+r.activePointer.screenY.toFixed(1)),s){this.line("Sources:"),this.line(" "+this._inputHandler(r.mouse,"mouse")),this.line(" "+this._inputHandler(r.mspointer,"mspointer")),this.line(" "+this._inputHandler(r.touch,"touch"));var o=r.pointers,a=r.mousePointer,h=n.PointerModes,l=0,c=0;this.line("Pointers:"),this.line(" "+(a.isDown?"x":"o")+" "+h[a.pointerMode]+" "+a.identifier);for(var u=0;u0)for(var e=0;e + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.DOM={getOffset:function(t,e){e=e||new n.Point;var i=t.getBoundingClientRect(),s=n.DOM.scrollY,r=n.DOM.scrollX,o=document.documentElement.clientTop,a=document.documentElement.clientLeft;return e.x=i.left+r-a,e.y=i.top+s-o,e},getBounds:function(t,e){return void 0===e&&(e=0),!(!(t=t&&!t.nodeType?t[0]:t)||1!==t.nodeType)&&this.calibrate(t.getBoundingClientRect(),e)},calibrate:function(t,e){e=+e||0;var i={width:0,height:0,left:0,right:0,top:0,bottom:0};return i.width=(i.right=t.right+e)-(i.left=t.left-e),i.height=(i.bottom=t.bottom+e)-(i.top=t.top-e),i},getAspectRatio:function(t){var e=(t=null==t?this.visualBounds:1===t.nodeType?this.getBounds(t):t).width,i=t.height;return"function"==typeof e&&(e=e.call(t)),"function"==typeof i&&(i=i.call(t)),e/i},inLayoutViewport:function(t,e){var i=this.getBounds(t,e);return!!i&&i.bottom>=0&&i.right>=0&&i.top<=this.layoutBounds.width&&i.left<=this.layoutBounds.height},getScreenOrientation:function(t){var e=window.screen,i=e.orientation||e.mozOrientation||e.msOrientation;if(i&&"string"==typeof i.type)return i.type;if("string"==typeof i)return i;var n="portrait-primary",s="landscape-primary";if("screen"===t)return e.height>e.width?n:s;if("viewport"===t)return this.visualBounds.height>this.visualBounds.width?n:s;if("window.orientation"===t&&"number"==typeof window.orientation)return 0===window.orientation||180===window.orientation?n:s;if(window.matchMedia){if(window.matchMedia("(orientation: portrait)").matches)return n;if(window.matchMedia("(orientation: landscape)").matches)return s}return this.visualBounds.height>this.visualBounds.width?n:s},visualBounds:new n.Rectangle,layoutBounds:new n.Rectangle,documentBounds:new n.Rectangle},n.Device.whenReady((function(t){var e=window&&"pageXOffset"in window?function(){return window.pageXOffset}:function(){return document.documentElement.scrollLeft},i=window&&"pageYOffset"in window?function(){return window.pageYOffset}:function(){return document.documentElement.scrollTop};if(Object.defineProperty(n.DOM,"scrollX",{get:e}),Object.defineProperty(n.DOM,"scrollY",{get:i}),Object.defineProperty(n.DOM.visualBounds,"x",{get:e}),Object.defineProperty(n.DOM.visualBounds,"y",{get:i}),Object.defineProperty(n.DOM.layoutBounds,"x",{value:0}),Object.defineProperty(n.DOM.layoutBounds,"y",{value:0}),t.desktop&&document.documentElement.clientWidth<=window.innerWidth&&document.documentElement.clientHeight<=window.innerHeight){var s=function(){return Math.max(window.innerWidth,document.documentElement.clientWidth)},r=function(){return Math.max(window.innerHeight,document.documentElement.clientHeight)};Object.defineProperty(n.DOM.visualBounds,"width",{get:s}),Object.defineProperty(n.DOM.visualBounds,"height",{get:r}),Object.defineProperty(n.DOM.layoutBounds,"width",{get:s}),Object.defineProperty(n.DOM.layoutBounds,"height",{get:r})}else Object.defineProperty(n.DOM.visualBounds,"width",{get:function(){return window.innerWidth}}),Object.defineProperty(n.DOM.visualBounds,"height",{get:function(){return window.innerHeight}}),Object.defineProperty(n.DOM.layoutBounds,"width",{get:function(){var t=document.documentElement.clientWidth,e=window.innerWidth;return t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.ArraySet=function(t){this.position=0,this.list=t||[]},n.ArraySet.prototype={add:function(t){return this.exists(t)||this.list.push(t),t},getIndex:function(t){return this.list.indexOf(t)},getByKey:function(t,e){for(var i=this.list.length;i--;)if(this.list[i][t]===e)return this.list[i];return null},exists:function(t){return this.list.indexOf(t)>-1},reset:function(){this.list.length=0},remove:function(t){var e=this.list.indexOf(t);if(e>-1)return this.list.splice(e,1),t},setAll:function(t,e){for(var i=this.list.length;i--;)this.list[i]&&(this.list[i][t]=e)},callAll:function(t){for(var e=Array.prototype.slice.call(arguments,1),i=this.list.length;i--;)this.list[i]&&this.list[i][t]&&this.list[i][t].apply(this.list[i],e)},removeAll:function(t){void 0===t&&(t=!1);for(var e=this.list.length;e--;)if(this.list[e]){var i=this.remove(this.list[e]);t&&i.destroy()}this.position=0,this.list=[]}},Object.defineProperty(n.ArraySet.prototype,"total",{get:function(){return this.list.length}}),Object.defineProperty(n.ArraySet.prototype,"first",{get:function(){return this.position=0,this.list.length>0?this.list[0]:null}}),Object.defineProperty(n.ArraySet.prototype,"next",{get:function(){return this.position + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.ArrayUtils={getRandomItem:function(t,e,i){if(null===t)return null;void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);return void 0===t[n]?null:t[n]},removeRandomItem:function(t,e,i){if(null==t)return null;void 0===e&&(e=0),void 0===i&&(i=t.length);var n=e+Math.floor(Math.random()*i);if(n=n||0===i)){null==i&&(i=1);for(var s=n-i,r=e;r0;e--){var i=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[i],t[i]=n}return t},transposeMatrix:function(t){for(var e=t.length,i=t[0].length,n=new Array(i),s=0;s-1;r--)n[s][r]=t[r][s]}return n},rotateMatrix:function(t,e){if("string"!=typeof e&&(e=(e%360+360)%360),90===e||-270===e||"rotateLeft"===e)t=(t=n.ArrayUtils.transposeMatrix(t)).reverse();else if(-90===e||270===e||"rotateRight"===e)t=t.reverse(),t=n.ArrayUtils.transposeMatrix(t);else if(180===Math.abs(e)||"rotate180"===e){for(var i=0;i + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},n.LinkedList.prototype={add:function(t){return 0===this.total&&null===this.first&&null===this.last?(this.first=t,this.last=t,this.next=t,t.prev=this,this.total++,t):(this.last.next=t,t.prev=this.last,this.last=t,this.total++,t)},reset:function(){this.first=null,this.last=null,this.next=null,this.prev=null,this.total=0},remove:function(t){if(1===this.total)return this.reset(),void(t.next=t.prev=null);t===this.first?this.first=this.first.next:t===this.last&&(this.last=this.last.prev),t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t.next=t.prev=null,null===this.first&&(this.last=null),this.total--},callAll:function(t){if(this.first&&this.last){var e=this.first;do{e&&e[t]&&e[t].call(e),e=e.next}while(e!==this.last.next)}}},n.LinkedList.prototype.constructor=n.LinkedList, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Create=function(t){this.game=t,this.bmd=null,this.canvas=null,this.ctx=null,this.palettes=[{0:"#000",1:"#9D9D9D",2:"#FFF",3:"#BE2633",4:"#E06F8B",5:"#493C2B",6:"#A46422",7:"#EB8931",8:"#F7E26B",9:"#2F484E",A:"#44891A",B:"#A3CE27",C:"#1B2632",D:"#005784",E:"#31A2F2",F:"#B2DCEF"},{0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#f5f4eb"},{0:"#000",1:"#2234d1",2:"#0c7e45",3:"#44aacc",4:"#8a3622",5:"#5c2e78",6:"#aa5c3d",7:"#b5b5b5",8:"#5e606e",9:"#4c81fb",A:"#6cd947",B:"#7be2f9",C:"#eb8a60",D:"#e23d69",E:"#ffd93f",F:"#fff"},{0:"#000",1:"#fff",2:"#8b4131",3:"#7bbdc5",4:"#8b41ac",5:"#6aac41",6:"#3931a4",7:"#d5de73",8:"#945a20",9:"#5a4100",A:"#bd736a",B:"#525252",C:"#838383",D:"#acee8b",E:"#7b73de",F:"#acacac"},{0:"#000",1:"#191028",2:"#46af45",3:"#a1d685",4:"#453e78",5:"#7664fe",6:"#833129",7:"#9ec2e8",8:"#dc534b",9:"#e18d79",A:"#d6b97b",B:"#e9d8a1",C:"#216c4b",D:"#d365c8",E:"#afaab9",F:"#fff"}]},n.Create.PALETTE_ARNE=0,n.Create.PALETTE_JMP=1,n.Create.PALETTE_CGA=2,n.Create.PALETTE_C64=3,n.Create.PALETTE_JAPANESE_MACHINE=4,n.Create.prototype={texture:function(t,e,i,n,s,r,o,a){void 0===i&&(i=8),void 0===n&&(n=i),void 0===s&&(s=0),void 0===r&&(r=!0);var h=e[0].length*i,l=e.length*n;null===this.bmd&&(this.bmd=this.game.make.bitmapData(),this.canvas=this.bmd.canvas,this.ctx=this.bmd.context),this.bmd.resize(h,l),this.bmd.clear();for(var c=0;c + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.FlexGrid=function(t,e,i){this.game=t.game,this.manager=t,this.width=e,this.height=i,this.boundsCustom=new n.Rectangle(0,0,e,i),this.boundsFluid=new n.Rectangle(0,0,e,i),this.boundsFull=new n.Rectangle(0,0,e,i),this.boundsNone=new n.Rectangle(0,0,e,i),this.positionCustom=new n.Point(0,0),this.positionFluid=new n.Point(0,0),this.positionFull=new n.Point(0,0),this.positionNone=new n.Point(0,0),this.scaleCustom=new n.Point(1,1),this.scaleFluid=new n.Point(1,1),this.scaleFluidInversed=new n.Point(1,1),this.scaleFull=new n.Point(1,1),this.scaleNone=new n.Point(1,1),this.customWidth=0,this.customHeight=0,this.customOffsetX=0,this.customOffsetY=0,this.ratioH=e/i,this.ratioV=i/e,this.multiplier=0,this.layers=[]},n.FlexGrid.prototype={setSize:function(t,e){this.width=t,this.height=e,this.ratioH=t/e,this.ratioV=e/t,this.scaleNone=new n.Point(1,1),this.boundsNone.width=this.width,this.boundsNone.height=this.height,this.refresh()},createCustomLayer:function(t,e,i,s){void 0===s&&(s=!0),this.customWidth=t,this.customHeight=e,this.boundsCustom.width=t,this.boundsCustom.height=e;var r=new n.FlexLayer(this,this.positionCustom,this.boundsCustom,this.scaleCustom);return s&&this.game.world.add(r),this.layers.push(r),i&&r.addMultiple(i),r},createFluidLayer:function(t,e){void 0===e&&(e=!0);var i=new n.FlexLayer(this,this.positionFluid,this.boundsFluid,this.scaleFluid);return e&&this.game.world.add(i),this.layers.push(i),t&&i.addMultiple(t),i},createFullLayer:function(t){var e=new n.FlexLayer(this,this.positionFull,this.boundsFull,this.scaleFluid);return this.game.world.add(e),this.layers.push(e),void 0!==t&&e.addMultiple(t),e},createFixedLayer:function(t){var e=new n.FlexLayer(this,this.positionNone,this.boundsNone,this.scaleNone);return this.game.world.add(e),this.layers.push(e),void 0!==t&&e.addMultiple(t),e},reset:function(){for(var t=this.layers.length;t--;)this.layers[t].persist||(this.layers[t].position=null,this.layers[t].scale=null,this.layers.slice(t,1))},onResize:function(t,e){this.ratioH=t/e,this.ratioV=e/t,this.refresh(t,e)},refresh:function(){this.multiplier=Math.min(this.manager.height/this.height,this.manager.width/this.width),this.boundsFluid.width=Math.round(this.width*this.multiplier),this.boundsFluid.height=Math.round(this.height*this.multiplier),this.scaleFluid.set(this.boundsFluid.width/this.width,this.boundsFluid.height/this.height),this.scaleFluidInversed.set(this.width/this.boundsFluid.width,this.height/this.boundsFluid.height),this.scaleFull.set(this.boundsFull.width/this.width,this.boundsFull.height/this.height),this.boundsFull.width=Math.round(this.manager.width*this.scaleFluidInversed.x),this.boundsFull.height=Math.round(this.manager.height*this.scaleFluidInversed.y),this.boundsFluid.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.boundsNone.centerOn(this.manager.bounds.centerX,this.manager.bounds.centerY),this.positionFluid.set(this.boundsFluid.x,this.boundsFluid.y),this.positionNone.set(this.boundsNone.x,this.boundsNone.y)},fitSprite:function(t){this.manager.scaleSprite(t),t.x=this.manager.bounds.centerX,t.y=this.manager.bounds.centerY},debug:function(){this.game.debug.text(this.boundsFluid.width+" x "+this.boundsFluid.height,this.boundsFluid.x+4,this.boundsFluid.y+16),this.game.debug.geom(this.boundsFluid,"rgba(255,0,0,0.9",!1)}},n.FlexGrid.prototype.constructor=n.FlexGrid, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.FlexLayer=function(t,e,i,s){n.Group.call(this,t.game,null,"__flexLayer"+t.game.rnd.uuid(),!1),this.manager=t.manager,this.grid=t,this.persist=!1,this.position=e,this.bounds=i,this.scale=s,this.topLeft=i.topLeft,this.topMiddle=new n.Point(i.halfWidth,0),this.topRight=i.topRight,this.bottomLeft=i.bottomLeft,this.bottomMiddle=new n.Point(i.halfWidth,i.bottom),this.bottomRight=i.bottomRight},n.FlexLayer.prototype=Object.create(n.Group.prototype),n.FlexLayer.prototype.constructor=n.FlexLayer,n.FlexLayer.prototype.resize=function(){},n.FlexLayer.prototype.debug=function(){this.game.debug.text(this.bounds.width+" x "+this.bounds.height,this.bounds.x+4,this.bounds.y+16),this.game.debug.geom(this.bounds,"rgba(0,0,255,0.9",!1),this.game.debug.geom(this.topLeft,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topMiddle,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topRight,"rgba(255,255,255,0.9")}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Color={RED:16711680,ORANGE:16750848,YELLOW:16776960,GREEN:65280,AQUA:65535,BLUE:255,VIOLET:16711935,WHITE:16777215,BLACK:0,GRAY:6710886,packPixel:function(t,e,i,s){return n.Device.LITTLE_ENDIAN?(s<<24|i<<16|e<<8|t)>>>0:(t<<24|e<<16|i<<8|s)>>>0},unpackPixel:function(t,e,i,s){return null==e&&(e=n.Color.createColor()),null==i&&(i=!1),null==s&&(s=!1),n.Device.LITTLE_ENDIAN?(e.a=(4278190080&t)>>>24,e.b=(16711680&t)>>>16,e.g=(65280&t)>>>8,e.r=255&t):(e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t),e.color=t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a/255+")",i&&n.Color.RGBtoHSL(e.r,e.g,e.b,e),s&&n.Color.RGBtoHSV(e.r,e.g,e.b,e),e},fromRGBA:function(t,e){return e||(e=n.Color.createColor()),e.r=(4278190080&t)>>>24,e.g=(16711680&t)>>>16,e.b=(65280&t)>>>8,e.a=255&t,e.rgba="rgba("+e.r+","+e.g+","+e.b+","+e.a+")",e},toRGBA:function(t,e,i,n){return t<<24|e<<16|i<<8|n},toABGR:function(t,e,i,n){return(n<<24|i<<16|e<<8|t)>>>0},hexToRGBArray:function(t){return[(t>>16&255)/255,(t>>8&255)/255,(255&t)/255]},RGBArrayToHex:function(t){return(255*t[0]<<16)+(255*t[1]<<8)+255*t[2]},RGBtoHSL:function(t,e,i,s){s||(s=n.Color.createColor(t,e,i,1)),t/=255,e/=255,i/=255;var r=Math.min(t,e,i),o=Math.max(t,e,i);if(s.h=0,s.s=0,s.l=(o+r)/2,o!==r){var a=o-r;s.s=s.l>.5?a/(2-o-r):a/(o+r),o===t?s.h=(e-i)/a+(e1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},createColor:function(t,e,i,s,r,o,a,h){var l={r:t||0,g:e||0,b:i||0,a:s||1,h:r||0,s:o||0,l:a||0,v:h||0,color:0,color32:0,rgba:""};return n.Color.updateColor(l)},updateColor:function(t){return t.rgba="rgba("+t.r.toFixed()+","+t.g.toFixed()+","+t.b.toFixed()+","+t.a.toString()+")",t.color=n.Color.getColor(t.r,t.g,t.b),t.color32=n.Color.getColor32(255*t.a,t.r,t.g,t.b),t},getColor32:function(t,e,i,n){return t<<24|e<<16|i<<8|n},getColor:function(t,e,i){return t<<16|e<<8|i},RGBtoString:function(t,e,i,s,r){return void 0===s&&(s=255),void 0===r&&(r="#"),"#"===r?"#"+((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1):"0x"+n.Color.componentToHex(s)+n.Color.componentToHex(t)+n.Color.componentToHex(e)+n.Color.componentToHex(i)},hexToRGB:function(t){var e=n.Color.hexToColor(t);if(e)return n.Color.getColor32(e.a,e.r,e.g,e.b)},hexToColor:function(t,e){t=t.replace(/^(?:#|0x)?([a-f\d])([a-f\d])([a-f\d])$/i,(function(t,e,i,n){return e+e+i+i+n+n}));var i=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);if(i){var s=parseInt(i[1],16),r=parseInt(i[2],16),o=parseInt(i[3],16);e?(e.r=s,e.g=r,e.b=o):e=n.Color.createColor(s,r,o)}return e},webToColor:function(t,e){e||(e=n.Color.createColor());var i=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(t);return i&&(e.r=~~Number(i[1]),e.g=~~Number(i[2]),e.b=~~Number(i[3]),e.a=void 0!==i[4]?Number(i[4]):1,n.Color.updateColor(e)),e},valueToColor:function(t,e){if(e||(e=n.Color.createColor()),"string"==typeof t)return 0===t.indexOf("rgb")?n.Color.webToColor(t,e):(e.a=1,n.Color.hexToColor(t,e));if("number"==typeof t){var i=n.Color.getRGB(t);return e.r=i.r,e.g=i.g,e.b=i.b,e.a=i.a/255,e}return e},componentToHex:function(t){var e=t.toString(16);return 1===e.length?"0"+e:e},HSVColorWheel:function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=[],s=0;s<=359;s++)i.push(n.Color.HSVtoRGB(s/359,t,e));return i},HSLColorWheel:function(t,e){void 0===t&&(t=.5),void 0===e&&(e=.5);for(var i=[],s=0;s<=359;s++)i.push(n.Color.HSLtoRGB(s/359,t,e));return i},interpolateColor:function(t,e,i,s,r,o){void 0===r&&(r=255),void 0===o&&(o=0);var a=n.Color.getRGB(t),h=n.Color.getRGB(e);if(0===o)var l=(h.red-a.red)*s/i+a.red,c=(h.green-a.green)*s/i+a.green,u=(h.blue-a.blue)*s/i+a.blue;if(1===o){var d,p=n.Color.RGBtoHSV(a.r,a.g,a.b),f=n.Color.RGBtoHSV(h.r,h.g,h.b),g=f.h-p.h;if(p.h>f.h){var m=f.h;f.h=p.h,p.h=m,g=-g,s=i-s}g>.5&&(p.h=p.h+1,d=((f.h-p.h)*s/i+p.h)%1),g<=.5&&(d=(f.h-p.h)*s/i+p.h);var y=(f.s-p.s)*s/i+p.s,v=(f.v-p.v)*s/i+p.v,b=n.Color.HSVtoRGB(d,y,v,b);l=b.r,c=b.g,u=b.b}return n.Color.getColor32(r,l,c,u)},interpolateColorWithRGB:function(t,e,i,s,r,o){var a=n.Color.getRGB(t),h=(e-a.red)*o/r+a.red,l=(i-a.green)*o/r+a.green,c=(s-a.blue)*o/r+a.blue;return n.Color.getColor(h,l,c)},interpolateRGB:function(t,e,i,s,r,o,a,h){var l=(s-t)*h/a+t,c=(r-e)*h/a+e,u=(o-i)*h/a+i;return n.Color.getColor(l,c,u)},linear:function(t,e,i){return this.interpolateColor(t,e,1,i)},linearInterpolation:function(t,e){var i=n.Math.linear(0,t.length-1,e),s=t[Math.floor(i)],r=t[Math.ceil(i)];return this.linear(s,r,i%1)},getRandomColor:function(t,e,i){if(void 0===t&&(t=0),void 0===e&&(e=255),void 0===i&&(i=255),e>255||t>e)return n.Color.getColor(255,255,255);var s=t+Math.round(Math.random()*(e-t)),r=t+Math.round(Math.random()*(e-t)),o=t+Math.round(Math.random()*(e-t));return n.Color.getColor32(i,s,r,o)},getRGB:function(t){return t>16777215?{alpha:t>>>24,red:t>>16&255,green:t>>8&255,blue:255&t,a:t>>>24,r:t>>16&255,g:t>>8&255,b:255&t}:{alpha:255,red:t>>16&255,green:t>>8&255,blue:255&t,a:255,r:t>>16&255,g:t>>8&255,b:255&t}},getWebRGB:function(t){if("object"==typeof t)return"rgba("+t.r.toString()+","+t.g.toString()+","+t.b.toString()+","+(t.a/255).toString()+")";var e=n.Color.getRGB(t);return"rgba("+e.r.toString()+","+e.g.toString()+","+e.b.toString()+","+(e.a/255).toString()+")"},getAlpha:function(t){return t>>>24},getAlphaFloat:function(t){return(t>>>24)/255},getRed:function(t){return t>>16&255},getGreen:function(t){return t>>8&255},getBlue:function(t){return 255&t},blendNormal:function(t){return t},blendLighten:function(t,e){return e>t?e:t},blendDarken:function(t,e){return e>t?t:e},blendMultiply:function(t,e){return t*e/255},blendAverage:function(t,e){return(t+e)/2},blendAdd:function(t,e){return Math.min(255,t+e)},blendSubtract:function(t,e){return Math.max(0,t+e-255)},blendDifference:function(t,e){return Math.abs(t-e)},blendNegation:function(t,e){return 255-Math.abs(255-t-e)},blendScreen:function(t,e){return 255-((255-t)*(255-e)>>8)},blendExclusion:function(t,e){return t+e-2*t*e/255},blendOverlay:function(t,e){return e<128?2*t*e/255:255-2*(255-t)*(255-e)/255},blendSoftLight:function(t,e){return e<128?2*(64+(t>>1))*(e/255):255-2*(255-(64+(t>>1)))*(255-e)/255},blendHardLight:function(t,e){return n.Color.blendOverlay(e,t)},blendColorDodge:function(t,e){return 255===e?e:Math.min(255,(t<<8)/(255-e))},blendColorBurn:function(t,e){return 0===e?e:Math.max(0,255-(255-t<<8)/e)},blendLinearDodge:function(t,e){return n.Color.blendAdd(t,e)},blendLinearBurn:function(t,e){return n.Color.blendSubtract(t,e)},blendLinearLight:function(t,e){return e<128?n.Color.blendLinearBurn(t,2*e):n.Color.blendLinearDodge(t,2*(e-128))},blendVividLight:function(t,e){return e<128?n.Color.blendColorBurn(t,2*e):n.Color.blendColorDodge(t,2*(e-128))},blendPinLight:function(t,e){return e<128?n.Color.blendDarken(t,2*e):n.Color.blendLighten(t,2*(e-128))},blendHardMix:function(t,e){return n.Color.blendVividLight(t,e)<128?0:255},blendReflect:function(t,e){return 255===e?e:Math.min(255,t*t/(255-e))},blendGlow:function(t,e){return n.Color.blendReflect(e,t)},blendPhoenix:function(t,e){return Math.min(t,e)-Math.max(t,e)+255}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Physics=function(t,e){e=e||{},this.game=t,this.config=e,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.matter=null,this.parseConfig()},n.Physics.ARCADE=0,n.Physics.P2JS=1,n.Physics.NINJA=2,n.Physics.BOX2D=3,n.Physics.CHIPMUNK=4,n.Physics.MATTERJS=5,n.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&!0!==this.config.arcade||!n.Physics.hasOwnProperty("Arcade")||(this.arcade=new n.Physics.Arcade(this.game)),this.config.hasOwnProperty("ninja")&&!0===this.config.ninja&&n.Physics.hasOwnProperty("Ninja")&&(this.ninja=new n.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&!0===this.config.p2&&n.Physics.hasOwnProperty("P2")&&(this.p2=new n.Physics.P2(this.game,this.config)),this.config.hasOwnProperty("box2d")&&!0===this.config.box2d&&n.Physics.hasOwnProperty("BOX2D")&&(this.box2d=new n.Physics.Box2D(this.game,this.config)),this.config.hasOwnProperty("matter")&&!0===this.config.matter&&n.Physics.hasOwnProperty("Matter")&&(this.matter=new n.Physics.Matter(this.game,this.config))},startSystem:function(t){t===n.Physics.ARCADE?this.arcade=new n.Physics.Arcade(this.game):t===n.Physics.P2JS?null===this.p2?this.p2=new n.Physics.P2(this.game,this.config):this.p2.reset():t===n.Physics.NINJA?this.ninja=new n.Physics.Ninja(this.game):t===n.Physics.BOX2D?null===this.box2d?this.box2d=new n.Physics.Box2D(this.game,this.config):this.box2d.reset():t===n.Physics.MATTERJS&&(null===this.matter?this.matter=new n.Physics.Matter(this.game,this.config):this.matter.reset())},enable:function(t,e,i){void 0===e&&(e=n.Physics.ARCADE),void 0===i&&(i=!1),e===n.Physics.ARCADE?this.arcade.enable(t):e===n.Physics.P2JS&&this.p2?this.p2.enable(t,i):e===n.Physics.NINJA&&this.ninja?this.ninja.enableAABB(t):e===n.Physics.BOX2D&&this.box2d?this.box2d.enable(t):e===n.Physics.MATTERJS&&this.matter?this.matter.enable(t):console.warn(t.key+" is attempting to enable a physics body using an unknown physics system.")},preUpdate:function(){this.p2&&this.p2.preUpdate(),this.box2d&&this.box2d.preUpdate(),this.matter&&this.matter.preUpdate()},update:function(){this.p2&&this.p2.update(),this.box2d&&this.box2d.update(),this.matter&&this.matter.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld(),this.box2d&&this.box2d.setBoundsToWorld(),this.matter&&this.matter.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear(),this.box2d&&this.box2d.clear(),this.matter&&this.matter.clear()},reset:function(){this.p2&&this.p2.reset(),this.box2d&&this.box2d.reset(),this.matter&&this.matter.reset()},destroy:function(){this.p2&&this.p2.destroy(),this.box2d&&this.box2d.destroy(),this.matter&&this.matter.destroy(),this.arcade=null,this.ninja=null,this.p2=null,this.box2d=null,this.matter=null}},n.Physics.prototype.constructor=n.Physics, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Physics.Arcade=function(t){this.game=t,this.gravity=new n.Point,this.bounds=new n.Rectangle(0,0,t.world.width,t.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.forceX=!1,this.sortDirection=n.Physics.Arcade.LEFT_RIGHT,this.skipQuadTree=!0,this.isPaused=!1,this.quadTree=new n.QuadTree(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this._total=0,this.setBoundsToWorld()},n.Physics.Arcade.prototype.constructor=n.Physics.Arcade,n.Physics.Arcade.SORT_NONE=0,n.Physics.Arcade.LEFT_RIGHT=1,n.Physics.Arcade.RIGHT_LEFT=2,n.Physics.Arcade.TOP_BOTTOM=3,n.Physics.Arcade.BOTTOM_TOP=4,n.Physics.Arcade.prototype={setBounds:function(t,e,i,n){this.bounds.setTo(t,e,i,n)},setBoundsToWorld:function(){this.bounds.copyFrom(this.game.world.bounds)},enable:function(t,e){void 0===e&&(e=!0);var i=1;if(Array.isArray(t))for(i=t.length;i--;)t[i]instanceof n.Group?this.enable(t[i].children,e):(this.enableBody(t[i]),e&&t[i].hasOwnProperty("children")&&t[i].children.length>0&&this.enable(t[i],!0));else t instanceof n.Group?this.enable(t.children,e):(this.enableBody(t),e&&t.hasOwnProperty("children")&&t.children.length>0&&this.enable(t.children,!0))},enableBody:function(t){t.hasOwnProperty("body")&&null===t.body&&(t.body=new n.Physics.Arcade.Body(t),t.parent&&t.parent instanceof n.Group&&t.parent.addToHash(t))},updateMotion:function(t){if(t.allowRotation){var e=this.computeVelocity(0,t,t.angularVelocity,t.angularAcceleration,t.angularDrag,t.maxAngular)-t.angularVelocity;t.angularVelocity+=e,t.rotation+=t.angularVelocity*this.game.time.physicsElapsed}t.velocity.x=this.computeVelocity(1,t,t.velocity.x,t.acceleration.x,t.drag.x,t.maxVelocity.x),t.velocity.y=this.computeVelocity(2,t,t.velocity.y,t.acceleration.y,t.drag.y,t.maxVelocity.y)},computeVelocity:function(t,e,i,n,s,r){return void 0===r&&(r=1e4),1===t&&e.allowGravity?i+=(this.gravity.x+e.gravity.x)*this.game.time.physicsElapsed:2===t&&e.allowGravity&&(i+=(this.gravity.y+e.gravity.y)*this.game.time.physicsElapsed),n?i+=n*this.game.time.physicsElapsed:s&&e.allowDrag&&(i-(s*=this.game.time.physicsElapsed)>0?i-=s:i+s<0?i+=s:i=0),i>r?i=r:i<-r&&(i=-r),i},overlap:function(t,e,i,n,s){return i=i||null,n=n||null,s=s||i,this._total=0,this.collideObjects(t,e,i,n,s,!0),this._total>0},collide:function(t,e,i,n,s){return i=i||null,n=n||null,s=s||i,this._total=0,this.collideObjects(t,e,i,n,s,!1),this._total>0},sortLeftRight:function(t,e){return t.body&&e.body?t.body.x-e.body.x:0},sortRightLeft:function(t,e){return t.body&&e.body?e.body.x-t.body.x:0},sortTopBottom:function(t,e){return t.body&&e.body?t.body.y-e.body.y:0},sortBottomTop:function(t,e){return t.body&&e.body?e.body.y-t.body.y:0},sort:function(t,e){null!==t.physicsSortDirection?e=t.physicsSortDirection:void 0===e&&(e=this.sortDirection),e===n.Physics.Arcade.LEFT_RIGHT?t.hash.sort(this.sortLeftRight):e===n.Physics.Arcade.RIGHT_LEFT?t.hash.sort(this.sortRightLeft):e===n.Physics.Arcade.TOP_BOTTOM?t.hash.sort(this.sortTopBottom):e===n.Physics.Arcade.BOTTOM_TOP&&t.hash.sort(this.sortBottomTop)},collideObjects:function(t,e,i,n,s,r){if(!Array.isArray(t)&&Array.isArray(e))for(var o=0;oa.right)break;if(a.x>t.body.right)continue}else if(this.sortDirection===n.Physics.Arcade.TOP_BOTTOM){if(t.body.bottoma.bottom)break;if(a.y>t.body.bottom)continue}this.collideSpriteVsSprite(t,l,i,s,r,o)}}else{this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(e);var c=this.quadTree.retrieve(t);for(h=0;hc.right)continue;if(c.x>a.right)break}else if(this.sortDirection===n.Physics.Arcade.TOP_BOTTOM){if(a.bottomc.bottom)continue;if(c.y>h.body.bottom)break}this.collideSpriteVsSprite(h,u,e,i,s,r)}}}}},collideGroupVsGroup:function(t,e,i,s,r,o){if(0!==t.length&&0!==e.length)for(var a=0;aa.bottom)&&(h.xa.right))return this.separateCircle(t,e,s)}var l=!1,c=!1;this.forceX||Math.abs(this.gravity.y+t.gravity.y)=e.right)&&!(t.position.y>=e.bottom))))},circleBodyIntersects:function(t,e){var i=n.Math.clamp(t.center.x,e.left,e.right),s=n.Math.clamp(t.center.y,e.top,e.bottom);return(t.center.x-i)*(t.center.x-i)+(t.center.y-s)*(t.center.y-s)<=t.halfWidth*t.halfWidth},separateCircle:function(t,e,i){this.getOverlapX(t,e),this.getOverlapY(t,e);var s=e.center.x-t.center.x,r=e.center.y-t.center.y,o=Math.atan2(r,s),a=0;if(t.isCircle!==e.isCircle){var h={x:e.isCircle?t.position.x:e.position.x,y:e.isCircle?t.position.y:e.position.y,right:e.isCircle?t.right:e.right,bottom:e.isCircle?t.bottom:e.bottom},l={x:t.isCircle?t.center.x:e.center.x,y:t.isCircle?t.center.y:e.center.y,radius:t.isCircle?t.halfWidth:e.halfWidth};l.yh.right&&(a=n.Math.distance(l.x,l.y,h.right,h.y)-l.radius):l.y>h.bottom&&(l.xh.right&&(a=n.Math.distance(l.x,l.y,h.right,h.bottom)-l.radius)),a*=-1}else a=t.halfWidth+e.halfWidth-n.Math.distance(t.center.x,t.center.y,e.center.x,e.center.y);if(i||0===a||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==a&&(t.onOverlap&&t.onOverlap.dispatch(t.sprite,e.sprite),e.onOverlap&&e.onOverlap.dispatch(e.sprite,t.sprite)),0!==a;var c=t.velocity.x*Math.cos(o)+t.velocity.y*Math.sin(o),u=-t.velocity.x*Math.sin(o)+t.velocity.y*Math.cos(o),d=e.velocity.x*Math.cos(o)+e.velocity.y*Math.sin(o),p=-e.velocity.x*Math.sin(o)+e.velocity.y*Math.cos(o),f=((t.mass-e.mass)*c+2*e.mass*d)/(t.mass+e.mass),g=(2*t.mass*c+(e.mass-t.mass)*d)/(t.mass+e.mass);return t.immovable||(t.velocity.x=(f*Math.cos(o)-u*Math.sin(o))*t.bounce.x,t.velocity.y=(u*Math.cos(o)+f*Math.sin(o))*t.bounce.y),e.immovable||(e.velocity.x=(g*Math.cos(o)-p*Math.sin(o))*e.bounce.x,e.velocity.y=(p*Math.cos(o)+g*Math.sin(o))*e.bounce.y),Math.abs(o)0&&!t.immovable&&e.velocity.x>t.velocity.x?t.velocity.x*=-1:e.velocity.x<0&&!e.immovable&&t.velocity.x0&&!t.immovable&&e.velocity.y>t.velocity.y?t.velocity.y*=-1:e.velocity.y<0&&!e.immovable&&t.velocity.yMath.PI/2&&(t.velocity.x<0&&!t.immovable&&e.velocity.x0&&!e.immovable&&t.velocity.x>e.velocity.x?e.velocity.x*=-1:t.velocity.y<0&&!t.immovable&&e.velocity.y0&&!e.immovable&&t.velocity.x>e.velocity.y&&(e.velocity.y*=-1)),t.immovable||(t.x+=t.velocity.x*this.game.time.physicsElapsed-a*Math.cos(o),t.y+=t.velocity.y*this.game.time.physicsElapsed-a*Math.sin(o)),e.immovable||(e.x+=e.velocity.x*this.game.time.physicsElapsed+a*Math.cos(o),e.y+=e.velocity.y*this.game.time.physicsElapsed+a*Math.sin(o)),t.onCollide&&t.onCollide.dispatch(t.sprite,e.sprite),e.onCollide&&e.onCollide.dispatch(e.sprite,t.sprite),!0},getOverlapX:function(t,e,i){var n=0,s=t.deltaAbsX()+e.deltaAbsX()+this.OVERLAP_BIAS;return 0===t.deltaX()&&0===e.deltaX()?(t.embedded=!0,e.embedded=!0):t.deltaX()>e.deltaX()?(n=t.right-e.x)>s&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?n=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0):t.deltaX()s&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?n=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0)),t.overlapX=n,e.overlapX=n,n},getOverlapY:function(t,e,i){var n=0,s=t.deltaAbsY()+e.deltaAbsY()+this.OVERLAP_BIAS;return 0===t.deltaY()&&0===e.deltaY()?(t.embedded=!0,e.embedded=!0):t.deltaY()>e.deltaY()?(n=t.bottom-e.y)>s&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?n=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0):t.deltaY()s&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?n=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0)),t.overlapY=n,e.overlapY=n,n},separateX:function(t,e,i){var n=this.getOverlapX(t,e,i);if(i||0===n||t.immovable&&e.immovable||t.customSeparateX||e.customSeparateX)return 0!==n||t.embedded&&e.embedded;var s=t.velocity.x,r=e.velocity.x;if(t.immovable||e.immovable)t.immovable?(e.x+=n,e.velocity.x=s-r*e.bounce.x,t.moves&&(e.y+=(t.y-t.prev.y)*t.friction.y)):(t.x-=n,t.velocity.x=r-s*t.bounce.x,e.moves&&(t.y+=(e.y-e.prev.y)*e.friction.y));else{n*=.5,t.x-=n,e.x+=n;var o=Math.sqrt(r*r*e.mass/t.mass)*(r>0?1:-1),a=Math.sqrt(s*s*t.mass/e.mass)*(s>0?1:-1),h=.5*(o+a);o-=h,a-=h,t.velocity.x=h+o*t.bounce.x,e.velocity.x=h+a*e.bounce.x}return!0},separateY:function(t,e,i){var n=this.getOverlapY(t,e,i);if(i||0===n||t.immovable&&e.immovable||t.customSeparateY||e.customSeparateY)return 0!==n||t.embedded&&e.embedded;var s=t.velocity.y,r=e.velocity.y;if(t.immovable||e.immovable)t.immovable?(e.y+=n,e.velocity.y=s-r*e.bounce.y,t.moves&&(e.x+=(t.x-t.prev.x)*t.friction.x)):(t.y-=n,t.velocity.y=r-s*t.bounce.y,e.moves&&(t.x+=(e.x-e.prev.x)*e.friction.x));else{n*=.5,t.y-=n,e.y+=n;var o=Math.sqrt(r*r*e.mass/t.mass)*(r>0?1:-1),a=Math.sqrt(s*s*t.mass/e.mass)*(s>0?1:-1),h=.5*(o+a);o-=h,a-=h,t.velocity.y=h+o*t.bounce.y,e.velocity.y=h+a*e.bounce.y}return!0},getObjectsUnderPointer:function(t,e,i,n){if(0!==e.length&&t.exists)return this.getObjectsAtLocation(t.x,t.y,e,i,n,t)},getObjectsAtLocation:function(t,e,i,s,r,o){this.quadTree.clear(),this.quadTree.reset(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels),this.quadTree.populate(i);for(var a=new n.Rectangle(t,e,1,1),h=[],l=this.quadTree.retrieve(a),c=0;c0&&(i=this.distanceBetween(t,e)/(s/1e3)),t.body.velocity.setToPolar(r,i),r},moveToPointer:function(t,e,i,n){void 0===e&&(e=60),i=i||this.game.input.activePointer,void 0===n&&(n=0);var s=this.angleToPointer(t,i);return n>0&&(e=this.distanceToPointer(t,i)/(n/1e3)),t.body.velocity.setToPolar(s,e),s},moveToXY:function(t,e,i,n,s){void 0===n&&(n=60),void 0===s&&(s=0);var r=Math.atan2(i-t.y,e-t.x);return s>0&&(n=this.distanceToXY(t,e,i)/(s/1e3)),t.body.velocity.setToPolar(r,n),r},velocityFromAngle:function(t,e,i){return void 0===e&&(e=60),(i=i||new n.Point).setToPolar(t,e,!0)},velocityFromRotation:function(t,e,i){return void 0===e&&(e=60),(i=i||new n.Point).setToPolar(t,e)},accelerationFromRotation:function(t,e,i){return void 0===e&&(e=60),(i=i||new n.Point).setToPolar(t,e)},accelerateToObject:function(t,e,i,n,s){void 0===i&&(i=60),void 0===n&&(n=1e3),void 0===s&&(s=1e3);var r=this.angleBetween(t,e);return t.body.acceleration.setToPolar(r,i),t.body.maxVelocity.setTo(n,s),r},accelerateToPointer:function(t,e,i,n,s){void 0===i&&(i=60),void 0===e&&(e=this.game.input.activePointer),void 0===n&&(n=1e3),void 0===s&&(s=1e3);var r=this.angleToPointer(t,e);return t.body.acceleration.setToPolar(r,i),t.body.maxVelocity.setTo(n,s),r},accelerateToXY:function(t,e,i,n,s,r){void 0===n&&(n=60),void 0===s&&(s=1e3),void 0===r&&(r=1e3);var o=this.angleToXY(t,e,i);return t.body.acceleration.setTo(o,n),t.body.maxVelocity.setTo(s,r),o},distanceBetween:function(t,e,i,n){var s,r;return void 0===i&&(i=!1),n?(s=t.centerX-e.centerX,r=t.centerY-e.centerY):i?(s=t.world.x-e.world.x,r=t.world.y-e.world.y):(s=t.x-e.x,r=t.y-e.y),Math.sqrt(s*s+r*r)},distanceToXY:function(t,e,i,n){void 0===n&&(n=!1);var s=n?t.world.x-e:t.x-e,r=n?t.world.y-i:t.y-i;return Math.sqrt(s*s+r*r)},distanceToPointer:function(t,e,i){void 0===e&&(e=this.game.input.activePointer),void 0===i&&(i=!1);var n=i?t.world.x-e.worldX:t.x-e.worldX,s=i?t.world.y-e.worldY:t.y-e.worldY;return Math.sqrt(n*n+s*s)},closest:function(t,e,i,n){for(var s=1/0,r=null,o=0,a=e.length;os&&(r=h,s=l)}return r},angleBetween:function(t,e,i){return void 0===i&&(i=!1),i?n.Point.angle(e.world,t.world):n.Point.angle(e,t)},angleBetweenCenters:function(t,e){var i=e.centerX-t.centerX,n=e.centerY-t.centerY;return Math.atan2(n,i)},angleToXY:function(t,e,i,n){return void 0===n&&(n=!1),n?Math.atan2(i-t.world.y,e-t.world.x):Math.atan2(i-t.y,e-t.x)},angleToPointer:function(t,e,i){return void 0===e&&(e=this.game.input.activePointer),void 0===i&&(i=!1),i?Math.atan2(e.worldY-t.world.y,e.worldX-t.world.x):Math.atan2(e.worldY-t.y,e.worldX-t.x)},worldAngleToPointer:function(t,e){return this.angleToPointer(t,e,!0)}}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Physics.Arcade.Body=function(t){this.sprite=t,this.game=t.game,this.type=n.Physics.ARCADE,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new n.Point,this.position=new n.Point(t.x,t.y),this.prev=new n.Point(this.position.x,this.position.y),this.allowRotation=!0,this.rotation=t.angle,this.preRotation=t.angle,this.width=t.width,this.height=t.height,this.sourceWidth=t.width,this.sourceHeight=t.height,t.texture&&(this.sourceWidth=t.texture.frame.width,this.sourceHeight=t.texture.frame.height),this.halfWidth=Math.abs(t.width/2),this.halfHeight=Math.abs(t.height/2),this.center=new n.Point(t.x+this.halfWidth,t.y+this.halfHeight),this.velocity=new n.Point,this.newVelocity=new n.Point,this.deltaMax=new n.Point,this.acceleration=new n.Point,this.allowDrag=!0,this.drag=new n.Point,this.allowGravity=!0,this.gravity=new n.Point,this.bounce=new n.Point,this.worldBounce=null,this.onWorldBounds=null,this.onCollide=null,this.onOverlap=null,this.maxVelocity=new n.Point(1e4,1e4),this.friction=new n.Point(1,0),this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=n.NONE,this.immovable=!1,this.moves=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.tilePadding=new n.Point,this.dirty=!1,this.skipQuadTree=!1,this.syncBounds=!1,this.isMoving=!1,this.stopVelocityOnCollide=!0,this.moveTimer=0,this.moveDistance=0,this.moveDuration=0,this.moveTarget=null,this.moveEnd=null,this.onMoveComplete=new n.Signal,this.movementCallback=null,this.movementCallbackContext=null,this._reset=!0,this._sx=t.scale.x,this._sy=t.scale.y,this._dx=0,this._dy=0},n.Physics.Arcade.Body.prototype={updateBounds:function(){if(this.syncBounds){var t=this.sprite.getBounds();t.ceilAll(),t.width===this.width&&t.height===this.height||(this.width=t.width,this.height=t.height,this._reset=!0)}else{var e=Math.abs(this.sprite.scale.x),i=Math.abs(this.sprite.scale.y);e===this._sx&&i===this._sy||(this.width=this.sourceWidth*e,this.height=this.sourceHeight*i,this._sx=e,this._sy=i,this._reset=!0)}this._reset&&(this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter())},updateCenter:function(){this.center.setTo(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},preUpdate:function(){this.enable&&!this.game.physics.arcade.isPaused&&(this.dirty=!0,this.wasTouching.none=this.touching.none,this.wasTouching.up=this.touching.up,this.wasTouching.down=this.touching.down,this.wasTouching.left=this.touching.left,this.wasTouching.right=this.touching.right,this.touching.none=!0,this.touching.up=!1,this.touching.down=!1,this.touching.left=!1,this.touching.right=!1,this.blocked.none=!0,this.blocked.up=!1,this.blocked.down=!1,this.blocked.left=!1,this.blocked.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1,this.updateBounds(),this.position.x=this.sprite.world.x-this.sprite.anchor.x*this.sprite.width+this.sprite.scale.x*this.offset.x,this.position.x-=this.sprite.scale.x<0?this.width:0,this.position.y=this.sprite.world.y-this.sprite.anchor.y*this.sprite.height+this.sprite.scale.y*this.offset.y,this.position.y-=this.sprite.scale.y<0?this.height:0,this.updateCenter(),this.rotation=this.sprite.angle,this.preRotation=this.rotation,(this._reset||this.sprite.fresh)&&(this.prev.x=this.position.x,this.prev.y=this.position.y),this.moves&&(this.game.physics.arcade.updateMotion(this),this.newVelocity.set(this.velocity.x*this.game.time.physicsElapsed,this.velocity.y*this.game.time.physicsElapsed),this.position.x+=this.newVelocity.x,this.position.y+=this.newVelocity.y,this.updateCenter(),this.position.x===this.prev.x&&this.position.y===this.prev.y||(this.angle=this.velocity.atan()),this.speed=Math.sqrt(this.velocity.x*this.velocity.x+this.velocity.y*this.velocity.y),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.onWorldBounds.dispatch(this.sprite,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)),this._dx=this.deltaX(),this._dy=this.deltaY(),this._reset=!1)},updateMovement:function(){var t=0,e=0!==this.overlapX||0!==this.overlapY;if(this.moveDuration>0?(this.moveTimer+=this.game.time.elapsedMS,t=this.moveTimer/this.moveDuration):(this.moveTarget.end.set(this.position.x,this.position.y),t=this.moveTarget.length/this.moveDistance),this.movementCallback)var i=this.movementCallback.call(this.movementCallbackContext,this,this.velocity,t);return!(e||t>=1||void 0!==i&&!0!==i)||(this.stopMovement(t>=1||this.stopVelocityOnCollide&&e),!1)},stopMovement:function(t){this.isMoving&&(this.isMoving=!1,t&&this.velocity.set(0),this.onMoveComplete.dispatch(this.sprite,0!==this.overlapX||0!==this.overlapY))},postUpdate:function(){this.enable&&this.dirty&&(this.isMoving&&this.updateMovement(),this.dirty=!1,this.deltaX()<0?this.facing=n.LEFT:this.deltaX()>0&&(this.facing=n.RIGHT),this.deltaY()<0?this.facing=n.UP:this.deltaY()>0&&(this.facing=n.DOWN),this.moves&&(this._dx=this.deltaX(),this._dy=this.deltaY(),0!==this.deltaMax.x&&0!==this._dx&&(this._dx<0&&this._dx<-this.deltaMax.x?this._dx=-this.deltaMax.x:this._dx>0&&this._dx>this.deltaMax.x&&(this._dx=this.deltaMax.x)),0!==this.deltaMax.y&&0!==this._dy&&(this._dy<0&&this._dy<-this.deltaMax.y?this._dy=-this.deltaMax.y:this._dy>0&&this._dy>this.deltaMax.y&&(this._dy=this.deltaMax.y)),this.sprite.position.x+=this._dx,this.sprite.position.y+=this._dy,this._reset=!0),this.updateCenter(),this.allowRotation&&(this.sprite.angle+=this.deltaZ()),this.prev.x=this.position.x,this.prev.y=this.position.y)},checkWorldBounds:function(){var t=this.position,e=this.game.physics.arcade.bounds,i=this.game.physics.arcade.checkCollision,n=this.worldBounce?-this.worldBounce.x:-this.bounce.x,s=this.worldBounce?-this.worldBounce.y:-this.bounce.y;return t.xe.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=n,this.blocked.right=!0,this.blocked.none=!1),t.ye.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=s,this.blocked.down=!0,this.blocked.none=!1),!this.blocked.none},moveFrom:function(t,e,i){return void 0===e&&(e=this.speed),0!==e&&(void 0===i?(n=this.angle,i=this.game.math.radToDeg(n)):n=this.game.math.degToRad(i),this.moveTimer=0,this.moveDuration=t,0===i||180===i?this.velocity.set(Math.cos(n)*e,0):90===i||270===i?this.velocity.set(0,Math.sin(n)*e):this.velocity.setToPolar(n,e),this.isMoving=!0,!0);var n},moveTo:function(t,e,i){var s,r=e/(t/1e3);return 0!==r&&(void 0===i?(s=this.angle,i=this.game.math.radToDeg(s)):s=this.game.math.degToRad(i),e=Math.abs(e),this.moveDuration=0,this.moveDistance=e,null===this.moveTarget&&(this.moveTarget=new n.Line,this.moveEnd=new n.Point),this.moveTarget.fromAngle(this.x,this.y,s,e),this.moveEnd.set(this.moveTarget.end.x,this.moveTarget.end.y),this.moveTarget.setTo(this.x,this.y,this.x,this.y),0===i||180===i?this.velocity.set(Math.cos(s)*r,0):90===i||270===i?this.velocity.set(0,Math.sin(s)*r):this.velocity.setToPolar(s,r),this.isMoving=!0,!0)},setSize:function(t,e,i,n){void 0===i&&(i=this.offset.x),void 0===n&&(n=this.offset.y),this.sourceWidth=t,this.sourceHeight=e,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(i,n),this.updateCenter(),this.isCircle=!1,this.radius=0},setCircle:function(t,e,i){void 0===e&&(e=this.offset.x),void 0===i&&(i=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.setTo(e,i),this.updateCenter()):this.isCircle=!1},reset:function(t,e){this.stop(),this.position.x=t-this.sprite.anchor.x*this.sprite.width+this.sprite.scale.x*this.offset.x,this.position.x-=this.sprite.scale.x<0?this.width:0,this.position.y=e-this.sprite.anchor.y*this.sprite.height+this.sprite.scale.y*this.offset.y,this.position.y-=this.sprite.scale.y<0?this.height:0,this.prev.x=this.position.x,this.prev.y=this.position.y,this.rotation=this.sprite.angle,this.preRotation=this.rotation,this.updateBounds(),this.updateCenter()},stop:function(){this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,e){return this.isCircle?n.Circle.contains(this,t,e):n.Rectangle.contains(this,t,e)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this.deltaX()>0?this.deltaX():-this.deltaX()},deltaAbsY:function(){return this.deltaY()>0?this.deltaY():-this.deltaY()},deltaX:function(){return this.position.x-this.prev.x},deltaY:function(){return this.position.y-this.prev.y},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.sprite.parent&&this.sprite.parent instanceof n.Group&&this.sprite.parent.removeFromHash(this.sprite),this.sprite.body=null,this.sprite=null}},Object.defineProperty(n.Physics.Arcade.Body.prototype,"left",{get:function(){return this.position.x}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"right",{get:function(){return this.position.x+this.width}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"top",{get:function(){return this.position.y}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.position.y+this.height}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"x",{get:function(){return this.position.x},set:function(t){this.position.x=t}}),Object.defineProperty(n.Physics.Arcade.Body.prototype,"y",{get:function(){return this.position.y},set:function(t){this.position.y=t}}),n.Physics.Arcade.Body.render=function(t,e,i,n,s){void 0===n&&(n=!0),i=i||"rgba(0,255,0,0.4)",t.fillStyle=i,t.strokeStyle=i,t.lineWidth=s||1,e.isCircle?(t.beginPath(),t.arc(e.center.x-e.game.camera.x,e.center.y-e.game.camera.y,e.halfWidth,0,2*Math.PI),n?t.fill():t.stroke()):n?t.fillRect(e.position.x-e.game.camera.x,e.position.y-e.game.camera.y,e.width,e.height):t.strokeRect(e.position.x-e.game.camera.x,e.position.y-e.game.camera.y,e.width,e.height)},n.Physics.Arcade.Body.renderBodyInfo=function(t,e){t.line("x: "+e.x.toFixed(2),"y: "+e.y.toFixed(2),"width: "+e.width,"height: "+e.height),t.line("velocity x: "+e.velocity.x.toFixed(2),"y: "+e.velocity.y.toFixed(2),"deltaX: "+e._dx.toFixed(2),"deltaY: "+e._dy.toFixed(2)),t.line("acceleration x: "+e.acceleration.x.toFixed(2),"y: "+e.acceleration.y.toFixed(2),"speed: "+e.speed.toFixed(2),"angle: "+e.angle.toFixed(2)),t.line("gravity x: "+e.gravity.x,"y: "+e.gravity.y,"bounce x: "+e.bounce.x.toFixed(2),"y: "+e.bounce.y.toFixed(2)),t.line("touching left: "+e.touching.left,"right: "+e.touching.right,"up: "+e.touching.up,"down: "+e.touching.down),t.line("blocked left: "+e.blocked.left,"right: "+e.blocked.right,"up: "+e.blocked.up,"down: "+e.blocked.down)},n.Physics.Arcade.Body.prototype.constructor=n.Physics.Arcade.Body, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Physics.Arcade.TilemapCollision=function(){},n.Physics.Arcade.TilemapCollision.prototype={TILE_BIAS:16,collideSpriteVsTilemapLayer:function(t,e,i,n,s,r){if(t.body){var o=e.getTiles(t.body.position.x-t.body.tilePadding.x-e.getTileOffsetX(),t.body.position.y-t.body.tilePadding.y-e.getTileOffsetY(),t.body.width+t.body.tilePadding.x,t.body.height+t.body.tilePadding.y,!1,!1);if(0!==o.length)for(var a=0;ae.deltaAbsY()?l=-1:e.deltaAbsX()0&&!t.blocked.right&&e.collideLeft&&t.checkCollision.right&&e.faceLeft&&t.right-s>e.left&&(n=t.right-s-e.left)>this.TILE_BIAS&&(n=0),0!==n&&(t.customSeparateX?t.overlapX=n:this.processTileSeparationX(t,n)),n},tileCheckY:function(t,e,i){var n=0,s=i.getTileOffsetY();return t.deltaY()<0&&!t.blocked.up&&e.collideDown&&t.checkCollision.up?e.faceBottom&&t.y-s0&&!t.blocked.down&&e.collideUp&&t.checkCollision.down&&e.faceTop&&t.bottom-s>e.top&&(n=t.bottom-s-e.top)>this.TILE_BIAS&&(n=0),0!==n&&(t.customSeparateY?t.overlapY=n:this.processTileSeparationY(t,n)),n},processTileSeparationX:function(t,e){e<0?(t.blocked.left=!0,t.blocked.none=!1):e>0&&(t.blocked.right=!0,t.blocked.none=!1),t.position.x-=e,0===t.bounce.x?t.velocity.x=0:t.velocity.x=-t.velocity.x*t.bounce.x},processTileSeparationY:function(t,e){e<0?(t.blocked.up=!0,t.blocked.none=!1):e>0&&(t.blocked.down=!0,t.blocked.none=!1),t.position.y-=e,0===t.bounce.y?t.velocity.y=0:t.velocity.y=-t.velocity.y*t.bounce.y}},n.Utils.mixinPrototype(n.Physics.Arcade.prototype,n.Physics.Arcade.TilemapCollision.prototype), +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +p2.Body.prototype.parent=null,p2.Spring.prototype.parent=null,n.Physics.P2=function(t,e){this.game=t,void 0===e?e={gravity:[0,0],broadphase:new p2.SAPBroadphase}:(e.hasOwnProperty("gravity")||(e.gravity=[0,0]),e.hasOwnProperty("broadphase")||(e.broadphase=new p2.SAPBroadphase)),this.config=e,this.world=new p2.World(this.config),this.frameRate=1/60,this.useElapsedTime=!1,this.paused=!1,this.materials=[],this.gravity=new n.Physics.P2.InversePointProxy(this,this.world.gravity),this.walls={left:null,right:null,top:null,bottom:null},this.onBodyAdded=new n.Signal,this.onBodyRemoved=new n.Signal,this.onSpringAdded=new n.Signal,this.onSpringRemoved=new n.Signal,this.onConstraintAdded=new n.Signal,this.onConstraintRemoved=new n.Signal,this.onContactMaterialAdded=new n.Signal,this.onContactMaterialRemoved=new n.Signal,this.postBroadphaseCallback=null,this.callbackContext=null,this.onBeginContact=new n.Signal,this.onEndContact=new n.Signal,e.hasOwnProperty("mpx")&&e.hasOwnProperty("pxm")&&e.hasOwnProperty("mpxi")&&e.hasOwnProperty("pxmi")&&(this.mpx=e.mpx,this.mpxi=e.mpxi,this.pxm=e.pxm,this.pxmi=e.pxmi),this.world.on("beginContact",this.beginContactHandler,this),this.world.on("endContact",this.endContactHandler,this),this.collisionGroups=[],this.nothingCollisionGroup=new n.Physics.P2.CollisionGroup(1),this.boundsCollisionGroup=new n.Physics.P2.CollisionGroup(2),this.everythingCollisionGroup=new n.Physics.P2.CollisionGroup(2147483648),this.boundsCollidesWith=[],this._toRemove=[],this._collisionGroupID=2,this._boundsLeft=!0,this._boundsRight=!0,this._boundsTop=!0,this._boundsBottom=!0,this._boundsOwnGroup=!1,this.setBoundsToWorld(!0,!0,!0,!0,!1)},n.Physics.P2.prototype={removeBodyNextStep:function(t){this._toRemove.push(t)},preUpdate:function(){for(var t=this._toRemove.length;t--;)this.removeBody(this._toRemove[t]);this._toRemove.length=0},enable:function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!0);var s=1;if(Array.isArray(t))for(s=t.length;s--;)t[s]instanceof n.Group?this.enable(t[s].children,e,i):(this.enableBody(t[s],e),i&&t[s].hasOwnProperty("children")&&t[s].children.length>0&&this.enable(t[s],e,!0));else t instanceof n.Group?this.enable(t.children,e,i):(this.enableBody(t,e),i&&t.hasOwnProperty("children")&&t.children.length>0&&this.enable(t.children,e,!0))},enableBody:function(t,e){t.hasOwnProperty("body")&&null===t.body&&(t.body=new n.Physics.P2.Body(this.game,t,t.x,t.y,1),t.body.debug=e,void 0!==t.anchor&&t.anchor.set(.5))},setImpactEvents:function(t){t?this.world.on("impact",this.impactHandler,this):this.world.off("impact",this.impactHandler,this)},setPostBroadphaseCallback:function(t,e){this.postBroadphaseCallback=t,this.callbackContext=e,null!==t?this.world.on("postBroadphase",this.postBroadphaseHandler,this):this.world.off("postBroadphase",this.postBroadphaseHandler,this)},postBroadphaseHandler:function(t){if(this.postBroadphaseCallback&&0!==t.pairs.length)for(var e=t.pairs.length-2;e>=0;e-=2)t.pairs[e].parent&&t.pairs[e+1].parent&&!this.postBroadphaseCallback.call(this.callbackContext,t.pairs[e].parent,t.pairs[e+1].parent)&&t.pairs.splice(e,2)},impactHandler:function(t){if(t.bodyA.parent&&t.bodyB.parent){var e=t.bodyA.parent,i=t.bodyB.parent;e._bodyCallbacks[t.bodyB.id]&&e._bodyCallbacks[t.bodyB.id].call(e._bodyCallbackContext[t.bodyB.id],e,i,t.shapeA,t.shapeB),i._bodyCallbacks[t.bodyA.id]&&i._bodyCallbacks[t.bodyA.id].call(i._bodyCallbackContext[t.bodyA.id],i,e,t.shapeB,t.shapeA),e._groupCallbacks[t.shapeB.collisionGroup]&&e._groupCallbacks[t.shapeB.collisionGroup].call(e._groupCallbackContext[t.shapeB.collisionGroup],e,i,t.shapeA,t.shapeB),i._groupCallbacks[t.shapeA.collisionGroup]&&i._groupCallbacks[t.shapeA.collisionGroup].call(i._groupCallbackContext[t.shapeA.collisionGroup],i,e,t.shapeB,t.shapeA)}},beginContactHandler:function(t){t.bodyA&&t.bodyB&&(this.onBeginContact.dispatch(t.bodyA,t.bodyB,t.shapeA,t.shapeB,t.contactEquations),t.bodyA.parent&&t.bodyA.parent.onBeginContact.dispatch(t.bodyB.parent,t.bodyB,t.shapeA,t.shapeB,t.contactEquations),t.bodyB.parent&&t.bodyB.parent.onBeginContact.dispatch(t.bodyA.parent,t.bodyA,t.shapeB,t.shapeA,t.contactEquations))},endContactHandler:function(t){t.bodyA&&t.bodyB&&(this.onEndContact.dispatch(t.bodyA,t.bodyB,t.shapeA,t.shapeB),t.bodyA.parent&&t.bodyA.parent.onEndContact.dispatch(t.bodyB.parent,t.bodyB,t.shapeA,t.shapeB),t.bodyB.parent&&t.bodyB.parent.onEndContact.dispatch(t.bodyA.parent,t.bodyA,t.shapeB,t.shapeA))},setBoundsToWorld:function(t,e,i,n,s){this.setBounds(this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,t,e,i,n,s)},setWorldMaterial:function(t,e,i,n,s){void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===s&&(s=!0),e&&this.walls.left&&(this.walls.left.shapes[0].material=t),i&&this.walls.right&&(this.walls.right.shapes[0].material=t),n&&this.walls.top&&(this.walls.top.shapes[0].material=t),s&&this.walls.bottom&&(this.walls.bottom.shapes[0].material=t)},updateBoundsCollisionGroup:function(t){void 0===t&&(t=!0);var e=t?this.boundsCollisionGroup.mask:this.everythingCollisionGroup.mask;this.walls.left&&(this.walls.left.shapes[0].collisionGroup=e),this.walls.right&&(this.walls.right.shapes[0].collisionGroup=e),this.walls.top&&(this.walls.top.shapes[0].collisionGroup=e),this.walls.bottom&&(this.walls.bottom.shapes[0].collisionGroup=e),this._boundsOwnGroup=t},setBounds:function(t,e,i,n,s,r,o,a,h){void 0===s&&(s=this._boundsLeft),void 0===r&&(r=this._boundsRight),void 0===o&&(o=this._boundsTop),void 0===a&&(a=this._boundsBottom),void 0===h&&(h=this._boundsOwnGroup),this.setupWall(s,"left",t,e,1.5707963267948966,h),this.setupWall(r,"right",t+i,e,-1.5707963267948966,h),this.setupWall(o,"top",t,e,-3.141592653589793,h),this.setupWall(a,"bottom",t,e+n,0,h),this._boundsLeft=s,this._boundsRight=r,this._boundsTop=o,this._boundsBottom=a,this._boundsOwnGroup=h},setupWall:function(t,e,i,n,s,r){t?(this.walls[e]?this.walls[e].position=[this.pxmi(i),this.pxmi(n)]:(this.walls[e]=new p2.Body({mass:0,position:[this.pxmi(i),this.pxmi(n)],angle:s}),this.walls[e].addShape(new p2.Plane),this.world.addBody(this.walls[e])),r&&(this.walls[e].shapes[0].collisionGroup=this.boundsCollisionGroup.mask)):this.walls[e]&&(this.world.removeBody(this.walls[e]),this.walls[e]=null)},pause:function(){this.paused=!0},resume:function(){this.paused=!1},update:function(){this.paused||(this.useElapsedTime?this.world.step(this.game.time.physicsElapsed):this.world.step(this.frameRate))},reset:function(){this.world.on("beginContact",this.beginContactHandler,this),this.world.on("endContact",this.endContactHandler,this),this.nothingCollisionGroup=new n.Physics.P2.CollisionGroup(1),this.boundsCollisionGroup=new n.Physics.P2.CollisionGroup(2),this.everythingCollisionGroup=new n.Physics.P2.CollisionGroup(2147483648),this._collisionGroupID=2,this.setBoundsToWorld(!0,!0,!0,!0,!1)},clear:function(){this.world.time=0,this.world.fixedStepTime=0,this.world.solver&&this.world.solver.equations.length&&this.world.solver.removeAllEquations();for(var t=this.world.constraints,e=t.length-1;e>=0;e--)this.world.removeConstraint(t[e]);var i=this.world.bodies;for(e=i.length-1;e>=0;e--)this.world.removeBody(i[e]);var n=this.world.springs;for(e=n.length-1;e>=0;e--)this.world.removeSpring(n[e]);var s=this.world.contactMaterials;for(e=s.length-1;e>=0;e--)this.world.removeContactMaterial(s[e]);this.world.off("beginContact",this.beginContactHandler,this),this.world.off("endContact",this.endContactHandler,this),this.postBroadphaseCallback=null,this.callbackContext=null,this.impactCallback=null,this.collisionGroups=[],this._toRemove=[],this.boundsCollidesWith=[],this.walls={left:null,right:null,top:null,bottom:null}},destroy:function(){this.clear(),this.game=null},addBody:function(t){return!t.data.world&&(this.world.addBody(t.data),this.onBodyAdded.dispatch(t),!0)},removeBody:function(t){return t.data.world===this.world&&(this.world.removeBody(t.data),this.onBodyRemoved.dispatch(t)),t},addSpring:function(t){return t instanceof n.Physics.P2.Spring||t instanceof n.Physics.P2.RotationalSpring?this.world.addSpring(t.data):this.world.addSpring(t),this.onSpringAdded.dispatch(t),t},removeSpring:function(t){return t instanceof n.Physics.P2.Spring||t instanceof n.Physics.P2.RotationalSpring?this.world.removeSpring(t.data):this.world.removeSpring(t),this.onSpringRemoved.dispatch(t),t},createDistanceConstraint:function(t,e,i,s,r,o){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.DistanceConstraint(this,t,e,i,s,r,o));console.warn("Cannot create Constraint, invalid body objects given")},createGearConstraint:function(t,e,i,s){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.GearConstraint(this,t,e,i,s));console.warn("Cannot create Constraint, invalid body objects given")},createRevoluteConstraint:function(t,e,i,s,r,o){if(t=this.getBody(t),i=this.getBody(i),t&&i)return this.addConstraint(new n.Physics.P2.RevoluteConstraint(this,t,e,i,s,r,o));console.warn("Cannot create Constraint, invalid body objects given")},createLockConstraint:function(t,e,i,s,r){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.LockConstraint(this,t,e,i,s,r));console.warn("Cannot create Constraint, invalid body objects given")},createPrismaticConstraint:function(t,e,i,s,r,o,a){if(t=this.getBody(t),e=this.getBody(e),t&&e)return this.addConstraint(new n.Physics.P2.PrismaticConstraint(this,t,e,i,s,r,o,a));console.warn("Cannot create Constraint, invalid body objects given")},addConstraint:function(t){return this.world.addConstraint(t),this.onConstraintAdded.dispatch(t),t},removeConstraint:function(t){return this.world.removeConstraint(t),this.onConstraintRemoved.dispatch(t),t},addContactMaterial:function(t){return this.world.addContactMaterial(t),this.onContactMaterialAdded.dispatch(t),t},removeContactMaterial:function(t){return this.world.removeContactMaterial(t),this.onContactMaterialRemoved.dispatch(t),t},getContactMaterial:function(t,e){return this.world.getContactMaterial(t,e)},setMaterial:function(t,e){for(var i=e.length;i--;)e[i].setMaterial(t)},createMaterial:function(t,e){t=t||"";var i=new n.Physics.P2.Material(t);return this.materials.push(i),void 0!==e&&e.setMaterial(i),i},createContactMaterial:function(t,e,i){void 0===t&&(t=this.createMaterial()),void 0===e&&(e=this.createMaterial());var s=new n.Physics.P2.ContactMaterial(t,e,i);return this.addContactMaterial(s)},getBodies:function(){for(var t=[],e=this.world.bodies.length;e--;)t.push(this.world.bodies[e].parent);return t},getBody:function(t){return t instanceof p2.Body?t:t instanceof n.Physics.P2.Body?t.data:t.body&&t.body.type===n.Physics.P2JS?t.body.data:null},getSprings:function(){for(var t=[],e=this.world.springs.length;e--;)t.push(this.world.springs[e].parent);return t},getConstraints:function(){for(var t=[],e=this.world.constraints.length;e--;)t.push(this.world.constraints[e]);return t},hitTest:function(t,e,i,s){void 0===e&&(e=this.world.bodies),void 0===i&&(i=5),void 0===s&&(s=!1);for(var r=[this.pxmi(t.x),this.pxmi(t.y)],o=[],a=e.length;a--;)e[a]instanceof n.Physics.P2.Body&&(!s||e[a].data.type!==p2.Body.STATIC)?o.push(e[a].data):e[a]instanceof p2.Body&&e[a].parent&&(!s||e[a].type!==p2.Body.STATIC)?o.push(e[a]):e[a]instanceof n.Sprite&&e[a].hasOwnProperty("body")&&(!s||e[a].body.data.type!==p2.Body.STATIC)&&o.push(e[a].body.data);return this.world.hitTest(r,o,i)},toJSON:function(){return this.world.toJSON()},createCollisionGroup:function(t){var e=Math.pow(2,this._collisionGroupID);this.walls.left&&(this.walls.left.shapes[0].collisionMask=this.walls.left.shapes[0].collisionMask|e),this.walls.right&&(this.walls.right.shapes[0].collisionMask=this.walls.right.shapes[0].collisionMask|e),this.walls.top&&(this.walls.top.shapes[0].collisionMask=this.walls.top.shapes[0].collisionMask|e),this.walls.bottom&&(this.walls.bottom.shapes[0].collisionMask=this.walls.bottom.shapes[0].collisionMask|e),this._collisionGroupID++;var i=new n.Physics.P2.CollisionGroup(e);return this.collisionGroups.push(i),t&&this.setCollisionGroup(t,i),i},setCollisionGroup:function(t,e){if(t instanceof n.Group)for(var i=0;i-1&&u.collides)if(n){var d=t.getTileRight(e,l,a);if(0===s&&(r=u.x*u.width,o=u.y*u.height,s=u.width),d&&d.collides)s+=u.width;else(p=this.createBody(r,o,0,!1)).addRectangle(s,u.height,s/2,u.height/2,0),i&&this.addBody(p),t.layers[e].bodies.push(p),s=0}else{var p;(p=this.createBody(u.x*u.width,u.y*u.height,0,!1)).addRectangle(u.width,u.height,u.width/2,u.height/2,0),i&&this.addBody(p),t.layers[e].bodies.push(p)}}}return t.layers[e].bodies},mpx:function(t){return 20*t},pxm:function(t){return.05*t},mpxi:function(t){return-20*t},pxmi:function(t){return-.05*t}},Object.defineProperty(n.Physics.P2.prototype,"friction",{get:function(){return this.world.defaultContactMaterial.friction},set:function(t){this.world.defaultContactMaterial.friction=t}}),Object.defineProperty(n.Physics.P2.prototype,"restitution",{get:function(){return this.world.defaultContactMaterial.restitution},set:function(t){this.world.defaultContactMaterial.restitution=t}}),Object.defineProperty(n.Physics.P2.prototype,"contactMaterial",{get:function(){return this.world.defaultContactMaterial},set:function(t){this.world.defaultContactMaterial=t}}),Object.defineProperty(n.Physics.P2.prototype,"applySpringForces",{get:function(){return this.world.applySpringForces},set:function(t){this.world.applySpringForces=t}}),Object.defineProperty(n.Physics.P2.prototype,"applyDamping",{get:function(){return this.world.applyDamping},set:function(t){this.world.applyDamping=t}}),Object.defineProperty(n.Physics.P2.prototype,"applyGravity",{get:function(){return this.world.applyGravity},set:function(t){this.world.applyGravity=t}}),Object.defineProperty(n.Physics.P2.prototype,"solveConstraints",{get:function(){return this.world.solveConstraints},set:function(t){this.world.solveConstraints=t}}),Object.defineProperty(n.Physics.P2.prototype,"time",{get:function(){return this.world.time}}),Object.defineProperty(n.Physics.P2.prototype,"emitImpactEvent",{get:function(){return this.world.emitImpactEvent},set:function(t){this.world.emitImpactEvent=t}}),Object.defineProperty(n.Physics.P2.prototype,"sleepMode",{get:function(){return this.world.sleepMode},set:function(t){this.world.sleepMode=t}}),Object.defineProperty(n.Physics.P2.prototype,"total",{get:function(){return this.world.bodies.length}}), +/** +* @author Georgios Kaleadis https://github.com/georgiee +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.FixtureList=function(t){Array.isArray(t)||(t=[t]),this.rawList=t,this.init(),this.parse(this.rawList)},n.Physics.P2.FixtureList.prototype={init:function(){this.namedFixtures={},this.groupedFixtures=[],this.allFixtures=[]},setCategory:function(t,e){this.getFixtures(e).forEach((function(e){e.collisionGroup=t}))},setMask:function(t,e){this.getFixtures(e).forEach((function(e){e.collisionMask=t}))},setSensor:function(t,e){this.getFixtures(e).forEach((function(e){e.sensor=t}))},setMaterial:function(t,e){this.getFixtures(e).forEach((function(e){e.material=t}))},getFixtures:function(t){var e=[];if(t){t instanceof Array||(t=[t]);var i=this;return t.forEach((function(t){i.namedFixtures[t]&&e.push(i.namedFixtures[t])})),this.flatten(e)}return this.allFixtures},getFixtureByKey:function(t){return this.namedFixtures[t]},getGroup:function(t){return this.groupedFixtures[t]},parse:function(){var t,e,i,n;for(t in n=[],i=this.rawList)e=i[t],isNaN(t-0)?this.namedFixtures[t]=this.flatten(e):(this.groupedFixtures[t]=this.groupedFixtures[t]||[],this.groupedFixtures[t]=this.groupedFixtures[t].concat(e)),n.push(this.allFixtures=this.flatten(this.groupedFixtures))},flatten:function(t){var e,i;return e=[],i=arguments.callee,t.forEach((function(t){return Array.prototype.push.apply(e,Array.isArray(t)?i(t):[t])})),e}}, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.PointProxy=function(t,e){this.world=t,this.destination=e},n.Physics.P2.PointProxy.prototype.constructor=n.Physics.P2.PointProxy,Object.defineProperty(n.Physics.P2.PointProxy.prototype,"x",{get:function(){return this.world.mpx(this.destination[0])},set:function(t){this.destination[0]=this.world.pxm(t)}}),Object.defineProperty(n.Physics.P2.PointProxy.prototype,"y",{get:function(){return this.world.mpx(this.destination[1])},set:function(t){this.destination[1]=this.world.pxm(t)}}),Object.defineProperty(n.Physics.P2.PointProxy.prototype,"mx",{get:function(){return this.destination[0]},set:function(t){this.destination[0]=t}}),Object.defineProperty(n.Physics.P2.PointProxy.prototype,"my",{get:function(){return this.destination[1]},set:function(t){this.destination[1]=t}}), +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.InversePointProxy=function(t,e){this.world=t,this.destination=e},n.Physics.P2.InversePointProxy.prototype.constructor=n.Physics.P2.InversePointProxy,Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"x",{get:function(){return this.world.mpxi(this.destination[0])},set:function(t){this.destination[0]=this.world.pxmi(t)}}),Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"y",{get:function(){return this.world.mpxi(this.destination[1])},set:function(t){this.destination[1]=this.world.pxmi(t)}}),Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"mx",{get:function(){return this.destination[0]},set:function(t){this.destination[0]=-t}}),Object.defineProperty(n.Physics.P2.InversePointProxy.prototype,"my",{get:function(){return this.destination[1]},set:function(t){this.destination[1]=-t}}), +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.Body=function(t,e,i,s,r){e=e||null,i=i||0,s=s||0,void 0===r&&(r=1),this.game=t,this.world=t.physics.p2,this.sprite=e,this.type=n.Physics.P2JS,this.offset=new n.Point,this.data=new p2.Body({position:[this.world.pxmi(i),this.world.pxmi(s)],mass:r}),this.data.parent=this,this.velocity=new n.Physics.P2.InversePointProxy(this.world,this.data.velocity),this.force=new n.Physics.P2.InversePointProxy(this.world,this.data.force),this.gravity=new n.Point,this.onBeginContact=new n.Signal,this.onEndContact=new n.Signal,this.collidesWith=[],this.removeNextStep=!1,this.debugBody=null,this.dirty=!1,this._collideWorldBounds=!0,this._bodyCallbacks={},this._bodyCallbackContext={},this._groupCallbacks={},this._groupCallbackContext={},this._reset=!1,e&&(this.setRectangleFromSprite(e),e.exists&&this.game.physics.p2.addBody(this))},n.Physics.P2.Body.prototype={createBodyCallback:function(t,e,i){var n=-1;t.id?n=t.id:t.body&&(n=t.body.id),n>-1&&(null===e?(delete this._bodyCallbacks[n],delete this._bodyCallbackContext[n]):(this._bodyCallbacks[n]=e,this._bodyCallbackContext[n]=i))},createGroupCallback:function(t,e,i){null===e?(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]):(this._groupCallbacks[t.mask]=e,this._groupCallbackContext[t.mask]=i)},getCollisionMask:function(){var t=0;this._collideWorldBounds&&(t=this.game.physics.p2.boundsCollisionGroup.mask);for(var e=0;e=0;i--)this.data.shapes[i].collisionMask=e;else t.collisionMask=e},setCollisionGroup:function(t,e){var i=this.getCollisionMask();if(void 0===e)for(var n=this.data.shapes.length-1;n>=0;n--)this.data.shapes[n].collisionGroup=t.mask,this.data.shapes[n].collisionMask=i;else e.collisionGroup=t.mask,e.collisionMask=i},clearCollision:function(t,e,i){if(void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i)for(var n=this.data.shapes.length-1;n>=0;n--)t&&(this.data.shapes[n].collisionGroup=null),e&&(this.data.shapes[n].collisionMask=null);else t&&(i.collisionGroup=null),e&&(i.collisionMask=null);t&&(this.collidesWith.length=0)},removeCollisionGroup:function(t,e,i){var n;if(void 0===e&&(e=!0),Array.isArray(t))for(var s=0;s-1&&(this.collidesWith.splice(n,1),e&&(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]));else(n=this.collidesWith.indexOf(t))>-1&&(this.collidesWith.splice(n,1),e&&(delete this._groupCallbacks[t.mask],delete this._groupCallbackContext[t.mask]));var r=this.getCollisionMask();if(void 0===i)for(s=this.data.shapes.length-1;s>=0;s--)this.data.shapes[s].collisionMask=r;else i.collisionMask=r},collides:function(t,e,i,n){if(Array.isArray(t))for(var s=0;s=0;s--)this.data.shapes[s].collisionMask=r;else n.collisionMask=r},adjustCenterOfMass:function(){this.data.adjustCenterOfMass(),this.shapeChanged()},getVelocityAtPoint:function(t,e){return this.data.getVelocityAtPoint(t,e)},applyDamping:function(t){this.data.applyDamping(t)},applyImpulse:function(t,e,i){this.data.applyImpulse(t,[this.world.pxmi(e),this.world.pxmi(i)])},applyImpulseLocal:function(t,e,i){this.data.applyImpulseLocal(t,[this.world.pxmi(e),this.world.pxmi(i)])},applyForce:function(t,e,i){this.data.applyForce(t,[this.world.pxmi(e),this.world.pxmi(i)])},setZeroForce:function(){this.data.setZeroForce()},setZeroRotation:function(){this.data.angularVelocity=0},setZeroVelocity:function(){this.data.velocity[0]=0,this.data.velocity[1]=0},setZeroDamping:function(){this.data.damping=0,this.data.angularDamping=0},toLocalFrame:function(t,e){return this.data.toLocalFrame(t,e)},toWorldFrame:function(t,e){return this.data.toWorldFrame(t,e)},rotateLeft:function(t){this.data.angularVelocity=this.world.pxm(-t)},rotateRight:function(t){this.data.angularVelocity=this.world.pxm(t)},moveForward:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.velocity[0]=e*Math.cos(i),this.data.velocity[1]=e*Math.sin(i)},moveBackward:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.velocity[0]=-e*Math.cos(i),this.data.velocity[1]=-e*Math.sin(i)},thrust:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.force[0]+=e*Math.cos(i),this.data.force[1]+=e*Math.sin(i)},thrustLeft:function(t){var e=this.world.pxmi(-t),i=this.data.angle;this.data.force[0]+=e*Math.cos(i),this.data.force[1]+=e*Math.sin(i)},thrustRight:function(t){var e=this.world.pxmi(-t),i=this.data.angle;this.data.force[0]-=e*Math.cos(i),this.data.force[1]-=e*Math.sin(i)},reverse:function(t){var e=this.world.pxmi(-t),i=this.data.angle+Math.PI/2;this.data.force[0]-=e*Math.cos(i),this.data.force[1]-=e*Math.sin(i)},moveLeft:function(t){this.data.velocity[0]=this.world.pxmi(-t)},moveRight:function(t){this.data.velocity[0]=this.world.pxmi(t)},moveUp:function(t){this.data.velocity[1]=this.world.pxmi(-t)},moveDown:function(t){this.data.velocity[1]=this.world.pxmi(t)},preUpdate:function(){this.dirty=!0,this.removeNextStep&&(this.removeFromWorld(),this.removeNextStep=!1)},postUpdate:function(){this.sprite.x=this.world.mpxi(this.data.position[0])+this.offset.x,this.sprite.y=this.world.mpxi(this.data.position[1])+this.offset.y,this.fixedRotation||(this.sprite.rotation=this.data.angle),this.debugBody&&this.debugBody.updateSpriteTransform(),this.dirty=!1},reset:function(t,e,i,n){void 0===i&&(i=!1),void 0===n&&(n=!1),this.setZeroForce(),this.setZeroVelocity(),this.setZeroRotation(),i&&this.setZeroDamping(),n&&(this.mass=1),this.x=t,this.y=e},addToWorld:function(){if(this.game.physics.p2._toRemove)for(var t=0;t=0;i--)this.data.shapes[i].material=t;else e.material=t},shapeChanged:function(){this.debugBody&&this.debugBody.draw()},addPhaserPolygon:function(t,e){for(var i=this.game.cache.getPhysicsData(t,e),n=[],s=0;s +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.BodyDebug=function(t,e,i){n.Group.call(this,t);var s={pixelsPerLengthUnit:t.physics.p2.mpx(1),debugPolygons:!1,lineWidth:1,alpha:.5};this.settings=Object.assign(s,i),this.ppu=this.settings.pixelsPerLengthUnit,this.ppu=-1*this.ppu,this.body=e,this.canvas=new n.Graphics(t),this.canvas.alpha=this.settings.alpha,this.add(this.canvas),this.draw(),this.updateSpriteTransform()},n.Physics.P2.BodyDebug.prototype=Object.create(n.Group.prototype),n.Physics.P2.BodyDebug.prototype.constructor=n.Physics.P2.BodyDebug,Object.assign(n.Physics.P2.BodyDebug.prototype,{updateSpriteTransform:function(){this.position.x=this.body.position[0]*this.ppu,this.position.y=this.body.position[1]*this.ppu,this.rotation=this.body.angle},draw:function(){var t,e,i,n,s,r,o,a,h,l,c,u,d,p,f;if(a=this.body,(l=this.canvas).clear(),i=parseInt(this.randomPastelHex(),16),r=16711680,o=this.lineWidth,a instanceof p2.Body&&a.shapes.length){var g=a.shapes.length;for(n=0;n!==g;){if(h=(e=a.shapes[n]).position||0,t=e.angle||0,e instanceof p2.Circle)this.drawCircle(l,h[0]*this.ppu,h[1]*this.ppu,t,e.radius*this.ppu,i,o);else if(e instanceof p2.Capsule)this.drawCapsule(l,h[0]*this.ppu,h[1]*this.ppu,t,e.length*this.ppu,e.radius*this.ppu,r,i,o);else if(e instanceof p2.Plane)this.drawPlane(l,h[0]*this.ppu,-h[1]*this.ppu,i,r,5*o,10*o,10*o,100*this.ppu,t);else if(e instanceof p2.Line)this.drawLine(l,e.length*this.ppu,r,o);else if(e instanceof p2.Box)this.drawRectangle(l,h[0]*this.ppu,h[1]*this.ppu,t,e.width*this.ppu,e.height*this.ppu,r,i,o);else if(e instanceof p2.Convex){for(u=[],d=p2.vec2.create(),s=p=0,f=e.vertices.length;f>=0?pf;s=f>=0?++p:--p)c=e.vertices[s],p2.vec2.rotate(d,c,t),u.push([(d[0]+h[0])*this.ppu,-(d[1]+h[1])*this.ppu]);this.drawConvex(l,u,e.triangles,r,i,o,this.settings.debugPolygons,[h[0]*this.ppu,-h[1]*this.ppu])}n++}}},drawRectangle:function(t,e,i,n,s,r,o,a,h){void 0===h&&(h=1),void 0===o&&(o=0),t.lineStyle(h,o,1),t.beginFill(a),t.drawRect(e-s/2,i-r/2,s,r)},drawCircle:function(t,e,i,n,s,r,o){void 0===o&&(o=1),void 0===r&&(r=16777215),t.lineStyle(o,0,1),t.beginFill(r,1),t.drawCircle(e,i,2*-s),t.endFill(),t.moveTo(e,i),t.lineTo(e+s*Math.cos(-n),i+s*Math.sin(-n))},drawLine:function(t,e,i,n){void 0===n&&(n=1),void 0===i&&(i=0),t.lineStyle(5*n,i,1),t.moveTo(-e/2,0),t.lineTo(e/2,0)},drawConvex:function(t,e,i,n,s,r,o,a){var h,l,c,u,d,p,f,g,m,y,v;if(void 0===r&&(r=1),void 0===n&&(n=0),o){for(h=[16711680,65280,255],l=0;l!==e.length+1;)u=e[l%e.length],d=e[(l+1)%e.length],f=u[0],y=u[1],g=d[0],v=d[1],t.lineStyle(r,h[l%h.length],1),t.moveTo(f,-y),t.lineTo(g,-v),t.drawCircle(f,-y,2*r),l++;return t.lineStyle(r,0,1),t.drawCircle(a[0],a[1],2*r)}for(t.lineStyle(r,n,1),t.beginFill(s),l=0;l!==e.length;)p=(c=e[l])[0],m=c[1],0===l?t.moveTo(p,-m):t.lineTo(p,-m),l++;if(t.endFill(),e.length>2)return t.moveTo(e[e.length-1][0],-e[e.length-1][1]),t.lineTo(e[0][0],-e[0][1])},drawPath:function(t,e,i,n,s){var r,o,a,h,l,c,u,d,p,f,g;for(void 0===s&&(s=1),void 0===i&&(i=0),t.lineStyle(s,i,1),"number"==typeof n&&t.beginFill(n),o=null,a=null,r=0;r2&&"number"==typeof n&&(t.moveTo(e[e.length-1][0],e[e.length-1][1]),t.lineTo(e[0][0],e[0][1]))},drawPlane:function(t,e,i,n,s,r,o,a,h,l){var c,u;void 0===r&&(r=1),void 0===n&&(n=16777215),t.lineStyle(r,s,11),t.beginFill(n),t.moveTo(e,-i),c=e+Math.cos(l)*this.game.width,u=i+Math.sin(l)*this.game.height,t.lineTo(c,-u),t.moveTo(e,-i),c=e+Math.cos(l)*-this.game.width,u=i+Math.sin(l)*-this.game.height,t.lineTo(c,-u)},drawCapsule:function(t,e,i,n,s,r,o,a,h){void 0===h&&(h=1),void 0===o&&(o=0),t.lineStyle(h,o,1);var l=Math.cos(n),c=Math.sin(n);t.beginFill(a,1),t.drawCircle(-s/2*l+e,-s/2*c+i,2*-r),t.drawCircle(s/2*l+e,s/2*c+i,2*-r),t.endFill(),t.lineStyle(h,o,0),t.beginFill(a,1),t.moveTo(-s/2*l+r*c+e,-s/2*c+r*l+i),t.lineTo(s/2*l+r*c+e,s/2*c+r*l+i),t.lineTo(s/2*l-r*c+e,s/2*c-r*l+i),t.lineTo(-s/2*l-r*c+e,-s/2*c-r*l+i),t.endFill(),t.lineStyle(h,o,1),t.moveTo(-s/2*l+r*c+e,-s/2*c+r*l+i),t.lineTo(s/2*l+r*c+e,s/2*c+r*l+i),t.moveTo(-s/2*l-r*c+e,-s/2*c-r*l+i),t.lineTo(s/2*l-r*c+e,s/2*c-r*l+i)},randomPastelHex:function(){var t,e,i,n;return i=[255,255,255],n=Math.floor(256*Math.random()),e=Math.floor(256*Math.random()),t=Math.floor(256*Math.random()),n=Math.floor((n+3*i[0])/4),e=Math.floor((e+3*i[1])/4),t=Math.floor((t+3*i[2])/4),this.rgbToHex(n,e,t)},rgbToHex:function(t,e,i){return this.componentToHex(t)+this.componentToHex(e)+this.componentToHex(i)},componentToHex:function(t){var e;return 2===(e=t.toString(16)).length?e:e+"0"}}), +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.Spring=function(t,e,i,n,s,r,o,a,h,l){this.game=t.game,this.world=t,void 0===n&&(n=1),void 0===s&&(s=100),void 0===r&&(r=1);var c={restLength:n=t.pxm(n),stiffness:s,damping:r};null!=o&&(c.worldAnchorA=[t.pxm(o[0]),t.pxm(o[1])]),null!=a&&(c.worldAnchorB=[t.pxm(a[0]),t.pxm(a[1])]),null!=h&&(c.localAnchorA=[t.pxm(h[0]),t.pxm(h[1])]),null!=l&&(c.localAnchorB=[t.pxm(l[0]),t.pxm(l[1])]),this.data=new p2.LinearSpring(e,i,c),this.data.parent=this},n.Physics.P2.Spring.prototype.constructor=n.Physics.P2.Spring, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.RotationalSpring=function(t,e,i,n,s,r){this.game=t.game,this.world=t,void 0===n&&(n=null),void 0===s&&(s=100),void 0===r&&(r=1),n&&(n=t.pxm(n));var o={restAngle:n,stiffness:s,damping:r};this.data=new p2.RotationalSpring(e,i,o),this.data.parent=this},n.Physics.P2.Spring.prototype.constructor=n.Physics.P2.Spring, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.Material=function(t){this.name=t,p2.Material.call(this)},n.Physics.P2.Material.prototype=Object.create(p2.Material.prototype),n.Physics.P2.Material.prototype.constructor=n.Physics.P2.Material, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.ContactMaterial=function(t,e,i){p2.ContactMaterial.call(this,t,e,i)},n.Physics.P2.ContactMaterial.prototype=Object.create(p2.ContactMaterial.prototype),n.Physics.P2.ContactMaterial.prototype.constructor=n.Physics.P2.ContactMaterial, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.CollisionGroup=function(t){this.mask=t}, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.DistanceConstraint=function(t,e,i,n,s,r,o){void 0===n&&(n=100),void 0===s&&(s=[0,0]),void 0===r&&(r=[0,0]),void 0===o&&(o=Number.MAX_VALUE),this.game=t.game,this.world=t;var a={distance:n=t.pxm(n),localAnchorA:s=[t.pxmi(s[0]),t.pxmi(s[1])],localAnchorB:r=[t.pxmi(r[0]),t.pxmi(r[1])],maxForce:o};p2.DistanceConstraint.call(this,e,i,a)},n.Physics.P2.DistanceConstraint.prototype=Object.create(p2.DistanceConstraint.prototype),n.Physics.P2.DistanceConstraint.prototype.constructor=n.Physics.P2.DistanceConstraint, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.GearConstraint=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=1),this.game=t.game,this.world=t;var r={angle:n,ratio:s};p2.GearConstraint.call(this,e,i,r)},n.Physics.P2.GearConstraint.prototype=Object.create(p2.GearConstraint.prototype),n.Physics.P2.GearConstraint.prototype.constructor=n.Physics.P2.GearConstraint, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.LockConstraint=function(t,e,i,n,s,r){void 0===n&&(n=[0,0]),void 0===s&&(s=0),void 0===r&&(r=Number.MAX_VALUE),this.game=t.game,this.world=t;var o={localOffsetB:n=[t.pxm(n[0]),t.pxm(n[1])],localAngleB:s,maxForce:r};p2.LockConstraint.call(this,e,i,o)},n.Physics.P2.LockConstraint.prototype=Object.create(p2.LockConstraint.prototype),n.Physics.P2.LockConstraint.prototype.constructor=n.Physics.P2.LockConstraint, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.PrismaticConstraint=function(t,e,i,n,s,r,o,a){void 0===n&&(n=!0),void 0===s&&(s=[0,0]),void 0===r&&(r=[0,0]),void 0===o&&(o=[0,0]),void 0===a&&(a=Number.MAX_VALUE),this.game=t.game,this.world=t;var h={localAnchorA:s=[t.pxmi(s[0]),t.pxmi(s[1])],localAnchorB:r=[t.pxmi(r[0]),t.pxmi(r[1])],localAxisA:o,maxForce:a,disableRotationalLock:!n};p2.PrismaticConstraint.call(this,e,i,h)},n.Physics.P2.PrismaticConstraint.prototype=Object.create(p2.PrismaticConstraint.prototype),n.Physics.P2.PrismaticConstraint.prototype.constructor=n.Physics.P2.PrismaticConstraint, +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Physics.P2.RevoluteConstraint=function(t,e,i,n,s,r,o){void 0===r&&(r=Number.MAX_VALUE),void 0===o&&(o=null),this.game=t.game,this.world=t,i=[t.pxmi(i[0]),t.pxmi(i[1])],s=[t.pxmi(s[0]),t.pxmi(s[1])],o&&(o=[t.pxmi(o[0]),t.pxmi(o[1])]);var a={worldPivot:o,localPivotA:i,localPivotB:s,maxForce:r};p2.RevoluteConstraint.call(this,e,n,a)},n.Physics.P2.RevoluteConstraint.prototype=Object.create(p2.RevoluteConstraint.prototype),n.Physics.P2.RevoluteConstraint.prototype.constructor=n.Physics.P2.RevoluteConstraint, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.ImageCollection=function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.imageWidth=0|i,this.imageHeight=0|n,this.imageMargin=0|s,this.imageSpacing=0|r,this.properties=o||{},this.images=[],this.total=0},n.ImageCollection.prototype={containsImageIndex:function(t){return t>=this.firstgid&&t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Tile=function(t,e,i,n,s,r){this.layer=t,this.index=e,this.x=i,this.y=n,this.rotation=0,this.flipped=!1,this.worldX=i*s,this.worldY=n*r,this.width=s,this.height=r,this.centerX=Math.abs(s/2),this.centerY=Math.abs(r/2),this.alpha=1,this.properties={},this.scanned=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1,this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.collisionCallback=null,this.collisionCallbackContext=this,this.debug=!1},n.Tile.prototype={containsPoint:function(t,e){return!(tthis.right||e>this.bottom)},intersects:function(t,e,i,n){return!(i<=this.worldX)&&(!(n<=this.worldY)&&(!(t>=this.worldX+this.width)&&!(e>=this.worldY+this.height)))},setCollisionCallback:function(t,e){this.collisionCallback=t,this.collisionCallbackContext=e},destroy:function(){this.collisionCallback=null,this.collisionCallbackContext=null,this.properties=null},setCollision:function(t,e,i,n){this.collideLeft=t,this.collideRight=e,this.collideUp=i,this.collideDown=n,this.faceLeft=t,this.faceRight=e,this.faceTop=i,this.faceBottom=n},resetCollision:function(){this.collideLeft=!1,this.collideRight=!1,this.collideUp=!1,this.collideDown=!1,this.faceTop=!1,this.faceBottom=!1,this.faceLeft=!1,this.faceRight=!1},isInteresting:function(t,e){return t&&e?this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.faceTop||this.faceBottom||this.faceLeft||this.faceRight||this.collisionCallback:t?this.collideLeft||this.collideRight||this.collideUp||this.collideDown:!!e&&(this.faceTop||this.faceBottom||this.faceLeft||this.faceRight)},copy:function(t){this.index=t.index,this.alpha=t.alpha,this.properties=t.properties,this.collideUp=t.collideUp,this.collideDown=t.collideDown,this.collideLeft=t.collideLeft,this.collideRight=t.collideRight,this.collisionCallback=t.collisionCallback,this.collisionCallbackContext=t.collisionCallbackContext}},n.Tile.prototype.constructor=n.Tile,Object.defineProperty(n.Tile.prototype,"collides",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown}}),Object.defineProperty(n.Tile.prototype,"canCollide",{get:function(){return this.collideLeft||this.collideRight||this.collideUp||this.collideDown||this.collisionCallback}}),Object.defineProperty(n.Tile.prototype,"left",{get:function(){return this.worldX}}),Object.defineProperty(n.Tile.prototype,"right",{get:function(){return this.worldX+this.width}}),Object.defineProperty(n.Tile.prototype,"top",{get:function(){return this.worldY}}),Object.defineProperty(n.Tile.prototype,"bottom",{get:function(){return this.worldY+this.height}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Tilemap=function(t,e,i,s,r,o){this.game=t,this.key=e;var a=n.TilemapParser.parse(this.game,e,i,s,r,o);null!==a&&(this.width=a.width,this.height=a.height,this.tileWidth=a.tileWidth,this.tileHeight=a.tileHeight,this.orientation=a.orientation,this.format=a.format,this.version=a.version,this.properties=a.properties,this.widthInPixels=a.widthInPixels,this.heightInPixels=a.heightInPixels,this.layers=a.layers,this.tilesets=a.tilesets,this.imagecollections=a.imagecollections,this.tiles=a.tiles,this.objects=a.objects,this.collideIndexes=[],this.collision=a.collision,this.images=a.images,this.enableDebug=!1,this.currentLayer=0,this.debugMap=[],this._results=[],this._tempA=0,this._tempB=0)},n.Tilemap.CSV=0,n.Tilemap.TILED_JSON=1,n.Tilemap.NORTH=0,n.Tilemap.EAST=1,n.Tilemap.SOUTH=2,n.Tilemap.WEST=3,n.Tilemap.prototype={create:function(t,e,i,n,s,r){return void 0===r&&(r=this.game.world),this.width=e,this.height=i,this.setTileSize(n,s),this.layers.length=0,this.createBlankLayer(t,e,i,n,s,r)},setTileSize:function(t,e){this.tileWidth=t,this.tileHeight=e,this.widthInPixels=this.width*t,this.heightInPixels=this.height*e},addTilesetImage:function(t,e,i,s,r,o,a){if(void 0===t)return null;void 0===i&&(i=this.tileWidth),void 0===s&&(s=this.tileHeight),void 0===r&&(r=0),void 0===o&&(o=0),void 0===a&&(a=0),0===i&&(i=32),0===s&&(s=32);var h=null;if(null==e&&(e=t),e instanceof n.BitmapData)h=e.canvas;else{if(!this.game.cache.checkImageKey(e))return console.warn('Phaser.Tilemap.addTilesetImage: Invalid image key given: "'+e+'"'),null;h=this.game.cache.getImage(e)}var l=this.getTilesetIndex(t);if(null===l&&this.format===n.Tilemap.TILED_JSON)return console.warn('Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "'+t+'"'),console.log("Tilesets: ",this.tilesets),null;if(this.tilesets[l])return this.tilesets[l].setImage(h),this.tilesets[l];var c=new n.Tileset(t,a,i,s,r,o,{});c.setImage(h),this.tilesets.push(c);for(var u=this.tilesets.length-1,d=r,p=r,f=0,g=0,m=0,y=a;y1)for(u=0;uthis.layers.length)return console.warn('Tilemap.createLayer: Invalid layer ID given: "'+t+'"'),void console.log("Layers: ",this.layers);void 0===e||e<=0?e=Math.min(this.game.width,this.layers[r].widthInPixels):e>this.game.width&&(e=this.game.width),void 0===i||i<=0?i=Math.min(this.game.height,this.layers[r].heightInPixels):i>this.game.height&&(i=this.game.height),this.enableDebug&&(console.group("Tilemap.createLayer"),console.log("Name:",this.layers[r].name),console.log("Size:",e,"x",i),console.log("Tileset:",this.tilesets[0].name,"index:",r));var o=s.add(new n.TilemapLayer(this.game,this,r,e,i));return this.enableDebug&&console.groupEnd(),o},createBlankLayer:function(t,e,i,s,r,o){if(void 0===o&&(o=this.game.world),null===this.getLayerIndex(t)){for(var a,h={name:t,x:0,y:0,width:e,height:i,widthInPixels:e*s,heightInPixels:i*r,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:null},l=[],c=0;cthis.game.width&&(d=this.game.width),p>this.game.height&&(p=this.game.height),(l=new n.TilemapLayer(this.game,this,this.layers.length-1,d,p)).name=t,o.add(l)}console.warn("Tilemap.createBlankLayer: Layer with matching name already exists: "+t)},getIndex:function(t,e){for(var i=0;ie)){for(var r=t;r<=e;r++)this.setCollisionByIndex(r,i,n,!1);s&&this.calculateFaces(n)}},setCollisionByExclusion:function(t,e,i,n){void 0===e&&(e=!0),void 0===n&&(n=!0),i=this.getLayer(i);for(var s=0,r=this.tiles.length;s-1&&this.collideIndexes.splice(s,1)}for(var r=0;r0?this.layers[t].data[i-1][e]:null},getTileBelow:function(t,e,i){return i0?this.layers[t].data[i][e-1]:null},getTileRight:function(t,e,i){return e-1},removeTile:function(t,e,i){if(i=this.getLayer(i),t>=0&&t=0&&e=0&&e=0&&i-1?this.layers[s].data[i][e].setCollision(!0,!0,!0,!0):this.layers[s].data[i][e].resetCollision(),this.layers[s].dirty=!0,this.calculateFaces(s),this.layers[s].data[i][e]):null);var r},putTileWorldXY:function(t,e,i,n,s,r){return r=this.getLayer(r),e=this.game.math.snapToFloor(e,n)/n,i=this.game.math.snapToFloor(i,s)/s,this.putTile(t,e,i,r)},searchTileIndex:function(t,e,i,n,s){void 0===e&&(e=0),void 0===i&&(i=!1),n=this.getLayer(n);var r,o,a=0,h=this.layers[n].height,l=this.layers[n].width,c=this.layers[n].data;if(s)var u=[];if(i)for(var d=h-1;d>=0;d--){r=c[d];for(var p=l-1;p>=0;p--)if((o=r[p]).index===t)if(a>=e){if(!s)return o;u.push(o)}else a++}else for(d=0;d=e){if(!s)return o;u.push(o)}else a++}return s?u:null},getTile:function(t,e,i,n){return void 0===n&&(n=!1),i=this.getLayer(i),t>=0&&t=0&&ethis.layers[s].width&&(i=this.layers[s].width),n>this.layers[s].height&&(n=this.layers[s].height),this._results.length=0,this._results.push({x:t,y:e,width:i,height:n,layer:s});for(var r=e;r1?this.debugMap[this.layers[this.currentLayer].data[i][n]]?e.push("background: "+this.debugMap[this.layers[this.currentLayer].data[i][n]]):e.push("background: #ffffff"):e.push("background: rgb(0, 0, 0)");t+="\n"}e[0]=t,console.log.apply(console,e)},destroy:function(){this.removeAllLayers(),this.data=[],this.game=null}},n.Tilemap.prototype.constructor=n.Tilemap,Object.defineProperty(n.Tilemap.prototype,"layer",{get:function(){return this.layers[this.currentLayer]},set:function(t){t!==this.currentLayer&&this.setLayer(t)}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.TilemapLayer=function(t,e,i,s,r){s|=0,r|=0,n.Sprite.call(this,t,0,0),this.map=e,this.index=i,this.layer=e.layers[i],this.canvas=n.CanvasPool.create(this,s,r),this.context=this.canvas.getContext("2d"),this.setTexture(new PIXI.Texture(new PIXI.BaseTexture(this.canvas,null,this.game.resolution))),this.type=n.TILEMAPLAYER,this.physicsType=n.TILEMAPLAYER,this.renderSettings={enableScrollDelta:!0,overdrawRatio:.2,copyCanvas:null},this.debug=!1,this.exists=!0,this.debugSettings={missingImageFill:"rgb(255,255,255)",debuggedTileOverfill:"rgba(0,255,0,0.4)",forceFullRedraw:!0,debugAlpha:.5,facingEdgeStroke:"rgba(0,255,0,1)",collidingTileOverfill:"rgba(0,255,0,0.2)"},this.scrollFactorX=1,this.scrollFactorY=1,this.dirty=!0,this.rayStepRate=4,this._wrap=!1,this._mc={scrollX:0,scrollY:0,renderWidth:0,renderHeight:0,tileWidth:e.tileWidth,tileHeight:e.tileHeight,cw:e.tileWidth,ch:e.tileHeight,tilesets:[]},this._scrollX=0,this._scrollY=0,this.tileOffset=new n.Point(this.layer.offsetX||0,this.layer.offsetY||0),this._results=[],t.device.canvasBitBltShift||(this.renderSettings.copyCanvas=n.TilemapLayer.ensureSharedCopyCanvas()),this.fixedToCamera=!0},n.TilemapLayer.prototype=Object.create(n.Sprite.prototype),n.TilemapLayer.prototype.constructor=n.TilemapLayer,n.TilemapLayer.prototype.preUpdateCore=n.Component.Core.preUpdate,n.TilemapLayer.sharedCopyCanvas=null,n.TilemapLayer.ensureSharedCopyCanvas=function(){return this.sharedCopyCanvas||(this.sharedCopyCanvas=n.CanvasPool.create(this,2,2)),this.sharedCopyCanvas},n.TilemapLayer.prototype.preUpdate=function(){return this.preUpdateCore()},n.TilemapLayer.prototype.postUpdate=function(){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y},n.TilemapLayer.prototype._renderCanvas=function(t){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y,this.render(),PIXI.Sprite.prototype._renderCanvas.call(this,t)},n.TilemapLayer.prototype._renderWebGL=function(t){this.fixedToCamera&&(this.position.x=(this.game.camera.view.x+this.cameraOffset.x)/this.game.camera.scale.x,this.position.y=(this.game.camera.view.y+this.cameraOffset.y)/this.game.camera.scale.y),this._scrollX=(this.game.camera.view.x-this.tileOffset.x)*this.scrollFactorX/this.scale.x,this._scrollY=(this.game.camera.view.y-this.tileOffset.y)*this.scrollFactorY/this.scale.y,this.render(),PIXI.Sprite.prototype._renderWebGL.call(this,t)},n.TilemapLayer.prototype.destroy=function(){n.CanvasPool.remove(this),n.Component.Destroy.prototype.destroy.call(this)},n.TilemapLayer.prototype.resize=function(t,e){this.canvas.width=t,this.canvas.height=e,this.texture.frame.resize(t,e),this.texture.width=t,this.texture.height=e,this.texture.crop.width=t,this.texture.crop.height=e,this.texture.baseTexture.width=t,this.texture.baseTexture.height=e,this.texture.baseTexture.dirty(),this.texture.requiresUpdate=!0,this.texture._updateUvs(),this.dirty=!0},n.TilemapLayer.prototype.resizeWorld=function(){this.game.world.setBounds(0,0,this.layer.widthInPixels*this.scale.x,this.layer.heightInPixels*this.scale.y)},n.TilemapLayer.prototype.getTileOffsetX=function(){return this.tileOffset.x||(this.fixedToCamera?0:this.position.x)},n.TilemapLayer.prototype.getTileOffsetY=function(){return this.tileOffset.y||(this.fixedToCamera?0:this.position.y)},n.TilemapLayer.prototype._fixX=function(t){return 1===this.scrollFactorX||0===this.scrollFactorX&&0===this.position.x?t:0===this.scrollFactorX&&0!==this.position.x?t-this.position.x:this._scrollX+(t-this._scrollX/this.scrollFactorX)},n.TilemapLayer.prototype._unfixX=function(t){return 1===this.scrollFactorX?t:this._scrollX/this.scrollFactorX+(t-this._scrollX)},n.TilemapLayer.prototype._fixY=function(t){return 1===this.scrollFactorY||0===this.scrollFactorY&&0===this.position.y?t:0===this.scrollFactorY&&0!==this.position.y?t-this.position.y:this._scrollY+(t-this._scrollY/this.scrollFactorY)},n.TilemapLayer.prototype._unfixY=function(t){return 1===this.scrollFactorY?t:this._scrollY/this.scrollFactorY+(t-this._scrollY)},n.TilemapLayer.prototype.getTileX=function(t){return Math.floor(this._fixX(t)/this._mc.tileWidth)},n.TilemapLayer.prototype.getTileY=function(t){return Math.floor(this._fixY(t)/this._mc.tileHeight)},n.TilemapLayer.prototype.getTileXY=function(t,e,i){return i.x=this.getTileX(t),i.y=this.getTileY(e),i},n.TilemapLayer.prototype.getRayCastTiles=function(t,e,i,n){e||(e=this.rayStepRate),void 0===i&&(i=!1),void 0===n&&(n=!1);var s=this.getTiles(t.x,t.y,t.width,t.height,i,n);if(0===s.length)return[];for(var r=t.coordinatesOnLine(e),o=[],a=0;a=0;m++,v--,f+=c){m>=h&&(m-=h);var w=this.layer.data[m];for(g=x,y=s-i,p=b;y>=0;g++,y--,p+=l){g>=a&&(g-=a);var _=w[g];if(_&&!(_.index<0)){var T=_.index,C=u[T];void 0===C&&(C=this.resolveTileset(T)),_.alpha===d||this.debug||(o.globalAlpha=_.alpha,d=_.alpha),C?_.rotation||_.flipped?(o.save(),o.translate(p+_.centerX,f+_.centerY),o.rotate(_.rotation),_.flipped&&o.scale(-1,1),C.draw(o,-_.centerX,-_.centerY,T),o.restore()):C.draw(o,p,f,T):this.debugSettings.missingImageFill&&(o.fillStyle=this.debugSettings.missingImageFill,o.fillRect(p,f,l,c)),_.debug&&this.debugSettings.debuggedTileOverfill&&(o.fillStyle=this.debugSettings.debuggedTileOverfill,o.fillRect(p,f,l,c))}}}},n.TilemapLayer.prototype.renderDeltaScroll=function(t,e){var i=this._mc.scrollX,n=this._mc.scrollY,s=this.canvas.width,r=this.canvas.height,o=this._mc.tileWidth,a=this._mc.tileHeight,h=0,l=-o,c=0,u=-a;if(t<0?(h=s+t,l=s-1):t>0&&(l=t),e<0?(c=r+e,u=r-1):e>0&&(u=e),this.shiftCanvas(this.context,t,e),h=Math.floor((h+i)/o),l=Math.floor((l+i)/o),c=Math.floor((c+n)/a),u=Math.floor((u+n)/a),h<=l){this.context.clearRect(h*o-i,0,(l-h+1)*o,r);var d=Math.floor((0+n)/a),p=Math.floor((r-1+n)/a);this.renderRegion(i,n,h,d,l,p)}if(c<=u){this.context.clearRect(0,c*a-n,s,(u-c+1)*a);var f=Math.floor((0+i)/o),g=Math.floor((s-1+i)/o);this.renderRegion(i,n,f,c,g,u)}},n.TilemapLayer.prototype.renderFull=function(){var t=this._mc.scrollX,e=this._mc.scrollY,i=this.canvas.width,n=this.canvas.height,s=this._mc.tileWidth,r=this._mc.tileHeight,o=Math.floor(t/s),a=Math.floor((i-1+t)/s),h=Math.floor(e/r),l=Math.floor((n-1+e)/r);this.context.clearRect(0,0,i,n),this.renderRegion(t,e,o,h,a,l)},n.TilemapLayer.prototype.render=function(){var t=!1;if(this.visible){(this.dirty||this.layer.dirty)&&(this.layer.dirty=!1,t=!0);var e=this.canvas.width,i=this.canvas.height,n=0|this._scrollX,s=0|this._scrollY,r=this._mc,o=r.scrollX-n,a=r.scrollY-s;if(t||0!==o||0!==a||r.renderWidth!==e||r.renderHeight!==i)return this.context.save(),r.scrollX=n,r.scrollY=s,r.renderWidth===e&&r.renderHeight===i||(r.renderWidth=e,r.renderHeight=i),this.debug&&(this.context.globalAlpha=this.debugSettings.debugAlpha,this.debugSettings.forceFullRedraw&&(t=!0)),!t&&this.renderSettings.enableScrollDelta&&Math.abs(o)+Math.abs(a)=0;n++,r--,e+=f){n>=d&&(n-=d);var T=this.layer.data[n];for(i=w,s=m-g,t=b;s>=0;i++,s--,t+=p){i>=u&&(i-=u);var C=T[i];!C||C.index<0||!C.collides||(this.debugSettings.collidingTileOverfill&&(h.fillStyle=this.debugSettings.collidingTileOverfill,h.fillRect(t,e,this._mc.cw,this._mc.ch)),this.debugSettings.facingEdgeStroke&&(h.beginPath(),C.faceTop&&(h.moveTo(t,e),h.lineTo(t+this._mc.cw,e)),C.faceBottom&&(h.moveTo(t,e+this._mc.ch),h.lineTo(t+this._mc.cw,e+this._mc.ch)),C.faceLeft&&(h.moveTo(t,e),h.lineTo(t,e+this._mc.ch)),C.faceRight&&(h.moveTo(t+this._mc.cw,e),h.lineTo(t+this._mc.cw,e+this._mc.ch)),h.closePath(),h.stroke()))}}},Object.defineProperty(n.TilemapLayer.prototype,"wrap",{get:function(){return this._wrap},set:function(t){this._wrap=t,this.dirty=!0}}),Object.defineProperty(n.TilemapLayer.prototype,"scrollX",{get:function(){return this._scrollX},set:function(t){this._scrollX=t}}),Object.defineProperty(n.TilemapLayer.prototype,"scrollY",{get:function(){return this._scrollY},set:function(t){this._scrollY=t}}),Object.defineProperty(n.TilemapLayer.prototype,"collisionWidth",{get:function(){return this._mc.cw},set:function(t){this._mc.cw=0|t,this.dirty=!0}}),Object.defineProperty(n.TilemapLayer.prototype,"collisionHeight",{get:function(){return this._mc.ch},set:function(t){this._mc.ch=0|t,this.dirty=!0}}), +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.TilemapParser={INSERT_NULL:!1,parse:function(t,e,i,s,r,o){if(void 0===i&&(i=32),void 0===s&&(s=32),void 0===r&&(r=10),void 0===o&&(o=10),void 0===e)return this.getEmptyData();if(null===e)return this.getEmptyData(i,s,r,o);var a=t.cache.getTilemapData(e);if(a){if(a.format===n.Tilemap.CSV)return this.parseCSV(e,a.data,i,s);if(!a.format||a.format===n.Tilemap.TILED_JSON)return this.parseTiledJSON(a.data)}else console.warn('No map data found for key "%s"',e)},parseCSV:function(t,e,i,s){for(var r=this.getEmptyData(),o=[],a=(e=e.trim()).split("\n"),h=a.length,l=0,c=0;c1.1&&console.warn('Some features in this Tiled JSON map (version %s) may not work in Phaser CE. Enable the json1 plugin and reexport the map in "Tiled 1.1" format. https://github.com/photonstorm/phaser-ce/issues/623',t.version);for(var e={width:t.width,height:t.height,tileWidth:t.tilewidth,tileHeight:t.tileheight,orientation:t.orientation,format:n.Tilemap.TILED_JSON,version:t.version,properties:t.properties,widthInPixels:t.width*t.tilewidth,heightInPixels:t.height*t.tileheight},i=[],s=0;s>>0;r.data=h,delete r.encoding}else if(r.compression){console.warn('Layer compression is unsupported, skipping layer "%s".',r.name);continue}var c={name:r.name,x:r.x,y:r.y,width:r.width,height:r.height,widthInPixels:r.width*t.tilewidth,heightInPixels:r.height*t.tileheight,alpha:r.opacity,offsetX:r.offsetx,offsetY:r.offsety,visible:r.visible,properties:{},indexes:[],callbacks:[],bodies:[]};r.properties&&(c.properties=r.properties);var u,d,p,f=0,g=[],m=[],y=0;for(a=r.data.length;y536870912)switch(E>2147483648&&(E-=2147483648,p+=4),E>1073741824&&(E-=1073741824,p+=2),E>536870912&&(E-=536870912,p+=1),p){case 5:u=Math.PI/2;break;case 6:u=Math.PI;break;case 3:u=3*Math.PI/2;break;case 4:u=0,d=!0;break;case 7:u=Math.PI/2,d=!0;break;case 2:u=Math.PI,d=!0;break;case 1:u=3*Math.PI/2,d=!0}if(E>0)(M=new n.Tile(c,E,f,m.length,t.tilewidth,t.tileheight)).rotation=u,M.flipped=d,0!==p&&(M.flippedVal=p),g.push(M);else n.TilemapParser.INSERT_NULL?g.push(null):g.push(new n.Tile(c,-1,f,m.length,t.tilewidth,t.tileheight));++f===r.width&&(m.push(g),f=0,g=[])}c.data=m,i.push(c)}e.layers=i;var v=[];for(s=0;s + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Tileset=function(t,e,i,n,s,r,o){(void 0===i||i<=0)&&(i=32),(void 0===n||n<=0)&&(n=32),void 0===s&&(s=0),void 0===r&&(r=0),this.name=t,this.firstgid=0|e,this.tileWidth=0|i,this.tileHeight=0|n,this.tileMargin=0|s,this.tileSpacing=0|r,this.properties=o||{},this.image=null,this.rows=0,this.columns=0,this.total=0,this.drawCoords=[]},n.Tileset.prototype={draw:function(t,e,i,n){var s=n-this.firstgid<<1;s>=0&&s+1=this.firstgid&&t + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Particle=function(t,e,i,s,r){n.Sprite.call(this,t,e,i,s,r),this.autoScale=!1,this.scaleData=null,this._s=0,this.autoAlpha=!1,this.alphaData=null,this._a=0},n.Particle.prototype=Object.create(n.Sprite.prototype),n.Particle.prototype.constructor=n.Particle,n.Particle.prototype.update=function(){this.autoScale&&(this._s--,this._s?this.scale.set(this.scaleData[this._s].x,this.scaleData[this._s].y):this.autoScale=!1),this.autoAlpha&&(this._a--,this._a?this.alpha=this.alphaData[this._a].v:this.autoAlpha=!1)},n.Particle.prototype.onEmit=function(){},n.Particle.prototype.setAlphaData=function(t){this.alphaData=t,this._a=t.length-1,this.alpha=this.alphaData[this._a].v,this.autoAlpha=!0},n.Particle.prototype.setScaleData=function(t){this.scaleData=t,this._s=t.length-1,this.scale.set(this.scaleData[this._s].x,this.scaleData[this._s].y),this.autoScale=!0},n.Particle.prototype.reset=function(t,e,i){return n.Component.Reset.prototype.reset.call(this,t,e,i),this.alpha=1,this.scale.set(1),this.autoScale=!1,this.autoAlpha=!1,this}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Particles=function(t){this.game=t,this.emitters={},this.ID=0},n.Particles.prototype={add:function(t){return this.emitters[t.id]=t,t},remove:function(t){delete this.emitters[t.id]}},n.Particles.prototype.constructor=n.Particles, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Particles.Arcade={}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Particles.Arcade.Emitter=function(t,e,i,s){this.maxParticles=s||50,n.Group.call(this,t),this._id=this.game.particles.ID++,this.name="emitter"+this.id,this.type=n.EMITTER,this.physicsType=n.GROUP,this.area=new n.Rectangle(e,i,1,1),this.minAngle=null,this.maxAngle=null,this.minSpeed=0,this.maxSpeed=100,this.minParticleSpeed=new n.Point(-100,-100),this.maxParticleSpeed=new n.Point(100,100),this.minParticleScale=1,this.maxParticleScale=1,this.scaleData=null,this.minRotation=-360,this.maxRotation=360,this.minParticleAlpha=1,this.maxParticleAlpha=1,this.alphaData=null,this.particleClass=n.Particle,this.particleDrag=new n.Point,this.angularDrag=0,this.frequency=100,this.lifespan=2e3,this.bounce=new n.Point,this.on=!1,this.particleAnchor=new n.Point(.5,.5),this.blendMode=n.blendModes.NORMAL,this.emitX=e,this.emitY=i,this.autoScale=!1,this.autoAlpha=!1,this.particleBringToTop=!1,this.particleSendToBack=!1,this.counts={emitted:0,failed:0,totalEmitted:0,totalFailed:0},this._gravity=new n.Point(0,100),this._minParticleScale=new n.Point(1,1),this._maxParticleScale=new n.Point(1,1),this._total=0,this._timer=0,this._counter=0,this._flowQuantity=0,this._flowTotal=0,this._explode=!0,this._frames=null},n.Particles.Arcade.Emitter.prototype=Object.create(n.Group.prototype),n.Particles.Arcade.Emitter.prototype.constructor=n.Particles.Arcade.Emitter,n.Particles.Arcade.Emitter.prototype.update=function(){if(this.counts.emitted=0,this.counts.failed=0,this.on&&this.game.time.time>=this._timer)if(this._timer=this.game.time.time+this.frequency*this.game.time.slowMotion,0!==this._flowTotal)if(this._flowQuantity>0){for(var t=0;t=this._flowTotal)){this.on=!1;break}}else this.emitParticle()&&(this._counter++,-1!==this._flowTotal&&this._counter>=this._flowTotal&&(this.on=!1));else this.emitParticle()&&(this._counter++,this._total>0&&this._counter>=this._total&&(this.on=!1));for(t=this.children.length;t--;)this.children[t].exists&&this.children[t].update()},n.Particles.Arcade.Emitter.prototype.makeParticles=function(t,e,i,n,s,r){var o;void 0===e&&(e=0),void 0===i&&(i=this.maxParticles),void 0===n&&(n=!1),void 0===s&&(s=!1),void 0===r&&(r=null);var a=0,h=t,l=e;for(this._frames=e,i>this.maxParticles&&(this.maxParticles=i);athis.maxParticles&&(i=this.maxParticles),this._counter=0,this._flowQuantity=i,this._flowTotal=n,s?(this.start(!0,t,e,i),this._counter+=i,this.on=!0,this._timer=this.game.time.time+e*this.game.time.slowMotion):this.start(!1,t,e,i),this},n.Particles.Arcade.Emitter.prototype.start=function(t,e,i,n,s){if(void 0===t&&(t=!0),void 0===e&&(e=0),null==i&&(i=250),void 0===n&&(n=0),void 0===s&&(s=!1),n>this.maxParticles&&(n=this.maxParticles),this.revive(),this.visible=!0,this.lifespan=e,this.frequency=i,t||s)for(var r=0;r1&&(o=r.between(this.left,this.right)),null!==e?a=e:this.height>1&&(a=r.between(this.top,this.bottom)),this.resetParticle(s,o,a),!0},n.Particles.Arcade.Emitter.prototype.getNextParticle=function(){for(var t=this.length;t--;){var e=this.next();if(!e.exists)return e}return null},n.Particles.Arcade.Emitter.prototype.resetParticle=function(t,e,i){var n=this.game.rnd;t.reset(e,i),t.angle=0,t.lifespan=this.lifespan,this.particleBringToTop?this.bringToTop(t):this.particleSendToBack&&this.sendToBack(t),this.autoScale?t.setScaleData(this.scaleData):1!==this.minParticleScale||1!==this.maxParticleScale?t.scale.set(n.realInRange(this.minParticleScale,this.maxParticleScale)):this._minParticleScale.x!==this._maxParticleScale.x||this._minParticleScale.y!==this._maxParticleScale.y?t.scale.set(n.realInRange(this._minParticleScale.x,this._maxParticleScale.x),n.realInRange(this._minParticleScale.y,this._maxParticleScale.y)):t.scale.set(this._minParticleScale.x,this._minParticleScale.y),this.autoAlpha?t.setAlphaData(this.alphaData):t.alpha=n.realInRange(this.minParticleAlpha,this.maxParticleAlpha),t.blendMode=this.blendMode;var s=t.body;s.updateBounds(),s.bounce.copyFrom(this.bounce),s.drag.copyFrom(this.particleDrag),null!=this.minAngle&&null!=this.maxAngle?this.game.physics.arcade.velocityFromAngle(this.minAngle===this.maxAngle?this.minAngle:n.between(this.minAngle,this.maxAngle),this.minSpeed===this.maxSpeed?this.minSpeed:n.between(this.minSpeed,this.maxSpeed),s.velocity):(s.velocity.x=n.between(this.minParticleSpeed.x,this.maxParticleSpeed.x),s.velocity.y=n.between(this.minParticleSpeed.y,this.maxParticleSpeed.y)),s.angularVelocity=n.between(this.minRotation,this.maxRotation),s.gravity.copyFrom(this.gravity),s.angularDrag=this.angularDrag,t.onEmit()},n.Particles.Arcade.Emitter.prototype.destroy=function(){this.game.particles.remove(this),n.Group.prototype.destroy.call(this,!0,!1)},n.Particles.Arcade.Emitter.prototype.setSize=function(t,e){return this.area.width=t,this.area.height=e,this},n.Particles.Arcade.Emitter.prototype.setXSpeed=function(t,e){return t=t||0,e=e||0,this.minParticleSpeed.x=t,this.maxParticleSpeed.x=e,this},n.Particles.Arcade.Emitter.prototype.setYSpeed=function(t,e){return t=t||0,e=e||0,this.minParticleSpeed.y=t,this.maxParticleSpeed.y=e,this},n.Particles.Arcade.Emitter.prototype.setRotation=function(t,e){return t=t||0,e=e||0,this.minRotation=t,this.maxRotation=e,this},n.Particles.Arcade.Emitter.prototype.setAlpha=function(t,e,i,s,r){if(void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=0),void 0===s&&(s=n.Easing.Linear.None),void 0===r&&(r=!1),this.minParticleAlpha=t,this.maxParticleAlpha=e,this.autoAlpha=!1,i>0&&t!==e){var o={v:t},a=this.game.make.tween(o).to({v:e},i,s);a.yoyo(r),this.alphaData=a.generateData(60),this.alphaData.reverse(),this.autoAlpha=!0}return this},n.Particles.Arcade.Emitter.prototype.setScale=function(t,e,i,s,r,o,a){if(void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===s&&(s=1),void 0===r&&(r=0),void 0===o&&(o=n.Easing.Linear.None),void 0===a&&(a=!1),this.minParticleScale=1,this.maxParticleScale=1,this._minParticleScale.set(t,i),this._maxParticleScale.set(e,s),this.autoScale=!1,r>0&&(t!==e||i!==s)){var h={x:t,y:i},l=this.game.make.tween(h).to({x:e,y:s},r,o);l.yoyo(a),this.scaleData=l.generateData(60),this.scaleData.reverse(),this.autoScale=!0}return this},n.Particles.Arcade.Emitter.prototype.setAngle=function(t,e,i,n){return this.minAngle=t,this.maxAngle=e,null!=i&&(this.minSpeed=i),null!=n&&(this.maxSpeed=n),this},n.Particles.Arcade.Emitter.prototype.at=function(t){return t.center?(this.emitX=t.center.x,this.emitY=t.center.y):(this.emitX=t.world.x+t.anchor.x*t.width,this.emitY=t.world.y+t.anchor.y*t.height),this},Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"gravity",{get:function(){return this._gravity},set:function(t){"number"==typeof t?this._gravity.y=t:this._gravity=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"id",{get:function(){return this._id}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"width",{get:function(){return this.area.width},set:function(t){this.area.width=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"height",{get:function(){return this.area.height},set:function(t){this.area.height=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(t){this.emitX=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(t){this.emitY=t}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-this.area.width/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+this.area.width/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-this.area.height/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+this.area.height/2)}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"output",{get:function(){return 1e3*this._flowQuantity/this.frequency}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"lifespanOutput",{get:function(){return(0===this.lifespan?1/0:this.lifespan)*this._flowQuantity/this.frequency}}),Object.defineProperty(n.Particles.Arcade.Emitter.prototype,"remainder",{get:function(){return this.maxParticles-this.lifespanOutput}}), +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Weapon=function(t,e){n.Plugin.call(this,t,e),this.bullets=null,this.autoExpandBulletsGroup=!1,this.autofire=!1,this.shots=0,this.fireLimit=0,this.fireRate=100,this.fireRateVariance=0,this.fireFrom=new n.Rectangle(0,0,1,1),this.fireAngle=n.ANGLE_UP,this.bulletInheritSpriteSpeed=!1,this.bulletAnimation="",this.bulletFrameRandom=!1,this.bulletFrameCycle=!1,this.bulletWorldWrap=!1,this.bulletWorldWrapPadding=0,this.bulletAngleOffset=0,this.bulletAngleVariance=0,this.bulletSpeed=200,this.bulletSpeedVariance=0,this.bulletLifespan=0,this.bulletKillDistance=0,this.bulletGravity=new n.Point(0,0),this.bulletRotateToVelocity=!1,this.bulletKey="",this.bulletFrame="",this._bulletClass=n.Bullet,this._bulletCollideWorldBounds=!1,this._bulletKillType=n.Weapon.KILL_WORLD_BOUNDS,this._data={customBody:!1,width:0,height:0,offsetX:0,offsetY:0},this.bounds=new n.Rectangle,this.bulletBounds=t.world.bounds,this.bulletFrames=[],this.bulletFrameIndex=0,this.anims={},this.onFire=new n.Signal,this.onKill=new n.Signal,this.onFireLimit=new n.Signal,this.trackedSprite=null,this.trackedPointer=null,this.multiFire=!1,this._hasFired=!1,this.trackRotation=!1,this.trackOffset=new n.Point,this._nextFire=0,this._tempNextFire=0,this._rotatedPoint=new n.Point},n.Weapon.prototype=Object.create(n.Plugin.prototype),n.Weapon.prototype.constructor=n.Weapon,n.Weapon.KILL_NEVER=0,n.Weapon.KILL_LIFESPAN=1,n.Weapon.KILL_DISTANCE=2,n.Weapon.KILL_WEAPON_BOUNDS=3,n.Weapon.KILL_CAMERA_BOUNDS=4,n.Weapon.KILL_WORLD_BOUNDS=5,n.Weapon.KILL_STATIC_BOUNDS=6,n.Weapon.prototype.createBullets=function(t,e,i,s){return void 0===t&&(t=1),void 0===s&&(s=this.game.world),this.bullets&&!this.bullets.game&&(this.bullets=null),this.bullets||(this.bullets=this.game.add.physicsGroup(n.Physics.ARCADE,s),this.bullets.classType=this._bulletClass),0!==t&&(-1===t&&(this.autoExpandBulletsGroup=!0,t=1),this.bullets.createMultiple(t,e,i),this.bullets.setAll("data.bulletManager",this),this.bulletKey=e,this.bulletFrame=i),this},n.Weapon.prototype.forEach=function(t,e){return this.bullets.forEachExists(t,e,arguments),this},n.Weapon.prototype.pauseAll=function(){return this.bullets.setAll("body.enable",!1),this},n.Weapon.prototype.resumeAll=function(){return this.bullets.setAll("body.enable",!0),this},n.Weapon.prototype.killAll=function(){return this.bullets.callAllExists("kill",!0),this.bullets.setAll("body.enable",!0),this},n.Weapon.prototype.resetShots=function(t){return this.shots=0,void 0!==t&&(this.fireLimit=t),this},n.Weapon.prototype.destroy=function(){this.parent.remove(this,!1),this.bullets.destroy(),this.game=null,this.parent=null,this.active=!1,this.visible=!1},n.Weapon.prototype.update=function(){this._bulletKillType===n.Weapon.KILL_WEAPON_BOUNDS&&(this.trackedSprite?(this.trackedSprite.updateTransform(),this.bounds.centerOn(this.trackedSprite.worldPosition.x,this.trackedSprite.worldPosition.y)):this.trackedPointer&&this.bounds.centerOn(this.trackedPointer.worldX,this.trackedPointer.worldY)),this.autofire&&this.fire()},n.Weapon.prototype.postRender=function(){this.multiFire&&this._hasFired&&(this._hasFired=!1,this._nextFire=this._tempNextFire)},n.Weapon.prototype.trackSprite=function(t,e,i,n){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.trackedPointer=null,this.trackedSprite=t,this.trackRotation=n,this.trackOffset.set(e,i),this},n.Weapon.prototype.trackPointer=function(t,e,i){return void 0===t&&(t=this.game.input.activePointer),void 0===e&&(e=0),void 0===i&&(i=0),this.trackedPointer=t,this.trackedSprite=null,this.trackRotation=!1,this.trackOffset.set(e,i),this},n.Weapon.prototype.fireMany=function(t,e){this.multiFire=!0;var i=[],n=this;return e||this.trackedSprite||this.trackedPointer?t.forEach((function(t){i.push(n.fire(e,null,null,t.x,t.y))})):t.forEach((function(t){i.push(n.fire(t))})),i},n.Weapon.prototype.fireOffset=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),this.fire(null,null,null,t,e)},n.Weapon.prototype.fire=function(t,e,i,s,r){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game.time.now0&&this.shots===this.fireLimit)return null;var o=this.bulletSpeed;0!==this.bulletSpeedVariance&&(o+=n.Math.between(-this.bulletSpeedVariance,this.bulletSpeedVariance)),t?this.fireFrom.width>1?this.fireFrom.centerOn(t.x,t.y):(this.fireFrom.x=t.x,this.fireFrom.y=t.y):this.trackedSprite?(this.trackRotation?(this._rotatedPoint.set(this.trackedSprite.world.x+this.trackOffset.x,this.trackedSprite.world.y+this.trackOffset.y),this._rotatedPoint.rotate(this.trackedSprite.world.x,this.trackedSprite.world.y,this.trackedSprite.worldRotation),this.fireFrom.width>1?this.fireFrom.centerOn(this._rotatedPoint.x,this._rotatedPoint.y):(this.fireFrom.x=this._rotatedPoint.x,this.fireFrom.y=this._rotatedPoint.y)):this.fireFrom.width>1?this.fireFrom.centerOn(this.trackedSprite.world.x+this.trackOffset.x,this.trackedSprite.world.y+this.trackOffset.y):(this.fireFrom.x=this.trackedSprite.world.x+this.trackOffset.x,this.fireFrom.y=this.trackedSprite.world.y+this.trackOffset.y),this.bulletInheritSpriteSpeed&&(o+=this.trackedSprite.body.speed)):this.trackedPointer&&(this.fireFrom.width>1?this.fireFrom.centerOn(this.trackedPointer.world.x+this.trackOffset.x,this.trackedPointer.world.y+this.trackOffset.y):(this.fireFrom.x=this.trackedPointer.world.x+this.trackOffset.x,this.fireFrom.y=this.trackedPointer.world.y+this.trackOffset.y)),void 0!==s&&(this.fireFrom.x+=s),void 0!==r&&(this.fireFrom.y+=r);var a=this.fireFrom.width>1?this.fireFrom.randomX:this.fireFrom.x,h=this.fireFrom.height>1?this.fireFrom.randomY:this.fireFrom.y,l=this.trackRotation?this.trackedSprite.angle:this.fireAngle;null!==e&&null!==i&&(l=this.game.math.radToDeg(Math.atan2(i-h,e-a))),0!==this.bulletAngleVariance&&(l+=n.Math.between(-this.bulletAngleVariance,this.bulletAngleVariance));var c=0,u=0;0===l||180===l?c=Math.cos(this.game.math.degToRad(l))*o:(90===l||270===l||(c=Math.cos(this.game.math.degToRad(l))*o),u=Math.sin(this.game.math.degToRad(l))*o);var d=null;if(this.autoExpandBulletsGroup?(d=this.bullets.getFirstExists(!1,!0,a,h,this.bulletKey,this.bulletFrame)).data.bulletManager=this:d=this.bullets.getFirstExists(!1),d){if(d.reset(a,h),d.data.fromX=a,d.data.fromY=h,d.data.killType=this.bulletKillType,d.data.killDistance=this.bulletKillDistance,d.data.rotateToVelocity=this.bulletRotateToVelocity,this.bulletKillType===n.Weapon.KILL_LIFESPAN&&(d.lifespan=this.bulletLifespan),d.angle=l+this.bulletAngleOffset,""!==this.bulletAnimation){if(null===d.animations.getAnimation(this.bulletAnimation)){var p=this.anims[this.bulletAnimation];d.animations.add(p.name,p.frames,p.frameRate,p.loop,p.useNumericIndex)}d.animations.play(this.bulletAnimation)}else this.bulletFrameCycle?(d.frame=this.bulletFrames[this.bulletFrameIndex],this.bulletFrameIndex++,this.bulletFrameIndex>=this.bulletFrames.length&&(this.bulletFrameIndex=0)):this.bulletFrameRandom&&(d.frame=this.bulletFrames[Math.floor(Math.random()*this.bulletFrames.length)]);d.data.bodyDirty&&(this._data.customBody&&d.body.setSize(this._data.width,this._data.height,this._data.offsetX,this._data.offsetY),d.body.collideWorldBounds=this.bulletCollideWorldBounds,d.data.bodyDirty=!1),d.body.velocity.set(c,u),d.body.gravity.set(this.bulletGravity.x,this.bulletGravity.y);var f=0;if(0!==this.bulletSpeedVariance){var g=this.fireRate;(g+=n.Math.between(-this.fireRateVariance,this.fireRateVariance))<0&&(g=0),f=this.game.time.now+g}else f=this.game.time.now+this.fireRate;this.multiFire?this._hasFired||(this._hasFired=!0,this._tempNextFire=f,this.shots++):(this._nextFire=f,this.shots++),this.onFire.dispatch(d,this,o),this.fireLimit>0&&this.shots===this.fireLimit&&this.onFireLimit.dispatch(this,this.fireLimit)}return d},n.Weapon.prototype.fireAtPointer=function(t){return void 0===t&&(t=this.game.input.activePointer),this.fire(null,t.worldX,t.worldY)},n.Weapon.prototype.fireAtSprite=function(t){return this.fire(null,t.world.x,t.world.y)},n.Weapon.prototype.fireAtXY=function(t,e){return this.fire(null,t,e)},n.Weapon.prototype.setBulletBodyOffset=function(t,e,i,n){return void 0===i&&(i=0),void 0===n&&(n=0),this._data.customBody=!0,this._data.width=t,this._data.height=e,this._data.offsetX=i,this._data.offsetY=n,this.bullets.callAll("body.setSize","body",t,e,i,n),this.bullets.setAll("data.bodyDirty",!1),this},n.Weapon.prototype.setBulletFrames=function(t,e,i,s){return void 0===i&&(i=!0),void 0===s&&(s=!1),this.bulletFrames=n.ArrayUtils.numberArray(t,e),this.bulletFrameIndex=0,this.bulletFrameCycle=i,this.bulletFrameRandom=s,this},n.Weapon.prototype.addBulletAnimation=function(t,e,i,n,s){return this.anims[t]={name:t,frames:e,frameRate:i,loop:n,useNumericIndex:s},this.bullets.callAll("animations.add","animations",t,e,i,n,s),this.bulletAnimation=t,this},n.Weapon.prototype.debug=function(t,e,i){void 0===t&&(t=16),void 0===e&&(e=32),void 0===i&&(i=!1),this.game.debug.text("Weapon Plugin",t,e),this.game.debug.text("Bullets Alive: "+this.bullets.total+" - Total: "+this.bullets.length,t,e+24),i&&this.bullets.forEachExists(this.game.debug.body,this.game.debug,"rgba(255, 0, 255, 0.8)")},Object.defineProperty(n.Weapon.prototype,"bulletClass",{get:function(){return this._bulletClass},set:function(t){this._bulletClass=t,this.bullets&&(this.bullets.classType=this._bulletClass)}}),Object.defineProperty(n.Weapon.prototype,"bulletKillType",{get:function(){return this._bulletKillType},set:function(t){switch(t){case n.Weapon.KILL_STATIC_BOUNDS:case n.Weapon.KILL_WEAPON_BOUNDS:this.bulletBounds=this.bounds;break;case n.Weapon.KILL_CAMERA_BOUNDS:this.bulletBounds=this.game.camera.view;break;case n.Weapon.KILL_WORLD_BOUNDS:this.bulletBounds=this.game.world.bounds}this._bulletKillType=t}}),Object.defineProperty(n.Weapon.prototype,"bulletCollideWorldBounds",{get:function(){return this._bulletCollideWorldBounds},set:function(t){this._bulletCollideWorldBounds=t,this.bullets.setAll("body.collideWorldBounds",t),this.bullets.setAll("data.bodyDirty",!1)}}),Object.defineProperty(n.Weapon.prototype,"x",{get:function(){return this.fireFrom.x},set:function(t){this.fireFrom.x=t}}),Object.defineProperty(n.Weapon.prototype,"y",{get:function(){return this.fireFrom.y},set:function(t){this.fireFrom.y=t}}), +/** +* @author Richard Davey +* @copyright 2016 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} +*/ +n.Bullet=function(t,e,i,s,r){n.Sprite.call(this,t,e,i,s,r),this.anchor.set(.5),this.data={bulletManager:null,fromX:0,fromY:0,bodyDirty:!0,rotateToVelocity:!1,killType:0,killDistance:0}},n.Bullet.prototype=Object.create(n.Sprite.prototype),n.Bullet.prototype.constructor=n.Bullet,n.Bullet.prototype.kill=function(){return this.alive=!1,this.exists=!1,this.visible=!1,this.data.bulletManager.onKill.dispatch(this),this},n.Bullet.prototype.update=function(){this.exists&&(this.data.killType>n.Weapon.KILL_LIFESPAN&&(this.data.killType===n.Weapon.KILL_DISTANCE?this.game.physics.arcade.distanceToXY(this,this.data.fromX,this.data.fromY,!0)>this.data.killDistance&&this.kill():this.data.bulletManager.bulletBounds.intersects(this)||this.kill()),this.data.rotateToVelocity&&(this.rotation=this.body.velocity.atan()),this.data.bulletManager.bulletWorldWrap&&this.game.world.wrap(this,this.data.bulletManager.bulletWorldWrapPadding))}, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +n.Video=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=null),this.game=t,this.key=e,this.width=0,this.height=0,this.type=n.VIDEO,this.disableTextureUpload=!1,this.touchLocked=!1,this.onPlay=new n.Signal,this.onChangeSource=new n.Signal,this.onComplete=new n.Signal,this.onAccess=new n.Signal,this.onError=new n.Signal,this.onTimeout=new n.Signal,this.onTouchUnlock=new n.Signal,this.playWhenUnlocked=!0,this.timeout=15e3,this._timeOutID=null,this.video=null,this.videoStream=null,this.isStreaming=!1,this.retryLimit=20,this.retry=0,this.retryInterval=500,this._retryID=null,this._codeMuted=!1,this._muted=!1,this._codePaused=!1,this._paused=!1,this._pending=!1,this._pendingChangeSource=!1,this._autoplay=!1,this._endCallback=null,this._playCallback=null,e&&this.game.cache.checkVideoKey(e)){var s=this.game.cache.getVideo(e);s.isBlob?this.createVideoFromBlob(s.data):this.video=s.data,this.width=this.video.videoWidth,this.height=this.video.videoHeight}else i&&this.createVideoFromURL(i,!1);this.video&&!i?(this.baseTexture=new PIXI.BaseTexture(this.video,null,this.game.resolution),this.baseTexture.forceLoaded(this.width,this.height)):(this.baseTexture=new PIXI.BaseTexture(n.Cache.DEFAULT.baseTexture.source,null,this.game.resolution),this.baseTexture.forceLoaded(this.width,this.height)),this.texture=new PIXI.Texture(this.baseTexture),this.textureFrame=new n.Frame(0,0,0,this.width,this.height,"video"),this.texture.setFrame(this.textureFrame),this.texture.valid=!1,null!==e&&this.video&&(this.texture.valid=this.video.canplay),this.snapshot=null,n.BitmapData&&(this.snapshot=new n.BitmapData(this.game,"",this.width,this.height)),this.game.device.needsTouchUnlock()?this.setTouchLock():s&&(s.locked=!1)},n.Video.prototype={connectToMediaStream:function(t,e){return t&&e&&(this.video=t,this.videoStream=e,this.isStreaming=!0,this.baseTexture.source=this.video,this.updateTexture(null,this.video.videoWidth,this.video.videoHeight),this.onAccess.dispatch(this)),this},startMediaStream:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=null),!this.game.device.getUserMedia)return this.onError.dispatch(this,"No getUserMedia"),!1;null!==this.videoStream&&(this.videoStream.active?this.videoStream.active=!1:this.videoStream.stop()),this.removeVideoElement(),this.video=document.createElement("video"),this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),null!==e&&(this.video.width=e),null!==i&&(this.video.height=i),this._timeOutID=window.setTimeout(this.getUserMediaTimeout.bind(this),this.timeout);try{navigator.getUserMedia({audio:t,video:!0},this.getUserMediaSuccess.bind(this),this.getUserMediaError.bind(this))}catch(t){this.getUserMediaError(t)}return this},getUserMediaTimeout:function(){clearTimeout(this._timeOutID),this.onTimeout.dispatch(this)},getUserMediaError:function(t){clearTimeout(this._timeOutID),this.onError.dispatch(this,t)},getUserMediaSuccess:function(t){clearTimeout(this._timeOutID),this.videoStream=t,void 0!==this.video.mozSrcObject?this.video.mozSrcObject=t:void 0!==this.video.srcObject?this.video.srcObject=t:this.video.src=window.URL&&window.URL.createObjectURL(t)||t;var e=this;this.video.onloadeddata=function(){var t=10;!function i(){if(t>0)if(e.video.videoWidth>0){var n=e.video.videoWidth,s=e.video.videoHeight;isNaN(e.video.videoHeight)&&(s=n/(4/3)),e.video.play(),e.isStreaming=!0,e.baseTexture.source=e.video,e.updateTexture(null,n,s),e.onAccess.dispatch(e)}else window.setTimeout(i,500);else console.warn("Unable to connect to video stream. Webcam error?");t--}()}},createVideoFromBlob:function(t){var e=this;return this.video=document.createElement("video"),this.video.controls=!1,this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),this.video.addEventListener("loadeddata",(function(t){e.updateTexture(t)}),!0),this.video.src=window.URL.createObjectURL(t),this.video.canplay=!0,this},createVideoFromURL:function(t,e){return void 0===e&&(e=!1),this.texture&&(this.texture.valid=!1),this.video=document.createElement("video"),this.video.controls=!1,e&&this.video.setAttribute("autoplay","autoplay"),this.video.setAttribute("playsinline","playsinline"),this.video.src=t,this.video.canplay=!0,this.video.load(),this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval),this.key=t,this},updateTexture:function(t,e,i){var n=!1;null==e&&(e=this.video.videoWidth,n=!0),null==i&&(i=this.video.videoHeight),this.width=e,this.height=i,this.baseTexture.source!==this.video&&(this.baseTexture.source=this.video),this.baseTexture.forceLoaded(e,i),this.texture.frame.resize(e,i),this.texture.width=e,this.texture.height=i,this.texture.valid=!0,this.snapshot&&this.snapshot.resize(e,i),n&&null!==this.key&&(this.onChangeSource.dispatch(this,e,i),this._autoplay&&(this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate)))},complete:function(){this.onComplete.dispatch(this)},play:function(t,e){return this._pendingChangeSource||(void 0===t&&(t=!1),void 0===e&&(e=1),this.game.sound.onMute&&(this.game.sound.onMute.add(this.setMute,this),this.game.sound.onUnMute.add(this.unsetMute,this),this.game.sound.mute&&this.setMute()),this.game.onPause.add(this.setPause,this),this.game.onResume.add(this.setResume,this),this._endCallback=this.complete.bind(this),this.video.addEventListener("ended",this._endCallback,!0),this.video.addEventListener("webkitendfullscreen",this._endCallback,!0),this.video.loop=t?"loop":"",this.video.playbackRate=e,this.touchLocked?this._pending=!0:(this._pending=!1,null!==this.key&&(4!==this.video.readyState?(this.retry=this.retryLimit,this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval)):(this._playCallback=this.playHandler.bind(this),this.video.addEventListener("playing",this._playCallback,!0))),this.video.play(),this.onPlay.dispatch(this,t,e))),this},playHandler:function(){this.video.removeEventListener("playing",this._playCallback,!0),this.updateTexture()},stop:function(){return this.game.sound.onMute&&(this.game.sound.onMute.remove(this.setMute,this),this.game.sound.onUnMute.remove(this.unsetMute,this)),this.game.onPause.remove(this.setPause,this),this.game.onResume.remove(this.setResume,this),this.isStreaming?(this.video.mozSrcObject?(this.video.mozSrcObject.stop(),this.video.src=null):this.video.srcObject?(this.video.srcObject.stop(),this.video.src=null):(this.video.src="",this.videoStream.active?this.videoStream.active=!1:this.videoStream.getTracks?this.videoStream.getTracks().forEach((function(t){t.stop()})):this.videoStream.stop()),this.videoStream=null,this.isStreaming=!1):(this.video.removeEventListener("ended",this._endCallback,!0),this.video.removeEventListener("webkitendfullscreen",this._endCallback,!0),this.video.removeEventListener("playing",this._playCallback,!0),this.touchLocked?this._pending=!1:this.video.pause()),this},add:function(t){if(Array.isArray(t))for(var e=0;e0?this._retryID=window.setTimeout(this.checkVideoProgress.bind(this),this.retryInterval):console.warn("Phaser.Video: Unable to start downloading video in time",this.isStreaming))},setTouchLock:function(){this.game.input.addTouchLockCallback(this.unlock,this,!0),this.touchLocked=!0},unlock:function(){if(this.touchLocked=!1,this.playWhenUnlocked&&(this.video.play(),this.onPlay.dispatch(this,this.loop,this.playbackRate)),this.key){var t=this.game.cache.getVideo(this.key);t&&!t.isBlob&&(t.locked=!1)}return this.onTouchUnlock.dispatch(this),!0},grab:function(t,e,i){if(void 0===t&&(t=!1),void 0===e&&(e=1),void 0===i&&(i=null),null!==this.snapshot)return t&&this.snapshot.cls(),this.snapshot.copy(this.video,0,0,this.width,this.height,0,0,this.width,this.height,0,0,0,1,1,e,i),this.snapshot;console.warn("Video.grab cannot run because Phaser.BitmapData is unavailable")},removeVideoElement:function(){if(this.video){for(this.video.parentNode&&this.video.parentNode.removeChild(this.video);this.video.hasChildNodes();)this.video.removeChild(this.video.firstChild);this.video.removeAttribute("autoplay"),this.video.removeAttribute("src"),this.video=null}},destroy:function(){this.stop(),this.removeVideoElement(),this.touchLocked&&this.game.input.removeTouchLockCallback(this.unlock,this),this._retryID&&window.clearTimeout(this._retryID)}},Object.defineProperty(n.Video.prototype,"currentTime",{get:function(){return this.video?this.video.currentTime:0},set:function(t){this.video.currentTime=t}}),Object.defineProperty(n.Video.prototype,"duration",{get:function(){return this.video?this.video.duration:0}}),Object.defineProperty(n.Video.prototype,"progress",{get:function(){return this.video?this.video.currentTime/this.video.duration:0}}),Object.defineProperty(n.Video.prototype,"mute",{get:function(){return this._muted},set:function(t){if(t=t||null){if(this._muted)return;this._codeMuted=!0,this.setMute()}else{if(!this._muted)return;this._codeMuted=!1,this.unsetMute()}}}),Object.defineProperty(n.Video.prototype,"paused",{get:function(){return this._paused},set:function(t){if(t=t||null,!this.touchLocked)if(t){if(this._paused)return;this._codePaused=!0,this.setPause()}else{if(!this._paused)return;this._codePaused=!1,this.setResume()}}}),Object.defineProperty(n.Video.prototype,"volume",{get:function(){return this.video?this.video.volume:1},set:function(t){t<0?t=0:t>1&&(t=1),this.video&&(this.video.volume=t)}}),Object.defineProperty(n.Video.prototype,"playbackRate",{get:function(){return this.video?this.video.playbackRate:1},set:function(t){this.video&&(this.video.playbackRate=t)}}),Object.defineProperty(n.Video.prototype,"loop",{get:function(){return!!this.video&&this.video.loop},set:function(t){t&&this.video?this.video.loop="loop":this.video&&(this.video.loop="")}}),Object.defineProperty(n.Video.prototype,"playing",{get:function(){return!!this.video&&!(this.video.paused&&this.video.ended)}}),n.Video.prototype.constructor=n.Video, +/** + * @author Richard Davey + * @copyright 2016 Photon Storm Ltd. + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +void 0===PIXI.blendModes&&(PIXI.blendModes=n.blendModes),void 0===PIXI.scaleModes&&(PIXI.scaleModes=n.scaleModes),void 0===PIXI.Texture.emptyTexture&&(PIXI.Texture.emptyTexture=new PIXI.Texture(new PIXI.BaseTexture)),void 0===PIXI.DisplayObject._tempMatrix&&(PIXI.DisplayObject._tempMatrix=new n.Matrix),PIXI.TextureSilentFail=!0,PIXI.canUseNewCanvasBlendModes=function(){return n.Device.canUseMultiply},t.exports&&(e=t.exports=n),e.Phaser=n,n}).call(this)},4674:function(t,e){ +/** +* @author Richard Davey +* @copyright 2020 Photon Storm Ltd. +* @license {@link https://github.com/photonstorm/phaser-ce/blob/master/license.txt|MIT License} +* +* @overview +* +* Phaser CE - https://github.com/photonstorm/phaser-ce +* +* v2.16.0 "2020-06-01" - Built: Mon Jun 01 2020 11:17:52 +* +* By Richard Davey http://www.photonstorm.com @photonstorm and Phaser CE contributors +* +* Phaser - http://phaser.io +*/ +(function(){var i=i||{}; +/** + * @author Mat Groves http://matgroves.com @Doormat23 + * @author Richard Davey + * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} + */ +i.DisplayObject=function(){this.position=new i.Point(0,0),this.scale=new i.Point(1,1),this.pivot=new i.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.renderable=!1,this.parent=null,this.worldAlpha=1,this.worldTransform=new Phaser.Matrix,this.worldPosition=new i.Point(0,0),this.worldScale=new i.Point(1,1),this.worldRotation=0,this.filterArea=null,this._sr=0,this._cr=1,this._bounds=new i.Rectangle(0,0,0,0),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},i.DisplayObject.prototype={constructor:i.DisplayObject,destroy:function(){if(this.children){for(var t=this.children.length;t--;)this.children[t].destroy();this.children=[]}this.hitArea=null,this.parent=null,this.worldTransform=null,this.filterArea=null,this.renderable=!1,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture()},updateTransform:function(t){if(!t&&!this.parent&&!this.game)return this;var e=this.parent;t?e=t:this.parent||(e=this.game.world);var i,n,s,r,o,a,h=e.worldTransform,l=this.worldTransform;this.rotation%Phaser.Math.PI2?(this.rotation!==this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation)),i=this._cr*this.scale.x,n=this._sr*this.scale.x,s=-this._sr*this.scale.y,r=this._cr*this.scale.y,o=this.position.x,a=this.position.y,(this.pivot.x||this.pivot.y)&&(o-=this.pivot.x*i+this.pivot.y*s,a-=this.pivot.x*n+this.pivot.y*r),l.a=i*h.a+n*h.c,l.b=i*h.b+n*h.d,l.c=s*h.a+r*h.c,l.d=s*h.b+r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty):(i=this.scale.x,n=0,s=0,r=this.scale.y,o=this.position.x-this.pivot.x*i,a=this.position.y-this.pivot.y*r,l.a=i*h.a,l.b=i*h.b,l.c=r*h.c,l.d=r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty),i=l.a,n=l.b,s=l.c;var c=i*(r=l.d)-n*s;if(i||n){var u=Math.sqrt(i*i+n*n);this.worldRotation=n>0?Math.acos(i/u):-Math.acos(i/u),this.worldScale.x=u,this.worldScale.y=c/u}else if(s||r){var d=Math.sqrt(s*s+r*r);this.worldRotation=Phaser.Math.HALF_PI-(r>0?Math.acos(-s/d):-Math.acos(s/d)),this.worldScale.x=c/d,this.worldScale.y=d}else this.worldScale.x=0,this.worldScale.y=0;return this.worldAlpha=this.alpha*e.worldAlpha,this.worldPosition.x=l.tx,this.worldPosition.y=l.ty,this._currentBounds=null,this.transformCallback&&this.transformCallback.call(this.transformCallbackContext,l,h),this},preUpdate:function(){},generateTexture:function(t,e,n){var s=this.getLocalBounds(),r=new Phaser.RenderTexture(this.game,0|s.width,0|s.height,n,e,t);return i.DisplayObject._tempMatrix.tx=-s.x,i.DisplayObject._tempMatrix.ty=-s.y,r.render(this,i.DisplayObject._tempMatrix),r},updateCache:function(){return this._generateCachedSprite(),this},toGlobal:function(t){return this.updateTransform(),this.worldTransform.apply(t)},toLocal:function(t,e){return e&&(t=e.toGlobal(t)),this.updateTransform(),this.worldTransform.applyInverse(t)},_renderCachedSprite:function(t){this._cachedSprite.worldAlpha=this.worldAlpha,t.gl?i.Sprite.prototype._renderWebGL.call(this._cachedSprite,t):i.Sprite.prototype._renderCanvas.call(this._cachedSprite,t)},_generateCachedSprite:function(){this._cacheAsBitmap=!1;var t=this.getLocalBounds();if(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),this.updateTransform(),this._cachedSprite)this._cachedSprite.texture.resize(t.width,t.height);else{var e=0;this.texture&&this.texture.baseTexture&&i._enableMultiTextureToggle&&(e=this.texture.baseTexture.textureIndex);var n=new Phaser.RenderTexture(this.game,t.width,t.height,void 0,void 0,void 0,void 0,e);this._cachedSprite=new i.Sprite(n),this._cachedSprite.worldTransform=this.worldTransform}var s=this._filters;this._filters=null,this._cachedSprite.filters=s,i.DisplayObject._tempMatrix.tx=-t.x,i.DisplayObject._tempMatrix.ty=-t.y,this._cachedSprite.texture.render(this,i.DisplayObject._tempMatrix,!0),this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._filters=s,this._cacheAsBitmap=!0},_destroyCachedSprite:function(){this._cachedSprite&&(this._cachedSprite.texture.destroy(!0),this._cachedSprite=null)},_destroyTintedTexture:function(){this.tintedTexture&&(Phaser.CanvasPool.removeByCanvas(this.tintedTexture),this.tintedTexture=null)}},i.DisplayObject.prototype.displayObjectUpdateTransform=i.DisplayObject.prototype.updateTransform,Object.defineProperties(i.DisplayObject.prototype,{x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},worldVisible:{get:function(){if(this.visible){var t=this.parent;if(!t)return this.visible;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}return!1}},mask:{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,t&&(this._mask.isMask=!0)}},filters:{get:function(){return this._filters},set:function(t){if(Array.isArray(t)){for(var e=[],n=0;n=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},i.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);if(i<0||n<0)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[n]=t}},i.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},i.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},i.DisplayObjectContainer.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},i.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);if(-1!==e)return this.removeChildAt(e)},i.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(e.parent=void 0,this.children.splice(t,1)),e},i.DisplayObjectContainer.prototype.bringChildToTop=function(t){if(t.parent===this)return this.setChildIndex(t,this.children.length-1)},i.DisplayObjectContainer.prototype.sendChildToBack=function(t){if(t.parent===this)return this.setChildIndex(t,0)},i.DisplayObjectContainer.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i=e-t;if(i>0&&i<=e){for(var n=this.children.splice(t,i),s=0;s(a=o.width+o.x)?u:a,d=d>(h=o.height+o.y)?d:h)}var f=this._bounds;if(!p){var g=(f=new i.Rectangle).x,m=f.width+f.x,y=f.y,v=f.height+f.y,b=this.worldTransform,x=b.a,w=b.b,_=b.c,T=b.d,C=b.tx,S=b.ty,P=x*m+_*v+C,A=T*v+w*m+S,E=x*g+_*v+C,M=T*v+w*g+S,k=x*g+_*y+C,L=T*y+w*g+S,O=x*m+_*y+C,I=T*y+w*m+S;l=O<(l=k<(l=E<(l=P)?E:l)?k:l)?O:l,c=I<(c=L<(c=M<(c=A)?M:c)?L:c)?I:c,u=O>(u=k>(u=E>(u=P)?E:u)?k:u)?O:u,d=I>(d=L>(d=M>(d=A)?M:d)?L:d)?I:d}if(f.x=l,f.y=c,f.width=u-l,f.height=d-c,n)for(t.worldTransform=r,e=0;e(f=T>(f=w>(f=b>f?b:f)?w:f)?T:f)?S:f,g=P>(g=C>(g=_>(g=x>g?x:g)?_:g)?C:g)?P:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=y,A.height=g-y,this._currentBounds=A,A},i.Sprite.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=Phaser.identityMatrix;for(var e=0;e= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) { gl_FragColor = RED;return;}","}"];var s=i.compileProgram(t,this.vertexSrc||i.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(s),this.uSamplerArray=t.getUniformLocation(s,"uSamplerArray[0]"),this.projectionVector=t.getUniformLocation(s,"projectionVector"),this.offsetVector=t.getUniformLocation(s,"offsetVector"),this.dimensions=t.getUniformLocation(s,"dimensions"),this.aVertexPosition=t.getAttribLocation(s,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(s,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(s,"aColor"),this.aTextureIndex=t.getAttribLocation(s,"aTextureIndex");var r=[],o=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var a=0;a 0.0) gl_Position = vec4(0.0);"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);"," vTextureIndex = aTextureIndex;","}"],i.PixiFastShader=function(t){if(this._UID=Phaser._UID++,this.gl=t,this.program=null,i._enableMultiTextureToggle){t=this.gl;this.MAX_TEXTURES=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);for(var e="\tif (vTextureIndex == 0.0) { gl_FragColor = texture2D(uSamplerArray[0], vTextureCoord) * vColor;return;}\n",n=1;n= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["// PixiFastShader Fragment Shader.","precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;","}"];this.vertexSrc=["// PixiFastShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","attribute float aTextureIndex;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;"," vColor = aColor;","}"],this.textureCount=0,this.init()},i.PixiFastShader.prototype.constructor=i.PixiFastShader,i.PixiFastShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["//StripShader Fragment Shader.","precision mediump float;","varying vec2 vTextureCoord;","varying float vTextureIndex;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);","}"];this.vertexSrc=["//StripShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aTextureIndex;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying float vTextureIndex;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;","}"],this.init()},i.StripShader.prototype.constructor=i.StripShader,i.StripShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},n=this.gl,s=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),r=n.getParameter(n.MAX_TEXTURE_SIZE),o=this.game.cache._cache.image,a=null,h=0;h=this.size&&(this.flush(),this.currentBaseTexture=n.baseTexture);var a=n._uvs;if(a){var h,l,c,u,d=t.anchor.x,p=t.anchor.y;if(n.trim){var f=n.trim;h=(l=f.x-d*f.width)+n.crop.width,c=(u=f.y-p*f.height)+n.crop.height}else h=n.frame.width*(1-d),l=n.frame.width*-d,c=n.frame.height*(1-p),u=n.frame.height*-p;var g=this.currentBatchSize*this.vertexSize,m=n.baseTexture.resolution,y=n.baseTexture.textureIndex,v=o.a/m,b=o.b/m,x=o.c/m,w=o.d/m,_=o.tx,T=o.ty,C=n.crop.height;if(n.rotated){var S=o.a,P=o.b,A=o.c,E=o.d,M=l,k=h;_=o.c*C+_,T=o.d*C+T,v=6123233995736766e-32*S-A,b=6123233995736766e-32*P-E,x=S+6123233995736766e-32*A,w=P+6123233995736766e-32*E,n._updateUvsInverted(),h=c,l=u,c=k,u=M}var L=this.colors,O=this.positions,I=t.tint,B=(I>>16)+(65280&I)+((255&I)<<16)+(255*t.worldAlpha<<24);this.renderSession.roundPixels?(O[g++]=v*l+x*u+_|0,O[g++]=w*u+b*l+T|0,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_|0,O[g++]=w*u+b*h+T|0,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_|0,O[g++]=w*c+b*h+T|0,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_|0,O[g++]=w*c+b*l+T|0,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y):(O[g++]=v*l+x*u+_,O[g++]=w*u+b*l+T,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_,O[g++]=w*u+b*h+T,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_,O[g++]=w*c+b*h+T,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_,O[g++]=w*c+b*l+T,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y),this.sprites[this.currentBatchSize++]=t}},i.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var e=t.tilingTexture,n=e.baseTexture,s=this.gl,r=t.texture.baseTexture.textureIndex;i.WebGLRenderer.textureArray[r]!=n&&(this.flush(),s.activeTexture(s.TEXTURE0+r),s.bindTexture(s.TEXTURE_2D,n._glTextures[s.id]),i.WebGLRenderer.textureArray[r]=n),this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture),t._uvs||(t._uvs=new i.TextureUvs);var o=t._uvs,a=e.baseTexture.width,h=e.baseTexture.height;t.tilePosition.x%=a*t.tileScaleOffset.x,t.tilePosition.y%=h*t.tileScaleOffset.y;var l=t.tilePosition.x/(a*t.tileScaleOffset.x),c=t.tilePosition.y/(h*t.tileScaleOffset.y),u=t.width/a/(t.tileScale.x*t.tileScaleOffset.x),d=t.height/h/(t.tileScale.y*t.tileScaleOffset.y);o.x0=0-l,o.y0=0-c,o.x1=1*u-l,o.y1=0-c,o.x2=1*u-l,o.y2=1*d-c,o.x3=0-l,o.y3=1*d-c;var p=t.tint,f=(p>>16)+(65280&p)+((255&p)<<16)+(255*t.worldAlpha<<24),g=this.positions,m=this.colors,y=t.width,v=t.height,b=t.anchor.x,x=t.anchor.y,w=y*(1-b),_=y*-b,T=v*(1-x),C=v*-x,S=this.currentBatchSize*this.vertexSize,P=e.baseTexture.resolution,A=t.worldTransform,E=A.a/P,M=A.b/P,k=A.c/P,L=A.d/P,O=A.tx,I=A.ty;g[S++]=E*_+k*C+O,g[S++]=L*C+M*_+I,g[S++]=o.x0,g[S++]=o.y0,m[S++]=f,g[S++]=r,g[S++]=E*w+k*C+O,g[S++]=L*C+M*w+I,g[S++]=o.x1,g[S++]=o.y1,m[S++]=f,g[S++]=r,g[S++]=E*w+k*T+O,g[S++]=L*T+M*w+I,g[S++]=o.x2,g[S++]=o.y2,m[S++]=f,g[S++]=r,g[S++]=E*_+k*T+O,g[S++]=L*T+M*_+I,g[S++]=o.x3,g[S++]=o.y3,m[S++]=f,g[S++]=r,this.sprites[this.currentBatchSize++]=t},i.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e,n,s,r=this.gl;if(this.dirty){this.dirty=!1,t=this.defaultShader.shaders[r.id],r.activeTexture(r.TEXTURE0),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var o=this.vertexSize;r.vertexAttribPointer(t.aVertexPosition,2,r.FLOAT,!1,o,0),r.vertexAttribPointer(t.aTextureCoord,2,r.FLOAT,!1,o,8),r.vertexAttribPointer(t.colorAttribute,4,r.UNSIGNED_BYTE,!0,o,16),r.vertexAttribPointer(t.aTextureIndex,1,r.FLOAT,!1,o,20)}if(this.currentBatchSize>.5*this.size)r.bufferSubData(r.ARRAY_BUFFER,0,this.vertices);else{r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer);var a=this.positions.subarray(0,this.currentBatchSize*this.vertexSize);r.bufferSubData(r.ARRAY_BUFFER,0,a)}for(var h,l=0,c=0,u=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,y=this.currentBatchSize;m0&&(v=!1),(f||g)&&(this.renderBatch(u,l,c),c=m,l=0,u=e,f&&(d=n,this.renderSession.blendModeManager.setBlendMode(d)),g)){(t=(p=s).shaders[r.id])||((t=new i.PixiShader(r)).fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[r.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var b=this.renderSession.projection;r.uniform2f(t.projectionVector,b.x,b.y);var x=this.renderSession.offset;r.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(u,l,c),this.currentBatchSize=0}},i.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var n=this.gl;if(t._dirty[n.id]){if(!this.renderSession.renderer.updateTexture(t))return}else n.bindTexture(n.TEXTURE_2D,t._glTextures[n.id]);n.drawElements(n.TRIANGLES,6*e,n.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},i.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},i.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},i.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},i.WebGLFastSpriteBatch=function(t){this.vertSize=11,this.maxSize=6e3,this.size=this.maxSize;var e=4*this.size*this.vertSize,i=6*this.maxSize;this.vertices=new Float32Array(e),this.indices=new Uint16Array(i),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,s=0;n=this.size&&this.flush()}},i.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]){if(this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}else this.renderSession.renderer.updateTexture(this.currentBaseTexture,t)}},i.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},i.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36),t.vertexAttribPointer(this.shader.aTextureIndex,1,t.FLOAT,!1,i,40)},i.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},i.WebGLFilterManager.prototype.constructor=i.WebGLFilterManager,i.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},i.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},i.WebGLFilterManager.prototype.pushFilter=function(t){var e=this.gl,n=this.renderSession.projection,s=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),t._previous_stencil_mgr=this.renderSession.stencilManager,this.renderSession.stencilManager=new i.WebGLStencilManager,this.renderSession.stencilManager.setContext(e),e.disable(e.STENCIL_TEST),this.filterStack.push(t);var r=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var o=this.texturePool.pop();o?o.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution):o=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),e.bindTexture(e.TEXTURE_2D,o.texture);var a=t._filterArea,h=r.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),e.bindFramebuffer(e.FRAMEBUFFER,o.frameBuffer),e.viewport(0,0,a.width*this.renderSession.resolution,a.height*this.renderSession.resolution),n.x=a.width/2,n.y=-a.height/2,s.x=-a.x,s.y=-a.y,e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t._glFilterTexture=o},i.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,e=this.filterStack.pop(),n=e._filterArea,s=e._glFilterTexture,r=this.renderSession.projection,o=this.renderSession.offset;if(e.filterPasses.length>1){t.viewport(0,0,n.width*this.renderSession.resolution,n.height*this.renderSession.resolution),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=n.height,this.vertexArray[2]=n.width,this.vertexArray[3]=n.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=n.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=n.width/this.width,this.uvArray[5]=n.height/this.height,this.uvArray[6]=n.width/this.width,this.uvArray[7]=n.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=s,h=this.texturePool.pop();h||(h=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution)),h.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l0?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.applyFilterPass(d,n,p,f),this.texturePool.push(s),e._glFilterTexture=null},i.WebGLFilterManager.prototype.applyFilterPass=function(t,e,n,s){var r=this.gl,o=t.shaders[r.id];o||((o=new i.PixiShader(r)).fragmentSrc=t.fragmentSrc,o.uniforms=t.uniforms,o.init(!0),t.shaders[r.id]=o),this.renderSession.shaderManager.setShader(o),r.uniform2f(o.projectionVector,n/2,-s/2),r.uniform2f(o.offsetVector,0,0),t.uniforms.dimensions&&(t.uniforms.dimensions.value[0]=this.width,t.uniforms.dimensions.value[1]=this.height,t.uniforms.dimensions.value[2]=this.vertexArray[0],t.uniforms.dimensions.value[3]=this.vertexArray[5]),o.syncUniforms(),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.vertexAttribPointer(o.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.vertexAttribPointer(o.aTextureCoord,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.colorBuffer),r.vertexAttribPointer(o.colorAttribute,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),this.renderSession.drawCount++},i.WebGLFilterManager.prototype.initShaderBuffers=function(){var t=this.gl;this.vertexBuffer=t.createBuffer(),this.uvBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.vertexArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW),this.uvArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),t.bufferData(t.ARRAY_BUFFER,this.uvArray,t.STATIC_DRAW),this.colorArray=new Float32Array([1,16777215,1,16777215,1,16777215,1,16777215]),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,1,3,2]),t.STATIC_DRAW)},i.WebGLFilterManager.prototype.destroy=function(){var t=this.gl;this.filterStack=null,this.offsetX=0,this.offsetY=0;for(var e=0;e=0;t--){var e=this._glTextures[t],n=i.glContexts[t];n&&e&&n.deleteTexture(e)}this._glTextures.length=0,this.dirty()},i.BaseTexture.fromCanvas=function(t,e,n){return 0===t.width&&(t.width=1),0===t.height&&(t.height=1),n=n||1,new i.BaseTexture(t,e,n)},i.TextureSilentFail=!1,i.Texture=function(t,e,n,s){this.noFrame=!1,e||(this.noFrame=!0,e=new i.Rectangle(0,0,1,1)),t instanceof i.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=e,this.trim=s,this.valid=!1,this.isTiling=!1,this.requiresUpdate=!1,this.requiresReTint=!1,this._uvs=null,this.width=0,this.height=0,this.crop=n||new i.Rectangle(0,0,1,1),this.rotated=!1,t.hasLoaded&&(this.noFrame&&(e=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(e))},i.Texture.prototype.constructor=i.Texture,i.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;this.noFrame&&(this.frame=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame)},i.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},i.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,this.trim||!(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs();else{if(!i.TextureSilentFail)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=!1}},i.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.width)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.width)/e,this._uvs.y2=(t.y+t.height)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.height)/n},i.Texture.prototype._updateUvsInverted=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.height)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.height)/e,this._uvs.y2=(t.y+t.width)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.width)/n},i.Texture.fromCanvas=function(t,e){var n=i.BaseTexture.fromCanvas(t,e);return new i.Texture(n)},i.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},t.exports&&(e=t.exports=i),e.PIXI=i,i}).call(this)},9204:function(t,e,i){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e=0;r--){var o=i[e.c];switch((e=this.execStack[r]).scope){case"interrupt":o=i[e.origin];var a=Object.keys(o.interrupt[e.index])[0];i=o.interrupt[e.index][a];break;case"choice":var h=Object.keys(o.choice[e.index])[0];i=o.choice[e.index][h];break;case"if":i=o[Object.keys(o)[0]]}s=i.slice(e.c).concat(s)}return s||[]},t}();e.default=o},885:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.game=e,this.name=t}return t.prototype.onInit=function(){},t.prototype.onStart=function(){},t.prototype.onLoad=function(t,e){},t.prototype.onLoaded=function(){},t.prototype.onSave=function(t,e){},t.prototype.onCall=function(t){},t.prototype.onAction=function(t){},t.prototype.onEndScene=function(t){},t.prototype.onTeardown=function(){},t}();e.default=i},8811:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return o(e,t),e},h=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},l=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&"says"===r[1];if("show"===a||"play"===a||h){var l=this.game.managers.story.parseAction(n);this.assetsPerScene[e]||(this.assetsPerScene[e]={}),this.assetsPerScene[e][l.actor]=l.actorType}if("if"!==a&&"else"!==a||i.unshift.apply(i,n[s]),"choice"===a||"interrupt"===a||"visualChoice"===a)for(var u=0,d=n[s];u0?[4,this.game.managers.audio.decodeAudio(i)]:[3,2];case 1:s.sent(),s.label=2;case 2:return this.loadingScreen&&(this.loadingScreen.destroy(this.game),this.loadingScreen=null),this.backgroundLoading&&(this.backgroundLoading=null),this.game.config.debugMode&&console.log("All assets loaded."),e(!0),[2]}}))}))}),c),c.loading=!0,c.loadingScreen&&c.loadingScreen.setLoadingBar(c.game),c.game.load.start()}))]}}))}))},t}();e.default=u},3973:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(9204)),r=function(){this.skipping=!1,this.unskippable=!1,this.auto=!1,this.paused=!1,this.clickCooldown=200,this.clickLocked=!1,this.waitForClick=!1,this.execStack=new s.default,this.actionsCounter=0,this.nextAction=null};e.default=r},571:function(t,e){"use strict";var i,n=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.RangedUserPreference=e.UserPreference=void 0;var s=function(){function t(t){this.value=t}return t.prototype.set=function(t){this.value=t},t.prototype.get=function(){return this.value},t.prototype.toJSON=function(){return this.value},t}();e.UserPreference=s;var r=function(t){function e(e,i,n,s){void 0===s&&(s=!1);var r=t.call(this,e)||this;return r.min=i,r.max=n,r.inverted=s,r}return n(e,t),e.prototype.set=function(t){this.value=t*(this.max-this.min)+this.min},e.prototype.get=function(){return this.inverted?this.max-this.value:this.value},e}(s);e.RangedUserPreference=r;var o=function(){function t(t,e){this.game=t,this.preferences={textSpeed:new r(20,10,100,!0),autoSpeed:new r(150,50,300),bgmv:new r(.5,0,1),sfxv:new r(.5,0,1),muted:new s(!1)};var i=localStorage.getItem("RenJSUserPreferences"+t.config.name);i?this.setPreferences(JSON.parse(i)):this.setPreferences(e)}return t.prototype.setPreferences=function(t){if(t)for(var e in this.preferences)void 0!==t[e]&&(this.preferences[e].value=t[e])},t.prototype.set=function(t,e){this.preferences[t].set(e),this.savePreferences()},t.prototype.get=function(t){return this.preferences[t].get()},t.prototype.addPreference=function(t,e,i){this.preferences[t]="boolean"===i?new s(e):new r(e,i.min,i.max)},t.prototype.savePreferences=function(){var t=JSON.stringify(this.preferences);localStorage.setItem("RenJSUserPreferences"+this.game.config.name,t)},t}();e.default=o},9163:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i){this.game=t,this.actionType=e,this.properties=i,this.key=Object.keys(i)[0],this.keyParams=this.key.split(" "),this.body=i[this.key]}return t.prototype.resolve=function(t,e){var i=this;t&&!e?t.then((function(){return i.game.resolveAction()})):this.game.resolveAction()},t.prototype.execute=function(){},t.prototype.parseParams=function(t){return t?this.keyParams:(this.params||(this.params=this.body?this.body.split(" "):[]),this.params)},t.prototype.parseActor=function(){return this.keyParams[1]},t.prototype.parseParameter=function(t,e,i){void 0===e&&(e="boolean"),void 0===i&&(i=!1);var n=this.parseParams(i),s=n.indexOf(t);if("boolean"===e)return-1!==s;if(-1===s)return null;var r=n[s+1];if("coords"===e){if(r in this.game.storyConfig.positions)return this.game.storyConfig.positions[r];var o=r.split(",");return{x:parseInt(o[0],10),y:parseInt(o[1],10)}}return"number"===e?parseFloat(r):r},t}();e.default=i},423:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.screenEffects.ambient.start(this.actor),this.resolve()},e}(r(i(9163)).default);e.default=o},1156:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.contAfterTrans=s.parseParameter("CONTINUE"),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.cgs.animate(this.actor,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},2352:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.keyParams[1],s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),"play"===s.actionType?(s.looped=s.parseParameter("LOOPED"),s.looped&&(s.fromSeconds=s.parseParameter("FROM","number")),s.force=s.parseParameter("FORCE"),s.channel=s.parseParameter("IN","string"),s.parseParameter("BGS")&&(s.channel="bgs"),s.channel||(s.channel="bgm")):s.channel=s.actor,s}return s(e,t),e.prototype.execute=function(){"play"===this.actionType?"music"===this.actorType?this.game.managers.audio.play(this.actor,this.channel,this.looped,this.fromSeconds,this.transition,this.force):this.game.managers.audio.playSFX(this.actor):this.game.managers.audio.stop(this.channel,this.transition),this.resolve()},e}(r(i(9163)).default);e.default=o},1629:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){var t=this.game.pluginsRJS[this.actor];this.properties.body=this.body,t.onCall(this.properties)},e}(r(i(9163)).default);e.default=o},7519:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e0){var r=s.game.managers.story.currentScene[0];r&&"else"in r&&(s.branches.ISFALSE=r.else,s.game.managers.story.currentScene.shift())}return s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.branch(this.condition,this.branches),this.resolve()},e}(r(i(9163)).default);e.default=o},2028:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actorType="characters",s.actor=s.keyParams[0],s.look=s.keyParams.length>2?s.keyParams[2]:null,s.game.managers.story.reservedWords.includes(s.look)&&(console.log("look is reserved word"),s.look=null),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({actor:this.actor,message:e})}t=this.game.managers.text.characterSays(this.actor,this.look,this.body,this.boxId,this.dontHide),this.resolve(t)},e}(r(i(7068)).default);e.default=o},8998:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.scene=s.game.managers.logic.parseVars(s.body),s}return s(e,t),e.prototype.execute=function(){this.resolve(this.game.managers.story.startScene(this.scene))},e}(r(i(9163)).default);e.default=o},1929:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),s.transition||(s.transition=s.game.storyConfig.transitions.defaults[s.actorType]),s.contAfterTrans=s.parseParameter("CONTINUE");var r=s.parseParameter("AT","coords");r&&(s.properties.position=r),s.parseParameter("FLIP")&&(s.properties.flipped="flip"),"cgs"===s.actorType&&(s.properties.layer=s.parseParameter("BEHIND")?"behindCharactersSprites":"cgsSprites");var o=s.parseParameter("IN","string");return o&&(s.properties.layer=o),"characters"===s.actorType&&(s.properties.look=s.params[0],s.game.managers.story.reservedWords.includes(s.properties.look)&&(s.properties.look=null),s.properties.look||(s.properties.look="normal")),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.story.getManagerByActorType(this.actorType).show(this.actor,this.transition,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},7068:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.dontHide=!1,s.boxId=s.parseParameter("IN","string",!0),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({message:e})}t=this.game.managers.text.display(this.body,this.boxId,null,this.dontHide),this.resolve(t)},e}(r(i(9163)).default);e.default=o},733:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.setVar(this.actor,this.body),this.resolve()},e}(r(i(9163)).default);e.default=o},7843:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.execute=function(){"click"===this.body?this.game.waitForClick():this.game.waitTimeout(parseInt(this.body,10))},e}(r(i(9163)).default);e.default=o},5761:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i,n){this.game=t,this.keyName=e,this.config={displayName:"",color:"#FFFFFF",voice:"none",nameBox:"default",messageBox:"default"},this.currentLook=null,this.usePortraits=!1,this.voice=null,Object.assign(this.config,i),"none"!==this.config.voice&&(this.voice=this.game.add.audio(this.config.voice),this.voice.play(),this.voice.stop()),this.usePortraits=void 0!==n}return t.prototype.createPortrait=function(t,e){if(this.usePortraits&&e.config.portrait){var i=this.keyName+"_portrait_"+t,n=e.config.portrait,s=this.game.add.sprite(n.x,n.y,i);s.anchor.set(.5,1),e.addChild(s),e.portrait=s}},t.prototype.createLook=function(t){void 0===t&&(t={});var e=this.currentLook?this.getLookData():{look:"normal",position:this.game.storyConfig.positions.DEFAULT,flipped:!1};Object.assign(e,t);var i=this.keyName+"_"+e.look,n=this.game.managers.story.characterSprites.create(e.position.x,e.position.y,i);return n.name=e.look,"flip"===t.flipped&&(this.currentLook?e.flipped=!(-1===this.currentLook.scale.x):e.flipped=!0),n.scale.x=e.flipped?-1:1,n.anchor.set(.5,1),n.updateTransform(),n.alpha=0,this.currentLook=n,n},t.prototype.resetLook=function(){this.currentLook.destroy(),this.currentLook=null},t.prototype.getLookData=function(){return this.currentLook?{look:this.currentLook.name,position:{x:this.currentLook.x,y:this.currentLook.y},flipped:-1===this.currentLook.scale.x}:null},t}();e.default=i},2459:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1] GUIVersion=='2.0'");var I=a.default.dump(JSON.parse(JSON.stringify(this.config)));console.log(I)}},e.prototype.convertText=function(t){return{x:t.isTextCentered?0:parseInt(t["offset-x"],10),y:t.isTextCentered?0:parseInt(t["offset-y"],10),lineSpacing:t.lineSpacing,style:this.convertTextStyle(t)}},e.prototype.convertTextStyle=function(t){var e={font:t.font,fontSize:t.size+"px",fill:t.color};return t.align&&(e.align=t.align),t["text-width"]&&(e.wordWrap=!0,e.wordWrapWidth=t["text-width"]),t.isTextCentered?(e.boundsAlignH="center",e.boundsAlignV="middle"):t["text-width"]||(e.boundsAlignH=t.align?t.align:"left",e.boundsAlignV="top"),e},e}(o.default);e.default=h},4254:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.initAssets=function(t){var e=function(t,e,i){return Object.keys(t).map((function(n){return{key:n,file:i+t[n].fileName,type:e,w:t[n].w,h:t[n].h}}))},i=e(t.assets.images,"image",t.assetsPath),n=e(t.assets.audio,"audio",t.assetsPath),s=e(t.assets.spritesheets,"spritesheet",t.assetsPath);this.assets=i.concat(n).concat(s),this.fonts=Object.keys(t.assets.fonts),this.config=t.config},e}(r(i(2459)).default);e.default=o},5225:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(3572);function s(t){return t.replace(/\s+/g," ").trim()}function r(t){for(var e,i,s=n.tokenizeTextStyle((e=t,(i=document.createElement("div")).textContent=e,i.innerHTML)),r=[],o="";s.length;){var a=s.shift();a.tag?"end"===a.tag&&r.length?o+="":a.tag.startsWith("color")?(r.push("mark"),o+=""):"bold"===a.tag?(r.push("strong"),o+=""):"italic"===a.tag&&(r.push("em"),o+=""):o+=a.text}return o.replace(/\n/g,"
")}var o=function(){function t(t){var e=this;this.game=t,this.debug=!1,this.state={name:"",text:"",choices:[],buttons:[],sliders:[]},this.updateLayout=function(){e.updateLayoutContainer(),e.updateLayoutText(),e.updateLayoutChoices(),e.updateLayoutButtons(),e.updateLayoutSliders()},this.elContainer=document.createElement("div"),this.elContainer.style.position="fixed",this.elContainer.style.pointerEvents="none",this.debug&&(this.elContainer.style.border="solid 1px red"),this.elProgress=document.createElement("progress"),this.elProgress.max=100,this.elProgress.value=0,this.debug||(this.elProgress.style.opacity="0"),this.elChoices=document.createElement("ol"),this.elChoices.style.listStyle="none",this.elButtons=document.createElement("ul"),this.elButtons.style.listStyle="none",this.elSliders=document.createElement("ul"),this.elSliders.style.listStyle="none",this.elText=document.createElement("div"),this.elText.setAttribute("aria-live","polite"),this.elText.setAttribute("aria-atomic","true"),this.elText.setAttribute("aria-relevant","text"),this.elText.setAttribute("role","main"),this.elText.setAttribute("aria-roledescription","text"),this.elText.tabIndex=0,this.elText.onclick=function(){e.game.onTap(null)},this.elText.style.position="absolute",this.debug?(this.elText.style.color="red",this.elText.style.top="1rem",this.elText.style.left="1rem",this.elText.style.right="1rem",this.elText.style.bottom="1rem"):(this.elText.style.color="transparent",this.elText.style.fontSize="0",this.elText.style.outline="none",this.elText.style.top="0",this.elText.style.left="0",this.elText.style.right="0",this.elText.style.bottom="0"),this.elContainer.appendChild(this.elProgress),this.elContainer.appendChild(this.elText),this.elContainer.appendChild(this.elChoices),this.elContainer.appendChild(this.elSliders),this.elContainer.appendChild(this.elButtons)}return t.prototype.boot=function(){var t=this;this.game.canvas.setAttribute("aria-hidden","true"),this.game.scale.onSizeChange.add(this.updateLayout),this.updateLayout(),this.game.load.onLoadStart.add((function(){t.updateLayout(),t.busy(),t.progress(0)})),this.game.load.onLoadComplete.add((function(){t.progress(100),t.ready()})),this.game.load.onFileComplete.add((function(e){t.progress(e)})),document.body.appendChild(this.elContainer)},t.prototype.progress=function(t){void 0===t?delete this.elProgress.value:this.elProgress.value=Math.floor(t)},t.prototype.busy=function(){this.elText.setAttribute("aria-busy","true")},t.prototype.ready=function(){this.elText.setAttribute("aria-busy","false")},t.prototype.updateLayoutText=function(){var t,e=r("hud"!==(null===(t=this.game.gui)||void 0===t?void 0:t.currentMenu)?"":s(this.state.text).split("\n").map((function(t){return t.trim()})).filter((function(t){return t})).join("\n"));e.length>0&&this.state.name&&(e=s(this.state.name)+": "+e),this.elText.innerHTML=e},t.prototype.updateLayoutContainer=function(){this.elContainer.style.width=this.game.scale.width+"px",this.elContainer.style.height=this.game.scale.height+"px",this.elContainer.style.top=this.game.scale.margin.top+"px",this.elContainer.style.left=this.game.scale.margin.left+"px"},t.prototype.updateLayoutBounds=function(t,e){t.style.width=e.width*this.game.scale.scaleFactorInversed.x+"px",t.style.height=e.height*this.game.scale.scaleFactorInversed.y+"px",t.style.top=e.y*this.game.scale.scaleFactorInversed.y+"px",t.style.left=e.x*this.game.scale.scaleFactorInversed.x+"px"},t.prototype.updateLayoutList=function(t,e){var i=this;this.rescueFocus(t),e.forEach((function(e,n){var s=t.children[n];s.style.display=e.isActive()?null:"none",i.updateLayoutBounds(s,e.getBounds())}))},t.prototype.updateLayoutChoices=function(){this.updateLayoutList(this.elChoices,this.state.choices)},t.prototype.updateLayoutButtons=function(){this.updateLayoutList(this.elButtons,this.state.buttons)},t.prototype.updateLayoutSliders=function(){this.updateLayoutList(this.elSliders,this.state.sliders)},t.prototype.rescueFocus=function(t){var e=document.activeElement;t!==e&&(e&&!t.contains(e)||this.elText.focus())},t.prototype.text=function(t){void 0===t&&(t=""),this.state.text=t,this.updateLayoutText()},t.prototype.name=function(t){void 0===t&&(t=""),this.state.name=t,this.updateLayoutText()},t.prototype.button=function(t){var e,i,n;this.state.buttons.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("button");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.textContent=(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.buttons)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Button "+this.state.buttons.length,r.onclick=t.onclick,r.onfocus=t.onfocus,r.onblur=t.onblur,s.appendChild(r),this.elButtons.appendChild(s),this.updateLayoutButtons()},t.prototype.slider=function(t){var e,i,n;this.state.sliders.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("input");r.type="number",r.setAttribute("aria-label",(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.sliders)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Slider "+this.state.buttons.length),r.min=t.min.toString(10),r.max=t.max.toString(10),r.step=t.step.toString(10),r.value=t.get().toString(10),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.appearance="textfield",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.onchange=function(e){return t.set(Number(e.currentTarget.value))},r.onfocus=function(){r.value=t.get().toString(10)},s.appendChild(r),this.elSliders.appendChild(s),this.updateLayoutSliders()},t.prototype.choices=function(t){var e=this;void 0===t&&(t=[]),this.state.choices=t,this.rescueFocus(this.elChoices),this.elChoices.innerHTML="",t.forEach((function(t){var i,n,s,o=document.createElement("li");o.style.position="absolute";var a=document.createElement("button");a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.background="transparent",e.debug?(a.style.border="solid 1px red",a.style.color="red"):(a.style.border="none",a.style.color="transparent",a.style.fontSize="0"),a.innerHTML=r(null!==(s=null===(n=null===(i=e.game.storyAccessibility)||void 0===i?void 0:i.choices)||void 0===n?void 0:n[t.label])&&void 0!==s?s:t.label),a.onclick=t.onclick,a.onfocus=t.onfocus,a.onblur=t.onblur,o.appendChild(a),e.elChoices.appendChild(o)})),this.updateLayoutChoices()},t}();e.default=o},150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(i,n){var s=t.call(this,i,n.x,n.y,n.asset,(function(){s.onClick()}))||this;return s.setFrames.apply(s,e.getButtonFrames(s.animations.frameTotal)),s.config=n,s.game=i,s}return s(e,t),e.getButtonFrames=function(t,e){void 0===e&&(e=!1);return{1:{normal:[0,0,0,0],pushed:[1,1,1,1]},2:{normal:[1,0,1,0],pushed:[3,2,3,2]},3:{normal:[1,0,2,0],pushed:[4,3,5,3]},4:{normal:[1,0,2,3],pushed:[5,4,6,7]}}[t][e?"pushed":"normal"]},e.prototype.onClick=function(){this.config.sfx&&"none"!==this.config.sfx&&this.game.managers.audio.playSFX(this.config.sfx),this.game.gui.bindingActions[this.config.binding](this.config,this)},e}(i(9747).Button);e.default=r},812:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?f--:(r.text.text+=d[p],r.onCharacter&&r.onCharacter(d,p),e&&(" "===d[p]||"\n"===d[p]||r.punctuationMarks.includes(d[p])||m===g?m=-1:0===m&&(e.play(),e.volume=r.game.userPreferences.get("sfxv")),m++),r.punctuationMarks.includes(d[p])&&(f=r.punctuationWait),++p>=d.length&&i())}),s),[2]}}))}))}))},e.prototype.hide=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.game.accessibility.text(),this.visible?(t||(t=this.config.transition),[4,this.game.screenEffects.transition.get(t)(this,null)]):[2];case 1:return e.sent(),this.visible=!1,[2]}}))}))},e.prototype.clear=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.config.alwaysOn?[3,2]:[4,this.hide(t)];case 1:e.sent(),e.label=2;case 2:return this.text.setText("",!0),this.ctc&&(this.ctc.visible=!1),this.portrait&&(this.portrait.destroy(),this.portrait=null),[2]}}))}))},e}(h.Sprite);e.default=u},5148:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.game=t,this.container=t.add.group(),this.container.alpha=0;var e=t.config.loadingScreen;if(e.background&&(this.background=this.container.create(t.world.centerX,t.world.centerY,"loadingScreenBg"),this.background.anchor.set(.5)),e.loadingBar){var i=e.loadingBar.position;this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar"),this.loadingBar.animations.frameTotal>1&&(this.loadingBarBg=this.loadingBar,this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar",1))}e.fade?t.add.tween(this.container).to({alpha:1},500).start():this.container.alpha=1}return t.prototype.setLoadingBar=function(t){if(this.loadingBar){var e=t.config.loadingScreen.loadingBar.direction?t.config.loadingScreen.loadingBar.direction:0;t.load.setPreloadSprite(this.loadingBar,e)}},t.prototype.waitingScreen=function(){this.loadingBar&&this.game.add.tween(this.loadingBar).to({alpha:1},600,null,!0,0,-1,!0)},t.prototype.destroy=function(t){var e=this;if(t.config.loadingScreen.fade){var i=t.add.tween(this.container).to({alpha:0},500);i.onComplete.addOnce((function(){e.container.destroy()})),i.start()}else this.container.destroy()},t}();e.default=i},7898:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(e,i){var n=t.call(this,e,i.x,i.y,i.asset)||this;n.game=e,n.config=i;var s=n.game.getSlotThumbnail(n.config.slot);return s&&n.loadThumbnail(s),n}return s(e,t),e.prototype.loadThumbnail=function(t){var e=this,i="thumbnail"+Math.floor(5e3*Math.random());this.game.load.image(i,t),this.game.load.onLoadComplete.addOnce((function(){var t=e.game.add.sprite(e.config.thumbnail.x,e.config.thumbnail.y,i);t.width=e.config.thumbnail.width,t.height=e.config.thumbnail.height,e.addChild(t)}),this),this.game.load.start()},e.prototype.destroy=function(){this.thumbnail.destroy(),t.prototype.destroy.call(this)},e}(i(9747).Sprite);e.default=r},3607:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Plugin=e.game=void 0;var s=n(i(8811)),r=n(i(885));e.game=s.default,e.Plugin=r.default},6041:function(t,e){"use strict";var i=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]2&&(l=parseInt(o[2],10)),this.cgs[t].animations.add(r,a,l)}n||(n={x:this.cgs[t].x,y:this.cgs[t].y}),i.zoom&&this.cgs[t].scale.set(i.zoom);var c=!1;if(void 0!==i.flipped){var u=this.cgs[t].scale.x<0;"flip"===i.flipped?(this.cgs[t].scale.x*=-1,c=!u):(c=i.flipped)!==u&&(this.cgs[t].scale.x*=-1)}return i.angle&&(this.cgs[t].angle=i.angle),this.current[t]={name:t,position:n,zoom:i.zoom,angle:i.angle,layer:i.layer,flipped:c},this.transition.get(e)(s,this.cgs[t],n)},t.prototype.animate=function(t,e){return s(this,void 0,void 0,(function(){var i,s,o=this;return r(this,(function(r){return i=e.time,s={},void 0!==e.alpha&&null!==e.alpha&&(s.alpha=e.alpha),void 0!==e.angle&&null!==e.angle&&(s.angle=e.angle),void 0!==e.position&&null!==e.position&&(s.x=e.position.x,s.y=e.position.y),void 0!==e.zoom&&null!==e.zoom&&(this.cgs[t].originalScale||(this.cgs[t].originalScale={width:this.cgs[t].width,height:this.cgs[t].height}),s.height=this.cgs[t].originalScale.height*e.zoom,s.width=this.cgs[t].originalScale.width*e.zoom),this.current[t]=n(n({},this.current[t]),e),[2,new Promise((function(n){var r=n;if(e.spritesheet){var a=function(){o.cgs[t].animations.stop(),n()};if("STOP"===e.spritesheet)o.cgs[t].frame=0,a();else{var h=e.spritesheet.split(" "),l=h[0],c=h.includes("LOOPED"),u=o.cgs[t].animations.getAnimation(l);if(h.includes("BACKWARDS")&&u.reverseOnce(),u.play(null,c),0===Object.keys(s).length)return c?i?o.game.waitTimeout(i,a.bind(o)):n():o.game.control.skipping?a():u.onComplete.addOnce(a.bind(o));r=a.bind(o)}}o.game.managers.tween.tween(o.cgs[t],s,r,i,!0)}))]}))}))},t.prototype.hide=function(t,e){return s(this,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return[4,this.transition.get(e)(this.cgs[t],null)];case 1:return i.sent(),this.cgs[t].destroy(),delete this.cgs[t],delete this.current[t],[2]}}))}))},t.prototype.isCGS=function(t){return this.game.setup.cgs&&t in this.game.setup.cgs},t}();e.default=l},878:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&(n.available=this.evalExpression(s[1]),n.choiceText=s[0].trim()),e.interrupt&&(n.interrupt=!0,n.origin=e.interrupt),n},LogicManager.prototype.choose=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:return e=this.currentChoices[t],this.updateChoiceLog(e.index),this.game.storyConfig.keepStoryLog&&this.game.storyLog.push({message:e.choiceText,choice:!0}),i=e.actions,this.game.managers.story.currentScene=i.concat(this.game.managers.story.currentScene),this.showingText&&t++,this.interrupting?this.game.control.execStack.stack("interrupt",i.length,e.index,e.origin):this.game.control.execStack.stack("choice",i.length,e.index),this.game.config.debugMode&&console.log("Choice taken "+t+" : "+e.choiceText),[4,this.clearChoices()];case 1:return n.sent(),this.interrupting?this.interrupting=null:this.game.resolveAction(),[2]}}))}))},LogicManager.prototype.getExecStackId=function(){var t=this.game.control.execStack.hash();return this.choicesLog[t]||(this.choicesLog[t]=[]),t},LogicManager.prototype.checkTextAction=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i,n=this;return __generator(this,(function(s){return!(e=this.game.managers.story.parseAction(__assign({},t)))||"say"!==e.actionType&&"text"!==e.actionType?[2,!1]:((i=e).dontHide=!0,[2,new Promise((function(t){i.resolve=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(i){switch(i.label){case 0:return[4,e];case 1:return i.sent(),t(!0),[2]}}))}))},i.execute()}))])}))}))},LogicManager.prototype.showChoices=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i,n,s=this;return __generator(this,(function(r){switch(r.label){case 0:return i=this,[4,this.checkTextAction(e[0])];case 1:return i.showingText=r.sent(),this.showingText&&e.shift(),this.currentChoices=e.map((function(t,e){return s.parseChoice(e,t)})),this.currentChoices=this.currentChoices.filter((function(t){return t.available})),n=-1,t||(t="default"),"visualChoices"!==t?[3,3]:[4,this.game.gui.hud.showVisualChoices(this.currentChoices)];case 2:return n=r.sent(),[3,5];case 3:return[4,this.game.gui.hud.showChoices(t,this.currentChoices)];case 4:n=r.sent(),r.label=5;case 5:return this.choose(n),[2]}}))}))},LogicManager.prototype.interrupt=function(t,e){this.interrupting={origin:this.game.control.execStack.top().c,execId:this.getExecStackId()},this.showChoices(t,e),this.game.resolveAction()},LogicManager.prototype.clearChoices=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.game.gui.hud.clear()];case 1:return t.sent(),this.currentChoices=[],this.showingText=!1,[2]}}))}))},LogicManager}();exports.default=LogicManager},7745:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.current=[],this.game=t}return t.prototype.tween=function(t,e,i,n,s,r,o){var a=this;void 0===r&&(r=0),void 0===o&&(o=!1);var h=this.game.add.tween(t);return h.to(e,n,Phaser.Easing.Linear.None,!1,r),i&&(h.onComplete.addOnce(i,this),h.callbackOnComplete=i),h.tweenables=e,s&&(this.current=[],h.start(),this.canSkip()&&!o?this.game.waitForClick((function(){return a.skip()})):(this.game.input.enabled=!1,h.onComplete.addOnce((function(){a.game.input.enabled=!0}),this))),this.current.push(h),this.game.control.skipping&&(this.game.input.enabled=!0,this.skip()),h},t.prototype.chain=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[];var s=null;t.forEach((function(e){var r=e.time?e.time:i/t.length,o=n.tween(e.sprite,e.tweenables,e.callback,r,!1,e.delay);s&&s.chain(o),s=o})),this.game.control.skipping?this.canSkip()&&!e&&this.game.waitForClick((function(){return n.skip()})):this.current[0].start()},t.prototype.parallel=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[],t.forEach((function(t){n.tween(t.sprite,t.tweenables,t.callback,i,!0,t.delay)})),this.canSkip()||e||this.game.waitForClick((function(){return n.skip()}))},t.prototype.canSkip=function(){return this.game.storyConfig.transitions.skippable&&!this.game.control.unskippable},t.prototype.skip=function(){this.game.control.unskippable||(this.current.forEach((function(t){for(var e in t.stop(!1),t.tweenables)t.target[e]=t.tweenables[e];t.callbackOnComplete&&t.callbackOnComplete()})),this.current=[])},t}();e.default=i},4664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.clearFunctions=[],this.current=[],this.game=t,this.audioManager=t.managers.audio}return t.prototype.start=function(t){this.current.push(t),this[t]?this[t]():this.game.pluginsRJS[t]&&this.game.pluginsRJS[t].onCall()},t.prototype.set=function(t){if(t)for(var e=0,i=t;e0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]=0;i--)this.game.load.text("story"+i,h.preparePath(this.game.config.storyText[i],this.game))},e.prototype.create=function(t){var e=this;new p.default(this.game).setLoadingBar(this.game),this.input.onDown.addOnce((function(){"suspended"===e.sound.context.state&&e.sound.context.resume()})),this.game.tools.jsyaml=a.default,this.game.setup=a.default.load(this.game.cache.getText("storySetup")),t.setup||(this.game.setup={}),this.game.storyConfig=a.default.load(this.game.cache.getText("storyConfig")),this.game.storyAccessibility=a.default.load(this.game.cache.getText("storyAccessibility"));var i={};this.game.config.storyText.forEach((function(t,n){var s=a.default.load(e.game.cache.getText("story"+n));Object.assign(i,r({},s))})),this.game.story=i,this.game.guiSetup=a.default.load(this.game.cache.getText("guiConfig")),"2.0"===t.guiSetup.GUIVersion||"2.0"===t.guiSetup.madeWithRenJSBuilder?t.gui=new d.default(t):t.guiSetup.madeWithRenJSBuilder?t.gui=new u.default(t):(console.error("Old GUI configuration is deprecated!!!!"),console.error("Check the docs at http://renjs.net/docs-page.html")),t.state.add("preloadStory",c.default),t.state.start("preloadStory")},e}(l.default);e.default=f},8171:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return t.call(this)||this}return s(e,t),e.prototype.init=function(){this.game.setupScreen()},e.prototype.preload=function(){for(var t in this.game.config.i18n.background&&this.game.load.image("langChooserBg",this.game.config.i18n.background),this.game.config.i18n.langs){var e=this.game.config.i18n.langs[t];this.game.load.spritesheet("languageTag"+t,e.asset,e.size.w,e.size.h)}},e.prototype.create=function(){var t=this;this.game.config.i18n.background&&this.game.add.image(0,0,"langChooserBg");var e=function(e){var n=i.game.config.i18n.langs[e];i.game.add.button(n.position.x,n.position.y,"languageTag"+e,(function(){t.game.config.i18n.current=e,localStorage.setItem("RenJS_I18N"+t.game.config.name,e),t.game.state.start("bootstrap")}),i,1,0,1,0)},i=this;for(var n in this.game.config.i18n.langs)e(n)},e}(r(i(4015)).default);e.default=o},1150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";function i(t,e){return e.config.i18n?t.replace("LANG",e.config.i18n.current):t}function n(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}Object.defineProperty(e,"__esModule",{value:!0}),e.loadStyle=e.guid=e.preloadExtra=e.preloadCharacter=e.preloadAudio=e.preloadCGS=e.preloadBackground=e.preparePath=void 0,e.preparePath=i,e.preloadBackground=function(t,e){var n=e.setup.backgrounds[t].split(" ");1===n.length?e.load.image(t,i(n[0],e)):e.load.spritesheet(t,i(n[0],e),parseInt(n[1],10),parseInt(n[2],10))},e.preloadCGS=function(t,e){var n=e.setup.cgs[t];if("string"==typeof n)e.load.image(t,i(n,e));else{var s=n.spritesheet.split(" ");e.load.spritesheet(t,i(s[0],e),parseInt(s[1],10),parseInt(s[2],10))}},e.preloadAudio=function(t,e,n){n.load.audio(t,i(n.setup[e][t],n))},e.preloadCharacter=function(t,e){var n=e.setup.characters[t];for(var s in n.looks)e.load.image(t+"_"+s,i(n.looks[s],e));for(var r in n.portraits)e.load.image(t+"_portrait_"+r,i(n.portraits[r],e))},e.preloadExtra=function(t,e,n){if("spritesheets"===e){var s=n.setup.extra[e][t].split(" ");n.load.spritesheet(t,i(s[0],n),parseInt(s[1],10),parseInt(s[2],10))}else n.load[e](t,i(n.setup.extra[e][t],n))},e.guid=function(){return"ss".replace(/s/g,n)},e.loadStyle=function(t,e){for(var i=0,n=Array.from(document.styleSheets);i{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0,e.range=function(t,e,i){void 0===i&&(i=1);for(var n=[t],s=t;s{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hudSort=e.setTextStyles=e.changeInputEnabled=void 0;var n=i(3572);e.changeInputEnabled=function t(e,i){e.input&&(e.input.enabled=i);for(var n=0,s=e.children;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenizeTextStyle=void 0;var i=/\((?:color:(?:\w+|#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6})|italic|bold|end)\)/;e.tokenizeTextStyle=function(t){for(var e=[];;){var n=i.exec(t);if(!n)return e.push({text:t}),e;var s=n.index,r=n[0];e.push({text:t.substr(0,s)}),e.push({tag:r.slice(1,-1)}),t=t.substr(s+r.length)}}},4147:t=>{"use strict";t.exports=JSON.parse('{"name":"renjs","version":"2.7.2","description":"RenJS is a videogame library for making Visual Novels that run directly in the web browser","author":"lunafromthemoon","contributors":["RockDaFox","Sean S. LeBlanc"],"license":"CC-BY-SA-4.0","repository":{"type":"git","url":"git+https://github.com/lunafromthemoon/RenJS-V2.git"},"bugs":{"url":"https://github.com/lunafromthemoon/RenJS-V2/issues"},"homepage":"https://renjs.net","keywords":["engine","visual","novel","phaser"],"files":["dist"],"main":"dist/renjs.js","types":"dist/types/index.d.ts","scripts":{"start":"webpack-dev-server --config webpack.dev.js --hot --progress","build":"webpack --config webpack.prod.js","build:docs":"./scripts/build-docs.sh","build:demo":"./scripts/build-demo.sh","lint":"eslint \\"./src/**/*.{j,t}s\\"","postversion":"npm run build && npm run build:docs"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm",["@semantic-release/github",{"assets":"dist/renjs.js"}],["@semantic-release/git",{"assets":["docs/**/*","dist/**/*","CHANGELOG.md","package.json","package-lock.json"]}]]},"dependencies":{"fontfaceobserver":"^2.1.0","js-yaml":"^4.1.0","object-hash":"^2.0.3","phaser-ce":"^2.16.0"},"devDependencies":{"@types/fontfaceobserver":"^2.1.0","@types/js-yaml":"^4.0.5","@typescript-eslint/eslint-plugin":"^5.5.0","@typescript-eslint/parser":"^5.5.0","bestzip":"^2.2.0","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^10.0.0","eslint":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-promise":"^5.2.0","eslint-plugin-standard":"^5.0.0","expose-loader":"^3.1.0","terser-webpack-plugin":"^5.2.5","ts-loader":"^9.2.6","typescript":"^3.9.7","webpack":"^5.64.4","webpack-cli":"^4.9.1","webpack-dev-server":"^4.6.0","webpack-merge":"^5.8.0"}}')}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(3607);RenJS=__webpack_exports__})(); \ No newline at end of file diff --git a/docs/downloads/releases/renjs.js b/docs/downloads/releases/renjs.js index 1a30020c..c755b944 100644 --- a/docs/downloads/releases/renjs.js +++ b/docs/downloads/releases/renjs.js @@ -897,4 +897,4 @@ void 0===PIXI.blendModes&&(PIXI.blendModes=n.blendModes),void 0===PIXI.scaleMode * @author Richard Davey * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ -i.DisplayObject=function(){this.position=new i.Point(0,0),this.scale=new i.Point(1,1),this.pivot=new i.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.renderable=!1,this.parent=null,this.worldAlpha=1,this.worldTransform=new Phaser.Matrix,this.worldPosition=new i.Point(0,0),this.worldScale=new i.Point(1,1),this.worldRotation=0,this.filterArea=null,this._sr=0,this._cr=1,this._bounds=new i.Rectangle(0,0,0,0),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},i.DisplayObject.prototype={constructor:i.DisplayObject,destroy:function(){if(this.children){for(var t=this.children.length;t--;)this.children[t].destroy();this.children=[]}this.hitArea=null,this.parent=null,this.worldTransform=null,this.filterArea=null,this.renderable=!1,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture()},updateTransform:function(t){if(!t&&!this.parent&&!this.game)return this;var e=this.parent;t?e=t:this.parent||(e=this.game.world);var i,n,s,r,o,a,h=e.worldTransform,l=this.worldTransform;this.rotation%Phaser.Math.PI2?(this.rotation!==this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation)),i=this._cr*this.scale.x,n=this._sr*this.scale.x,s=-this._sr*this.scale.y,r=this._cr*this.scale.y,o=this.position.x,a=this.position.y,(this.pivot.x||this.pivot.y)&&(o-=this.pivot.x*i+this.pivot.y*s,a-=this.pivot.x*n+this.pivot.y*r),l.a=i*h.a+n*h.c,l.b=i*h.b+n*h.d,l.c=s*h.a+r*h.c,l.d=s*h.b+r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty):(i=this.scale.x,n=0,s=0,r=this.scale.y,o=this.position.x-this.pivot.x*i,a=this.position.y-this.pivot.y*r,l.a=i*h.a,l.b=i*h.b,l.c=r*h.c,l.d=r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty),i=l.a,n=l.b,s=l.c;var c=i*(r=l.d)-n*s;if(i||n){var u=Math.sqrt(i*i+n*n);this.worldRotation=n>0?Math.acos(i/u):-Math.acos(i/u),this.worldScale.x=u,this.worldScale.y=c/u}else if(s||r){var d=Math.sqrt(s*s+r*r);this.worldRotation=Phaser.Math.HALF_PI-(r>0?Math.acos(-s/d):-Math.acos(s/d)),this.worldScale.x=c/d,this.worldScale.y=d}else this.worldScale.x=0,this.worldScale.y=0;return this.worldAlpha=this.alpha*e.worldAlpha,this.worldPosition.x=l.tx,this.worldPosition.y=l.ty,this._currentBounds=null,this.transformCallback&&this.transformCallback.call(this.transformCallbackContext,l,h),this},preUpdate:function(){},generateTexture:function(t,e,n){var s=this.getLocalBounds(),r=new Phaser.RenderTexture(this.game,0|s.width,0|s.height,n,e,t);return i.DisplayObject._tempMatrix.tx=-s.x,i.DisplayObject._tempMatrix.ty=-s.y,r.render(this,i.DisplayObject._tempMatrix),r},updateCache:function(){return this._generateCachedSprite(),this},toGlobal:function(t){return this.updateTransform(),this.worldTransform.apply(t)},toLocal:function(t,e){return e&&(t=e.toGlobal(t)),this.updateTransform(),this.worldTransform.applyInverse(t)},_renderCachedSprite:function(t){this._cachedSprite.worldAlpha=this.worldAlpha,t.gl?i.Sprite.prototype._renderWebGL.call(this._cachedSprite,t):i.Sprite.prototype._renderCanvas.call(this._cachedSprite,t)},_generateCachedSprite:function(){this._cacheAsBitmap=!1;var t=this.getLocalBounds();if(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),this.updateTransform(),this._cachedSprite)this._cachedSprite.texture.resize(t.width,t.height);else{var e=0;this.texture&&this.texture.baseTexture&&i._enableMultiTextureToggle&&(e=this.texture.baseTexture.textureIndex);var n=new Phaser.RenderTexture(this.game,t.width,t.height,void 0,void 0,void 0,void 0,e);this._cachedSprite=new i.Sprite(n),this._cachedSprite.worldTransform=this.worldTransform}var s=this._filters;this._filters=null,this._cachedSprite.filters=s,i.DisplayObject._tempMatrix.tx=-t.x,i.DisplayObject._tempMatrix.ty=-t.y,this._cachedSprite.texture.render(this,i.DisplayObject._tempMatrix,!0),this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._filters=s,this._cacheAsBitmap=!0},_destroyCachedSprite:function(){this._cachedSprite&&(this._cachedSprite.texture.destroy(!0),this._cachedSprite=null)},_destroyTintedTexture:function(){this.tintedTexture&&(Phaser.CanvasPool.removeByCanvas(this.tintedTexture),this.tintedTexture=null)}},i.DisplayObject.prototype.displayObjectUpdateTransform=i.DisplayObject.prototype.updateTransform,Object.defineProperties(i.DisplayObject.prototype,{x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},worldVisible:{get:function(){if(this.visible){var t=this.parent;if(!t)return this.visible;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}return!1}},mask:{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,t&&(this._mask.isMask=!0)}},filters:{get:function(){return this._filters},set:function(t){if(Array.isArray(t)){for(var e=[],n=0;n=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},i.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);if(i<0||n<0)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[n]=t}},i.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},i.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},i.DisplayObjectContainer.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},i.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);if(-1!==e)return this.removeChildAt(e)},i.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(e.parent=void 0,this.children.splice(t,1)),e},i.DisplayObjectContainer.prototype.bringChildToTop=function(t){if(t.parent===this)return this.setChildIndex(t,this.children.length-1)},i.DisplayObjectContainer.prototype.sendChildToBack=function(t){if(t.parent===this)return this.setChildIndex(t,0)},i.DisplayObjectContainer.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i=e-t;if(i>0&&i<=e){for(var n=this.children.splice(t,i),s=0;s(a=o.width+o.x)?u:a,d=d>(h=o.height+o.y)?d:h)}var f=this._bounds;if(!p){var g=(f=new i.Rectangle).x,m=f.width+f.x,y=f.y,v=f.height+f.y,b=this.worldTransform,x=b.a,w=b.b,_=b.c,T=b.d,C=b.tx,S=b.ty,P=x*m+_*v+C,A=T*v+w*m+S,E=x*g+_*v+C,M=T*v+w*g+S,k=x*g+_*y+C,L=T*y+w*g+S,O=x*m+_*y+C,I=T*y+w*m+S;l=O<(l=k<(l=E<(l=P)?E:l)?k:l)?O:l,c=I<(c=L<(c=M<(c=A)?M:c)?L:c)?I:c,u=O>(u=k>(u=E>(u=P)?E:u)?k:u)?O:u,d=I>(d=L>(d=M>(d=A)?M:d)?L:d)?I:d}if(f.x=l,f.y=c,f.width=u-l,f.height=d-c,n)for(t.worldTransform=r,e=0;e(f=T>(f=w>(f=b>f?b:f)?w:f)?T:f)?S:f,g=P>(g=C>(g=_>(g=x>g?x:g)?_:g)?C:g)?P:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=y,A.height=g-y,this._currentBounds=A,A},i.Sprite.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=Phaser.identityMatrix;for(var e=0;e= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) { gl_FragColor = RED;return;}","}"];var s=i.compileProgram(t,this.vertexSrc||i.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(s),this.uSamplerArray=t.getUniformLocation(s,"uSamplerArray[0]"),this.projectionVector=t.getUniformLocation(s,"projectionVector"),this.offsetVector=t.getUniformLocation(s,"offsetVector"),this.dimensions=t.getUniformLocation(s,"dimensions"),this.aVertexPosition=t.getAttribLocation(s,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(s,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(s,"aColor"),this.aTextureIndex=t.getAttribLocation(s,"aTextureIndex");var r=[],o=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var a=0;a 0.0) gl_Position = vec4(0.0);"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);"," vTextureIndex = aTextureIndex;","}"],i.PixiFastShader=function(t){if(this._UID=Phaser._UID++,this.gl=t,this.program=null,i._enableMultiTextureToggle){t=this.gl;this.MAX_TEXTURES=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);for(var e="\tif (vTextureIndex == 0.0) { gl_FragColor = texture2D(uSamplerArray[0], vTextureCoord) * vColor;return;}\n",n=1;n= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["// PixiFastShader Fragment Shader.","precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;","}"];this.vertexSrc=["// PixiFastShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","attribute float aTextureIndex;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;"," vColor = aColor;","}"],this.textureCount=0,this.init()},i.PixiFastShader.prototype.constructor=i.PixiFastShader,i.PixiFastShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["//StripShader Fragment Shader.","precision mediump float;","varying vec2 vTextureCoord;","varying float vTextureIndex;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);","}"];this.vertexSrc=["//StripShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aTextureIndex;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying float vTextureIndex;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;","}"],this.init()},i.StripShader.prototype.constructor=i.StripShader,i.StripShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},n=this.gl,s=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),r=n.getParameter(n.MAX_TEXTURE_SIZE),o=this.game.cache._cache.image,a=null,h=0;h=this.size&&(this.flush(),this.currentBaseTexture=n.baseTexture);var a=n._uvs;if(a){var h,l,c,u,d=t.anchor.x,p=t.anchor.y;if(n.trim){var f=n.trim;h=(l=f.x-d*f.width)+n.crop.width,c=(u=f.y-p*f.height)+n.crop.height}else h=n.frame.width*(1-d),l=n.frame.width*-d,c=n.frame.height*(1-p),u=n.frame.height*-p;var g=this.currentBatchSize*this.vertexSize,m=n.baseTexture.resolution,y=n.baseTexture.textureIndex,v=o.a/m,b=o.b/m,x=o.c/m,w=o.d/m,_=o.tx,T=o.ty,C=n.crop.height;if(n.rotated){var S=o.a,P=o.b,A=o.c,E=o.d,M=l,k=h;_=o.c*C+_,T=o.d*C+T,v=6123233995736766e-32*S-A,b=6123233995736766e-32*P-E,x=S+6123233995736766e-32*A,w=P+6123233995736766e-32*E,n._updateUvsInverted(),h=c,l=u,c=k,u=M}var L=this.colors,O=this.positions,I=t.tint,B=(I>>16)+(65280&I)+((255&I)<<16)+(255*t.worldAlpha<<24);this.renderSession.roundPixels?(O[g++]=v*l+x*u+_|0,O[g++]=w*u+b*l+T|0,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_|0,O[g++]=w*u+b*h+T|0,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_|0,O[g++]=w*c+b*h+T|0,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_|0,O[g++]=w*c+b*l+T|0,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y):(O[g++]=v*l+x*u+_,O[g++]=w*u+b*l+T,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_,O[g++]=w*u+b*h+T,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_,O[g++]=w*c+b*h+T,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_,O[g++]=w*c+b*l+T,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y),this.sprites[this.currentBatchSize++]=t}},i.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var e=t.tilingTexture,n=e.baseTexture,s=this.gl,r=t.texture.baseTexture.textureIndex;i.WebGLRenderer.textureArray[r]!=n&&(this.flush(),s.activeTexture(s.TEXTURE0+r),s.bindTexture(s.TEXTURE_2D,n._glTextures[s.id]),i.WebGLRenderer.textureArray[r]=n),this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture),t._uvs||(t._uvs=new i.TextureUvs);var o=t._uvs,a=e.baseTexture.width,h=e.baseTexture.height;t.tilePosition.x%=a*t.tileScaleOffset.x,t.tilePosition.y%=h*t.tileScaleOffset.y;var l=t.tilePosition.x/(a*t.tileScaleOffset.x),c=t.tilePosition.y/(h*t.tileScaleOffset.y),u=t.width/a/(t.tileScale.x*t.tileScaleOffset.x),d=t.height/h/(t.tileScale.y*t.tileScaleOffset.y);o.x0=0-l,o.y0=0-c,o.x1=1*u-l,o.y1=0-c,o.x2=1*u-l,o.y2=1*d-c,o.x3=0-l,o.y3=1*d-c;var p=t.tint,f=(p>>16)+(65280&p)+((255&p)<<16)+(255*t.worldAlpha<<24),g=this.positions,m=this.colors,y=t.width,v=t.height,b=t.anchor.x,x=t.anchor.y,w=y*(1-b),_=y*-b,T=v*(1-x),C=v*-x,S=this.currentBatchSize*this.vertexSize,P=e.baseTexture.resolution,A=t.worldTransform,E=A.a/P,M=A.b/P,k=A.c/P,L=A.d/P,O=A.tx,I=A.ty;g[S++]=E*_+k*C+O,g[S++]=L*C+M*_+I,g[S++]=o.x0,g[S++]=o.y0,m[S++]=f,g[S++]=r,g[S++]=E*w+k*C+O,g[S++]=L*C+M*w+I,g[S++]=o.x1,g[S++]=o.y1,m[S++]=f,g[S++]=r,g[S++]=E*w+k*T+O,g[S++]=L*T+M*w+I,g[S++]=o.x2,g[S++]=o.y2,m[S++]=f,g[S++]=r,g[S++]=E*_+k*T+O,g[S++]=L*T+M*_+I,g[S++]=o.x3,g[S++]=o.y3,m[S++]=f,g[S++]=r,this.sprites[this.currentBatchSize++]=t},i.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e,n,s,r=this.gl;if(this.dirty){this.dirty=!1,t=this.defaultShader.shaders[r.id],r.activeTexture(r.TEXTURE0),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var o=this.vertexSize;r.vertexAttribPointer(t.aVertexPosition,2,r.FLOAT,!1,o,0),r.vertexAttribPointer(t.aTextureCoord,2,r.FLOAT,!1,o,8),r.vertexAttribPointer(t.colorAttribute,4,r.UNSIGNED_BYTE,!0,o,16),r.vertexAttribPointer(t.aTextureIndex,1,r.FLOAT,!1,o,20)}if(this.currentBatchSize>.5*this.size)r.bufferSubData(r.ARRAY_BUFFER,0,this.vertices);else{r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer);var a=this.positions.subarray(0,this.currentBatchSize*this.vertexSize);r.bufferSubData(r.ARRAY_BUFFER,0,a)}for(var h,l=0,c=0,u=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,y=this.currentBatchSize;m0&&(v=!1),(f||g)&&(this.renderBatch(u,l,c),c=m,l=0,u=e,f&&(d=n,this.renderSession.blendModeManager.setBlendMode(d)),g)){(t=(p=s).shaders[r.id])||((t=new i.PixiShader(r)).fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[r.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var b=this.renderSession.projection;r.uniform2f(t.projectionVector,b.x,b.y);var x=this.renderSession.offset;r.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(u,l,c),this.currentBatchSize=0}},i.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var n=this.gl;if(t._dirty[n.id]){if(!this.renderSession.renderer.updateTexture(t))return}else n.bindTexture(n.TEXTURE_2D,t._glTextures[n.id]);n.drawElements(n.TRIANGLES,6*e,n.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},i.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},i.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},i.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},i.WebGLFastSpriteBatch=function(t){this.vertSize=11,this.maxSize=6e3,this.size=this.maxSize;var e=4*this.size*this.vertSize,i=6*this.maxSize;this.vertices=new Float32Array(e),this.indices=new Uint16Array(i),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,s=0;n=this.size&&this.flush()}},i.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]){if(this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}else this.renderSession.renderer.updateTexture(this.currentBaseTexture,t)}},i.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},i.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36),t.vertexAttribPointer(this.shader.aTextureIndex,1,t.FLOAT,!1,i,40)},i.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},i.WebGLFilterManager.prototype.constructor=i.WebGLFilterManager,i.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},i.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},i.WebGLFilterManager.prototype.pushFilter=function(t){var e=this.gl,n=this.renderSession.projection,s=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),t._previous_stencil_mgr=this.renderSession.stencilManager,this.renderSession.stencilManager=new i.WebGLStencilManager,this.renderSession.stencilManager.setContext(e),e.disable(e.STENCIL_TEST),this.filterStack.push(t);var r=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var o=this.texturePool.pop();o?o.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution):o=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),e.bindTexture(e.TEXTURE_2D,o.texture);var a=t._filterArea,h=r.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),e.bindFramebuffer(e.FRAMEBUFFER,o.frameBuffer),e.viewport(0,0,a.width*this.renderSession.resolution,a.height*this.renderSession.resolution),n.x=a.width/2,n.y=-a.height/2,s.x=-a.x,s.y=-a.y,e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t._glFilterTexture=o},i.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,e=this.filterStack.pop(),n=e._filterArea,s=e._glFilterTexture,r=this.renderSession.projection,o=this.renderSession.offset;if(e.filterPasses.length>1){t.viewport(0,0,n.width*this.renderSession.resolution,n.height*this.renderSession.resolution),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=n.height,this.vertexArray[2]=n.width,this.vertexArray[3]=n.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=n.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=n.width/this.width,this.uvArray[5]=n.height/this.height,this.uvArray[6]=n.width/this.width,this.uvArray[7]=n.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=s,h=this.texturePool.pop();h||(h=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution)),h.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l0?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.applyFilterPass(d,n,p,f),this.texturePool.push(s),e._glFilterTexture=null},i.WebGLFilterManager.prototype.applyFilterPass=function(t,e,n,s){var r=this.gl,o=t.shaders[r.id];o||((o=new i.PixiShader(r)).fragmentSrc=t.fragmentSrc,o.uniforms=t.uniforms,o.init(!0),t.shaders[r.id]=o),this.renderSession.shaderManager.setShader(o),r.uniform2f(o.projectionVector,n/2,-s/2),r.uniform2f(o.offsetVector,0,0),t.uniforms.dimensions&&(t.uniforms.dimensions.value[0]=this.width,t.uniforms.dimensions.value[1]=this.height,t.uniforms.dimensions.value[2]=this.vertexArray[0],t.uniforms.dimensions.value[3]=this.vertexArray[5]),o.syncUniforms(),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.vertexAttribPointer(o.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.vertexAttribPointer(o.aTextureCoord,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.colorBuffer),r.vertexAttribPointer(o.colorAttribute,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),this.renderSession.drawCount++},i.WebGLFilterManager.prototype.initShaderBuffers=function(){var t=this.gl;this.vertexBuffer=t.createBuffer(),this.uvBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.vertexArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW),this.uvArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),t.bufferData(t.ARRAY_BUFFER,this.uvArray,t.STATIC_DRAW),this.colorArray=new Float32Array([1,16777215,1,16777215,1,16777215,1,16777215]),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,1,3,2]),t.STATIC_DRAW)},i.WebGLFilterManager.prototype.destroy=function(){var t=this.gl;this.filterStack=null,this.offsetX=0,this.offsetY=0;for(var e=0;e=0;t--){var e=this._glTextures[t],n=i.glContexts[t];n&&e&&n.deleteTexture(e)}this._glTextures.length=0,this.dirty()},i.BaseTexture.fromCanvas=function(t,e,n){return 0===t.width&&(t.width=1),0===t.height&&(t.height=1),n=n||1,new i.BaseTexture(t,e,n)},i.TextureSilentFail=!1,i.Texture=function(t,e,n,s){this.noFrame=!1,e||(this.noFrame=!0,e=new i.Rectangle(0,0,1,1)),t instanceof i.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=e,this.trim=s,this.valid=!1,this.isTiling=!1,this.requiresUpdate=!1,this.requiresReTint=!1,this._uvs=null,this.width=0,this.height=0,this.crop=n||new i.Rectangle(0,0,1,1),this.rotated=!1,t.hasLoaded&&(this.noFrame&&(e=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(e))},i.Texture.prototype.constructor=i.Texture,i.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;this.noFrame&&(this.frame=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame)},i.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},i.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,this.trim||!(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs();else{if(!i.TextureSilentFail)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=!1}},i.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.width)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.width)/e,this._uvs.y2=(t.y+t.height)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.height)/n},i.Texture.prototype._updateUvsInverted=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.height)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.height)/e,this._uvs.y2=(t.y+t.width)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.width)/n},i.Texture.fromCanvas=function(t,e){var n=i.BaseTexture.fromCanvas(t,e);return new i.Texture(n)},i.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},t.exports&&(e=t.exports=i),e.PIXI=i,i}).call(this)},9204:function(t,e,i){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e=0;r--){var o=i[e.c];switch((e=this.execStack[r]).scope){case"interrupt":o=i[e.origin];var a=Object.keys(o.interrupt[e.index])[0];i=o.interrupt[e.index][a];break;case"choice":var h=Object.keys(o.choice[e.index])[0];i=o.choice[e.index][h];break;case"if":i=o[Object.keys(o)[0]]}s=i.slice(e.c).concat(s)}return s||[]},t}();e.default=o},885:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.game=e,this.name=t}return t.prototype.onInit=function(){},t.prototype.onStart=function(){},t.prototype.onLoad=function(t,e){},t.prototype.onLoaded=function(){},t.prototype.onSave=function(t,e){},t.prototype.onCall=function(t){},t.prototype.onAction=function(t){},t.prototype.onEndScene=function(t){},t.prototype.onTeardown=function(){},t}();e.default=i},8811:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return o(e,t),e},h=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},l=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&"says"===r[1];if("show"===a||"play"===a||h){var l=this.game.managers.story.parseAction(n);this.assetsPerScene[e]||(this.assetsPerScene[e]={}),this.assetsPerScene[e][l.actor]=l.actorType}if("if"!==a&&"else"!==a||i.unshift.apply(i,n[s]),"choice"===a||"interrupt"===a||"visualChoice"===a)for(var u=0,d=n[s];u0?[4,this.game.managers.audio.decodeAudio(i)]:[3,2];case 1:s.sent(),s.label=2;case 2:return this.loadingScreen&&(this.loadingScreen.destroy(this.game),this.loadingScreen=null),this.backgroundLoading&&(this.backgroundLoading=null),this.game.config.debugMode&&console.log("All assets loaded."),e(!0),[2]}}))}))}),c),c.loading=!0,c.loadingScreen&&c.loadingScreen.setLoadingBar(c.game),c.game.load.start()}))]}}))}))},t}();e.default=u},3973:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(9204)),r=function(){this.skipping=!1,this.unskippable=!1,this.auto=!1,this.paused=!1,this.clickCooldown=200,this.clickLocked=!1,this.waitForClick=!1,this.execStack=new s.default,this.actionsCounter=0,this.nextAction=null};e.default=r},571:function(t,e){"use strict";var i,n=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.RangedUserPreference=e.UserPreference=void 0;var s=function(){function t(t){this.value=t}return t.prototype.set=function(t){this.value=t},t.prototype.get=function(){return this.value},t.prototype.toJSON=function(){return this.value},t}();e.UserPreference=s;var r=function(t){function e(e,i,n,s){void 0===s&&(s=!1);var r=t.call(this,e)||this;return r.min=i,r.max=n,r.inverted=s,r}return n(e,t),e.prototype.set=function(t){this.value=t*(this.max-this.min)+this.min},e.prototype.get=function(){return this.inverted?this.max-this.value:this.value},e}(s);e.RangedUserPreference=r;var o=function(){function t(t,e){this.game=t,this.preferences={textSpeed:new r(20,10,100,!0),autoSpeed:new r(150,50,300),bgmv:new r(.5,0,1),sfxv:new r(.5,0,1),muted:new s(!1)};var i=localStorage.getItem("RenJSUserPreferences"+t.config.name);i?this.setPreferences(JSON.parse(i)):this.setPreferences(e)}return t.prototype.setPreferences=function(t){if(t)for(var e in this.preferences)void 0!==t[e]&&(this.preferences[e].value=t[e])},t.prototype.set=function(t,e){this.preferences[t].set(e),this.savePreferences()},t.prototype.get=function(t){return this.preferences[t].get()},t.prototype.addPreference=function(t,e,i){this.preferences[t]="boolean"===i?new s(e):new r(e,i.min,i.max)},t.prototype.savePreferences=function(){var t=JSON.stringify(this.preferences);localStorage.setItem("RenJSUserPreferences"+this.game.config.name,t)},t}();e.default=o},9163:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i){this.game=t,this.actionType=e,this.properties=i,this.key=Object.keys(i)[0],this.keyParams=this.key.split(" "),this.body=i[this.key]}return t.prototype.resolve=function(t,e){var i=this;t&&!e?t.then((function(){return i.game.resolveAction()})):this.game.resolveAction()},t.prototype.execute=function(){},t.prototype.parseParams=function(t){return t?this.keyParams:(this.params||(this.params=this.body?this.body.split(" "):[]),this.params)},t.prototype.parseActor=function(){return this.keyParams[1]},t.prototype.parseParameter=function(t,e,i){void 0===e&&(e="boolean"),void 0===i&&(i=!1);var n=this.parseParams(i),s=n.indexOf(t);if("boolean"===e)return-1!==s;if(-1===s)return null;var r=n[s+1];if("coords"===e){if(r in this.game.storyConfig.positions)return this.game.storyConfig.positions[r];var o=r.split(",");return{x:parseInt(o[0],10),y:parseInt(o[1],10)}}return"number"===e?parseFloat(r):r},t}();e.default=i},423:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.screenEffects.ambient.start(this.actor),this.resolve()},e}(r(i(9163)).default);e.default=o},1156:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.contAfterTrans=s.parseParameter("CONTINUE"),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.cgs.animate(this.actor,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},2352:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.keyParams[1],s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),"play"===s.actionType?(s.looped=s.parseParameter("LOOPED"),s.looped&&(s.fromSeconds=s.parseParameter("FROM","number")),s.force=s.parseParameter("FORCE"),s.channel=s.parseParameter("IN","string"),s.parseParameter("BGS")&&(s.channel="bgs"),s.channel||(s.channel="bgm")):s.channel=s.actor,s}return s(e,t),e.prototype.execute=function(){"play"===this.actionType?"music"===this.actorType?this.game.managers.audio.play(this.actor,this.channel,this.looped,this.fromSeconds,this.transition,this.force):this.game.managers.audio.playSFX(this.actor):this.game.managers.audio.stop(this.channel,this.transition),this.resolve()},e}(r(i(9163)).default);e.default=o},1629:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){var t=this.game.pluginsRJS[this.actor];this.properties.body=this.body,t.onCall(this.properties)},e}(r(i(9163)).default);e.default=o},7519:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e0){var r=s.game.managers.story.currentScene[0];r&&"else"in r&&(s.branches.ISFALSE=r.else,s.game.managers.story.currentScene.shift())}return s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.branch(this.condition,this.branches),this.resolve()},e}(r(i(9163)).default);e.default=o},2028:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actorType="characters",s.actor=s.keyParams[0],s.look=s.keyParams.length>2?s.keyParams[2]:null,s.game.managers.story.reservedWords.includes(s.look)&&(console.log("look is reserved word"),s.look=null),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({actor:this.actor,message:e})}t=this.game.managers.text.characterSays(this.actor,this.look,this.body,this.boxId,this.dontHide),this.resolve(t)},e}(r(i(7068)).default);e.default=o},8998:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.scene=s.game.managers.logic.parseVars(s.body),s}return s(e,t),e.prototype.execute=function(){this.resolve(this.game.managers.story.startScene(this.scene))},e}(r(i(9163)).default);e.default=o},1929:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),s.transition||(s.transition=s.game.storyConfig.transitions.defaults[s.actorType]),s.contAfterTrans=s.parseParameter("CONTINUE");var r=s.parseParameter("AT","coords");r&&(s.properties.position=r),s.parseParameter("FLIP")&&(s.properties.flipped="flip"),"cgs"===s.actorType&&(s.properties.layer=s.parseParameter("BEHIND")?"behindCharactersSprites":"cgsSprites");var o=s.parseParameter("IN","string");return o&&(s.properties.layer=o),"characters"===s.actorType&&(s.properties.look=s.params[0],s.game.managers.story.reservedWords.includes(s.properties.look)&&(s.properties.look=null),s.properties.look||(s.properties.look="normal")),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.story.getManagerByActorType(this.actorType).show(this.actor,this.transition,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},7068:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.dontHide=!1,s.boxId=s.parseParameter("IN","string",!0),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({message:e})}t=this.game.managers.text.display(this.body,this.boxId,null,this.dontHide),this.resolve(t)},e}(r(i(9163)).default);e.default=o},733:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.setVar(this.actor,this.body),this.resolve()},e}(r(i(9163)).default);e.default=o},7843:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.execute=function(){"click"===this.body?this.game.waitForClick():this.game.waitTimeout(parseInt(this.body,10))},e}(r(i(9163)).default);e.default=o},5761:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i,n){this.game=t,this.keyName=e,this.config={displayName:"",color:"#FFFFFF",voice:"none",nameBox:"default",messageBox:"default"},this.currentLook=null,this.usePortraits=!1,this.voice=null,Object.assign(this.config,i),"none"!==this.config.voice&&(this.voice=this.game.add.audio(this.config.voice),this.voice.play(),this.voice.stop()),this.usePortraits=void 0!==n}return t.prototype.createPortrait=function(t,e){if(this.usePortraits&&e.config.portrait){var i=this.keyName+"_portrait_"+t,n=e.config.portrait,s=this.game.add.sprite(n.x,n.y,i);s.anchor.set(.5,1),e.addChild(s),e.portrait=s}},t.prototype.createLook=function(t){void 0===t&&(t={});var e=this.currentLook?this.getLookData():{look:"normal",position:this.game.storyConfig.positions.DEFAULT,flipped:!1};Object.assign(e,t);var i=this.keyName+"_"+e.look,n=this.game.managers.story.characterSprites.create(e.position.x,e.position.y,i);return n.name=e.look,"flip"===t.flipped&&(this.currentLook?e.flipped=!(-1===this.currentLook.scale.x):e.flipped=!0),n.scale.x=e.flipped?-1:1,n.anchor.set(.5,1),n.updateTransform(),n.alpha=0,this.currentLook=n,n},t.prototype.resetLook=function(){this.currentLook.destroy(),this.currentLook=null},t.prototype.getLookData=function(){return this.currentLook?{look:this.currentLook.name,position:{x:this.currentLook.x,y:this.currentLook.y},flipped:-1===this.currentLook.scale.x}:null},t}();e.default=i},2459:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1] GUIVersion=='2.0'");var I=a.default.dump(JSON.parse(JSON.stringify(this.config)));console.log(I)}},e.prototype.convertText=function(t){return{x:t.isTextCentered?0:parseInt(t["offset-x"],10),y:t.isTextCentered?0:parseInt(t["offset-y"],10),lineSpacing:t.lineSpacing,style:this.convertTextStyle(t)}},e.prototype.convertTextStyle=function(t){var e={font:t.font,fontSize:t.size+"px",fill:t.color};return t.align&&(e.align=t.align),t["text-width"]&&(e.wordWrap=!0,e.wordWrapWidth=t["text-width"]),t.isTextCentered?(e.boundsAlignH="center",e.boundsAlignV="middle"):t["text-width"]||(e.boundsAlignH=t.align?t.align:"left",e.boundsAlignV="top"),e},e}(o.default);e.default=h},4254:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.initAssets=function(t){var e=function(t,e,i){return Object.keys(t).map((function(n){return{key:n,file:i+t[n].fileName,type:e,w:t[n].w,h:t[n].h}}))},i=e(t.assets.images,"image",t.assetsPath),n=e(t.assets.audio,"audio",t.assetsPath),s=e(t.assets.spritesheets,"spritesheet",t.assetsPath);this.assets=i.concat(n).concat(s),this.fonts=Object.keys(t.assets.fonts),this.config=t.config},e}(r(i(2459)).default);e.default=o},5225:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(3572);function s(t){return t.replace(/\s+/g," ").trim()}function r(t){for(var e,i,s=n.tokenizeTextStyle((e=t,(i=document.createElement("div")).textContent=e,i.innerHTML)),r=[],o="";s.length;){var a=s.shift();a.tag?"end"===a.tag&&r.length?o+="":a.tag.startsWith("color")?(r.push("mark"),o+=""):"bold"===a.tag?(r.push("strong"),o+=""):"italic"===a.tag&&(r.push("em"),o+=""):o+=a.text}return o.replace(/\n/g,"
")}var o=function(){function t(t){var e=this;this.game=t,this.debug=!1,this.state={name:"",text:"",choices:[],buttons:[],sliders:[]},this.updateLayout=function(){e.updateLayoutContainer(),e.updateLayoutText(),e.updateLayoutChoices(),e.updateLayoutButtons(),e.updateLayoutSliders()},this.elContainer=document.createElement("div"),this.elContainer.style.position="fixed",this.elContainer.style.pointerEvents="none",this.debug&&(this.elContainer.style.border="solid 1px red"),this.elProgress=document.createElement("progress"),this.elProgress.max=100,this.elProgress.value=0,this.debug||(this.elProgress.style.opacity="0"),this.elChoices=document.createElement("ol"),this.elChoices.style.listStyle="none",this.elButtons=document.createElement("ul"),this.elButtons.style.listStyle="none",this.elSliders=document.createElement("ul"),this.elSliders.style.listStyle="none",this.elText=document.createElement("div"),this.elText.setAttribute("aria-live","polite"),this.elText.setAttribute("aria-atomic","true"),this.elText.setAttribute("aria-relevant","text"),this.elText.setAttribute("role","main"),this.elText.setAttribute("aria-roledescription","text"),this.elText.tabIndex=0,this.elText.onclick=function(){e.game.onTap(null)},this.elText.style.position="absolute",this.debug?(this.elText.style.color="red",this.elText.style.top="1rem",this.elText.style.left="1rem",this.elText.style.right="1rem",this.elText.style.bottom="1rem"):(this.elText.style.color="transparent",this.elText.style.fontSize="0",this.elText.style.outline="none",this.elText.style.top="0",this.elText.style.left="0",this.elText.style.right="0",this.elText.style.bottom="0"),this.elContainer.appendChild(this.elProgress),this.elContainer.appendChild(this.elText),this.elContainer.appendChild(this.elChoices),this.elContainer.appendChild(this.elSliders),this.elContainer.appendChild(this.elButtons)}return t.prototype.boot=function(){var t=this;this.game.canvas.setAttribute("aria-hidden","true"),this.game.scale.onSizeChange.add(this.updateLayout),this.updateLayout(),this.game.load.onLoadStart.add((function(){t.updateLayout(),t.busy(),t.progress(0)})),this.game.load.onLoadComplete.add((function(){t.progress(100),t.ready()})),this.game.load.onFileComplete.add((function(e){t.progress(e)})),document.body.appendChild(this.elContainer)},t.prototype.progress=function(t){void 0===t?delete this.elProgress.value:this.elProgress.value=Math.floor(t)},t.prototype.busy=function(){this.elText.setAttribute("aria-busy","true")},t.prototype.ready=function(){this.elText.setAttribute("aria-busy","false")},t.prototype.updateLayoutText=function(){var t,e=r("hud"!==(null===(t=this.game.gui)||void 0===t?void 0:t.currentMenu)?"":s(this.state.text).split("\n").map((function(t){return t.trim()})).filter((function(t){return t})).join("\n"));e.length>0&&this.state.name&&(e=s(this.state.name)+": "+e),this.elText.innerHTML=e},t.prototype.updateLayoutContainer=function(){this.elContainer.style.width=this.game.scale.width+"px",this.elContainer.style.height=this.game.scale.height+"px",this.elContainer.style.top=this.game.scale.margin.top+"px",this.elContainer.style.left=this.game.scale.margin.left+"px"},t.prototype.updateLayoutBounds=function(t,e){t.style.width=e.width*this.game.scale.scaleFactorInversed.x+"px",t.style.height=e.height*this.game.scale.scaleFactorInversed.y+"px",t.style.top=e.y*this.game.scale.scaleFactorInversed.y+"px",t.style.left=e.x*this.game.scale.scaleFactorInversed.x+"px"},t.prototype.updateLayoutList=function(t,e){var i=this;this.rescueFocus(t),e.forEach((function(e,n){var s=t.children[n];s.style.display=e.isActive()?null:"none",i.updateLayoutBounds(s,e.getBounds())}))},t.prototype.updateLayoutChoices=function(){this.updateLayoutList(this.elChoices,this.state.choices)},t.prototype.updateLayoutButtons=function(){this.updateLayoutList(this.elButtons,this.state.buttons)},t.prototype.updateLayoutSliders=function(){this.updateLayoutList(this.elSliders,this.state.sliders)},t.prototype.rescueFocus=function(t){var e=document.activeElement;t!==e&&(e&&!t.contains(e)||this.elText.focus())},t.prototype.text=function(t){void 0===t&&(t=""),this.state.text=t,this.updateLayoutText()},t.prototype.name=function(t){void 0===t&&(t=""),this.state.name=t,this.updateLayoutText()},t.prototype.button=function(t){var e,i,n;this.state.buttons.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("button");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.textContent=(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.buttons)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Button "+this.state.buttons.length,r.onclick=t.onclick,r.onfocus=t.onfocus,r.onblur=t.onblur,s.appendChild(r),this.elButtons.appendChild(s),this.updateLayoutButtons()},t.prototype.slider=function(t){var e,i,n;this.state.sliders.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("input");r.type="number",r.setAttribute("aria-label",(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.sliders)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Slider "+this.state.buttons.length),r.min=t.min.toString(10),r.max=t.max.toString(10),r.step=t.step.toString(10),r.value=t.get().toString(10),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.appearance="textfield",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.onchange=function(e){return t.set(Number(e.currentTarget.value))},r.onfocus=function(){r.value=t.get().toString(10)},s.appendChild(r),this.elSliders.appendChild(s),this.updateLayoutSliders()},t.prototype.choices=function(t){var e=this;void 0===t&&(t=[]),this.state.choices=t,this.rescueFocus(this.elChoices),this.elChoices.innerHTML="",t.forEach((function(t){var i,n,s,o=document.createElement("li");o.style.position="absolute";var a=document.createElement("button");a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.background="transparent",e.debug?(a.style.border="solid 1px red",a.style.color="red"):(a.style.border="none",a.style.color="transparent",a.style.fontSize="0"),a.innerHTML=r(null!==(s=null===(n=null===(i=e.game.storyAccessibility)||void 0===i?void 0:i.choices)||void 0===n?void 0:n[t.label])&&void 0!==s?s:t.label),a.onclick=t.onclick,a.onfocus=t.onfocus,a.onblur=t.onblur,o.appendChild(a),e.elChoices.appendChild(o)})),this.updateLayoutChoices()},t}();e.default=o},150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(i,n){var s=t.call(this,i,n.x,n.y,n.asset,(function(){s.onClick()}))||this;return s.setFrames.apply(s,e.getButtonFrames(s.animations.frameTotal)),s.config=n,s.game=i,s}return s(e,t),e.getButtonFrames=function(t,e){void 0===e&&(e=!1);return{1:{normal:[0,0,0,0],pushed:[1,1,1,1]},2:{normal:[1,0,1,0],pushed:[3,2,3,2]},3:{normal:[1,0,2,0],pushed:[4,3,5,3]},4:{normal:[1,0,2,3],pushed:[5,4,6,7]}}[t][e?"pushed":"normal"]},e.prototype.onClick=function(){this.config.sfx&&"none"!==this.config.sfx&&this.game.managers.audio.playSFX(this.config.sfx),this.game.gui.bindingActions[this.config.binding](this.config,this)},e}(i(9747).Button);e.default=r},812:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?f--:(r.text.text+=d[p],r.onCharacter&&r.onCharacter(d,p),e&&(" "===d[p]||"\n"===d[p]||r.punctuationMarks.includes(d[p])||m===g?m=-1:0===m&&(e.play(),e.volume=r.game.userPreferences.get("sfxv")),m++),r.punctuationMarks.includes(d[p])&&(f=r.punctuationWait),++p>=d.length&&i())}),s),[2]}}))}))}))},e.prototype.hide=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.game.accessibility.text(),this.visible?(t||(t=this.config.transition),[4,this.game.screenEffects.transition.get(t)(this,null)]):[2];case 1:return e.sent(),this.visible=!1,[2]}}))}))},e.prototype.clear=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.config.alwaysOn?[3,2]:[4,this.hide(t)];case 1:e.sent(),e.label=2;case 2:return this.text.setText("",!0),this.ctc&&(this.ctc.visible=!1),this.portrait&&(this.portrait.destroy(),this.portrait=null),[2]}}))}))},e}(h.Sprite);e.default=u},5148:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.game=t,this.container=t.add.group(),this.container.alpha=0;var e=t.config.loadingScreen;if(e.background&&(this.background=this.container.create(t.world.centerX,t.world.centerY,"loadingScreenBg"),this.background.anchor.set(.5)),e.loadingBar){var i=e.loadingBar.position;this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar"),this.loadingBar.animations.frameTotal>1&&(this.loadingBarBg=this.loadingBar,this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar",1))}e.fade?t.add.tween(this.container).to({alpha:1},500).start():this.container.alpha=1}return t.prototype.setLoadingBar=function(t){if(this.loadingBar){var e=t.config.loadingScreen.loadingBar.direction?t.config.loadingScreen.loadingBar.direction:0;t.load.setPreloadSprite(this.loadingBar,e)}},t.prototype.waitingScreen=function(){this.loadingBar&&this.game.add.tween(this.loadingBar).to({alpha:1},600,null,!0,0,-1,!0)},t.prototype.destroy=function(t){var e=this;if(t.config.loadingScreen.fade){var i=t.add.tween(this.container).to({alpha:0},500);i.onComplete.addOnce((function(){e.container.destroy()})),i.start()}else this.container.destroy()},t}();e.default=i},7898:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(e,i){var n=t.call(this,e,i.x,i.y,i.asset)||this;n.game=e,n.config=i;var s=n.game.getSlotThumbnail(n.config.slot);return s&&n.loadThumbnail(s),n}return s(e,t),e.prototype.loadThumbnail=function(t){var e=this,i="thumbnail"+Math.floor(5e3*Math.random());this.game.load.image(i,t),this.game.load.onLoadComplete.addOnce((function(){var t=e.game.add.sprite(e.config.thumbnail.x,e.config.thumbnail.y,i);t.width=e.config.thumbnail.width,t.height=e.config.thumbnail.height,e.addChild(t)}),this),this.game.load.start()},e.prototype.destroy=function(){this.thumbnail.destroy(),t.prototype.destroy.call(this)},e}(i(9747).Sprite);e.default=r},3607:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Plugin=e.game=void 0;var s=n(i(8811)),r=n(i(885));e.game=s.default,e.Plugin=r.default},6041:function(t,e){"use strict";var i=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]2&&(l=parseInt(o[2],10)),this.cgs[t].animations.add(r,a,l)}n||(n={x:this.cgs[t].x,y:this.cgs[t].y}),i.zoom&&this.cgs[t].scale.set(i.zoom);var c=!1;if(void 0!==i.flipped){var u=this.cgs[t].scale.x<0;"flip"===i.flipped?(this.cgs[t].scale.x*=-1,c=!u):(c=i.flipped)!==u&&(this.cgs[t].scale.x*=-1)}return i.angle&&(this.cgs[t].angle=i.angle),this.current[t]={name:t,position:n,zoom:i.zoom,angle:i.angle,layer:i.layer,flipped:c},this.transition.get(e)(s,this.cgs[t],n)},t.prototype.animate=function(t,e){return s(this,void 0,void 0,(function(){var i,s,o=this;return r(this,(function(r){return i=e.time,s={},void 0!==e.alpha&&null!==e.alpha&&(s.alpha=e.alpha),void 0!==e.angle&&null!==e.angle&&(s.angle=e.angle),void 0!==e.position&&null!==e.position&&(s.x=e.position.x,s.y=e.position.y),void 0!==e.zoom&&null!==e.zoom&&(this.cgs[t].originalScale||(this.cgs[t].originalScale={width:this.cgs[t].width,height:this.cgs[t].height}),s.height=this.cgs[t].originalScale.height*e.zoom,s.width=this.cgs[t].originalScale.width*e.zoom),this.current[t]=n(n({},this.current[t]),e),[2,new Promise((function(n){var r=n;if(e.spritesheet){var a=function(){o.cgs[t].animations.stop(),n()};if("STOP"===e.spritesheet)o.cgs[t].frame=0,a();else{var h=e.spritesheet.split(" "),l=h[0],c=h.includes("LOOPED"),u=o.cgs[t].animations.getAnimation(l);if(h.includes("BACKWARDS")&&u.reverseOnce(),u.play(null,c),0===Object.keys(s).length)return c?i?o.game.waitTimeout(i,a.bind(o)):n():o.game.control.skipping?a():u.onComplete.addOnce(a.bind(o));r=a.bind(o)}}o.game.managers.tween.tween(o.cgs[t],s,r,i,!0)}))]}))}))},t.prototype.hide=function(t,e){return s(this,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return[4,this.transition.get(e)(this.cgs[t],null)];case 1:return i.sent(),this.cgs[t].destroy(),delete this.cgs[t],delete this.current[t],[2]}}))}))},t.prototype.isCGS=function(t){return this.game.setup.cgs&&t in this.game.setup.cgs},t}();e.default=l},878:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&(n.available=this.evalExpression(s[1]),n.choiceText=s[0].trim()),e.interrupt&&(n.interrupt=!0,n.origin=e.interrupt),n},LogicManager.prototype.choose=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:return e=this.currentChoices[t],this.updateChoiceLog(e.index),this.game.storyConfig.keepStoryLog&&this.game.storyLog.push({message:e.choiceText,choice:!0}),i=e.actions,this.game.managers.story.currentScene=i.concat(this.game.managers.story.currentScene),this.showingText&&t++,this.interrupting?this.game.control.execStack.stack("interrupt",i.length,e.index,e.origin):this.game.control.execStack.stack("choice",i.length,e.index),this.game.config.debugMode&&console.log("Choice taken "+t+" : "+e.choiceText),[4,this.clearChoices()];case 1:return n.sent(),this.interrupting?this.interrupting=null:this.game.resolveAction(),[2]}}))}))},LogicManager.prototype.getExecStackId=function(){var t=this.game.control.execStack.hash();return this.choicesLog[t]||(this.choicesLog[t]=[]),t},LogicManager.prototype.checkTextAction=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i,n=this;return __generator(this,(function(s){return!(e=this.game.managers.story.parseAction(__assign({},t)))||"say"!==e.actionType&&"text"!==e.actionType?[2,!1]:((i=e).dontHide=!0,[2,new Promise((function(t){i.resolve=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(i){switch(i.label){case 0:return[4,e];case 1:return i.sent(),t(!0),[2]}}))}))},i.execute()}))])}))}))},LogicManager.prototype.showChoices=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i,n,s=this;return __generator(this,(function(r){switch(r.label){case 0:return i=this,[4,this.checkTextAction(e[0])];case 1:return i.showingText=r.sent(),this.showingText&&e.shift(),this.currentChoices=e.map((function(t,e){return s.parseChoice(e,t)})),this.currentChoices=this.currentChoices.filter((function(t){return t.available})),n=-1,t||(t="default"),"visualChoices"!==t?[3,3]:[4,this.game.gui.hud.showVisualChoices(this.currentChoices)];case 2:return n=r.sent(),[3,5];case 3:return[4,this.game.gui.hud.showChoices(t,this.currentChoices)];case 4:n=r.sent(),r.label=5;case 5:return this.choose(n),[2]}}))}))},LogicManager.prototype.interrupt=function(t,e){this.interrupting={origin:this.game.control.execStack.top().c,execId:this.getExecStackId()},this.showChoices(t,e),this.game.resolveAction()},LogicManager.prototype.clearChoices=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.game.gui.hud.clear()];case 1:return t.sent(),this.currentChoices=[],this.showingText=!1,[2]}}))}))},LogicManager}();exports.default=LogicManager},7745:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.current=[],this.game=t}return t.prototype.tween=function(t,e,i,n,s,r,o){var a=this;void 0===r&&(r=0),void 0===o&&(o=!1);var h=this.game.add.tween(t);return h.to(e,n,Phaser.Easing.Linear.None,!1,r),i&&(h.onComplete.addOnce(i,this),h.callbackOnComplete=i),h.tweenables=e,s&&(this.current=[],h.start(),this.canSkip()&&!o?this.game.waitForClick((function(){return a.skip()})):(this.game.input.enabled=!1,h.onComplete.addOnce((function(){a.game.input.enabled=!0}),this))),this.current.push(h),this.game.control.skipping&&(this.game.input.enabled=!0,this.skip()),h},t.prototype.chain=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[];var s=null;t.forEach((function(e){var r=e.time?e.time:i/t.length,o=n.tween(e.sprite,e.tweenables,e.callback,r,!1,e.delay);s&&s.chain(o),s=o})),this.game.control.skipping?this.canSkip()&&!e&&this.game.waitForClick((function(){return n.skip()})):this.current[0].start()},t.prototype.parallel=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[],t.forEach((function(t){n.tween(t.sprite,t.tweenables,t.callback,i,!0,t.delay)})),this.canSkip()||e||this.game.waitForClick((function(){return n.skip()}))},t.prototype.canSkip=function(){return this.game.storyConfig.transitions.skippable&&!this.game.control.unskippable},t.prototype.skip=function(){this.game.control.unskippable||(this.current.forEach((function(t){for(var e in t.stop(!1),t.tweenables)t.target[e]=t.tweenables[e];t.callbackOnComplete&&t.callbackOnComplete()})),this.current=[])},t}();e.default=i},4664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.clearFunctions=[],this.current=[],this.game=t,this.audioManager=t.managers.audio}return t.prototype.start=function(t){this.current.push(t),this[t]?this[t]():this.game.pluginsRJS[t]&&this.game.pluginsRJS[t].onCall()},t.prototype.set=function(t){if(t)for(var e=0,i=t;e0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]=0;i--)this.game.load.text("story"+i,h.preparePath(this.game.config.storyText[i],this.game))},e.prototype.create=function(t){var e=this;new p.default(this.game).setLoadingBar(this.game),this.input.onDown.addOnce((function(){"suspended"===e.sound.context.state&&e.sound.context.resume()})),this.game.tools.jsyaml=a.default,this.game.setup=a.default.load(this.game.cache.getText("storySetup")),t.setup||(this.game.setup={}),this.game.storyConfig=a.default.load(this.game.cache.getText("storyConfig")),this.game.storyAccessibility=a.default.load(this.game.cache.getText("storyAccessibility"));var i={};this.game.config.storyText.forEach((function(t,n){var s=a.default.load(e.game.cache.getText("story"+n));Object.assign(i,r({},s))})),this.game.story=i,this.game.guiSetup=a.default.load(this.game.cache.getText("guiConfig")),"2.0"===t.guiSetup.GUIVersion||"2.0"===t.guiSetup.madeWithRenJSBuilder?t.gui=new d.default(t):t.guiSetup.madeWithRenJSBuilder?t.gui=new u.default(t):(console.error("Old GUI configuration is deprecated!!!!"),console.error("Check the docs at http://renjs.net/docs-page.html")),t.state.add("preloadStory",c.default),t.state.start("preloadStory")},e}(l.default);e.default=f},8171:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return t.call(this)||this}return s(e,t),e.prototype.init=function(){this.game.setupScreen()},e.prototype.preload=function(){for(var t in this.game.config.i18n.background&&this.game.load.image("langChooserBg",this.game.config.i18n.background),this.game.config.i18n.langs){var e=this.game.config.i18n.langs[t];this.game.load.spritesheet("languageTag"+t,e.asset,e.size.w,e.size.h)}},e.prototype.create=function(){var t=this;this.game.config.i18n.background&&this.game.add.image(0,0,"langChooserBg");var e=function(e){var n=i.game.config.i18n.langs[e];i.game.add.button(n.position.x,n.position.y,"languageTag"+e,(function(){t.game.config.i18n.current=e,localStorage.setItem("RenJS_I18N"+t.game.config.name,e),t.game.state.start("bootstrap")}),i,1,0,1,0)},i=this;for(var n in this.game.config.i18n.langs)e(n)},e}(r(i(4015)).default);e.default=o},1150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";function i(t,e){return e.config.i18n?t.replace("LANG",e.config.i18n.current):t}function n(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}Object.defineProperty(e,"__esModule",{value:!0}),e.loadStyle=e.guid=e.preloadExtra=e.preloadCharacter=e.preloadAudio=e.preloadCGS=e.preloadBackground=e.preparePath=void 0,e.preparePath=i,e.preloadBackground=function(t,e){var n=e.setup.backgrounds[t].split(" ");1===n.length?e.load.image(t,i(n[0],e)):e.load.spritesheet(t,i(n[0],e),parseInt(n[1],10),parseInt(n[2],10))},e.preloadCGS=function(t,e){var n=e.setup.cgs[t];if("string"==typeof n)e.load.image(t,i(n,e));else{var s=n.spritesheet.split(" ");e.load.spritesheet(t,i(s[0],e),parseInt(s[1],10),parseInt(s[2],10))}},e.preloadAudio=function(t,e,n){n.load.audio(t,i(n.setup[e][t],n))},e.preloadCharacter=function(t,e){var n=e.setup.characters[t];for(var s in n.looks)e.load.image(t+"_"+s,i(n.looks[s],e));for(var r in n.portraits)e.load.image(t+"_portrait_"+r,i(n.portraits[r],e))},e.preloadExtra=function(t,e,n){if("spritesheets"===e){var s=n.setup.extra[e][t].split(" ");n.load.spritesheet(t,i(s[0],n),parseInt(s[1],10),parseInt(s[2],10))}else n.load[e](t,i(n.setup.extra[e][t],n))},e.guid=function(){return"ss".replace(/s/g,n)},e.loadStyle=function(t,e){for(var i=0,n=Array.from(document.styleSheets);i{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0,e.range=function(t,e,i){void 0===i&&(i=1);for(var n=[t],s=t;s{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hudSort=e.setTextStyles=e.changeInputEnabled=void 0;var n=i(3572);e.changeInputEnabled=function t(e,i){e.input&&(e.input.enabled=i);for(var n=0,s=e.children;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenizeTextStyle=void 0;var i=/\((?:color:(?:\w+|#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6})|italic|bold|end)\)/;e.tokenizeTextStyle=function(t){for(var e=[];;){var n=i.exec(t);if(!n)return e.push({text:t}),e;var s=n.index,r=n[0];e.push({text:t.substr(0,s)}),e.push({tag:r.slice(1,-1)}),t=t.substr(s+r.length)}}},4147:t=>{"use strict";t.exports=JSON.parse('{"name":"renjs","version":"2.7.1","description":"RenJS is a videogame library for making Visual Novels that run directly in the web browser","author":"lunafromthemoon","contributors":["RockDaFox","Sean S. LeBlanc"],"license":"CC-BY-SA-4.0","repository":{"type":"git","url":"git+https://github.com/lunafromthemoon/RenJS-V2.git"},"bugs":{"url":"https://github.com/lunafromthemoon/RenJS-V2/issues"},"homepage":"https://renjs.net","keywords":["engine","visual","novel","phaser"],"files":["dist"],"main":"dist/renjs.js","types":"dist/types/index.d.ts","scripts":{"start":"webpack-dev-server --config webpack.dev.js --hot --progress","build":"webpack --config webpack.prod.js","build:docs":"./scripts/build-docs.sh","build:demo":"./scripts/build-demo.sh","lint":"eslint \\"./src/**/*.{j,t}s\\"","postversion":"npm run build && npm run build:docs"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm",["@semantic-release/github",{"assets":"dist/renjs.js"}],["@semantic-release/git",{"assets":["docs/**/*","dist/**/*","CHANGELOG.md","package.json","package-lock.json"]}]]},"dependencies":{"fontfaceobserver":"^2.1.0","js-yaml":"^4.1.0","object-hash":"^2.0.3","phaser-ce":"^2.16.0"},"devDependencies":{"@types/fontfaceobserver":"^2.1.0","@types/js-yaml":"^4.0.5","@typescript-eslint/eslint-plugin":"^5.5.0","@typescript-eslint/parser":"^5.5.0","bestzip":"^2.2.0","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^10.0.0","eslint":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-promise":"^5.2.0","eslint-plugin-standard":"^5.0.0","expose-loader":"^3.1.0","terser-webpack-plugin":"^5.2.5","ts-loader":"^9.2.6","typescript":"^3.9.7","webpack":"^5.64.4","webpack-cli":"^4.9.1","webpack-dev-server":"^4.6.0","webpack-merge":"^5.8.0"}}')}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(3607);RenJS=__webpack_exports__})(); \ No newline at end of file +i.DisplayObject=function(){this.position=new i.Point(0,0),this.scale=new i.Point(1,1),this.pivot=new i.Point(0,0),this.rotation=0,this.alpha=1,this.visible=!0,this.hitArea=null,this.renderable=!1,this.parent=null,this.worldAlpha=1,this.worldTransform=new Phaser.Matrix,this.worldPosition=new i.Point(0,0),this.worldScale=new i.Point(1,1),this.worldRotation=0,this.filterArea=null,this._sr=0,this._cr=1,this._bounds=new i.Rectangle(0,0,0,0),this._currentBounds=null,this._mask=null,this._cacheAsBitmap=!1,this._cacheIsDirty=!1},i.DisplayObject.prototype={constructor:i.DisplayObject,destroy:function(){if(this.children){for(var t=this.children.length;t--;)this.children[t].destroy();this.children=[]}this.hitArea=null,this.parent=null,this.worldTransform=null,this.filterArea=null,this.renderable=!1,this._bounds=null,this._currentBounds=null,this._mask=null,this._destroyCachedSprite(),this._destroyTintedTexture()},updateTransform:function(t){if(!t&&!this.parent&&!this.game)return this;var e=this.parent;t?e=t:this.parent||(e=this.game.world);var i,n,s,r,o,a,h=e.worldTransform,l=this.worldTransform;this.rotation%Phaser.Math.PI2?(this.rotation!==this.rotationCache&&(this.rotationCache=this.rotation,this._sr=Math.sin(this.rotation),this._cr=Math.cos(this.rotation)),i=this._cr*this.scale.x,n=this._sr*this.scale.x,s=-this._sr*this.scale.y,r=this._cr*this.scale.y,o=this.position.x,a=this.position.y,(this.pivot.x||this.pivot.y)&&(o-=this.pivot.x*i+this.pivot.y*s,a-=this.pivot.x*n+this.pivot.y*r),l.a=i*h.a+n*h.c,l.b=i*h.b+n*h.d,l.c=s*h.a+r*h.c,l.d=s*h.b+r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty):(i=this.scale.x,n=0,s=0,r=this.scale.y,o=this.position.x-this.pivot.x*i,a=this.position.y-this.pivot.y*r,l.a=i*h.a,l.b=i*h.b,l.c=r*h.c,l.d=r*h.d,l.tx=o*h.a+a*h.c+h.tx,l.ty=o*h.b+a*h.d+h.ty),i=l.a,n=l.b,s=l.c;var c=i*(r=l.d)-n*s;if(i||n){var u=Math.sqrt(i*i+n*n);this.worldRotation=n>0?Math.acos(i/u):-Math.acos(i/u),this.worldScale.x=u,this.worldScale.y=c/u}else if(s||r){var d=Math.sqrt(s*s+r*r);this.worldRotation=Phaser.Math.HALF_PI-(r>0?Math.acos(-s/d):-Math.acos(s/d)),this.worldScale.x=c/d,this.worldScale.y=d}else this.worldScale.x=0,this.worldScale.y=0;return this.worldAlpha=this.alpha*e.worldAlpha,this.worldPosition.x=l.tx,this.worldPosition.y=l.ty,this._currentBounds=null,this.transformCallback&&this.transformCallback.call(this.transformCallbackContext,l,h),this},preUpdate:function(){},generateTexture:function(t,e,n){var s=this.getLocalBounds(),r=new Phaser.RenderTexture(this.game,0|s.width,0|s.height,n,e,t);return i.DisplayObject._tempMatrix.tx=-s.x,i.DisplayObject._tempMatrix.ty=-s.y,r.render(this,i.DisplayObject._tempMatrix),r},updateCache:function(){return this._generateCachedSprite(),this},toGlobal:function(t){return this.updateTransform(),this.worldTransform.apply(t)},toLocal:function(t,e){return e&&(t=e.toGlobal(t)),this.updateTransform(),this.worldTransform.applyInverse(t)},_renderCachedSprite:function(t){this._cachedSprite.worldAlpha=this.worldAlpha,t.gl?i.Sprite.prototype._renderWebGL.call(this._cachedSprite,t):i.Sprite.prototype._renderCanvas.call(this._cachedSprite,t)},_generateCachedSprite:function(){this._cacheAsBitmap=!1;var t=this.getLocalBounds();if(t.width=Math.max(1,Math.ceil(t.width)),t.height=Math.max(1,Math.ceil(t.height)),this.updateTransform(),this._cachedSprite)this._cachedSprite.texture.resize(t.width,t.height);else{var e=0;this.texture&&this.texture.baseTexture&&i._enableMultiTextureToggle&&(e=this.texture.baseTexture.textureIndex);var n=new Phaser.RenderTexture(this.game,t.width,t.height,void 0,void 0,void 0,void 0,e);this._cachedSprite=new i.Sprite(n),this._cachedSprite.worldTransform=this.worldTransform}var s=this._filters;this._filters=null,this._cachedSprite.filters=s,i.DisplayObject._tempMatrix.tx=-t.x,i.DisplayObject._tempMatrix.ty=-t.y,this._cachedSprite.texture.render(this,i.DisplayObject._tempMatrix,!0),this._cachedSprite.anchor.x=-t.x/t.width,this._cachedSprite.anchor.y=-t.y/t.height,this._filters=s,this._cacheAsBitmap=!0},_destroyCachedSprite:function(){this._cachedSprite&&(this._cachedSprite.texture.destroy(!0),this._cachedSprite=null)},_destroyTintedTexture:function(){this.tintedTexture&&(Phaser.CanvasPool.removeByCanvas(this.tintedTexture),this.tintedTexture=null)}},i.DisplayObject.prototype.displayObjectUpdateTransform=i.DisplayObject.prototype.updateTransform,Object.defineProperties(i.DisplayObject.prototype,{x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},worldVisible:{get:function(){if(this.visible){var t=this.parent;if(!t)return this.visible;do{if(!t.visible)return!1;t=t.parent}while(t);return!0}return!1}},mask:{get:function(){return this._mask},set:function(t){this._mask&&(this._mask.isMask=!1),this._mask=t,t&&(this._mask.isMask=!0)}},filters:{get:function(){return this._filters},set:function(t){if(Array.isArray(t)){for(var e=[],n=0;n=0&&e<=this.children.length)return t.parent&&t.parent.removeChild(t),t.parent=this,this.children.splice(e,0,t),t;throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length)},i.DisplayObjectContainer.prototype.swapChildren=function(t,e){if(t!==e){var i=this.getChildIndex(t),n=this.getChildIndex(e);if(i<0||n<0)throw new Error("swapChildren: Both the supplied DisplayObjects must be a child of the caller.");this.children[i]=e,this.children[n]=t}},i.DisplayObjectContainer.prototype.getChildIndex=function(t){var e=this.children.indexOf(t);if(-1===e)throw new Error("The supplied DisplayObject must be a child of the caller");return e},i.DisplayObjectContainer.prototype.setChildIndex=function(t,e){if(e<0||e>=this.children.length)throw new Error("The supplied index is out of bounds");var i=this.getChildIndex(t);this.children.splice(i,1),this.children.splice(e,0,t)},i.DisplayObjectContainer.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Supplied index "+t+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");return this.children[t]},i.DisplayObjectContainer.prototype.removeChild=function(t){var e=this.children.indexOf(t);if(-1!==e)return this.removeChildAt(e)},i.DisplayObjectContainer.prototype.removeChildAt=function(t){var e=this.getChildAt(t);return e&&(e.parent=void 0,this.children.splice(t,1)),e},i.DisplayObjectContainer.prototype.bringChildToTop=function(t){if(t.parent===this)return this.setChildIndex(t,this.children.length-1)},i.DisplayObjectContainer.prototype.sendChildToBack=function(t){if(t.parent===this)return this.setChildIndex(t,0)},i.DisplayObjectContainer.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=this.children.length);var i=e-t;if(i>0&&i<=e){for(var n=this.children.splice(t,i),s=0;s(a=o.width+o.x)?u:a,d=d>(h=o.height+o.y)?d:h)}var f=this._bounds;if(!p){var g=(f=new i.Rectangle).x,m=f.width+f.x,y=f.y,v=f.height+f.y,b=this.worldTransform,x=b.a,w=b.b,_=b.c,T=b.d,C=b.tx,S=b.ty,P=x*m+_*v+C,A=T*v+w*m+S,E=x*g+_*v+C,M=T*v+w*g+S,k=x*g+_*y+C,L=T*y+w*g+S,O=x*m+_*y+C,I=T*y+w*m+S;l=O<(l=k<(l=E<(l=P)?E:l)?k:l)?O:l,c=I<(c=L<(c=M<(c=A)?M:c)?L:c)?I:c,u=O>(u=k>(u=E>(u=P)?E:u)?k:u)?O:u,d=I>(d=L>(d=M>(d=A)?M:d)?L:d)?I:d}if(f.x=l,f.y=c,f.width=u-l,f.height=d-c,n)for(t.worldTransform=r,e=0;e(f=T>(f=w>(f=b>f?b:f)?w:f)?T:f)?S:f,g=P>(g=C>(g=_>(g=x>g?x:g)?_:g)?C:g)?P:g}var A=this._bounds;return A.x=m,A.width=f-m,A.y=y,A.height=g-y,this._currentBounds=A,A},i.Sprite.prototype.getLocalBounds=function(){var t=this.worldTransform;this.worldTransform=Phaser.identityMatrix;for(var e=0;e= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) { gl_FragColor = RED;return;}","}"];var s=i.compileProgram(t,this.vertexSrc||i.PixiShader.defaultVertexSrc,this.fragmentSrc);t.useProgram(s),this.uSamplerArray=t.getUniformLocation(s,"uSamplerArray[0]"),this.projectionVector=t.getUniformLocation(s,"projectionVector"),this.offsetVector=t.getUniformLocation(s,"offsetVector"),this.dimensions=t.getUniformLocation(s,"dimensions"),this.aVertexPosition=t.getAttribLocation(s,"aVertexPosition"),this.aTextureCoord=t.getAttribLocation(s,"aTextureCoord"),this.colorAttribute=t.getAttribLocation(s,"aColor"),this.aTextureIndex=t.getAttribLocation(s,"aTextureIndex");var r=[],o=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var a=0;a 0.0) gl_Position = vec4(0.0);"," gl_Position = vec4( ((aVertexPosition + offsetVector) / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vColor = vec4(aColor.rgb * aColor.a, aColor.a);"," vTextureIndex = aTextureIndex;","}"],i.PixiFastShader=function(t){if(this._UID=Phaser._UID++,this.gl=t,this.program=null,i._enableMultiTextureToggle){t=this.gl;this.MAX_TEXTURES=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);for(var e="\tif (vTextureIndex == 0.0) { gl_FragColor = texture2D(uSamplerArray[0], vTextureCoord) * vColor;return;}\n",n=1;n= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["// PixiFastShader Fragment Shader.","precision lowp float;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;","}"];this.vertexSrc=["// PixiFastShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aPositionCoord;","attribute vec2 aScale;","attribute float aRotation;","attribute vec2 aTextureCoord;","attribute float aColor;","attribute float aTextureIndex;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","uniform mat3 uMatrix;","varying vec2 vTextureCoord;","varying float vColor;","varying float vTextureIndex;","const vec2 center = vec2(-1.0, 1.0);","void main(void) {"," vec2 v;"," vec2 sv = aVertexPosition * aScale;"," v.x = (sv.x) * cos(aRotation) - (sv.y) * sin(aRotation);"," v.y = (sv.x) * sin(aRotation) + (sv.y) * cos(aRotation);"," v = ( uMatrix * vec3(v + aPositionCoord , 1.0) ).xy ;"," gl_Position = vec4( ( v / projectionVector) + center , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;"," vColor = aColor;","}"],this.textureCount=0,this.init()},i.PixiFastShader.prototype.constructor=i.PixiFastShader,i.PixiFastShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r= "+this.MAX_TEXTURES+".0) { gl_FragColor = BLUE;return;}"," if(isnan(vTextureIndex)) {gl_FragColor = RED;return;}","}"]}else this.fragmentSrc=["//StripShader Fragment Shader.","precision mediump float;","varying vec2 vTextureCoord;","varying float vTextureIndex;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {"," gl_FragColor = texture2D(uSampler, vTextureCoord);","}"];this.vertexSrc=["//StripShader Vertex Shader.","attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aTextureIndex;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform vec2 offsetVector;","varying vec2 vTextureCoord;","varying float vTextureIndex;","void main(void) {"," vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);"," v -= offsetVector.xyx;"," gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);"," vTextureCoord = aTextureCoord;"," vTextureIndex = aTextureIndex;","}"],this.init()},i.StripShader.prototype.constructor=i.StripShader,i.StripShader.prototype.init=function(){var t=this.gl,e=i.compileProgram(t,this.vertexSrc,this.fragmentSrc);if(t.useProgram(e),this.uSampler=i._enableMultiTextureToggle?t.getUniformLocation(e,"uSamplerArray[0]"):t.getUniformLocation(e,"uSampler"),i._enableMultiTextureToggle){var n=[],s=t.createTexture();t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,s),t.texImage2D(t.TEXTURE_2D,0,t.RGB,1,1,0,t.RGB,t.UNSIGNED_BYTE,null);for(var r=0;r>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},n=this.gl,s=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),r=n.getParameter(n.MAX_TEXTURE_SIZE),o=this.game.cache._cache.image,a=null,h=0;h=this.size&&(this.flush(),this.currentBaseTexture=n.baseTexture);var a=n._uvs;if(a){var h,l,c,u,d=t.anchor.x,p=t.anchor.y;if(n.trim){var f=n.trim;h=(l=f.x-d*f.width)+n.crop.width,c=(u=f.y-p*f.height)+n.crop.height}else h=n.frame.width*(1-d),l=n.frame.width*-d,c=n.frame.height*(1-p),u=n.frame.height*-p;var g=this.currentBatchSize*this.vertexSize,m=n.baseTexture.resolution,y=n.baseTexture.textureIndex,v=o.a/m,b=o.b/m,x=o.c/m,w=o.d/m,_=o.tx,T=o.ty,C=n.crop.height;if(n.rotated){var S=o.a,P=o.b,A=o.c,E=o.d,M=l,k=h;_=o.c*C+_,T=o.d*C+T,v=6123233995736766e-32*S-A,b=6123233995736766e-32*P-E,x=S+6123233995736766e-32*A,w=P+6123233995736766e-32*E,n._updateUvsInverted(),h=c,l=u,c=k,u=M}var L=this.colors,O=this.positions,I=t.tint,B=(I>>16)+(65280&I)+((255&I)<<16)+(255*t.worldAlpha<<24);this.renderSession.roundPixels?(O[g++]=v*l+x*u+_|0,O[g++]=w*u+b*l+T|0,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_|0,O[g++]=w*u+b*h+T|0,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_|0,O[g++]=w*c+b*h+T|0,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_|0,O[g++]=w*c+b*l+T|0,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y):(O[g++]=v*l+x*u+_,O[g++]=w*u+b*l+T,O[g++]=a.x0,O[g++]=a.y0,L[g++]=B,O[g++]=y,O[g++]=v*h+x*u+_,O[g++]=w*u+b*h+T,O[g++]=a.x1,O[g++]=a.y1,L[g++]=B,O[g++]=y,O[g++]=v*h+x*c+_,O[g++]=w*c+b*h+T,O[g++]=a.x2,O[g++]=a.y2,L[g++]=B,O[g++]=y,O[g++]=v*l+x*c+_,O[g++]=w*c+b*l+T,O[g++]=a.x3,O[g++]=a.y3,L[g++]=B,O[g++]=y),this.sprites[this.currentBatchSize++]=t}},i.WebGLSpriteBatch.prototype.renderTilingSprite=function(t){var e=t.tilingTexture,n=e.baseTexture,s=this.gl,r=t.texture.baseTexture.textureIndex;i.WebGLRenderer.textureArray[r]!=n&&(this.flush(),s.activeTexture(s.TEXTURE0+r),s.bindTexture(s.TEXTURE_2D,n._glTextures[s.id]),i.WebGLRenderer.textureArray[r]=n),this.currentBatchSize>=this.size&&(this.flush(),this.currentBaseTexture=e.baseTexture),t._uvs||(t._uvs=new i.TextureUvs);var o=t._uvs,a=e.baseTexture.width,h=e.baseTexture.height;t.tilePosition.x%=a*t.tileScaleOffset.x,t.tilePosition.y%=h*t.tileScaleOffset.y;var l=t.tilePosition.x/(a*t.tileScaleOffset.x),c=t.tilePosition.y/(h*t.tileScaleOffset.y),u=t.width/a/(t.tileScale.x*t.tileScaleOffset.x),d=t.height/h/(t.tileScale.y*t.tileScaleOffset.y);o.x0=0-l,o.y0=0-c,o.x1=1*u-l,o.y1=0-c,o.x2=1*u-l,o.y2=1*d-c,o.x3=0-l,o.y3=1*d-c;var p=t.tint,f=(p>>16)+(65280&p)+((255&p)<<16)+(255*t.worldAlpha<<24),g=this.positions,m=this.colors,y=t.width,v=t.height,b=t.anchor.x,x=t.anchor.y,w=y*(1-b),_=y*-b,T=v*(1-x),C=v*-x,S=this.currentBatchSize*this.vertexSize,P=e.baseTexture.resolution,A=t.worldTransform,E=A.a/P,M=A.b/P,k=A.c/P,L=A.d/P,O=A.tx,I=A.ty;g[S++]=E*_+k*C+O,g[S++]=L*C+M*_+I,g[S++]=o.x0,g[S++]=o.y0,m[S++]=f,g[S++]=r,g[S++]=E*w+k*C+O,g[S++]=L*C+M*w+I,g[S++]=o.x1,g[S++]=o.y1,m[S++]=f,g[S++]=r,g[S++]=E*w+k*T+O,g[S++]=L*T+M*w+I,g[S++]=o.x2,g[S++]=o.y2,m[S++]=f,g[S++]=r,g[S++]=E*_+k*T+O,g[S++]=L*T+M*_+I,g[S++]=o.x3,g[S++]=o.y3,m[S++]=f,g[S++]=r,this.sprites[this.currentBatchSize++]=t},i.WebGLSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t,e,n,s,r=this.gl;if(this.dirty){this.dirty=!1,t=this.defaultShader.shaders[r.id],r.activeTexture(r.TEXTURE0),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var o=this.vertexSize;r.vertexAttribPointer(t.aVertexPosition,2,r.FLOAT,!1,o,0),r.vertexAttribPointer(t.aTextureCoord,2,r.FLOAT,!1,o,8),r.vertexAttribPointer(t.colorAttribute,4,r.UNSIGNED_BYTE,!0,o,16),r.vertexAttribPointer(t.aTextureIndex,1,r.FLOAT,!1,o,20)}if(this.currentBatchSize>.5*this.size)r.bufferSubData(r.ARRAY_BUFFER,0,this.vertices);else{r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer);var a=this.positions.subarray(0,this.currentBatchSize*this.vertexSize);r.bufferSubData(r.ARRAY_BUFFER,0,a)}for(var h,l=0,c=0,u=null,d=this.renderSession.blendModeManager.currentBlendMode,p=null,f=!1,g=!1,m=0,y=this.currentBatchSize;m0&&(v=!1),(f||g)&&(this.renderBatch(u,l,c),c=m,l=0,u=e,f&&(d=n,this.renderSession.blendModeManager.setBlendMode(d)),g)){(t=(p=s).shaders[r.id])||((t=new i.PixiShader(r)).fragmentSrc=p.fragmentSrc,t.uniforms=p.uniforms,t.init(),p.shaders[r.id]=t),this.renderSession.shaderManager.setShader(t),t.dirty&&t.syncUniforms();var b=this.renderSession.projection;r.uniform2f(t.projectionVector,b.x,b.y);var x=this.renderSession.offset;r.uniform2f(t.offsetVector,x.x,x.y)}l++}this.renderBatch(u,l,c),this.currentBatchSize=0}},i.WebGLSpriteBatch.prototype.renderBatch=function(t,e,i){if(0!==e){var n=this.gl;if(t._dirty[n.id]){if(!this.renderSession.renderer.updateTexture(t))return}else n.bindTexture(n.TEXTURE_2D,t._glTextures[n.id]);n.drawElements(n.TRIANGLES,6*e,n.UNSIGNED_SHORT,6*i*2),this.renderSession.drawCount++}},i.WebGLSpriteBatch.prototype.stop=function(){this.flush(),this.dirty=!0},i.WebGLSpriteBatch.prototype.start=function(){this.dirty=!0},i.WebGLSpriteBatch.prototype.destroy=function(){this.vertices=null,this.indices=null,this.gl.deleteBuffer(this.vertexBuffer),this.gl.deleteBuffer(this.indexBuffer),this.currentBaseTexture=null,this.gl=null},i.WebGLFastSpriteBatch=function(t){this.vertSize=11,this.maxSize=6e3,this.size=this.maxSize;var e=4*this.size*this.vertSize,i=6*this.maxSize;this.vertices=new Float32Array(e),this.indices=new Uint16Array(i),this.vertexBuffer=null,this.indexBuffer=null,this.lastIndexCount=0;for(var n=0,s=0;n=this.size&&this.flush()}},i.WebGLFastSpriteBatch.prototype.flush=function(){if(0!==this.currentBatchSize){var t=this.gl;if(this.currentBaseTexture._glTextures[t.id]){if(this.currentBatchSize>.5*this.size)t.bufferSubData(t.ARRAY_BUFFER,0,this.vertices);else{var e=this.vertices.subarray(0,4*this.currentBatchSize*this.vertSize);t.bufferSubData(t.ARRAY_BUFFER,0,e)}t.drawElements(t.TRIANGLES,6*this.currentBatchSize,t.UNSIGNED_SHORT,0),this.currentBatchSize=0,this.renderSession.drawCount++}else this.renderSession.renderer.updateTexture(this.currentBaseTexture,t)}},i.WebGLFastSpriteBatch.prototype.stop=function(){this.flush()},i.WebGLFastSpriteBatch.prototype.start=function(){var t=this.gl;t.activeTexture(t.TEXTURE0),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var e=this.renderSession.projection;t.uniform2f(this.shader.projectionVector,e.x,e.y),t.uniformMatrix3fv(this.shader.uMatrix,!1,this.matrix);var i=4*this.vertSize;t.vertexAttribPointer(this.shader.aVertexPosition,2,t.FLOAT,!1,i,0),t.vertexAttribPointer(this.shader.aPositionCoord,2,t.FLOAT,!1,i,8),t.vertexAttribPointer(this.shader.aScale,2,t.FLOAT,!1,i,16),t.vertexAttribPointer(this.shader.aRotation,1,t.FLOAT,!1,i,24),t.vertexAttribPointer(this.shader.aTextureCoord,2,t.FLOAT,!1,i,28),t.vertexAttribPointer(this.shader.colorAttribute,1,t.FLOAT,!1,i,36),t.vertexAttribPointer(this.shader.aTextureIndex,1,t.FLOAT,!1,i,40)},i.WebGLFilterManager=function(){this.filterStack=[],this.offsetX=0,this.offsetY=0},i.WebGLFilterManager.prototype.constructor=i.WebGLFilterManager,i.WebGLFilterManager.prototype.setContext=function(t){this.gl=t,this.texturePool=[],this.initShaderBuffers()},i.WebGLFilterManager.prototype.begin=function(t,e){this.renderSession=t,this.defaultShader=t.shaderManager.defaultShader;var i=this.renderSession.projection;this.width=2*i.x,this.height=2*-i.y,this.buffer=e},i.WebGLFilterManager.prototype.pushFilter=function(t){var e=this.gl,n=this.renderSession.projection,s=this.renderSession.offset;t._filterArea=t.target.filterArea||t.target.getBounds(),t._previous_stencil_mgr=this.renderSession.stencilManager,this.renderSession.stencilManager=new i.WebGLStencilManager,this.renderSession.stencilManager.setContext(e),e.disable(e.STENCIL_TEST),this.filterStack.push(t);var r=t.filterPasses[0];this.offsetX+=t._filterArea.x,this.offsetY+=t._filterArea.y;var o=this.texturePool.pop();o?o.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution):o=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),e.bindTexture(e.TEXTURE_2D,o.texture);var a=t._filterArea,h=r.padding;a.x-=h,a.y-=h,a.width+=2*h,a.height+=2*h,a.x<0&&(a.x=0),a.width>this.width&&(a.width=this.width),a.y<0&&(a.y=0),a.height>this.height&&(a.height=this.height),e.bindFramebuffer(e.FRAMEBUFFER,o.frameBuffer),e.viewport(0,0,a.width*this.renderSession.resolution,a.height*this.renderSession.resolution),n.x=a.width/2,n.y=-a.height/2,s.x=-a.x,s.y=-a.y,e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),t._glFilterTexture=o},i.WebGLFilterManager.prototype.popFilter=function(){var t=this.gl,e=this.filterStack.pop(),n=e._filterArea,s=e._glFilterTexture,r=this.renderSession.projection,o=this.renderSession.offset;if(e.filterPasses.length>1){t.viewport(0,0,n.width*this.renderSession.resolution,n.height*this.renderSession.resolution),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),this.vertexArray[0]=0,this.vertexArray[1]=n.height,this.vertexArray[2]=n.width,this.vertexArray[3]=n.height,this.vertexArray[4]=0,this.vertexArray[5]=0,this.vertexArray[6]=n.width,this.vertexArray[7]=0,t.bufferSubData(t.ARRAY_BUFFER,0,this.vertexArray),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),this.uvArray[2]=n.width/this.width,this.uvArray[5]=n.height/this.height,this.uvArray[6]=n.width/this.width,this.uvArray[7]=n.height/this.height,t.bufferSubData(t.ARRAY_BUFFER,0,this.uvArray);var a=s,h=this.texturePool.pop();h||(h=new i.FilterTexture(this.gl,this.width*this.renderSession.resolution,this.height*this.renderSession.resolution)),h.resize(this.width*this.renderSession.resolution,this.height*this.renderSession.resolution),t.bindFramebuffer(t.FRAMEBUFFER,h.frameBuffer),t.clear(t.COLOR_BUFFER_BIT),t.disable(t.BLEND);for(var l=0;l0?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.applyFilterPass(d,n,p,f),this.texturePool.push(s),e._glFilterTexture=null},i.WebGLFilterManager.prototype.applyFilterPass=function(t,e,n,s){var r=this.gl,o=t.shaders[r.id];o||((o=new i.PixiShader(r)).fragmentSrc=t.fragmentSrc,o.uniforms=t.uniforms,o.init(!0),t.shaders[r.id]=o),this.renderSession.shaderManager.setShader(o),r.uniform2f(o.projectionVector,n/2,-s/2),r.uniform2f(o.offsetVector,0,0),t.uniforms.dimensions&&(t.uniforms.dimensions.value[0]=this.width,t.uniforms.dimensions.value[1]=this.height,t.uniforms.dimensions.value[2]=this.vertexArray[0],t.uniforms.dimensions.value[3]=this.vertexArray[5]),o.syncUniforms(),r.bindBuffer(r.ARRAY_BUFFER,this.vertexBuffer),r.vertexAttribPointer(o.aVertexPosition,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.uvBuffer),r.vertexAttribPointer(o.aTextureCoord,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ARRAY_BUFFER,this.colorBuffer),r.vertexAttribPointer(o.colorAttribute,2,r.FLOAT,!1,0,0),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.drawElements(r.TRIANGLES,6,r.UNSIGNED_SHORT,0),this.renderSession.drawCount++},i.WebGLFilterManager.prototype.initShaderBuffers=function(){var t=this.gl;this.vertexBuffer=t.createBuffer(),this.uvBuffer=t.createBuffer(),this.colorBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),this.vertexArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,this.vertexArray,t.STATIC_DRAW),this.uvArray=new Float32Array([0,0,1,0,0,1,1,1]),t.bindBuffer(t.ARRAY_BUFFER,this.uvBuffer),t.bufferData(t.ARRAY_BUFFER,this.uvArray,t.STATIC_DRAW),this.colorArray=new Float32Array([1,16777215,1,16777215,1,16777215,1,16777215]),t.bindBuffer(t.ARRAY_BUFFER,this.colorBuffer),t.bufferData(t.ARRAY_BUFFER,this.colorArray,t.STATIC_DRAW),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,1,3,2]),t.STATIC_DRAW)},i.WebGLFilterManager.prototype.destroy=function(){var t=this.gl;this.filterStack=null,this.offsetX=0,this.offsetY=0;for(var e=0;e=0;t--){var e=this._glTextures[t],n=i.glContexts[t];n&&e&&n.deleteTexture(e)}this._glTextures.length=0,this.dirty()},i.BaseTexture.fromCanvas=function(t,e,n){return 0===t.width&&(t.width=1),0===t.height&&(t.height=1),n=n||1,new i.BaseTexture(t,e,n)},i.TextureSilentFail=!1,i.Texture=function(t,e,n,s){this.noFrame=!1,e||(this.noFrame=!0,e=new i.Rectangle(0,0,1,1)),t instanceof i.Texture&&(t=t.baseTexture),this.baseTexture=t,this.frame=e,this.trim=s,this.valid=!1,this.isTiling=!1,this.requiresUpdate=!1,this.requiresReTint=!1,this._uvs=null,this.width=0,this.height=0,this.crop=n||new i.Rectangle(0,0,1,1),this.rotated=!1,t.hasLoaded&&(this.noFrame&&(e=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(e))},i.Texture.prototype.constructor=i.Texture,i.Texture.prototype.onBaseTextureLoaded=function(){var t=this.baseTexture;this.noFrame&&(this.frame=new i.Rectangle(0,0,t.width,t.height)),this.setFrame(this.frame)},i.Texture.prototype.destroy=function(t){t&&this.baseTexture.destroy(),this.valid=!1},i.Texture.prototype.setFrame=function(t){if(this.noFrame=!1,this.frame=t,this.width=t.width,this.height=t.height,this.crop.x=t.x,this.crop.y=t.y,this.crop.width=t.width,this.crop.height=t.height,this.trim||!(t.x+t.width>this.baseTexture.width||t.y+t.height>this.baseTexture.height))this.valid=t&&t.width&&t.height&&this.baseTexture.source&&this.baseTexture.hasLoaded,this.trim&&(this.width=this.trim.width,this.height=this.trim.height,this.frame.width=this.trim.width,this.frame.height=this.trim.height),this.valid&&this._updateUvs();else{if(!i.TextureSilentFail)throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this);this.valid=!1}},i.Texture.prototype._updateUvs=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.width)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.width)/e,this._uvs.y2=(t.y+t.height)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.height)/n},i.Texture.prototype._updateUvsInverted=function(){this._uvs||(this._uvs=new i.TextureUvs);var t=this.crop,e=this.baseTexture.width,n=this.baseTexture.height;this._uvs.x0=t.x/e,this._uvs.y0=t.y/n,this._uvs.x1=(t.x+t.height)/e,this._uvs.y1=t.y/n,this._uvs.x2=(t.x+t.height)/e,this._uvs.y2=(t.y+t.width)/n,this._uvs.x3=t.x/e,this._uvs.y3=(t.y+t.width)/n},i.Texture.fromCanvas=function(t,e){var n=i.BaseTexture.fromCanvas(t,e);return new i.Texture(n)},i.TextureUvs=function(){this.x0=0,this.y0=0,this.x1=0,this.y1=0,this.x2=0,this.y2=0,this.x3=0,this.y3=0},t.exports&&(e=t.exports=i),e.PIXI=i,i}).call(this)},9204:function(t,e,i){"use strict";var n=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e=0;r--){var o=i[e.c];switch((e=this.execStack[r]).scope){case"interrupt":o=i[e.origin];var a=Object.keys(o.interrupt[e.index])[0];i=o.interrupt[e.index][a];break;case"choice":var h=Object.keys(o.choice[e.index])[0];i=o.choice[e.index][h];break;case"if":i=o[Object.keys(o)[0]]}s=i.slice(e.c).concat(s)}return s||[]},t}();e.default=o},885:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.game=e,this.name=t}return t.prototype.onInit=function(){},t.prototype.onStart=function(){},t.prototype.onLoad=function(t,e){},t.prototype.onLoaded=function(){},t.prototype.onSave=function(t,e){},t.prototype.onCall=function(t){},t.prototype.onAction=function(t){},t.prototype.onEndScene=function(t){},t.prototype.onTeardown=function(){},t}();e.default=i},8811:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.hasOwnProperty.call(t,i)&&r(e,t,i);return o(e,t),e},h=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},l=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&"says"===r[1];if("show"===a||"play"===a||h){var l=this.game.managers.story.parseAction(n);this.assetsPerScene[e]||(this.assetsPerScene[e]={}),this.assetsPerScene[e][l.actor]=l.actorType}if("if"!==a&&"else"!==a||i.unshift.apply(i,n[s]),"choice"===a||"interrupt"===a||"visualChoice"===a)for(var u=0,d=n[s];u0?[4,this.game.managers.audio.decodeAudio(i)]:[3,2];case 1:s.sent(),s.label=2;case 2:return this.loadingScreen&&(this.loadingScreen.destroy(this.game),this.loadingScreen=null),this.backgroundLoading&&(this.backgroundLoading=null),this.game.config.debugMode&&console.log("All assets loaded."),e(!0),[2]}}))}))}),c),c.loading=!0,c.loadingScreen&&c.loadingScreen.setLoadingBar(c.game),c.game.load.start()}))]}}))}))},t}();e.default=u},3973:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(9204)),r=function(){this.skipping=!1,this.unskippable=!1,this.auto=!1,this.paused=!1,this.clickCooldown=200,this.clickLocked=!1,this.waitForClick=!1,this.execStack=new s.default,this.actionsCounter=0,this.nextAction=null};e.default=r},571:function(t,e){"use strict";var i,n=this&&this.__extends||(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.RangedUserPreference=e.UserPreference=void 0;var s=function(){function t(t){this.value=t}return t.prototype.set=function(t){this.value=t},t.prototype.get=function(){return this.value},t.prototype.toJSON=function(){return this.value},t}();e.UserPreference=s;var r=function(t){function e(e,i,n,s){void 0===s&&(s=!1);var r=t.call(this,e)||this;return r.min=i,r.max=n,r.inverted=s,r}return n(e,t),e.prototype.set=function(t){this.value=t*(this.max-this.min)+this.min},e.prototype.get=function(){return this.inverted?this.max-this.value:this.value},e}(s);e.RangedUserPreference=r;var o=function(){function t(t,e){this.game=t,this.preferences={textSpeed:new r(20,10,100,!0),autoSpeed:new r(150,50,300),bgmv:new r(.5,0,1),sfxv:new r(.5,0,1),muted:new s(!1)};var i=localStorage.getItem("RenJSUserPreferences"+t.config.name);i?this.setPreferences(JSON.parse(i)):this.setPreferences(e)}return t.prototype.setPreferences=function(t){if(t)for(var e in this.preferences)void 0!==t[e]&&(this.preferences[e].value=t[e])},t.prototype.set=function(t,e){this.preferences[t].set(e),this.savePreferences()},t.prototype.get=function(t){return this.preferences[t].get()},t.prototype.addPreference=function(t,e,i){this.preferences[t]="boolean"===i?new s(e):new r(e,i.min,i.max)},t.prototype.savePreferences=function(){var t=JSON.stringify(this.preferences);localStorage.setItem("RenJSUserPreferences"+this.game.config.name,t)},t}();e.default=o},9163:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i){this.game=t,this.actionType=e,this.properties=i,this.key=Object.keys(i)[0],this.keyParams=this.key.split(" "),this.body=i[this.key]}return t.prototype.resolve=function(t,e){var i=this;t&&!e?t.then((function(){return i.game.resolveAction()})):this.game.resolveAction()},t.prototype.execute=function(){},t.prototype.parseParams=function(t){return t?this.keyParams:(this.params||(this.params=this.body?this.body.split(" "):[]),this.params)},t.prototype.parseActor=function(){return this.keyParams[1]},t.prototype.parseParameter=function(t,e,i){void 0===e&&(e="boolean"),void 0===i&&(i=!1);var n=this.parseParams(i),s=n.indexOf(t);if("boolean"===e)return-1!==s;if(-1===s)return null;var r=n[s+1];if("coords"===e){if(r in this.game.storyConfig.positions)return this.game.storyConfig.positions[r];var o=r.split(",");return{x:parseInt(o[0],10),y:parseInt(o[1],10)}}return"number"===e?parseFloat(r):r},t}();e.default=i},423:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.screenEffects.ambient.start(this.actor),this.resolve()},e}(r(i(9163)).default);e.default=o},1156:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.contAfterTrans=s.parseParameter("CONTINUE"),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.cgs.animate(this.actor,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},2352:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.keyParams[1],s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),"play"===s.actionType?(s.looped=s.parseParameter("LOOPED"),s.looped&&(s.fromSeconds=s.parseParameter("FROM","number")),s.force=s.parseParameter("FORCE"),s.channel=s.parseParameter("IN","string"),s.parseParameter("BGS")&&(s.channel="bgs"),s.channel||(s.channel="bgm")):s.channel=s.actor,s}return s(e,t),e.prototype.execute=function(){"play"===this.actionType?"music"===this.actorType?this.game.managers.audio.play(this.actor,this.channel,this.looped,this.fromSeconds,this.transition,this.force):this.game.managers.audio.playSFX(this.actor):this.game.managers.audio.stop(this.channel,this.transition),this.resolve()},e}(r(i(9163)).default);e.default=o},1629:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){var t=this.game.pluginsRJS[this.actor];this.properties.body=this.body,t.onCall(this.properties)},e}(r(i(9163)).default);e.default=o},7519:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__spreadArrays||function(){for(var t=0,e=0,i=arguments.length;e0){var r=s.game.managers.story.currentScene[0];r&&"else"in r&&(s.branches.ISFALSE=r.else,s.game.managers.story.currentScene.shift())}return s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.branch(this.condition,this.branches),this.resolve()},e}(r(i(9163)).default);e.default=o},2028:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actorType="characters",s.actor=s.keyParams[0],s.look=s.keyParams.length>2?s.keyParams[2]:null,s.game.managers.story.reservedWords.includes(s.look)&&(console.log("look is reserved word"),s.look=null),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({actor:this.actor,message:e})}t=this.game.managers.text.characterSays(this.actor,this.look,this.body,this.boxId,this.dontHide),this.resolve(t)},e}(r(i(7068)).default);e.default=o},8998:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.scene=s.game.managers.logic.parseVars(s.body),s}return s(e,t),e.prototype.execute=function(){this.resolve(this.game.managers.story.startScene(this.scene))},e}(r(i(9163)).default);e.default=o},1929:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s.actorType=s.game.managers.story.getActorType(s.actor),s.transition=s.parseParameter("WITH","string"),s.transition||(s.transition=s.game.storyConfig.transitions.defaults[s.actorType]),s.contAfterTrans=s.parseParameter("CONTINUE");var r=s.parseParameter("AT","coords");r&&(s.properties.position=r),s.parseParameter("FLIP")&&(s.properties.flipped="flip"),"cgs"===s.actorType&&(s.properties.layer=s.parseParameter("BEHIND")?"behindCharactersSprites":"cgsSprites");var o=s.parseParameter("IN","string");return o&&(s.properties.layer=o),"characters"===s.actorType&&(s.properties.look=s.params[0],s.game.managers.story.reservedWords.includes(s.properties.look)&&(s.properties.look=null),s.properties.look||(s.properties.look="normal")),s}return s(e,t),e.prototype.execute=function(){var t=this.game.managers.story.getManagerByActorType(this.actorType).show(this.actor,this.transition,this.properties);this.resolve(t,this.contAfterTrans)},e}(r(i(9163)).default);e.default=o},7068:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.dontHide=!1,s.boxId=s.parseParameter("IN","string",!0),s}return s(e,t),e.prototype.execute=function(){var t;if(this.game.storyConfig.keepStoryLog){var e=this.game.managers.logic.parseVars(this.body.toString());this.game.storyLog.push({message:e})}t=this.game.managers.text.display(this.body,this.boxId,null,this.dontHide),this.resolve(t)},e}(r(i(9163)).default);e.default=o},733:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i,n){var s=t.call(this,e,i,n)||this;return s.game=e,s.actionType=i,s.properties=n,s.actor=s.parseActor(),s}return s(e,t),e.prototype.execute=function(){this.game.managers.logic.setVar(this.actor,this.body),this.resolve()},e}(r(i(9163)).default);e.default=o},7843:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.execute=function(){"click"===this.body?this.game.waitForClick():this.game.waitTimeout(parseInt(this.body,10))},e}(r(i(9163)).default);e.default=o},5761:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,i,n){this.game=t,this.keyName=e,this.config={displayName:"",color:"#FFFFFF",voice:"none",nameBox:"default",messageBox:"default"},this.currentLook=null,this.usePortraits=!1,this.voice=null,Object.assign(this.config,i),"none"!==this.config.voice&&(this.voice=this.game.add.audio(this.config.voice),this.voice.play(),this.voice.stop()),this.usePortraits=void 0!==n}return t.prototype.createPortrait=function(t,e){if(this.usePortraits&&e.config.portrait){var i=this.keyName+"_portrait_"+t,n=e.config.portrait,s=this.game.add.sprite(n.x,n.y,i);s.anchor.set(.5,1),e.addChild(s),e.portrait=s}},t.prototype.createLook=function(t){void 0===t&&(t={});var e=this.currentLook?this.getLookData():{look:"normal",position:this.game.storyConfig.positions.DEFAULT,flipped:!1};Object.assign(e,t);var i=this.keyName+"_"+e.look,n=this.game.managers.story.characterSprites.create(e.position.x,e.position.y,i);return n.name=e.look,"flip"===t.flipped&&(this.currentLook?e.flipped=!(-1===this.currentLook.scale.x):e.flipped=!0),n.scale.x=e.flipped?-1:1,n.anchor.set(.5,1),n.updateTransform(),n.alpha=0,this.currentLook=n,n},t.prototype.resetLook=function(){this.currentLook.destroy(),this.currentLook=null},t.prototype.getLookData=function(){return this.currentLook?{look:this.currentLook.name,position:{x:this.currentLook.x,y:this.currentLook.y},flipped:-1===this.currentLook.scale.x}:null},t}();e.default=i},2459:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1] GUIVersion=='2.0'");var I=a.default.dump(JSON.parse(JSON.stringify(this.config)));console.log(I)}},e.prototype.convertText=function(t){return{x:t.isTextCentered?0:parseInt(t["offset-x"],10),y:t.isTextCentered?0:parseInt(t["offset-y"],10),lineSpacing:t.lineSpacing,style:this.convertTextStyle(t)}},e.prototype.convertTextStyle=function(t){var e={font:t.font,fontSize:t.size+"px",fill:t.color};return t.align&&(e.align=t.align),t["text-width"]&&(e.wordWrap=!0,e.wordWrapWidth=t["text-width"]),t.isTextCentered?(e.boundsAlignH="center",e.boundsAlignV="middle"):t["text-width"]||(e.boundsAlignH=t.align?t.align:"left",e.boundsAlignV="top"),e},e}(o.default);e.default=h},4254:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.initAssets=function(t){var e=function(t,e,i){return Object.keys(t).map((function(n){return{key:n,file:i+t[n].fileName,type:e,w:t[n].w,h:t[n].h}}))},i=e(t.assets.images,"image",t.assetsPath),n=e(t.assets.audio,"audio",t.assetsPath),s=e(t.assets.spritesheets,"spritesheet",t.assetsPath);this.assets=i.concat(n).concat(s),this.fonts=Object.keys(t.assets.fonts),this.config=t.config},e}(r(i(2459)).default);e.default=o},5225:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(3572);function s(t){return t.replace(/\s+/g," ").trim()}function r(t){for(var e,i,s=n.tokenizeTextStyle((e=t,(i=document.createElement("div")).textContent=e,i.innerHTML)),r=[],o="";s.length;){var a=s.shift();a.tag?"end"===a.tag&&r.length?o+="":a.tag.startsWith("color")?(r.push("mark"),o+=""):"bold"===a.tag?(r.push("strong"),o+=""):"italic"===a.tag&&(r.push("em"),o+=""):o+=a.text}return o.replace(/\n/g,"
")}var o=function(){function t(t){var e=this;this.game=t,this.debug=!1,this.state={name:"",text:"",choices:[],buttons:[],sliders:[]},this.updateLayout=function(){e.updateLayoutContainer(),e.updateLayoutText(),e.updateLayoutChoices(),e.updateLayoutButtons(),e.updateLayoutSliders()},this.elContainer=document.createElement("div"),this.elContainer.style.position="fixed",this.elContainer.style.pointerEvents="none",this.debug&&(this.elContainer.style.border="solid 1px red"),this.elProgress=document.createElement("progress"),this.elProgress.max=100,this.elProgress.value=0,this.debug||(this.elProgress.style.opacity="0"),this.elChoices=document.createElement("ol"),this.elChoices.style.listStyle="none",this.elButtons=document.createElement("ul"),this.elButtons.style.listStyle="none",this.elSliders=document.createElement("ul"),this.elSliders.style.listStyle="none",this.elText=document.createElement("div"),this.elText.setAttribute("aria-live","polite"),this.elText.setAttribute("aria-atomic","true"),this.elText.setAttribute("aria-relevant","text"),this.elText.setAttribute("role","main"),this.elText.setAttribute("aria-roledescription","text"),this.elText.tabIndex=0,this.elText.onclick=function(){e.game.onTap(null)},this.elText.style.position="absolute",this.debug?(this.elText.style.color="red",this.elText.style.top="1rem",this.elText.style.left="1rem",this.elText.style.right="1rem",this.elText.style.bottom="1rem"):(this.elText.style.color="transparent",this.elText.style.fontSize="0",this.elText.style.outline="none",this.elText.style.top="0",this.elText.style.left="0",this.elText.style.right="0",this.elText.style.bottom="0"),this.elContainer.appendChild(this.elProgress),this.elContainer.appendChild(this.elText),this.elContainer.appendChild(this.elChoices),this.elContainer.appendChild(this.elSliders),this.elContainer.appendChild(this.elButtons)}return t.prototype.boot=function(){var t=this;this.game.canvas.setAttribute("aria-hidden","true"),this.game.scale.onSizeChange.add(this.updateLayout),this.updateLayout(),this.game.load.onLoadStart.add((function(){t.updateLayout(),t.busy(),t.progress(0)})),this.game.load.onLoadComplete.add((function(){t.progress(100),t.ready()})),this.game.load.onFileComplete.add((function(e){t.progress(e)})),document.body.appendChild(this.elContainer)},t.prototype.progress=function(t){void 0===t?delete this.elProgress.value:this.elProgress.value=Math.floor(t)},t.prototype.busy=function(){this.elText.setAttribute("aria-busy","true")},t.prototype.ready=function(){this.elText.setAttribute("aria-busy","false")},t.prototype.updateLayoutText=function(){var t,e=r("hud"!==(null===(t=this.game.gui)||void 0===t?void 0:t.currentMenu)?"":s(this.state.text).split("\n").map((function(t){return t.trim()})).filter((function(t){return t})).join("\n"));e.length>0&&this.state.name&&(e=s(this.state.name)+": "+e),this.elText.innerHTML=e},t.prototype.updateLayoutContainer=function(){this.elContainer.style.width=this.game.scale.width+"px",this.elContainer.style.height=this.game.scale.height+"px",this.elContainer.style.top=this.game.scale.margin.top+"px",this.elContainer.style.left=this.game.scale.margin.left+"px"},t.prototype.updateLayoutBounds=function(t,e){t.style.width=e.width*this.game.scale.scaleFactorInversed.x+"px",t.style.height=e.height*this.game.scale.scaleFactorInversed.y+"px",t.style.top=e.y*this.game.scale.scaleFactorInversed.y+"px",t.style.left=e.x*this.game.scale.scaleFactorInversed.x+"px"},t.prototype.updateLayoutList=function(t,e){var i=this;this.rescueFocus(t),e.forEach((function(e,n){var s=t.children[n];s.style.display=e.isActive()?null:"none",i.updateLayoutBounds(s,e.getBounds())}))},t.prototype.updateLayoutChoices=function(){this.updateLayoutList(this.elChoices,this.state.choices)},t.prototype.updateLayoutButtons=function(){this.updateLayoutList(this.elButtons,this.state.buttons)},t.prototype.updateLayoutSliders=function(){this.updateLayoutList(this.elSliders,this.state.sliders)},t.prototype.rescueFocus=function(t){var e=document.activeElement;t!==e&&(e&&!t.contains(e)||this.elText.focus())},t.prototype.text=function(t){void 0===t&&(t=""),this.state.text=t,this.updateLayoutText()},t.prototype.name=function(t){void 0===t&&(t=""),this.state.name=t,this.updateLayoutText()},t.prototype.button=function(t){var e,i,n;this.state.buttons.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("button");r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.textContent=(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.buttons)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Button "+this.state.buttons.length,r.onclick=t.onclick,r.onfocus=t.onfocus,r.onblur=t.onblur,s.appendChild(r),this.elButtons.appendChild(s),this.updateLayoutButtons()},t.prototype.slider=function(t){var e,i,n;this.state.sliders.push(t);var s=document.createElement("li");s.style.position="absolute";var r=document.createElement("input");r.type="number",r.setAttribute("aria-label",(null!==(n=null===(i=null===(e=this.game.storyAccessibility)||void 0===e?void 0:e.sliders)||void 0===i?void 0:i[t.label])&&void 0!==n?n:t.label)||"Slider "+this.state.buttons.length),r.min=t.min.toString(10),r.max=t.max.toString(10),r.step=t.step.toString(10),r.value=t.get().toString(10),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.appearance="textfield",r.style.background="transparent",this.debug?(r.style.border="solid 1px red",r.style.color="red"):(r.style.border="none",r.style.color="transparent",r.style.fontSize="0"),r.onchange=function(e){return t.set(Number(e.currentTarget.value))},r.onfocus=function(){r.value=t.get().toString(10)},s.appendChild(r),this.elSliders.appendChild(s),this.updateLayoutSliders()},t.prototype.choices=function(t){var e=this;void 0===t&&(t=[]),this.state.choices=t,this.rescueFocus(this.elChoices),this.elChoices.innerHTML="",t.forEach((function(t){var i,n,s,o=document.createElement("li");o.style.position="absolute";var a=document.createElement("button");a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.width="100%",a.style.height="100%",a.style.background="transparent",e.debug?(a.style.border="solid 1px red",a.style.color="red"):(a.style.border="none",a.style.color="transparent",a.style.fontSize="0"),a.innerHTML=r(null!==(s=null===(n=null===(i=e.game.storyAccessibility)||void 0===i?void 0:i.choices)||void 0===n?void 0:n[t.label])&&void 0!==s?s:t.label),a.onclick=t.onclick,a.onfocus=t.onfocus,a.onblur=t.onblur,o.appendChild(a),e.elChoices.appendChild(o)})),this.updateLayoutChoices()},t}();e.default=o},150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(i,n){var s=t.call(this,i,n.x,n.y,n.asset,(function(){s.onClick()}))||this;return s.setFrames.apply(s,e.getButtonFrames(s.animations.frameTotal)),s.config=n,s.game=i,s}return s(e,t),e.getButtonFrames=function(t,e){void 0===e&&(e=!1);return{1:{normal:[0,0,0,0],pushed:[1,1,1,1]},2:{normal:[1,0,1,0],pushed:[3,2,3,2]},3:{normal:[1,0,2,0],pushed:[4,3,5,3]},4:{normal:[1,0,2,3],pushed:[5,4,6,7]}}[t][e?"pushed":"normal"]},e.prototype.onClick=function(){this.config.sfx&&"none"!==this.config.sfx&&this.game.managers.audio.playSFX(this.config.sfx),this.game.gui.bindingActions[this.config.binding](this.config,this)},e}(i(9747).Button);e.default=r},812:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0?f--:(r.text.text+=d[p],r.onCharacter&&r.onCharacter(d,p),e&&(" "===d[p]||"\n"===d[p]||r.punctuationMarks.includes(d[p])||m===g?m=-1:0===m&&(e.play(),e.volume=r.game.userPreferences.get("sfxv")),m++),r.punctuationMarks.includes(d[p])&&(f=r.punctuationWait),++p>=d.length&&i())}),s),[2]}}))}))}))},e.prototype.hide=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.game.accessibility.text(),this.visible?(t||(t=this.config.transition),[4,this.game.screenEffects.transition.get(t)(this,null)]):[2];case 1:return e.sent(),this.visible=!1,[2]}}))}))},e.prototype.clear=function(t){return r(this,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return this.config.alwaysOn?[3,2]:[4,this.hide(t)];case 1:e.sent(),e.label=2;case 2:return this.text.setText("",!0),this.ctc&&(this.ctc.visible=!1),this.portrait&&(this.portrait.destroy(),this.portrait=null),[2]}}))}))},e}(h.Sprite);e.default=u},5148:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.game=t,this.container=t.add.group(),this.container.alpha=0;var e=t.config.loadingScreen;if(e.background&&(this.background=this.container.create(t.world.centerX,t.world.centerY,"loadingScreenBg"),this.background.anchor.set(.5)),e.loadingBar){var i=e.loadingBar.position;this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar"),this.loadingBar.animations.frameTotal>1&&(this.loadingBarBg=this.loadingBar,this.loadingBar=this.container.create(i.x,i.y,"loadingScreenBar",1))}e.fade?t.add.tween(this.container).to({alpha:1},500).start():this.container.alpha=1}return t.prototype.setLoadingBar=function(t){if(this.loadingBar){var e=t.config.loadingScreen.loadingBar.direction?t.config.loadingScreen.loadingBar.direction:0;t.load.setPreloadSprite(this.loadingBar,e)}},t.prototype.waitingScreen=function(){this.loadingBar&&this.game.add.tween(this.loadingBar).to({alpha:1},600,null,!0,0,-1,!0)},t.prototype.destroy=function(t){var e=this;if(t.config.loadingScreen.fade){var i=t.add.tween(this.container).to({alpha:0},500);i.onComplete.addOnce((function(){e.container.destroy()})),i.start()}else this.container.destroy()},t}();e.default=i},7898:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){function e(e,i){var n=t.call(this,e,i.x,i.y,i.asset)||this;n.game=e,n.config=i;var s=n.game.getSlotThumbnail(n.config.slot);return s&&n.loadThumbnail(s),n}return s(e,t),e.prototype.loadThumbnail=function(t){var e=this,i="thumbnail"+Math.floor(5e3*Math.random());this.game.load.image(i,t),this.game.load.onLoadComplete.addOnce((function(){var t=e.game.add.sprite(e.config.thumbnail.x,e.config.thumbnail.y,i);t.width=e.config.thumbnail.width,t.height=e.config.thumbnail.height,e.addChild(t)}),this),this.game.load.start()},e.prototype.destroy=function(){this.thumbnail.destroy(),t.prototype.destroy.call(this)},e}(i(9747).Sprite);e.default=r},3607:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Plugin=e.game=void 0;var s=n(i(8811)),r=n(i(885));e.game=s.default,e.Plugin=r.default},6041:function(t,e){"use strict";var i=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]2&&(l=parseInt(o[2],10)),this.cgs[t].animations.add(r,a,l)}n||(n={x:this.cgs[t].x,y:this.cgs[t].y}),i.zoom&&this.cgs[t].scale.set(i.zoom);var c=!1;if(void 0!==i.flipped){var u=this.cgs[t].scale.x<0;"flip"===i.flipped?(this.cgs[t].scale.x*=-1,c=!u):(c=i.flipped)!==u&&(this.cgs[t].scale.x*=-1)}return i.angle&&(this.cgs[t].angle=i.angle),this.current[t]={name:t,position:n,zoom:i.zoom,angle:i.angle,layer:i.layer,flipped:c},this.transition.get(e)(s,this.cgs[t],n)},t.prototype.animate=function(t,e){return s(this,void 0,void 0,(function(){var i,s,o=this;return r(this,(function(r){return i=e.time,s={},void 0!==e.alpha&&null!==e.alpha&&(s.alpha=e.alpha),void 0!==e.angle&&null!==e.angle&&(s.angle=e.angle),void 0!==e.position&&null!==e.position&&(s.x=e.position.x,s.y=e.position.y),void 0!==e.zoom&&null!==e.zoom&&(this.cgs[t].originalScale||(this.cgs[t].originalScale={width:this.cgs[t].width,height:this.cgs[t].height}),s.height=this.cgs[t].originalScale.height*e.zoom,s.width=this.cgs[t].originalScale.width*e.zoom),this.current[t]=n(n({},this.current[t]),e),[2,new Promise((function(n){var r=n;if(e.spritesheet){var a=function(){o.cgs[t].animations.stop(),n()};if("STOP"===e.spritesheet)o.cgs[t].frame=0,a();else{var h=e.spritesheet.split(" "),l=h[0],c=h.includes("LOOPED"),u=o.cgs[t].animations.getAnimation(l);if(h.includes("BACKWARDS")&&u.reverseOnce(),u.play(null,c),0===Object.keys(s).length)return c?i?o.game.waitTimeout(i,a.bind(o)):n():o.game.control.skipping?a():u.onComplete.addOnce(a.bind(o));r=a.bind(o)}}o.game.managers.tween.tween(o.cgs[t],s,r,i,!0)}))]}))}))},t.prototype.hide=function(t,e){return s(this,void 0,void 0,(function(){return r(this,(function(i){switch(i.label){case 0:return[4,this.transition.get(e)(this.cgs[t],null)];case 1:return i.sent(),this.cgs[t].destroy(),delete this.cgs[t],delete this.current[t],[2]}}))}))},t.prototype.isCGS=function(t){return this.game.setup.cgs&&t in this.game.setup.cgs},t}();e.default=l},878:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]1&&(n.available=this.evalExpression(s[1]),n.choiceText=s[0].trim()),e.interrupt&&(n.interrupt=!0,n.origin=e.interrupt),n},LogicManager.prototype.choose=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i;return __generator(this,(function(n){switch(n.label){case 0:return e=this.currentChoices[t],this.updateChoiceLog(e.index),this.game.storyConfig.keepStoryLog&&this.game.storyLog.push({message:e.choiceText,choice:!0}),i=e.actions,this.game.managers.story.currentScene=i.concat(this.game.managers.story.currentScene),this.showingText&&t++,this.interrupting?this.game.control.execStack.stack("interrupt",i.length,e.index,e.origin):this.game.control.execStack.stack("choice",i.length,e.index),this.game.config.debugMode&&console.log("Choice taken "+t+" : "+e.choiceText),[4,this.clearChoices()];case 1:return n.sent(),this.interrupting?this.interrupting=null:this.game.resolveAction(),[2]}}))}))},LogicManager.prototype.getExecStackId=function(){var t=this.game.control.execStack.hash();return this.choicesLog[t]||(this.choicesLog[t]=[]),t},LogicManager.prototype.checkTextAction=function(t){return __awaiter(this,void 0,void 0,(function(){var e,i,n=this;return __generator(this,(function(s){return!(e=this.game.managers.story.parseAction(__assign({},t)))||"say"!==e.actionType&&"text"!==e.actionType?[2,!1]:((i=e).dontHide=!0,[2,new Promise((function(t){i.resolve=function(e){return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(i){switch(i.label){case 0:return[4,e];case 1:return i.sent(),t(!0),[2]}}))}))},i.execute()}))])}))}))},LogicManager.prototype.showChoices=function(t,e){return __awaiter(this,void 0,void 0,(function(){var i,n,s=this;return __generator(this,(function(r){switch(r.label){case 0:return i=this,[4,this.checkTextAction(e[0])];case 1:return i.showingText=r.sent(),this.showingText&&e.shift(),this.currentChoices=e.map((function(t,e){return s.parseChoice(e,t)})),this.currentChoices=this.currentChoices.filter((function(t){return t.available})),n=-1,t||(t="default"),"visualChoices"!==t?[3,3]:[4,this.game.gui.hud.showVisualChoices(this.currentChoices)];case 2:return n=r.sent(),[3,5];case 3:return[4,this.game.gui.hud.showChoices(t,this.currentChoices)];case 4:n=r.sent(),r.label=5;case 5:return this.choose(n),[2]}}))}))},LogicManager.prototype.interrupt=function(t,e){this.interrupting={origin:this.game.control.execStack.top().c,execId:this.getExecStackId()},this.showChoices(t,e),this.game.resolveAction()},LogicManager.prototype.clearChoices=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.game.gui.hud.clear()];case 1:return t.sent(),this.currentChoices=[],this.showingText=!1,[2]}}))}))},LogicManager}();exports.default=LogicManager},7745:function(t,e,i){"use strict";var n=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.current=[],this.game=t}return t.prototype.tween=function(t,e,i,n,s,r,o){var a=this;void 0===r&&(r=0),void 0===o&&(o=!1);var h=this.game.add.tween(t);return h.to(e,n,Phaser.Easing.Linear.None,!1,r),i&&(h.onComplete.addOnce(i,this),h.callbackOnComplete=i),h.tweenables=e,s&&(this.current=[],h.start(),this.canSkip()&&!o?this.game.waitForClick((function(){return a.skip()})):(this.game.input.enabled=!1,h.onComplete.addOnce((function(){a.game.input.enabled=!0}),this))),this.current.push(h),this.game.control.skipping&&(this.game.input.enabled=!0,this.skip()),h},t.prototype.chain=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[];var s=null;t.forEach((function(e){var r=e.time?e.time:i/t.length,o=n.tween(e.sprite,e.tweenables,e.callback,r,!1,e.delay);s&&s.chain(o),s=o})),this.game.control.skipping?this.canSkip()&&!e&&this.game.waitForClick((function(){return n.skip()})):this.current[0].start()},t.prototype.parallel=function(t,e,i){var n=this;void 0===e&&(e=!1),this.current=[],t.forEach((function(t){n.tween(t.sprite,t.tweenables,t.callback,i,!0,t.delay)})),this.canSkip()||e||this.game.waitForClick((function(){return n.skip()}))},t.prototype.canSkip=function(){return this.game.storyConfig.transitions.skippable&&!this.game.control.unskippable},t.prototype.skip=function(){this.game.control.unskippable||(this.current.forEach((function(t){for(var e in t.stop(!1),t.tweenables)t.target[e]=t.tweenables[e];t.callbackOnComplete&&t.callbackOnComplete()})),this.current=[])},t}();e.default=i},4664:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){this.clearFunctions=[],this.current=[],this.game=t,this.audioManager=t.managers.audio}return t.prototype.start=function(t){this.current.push(t),this[t]?this[t]():this.game.pluginsRJS[t]&&this.game.pluginsRJS[t].onCall()},t.prototype.set=function(t){if(t)for(var e=0,i=t;e0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]=0;i--)this.game.load.text("story"+i,h.preparePath(this.game.config.storyText[i],this.game))},e.prototype.create=function(t){var e=this;new p.default(this.game).setLoadingBar(this.game),this.input.onDown.addOnce((function(){"suspended"===e.sound.context.state&&e.sound.context.resume()})),this.game.tools.jsyaml=a.default,this.game.setup=a.default.load(this.game.cache.getText("storySetup")),t.setup||(this.game.setup={}),this.game.storyConfig=a.default.load(this.game.cache.getText("storyConfig")),this.game.storyAccessibility=a.default.load(this.game.cache.getText("storyAccessibility"));var i={};this.game.config.storyText.forEach((function(t,n){var s=a.default.load(e.game.cache.getText("story"+n));Object.assign(i,r({},s))})),this.game.story=i,this.game.guiSetup=a.default.load(this.game.cache.getText("guiConfig")),"2.0"===t.guiSetup.GUIVersion||"2.0"===t.guiSetup.madeWithRenJSBuilder?t.gui=new d.default(t):t.guiSetup.madeWithRenJSBuilder?t.gui=new u.default(t):(console.error("Old GUI configuration is deprecated!!!!"),console.error("Check the docs at http://renjs.net/docs-page.html")),t.state.add("preloadStory",c.default),t.state.start("preloadStory")},e}(l.default);e.default=f},8171:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return t.call(this)||this}return s(e,t),e.prototype.init=function(){this.game.setupScreen()},e.prototype.preload=function(){for(var t in this.game.config.i18n.background&&this.game.load.image("langChooserBg",this.game.config.i18n.background),this.game.config.i18n.langs){var e=this.game.config.i18n.langs[t];this.game.load.spritesheet("languageTag"+t,e.asset,e.size.w,e.size.h)}},e.prototype.create=function(){var t=this;this.game.config.i18n.background&&this.game.add.image(0,0,"langChooserBg");var e=function(e){var n=i.game.config.i18n.langs[e];i.game.add.button(n.position.x,n.position.y,"languageTag"+e,(function(){t.game.config.i18n.current=e,localStorage.setItem("RenJS_I18N"+t.game.config.name,e),t.game.state.start("bootstrap")}),i,1,0,1,0)},i=this;for(var n in this.game.config.i18n.langs)e(n)},e}(r(i(4015)).default);e.default=o},1150:function(t,e,i){"use strict";var n,s=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},n(t,e)},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(s,r){function o(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n.throw(t))}catch(t){r(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}h((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var i,n,s,r,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;o;)try{if(i=1,n&&(s=2&r[0]?n.return:r[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,r[1])).done)return s;switch(n=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return o.label++,{value:r[1],done:!1};case 5:o.label++,n=r[1],r=[0];continue;case 7:r=o.ops.pop(),o.trys.pop();continue;default:if(!(s=o.trys,(s=s.length>0&&s[s.length-1])||6!==r[0]&&2!==r[0])){o=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]{"use strict";function i(t,e){return e.config.i18n?t.replace("LANG",e.config.i18n.current):t}function n(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}Object.defineProperty(e,"__esModule",{value:!0}),e.loadStyle=e.guid=e.preloadExtra=e.preloadCharacter=e.preloadAudio=e.preloadCGS=e.preloadBackground=e.preparePath=void 0,e.preparePath=i,e.preloadBackground=function(t,e){var n=e.setup.backgrounds[t].split(" ");1===n.length?e.load.image(t,i(n[0],e)):e.load.spritesheet(t,i(n[0],e),parseInt(n[1],10),parseInt(n[2],10))},e.preloadCGS=function(t,e){var n=e.setup.cgs[t];if("string"==typeof n)e.load.image(t,i(n,e));else{var s=n.spritesheet.split(" ");e.load.spritesheet(t,i(s[0],e),parseInt(s[1],10),parseInt(s[2],10))}},e.preloadAudio=function(t,e,n){n.load.audio(t,i(n.setup[e][t],n))},e.preloadCharacter=function(t,e){var n=e.setup.characters[t];for(var s in n.looks)e.load.image(t+"_"+s,i(n.looks[s],e));for(var r in n.portraits)e.load.image(t+"_portrait_"+r,i(n.portraits[r],e))},e.preloadExtra=function(t,e,n){if("spritesheets"===e){var s=n.setup.extra[e][t].split(" ");n.load.spritesheet(t,i(s[0],n),parseInt(s[1],10),parseInt(s[2],10))}else n.load[e](t,i(n.setup.extra[e][t],n))},e.guid=function(){return"ss".replace(/s/g,n)},e.loadStyle=function(t,e){for(var i=0,n=Array.from(document.styleSheets);i{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.range=void 0,e.range=function(t,e,i){void 0===i&&(i=1);for(var n=[t],s=t;s{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.hudSort=e.setTextStyles=e.changeInputEnabled=void 0;var n=i(3572);e.changeInputEnabled=function t(e,i){e.input&&(e.input.enabled=i);for(var n=0,s=e.children;n{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.tokenizeTextStyle=void 0;var i=/\((?:color:(?:\w+|#[0-9a-fA-F]{3}|#[0-9a-fA-F]{6})|italic|bold|end)\)/;e.tokenizeTextStyle=function(t){for(var e=[];;){var n=i.exec(t);if(!n)return e.push({text:t}),e;var s=n.index,r=n[0];e.push({text:t.substr(0,s)}),e.push({tag:r.slice(1,-1)}),t=t.substr(s+r.length)}}},4147:t=>{"use strict";t.exports=JSON.parse('{"name":"renjs","version":"2.7.2","description":"RenJS is a videogame library for making Visual Novels that run directly in the web browser","author":"lunafromthemoon","contributors":["RockDaFox","Sean S. LeBlanc"],"license":"CC-BY-SA-4.0","repository":{"type":"git","url":"git+https://github.com/lunafromthemoon/RenJS-V2.git"},"bugs":{"url":"https://github.com/lunafromthemoon/RenJS-V2/issues"},"homepage":"https://renjs.net","keywords":["engine","visual","novel","phaser"],"files":["dist"],"main":"dist/renjs.js","types":"dist/types/index.d.ts","scripts":{"start":"webpack-dev-server --config webpack.dev.js --hot --progress","build":"webpack --config webpack.prod.js","build:docs":"./scripts/build-docs.sh","build:demo":"./scripts/build-demo.sh","lint":"eslint \\"./src/**/*.{j,t}s\\"","postversion":"npm run build && npm run build:docs"},"release":{"branches":["main"],"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator","@semantic-release/changelog","@semantic-release/npm",["@semantic-release/github",{"assets":"dist/renjs.js"}],["@semantic-release/git",{"assets":["docs/**/*","dist/**/*","CHANGELOG.md","package.json","package-lock.json"]}]]},"dependencies":{"fontfaceobserver":"^2.1.0","js-yaml":"^4.1.0","object-hash":"^2.0.3","phaser-ce":"^2.16.0"},"devDependencies":{"@types/fontfaceobserver":"^2.1.0","@types/js-yaml":"^4.0.5","@typescript-eslint/eslint-plugin":"^5.5.0","@typescript-eslint/parser":"^5.5.0","bestzip":"^2.2.0","clean-webpack-plugin":"^4.0.0","copy-webpack-plugin":"^10.0.0","eslint":"^8.3.0","eslint-plugin-import":"^2.25.3","eslint-plugin-prefer-arrow":"^1.2.3","eslint-plugin-promise":"^5.2.0","eslint-plugin-standard":"^5.0.0","expose-loader":"^3.1.0","terser-webpack-plugin":"^5.2.5","ts-loader":"^9.2.6","typescript":"^3.9.7","webpack":"^5.64.4","webpack-cli":"^4.9.1","webpack-dev-server":"^4.6.0","webpack-merge":"^5.8.0"}}')}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var i=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(i.exports,i,i.exports,__webpack_require__),i.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var __webpack_exports__=__webpack_require__(3607);RenJS=__webpack_exports__})(); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 35f94d0a..f64b6191 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "renjs", - "version": "2.7.1", + "version": "2.7.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c00a10a8..a38b906a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "renjs", - "version": "2.7.1", + "version": "2.7.2", "description": "RenJS is a videogame library for making Visual Novels that run directly in the web browser", "author": "lunafromthemoon", "contributors": [