phaser/build/phaser.min.js

1 line
No EOL
281 KiB
JavaScript

var PIXI=PIXI||{};var Phaser=Phaser||{VERSION:"1.0.5",GAMES:[],AUTO:0,CANVAS:1,WEBGL:2,SPRITE:0,BUTTON:1,BULLET:2,GRAPHICS:3,TEXT:4,TILESPRITE:5,BITMAPTEXT:6,GROUP:7,RENDERTEXTURE:8,TILEMAP:9,TILEMAPLAYER:10,EMITTER:11};PIXI.InteractionManager=function(b){};Phaser.Utils={pad:function(g,b,f,c){if(typeof(b)=="undefined"){var b=0}if(typeof(f)=="undefined"){var f=" "}if(typeof(c)=="undefined"){var c=3}if(b+1>=g.length){switch(c){case 1:g=Array(b+1-g.length).join(f)+g;break;case 3:var d=Math.ceil((padlen=b-g.length)/2);var e=padlen-d;g=Array(e+1).join(f)+g+Array(d+1).join(f);break;default:g=g+Array(b+1-g.length).join(f);break}}return g},isPlainObject:function(c){if(typeof(c)!=="object"||c.nodeType||c===c.window){return false}try{if(c.constructor&&!hasOwn.call(c.constructor.prototype,"isPrototypeOf")){return false}}catch(b){return false}return true},extend:function(){var l,d,b,c,h,j,g=arguments[0]||{},f=1,e=arguments.length,k=false;if(typeof g==="boolean"){k=g;g=arguments[1]||{};f=2}if(e===f){g=this;--f}for(;f<e;f++){if((l=arguments[f])!=null){for(d in l){b=g[d];c=l[d];if(g===c){continue}if(k&&c&&(Phaser.Utils.isPlainObject(c)||(h=Array.isArray(c)))){if(h){h=false;j=b&&Array.isArray(b)?b:[]}else{j=b&&Phaser.Utils.isPlainObject(b)?b:{}}g[d]=extend(k,j,c)}else{if(c!==undefined){g[d]=c}}}}}return g}};function HEXtoRGB(b){return[(b>>16&255)/255,(b>>8&255)/255,(b&255)/255]}if(typeof Function.prototype.bind!="function"){Function.prototype.bind=(function(){var b=Array.prototype.slice;return function(c){var f=this,g=b.call(arguments,1);if(typeof f!="function"){throw new TypeError()}function d(){var h=g.concat(b.call(arguments));f.apply(this instanceof d?this:c,h)}d.prototype=(function e(h){h&&(e.prototype=h);if(!(this instanceof e)){return new e}})(f.prototype);return d}})()}function determineMatrixArrayType(){PIXI.Matrix=(typeof Float32Array!=="undefined")?Float32Array:Array;return PIXI.Matrix}determineMatrixArrayType();PIXI.mat3={};PIXI.mat3.create=function(){var b=new PIXI.Matrix(9);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};PIXI.mat3.identity=function(b){b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=1;b[5]=0;b[6]=0;b[7]=0;b[8]=1;return b};PIXI.mat4={};PIXI.mat4.create=function(){var b=new PIXI.Matrix(16);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};PIXI.mat3.multiply=function(q,h,i){if(!i){i=q}var v=q[0],u=q[1],t=q[2],g=q[3],f=q[4],e=q[5],o=q[6],n=q[7],m=q[8],l=h[0],k=h[1],j=h[2],s=h[3],r=h[4],p=h[5],d=h[6],c=h[7],b=h[8];i[0]=l*v+k*g+j*o;i[1]=l*u+k*f+j*n;i[2]=l*t+k*e+j*m;i[3]=s*v+r*g+p*o;i[4]=s*u+r*f+p*n;i[5]=s*t+r*e+p*m;i[6]=d*v+c*g+b*o;i[7]=d*u+c*f+b*n;i[8]=d*t+c*e+b*m;return i};PIXI.mat3.clone=function(c){var b=new PIXI.Matrix(9);b[0]=c[0];b[1]=c[1];b[2]=c[2];b[3]=c[3];b[4]=c[4];b[5]=c[5];b[6]=c[6];b[7]=c[7];b[8]=c[8];return b};PIXI.mat3.transpose=function(d,c){if(!c||d===c){var f=d[1],e=d[2],b=d[5];d[1]=d[3];d[2]=d[6];d[3]=f;d[5]=d[7];d[6]=e;d[7]=b;return d}c[0]=d[0];c[1]=d[3];c[2]=d[6];c[3]=d[1];c[4]=d[4];c[5]=d[7];c[6]=d[2];c[7]=d[5];c[8]=d[8];return c};PIXI.mat3.toMat4=function(c,b){if(!b){b=PIXI.mat4.create()}b[15]=1;b[14]=0;b[13]=0;b[12]=0;b[11]=0;b[10]=c[8];b[9]=c[7];b[8]=c[6];b[7]=0;b[6]=c[5];b[5]=c[4];b[4]=c[3];b[3]=0;b[2]=c[2];b[1]=c[1];b[0]=c[0];return b};PIXI.mat4.create=function(){var b=new PIXI.Matrix(16);b[0]=1;b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=1;b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};PIXI.mat4.transpose=function(e,d){if(!d||e===d){var i=e[1],g=e[2],f=e[3],b=e[6],h=e[7],c=e[11];e[1]=e[4];e[2]=e[8];e[3]=e[12];e[4]=i;e[6]=e[9];e[7]=e[13];e[8]=g;e[9]=b;e[11]=e[14];e[12]=f;e[13]=h;e[14]=c;return e}d[0]=e[0];d[1]=e[4];d[2]=e[8];d[3]=e[12];d[4]=e[1];d[5]=e[5];d[6]=e[9];d[7]=e[13];d[8]=e[2];d[9]=e[6];d[10]=e[10];d[11]=e[14];d[12]=e[3];d[13]=e[7];d[14]=e[11];d[15]=e[15];return d};PIXI.mat4.multiply=function(p,i,k){if(!k){k=p}var v=p[0],u=p[1],s=p[2],q=p[3];var h=p[4],f=p[5],d=p[6],b=p[7];var o=p[8],n=p[9],m=p[10],l=p[11];var z=p[12],w=p[13],t=p[14],r=p[15];var j=i[0],g=i[1],e=i[2],c=i[3];k[0]=j*v+g*h+e*o+c*z;k[1]=j*u+g*f+e*n+c*w;k[2]=j*s+g*d+e*m+c*t;k[3]=j*q+g*b+e*l+c*r;j=i[4];g=i[5];e=i[6];c=i[7];k[4]=j*v+g*h+e*o+c*z;k[5]=j*u+g*f+e*n+c*w;k[6]=j*s+g*d+e*m+c*t;k[7]=j*q+g*b+e*l+c*r;j=i[8];g=i[9];e=i[10];c=i[11];k[8]=j*v+g*h+e*o+c*z;k[9]=j*u+g*f+e*n+c*w;k[10]=j*s+g*d+e*m+c*t;k[11]=j*q+g*b+e*l+c*r;j=i[12];g=i[13];e=i[14];c=i[15];k[12]=j*v+g*h+e*o+c*z;k[13]=j*u+g*f+e*n+c*w;k[14]=j*s+g*d+e*m+c*t;k[15]=j*q+g*b+e*l+c*r;return k};PIXI.Point=function(b,c){this.x=b||0;this.y=c||0};PIXI.Point.prototype.clone=function(){return new PIXI.Point(this.x,this.y)};PIXI.Point.prototype.constructor=PIXI.Point;PIXI.Rectangle=function(c,e,d,b){this.x=c||0;this.y=e||0;this.width=d||0;this.height=b||0};PIXI.Rectangle.prototype.clone=function(){return new PIXI.Rectangle(this.x,this.y,this.width,this.height)};PIXI.Rectangle.prototype.contains=function(b,e){if(this.width<=0||this.height<=0){return false}var c=this.x;if(b>=c&&b<=c+this.width){var d=this.y;if(e>=d&&e<=d+this.height){return true}}return false};PIXI.Rectangle.prototype.constructor=PIXI.Rectangle;PIXI.DisplayObject=function(){this.last=this;this.first=this;this.position=new PIXI.Point();this.scale=new PIXI.Point(1,1);this.pivot=new PIXI.Point(0,0);this.rotation=0;this.alpha=1;this.visible=true;this.hitArea=null;this.buttonMode=false;this.renderable=false;this.parent=null;this.stage=null;this.worldAlpha=1;this._interactive=false;this.worldTransform=PIXI.mat3.create();this.localTransform=PIXI.mat3.create();this.color=[];this.dynamic=true;this._sr=0;this._cr=1};PIXI.DisplayObject.prototype.constructor=PIXI.DisplayObject;PIXI.DisplayObject.prototype.setInteractive=function(b){this.interactive=b};Object.defineProperty(PIXI.DisplayObject.prototype,"interactive",{get:function(){return this._interactive},set:function(b){this._interactive=b;if(this.stage){this.stage.dirty=true}}});Object.defineProperty(PIXI.DisplayObject.prototype,"mask",{get:function(){return this._mask},set:function(b){this._mask=b;if(b){this.addFilter(b)}else{this.removeFilter()}}});PIXI.DisplayObject.prototype.addFilter=function(j){if(this.filter){return}this.filter=true;var b=new PIXI.FilterBlock();var e=new PIXI.FilterBlock();b.mask=j;e.mask=j;b.first=b.last=this;e.first=e.last=this;b.open=true;var d=b;var f=b;var i;var h;h=this.first._iPrev;if(h){i=h._iNext;d._iPrev=h;h._iNext=d}else{i=this}if(i){i._iPrev=f;f._iNext=i}var d=e;var f=e;var i=null;var h=null;h=this.last;i=h._iNext;if(i){i._iPrev=f;f._iNext=i}d._iPrev=h;h._iNext=d;var c=this;var g=this.last;while(c){if(c.last==g){c.last=e}c=c.parent}this.first=b;if(this.__renderGroup){this.__renderGroup.addFilterBlocks(b,e)}j.renderable=false};PIXI.DisplayObject.prototype.removeFilter=function(){if(!this.filter){return}this.filter=false;var d=this.first;var g=d._iNext;var h=d._iPrev;if(g){g._iPrev=h}if(h){h._iNext=g}this.first=d._iNext;var e=this.last;var g=e._iNext;var h=e._iPrev;if(g){g._iPrev=h}h._iNext=g;var f=e._iPrev;var c=this;while(c.last==e){c.last=f;c=c.parent;if(!c){break}}var b=d.mask;b.renderable=true;if(this.__renderGroup){this.__renderGroup.removeFilterBlocks(d,e)}};PIXI.DisplayObject.prototype.updateTransform=function(){if(this.rotation!==this.rotationCache){this.rotationCache=this.rotation;this._sr=Math.sin(this.rotation);this._cr=Math.cos(this.rotation)}var r=this.localTransform;var f=this.parent.worldTransform;var b=this.worldTransform;r[0]=this._cr*this.scale.x;r[1]=-this._sr*this.scale.y;r[3]=this._sr*this.scale.x;r[4]=this._cr*this.scale.y;var n=this.pivot.x;var m=this.pivot.y;var i=r[0],h=r[1],g=this.position.x-r[0]*n-m*r[1],q=r[3],p=r[4],o=this.position.y-r[4]*m-n*r[3],l=f[0],k=f[1],j=f[2],e=f[3],d=f[4],c=f[5];r[2]=g;r[5]=o;b[0]=l*i+k*q;b[1]=l*h+k*p;b[2]=l*g+k*o+j;b[3]=e*i+d*q;b[4]=e*h+d*p;b[5]=e*g+d*o+c;this.worldAlpha=this.alpha*this.parent.worldAlpha;this.vcount=PIXI.visibleCount};PIXI.visibleCount=0;PIXI.DisplayObjectContainer=function(){PIXI.DisplayObject.call(this);this.children=[]};PIXI.DisplayObjectContainer.prototype=Object.create(PIXI.DisplayObject.prototype);PIXI.DisplayObjectContainer.prototype.constructor=PIXI.DisplayObjectContainer;PIXI.DisplayObjectContainer.prototype.addChild=function(i){if(i.parent!=undefined){i.parent.removeChild(i)}i.parent=this;this.children.push(i);if(this.stage){var f=i;do{if(f.interactive){this.stage.dirty=true}f.stage=this.stage;f=f._iNext}while(f)}var e=i.first;var d=i.last;var g;var h;if(this.filter){h=this.last._iPrev}else{h=this.last}g=h._iNext;var c=this;var b=h;while(c){if(c.last==b){c.last=i.last}c=c.parent}if(g){g._iPrev=d;d._iNext=g}e._iPrev=h;h._iNext=e;if(this.__renderGroup){if(i.__renderGroup){i.__renderGroup.removeDisplayObjectAndChildren(i)}this.__renderGroup.addDisplayObjectAndChildren(i)}};PIXI.DisplayObjectContainer.prototype.addChildAt=function(c,f){if(f>=0&&f<=this.children.length){if(c.parent!=undefined){c.parent.removeChild(c)}c.parent=this;if(this.stage){var e=c;do{if(e.interactive){this.stage.dirty=true}e.stage=this.stage;e=e._iNext}while(e)}var d=c.first;var g=c.last;var j;var i;if(f==this.children.length){i=this.last;var b=this;var h=this.last;while(b){if(b.last==h){b.last=c.last}b=b.parent}}else{if(f==0){i=this}else{i=this.children[f-1].last}}j=i._iNext;if(j){j._iPrev=g;g._iNext=j}d._iPrev=i;i._iNext=d;this.children.splice(f,0,c);if(this.__renderGroup){if(c.__renderGroup){c.__renderGroup.removeDisplayObjectAndChildren(c)}this.__renderGroup.addDisplayObjectAndChildren(c)}}else{throw new Error(c+" The index "+f+" supplied is out of bounds "+this.children.length)}};PIXI.DisplayObjectContainer.prototype.swapChildren=function(c,b){return};PIXI.DisplayObjectContainer.prototype.getChildAt=function(b){if(b>=0&&b<this.children.length){return this.children[b]}else{throw new Error(child+" Both the supplied DisplayObjects must be a child of the caller "+this)}};PIXI.DisplayObjectContainer.prototype.removeChild=function(c){var f=this.children.indexOf(c);if(f!==-1){var d=c.first;var g=c.last;var i=g._iNext;var h=d._iPrev;if(i){i._iPrev=h}h._iNext=i;if(this.last==g){var j=d._iPrev;var b=this;while(b.last==g.last){b.last=j;b=b.parent;if(!b){break}}}g._iNext=null;d._iPrev=null;if(this.stage){var e=c;do{if(e.interactive){this.stage.dirty=true}e.stage=null;e=e._iNext}while(e)}if(c.__renderGroup){c.__renderGroup.removeDisplayObjectAndChildren(c)}c.parent=undefined;this.children.splice(f,1)}else{throw new Error(c+" The supplied DisplayObject must be a child of the caller "+this)}};PIXI.DisplayObjectContainer.prototype.updateTransform=function(){if(!this.visible){return}PIXI.DisplayObject.prototype.updateTransform.call(this);for(var c=0,b=this.children.length;c<b;c++){this.children[c].updateTransform()}};PIXI.blendModes={};PIXI.blendModes.NORMAL=0;PIXI.blendModes.SCREEN=1;PIXI.Sprite=function(b){PIXI.DisplayObjectContainer.call(this);this.anchor=new PIXI.Point();this.texture=b;this.blendMode=PIXI.blendModes.NORMAL;this._width=0;this._height=0;if(b.baseTexture.hasLoaded){this.updateFrame=true}else{this.onTextureUpdateBind=this.onTextureUpdate.bind(this);this.texture.addEventListener("update",this.onTextureUpdateBind)}this.renderable=true};PIXI.Sprite.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Sprite.prototype.constructor=PIXI.Sprite;Object.defineProperty(PIXI.Sprite.prototype,"width",{get:function(){return this.scale.x*this.texture.frame.width},set:function(b){this.scale.x=b/this.texture.frame.width;this._width=b}});Object.defineProperty(PIXI.Sprite.prototype,"height",{get:function(){return this.scale.y*this.texture.frame.height},set:function(b){this.scale.y=b/this.texture.frame.height;this._height=b}});PIXI.Sprite.prototype.setTexture=function(b){if(this.texture.baseTexture!=b.baseTexture){this.textureChange=true;this.texture=b;if(this.__renderGroup){this.__renderGroup.updateTexture(this)}}else{this.texture=b}this.updateFrame=true};PIXI.Sprite.prototype.onTextureUpdate=function(b){if(this._width){this.scale.x=this._width/this.texture.frame.width}if(this._height){this.scale.y=this._height/this.texture.frame.height}this.updateFrame=true};PIXI.Sprite.fromFrame=function(c){var b=PIXI.TextureCache[c];if(!b){throw new Error("The frameId '"+c+"' does not exist in the texture cache"+this)}return new PIXI.Sprite(b)};PIXI.Sprite.fromImage=function(b){var c=PIXI.Texture.fromImage(b);return new PIXI.Sprite(c)};PIXI.Stage=function(c,b){PIXI.DisplayObjectContainer.call(this);this.worldTransform=PIXI.mat3.create();this.interactive=b;this.interactionManager=new PIXI.InteractionManager(this);this.dirty=true;this.__childrenAdded=[];this.__childrenRemoved=[];this.stage=this;this.stage.hitArea=new PIXI.Rectangle(0,0,100000,100000);this.setBackgroundColor(c);this.worldVisible=true};PIXI.Stage.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Stage.prototype.constructor=PIXI.Stage;PIXI.Stage.prototype.updateTransform=function(){this.worldAlpha=1;this.vcount=PIXI.visibleCount;for(var c=0,b=this.children.length;c<b;c++){this.children[c].updateTransform()}if(this.dirty){this.dirty=false;this.interactionManager.dirty=true}if(this.interactive){this.interactionManager.update()}};PIXI.Stage.prototype.setBackgroundColor=function(b){this.backgroundColor=b||0;this.backgroundColorSplit=HEXtoRGB(this.backgroundColor);var c=this.backgroundColor.toString(16);c="000000".substr(0,6-c.length)+c;this.backgroundColorString="#"+c};PIXI.Stage.prototype.getMousePosition=function(){return this.interactionManager.mouse.global};PIXI.CustomRenderable=function(){PIXI.DisplayObject.call(this)};PIXI.CustomRenderable.prototype=Object.create(PIXI.DisplayObject.prototype);PIXI.CustomRenderable.prototype.constructor=PIXI.CustomRenderable;PIXI.CustomRenderable.prototype.renderCanvas=function(b){};PIXI.CustomRenderable.prototype.initWebGL=function(b){};PIXI.CustomRenderable.prototype.renderWebGL=function(c,b){};PIXI.Strip=function(e,d,b){PIXI.DisplayObjectContainer.call(this);this.texture=e;this.blendMode=PIXI.blendModes.NORMAL;try{this.uvs=new Float32Array([0,1,1,1,1,0,0,1]);this.verticies=new Float32Array([0,0,0,0,0,0,0,0,0]);this.colors=new Float32Array([1,1,1,1]);this.indices=new Uint16Array([0,1,2,3])}catch(c){this.uvs=[0,1,1,1,1,0,0,1];this.verticies=[0,0,0,0,0,0,0,0,0];this.colors=[1,1,1,1];this.indices=[0,1,2,3]}this.width=d;this.height=b;if(e.baseTexture.hasLoaded){this.width=this.texture.frame.width;this.height=this.texture.frame.height;this.updateFrame=true}else{this.onTextureUpdateBind=this.onTextureUpdate.bind(this);this.texture.addEventListener("update",this.onTextureUpdateBind)}this.renderable=true};PIXI.Strip.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Strip.prototype.constructor=PIXI.Strip;PIXI.Strip.prototype.setTexture=function(b){this.texture=b;this.width=b.frame.width;this.height=b.frame.height;this.updateFrame=true};PIXI.Strip.prototype.onTextureUpdate=function(b){this.updateFrame=true};PIXI.Rope=function(d,c){PIXI.Strip.call(this,d);this.points=c;try{this.verticies=new Float32Array(c.length*4);this.uvs=new Float32Array(c.length*4);this.colors=new Float32Array(c.length*2);this.indices=new Uint16Array(c.length*2)}catch(b){this.verticies=verticies;this.uvs=uvs;this.colors=colors;this.indices=indices}this.refresh()};PIXI.Rope.prototype=Object.create(PIXI.Strip.prototype);PIXI.Rope.prototype.constructor=PIXI.Rope;PIXI.Rope.prototype.refresh=function(){var m=this.points;if(m.length<1){return}var d=this.uvs;var n=this.indices;var b=this.colors;var k=m[0];var j;var c={x:0,y:0};var l=m[0];this.count-=0.2;d[0]=0;d[1]=1;d[2]=0;d[3]=1;b[0]=1;b[1]=1;n[0]=0;n[1]=1;var h=m.length;for(var e=1;e<h;e++){var l=m[e];var g=e*4;var f=e/(h-1);if(e%2){d[g]=f;d[g+1]=0;d[g+2]=f;d[g+3]=1}else{d[g]=f;d[g+1]=0;d[g+2]=f;d[g+3]=1}g=e*2;b[g]=1;b[g+1]=1;g=e*2;n[g]=g;n[g+1]=g+1;k=l}};PIXI.Rope.prototype.updateTransform=function(){var n=this.points;if(n.length<1){return}var b=this.verticies;var l=n[0];var j;var c={x:0,y:0};var m=n[0];this.count-=0.2;b[0]=m.x+c.x;b[1]=m.y+c.y;b[2]=m.x-c.x;b[3]=m.y-c.y;var k=n.length;for(var e=1;e<k;e++){var m=n[e];var g=e*4;if(e<n.length-1){j=n[e+1]}else{j=m}c.y=-(j.x-l.x);c.x=j.y-l.y;var h=(1-(e/(k-1)))*10;if(h>1){h=1}var d=Math.sqrt(c.x*c.x+c.y*c.y);var f=this.texture.height/2;c.x/=d;c.y/=d;c.x*=f;c.y*=f;b[g]=m.x+c.x;b[g+1]=m.y+c.y;b[g+2]=m.x-c.x;b[g+3]=m.y-c.y;l=m}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.Rope.prototype.setTexture=function(b){this.texture=b;this.updateFrame=true};PIXI.TilingSprite=function(d,c,b){PIXI.DisplayObjectContainer.call(this);this.texture=d;this.width=c;this.height=b;this.tileScale=new PIXI.Point(1,1);this.tilePosition=new PIXI.Point(0,0);this.renderable=true;this.blendMode=PIXI.blendModes.NORMAL};PIXI.TilingSprite.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.TilingSprite.prototype.constructor=PIXI.TilingSprite;PIXI.TilingSprite.prototype.setTexture=function(b){this.texture=b;this.updateFrame=true};PIXI.TilingSprite.prototype.onTextureUpdate=function(b){this.updateFrame=true};PIXI.FilterBlock=function(b){this.graphics=b;this.visible=true;this.renderable=true};PIXI.MaskFilter=function(b){this.graphics};PIXI.Graphics=function(){PIXI.DisplayObjectContainer.call(this);this.renderable=true;this.fillAlpha=1;this.lineWidth=0;this.lineColor="black";this.graphicsData=[];this.currentPath={points:[]}};PIXI.Graphics.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.Graphics.prototype.constructor=PIXI.Graphics;PIXI.Graphics.prototype.lineStyle=function(b,c,d){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.lineWidth=b||0;this.lineColor=c||0;this.lineAlpha=(d==undefined)?1:d;this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[],type:PIXI.Graphics.POLY};this.graphicsData.push(this.currentPath)};PIXI.Graphics.prototype.moveTo=function(b,c){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath=this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[],type:PIXI.Graphics.POLY};this.currentPath.points.push(b,c);this.graphicsData.push(this.currentPath)};PIXI.Graphics.prototype.lineTo=function(b,c){this.currentPath.points.push(b,c);this.dirty=true};PIXI.Graphics.prototype.beginFill=function(b,c){this.filling=true;this.fillColor=b||0;this.fillAlpha=(c==undefined)?1:c};PIXI.Graphics.prototype.endFill=function(){this.filling=false;this.fillColor=null;this.fillAlpha=1};PIXI.Graphics.prototype.drawRect=function(c,e,d,b){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[c,e,d,b],type:PIXI.Graphics.RECT};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.drawCircle=function(c,d,b){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[c,d,b,b],type:PIXI.Graphics.CIRC};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.drawElipse=function(c,e,d,b){if(this.currentPath.points.length==0){this.graphicsData.pop()}this.currentPath={lineWidth:this.lineWidth,lineColor:this.lineColor,lineAlpha:this.lineAlpha,fillColor:this.fillColor,fillAlpha:this.fillAlpha,fill:this.filling,points:[c,e,d,b],type:PIXI.Graphics.ELIP};this.graphicsData.push(this.currentPath);this.dirty=true};PIXI.Graphics.prototype.clear=function(){this.lineWidth=0;this.filling=false;this.dirty=true;this.clearDirty=true;this.graphicsData=[]};PIXI.Graphics.POLY=0;PIXI.Graphics.RECT=1;PIXI.Graphics.CIRC=2;PIXI.Graphics.ELIP=3;PIXI.CanvasGraphics=function(){};PIXI.CanvasGraphics.renderGraphics=function(u,c){var p=u.worldAlpha;for(var s=0;s<u.graphicsData.length;s++){var z=u.graphicsData[s];var r=z.points;c.strokeStyle=color="#"+("00000"+(z.lineColor|0).toString(16)).substr(-6);c.lineWidth=z.lineWidth;if(z.type==PIXI.Graphics.POLY){c.beginPath();c.moveTo(r[0],r[1]);for(var q=1;q<r.length/2;q++){c.lineTo(r[q*2],r[q*2+1])}if(r[0]==r[r.length-2]&&r[1]==r[r.length-1]){c.closePath()}if(z.fill){c.globalAlpha=z.fillAlpha*p;c.fillStyle=color="#"+("00000"+(z.fillColor|0).toString(16)).substr(-6);c.fill()}if(z.lineWidth){c.globalAlpha=z.lineAlpha*p;c.stroke()}}else{if(z.type==PIXI.Graphics.RECT){if(z.fillColor){c.globalAlpha=z.fillAlpha*p;c.fillStyle=color="#"+("00000"+(z.fillColor|0).toString(16)).substr(-6);c.fillRect(r[0],r[1],r[2],r[3])}if(z.lineWidth){c.globalAlpha=z.lineAlpha*p;c.strokeRect(r[0],r[1],r[2],r[3])}}else{if(z.type==PIXI.Graphics.CIRC){c.beginPath();c.arc(r[0],r[1],r[2],0,2*Math.PI);c.closePath();if(z.fill){c.globalAlpha=z.fillAlpha*p;c.fillStyle=color="#"+("00000"+(z.fillColor|0).toString(16)).substr(-6);c.fill()}if(z.lineWidth){c.globalAlpha=z.lineAlpha*p;c.stroke()}}else{if(z.type==PIXI.Graphics.ELIP){var d=z.points;var l=d[2]*2;var t=d[3]*2;var k=d[0]-l/2;var g=d[1]-t/2;c.beginPath();var m=0.5522848,f=(l/2)*m,e=(t/2)*m,o=k+l,b=g+t,n=k+l/2,v=g+t/2;c.moveTo(k,v);c.bezierCurveTo(k,v-e,n-f,g,n,g);c.bezierCurveTo(n+f,g,o,v-e,o,v);c.bezierCurveTo(o,v+e,n+f,b,n,b);c.bezierCurveTo(n-f,b,k,v+e,k,v);c.closePath();if(z.fill){c.globalAlpha=z.fillAlpha*p;c.fillStyle=color="#"+("00000"+(z.fillColor|0).toString(16)).substr(-6);c.fill()}if(z.lineWidth){c.globalAlpha=z.lineAlpha*p;c.stroke()}}}}}}};PIXI.CanvasGraphics.renderGraphicsMask=function(v,c){var p=v.worldAlpha;var t=v.graphicsData.length;if(t>1){t=1;console.log("Pixi.js warning: masks in canvas can only mask using the first path in the graphics object")}for(var s=0;s<1;s++){var A=v.graphicsData[s];var r=A.points;if(A.type==PIXI.Graphics.POLY){c.beginPath();c.moveTo(r[0],r[1]);for(var q=1;q<r.length/2;q++){c.lineTo(r[q*2],r[q*2+1])}if(r[0]==r[r.length-2]&&r[1]==r[r.length-1]){c.closePath()}}else{if(A.type==PIXI.Graphics.RECT){c.beginPath();c.rect(r[0],r[1],r[2],r[3]);c.closePath()}else{if(A.type==PIXI.Graphics.CIRC){c.beginPath();c.arc(r[0],r[1],r[2],0,2*Math.PI);c.closePath()}else{if(A.type==PIXI.Graphics.ELIP){var d=A.points;var l=d[2]*2;var u=d[3]*2;var k=d[0]-l/2;var g=d[1]-u/2;c.beginPath();var m=0.5522848,f=(l/2)*m,e=(u/2)*m,o=k+l,b=g+u,n=k+l/2,z=g+u/2;c.moveTo(k,z);c.bezierCurveTo(k,z-e,n-f,g,n,g);c.bezierCurveTo(n+f,g,o,z-e,o,z);c.bezierCurveTo(o,z+e,n+f,b,n,b);c.bezierCurveTo(n-f,b,k,z+e,k,z);c.closePath()}}}}}};PIXI.CanvasRenderer=function(d,b,c,e){this.transparent=e;this.width=d||800;this.height=b||600;this.view=c||document.createElement("canvas");this.context=this.view.getContext("2d");this.refresh=true;this.view.width=this.width;this.view.height=this.height;this.count=0};PIXI.CanvasRenderer.prototype.constructor=PIXI.CanvasRenderer;PIXI.CanvasRenderer.prototype.render=function(b){PIXI.texturesToUpdate=[];PIXI.texturesToDestroy=[];PIXI.visibleCount++;b.updateTransform();if(this.view.style.backgroundColor!=b.backgroundColorString&&!this.transparent){this.view.style.backgroundColor=b.backgroundColorString}this.context.setTransform(1,0,0,1,0,0);this.context.clearRect(0,0,this.width,this.height);this.renderDisplayObject(b);if(b.interactive){if(!b._interactiveEventsAdded){b._interactiveEventsAdded=true;b.interactionManager.setTarget(this)}}if(PIXI.Texture.frameUpdates.length>0){PIXI.Texture.frameUpdates=[]}};PIXI.CanvasRenderer.prototype.resize=function(c,b){this.width=c;this.height=b;this.view.width=c;this.view.height=b};PIXI.CanvasRenderer.prototype.renderDisplayObject=function(h){var e;var f=this.context;f.globalCompositeOperation="source-over";var d=h.last._iNext;h=h.first;do{e=h.worldTransform;if(!h.visible){h=h.last._iNext;continue}if(!h.renderable){h=h._iNext;continue}if(h instanceof PIXI.Sprite){var g=h.texture.frame;if(g){f.globalAlpha=h.worldAlpha;f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);f.drawImage(h.texture.baseTexture.source,g.x,g.y,g.width,g.height,(h.anchor.x)*-g.width,(h.anchor.y)*-g.height,g.width,g.height)}}else{if(h instanceof PIXI.Strip){f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);this.renderStrip(h)}else{if(h instanceof PIXI.TilingSprite){f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);this.renderTilingSprite(h)}else{if(h instanceof PIXI.CustomRenderable){h.renderCanvas(this)}else{if(h instanceof PIXI.Graphics){f.setTransform(e[0],e[3],e[1],e[4],e[2],e[5]);PIXI.CanvasGraphics.renderGraphics(h,f)}else{if(h instanceof PIXI.FilterBlock){if(h.open){f.save();var c=h.mask.alpha;var b=h.mask.worldTransform;f.setTransform(b[0],b[3],b[1],b[4],b[2],b[5]);h.mask.worldAlpha=0.5;f.worldAlpha=0;PIXI.CanvasGraphics.renderGraphicsMask(h.mask,f);f.clip();h.mask.worldAlpha=c}else{f.restore()}}}}}}}h=h._iNext}while(h!=d)};PIXI.CanvasRenderer.prototype.renderStripFlat=function(d){var e=this.context;var f=d.verticies;var j=d.uvs;var g=f.length/2;this.count++;e.beginPath();for(var k=1;k<g-2;k++){var l=k*2;var h=f[l],c=f[l+2],b=f[l+4];var o=f[l+1],n=f[l+3],m=f[l+5];e.moveTo(h,o);e.lineTo(c,n);e.lineTo(b,m)}e.fillStyle="#FF0000";e.fill();e.closePath()};PIXI.CanvasRenderer.prototype.renderTilingSprite=function(e){var d=this.context;d.globalAlpha=e.worldAlpha;if(!e.__tilePattern){e.__tilePattern=d.createPattern(e.texture.baseTexture.source,"repeat")}d.beginPath();var b=e.tilePosition;var c=e.tileScale;d.scale(c.x,c.y);d.translate(b.x,b.y);d.fillStyle=e.__tilePattern;d.fillRect(-b.x,-b.y,e.width/c.x,e.height/c.y);d.scale(1/c.x,1/c.y);d.translate(-b.x,-b.y);d.closePath()};PIXI.CanvasRenderer.prototype.renderStrip=function(t){var f=this.context;var e=t.verticies;var s=t.uvs;var n=e.length/2;this.count++;for(var u=1;u<n-2;u++){var r=u*2;var C=e[r],B=e[r+2],z=e[r+4];var l=e[r+1],j=e[r+3],d=e[r+5];var A=s[r]*t.texture.width,w=s[r+2]*t.texture.width,v=s[r+4]*t.texture.width;var h=s[r+1]*t.texture.height,c=s[r+3]*t.texture.height,b=s[r+5]*t.texture.height;f.save();f.beginPath();f.moveTo(C,l);f.lineTo(B,j);f.lineTo(z,d);f.closePath();f.clip();var D=A*c+h*v+w*b-c*v-h*w-A*b;var q=C*c+h*z+B*b-c*z-h*B-C*b;var p=A*B+C*v+w*z-B*v-C*w-A*z;var o=A*c*z+h*B*v+C*w*b-C*c*v-h*w*z-A*B*b;var m=l*c+h*d+j*b-c*d-h*j-l*b;var k=A*j+l*v+w*d-j*v-l*w-A*d;var g=A*c*d+h*j*v+l*w*b-l*c*v-h*w*d-A*j*b;f.transform(q/D,m/D,p/D,k/D,o/D,g/D);f.drawImage(t.texture.baseTexture.source,0,0);f.restore()}};PIXI._batchs=[];PIXI._getBatch=function(b){if(PIXI._batchs.length==0){return new PIXI.WebGLBatch(b)}else{return PIXI._batchs.pop()}};PIXI._returnBatch=function(b){b.clean();PIXI._batchs.push(b)};PIXI._restoreBatchs=function(c){for(var b=0;b<PIXI._batchs.length;b++){PIXI._batchs[b].restoreLostContext(c)}};PIXI.WebGLBatch=function(b){this.gl=b;this.size=0;this.vertexBuffer=b.createBuffer();this.indexBuffer=b.createBuffer();this.uvBuffer=b.createBuffer();this.colorBuffer=b.createBuffer();this.blendMode=PIXI.blendModes.NORMAL;this.dynamicSize=1};PIXI.WebGLBatch.prototype.constructor=PIXI.WebGLBatch;PIXI.WebGLBatch.prototype.clean=function(){this.verticies=[];this.uvs=[];this.indices=[];this.colors=[];this.dynamicSize=1;this.texture=null;this.last=null;this.size=0;this.head;this.tail};PIXI.WebGLBatch.prototype.restoreLostContext=function(b){this.gl=b;this.vertexBuffer=b.createBuffer();this.indexBuffer=b.createBuffer();this.uvBuffer=b.createBuffer();this.colorBuffer=b.createBuffer()};PIXI.WebGLBatch.prototype.init=function(b){b.batch=this;this.dirty=true;this.blendMode=b.blendMode;this.texture=b.texture.baseTexture;this.head=b;this.tail=b;this.size=1;this.growBatch()};PIXI.WebGLBatch.prototype.insertBefore=function(b,d){this.size++;b.batch=this;this.dirty=true;var c=d.__prev;d.__prev=b;b.__next=d;if(c){b.__prev=c;c.__next=b}else{this.head=b}};PIXI.WebGLBatch.prototype.insertAfter=function(c,b){this.size++;c.batch=this;this.dirty=true;var d=b.__next;b.__next=c;c.__prev=b;if(d){c.__next=d;d.__prev=c}else{this.tail=c}};PIXI.WebGLBatch.prototype.remove=function(b){this.size--;if(this.size==0){b.batch=null;b.__prev=null;b.__next=null;return}if(b.__prev){b.__prev.__next=b.__next}else{this.head=b.__next;this.head.__prev=null}if(b.__next){b.__next.__prev=b.__prev}else{this.tail=b.__prev;this.tail.__next=null}b.batch=null;b.__next=null;b.__prev=null;this.dirty=true};PIXI.WebGLBatch.prototype.split=function(c){this.dirty=true;var b=new PIXI.WebGLBatch(this.gl);b.init(c);b.texture=this.texture;b.tail=this.tail;this.tail=c.__prev;this.tail.__next=null;c.__prev=null;var d=0;while(c){d++;c.batch=b;c=c.__next}b.size=d;this.size-=d;return b};PIXI.WebGLBatch.prototype.merge=function(b){this.dirty=true;this.tail.__next=b.head;b.head.__prev=this.tail;this.size+=b.size;this.tail=b.tail;var c=b.head;while(c){c.batch=this;c=c.__next}};PIXI.WebGLBatch.prototype.growBatch=function(){var f=this.gl;if(this.size==1){this.dynamicSize=1}else{this.dynamicSize=this.size*1.5}this.verticies=new Float32Array(this.dynamicSize*8);f.bindBuffer(f.ARRAY_BUFFER,this.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,this.verticies,f.DYNAMIC_DRAW);this.uvs=new Float32Array(this.dynamicSize*8);f.bindBuffer(f.ARRAY_BUFFER,this.uvBuffer);f.bufferData(f.ARRAY_BUFFER,this.uvs,f.DYNAMIC_DRAW);this.dirtyUVS=true;this.colors=new Float32Array(this.dynamicSize*4);f.bindBuffer(f.ARRAY_BUFFER,this.colorBuffer);f.bufferData(f.ARRAY_BUFFER,this.colors,f.DYNAMIC_DRAW);this.dirtyColors=true;this.indices=new Uint16Array(this.dynamicSize*6);var c=this.indices.length/6;for(var b=0;b<c;b++){var e=b*6;var d=b*4;this.indices[e+0]=d+0;this.indices[e+1]=d+1;this.indices[e+2]=d+2;this.indices[e+3]=d+0;this.indices[e+4]=d+2;this.indices[e+5]=d+3}f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,this.indexBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,this.indices,f.STATIC_DRAW)};PIXI.WebGLBatch.prototype.refresh=function(){var t=this.gl;if(this.dynamicSize<this.size){this.growBatch()}var o=0;var s,r,q,f,e,l,k,j,i,h;var A,z,v,u,B,w;var p=this.head;while(p){h=o*8;var n=p.texture;var m=n.frame;var C=n.baseTexture.width;var g=n.baseTexture.height;this.uvs[h+0]=m.x/C;this.uvs[h+1]=m.y/g;this.uvs[h+2]=(m.x+m.width)/C;this.uvs[h+3]=m.y/g;this.uvs[h+4]=(m.x+m.width)/C;this.uvs[h+5]=(m.y+m.height)/g;this.uvs[h+6]=m.x/C;this.uvs[h+7]=(m.y+m.height)/g;p.updateFrame=false;colorIndex=o*4;this.colors[colorIndex]=this.colors[colorIndex+1]=this.colors[colorIndex+2]=this.colors[colorIndex+3]=p.worldAlpha;p=p.__next;o++}this.dirtyUVS=true;this.dirtyColors=true};PIXI.WebGLBatch.prototype.update=function(){var w=this.gl;var v,u,t,f,e,o,n,m,l,k,j,h;var E,C,A,z,D,B;var r=0;var s=this.head;while(s){if(s.vcount===PIXI.visibleCount){u=s.texture.frame.width;t=s.texture.frame.height;f=s.anchor.x;e=s.anchor.y;o=u*(1-f);n=u*-f;m=t*(1-e);l=t*-e;k=r*8;v=s.worldTransform;E=v[0];C=v[3];A=v[1];z=v[4];D=v[2];B=v[5];this.verticies[k+0]=E*n+A*l+D;this.verticies[k+1]=z*l+C*n+B;this.verticies[k+2]=E*o+A*l+D;this.verticies[k+3]=z*l+C*o+B;this.verticies[k+4]=E*o+A*m+D;this.verticies[k+5]=z*m+C*o+B;this.verticies[k+6]=E*n+A*m+D;this.verticies[k+7]=z*m+C*n+B;if(s.updateFrame||s.texture.updateFrame){this.dirtyUVS=true;var q=s.texture;var p=q.frame;var F=q.baseTexture.width;var i=q.baseTexture.height;this.uvs[k+0]=p.x/F;this.uvs[k+1]=p.y/i;this.uvs[k+2]=(p.x+p.width)/F;this.uvs[k+3]=p.y/i;this.uvs[k+4]=(p.x+p.width)/F;this.uvs[k+5]=(p.y+p.height)/i;this.uvs[k+6]=p.x/F;this.uvs[k+7]=(p.y+p.height)/i;s.updateFrame=false}if(s.cacheAlpha!=s.worldAlpha){s.cacheAlpha=s.worldAlpha;var g=r*4;this.colors[g]=this.colors[g+1]=this.colors[g+2]=this.colors[g+3]=s.worldAlpha;this.dirtyColors=true}}else{k=r*8;this.verticies[k+0]=0;this.verticies[k+1]=0;this.verticies[k+2]=0;this.verticies[k+3]=0;this.verticies[k+4]=0;this.verticies[k+5]=0;this.verticies[k+6]=0;this.verticies[k+7]=0}r++;s=s.__next}};PIXI.WebGLBatch.prototype.render=function(f,c){f=f||0;if(c==undefined){c=this.size}if(this.dirty){this.refresh();this.dirty=false}if(this.size==0){return}this.update();var d=this.gl;var e=PIXI.shaderProgram;d.useProgram(e);d.bindBuffer(d.ARRAY_BUFFER,this.vertexBuffer);d.bufferSubData(d.ARRAY_BUFFER,0,this.verticies);d.vertexAttribPointer(e.vertexPositionAttribute,2,d.FLOAT,false,0,0);d.bindBuffer(d.ARRAY_BUFFER,this.uvBuffer);if(this.dirtyUVS){this.dirtyUVS=false;d.bufferSubData(d.ARRAY_BUFFER,0,this.uvs)}d.vertexAttribPointer(e.textureCoordAttribute,2,d.FLOAT,false,0,0);d.activeTexture(d.TEXTURE0);d.bindTexture(d.TEXTURE_2D,this.texture._glTexture);d.bindBuffer(d.ARRAY_BUFFER,this.colorBuffer);if(this.dirtyColors){this.dirtyColors=false;d.bufferSubData(d.ARRAY_BUFFER,0,this.colors)}d.vertexAttribPointer(e.colorAttribute,1,d.FLOAT,false,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,this.indexBuffer);var b=c-f;d.drawElements(d.TRIANGLES,b*6,d.UNSIGNED_SHORT,f*2*6)};PIXI.WebGLGraphics=function(){};PIXI.WebGLGraphics.renderGraphics=function(d,c){var e=PIXI.gl;if(!d._webGL){d._webGL={points:[],indices:[],lastIndex:0,buffer:e.createBuffer(),indexBuffer:e.createBuffer()}}if(d.dirty){d.dirty=false;if(d.clearDirty){d.clearDirty=false;d._webGL.lastIndex=0;d._webGL.points=[];d._webGL.indices=[]}PIXI.WebGLGraphics.updateGraphics(d)}PIXI.activatePrimitiveShader();var b=PIXI.mat3.clone(d.worldTransform);PIXI.mat3.transpose(b);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.uniformMatrix3fv(PIXI.primitiveProgram.translationMatrix,false,b);e.uniform2f(PIXI.primitiveProgram.projectionVector,c.x,c.y);e.uniform1f(PIXI.primitiveProgram.alpha,d.worldAlpha);e.bindBuffer(e.ARRAY_BUFFER,d._webGL.buffer);e.vertexAttribPointer(PIXI.shaderProgram.vertexPositionAttribute,2,e.FLOAT,false,0,0);e.vertexAttribPointer(PIXI.primitiveProgram.vertexPositionAttribute,2,e.FLOAT,false,4*6,0);e.vertexAttribPointer(PIXI.primitiveProgram.colorAttribute,4,e.FLOAT,false,4*6,2*4);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,d._webGL.indexBuffer);e.drawElements(e.TRIANGLE_STRIP,d._webGL.indices.length,e.UNSIGNED_SHORT,0);PIXI.activateDefaultShader()};PIXI.WebGLGraphics.updateGraphics=function(b){for(var c=b._webGL.lastIndex;c<b.graphicsData.length;c++){var d=b.graphicsData[c];if(d.type==PIXI.Graphics.POLY){if(d.fill){if(d.points.length>3){PIXI.WebGLGraphics.buildPoly(d,b._webGL)}}if(d.lineWidth>0){PIXI.WebGLGraphics.buildLine(d,b._webGL)}}else{if(d.type==PIXI.Graphics.RECT){PIXI.WebGLGraphics.buildRectangle(d,b._webGL)}else{if(d.type==PIXI.Graphics.CIRC||d.type==PIXI.Graphics.ELIP){PIXI.WebGLGraphics.buildCircle(d,b._webGL)}}}}b._webGL.lastIndex=b.graphicsData.length;var e=PIXI.gl;b._webGL.glPoints=new Float32Array(b._webGL.points);e.bindBuffer(e.ARRAY_BUFFER,b._webGL.buffer);e.bufferData(e.ARRAY_BUFFER,b._webGL.glPoints,e.STATIC_DRAW);b._webGL.glIndicies=new Uint16Array(b._webGL.indices);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b._webGL.indexBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,b._webGL.glIndicies,e.STATIC_DRAW)};PIXI.WebGLGraphics.buildRectangle=function(s,i){var f=s.points;var n=f[0];var m=f[1];var d=f[2];var q=f[3];if(s.fill){var h=HEXtoRGB(s.fillColor);var e=s.fillAlpha;var c=h[0]*e;var j=h[1]*e;var l=h[2]*e;var o=i.points;var p=i.indices;var k=o.length/6;o.push(n,m);o.push(c,j,l,e);o.push(n+d,m);o.push(c,j,l,e);o.push(n,m+q);o.push(c,j,l,e);o.push(n+d,m+q);o.push(c,j,l,e);p.push(k,k,k+1,k+2,k+3,k+3)}if(s.lineWidth){s.points=[n,m,n+d,m,n+d,m+q,n,m+q,n,m];PIXI.WebGLGraphics.buildLine(s,i)}};PIXI.WebGLGraphics.buildCircle=function(k,w){var f=k.points;var j=f[0];var h=f[1];var o=f[2];var n=f[3];var l=40;var t=(Math.PI*2)/l;if(k.fill){var p=HEXtoRGB(k.fillColor);var d=k.fillAlpha;var m=p[0]*d;var s=p[1]*d;var u=p[2]*d;var v=w.points;var e=w.indices;var c=v.length/6;e.push(c);for(var q=0;q<l+1;q++){v.push(j,h,m,s,u,d);v.push(j+Math.sin(t*q)*o,h+Math.cos(t*q)*n,m,s,u,d);e.push(c++,c++)}e.push(c-1)}if(k.lineWidth){k.points=[];for(var q=0;q<l+1;q++){k.points.push(j+Math.sin(t*q)*o,h+Math.cos(t*q)*n)}PIXI.WebGLGraphics.buildLine(k,w)}};PIXI.WebGLGraphics.buildLine=function(V,E){var O=true;var H=V.points;if(H.length==0){return}var t=new PIXI.Point(H[0],H[1]);var n=new PIXI.Point(H[H.length-2],H[H.length-1]);if(t.x==n.x&&t.y==n.y){H.pop();H.pop();n=new PIXI.Point(H[H.length-2],H[H.length-1]);var v=n.x+(t.x-n.x)*0.5;var s=n.y+(t.y-n.y)*0.5;H.unshift(v,s);H.push(v,s)}var S=E.points;var l=E.indices;var u=H.length/2;var q=H.length;var U=S.length/6;var c=V.lineWidth/2;var G=HEXtoRGB(V.lineColor);var Q=V.lineAlpha;var M=G[0]*Q;var T=G[1]*Q;var W=G[2]*Q;var J,I,B,A,k,j;var L,K,z,w,h,f;var e,d;var P,F,p,N,D,o;var X,C,m;J=H[0];I=H[1];B=H[2];A=H[3];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;S.push(J-L,I-K,M,T,W,Q);S.push(J+L,I+K,M,T,W,Q);for(var R=1;R<u-1;R++){J=H[(R-1)*2];I=H[(R-1)*2+1];B=H[(R)*2];A=H[(R)*2+1];k=H[(R+1)*2];j=H[(R+1)*2+1];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;z=-(A-j);w=B-k;m=Math.sqrt(z*z+w*w);z/=m;w/=m;z*=c;w*=c;P=(-K+I)-(-K+A);F=(-L+B)-(-L+J);p=(-L+J)*(-K+A)-(-L+B)*(-K+I);N=(-w+j)-(-w+A);D=(-z+B)-(-z+k);o=(-z+k)*(-w+A)-(-z+B)*(-w+j);X=P*D-N*F;if(X==0){X+=1}px=(F*o-D*p)/X;py=(N*p-P*o)/X;C=(px-B)*(px-B)+(py-A)+(py-A);if(C>140*140){h=L-z;f=K-w;m=Math.sqrt(h*h+f*f);h/=m;f/=m;h*=c;f*=c;S.push(B-h,A-f);S.push(M,T,W,Q);S.push(B+h,A+f);S.push(M,T,W,Q);S.push(B-h,A-f);S.push(M,T,W,Q);q++}else{S.push(px,py);S.push(M,T,W,Q);S.push(B-(px-B),A-(py-A));S.push(M,T,W,Q)}}J=H[(u-2)*2];I=H[(u-2)*2+1];B=H[(u-1)*2];A=H[(u-1)*2+1];L=-(I-A);K=J-B;m=Math.sqrt(L*L+K*K);L/=m;K/=m;L*=c;K*=c;S.push(B-L,A-K);S.push(M,T,W,Q);S.push(B+L,A+K);S.push(M,T,W,Q);l.push(U);for(var R=0;R<q;R++){l.push(U++)}l.push(U-1)};PIXI.WebGLGraphics.buildPoly=function(s,k){var p=s.points;if(p.length<6){return}var o=k.points;var q=k.indices;var d=p.length/2;var h=HEXtoRGB(s.fillColor);var f=s.fillAlpha;var c=h[0]*f;var l=h[1]*f;var n=h[2]*f;var e=PIXI.PolyK.Triangulate(p);var m=o.length/6;for(var j=0;j<e.length;j+=3){q.push(e[j]+m);q.push(e[j]+m);q.push(e[j+1]+m);q.push(e[j+2]+m);q.push(e[j+2]+m)}for(var j=0;j<d;j++){o.push(p[j*2],p[j*2+1],c,l,n,f)}};function HEXtoRGB(b){return[(b>>16&255)/255,(b>>8&255)/255,(b&255)/255]}PIXI._defaultFrame=new PIXI.Rectangle(0,0,1,1);PIXI.gl;PIXI.WebGLRenderer=function(g,b,d,j,c){this.transparent=!!j;this.width=g||800;this.height=b||600;this.view=d||document.createElement("canvas");this.view.width=this.width;this.view.height=this.height;var f=this;this.view.addEventListener("webglcontextlost",function(e){f.handleContextLost(e)},false);this.view.addEventListener("webglcontextrestored",function(e){f.handleContextRestored(e)},false);this.batchs=[];try{PIXI.gl=this.gl=this.view.getContext("experimental-webgl",{alpha:this.transparent,antialias:!!c,premultipliedAlpha:false,stencil:true})}catch(h){throw new Error(" This browser does not support webGL. Try using the canvas renderer"+this)}PIXI.initPrimitiveShader();PIXI.initDefaultShader();PIXI.initDefaultStripShader();PIXI.activateDefaultShader();var i=this.gl;PIXI.WebGLRenderer.gl=i;this.batch=new PIXI.WebGLBatch(i);i.disable(i.DEPTH_TEST);i.disable(i.CULL_FACE);i.enable(i.BLEND);i.colorMask(true,true,true,this.transparent);PIXI.projection=new PIXI.Point(400,300);this.resize(this.width,this.height);this.contextLost=false;this.stageRenderGroup=new PIXI.WebGLRenderGroup(this.gl)};PIXI.WebGLRenderer.prototype.constructor=PIXI.WebGLRenderer;PIXI.WebGLRenderer.getBatch=function(){if(PIXI._batchs.length==0){return new PIXI.WebGLBatch(PIXI.WebGLRenderer.gl)}else{return PIXI._batchs.pop()}};PIXI.WebGLRenderer.returnBatch=function(b){b.clean();PIXI._batchs.push(b)};PIXI.WebGLRenderer.prototype.render=function(b){if(this.contextLost){return}if(this.__stage!==b){this.__stage=b;this.stageRenderGroup.setRenderable(b)}PIXI.WebGLRenderer.updateTextures();PIXI.visibleCount++;b.updateTransform();var d=this.gl;d.colorMask(true,true,true,this.transparent);d.viewport(0,0,this.width,this.height);d.bindFramebuffer(d.FRAMEBUFFER,null);d.clearColor(b.backgroundColorSplit[0],b.backgroundColorSplit[1],b.backgroundColorSplit[2],!this.transparent);d.clear(d.COLOR_BUFFER_BIT);this.stageRenderGroup.backgroundColor=b.backgroundColorSplit;this.stageRenderGroup.render(PIXI.projection);if(b.interactive){if(!b._interactiveEventsAdded){b._interactiveEventsAdded=true;b.interactionManager.setTarget(this)}}if(PIXI.Texture.frameUpdates.length>0){for(var c=0;c<PIXI.Texture.frameUpdates.length;c++){PIXI.Texture.frameUpdates[c].updateFrame=false}PIXI.Texture.frameUpdates=[]}};PIXI.WebGLRenderer.updateTextures=function(){for(var b=0;b<PIXI.texturesToUpdate.length;b++){PIXI.WebGLRenderer.updateTexture(PIXI.texturesToUpdate[b])}for(var b=0;b<PIXI.texturesToDestroy.length;b++){PIXI.WebGLRenderer.destroyTexture(PIXI.texturesToDestroy[b])}PIXI.texturesToUpdate=[];PIXI.texturesToDestroy=[]};PIXI.WebGLRenderer.updateTexture=function(b){var c=PIXI.gl;if(!b._glTexture){b._glTexture=c.createTexture()}if(b.hasLoaded){c.bindTexture(c.TEXTURE_2D,b._glTexture);c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,b.source);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR);if(!b._powerOf2){c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE)}else{c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT)}c.bindTexture(c.TEXTURE_2D,null)}};PIXI.WebGLRenderer.destroyTexture=function(b){var c=PIXI.gl;if(b._glTexture){b._glTexture=c.createTexture();c.deleteTexture(c.TEXTURE_2D,b._glTexture)}};PIXI.WebGLRenderer.prototype.resize=function(c,b){this.width=c;this.height=b;this.view.width=c;this.view.height=b;this.gl.viewport(0,0,this.width,this.height);PIXI.projection.x=this.width/2;PIXI.projection.y=this.height/2};PIXI.WebGLRenderer.prototype.handleContextLost=function(b){b.preventDefault();this.contextLost=true};PIXI.WebGLRenderer.prototype.handleContextRestored=function(e){this.gl=this.view.getContext("experimental-webgl",{alpha:true});this.initShaders();for(var c in PIXI.TextureCache){var d=PIXI.TextureCache[c].baseTexture;d._glTexture=null;PIXI.WebGLRenderer.updateTexture(d)}for(var b=0;b<this.batchs.length;b++){this.batchs[b].restoreLostContext(this.gl);this.batchs[b].dirty=true}PIXI._restoreBatchs(this.gl);this.contextLost=false};PIXI.WebGLRenderGroup=function(b){this.gl=b;this.root;this.backgroundColor;this.batchs=[];this.toRemove=[]};PIXI.WebGLRenderGroup.prototype.constructor=PIXI.WebGLRenderGroup;PIXI.WebGLRenderGroup.prototype.setRenderable=function(b){if(this.root){this.removeDisplayObjectAndChildren(this.root)}b.worldVisible=b.visible;this.root=b;this.addDisplayObjectAndChildren(b)};PIXI.WebGLRenderGroup.prototype.render=function(b){PIXI.WebGLRenderer.updateTextures();var f=this.gl;f.uniform2f(PIXI.shaderProgram.projectionVector,b.x,b.y);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);var e;for(var d=0;d<this.batchs.length;d++){e=this.batchs[d];if(e instanceof PIXI.WebGLBatch){this.batchs[d].render();continue}var c=e.vcount===PIXI.visibleCount;if(e instanceof PIXI.TilingSprite){if(c){this.renderTilingSprite(e,b)}}else{if(e instanceof PIXI.Strip){if(c){this.renderStrip(e,b)}}else{if(e instanceof PIXI.Graphics){if(c&&e.renderable){PIXI.WebGLGraphics.renderGraphics(e,b)}}else{if(e instanceof PIXI.FilterBlock){if(e.open){f.enable(f.STENCIL_TEST);f.colorMask(false,false,false,false);f.stencilFunc(f.ALWAYS,1,255);f.stencilOp(f.KEEP,f.KEEP,f.REPLACE);PIXI.WebGLGraphics.renderGraphics(e.mask,b);f.colorMask(true,true,true,false);f.stencilFunc(f.NOTEQUAL,0,255);f.stencilOp(f.KEEP,f.KEEP,f.KEEP)}else{f.disable(f.STENCIL_TEST)}}}}}}};PIXI.WebGLRenderGroup.prototype.handleFilter=function(c,b){};PIXI.WebGLRenderGroup.prototype.renderSpecific=function(k,j){PIXI.WebGLRenderer.updateTextures();var g=this.gl;g.uniform2f(PIXI.shaderProgram.projectionVector,j.x,j.y);var p;var d;var h;var q;var o=k.first;while(o._iNext){o=o._iNext;if(o.renderable&&o.__renderGroup){break}}var m=o.batch;if(o instanceof PIXI.Sprite){m=o.batch;var l=m.head;var f=l;if(l==o){p=0}else{p=1;while(l.__next!=o){p++;l=l.__next}}}else{m=o}var b=k;var c;var n=k;while(n.children.length>0){n=n.children[n.children.length-1];if(n.renderable){b=n}}if(b instanceof PIXI.Sprite){c=b.batch;var l=c.head;if(l==b){h=0}else{h=1;while(l.__next!=b){h++;l=l.__next}}}else{c=b}if(m==c){if(m instanceof PIXI.WebGLBatch){m.render(p,h+1)}else{this.renderSpecial(m,j)}return}d=this.batchs.indexOf(m);q=this.batchs.indexOf(c);if(m instanceof PIXI.WebGLBatch){m.render(p)}else{this.renderSpecial(m,j)}for(var e=d+1;e<q;e++){renderable=this.batchs[e];if(renderable instanceof PIXI.WebGLBatch){this.batchs[e].render()}else{this.renderSpecial(renderable,j)}}if(c instanceof PIXI.WebGLBatch){c.render(0,h+1)}else{this.renderSpecial(c,j)}};PIXI.WebGLRenderGroup.prototype.renderSpecial=function(d,b){var c=d.vcount===PIXI.visibleCount;if(d instanceof PIXI.TilingSprite){if(c){this.renderTilingSprite(d,b)}}else{if(d instanceof PIXI.Strip){if(c){this.renderStrip(d,b)}}else{if(d instanceof PIXI.CustomRenderable){if(c){d.renderWebGL(this,b)}}else{if(d instanceof PIXI.Graphics){if(c&&d.renderable){PIXI.WebGLGraphics.renderGraphics(d,b)}}else{if(d instanceof PIXI.FilterBlock){var e=PIXI.gl;if(d.open){e.enable(e.STENCIL_TEST);e.colorMask(false,false,false,false);e.stencilFunc(e.ALWAYS,1,255);e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);PIXI.WebGLGraphics.renderGraphics(d.mask,b);e.colorMask(true,true,true,true);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}else{e.disable(e.STENCIL_TEST)}}}}}}};PIXI.WebGLRenderGroup.prototype.updateTexture=function(d){this.removeObject(d);var b=d.first;while(b!=this.root){b=b._iPrev;if(b.renderable&&b.__renderGroup){break}}var c=d.last;while(c._iNext){c=c._iNext;if(c.renderable&&c.__renderGroup){break}}this.insertObject(d,b,c)};PIXI.WebGLRenderGroup.prototype.addFilterBlocks=function(e,c){e.__renderGroup=this;c.__renderGroup=this;var b=e;while(b!=this.root){b=b._iPrev;if(b.renderable&&b.__renderGroup){break}}this.insertAfter(e,b);var d=c;while(d!=this.root){d=d._iPrev;if(d.renderable&&d.__renderGroup){break}}this.insertAfter(c,d)};PIXI.WebGLRenderGroup.prototype.removeFilterBlocks=function(c,b){this.removeObject(c);this.removeObject(b)};PIXI.WebGLRenderGroup.prototype.addDisplayObjectAndChildren=function(f){if(f.__renderGroup){f.__renderGroup.removeDisplayObjectAndChildren(f)}var b=f.first;while(b!=this.root.first){b=b._iPrev;if(b.renderable&&b.__renderGroup){break}}var c=f.last;while(c._iNext){c=c._iNext;if(c.renderable&&c.__renderGroup){break}}var e=f.first;var d=f.last._iNext;do{e.__renderGroup=this;if(e.renderable){this.insertObject(e,b,c);b=e}e=e._iNext}while(e!=d)};PIXI.WebGLRenderGroup.prototype.removeDisplayObjectAndChildren=function(b){if(b.__renderGroup!=this){return}var c=b.last;do{b.__renderGroup=null;if(b.renderable){this.removeObject(b)}b=b._iNext}while(b)};PIXI.WebGLRenderGroup.prototype.insertObject=function(h,g,i){var b=g;var c=i;if(h instanceof PIXI.Sprite){var j;var d;if(b instanceof PIXI.Sprite){j=b.batch;if(j){if(j.texture==h.texture.baseTexture&&j.blendMode==h.blendMode){j.insertAfter(h,b);return}}}else{j=b}if(c){if(c instanceof PIXI.Sprite){d=c.batch;if(d){if(d.texture==h.texture.baseTexture&&d.blendMode==h.blendMode){d.insertBefore(h,c);return}else{if(d==j){var k=j.split(c);var e=PIXI.WebGLRenderer.getBatch();var f=this.batchs.indexOf(j);e.init(h);this.batchs.splice(f+1,0,e,k);return}}}}else{d=c}}var e=PIXI.WebGLRenderer.getBatch();e.init(h);if(j){var f=this.batchs.indexOf(j);this.batchs.splice(f+1,0,e)}else{this.batchs.push(e)}return}else{if(h instanceof PIXI.TilingSprite){this.initTilingSprite(h)}else{if(h instanceof PIXI.Strip){this.initStrip(h)}else{if(h){}}}}this.insertAfter(h,b)};PIXI.WebGLRenderGroup.prototype.insertAfter=function(d,f){if(f instanceof PIXI.Sprite){var e=f.batch;if(e){if(e.tail==f){var c=this.batchs.indexOf(e);this.batchs.splice(c+1,0,d)}else{var b=e.split(f.__next);var c=this.batchs.indexOf(e);this.batchs.splice(c+1,0,d,b)}}else{this.batchs.push(d)}}else{var c=this.batchs.indexOf(f);this.batchs.splice(c+1,0,d)}};PIXI.WebGLRenderGroup.prototype.removeObject=function(e){var d;if(e instanceof PIXI.Sprite){var c=e.batch;if(!c){return}c.remove(e);if(c.size==0){d=c}}else{d=e}if(d){var b=this.batchs.indexOf(d);if(b==-1){return}if(b==0||b==this.batchs.length-1){this.batchs.splice(b,1);if(d instanceof PIXI.WebGLBatch){PIXI.WebGLRenderer.returnBatch(d)}return}if(this.batchs[b-1] instanceof PIXI.WebGLBatch&&this.batchs[b+1] instanceof PIXI.WebGLBatch){if(this.batchs[b-1].texture==this.batchs[b+1].texture&&this.batchs[b-1].blendMode==this.batchs[b+1].blendMode){this.batchs[b-1].merge(this.batchs[b+1]);if(d instanceof PIXI.WebGLBatch){PIXI.WebGLRenderer.returnBatch(d)}PIXI.WebGLRenderer.returnBatch(this.batchs[b+1]);this.batchs.splice(b,2);return}}this.batchs.splice(b,1);if(d instanceof PIXI.WebGLBatch){PIXI.WebGLRenderer.returnBatch(d)}}};PIXI.WebGLRenderGroup.prototype.initTilingSprite=function(b){var c=this.gl;b.verticies=new Float32Array([0,0,b.width,0,b.width,b.height,0,b.height]);b.uvs=new Float32Array([0,0,1,0,1,1,0,1]);b.colors=new Float32Array([1,1,1,1]);b.indices=new Uint16Array([0,1,3,2]);b._vertexBuffer=c.createBuffer();b._indexBuffer=c.createBuffer();b._uvBuffer=c.createBuffer();b._colorBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,b._vertexBuffer);c.bufferData(c.ARRAY_BUFFER,b.verticies,c.STATIC_DRAW);c.bindBuffer(c.ARRAY_BUFFER,b._uvBuffer);c.bufferData(c.ARRAY_BUFFER,b.uvs,c.DYNAMIC_DRAW);c.bindBuffer(c.ARRAY_BUFFER,b._colorBuffer);c.bufferData(c.ARRAY_BUFFER,b.colors,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b._indexBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,b.indices,c.STATIC_DRAW);if(b.texture.baseTexture._glTexture){c.bindTexture(c.TEXTURE_2D,b.texture.baseTexture._glTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.REPEAT);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.REPEAT);b.texture.baseTexture._powerOf2=true}else{b.texture.baseTexture._powerOf2=true}};PIXI.WebGLRenderGroup.prototype.renderStrip=function(d,c){var e=this.gl;var f=PIXI.shaderProgram;e.useProgram(PIXI.stripShaderProgram);var b=PIXI.mat3.clone(d.worldTransform);PIXI.mat3.transpose(b);e.uniformMatrix3fv(PIXI.stripShaderProgram.translationMatrix,false,b);e.uniform2f(PIXI.stripShaderProgram.projectionVector,c.x,c.y);e.uniform1f(PIXI.stripShaderProgram.alpha,d.worldAlpha);if(!d.dirty){e.bindBuffer(e.ARRAY_BUFFER,d._vertexBuffer);e.bufferSubData(e.ARRAY_BUFFER,0,d.verticies);e.vertexAttribPointer(f.vertexPositionAttribute,2,e.FLOAT,false,0,0);e.bindBuffer(e.ARRAY_BUFFER,d._uvBuffer);e.vertexAttribPointer(f.textureCoordAttribute,2,e.FLOAT,false,0,0);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,d.texture.baseTexture._glTexture);e.bindBuffer(e.ARRAY_BUFFER,d._colorBuffer);e.vertexAttribPointer(f.colorAttribute,1,e.FLOAT,false,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,d._indexBuffer)}else{d.dirty=false;e.bindBuffer(e.ARRAY_BUFFER,d._vertexBuffer);e.bufferData(e.ARRAY_BUFFER,d.verticies,e.STATIC_DRAW);e.vertexAttribPointer(f.vertexPositionAttribute,2,e.FLOAT,false,0,0);e.bindBuffer(e.ARRAY_BUFFER,d._uvBuffer);e.bufferData(e.ARRAY_BUFFER,d.uvs,e.STATIC_DRAW);e.vertexAttribPointer(f.textureCoordAttribute,2,e.FLOAT,false,0,0);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,d.texture.baseTexture._glTexture);e.bindBuffer(e.ARRAY_BUFFER,d._colorBuffer);e.bufferData(e.ARRAY_BUFFER,d.colors,e.STATIC_DRAW);e.vertexAttribPointer(f.colorAttribute,1,e.FLOAT,false,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,d._indexBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,d.indices,e.STATIC_DRAW)}e.drawElements(e.TRIANGLE_STRIP,d.indices.length,e.UNSIGNED_SHORT,0);e.useProgram(PIXI.shaderProgram)};PIXI.WebGLRenderGroup.prototype.renderTilingSprite=function(j,g){var e=this.gl;var b=PIXI.shaderProgram;var d=j.tilePosition;var k=j.tileScale;var f=d.x/j.texture.baseTexture.width;var c=d.y/j.texture.baseTexture.height;var i=(j.width/j.texture.baseTexture.width)/k.x;var h=(j.height/j.texture.baseTexture.height)/k.y;j.uvs[0]=0-f;j.uvs[1]=0-c;j.uvs[2]=(1*i)-f;j.uvs[3]=0-c;j.uvs[4]=(1*i)-f;j.uvs[5]=(1*h)-c;j.uvs[6]=0-f;j.uvs[7]=(1*h)-c;e.bindBuffer(e.ARRAY_BUFFER,j._uvBuffer);e.bufferSubData(e.ARRAY_BUFFER,0,j.uvs);this.renderStrip(j,g)};PIXI.WebGLRenderGroup.prototype.initStrip=function(b){var c=this.gl;var d=this.shaderProgram;b._vertexBuffer=c.createBuffer();b._indexBuffer=c.createBuffer();b._uvBuffer=c.createBuffer();b._colorBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,b._vertexBuffer);c.bufferData(c.ARRAY_BUFFER,b.verticies,c.DYNAMIC_DRAW);c.bindBuffer(c.ARRAY_BUFFER,b._uvBuffer);c.bufferData(c.ARRAY_BUFFER,b.uvs,c.STATIC_DRAW);c.bindBuffer(c.ARRAY_BUFFER,b._colorBuffer);c.bufferData(c.ARRAY_BUFFER,b.colors,c.STATIC_DRAW);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,b._indexBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,b.indices,c.STATIC_DRAW)};PIXI.shaderFragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform sampler2D uSampler;","void main(void) {","gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));","gl_FragColor = gl_FragColor * vColor;","}"];PIXI.shaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","varying float vColor;","void main(void) {","gl_Position = vec4( aVertexPosition.x / projectionVector.x -1.0, aVertexPosition.y / -projectionVector.y + 1.0 , 0.0, 1.0);","vTextureCoord = aTextureCoord;","vColor = aColor;","}"];PIXI.stripShaderFragmentSrc=["precision mediump float;","varying vec2 vTextureCoord;","varying float vColor;","uniform float alpha;","uniform sampler2D uSampler;","void main(void) {","gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y));","gl_FragColor = gl_FragColor * alpha;","}"];PIXI.stripShaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec2 aTextureCoord;","attribute float aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","varying vec2 vTextureCoord;","varying float vColor;","void main(void) {","vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);","gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);","vTextureCoord = aTextureCoord;","vColor = aColor;","}"];PIXI.primitiveShaderFragmentSrc=["precision mediump float;","varying vec4 vColor;","void main(void) {","gl_FragColor = vColor;","}"];PIXI.primitiveShaderVertexSrc=["attribute vec2 aVertexPosition;","attribute vec4 aColor;","uniform mat3 translationMatrix;","uniform vec2 projectionVector;","uniform float alpha;","varying vec4 vColor;","void main(void) {","vec3 v = translationMatrix * vec3(aVertexPosition, 1.0);","gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);","vColor = aColor * alpha;","}"];PIXI.initPrimitiveShader=function(){var b=PIXI.gl;var c=PIXI.compileProgram(PIXI.primitiveShaderVertexSrc,PIXI.primitiveShaderFragmentSrc);b.useProgram(c);c.vertexPositionAttribute=b.getAttribLocation(c,"aVertexPosition");c.colorAttribute=b.getAttribLocation(c,"aColor");c.projectionVector=b.getUniformLocation(c,"projectionVector");c.translationMatrix=b.getUniformLocation(c,"translationMatrix");c.alpha=b.getUniformLocation(c,"alpha");PIXI.primitiveProgram=c};PIXI.initDefaultShader=function(){var b=this.gl;var c=PIXI.compileProgram(PIXI.shaderVertexSrc,PIXI.shaderFragmentSrc);b.useProgram(c);c.vertexPositionAttribute=b.getAttribLocation(c,"aVertexPosition");c.projectionVector=b.getUniformLocation(c,"projectionVector");c.textureCoordAttribute=b.getAttribLocation(c,"aTextureCoord");c.colorAttribute=b.getAttribLocation(c,"aColor");c.samplerUniform=b.getUniformLocation(c,"uSampler");PIXI.shaderProgram=c};PIXI.initDefaultStripShader=function(){var b=this.gl;var c=PIXI.compileProgram(PIXI.stripShaderVertexSrc,PIXI.stripShaderFragmentSrc);b.useProgram(c);c.vertexPositionAttribute=b.getAttribLocation(c,"aVertexPosition");c.projectionVector=b.getUniformLocation(c,"projectionVector");c.textureCoordAttribute=b.getAttribLocation(c,"aTextureCoord");c.translationMatrix=b.getUniformLocation(c,"translationMatrix");c.alpha=b.getUniformLocation(c,"alpha");c.colorAttribute=b.getAttribLocation(c,"aColor");c.projectionVector=b.getUniformLocation(c,"projectionVector");c.samplerUniform=b.getUniformLocation(c,"uSampler");PIXI.stripShaderProgram=c};PIXI.CompileVertexShader=function(c,b){return PIXI._CompileShader(c,b,c.VERTEX_SHADER)};PIXI.CompileFragmentShader=function(c,b){return PIXI._CompileShader(c,b,c.FRAGMENT_SHADER)};PIXI._CompileShader=function(f,e,d){var c=e.join("\n");var b=f.createShader(d);f.shaderSource(b,c);f.compileShader(b);if(!f.getShaderParameter(b,f.COMPILE_STATUS)){alert(f.getShaderInfoLog(b));return null}return b};PIXI.compileProgram=function(b,d){var f=PIXI.gl;var c=PIXI.CompileFragmentShader(f,d);var e=PIXI.CompileVertexShader(f,b);var g=f.createProgram();f.attachShader(g,e);f.attachShader(g,c);f.linkProgram(g);if(!f.getProgramParameter(g,f.LINK_STATUS)){alert("Could not initialise shaders")}return g};PIXI.activateDefaultShader=function(){var b=PIXI.gl;var c=PIXI.shaderProgram;b.useProgram(c);b.enableVertexAttribArray(c.vertexPositionAttribute);b.enableVertexAttribArray(c.textureCoordAttribute);b.enableVertexAttribArray(c.colorAttribute)};PIXI.activatePrimitiveShader=function(){var b=PIXI.gl;b.disableVertexAttribArray(PIXI.shaderProgram.textureCoordAttribute);b.disableVertexAttribArray(PIXI.shaderProgram.colorAttribute);b.useProgram(PIXI.primitiveProgram);b.enableVertexAttribArray(PIXI.primitiveProgram.vertexPositionAttribute);b.enableVertexAttribArray(PIXI.primitiveProgram.colorAttribute)};PIXI.BitmapText=function(c,b){PIXI.DisplayObjectContainer.call(this);this.setText(c);this.setStyle(b);this.updateText();this.dirty=false};PIXI.BitmapText.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);PIXI.BitmapText.prototype.constructor=PIXI.BitmapText;PIXI.BitmapText.prototype.setText=function(b){this.text=b||" ";this.dirty=true};PIXI.BitmapText.prototype.setStyle=function(c){c=c||{};c.align=c.align||"left";this.style=c;var b=c.font.split(" ");this.fontName=b[b.length-1];this.fontSize=b.length>=2?parseInt(b[b.length-2],10):PIXI.BitmapText.fonts[this.fontName].size;this.dirty=true};PIXI.BitmapText.prototype.updateText=function(){var h=PIXI.BitmapText.fonts[this.fontName];var m=new PIXI.Point();var j=null;var l=[];var q=0;var e=[];var p=0;var f=this.fontSize/h.size;for(var g=0;g<this.text.length;g++){var o=this.text.charCodeAt(g);if(/(?:\r\n|\r|\n)/.test(this.text.charAt(g))){e.push(m.x);q=Math.max(q,m.x);p++;m.x=0;m.y+=h.lineHeight;j=null;continue}var d=h.chars[o];if(!d){continue}if(j&&d[j]){m.x+=d.kerning[j]}l.push({texture:d.texture,line:p,charCode:o,position:new PIXI.Point(m.x+d.xOffset,m.y+d.yOffset)});m.x+=d.xAdvance;j=o}e.push(m.x);q=Math.max(q,m.x);var n=[];for(g=0;g<=p;g++){var b=0;if(this.style.align=="right"){b=q-e[g]}else{if(this.style.align=="center"){b=(q-e[g])/2}}n.push(b)}for(g=0;g<l.length;g++){var k=new PIXI.Sprite(l[g].texture);k.position.x=(l[g].position.x+n[l[g].line])*f;k.position.y=l[g].position.y*f;k.scale.x=k.scale.y=f;this.addChild(k)}this.width=m.x*f;this.height=(m.y+h.lineHeight)*f};PIXI.BitmapText.prototype.updateTransform=function(){if(this.dirty){while(this.children.length>0){this.removeChild(this.getChildAt(0))}this.updateText();this.dirty=false}PIXI.DisplayObjectContainer.prototype.updateTransform.call(this)};PIXI.BitmapText.fonts={};PIXI.Text=function(c,b){this.canvas=document.createElement("canvas");this.context=this.canvas.getContext("2d");PIXI.Sprite.call(this,PIXI.Texture.fromCanvas(this.canvas));this.setText(c);this.setStyle(b);this.updateText();this.dirty=false};PIXI.Text.prototype=Object.create(PIXI.Sprite.prototype);PIXI.Text.prototype.constructor=PIXI.Text;PIXI.Text.prototype.setStyle=function(b){b=b||{};b.font=b.font||"bold 20pt Arial";b.fill=b.fill||"black";b.align=b.align||"left";b.stroke=b.stroke||"black";b.strokeThickness=b.strokeThickness||0;b.wordWrap=b.wordWrap||false;b.wordWrapWidth=b.wordWrapWidth||100;this.style=b;this.dirty=true};PIXI.Sprite.prototype.setText=function(b){this.text=b.toString()||" ";this.dirty=true};PIXI.Text.prototype.updateText=function(){this.context.font=this.style.font;var g=this.text;if(this.style.wordWrap){g=this.wordWrap(this.text)}var f=g.split(/(?:\r\n|\r|\n)/);var d=[];var c=0;for(var h=0;h<f.length;h++){var b=this.context.measureText(f[h]).width;d[h]=b;c=Math.max(c,b)}this.canvas.width=c+this.style.strokeThickness;var j=this.determineFontHeight("font: "+this.style.font+";")+this.style.strokeThickness;this.canvas.height=j*f.length;this.context.fillStyle=this.style.fill;this.context.font=this.style.font;this.context.strokeStyle=this.style.stroke;this.context.lineWidth=this.style.strokeThickness;this.context.textBaseline="top";for(h=0;h<f.length;h++){var e=new PIXI.Point(this.style.strokeThickness/2,this.style.strokeThickness/2+h*j);if(this.style.align=="right"){e.x+=c-d[h]}else{if(this.style.align=="center"){e.x+=(c-d[h])/2}}if(this.style.stroke&&this.style.strokeThickness){this.context.strokeText(f[h],e.x,e.y)}if(this.style.fill){this.context.fillText(f[h],e.x,e.y)}}this.updateTexture()};PIXI.Text.prototype.updateTexture=function(){this.texture.baseTexture.width=this.canvas.width;this.texture.baseTexture.height=this.canvas.height;this.texture.frame.width=this.canvas.width;this.texture.frame.height=this.canvas.height;this._width=this.canvas.width;this._height=this.canvas.height;PIXI.texturesToUpdate.push(this.texture.baseTexture)};PIXI.Text.prototype.updateTransform=function(){if(this.dirty){this.updateText();this.dirty=false}PIXI.Sprite.prototype.updateTransform.call(this)};PIXI.Text.prototype.determineFontHeight=function(f){var c=PIXI.Text.heightCache[f];if(!c){var b=document.getElementsByTagName("body")[0];var e=document.createElement("div");var d=document.createTextNode("M");e.appendChild(d);e.setAttribute("style",f+";position:absolute;top:0;left:0");b.appendChild(e);c=e.offsetHeight;PIXI.Text.heightCache[f]=c;b.removeChild(e)}return c};PIXI.Text.prototype.wordWrap=function(g){var e=function(i,l,m,h,j){var k=Math.floor((h-m)/2)+m;if(k==m){return 1}if(i.measureText(l.substring(0,k)).width<=j){if(i.measureText(l.substring(0,k+1)).width>j){return k}else{return arguments.callee(i,l,k,h,j)}}else{return arguments.callee(i,l,m,k,j)}};var f=function(h,j,i){if(h.measureText(j).width<=i||j.length<1){return j}var k=e(h,j,0,j.length,i);return j.substring(0,k)+"\n"+arguments.callee(h,j.substring(k),i)};var b="";var c=g.split("\n");for(var d=0;d<c.length;d++){b+=f(this.context,c[d],this.style.wordWrapWidth)+"\n"}return b};PIXI.Text.prototype.destroy=function(b){if(b){this.texture.destroy()}};PIXI.Text.heightCache={};PIXI.BaseTextureCache={};PIXI.texturesToUpdate=[];PIXI.texturesToDestroy=[];PIXI.BaseTexture=function(c){PIXI.EventTarget.call(this);this.width=100;this.height=100;this.hasLoaded=false;this.source=c;if(!c){return}if(this.source instanceof Image||this.source instanceof HTMLImageElement){if(this.source.complete){this.hasLoaded=true;this.width=this.source.width;this.height=this.source.height;PIXI.texturesToUpdate.push(this)}else{var b=this;this.source.onload=function(){b.hasLoaded=true;b.width=b.source.width;b.height=b.source.height;PIXI.texturesToUpdate.push(b);b.dispatchEvent({type:"loaded",content:b})}}}else{this.hasLoaded=true;this.width=this.source.width;this.height=this.source.height;PIXI.texturesToUpdate.push(this)}this._powerOf2=false};PIXI.BaseTexture.prototype.constructor=PIXI.BaseTexture;PIXI.BaseTexture.prototype.destroy=function(){if(this.source instanceof Image){this.source.src=null}this.source=null;PIXI.texturesToDestroy.push(this)};PIXI.BaseTexture.fromImage=function(c,b){var d=PIXI.BaseTextureCache[c];if(!d){var e=new Image();if(b){e.crossOrigin=""}e.src=c;d=new PIXI.BaseTexture(e);PIXI.BaseTextureCache[c]=d}return d};PIXI.TextureCache={};PIXI.FrameCache={};PIXI.Texture=function(c,d){PIXI.EventTarget.call(this);if(!d){this.noFrame=true;d=new PIXI.Rectangle(0,0,1,1)}if(c instanceof PIXI.Texture){c=c.baseTexture}this.baseTexture=c;this.frame=d;this.trim=new PIXI.Point();this.scope=this;if(c.hasLoaded){if(this.noFrame){d=new PIXI.Rectangle(0,0,c.width,c.height)}this.setFrame(d)}else{var b=this;c.addEventListener("loaded",function(){b.onBaseTextureLoaded()})}};PIXI.Texture.prototype.constructor=PIXI.Texture;PIXI.Texture.prototype.onBaseTextureLoaded=function(c){var b=this.baseTexture;b.removeEventListener("loaded",this.onLoaded);if(this.noFrame){this.frame=new PIXI.Rectangle(0,0,b.width,b.height)}this.noFrame=false;this.width=this.frame.width;this.height=this.frame.height;this.scope.dispatchEvent({type:"update",content:this})};PIXI.Texture.prototype.destroy=function(b){if(b){this.baseTexture.destroy()}};PIXI.Texture.prototype.setFrame=function(b){this.frame=b;this.width=b.width;this.height=b.height;if(b.x+b.width>this.baseTexture.width||b.y+b.height>this.baseTexture.height){throw new Error("Texture Error: frame does not fit inside the base Texture dimensions "+this)}this.updateFrame=true;PIXI.Texture.frameUpdates.push(this)};PIXI.Texture.fromImage=function(c,b){var d=PIXI.TextureCache[c];if(!d){d=new PIXI.Texture(PIXI.BaseTexture.fromImage(c,b));PIXI.TextureCache[c]=d}return d};PIXI.Texture.fromFrame=function(c){var b=PIXI.TextureCache[c];if(!b){throw new Error("The frameId '"+c+"' does not exist in the texture cache "+this)}return b};PIXI.Texture.fromCanvas=function(b){var c=new PIXI.BaseTexture(b);return new PIXI.Texture(c)};PIXI.Texture.addTextureToCache=function(b,c){PIXI.TextureCache[c]=b};PIXI.Texture.removeTextureFromCache=function(c){var b=PIXI.TextureCache[c];PIXI.TextureCache[c]=null;return b};PIXI.Texture.frameUpdates=[];PIXI.RenderTexture=function(c,b){PIXI.EventTarget.call(this);this.width=c||100;this.height=b||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};PIXI.RenderTexture.prototype=Object.create(PIXI.Texture.prototype);PIXI.RenderTexture.prototype.constructor=PIXI.RenderTexture;PIXI.RenderTexture.prototype.initWebGL=function(){var b=PIXI.gl;this.glFramebuffer=b.createFramebuffer();b.bindFramebuffer(b.FRAMEBUFFER,this.glFramebuffer);this.glFramebuffer.width=this.width;this.glFramebuffer.height=this.height;this.baseTexture=new PIXI.BaseTexture();this.baseTexture.width=this.width;this.baseTexture.height=this.height;this.baseTexture._glTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,this.baseTexture._glTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,this.width,this.height,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);this.baseTexture.isRender=true;b.bindFramebuffer(b.FRAMEBUFFER,this.glFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,this.baseTexture._glTexture,0);this.projection=new PIXI.Point(this.width/2,this.height/2);this.render=this.renderWebGL};PIXI.RenderTexture.prototype.resize=function(c,b){this.width=c;this.height=b;if(PIXI.gl){this.projection.x=this.width/2;this.projection.y=this.height/2;var d=PIXI.gl;d.bindTexture(d.TEXTURE_2D,this.baseTexture._glTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,this.width,this.height,0,d.RGBA,d.UNSIGNED_BYTE,null)}else{this.frame.width=this.width;this.frame.height=this.height;this.renderer.resize(this.width,this.height)}};PIXI.RenderTexture.prototype.initCanvas=function(){this.renderer=new PIXI.CanvasRenderer(this.width,this.height,null,0);this.baseTexture=new PIXI.BaseTexture(this.renderer.view);this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.render=this.renderCanvas};PIXI.RenderTexture.prototype.renderWebGL=function(k,g,h){var f=PIXI.gl;f.colorMask(true,true,true,true);f.viewport(0,0,this.width,this.height);f.bindFramebuffer(f.FRAMEBUFFER,this.glFramebuffer);if(h){f.clearColor(0,0,0,0);f.clear(f.COLOR_BUFFER_BIT)}var c=k.children;var b=k.worldTransform;k.worldTransform=PIXI.mat3.create();k.worldTransform[4]=-1;k.worldTransform[5]=this.projection.y*2;if(g){k.worldTransform[2]=g.x;k.worldTransform[5]-=g.y}PIXI.visibleCount++;k.vcount=PIXI.visibleCount;for(var e=0,d=c.length;e<d;e++){c[e].updateTransform()}var l=k.__renderGroup;if(l){if(k==l.root){l.render(this.projection)}else{l.renderSpecific(k,this.projection)}}else{if(!this.renderGroup){this.renderGroup=new PIXI.WebGLRenderGroup(f)}this.renderGroup.setRenderable(k);this.renderGroup.render(this.projection)}k.worldTransform=b};PIXI.RenderTexture.prototype.renderCanvas=function(g,c,b){var f=g.children;g.worldTransform=PIXI.mat3.create();if(c){g.worldTransform[2]=c.x;g.worldTransform[5]=c.y}for(var e=0,d=f.length;e<d;e++){f[e].updateTransform()}if(b){this.renderer.context.clearRect(0,0,this.width,this.height)}this.renderer.renderDisplayObject(g);this.renderer.context.setTransform(1,0,0,1,0,0)};PIXI.EventTarget=function(){var b={};this.addEventListener=this.on=function(c,d){if(b[c]===undefined){b[c]=[]}if(b[c].indexOf(d)===-1){b[c].push(d)}};this.dispatchEvent=this.emit=function(c){for(var d in b[c.type]){b[c.type][d](c)}};this.removeEventListener=this.off=function(d,e){var c=b[d].indexOf(e);if(c!==-1){b[d].splice(c,1)}}};PIXI.PolyK={};PIXI.PolyK.Triangulate=function(h){var z=true;var k=h.length>>1;if(k<3){return[]}var u=[];var g=[];for(var s=0;s<k;s++){g.push(s)}var s=0;var o=k;while(o>3){var q=g[(s+0)%o];var m=g[(s+1)%o];var l=g[(s+2)%o];var f=h[2*q],d=h[2*q+1];var v=h[2*m],t=h[2*m+1];var c=h[2*l],b=h[2*l+1];var e=false;if(PIXI.PolyK._convex(f,d,v,t,c,b,z)){e=true;for(var r=0;r<o;r++){var w=g[r];if(w==q||w==m||w==l){continue}if(PIXI.PolyK._PointInTriangle(h[2*w],h[2*w+1],f,d,v,t,c,b)){e=false;break}}}if(e){u.push(q,m,l);g.splice((s+1)%o,1);o--;s=0}else{if(s++>3*o){if(z){var u=[];g=[];for(var s=0;s<k;s++){g.push(s)}s=0;o=k;z=false}else{console.log("PIXI Warning: shape too complex to fill");return[]}}}}u.push(g[0],g[1],g[2]);return u};PIXI.PolyK._PointInTriangle=function(p,o,l,k,A,z,h,f){var e=h-l;var d=f-k;var j=A-l;var i=z-k;var w=p-l;var s=o-k;var t=e*e+d*d;var r=e*j+d*i;var q=e*w+d*s;var c=j*j+i*i;var b=j*w+i*s;var g=1/(t*c-r*r);var n=(c*q-r*b)*g;var m=(t*b-r*q)*g;return(n>=0)&&(m>=0)&&(n+m<1)};PIXI.PolyK._convex=function(e,d,g,f,b,h,c){return((d-f)*(b-g)+(g-e)*(h-f)>=0)==c};Phaser.Camera=function(d,g,c,f,e,b){this.game=d;this.world=d.world;this.id=0;this.view=new Phaser.Rectangle(c,f,e,b);this.screenView=new Phaser.Rectangle(c,f,e,b);this.deadzone=null;this.visible=true;this.atLimit={x:false,y:false};this.target=null;this._edge=0};Phaser.Camera.FOLLOW_LOCKON=0;Phaser.Camera.FOLLOW_PLATFORMER=1;Phaser.Camera.FOLLOW_TOPDOWN=2;Phaser.Camera.FOLLOW_TOPDOWN_TIGHT=3;Phaser.Camera.prototype={follow:function(f,d){if(typeof d==="undefined"){d=Phaser.Camera.FOLLOW_LOCKON}this.target=f;var e;switch(d){case Phaser.Camera.FOLLOW_PLATFORMER:var b=this.width/8;var c=this.height/3;this.deadzone=new Phaser.Rectangle((this.width-b)/2,(this.height-c)/2-c*0.25,b,c);break;case Phaser.Camera.FOLLOW_TOPDOWN:e=Math.max(this.width,this.height)/4;this.deadzone=new Phaser.Rectangle((this.width-e)/2,(this.height-e)/2,e,e);break;case Phaser.Camera.FOLLOW_TOPDOWN_TIGHT:e=Math.max(this.width,this.height)/8;this.deadzone=new Phaser.Rectangle((this.width-e)/2,(this.height-e)/2,e,e);break;case Phaser.Camera.FOLLOW_LOCKON:default:this.deadzone=null;break}},focusOnXY:function(b,c){this.view.x=Math.round(b-this.view.halfWidth);this.view.y=Math.round(c-this.view.halfHeight)},update:function(){if(this.target!==null){if(this.deadzone){this._edge=this.target.x-this.deadzone.x;if(this.view.x>this._edge){this.view.x=this._edge}this._edge=this.target.x+this.target.width-this.deadzone.x-this.deadzone.width;if(this.view.x<this._edge){this.view.x=this._edge}this._edge=this.target.y-this.deadzone.y;if(this.view.y>this._edge){this.view.y=this._edge}this._edge=this.target.y+this.target.height-this.deadzone.y-this.deadzone.height;if(this.view.y<this._edge){this.view.y=this._edge}}else{this.focusOnXY(this.target.x,this.target.y)}}this.checkWorldBounds()},checkWorldBounds:function(){this.atLimit.x=false;this.atLimit.y=false;if(this.view.x<this.world.bounds.left){this.atLimit.x=true;this.view.x=this.world.bounds.left}if(this.view.x>this.world.bounds.right-this.width){this.atLimit.x=true;this.view.x=(this.world.bounds.right-this.width)+1}if(this.view.y<this.world.bounds.top){this.atLimit.y=true;this.view.y=this.world.bounds.top}if(this.view.y>this.world.bounds.bottom-this.height){this.atLimit.y=true;this.view.y=(this.world.bounds.bottom-this.height)+1}this.view.floor()},setPosition:function(b,c){this.view.x=b;this.view.y=c;this.checkWorldBounds()},setSize:function(c,b){this.view.width=c;this.view.height=b}};Object.defineProperty(Phaser.Camera.prototype,"x",{get:function(){return this.view.x},set:function(b){this.view.x=b;this.checkWorldBounds()}});Object.defineProperty(Phaser.Camera.prototype,"y",{get:function(){return this.view.y},set:function(b){this.view.y=b;this.checkWorldBounds()}});Object.defineProperty(Phaser.Camera.prototype,"width",{get:function(){return this.view.width},set:function(b){this.view.width=b}});Object.defineProperty(Phaser.Camera.prototype,"height",{get:function(){return this.view.height},set:function(b){this.view.height=b}});Phaser.State=function(){this.game=null;this.add=null;this.camera=null;this.cache=null;this.input=null;this.load=null;this.math=null;this.sound=null;this.stage=null;this.time=null;this.tweens=null;this.world=null;this.particles=null;this.physics=null};Phaser.State.prototype={preload:function(){},create:function(){},update:function(){},render:function(){},paused:function(){},destroy:function(){}};Phaser.StateManager=function(c,b){this.game=c;this.states={};if(b!==null){this._pendingState=b}};Phaser.StateManager.prototype={game:null,_pendingState:null,_created:false,states:{},current:"",onInitCallback:null,onPreloadCallback:null,onCreateCallback:null,onUpdateCallback:null,onRenderCallback:null,onPreRenderCallback:null,onLoadUpdateCallback:null,onLoadRenderCallback:null,onPausedCallback:null,onShutDownCallback:null,boot:function(){if(this._pendingState!==null){if(typeof this._pendingState==="string"){this.start(this._pendingState,false,false)}else{this.add("default",this._pendingState,true)}}},add:function(c,d,b){if(typeof b==="undefined"){b=false}var e;if(d instanceof Phaser.State){e=d}else{if(typeof d==="object"){e=d;e.game=this.game}else{if(typeof d==="function"){e=new d(this.game)}}}this.states[c]=e;if(b){if(this.game.isBooted){this.start(c)}else{this._pendingState=c}}return e},remove:function(b){if(this.current==b){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.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null}delete this.states[b]},start:function(c,b,d){if(typeof b==="undefined"){b=true}if(typeof d==="undefined"){d=false}if(this.game.isBooted==false){this._pendingState=c;return}if(this.checkState(c)==false){return}else{if(this.current){this.onShutDownCallback.call(this.callbackContext)}if(b){this.game.world.destroy();if(d==true){this.game.cache.destroy()}}this.setCurrentState(c)}if(this.onPreloadCallback){this.game.load.reset();this.onPreloadCallback.call(this.callbackContext);if(this.game.load.queueSize==0){this.game.loadComplete()}else{this.game.load.start()}}else{this.game.loadComplete()}},dummy:function(){},checkState:function(b){if(this.states[b]){var c=false;if(this.states[b]["preload"]){c=true}if(c==false&&this.states[b]["loadRender"]){c=true}if(c==false&&this.states[b]["loadUpdate"]){c=true}if(c==false&&this.states[b]["create"]){c=true}if(c==false&&this.states[b]["update"]){c=true}if(c==false&&this.states[b]["preRender"]){c=true}if(c==false&&this.states[b]["render"]){c=true}if(c==false&&this.states[b]["paused"]){c=true}if(c==false){console.warn("Invalid Phaser State object given. Must contain at least a one of the required functions.");return false}return true}else{console.warn("Phaser.StateManager - No state found with the key: "+b);return false}},link:function(b){this.states[b].game=this.game;this.states[b].add=this.game.add;this.states[b].camera=this.game.camera;this.states[b].cache=this.game.cache;this.states[b].input=this.game.input;this.states[b].load=this.game.load;this.states[b].math=this.game.math;this.states[b].sound=this.game.sound;this.states[b].stage=this.game.stage;this.states[b].time=this.game.time;this.states[b].tweens=this.game.tweens;this.states[b].world=this.game.world;this.states[b].particles=this.game.particles;this.states[b].physics=this.game.physics;this.states[b].rnd=this.game.rnd},setCurrentState:function(b){this.callbackContext=this.states[b];this.link(b);this.onInitCallback=this.states[b]["init"]||this.dummy;this.onPreloadCallback=this.states[b]["preload"]||null;this.onLoadRenderCallback=this.states[b]["loadRender"]||null;this.onLoadUpdateCallback=this.states[b]["loadUpdate"]||null;this.onCreateCallback=this.states[b]["create"]||null;this.onUpdateCallback=this.states[b]["update"]||null;this.onPreRenderCallback=this.states[b]["preRender"]||null;this.onRenderCallback=this.states[b]["render"]||null;this.onPausedCallback=this.states[b]["paused"]||null;this.onShutDownCallback=this.states[b]["shutdown"]||this.dummy;this.current=b;this._created=false;this.onInitCallback.call(this.callbackContext)},loadComplete:function(){if(this._created==false&&this.onCreateCallback){this.onCreateCallback.call(this.callbackContext)}this._created=true},update:function(){if(this._created&&this.onUpdateCallback){this.onUpdateCallback.call(this.callbackContext)}else{if(this.onLoadUpdateCallback){this.onLoadUpdateCallback.call(this.callbackContext)}}},preRender:function(){if(this.onPreRenderCallback){this.onPreRenderCallback.call(this.callbackContext)}},render:function(){if(this._created&&this.onRenderCallback){this.onRenderCallback.call(this.callbackContext)}else{if(this.onLoadRenderCallback){this.onLoadRenderCallback.call(this.callbackContext)}}},destroy:function(){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.onRenderCallback=null;this.onPausedCallback=null;this.onDestroyCallback=null;this.game=null;this.states={};this._pendingState=null}};Phaser.LinkedList=function(){this.next=null;this.prev=null;this.first=null;this.last=null;this.total=0};Phaser.LinkedList.prototype={add:function(b){if(this.total==0&&this.first==null&&this.last==null){this.first=b;this.last=b;this.next=b;b.prev=this;this.total++;return}this.last.next=b;b.prev=this.last;this.last=b;this.total++;return b},remove:function(c){if(this.first==null&&this.last==null){return}this.total--;if(this.first==c&&this.last==c){this.first=null;this.last=null;this.next=null;c.next=null;c.prev=null;return}var b=c.prev;if(c.next){c.next.prev=c.prev}b.next=c.next},callAll:function(c){if(!this.first||!this.last){return}var b=this.first;do{if(b&&b[c]){b[c].call(b)}b=b.next}while(b!=this.last.next)},dump:function(){var j=20;var e="\n"+Phaser.Utils.pad("Node",j)+"|"+Phaser.Utils.pad("Next",j)+"|"+Phaser.Utils.pad("Previous",j)+"|"+Phaser.Utils.pad("First",j)+"|"+Phaser.Utils.pad("Last",j);console.log(e);var e=Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j);console.log(e);var g=this;var c=g.last.next;g=g.first;do{var d=g.sprite.name||"*";var f="-";var b="-";var h="-";var i="-";if(g.next){f=g.next.sprite.name}if(g.prev){b=g.prev.sprite.name}if(g.first){h=g.first.sprite.name}if(g.last){i=g.last.sprite.name}if(typeof f==="undefined"){f="-"}if(typeof b==="undefined"){b="-"}if(typeof h==="undefined"){h="-"}if(typeof i==="undefined"){i="-"}var e=Phaser.Utils.pad(d,j)+"|"+Phaser.Utils.pad(f,j)+"|"+Phaser.Utils.pad(b,j)+"|"+Phaser.Utils.pad(h,j)+"|"+Phaser.Utils.pad(i,j);console.log(e);g=g.next}while(g!=c)}};Phaser.Signal=function(){this._bindings=[];this._prevParams=null;var b=this;this.dispatch=function(){Phaser.Signal.prototype.dispatch.apply(b,arguments)}};Phaser.Signal.prototype={memorize:false,_shouldPropagate:true,active:true,validateListener:function(b,c){if(typeof b!=="function"){throw new Error("listener is a required param of {fn}() and should be a Function.".replace("{fn}",c))}},_registerListener:function(f,d,e,c){var b=this._indexOfListener(f,e),g;if(b!==-1){g=this._bindings[b];if(g.isOnce()!==d){throw new Error("You cannot add"+(d?"":"Once")+"() then add"+(!d?"":"Once")+"() the same listener without removing the relationship first.")}}else{g=new Phaser.SignalBinding(this,f,d,e,c);this._addBinding(g)}if(this.memorize&&this._prevParams){g.execute(this._prevParams)}return g},_addBinding:function(b){var c=this._bindings.length;do{--c}while(this._bindings[c]&&b._priority<=this._bindings[c]._priority);this._bindings.splice(c+1,0,b)},_indexOfListener:function(c,b){var e=this._bindings.length,d;while(e--){d=this._bindings[e];if(d._listener===c&&d.context===b){return e}}return -1},has:function(c,b){return this._indexOfListener(c,b)!==-1},add:function(d,c,b){this.validateListener(d,"add");return this._registerListener(d,false,c,b)},addOnce:function(d,c,b){this.validateListener(d,"addOnce");return this._registerListener(d,true,c,b)},remove:function(d,c){this.validateListener(d,"remove");var b=this._indexOfListener(d,c);if(b!==-1){this._bindings[b]._destroy();this._bindings.splice(b,1)}return d},removeAll:function(){var b=this._bindings.length;while(b--){this._bindings[b]._destroy()}this._bindings.length=0},getNumListeners:function(){return this._bindings.length},halt:function(){this._shouldPropagate=false},dispatch:function(c){if(!this.active){return}var b=Array.prototype.slice.call(arguments),e=this._bindings.length,d;if(this.memorize){this._prevParams=b}if(!e){return}d=this._bindings.slice();this._shouldPropagate=true;do{e--}while(d[e]&&this._shouldPropagate&&d[e].execute(b)!==false)},forget:function(){this._prevParams=null},dispose:function(){this.removeAll();delete this._bindings;delete this._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}};Phaser.SignalBinding=function(f,e,c,d,b){this._listener=e;this._isOnce=c;this.context=d;this._signal=f;this._priority=b||0};Phaser.SignalBinding.prototype={active:true,params:null,execute:function(b){var d,c;if(this.active&&!!this._listener){c=this.params?this.params.concat(b):b;d=this._listener.apply(this.context,c);if(this._isOnce){this.detach()}}return d},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+"]"}};Phaser.Plugin=function(b,c){this.game=b;this.parent=c;this.active=false;this.visible=false;this.hasPreUpdate=false;this.hasUpdate=false;this.hasRender=false;this.hasPostRender=false};Phaser.Plugin.prototype={preUpdate:function(){},update:function(){},render:function(){},postRender:function(){},destroy:function(){this.game=null;this.parent=null;this.active=false;this.visible=false}};Phaser.PluginManager=function(b,c){this.game=b;this._parent=c;this.plugins=[];this._pluginsLength=0};Phaser.PluginManager.prototype={add:function(c){var b=false;if(typeof c==="function"){c=new c(this.game,this._parent)}else{c.game=this.game;c.parent=this._parent}if(typeof c.preUpdate==="function"){c.hasPreUpdate=true;b=true}if(typeof c.update==="function"){c.hasUpdate=true;b=true}if(typeof c.render==="function"){c.hasRender=true;b=true}if(typeof c.postRender==="function"){c.hasPostRender=true;b=true}if(b){if(c.hasPreUpdate||c.hasUpdate){c.active=true}if(c.hasRender||c.hasPostRender){c.visible=true}this._pluginsLength=this.plugins.push(c);return c}else{return null}},remove:function(b){this._pluginsLength--},preUpdate:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].active&&this.plugins[this._p].hasPreUpdate){this.plugins[this._p].preUpdate()}}},update:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].active&&this.plugins[this._p].hasUpdate){this.plugins[this._p].update()}}},render:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].visible&&this.plugins[this._p].hasRender){this.plugins[this._p].render()}}},postRender:function(){if(this._pluginsLength==0){return}for(this._p=0;this._p<this._pluginsLength;this._p++){if(this.plugins[this._p].visible&&this.plugins[this._p].hasPostRender){this.plugins[this._p].postRender()}}},destroy:function(){this.plugins.length=0;this._pluginsLength=0;this.game=null;this._parent=null}};Phaser.Stage=function(c,d,b){this.game=c;this._backgroundColor="rgb(0,0,0)";this.offset=new Phaser.Point;this.canvas=Phaser.Canvas.create(d,b);this.canvas.style["-webkit-full-screen"]="width: 100%; height: 100%";this._stage=new PIXI.Stage(0,false);this._stage.name="_stage_root";this.scaleMode=Phaser.StageScaleMode.NO_SCALE;this.scale=new Phaser.StageScaleMode(this.game,d,b);this.aspectRatio=d/b};Phaser.Stage.prototype={boot:function(){Phaser.Canvas.getOffset(this.canvas,this.offset);this.bounds=new Phaser.Rectangle(this.offset.x,this.offset.y,this.game.width,this.game.height);var b=this;this._onChange=function(c){return b.visibilityChange(c)};document.addEventListener("visibilitychange",this._onChange,false);document.addEventListener("webkitvisibilitychange",this._onChange,false);document.addEventListener("pagehide",this._onChange,false);document.addEventListener("pageshow",this._onChange,false);window.onblur=this._onChange;window.onfocus=this._onChange},visibilityChange:function(b){if(this.disableVisibilityChange){return}if(b.type=="pagehide"||b.type=="blur"||document.hidden==true||document.webkitHidden==true){this.game.paused=true}else{this.game.paused=false}}};Object.defineProperty(Phaser.Stage.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(b){this._backgroundColor=b;if(typeof b==="string"){b=Phaser.Color.hexToRGB(b)}this._stage.setBackgroundColor(b)}});Phaser.Group=function(b,e,d,c){e=e||null;if(typeof c=="undefined"){c=false}this.game=b;this.name=d||"group";if(c){this._container=this.game.stage._stage}else{this._container=new PIXI.DisplayObjectContainer();this._container.name=this.name;if(e){if(e instanceof Phaser.Group){e._container.addChild(this._container)}else{e.addChild(this._container)}}else{this.game.stage._stage.addChild(this._container)}}this.type=Phaser.GROUP;this.exists=true;this._sortIndex="y"};Phaser.Group.prototype={add:function(b){if(b.group!==this){b.group=this;if(b.events){b.events.onAddedToGroup.dispatch(b,this)}this._container.addChild(b)}return b},addAt:function(c,b){if(c.group!==this){c.group=this;if(c.events){c.events.onAddedToGroup.dispatch(c,this)}this._container.addChildAt(c,b)}return c},getAt:function(b){return this._container.getChildAt(b)},create:function(b,g,c,e,d){if(typeof d=="undefined"){d=true}var f=new Phaser.Sprite(this.game,b,g,c,e);f.group=this;f.exists=d;if(f.events){f.events.onAddedToGroup.dispatch(f,this)}this._container.addChild(f);return f},swap:function(i,g){if(i===g||!i.parent||!g.parent){console.warn("You cannot swap a child with itself or swap un-parented children");return false}var d=i._iPrev;var c=i._iNext;var h=g._iPrev;var f=g._iNext;var b=this._container.last._iNext;var e=this.game.stage._stage;do{if(e!==i&&e!==g){if(e.first===i){e.first=g}else{if(e.first===g){e.first=i}}if(e.last===i){e.last=g}else{if(e.last===g){e.last=i}}}e=e._iNext}while(e!=b);if(i._iNext==g){i._iNext=f;i._iPrev=g;g._iNext=i;g._iPrev=d;if(d){d._iNext=g}if(f){f._iPrev=i}if(i.__renderGroup){i.__renderGroup.updateTexture(i)}if(g.__renderGroup){g.__renderGroup.updateTexture(g)}return true}else{if(g._iNext==i){i._iNext=g;i._iPrev=h;g._iNext=c;g._iPrev=i;if(h){h._iNext=i}if(c){f._iPrev=g}if(i.__renderGroup){i.__renderGroup.updateTexture(i)}if(g.__renderGroup){g.__renderGroup.updateTexture(g)}return true}else{i._iNext=f;i._iPrev=h;g._iNext=c;g._iPrev=d;if(d){d._iNext=g}if(c){c._iPrev=g}if(h){h._iNext=i}if(f){f._iPrev=i}if(i.__renderGroup){i.__renderGroup.updateTexture(i)}if(g.__renderGroup){g.__renderGroup.updateTexture(g)}return true}}return false},bringToTop:function(b){if(b.group===this){this.remove(b);this.add(b)}return b},getIndex:function(b){return this._container.children.indexOf(b)},replace:function(d,b){if(!this._container.first._iNext){return}var c=this.getIndex(d);if(c!=-1){if(b.parent!=undefined){b.events.onRemovedFromGroup.dispatch(b,this);b.parent.removeChild(b)}this._container.removeChild(d);this._container.addChildAt(b,c);b.events.onAddedToGroup.dispatch(b,this)}},setProperty:function(e,c,d,b){b=b||0;if(c.length==1){if(b==0){e[c[0]]=d}else{if(b==1){e[c[0]]+=d}else{if(b==2){e[c[0]]-=d}else{if(b==3){e[c[0]]*=d}else{if(b==4){e[c[0]]/=d}}}}}}else{if(c.length==2){if(b==0){e[c[0]][c[1]]=d}else{if(b==1){e[c[0]][c[1]]+=d}else{if(b==2){e[c[0]][c[1]]-=d}else{if(b==3){e[c[0]][c[1]]*=d}else{if(b==4){e[c[0]][c[1]]/=d}}}}}}else{if(c.length==3){if(b==0){e[c[0]][c[1]][c[2]]=d}else{if(b==1){e[c[0]][c[1]][c[2]]+=d}else{if(b==2){e[c[0]][c[1]][c[2]]-=d}else{if(b==3){e[c[0]][c[1]][c[2]]*=d}else{if(b==4){e[c[0]][c[1]][c[2]]/=d}}}}}}else{if(c.length==4){if(b==0){e[c[0]][c[1]][c[2]][c[3]]=d}else{if(b==1){e[c[0]][c[1]][c[2]][c[3]]+=d}else{if(b==2){e[c[0]][c[1]][c[2]][c[3]]-=d}else{if(b==3){e[c[0]][c[1]][c[2]][c[3]]*=d}else{if(b==4){e[c[0]][c[1]][c[2]][c[3]]/=d}}}}}}else{}}}}},setAll:function(e,f,c,g,b){e=e.split(".");c=c||false;g=g||false;b=b||0;if(this._container.children.length>0&&this._container.first._iNext){var d=this._container.first._iNext;do{if((c==false||(c&&d.alive))&&(g==false||(g&&d.visible))){this.setProperty(d,e,f,b)}d=d._iNext}while(d!=this._container.last._iNext)}},addAll:function(c,d,b,e){this.setAll(c,d,b,e,1)},subAll:function(c,d,b,e){this.setAll(c,d,b,e,2)},multiplyAll:function(c,d,b,e){this.setAll(c,d,b,e,3)},divideAll:function(c,d,b,e){this.setAll(c,d,b,e,4)},callAllExists:function(f,b,e){var c=Array.prototype.splice.call(arguments,3);if(this._container.children.length>0&&this._container.first._iNext){var d=this._container.first._iNext;do{if(d.exists==e&&d[f]){d[f].apply(d,c)}d=d._iNext}while(d!=this._container.last._iNext)}},callAll:function(e,b){var c=Array.prototype.splice.call(arguments,2);if(this._container.children.length>0&&this._container.first._iNext){var d=this._container.first._iNext;do{if(d[e]){d[e].apply(d,c)}d=d._iNext}while(d!=this._container.last._iNext)}},forEach:function(e,b,d){if(typeof d=="undefined"){d=false}if(this._container.children.length>0&&this._container.first._iNext){var c=this._container.first._iNext;do{if(d==false||(d&&c.exists)){e.call(b,c)}c=c._iNext}while(c!=this._container.last._iNext)}},forEachAlive:function(d,b){if(this._container.children.length>0&&this._container.first._iNext){var c=this._container.first._iNext;do{if(c.alive){d.call(b,c)}c=c._iNext}while(c!=this._container.last._iNext)}},forEachDead:function(d,b){if(this._container.children.length>0&&this._container.first._iNext){var c=this._container.first._iNext;do{if(c.alive==false){d.call(b,c)}c=c._iNext}while(c!=this._container.last._iNext)}},getFirstExists:function(c){if(typeof c!=="boolean"){c=true}if(this._container.children.length>0&&this._container.first._iNext){var b=this._container.first._iNext;do{if(b.exists===c){return b}b=b._iNext}while(b!=this._container.last._iNext)}return null},getFirstAlive:function(){if(this._container.children.length>0&&this._container.first._iNext){var b=this._container.first._iNext;do{if(b.alive){return b}b=b._iNext}while(b!=this._container.last._iNext)}return null},getFirstDead:function(){if(this._container.children.length>0&&this._container.first._iNext){var b=this._container.first._iNext;do{if(!b.alive){return b}b=b._iNext}while(b!=this._container.last._iNext)}return null},countLiving:function(){var c=-1;if(this._container.children.length>0&&this._container.first._iNext){var b=this._container.first._iNext;do{if(b.alive){c++}b=b._iNext}while(b!=this._container.last._iNext)}return c},countDead:function(){var c=-1;if(this._container.children.length>0&&this._container.first._iNext){var b=this._container.first._iNext;do{if(!b.alive){c++}b=b._iNext}while(b!=this._container.last._iNext)}return c},getRandom:function(c,b){if(this._container.children.length==0){return null}c=c||0;b=b||this._container.children.length;return this.game.math.getRandom(this._container.children,c,b)},remove:function(b){b.events.onRemovedFromGroup.dispatch(b,this);this._container.removeChild(b);b.group=null},removeAll:function(){if(this._container.children.length==0){return}do{if(this._container.children[0].events){this._container.children[0].events.onRemovedFromGroup.dispatch(this._container.children[0],this)}this._container.removeChild(this._container.children[0])}while(this._container.children.length>0)},removeBetween:function(d,c){if(this._container.children.length==0){return}if(d>c||d<0||c>this._container.children.length){return false}for(var b=d;b<c;b++){var e=this._container.children[b];e.events.onRemovedFromGroup.dispatch(e,this);this._container.removeChild(e)}},destroy:function(){this.removeAll();this._container.parent.removeChild(this._container);this._container=null;this.game=null;this.exists=false},dump:function(h){if(typeof h=="undefined"){h=false}var j=20;var e="\n"+Phaser.Utils.pad("Node",j)+"|"+Phaser.Utils.pad("Next",j)+"|"+Phaser.Utils.pad("Previous",j)+"|"+Phaser.Utils.pad("First",j)+"|"+Phaser.Utils.pad("Last",j);console.log(e);var e=Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j)+"|"+Phaser.Utils.pad("----------",j);console.log(e);if(h){var c=this.game.stage._stage.last._iNext;var k=this.game.stage._stage}else{var c=this._container.last._iNext;var k=this._container}do{var d=k.name||"*";var f="-";var b="-";var g="-";var i="-";if(k._iNext){f=k._iNext.name}if(k._iPrev){b=k._iPrev.name}if(k.first){g=k.first.name}if(k.last){i=k.last.name}if(typeof f==="undefined"){f="-"}if(typeof b==="undefined"){b="-"}if(typeof g==="undefined"){g="-"}if(typeof i==="undefined"){i="-"}var e=Phaser.Utils.pad(d,j)+"|"+Phaser.Utils.pad(f,j)+"|"+Phaser.Utils.pad(b,j)+"|"+Phaser.Utils.pad(g,j)+"|"+Phaser.Utils.pad(i,j);console.log(e);k=k._iNext}while(k!=c)}};Object.defineProperty(Phaser.Group.prototype,"length",{get:function(){return this._container.children.length}});Object.defineProperty(Phaser.Group.prototype,"x",{get:function(){return this._container.position.x},set:function(b){this._container.position.x=b}});Object.defineProperty(Phaser.Group.prototype,"y",{get:function(){return this._container.position.y},set:function(b){this._container.position.y=b}});Object.defineProperty(Phaser.Group.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this._container.rotation)},set:function(b){this._container.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Group.prototype,"rotation",{get:function(){return this._container.rotation},set:function(b){this._container.rotation=b}});Object.defineProperty(Phaser.Group.prototype,"visible",{get:function(){return this._container.visible},set:function(b){this._container.visible=b}});Phaser.World=function(b){this.game=b;this.bounds=new Phaser.Rectangle(0,0,b.width,b.height);this.camera=null;this.currentRenderOrderID=0;this.group=null};Phaser.World.prototype={boot:function(){this.camera=new Phaser.Camera(this.game,0,0,0,this.game.width,this.game.height);this.game.camera=this.camera;this.group=new Phaser.Group(this.game,null,"__world",true)},update:function(){this.camera.update();this.currentRenderOrderID=0;if(this.game.stage._stage.first._iNext){var b=this.game.stage._stage.first._iNext;do{if(b.preUpdate){b.preUpdate()}if(b.update){b.update()}b=b._iNext}while(b!=this.game.stage._stage.last._iNext)}},setSize:function(c,b){if(c>=this.game.width){this.bounds.width=c}if(b>=this.game.height){this.bounds.height=b}},destroy:function(){this.camera.x=0;this.camera.y=0;this.game.input.reset(true);this.group.removeAll()}};Object.defineProperty(Phaser.World.prototype,"width",{get:function(){return this.bounds.width},set:function(b){this.bounds.width=b}});Object.defineProperty(Phaser.World.prototype,"height",{get:function(){return this.bounds.height},set:function(b){this.bounds.height=b}});Object.defineProperty(Phaser.World.prototype,"centerX",{get:function(){return this.bounds.halfWidth}});Object.defineProperty(Phaser.World.prototype,"centerY",{get:function(){return this.bounds.halfHeight}});Object.defineProperty(Phaser.World.prototype,"randomX",{get:function(){return Math.round(Math.random()*this.bounds.width)}});Object.defineProperty(Phaser.World.prototype,"randomY",{get:function(){return Math.round(Math.random()*this.bounds.height)}});Phaser.Game=function(e,b,g,d,f,h,c){e=e||800;b=b||600;g=g||Phaser.AUTO;d=d||"";f=f||null;h=h||false;c=c||true;this.id=Phaser.GAMES.push(this)-1;this.parent=d;this.width=e;this.height=b;this.transparent=h;this.antialias=c;this.renderer=null;this.state=new Phaser.StateManager(this,f);this._paused=false;this.renderType=g;this._loadComplete=false;this.isBooted=false;this.isRunning=false;this.raf=null;this.add=null;this.cache=null;this.input=null;this.load=null;this.math=null;this.net=null;this.sound=null;this.stage=null;this.time=null;this.tweens=null;this.world=null;this.physics=null;this.rnd=null;this.device=null;this.camera=null;this.canvas=null;this.context=null;this.debug=null;this.particles=null;var i=this;this._onBoot=function(){return i.boot()};if(document.readyState==="complete"||document.readyState==="interactive"){window.setTimeout(this._onBoot,0)}else{document.addEventListener("DOMContentLoaded",this._onBoot,false);window.addEventListener("load",this._onBoot,false)}return this};Phaser.Game.prototype={boot:function(){if(this.isBooted){return}if(!document.body){window.setTimeout(this._onBoot,20)}else{document.removeEventListener("DOMContentLoaded",this._onBoot);window.removeEventListener("load",this._onBoot);this.onPause=new Phaser.Signal;this.onResume=new Phaser.Signal;this.isBooted=true;this.device=new Phaser.Device();this.math=Phaser.Math;this.rnd=new Phaser.RandomDataGenerator([(Date.now()*Math.random()).toString()]);this.stage=new Phaser.Stage(this,this.width,this.height);this.setUpRenderer();this.world=new Phaser.World(this);this.add=new Phaser.GameObjectFactory(this);this.cache=new Phaser.Cache(this);this.load=new Phaser.Loader(this);this.time=new Phaser.Time(this);this.tweens=new Phaser.TweenManager(this);this.input=new Phaser.Input(this);this.sound=new Phaser.SoundManager(this);this.physics=new Phaser.Physics.Arcade(this);this.particles=new Phaser.Particles(this);this.plugins=new Phaser.PluginManager(this,this);this.net=new Phaser.Net(this);this.debug=new Phaser.Utils.Debug(this);this.load.onLoadComplete.add(this.loadComplete,this);this.stage.boot();this.world.boot();this.input.boot();this.sound.boot();this.state.boot();if(this.renderType==Phaser.CANVAS){console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to Canvas","color: #ffff33; background: #000000")}else{console.log("%cPhaser "+Phaser.VERSION+" initialized. Rendering to WebGL","color: #ffff33; background: #000000")}this.isRunning=true;this._loadComplete=false;this.raf=new Phaser.RequestAnimationFrame(this);this.raf.start()}},setUpRenderer:function(){if(this.renderType===Phaser.CANVAS||(this.renderType===Phaser.AUTO&&this.device.webGL==false)){if(this.device.canvas){this.renderType=Phaser.CANVAS;this.renderer=new PIXI.CanvasRenderer(this.width,this.height,this.stage.canvas,this.transparent);Phaser.Canvas.setSmoothingEnabled(this.renderer.context,this.antialias);this.canvas=this.renderer.view;this.context=this.renderer.context}else{throw new Error("Phaser.Game - cannot create Canvas or WebGL context, aborting.")}}else{this.renderType=Phaser.WEBGL;this.renderer=new PIXI.WebGLRenderer(this.width,this.height,this.stage.canvas,this.transparent,this.antialias);this.canvas=this.renderer.view;this.context=null}Phaser.Canvas.addToDOM(this.renderer.view,this.parent,true);Phaser.Canvas.setTouchAction(this.renderer.view)},loadComplete:function(){this._loadComplete=true;this.state.loadComplete()},update:function(b){this.time.update(b);if(!this._paused){this.plugins.preUpdate();this.physics.preUpdate();this.input.update();this.tweens.update();this.sound.update();this.world.update();this.particles.update();this.state.update();this.plugins.update();this.renderer.render(this.stage._stage);this.plugins.render();this.state.render();this.plugins.postRender()}},destroy:function(){this.state.destroy();this.state=null;this.cache=null;this.input=null;this.load=null;this.sound=null;this.stage=null;this.time=null;this.world=null;this.isBooted=false}};Object.defineProperty(Phaser.Game.prototype,"paused",{get:function(){return this._paused},set:function(b){if(b===true){if(this._paused==false){this._paused=true;this.onPause.dispatch(this)}}else{if(this._paused){this._paused=false;this.onResume.dispatch(this)}}}});Phaser.Input=function(b){this.game=b;this.hitCanvas=null;this.hitContext=null};Phaser.Input.MOUSE_OVERRIDES_TOUCH=0;Phaser.Input.TOUCH_OVERRIDES_MOUSE=1;Phaser.Input.MOUSE_TOUCH_COMBINE=2;Phaser.Input.prototype={game:null,pollRate:0,_pollCounter:0,_oldPosition:null,_x:0,_y:0,disabled:false,multiInputOverride:Phaser.Input.MOUSE_TOUCH_COMBINE,position:null,speed:null,circle:null,scale:null,maxPointers:10,currentPointers:0,tapRate:200,doubleTapRate:300,holdRate:2000,justPressedRate:200,justReleasedRate:200,recordPointerHistory:false,recordRate:100,recordLimit:100,pointer1:null,pointer2:null,pointer3:null,pointer4:null,pointer5:null,pointer6:null,pointer7:null,pointer8:null,pointer9:null,pointer10:null,activePointer:null,mousePointer:null,mouse:null,keyboard:null,touch:null,mspointer:null,onDown:null,onUp:null,onTap:null,onHold:null,interactiveItems:new Phaser.LinkedList(),boot:function(){this.mousePointer=new Phaser.Pointer(this.game,0);this.pointer1=new Phaser.Pointer(this.game,1);this.pointer2=new Phaser.Pointer(this.game,2);this.mouse=new Phaser.Mouse(this.game);this.keyboard=new Phaser.Keyboard(this.game);this.touch=new Phaser.Touch(this.game);this.mspointer=new Phaser.MSPointer(this.game);this.onDown=new Phaser.Signal();this.onUp=new Phaser.Signal();this.onTap=new Phaser.Signal();this.onHold=new Phaser.Signal();this.scale=new Phaser.Point(1,1);this.speed=new Phaser.Point();this.position=new Phaser.Point();this._oldPosition=new Phaser.Point();this.circle=new Phaser.Circle(0,0,44);this.activePointer=this.mousePointer;this.currentPointers=0;this.hitCanvas=document.createElement("canvas");this.hitCanvas.width=1;this.hitCanvas.height=1;this.hitContext=this.hitCanvas.getContext("2d");this.mouse.start();this.keyboard.start();this.touch.start();this.mspointer.start();this.mousePointer.active=true},addPointer:function(){var c=0;for(var b=10;b>0;b--){if(this["pointer"+b]===null){c=b}}if(c==0){console.warn("You can only have 10 Pointer objects");return null}else{this["pointer"+c]=new Phaser.Pointer(this.game,c);return this["pointer"+c]}},update:function(){if(this.pollRate>0&&this._pollCounter<this.pollRate){this._pollCounter++;return}this.speed.x=this.position.x-this._oldPosition.x;this.speed.y=this.position.y-this._oldPosition.y;this._oldPosition.copyFrom(this.position);this.mousePointer.update();this.pointer1.update();this.pointer2.update();if(this.pointer3){this.pointer3.update()}if(this.pointer4){this.pointer4.update()}if(this.pointer5){this.pointer5.update()}if(this.pointer6){this.pointer6.update()}if(this.pointer7){this.pointer7.update()}if(this.pointer8){this.pointer8.update()}if(this.pointer9){this.pointer9.update()}if(this.pointer10){this.pointer10.update()}this._pollCounter=0},reset:function(c){if(this.game.isBooted==false){return}if(typeof c=="undefined"){c=false}this.keyboard.reset();this.mousePointer.reset();for(var b=1;b<=10;b++){if(this["pointer"+b]){this["pointer"+b].reset()}}this.currentPointers=0;this.game.stage.canvas.style.cursor="default";if(c==true){this.onDown.dispose();this.onUp.dispose();this.onTap.dispose();this.onHold.dispose();this.onDown=new Phaser.Signal();this.onUp=new Phaser.Signal();this.onTap=new Phaser.Signal();this.onHold=new Phaser.Signal();this.interactiveItems.callAll("reset")}this._pollCounter=0},resetSpeed:function(b,c){this._oldPosition.setTo(b,c);this.speed.setTo(0,0)},startPointer:function(c){if(this.maxPointers<10&&this.totalActivePointers==this.maxPointers){return null}if(this.pointer1.active==false){return this.pointer1.start(c)}else{if(this.pointer2.active==false){return this.pointer2.start(c)}else{for(var b=3;b<=10;b++){if(this["pointer"+b]&&this["pointer"+b].active==false){return this["pointer"+b].start(c)}}}}return null},updatePointer:function(c){if(this.pointer1.active&&this.pointer1.identifier==c.identifier){return this.pointer1.move(c)}else{if(this.pointer2.active&&this.pointer2.identifier==c.identifier){return this.pointer2.move(c)}else{for(var b=3;b<=10;b++){if(this["pointer"+b]&&this["pointer"+b].active&&this["pointer"+b].identifier==c.identifier){return this["pointer"+b].move(c)}}}}return null},stopPointer:function(c){if(this.pointer1.active&&this.pointer1.identifier==c.identifier){return this.pointer1.stop(c)}else{if(this.pointer2.active&&this.pointer2.identifier==c.identifier){return this.pointer2.stop(c)}else{for(var b=3;b<=10;b++){if(this["pointer"+b]&&this["pointer"+b].active&&this["pointer"+b].identifier==c.identifier){return this["pointer"+b].stop(c)}}}}return null},getPointer:function(c){c=c||false;if(this.pointer1.active==c){return this.pointer1}else{if(this.pointer2.active==c){return this.pointer2}else{for(var b=3;b<=10;b++){if(this["pointer"+b]&&this["pointer"+b].active==c){return this["pointer"+b]}}}}return null},getPointerFromIdentifier:function(b){if(this.pointer1.identifier==b){return this.pointer1}else{if(this.pointer2.identifier==b){return this.pointer2}else{for(var c=3;c<=10;c++){if(this["pointer"+c]&&this["pointer"+c].identifier==b){return this["pointer"+c]}}}}return null},getDistance:function(c,b){},getAngle:function(c,b){}};Object.defineProperty(Phaser.Input.prototype,"x",{get:function(){return this._x},set:function(b){this._x=Math.floor(b)}});Object.defineProperty(Phaser.Input.prototype,"y",{get:function(){return this._y},set:function(b){this._y=Math.floor(b)}});Object.defineProperty(Phaser.Input.prototype,"pollLocked",{get:function(){return(this.pollRate>0&&this._pollCounter<this.pollRate)}});Object.defineProperty(Phaser.Input.prototype,"totalInactivePointers",{get:function(){return 10-this.currentPointers}});Object.defineProperty(Phaser.Input.prototype,"totalActivePointers",{get:function(){this.currentPointers=0;for(var b=1;b<=10;b++){if(this["pointer"+b]&&this["pointer"+b].active){this.currentPointers++}}return this.currentPointers}});Object.defineProperty(Phaser.Input.prototype,"worldX",{get:function(){return this.game.camera.view.x+this.x}});Object.defineProperty(Phaser.Input.prototype,"worldY",{get:function(){return this.game.camera.view.y+this.y}});Phaser.Keyboard=function(b){this.game=b;this._keys={};this._capture={}};Phaser.Keyboard.prototype={game:null,disabled:false,_onKeyDown:null,_onKeyUp:null,start:function(){var b=this;this._onKeyDown=function(c){return b.onKeyDown(c)};this._onKeyUp=function(c){return b.onKeyUp(c)};document.body.addEventListener("keydown",this._onKeyDown,false);document.body.addEventListener("keyup",this._onKeyUp,false)},stop:function(){document.body.removeEventListener("keydown",this._onKeyDown);document.body.removeEventListener("keyup",this._onKeyUp)},addKeyCapture:function(b){if(typeof b==="object"){for(var c in b){this._capture[b[c]]=true}}else{this._capture[b]=true}},removeKeyCapture:function(b){delete this._capture[b]},clearCaptures:function(){this._capture={}},onKeyDown:function(b){if(this.game.input.disabled||this.disabled){return}if(this._capture[b.keyCode]){b.preventDefault()}if(!this._keys[b.keyCode]){this._keys[b.keyCode]={isDown:true,timeDown:this.game.time.now,timeUp:0}}else{this._keys[b.keyCode].isDown=true;this._keys[b.keyCode].timeDown=this.game.time.now}},onKeyUp:function(b){if(this.game.input.disabled||this.disabled){return}if(this._capture[b.keyCode]){b.preventDefault()}if(!this._keys[b.keyCode]){this._keys[b.keyCode]={isDown:false,timeDown:0,timeUp:this.game.time.now}}else{this._keys[b.keyCode].isDown=false;this._keys[b.keyCode].timeUp=this.game.time.now}},reset:function(){for(var b in this._keys){this._keys[b].isDown=false}},justPressed:function(b,c){if(typeof c==="undefined"){c=250}if(this._keys[b]&&this._keys[b].isDown===true&&(this.game.time.now-this._keys[b].timeDown<c)){return true}return false},justReleased:function(b,c){if(typeof c==="undefined"){c=250}if(this._keys[b]&&this._keys[b].isDown===false&&(this.game.time.now-this._keys[b].timeUp<c)){return true}return false},isDown:function(b){if(this._keys[b]){return this._keys[b].isDown}return false}};Phaser.Keyboard.A="A".charCodeAt(0);Phaser.Keyboard.B="B".charCodeAt(0);Phaser.Keyboard.C="C".charCodeAt(0);Phaser.Keyboard.D="D".charCodeAt(0);Phaser.Keyboard.E="E".charCodeAt(0);Phaser.Keyboard.F="F".charCodeAt(0);Phaser.Keyboard.G="G".charCodeAt(0);Phaser.Keyboard.H="H".charCodeAt(0);Phaser.Keyboard.I="I".charCodeAt(0);Phaser.Keyboard.J="J".charCodeAt(0);Phaser.Keyboard.K="K".charCodeAt(0);Phaser.Keyboard.L="L".charCodeAt(0);Phaser.Keyboard.M="M".charCodeAt(0);Phaser.Keyboard.N="N".charCodeAt(0);Phaser.Keyboard.O="O".charCodeAt(0);Phaser.Keyboard.P="P".charCodeAt(0);Phaser.Keyboard.Q="Q".charCodeAt(0);Phaser.Keyboard.R="R".charCodeAt(0);Phaser.Keyboard.S="S".charCodeAt(0);Phaser.Keyboard.T="T".charCodeAt(0);Phaser.Keyboard.U="U".charCodeAt(0);Phaser.Keyboard.V="V".charCodeAt(0);Phaser.Keyboard.W="W".charCodeAt(0);Phaser.Keyboard.X="X".charCodeAt(0);Phaser.Keyboard.Y="Y".charCodeAt(0);Phaser.Keyboard.Z="Z".charCodeAt(0);Phaser.Keyboard.ZERO="0".charCodeAt(0);Phaser.Keyboard.ONE="1".charCodeAt(0);Phaser.Keyboard.TWO="2".charCodeAt(0);Phaser.Keyboard.THREE="3".charCodeAt(0);Phaser.Keyboard.FOUR="4".charCodeAt(0);Phaser.Keyboard.FIVE="5".charCodeAt(0);Phaser.Keyboard.SIX="6".charCodeAt(0);Phaser.Keyboard.SEVEN="7".charCodeAt(0);Phaser.Keyboard.EIGHT="8".charCodeAt(0);Phaser.Keyboard.NINE="9".charCodeAt(0);Phaser.Keyboard.NUMPAD_0=96;Phaser.Keyboard.NUMPAD_1=97;Phaser.Keyboard.NUMPAD_2=98;Phaser.Keyboard.NUMPAD_3=99;Phaser.Keyboard.NUMPAD_4=100;Phaser.Keyboard.NUMPAD_5=101;Phaser.Keyboard.NUMPAD_6=102;Phaser.Keyboard.NUMPAD_7=103;Phaser.Keyboard.NUMPAD_8=104;Phaser.Keyboard.NUMPAD_9=105;Phaser.Keyboard.NUMPAD_MULTIPLY=106;Phaser.Keyboard.NUMPAD_ADD=107;Phaser.Keyboard.NUMPAD_ENTER=108;Phaser.Keyboard.NUMPAD_SUBTRACT=109;Phaser.Keyboard.NUMPAD_DECIMAL=110;Phaser.Keyboard.NUMPAD_DIVIDE=111;Phaser.Keyboard.F1=112;Phaser.Keyboard.F2=113;Phaser.Keyboard.F3=114;Phaser.Keyboard.F4=115;Phaser.Keyboard.F5=116;Phaser.Keyboard.F6=117;Phaser.Keyboard.F7=118;Phaser.Keyboard.F8=119;Phaser.Keyboard.F9=120;Phaser.Keyboard.F10=121;Phaser.Keyboard.F11=122;Phaser.Keyboard.F12=123;Phaser.Keyboard.F13=124;Phaser.Keyboard.F14=125;Phaser.Keyboard.F15=126;Phaser.Keyboard.COLON=186;Phaser.Keyboard.EQUALS=187;Phaser.Keyboard.UNDERSCORE=189;Phaser.Keyboard.QUESTION_MARK=191;Phaser.Keyboard.TILDE=192;Phaser.Keyboard.OPEN_BRACKET=219;Phaser.Keyboard.BACKWARD_SLASH=220;Phaser.Keyboard.CLOSED_BRACKET=221;Phaser.Keyboard.QUOTES=222;Phaser.Keyboard.BACKSPACE=8;Phaser.Keyboard.TAB=9;Phaser.Keyboard.CLEAR=12;Phaser.Keyboard.ENTER=13;Phaser.Keyboard.SHIFT=16;Phaser.Keyboard.CONTROL=17;Phaser.Keyboard.ALT=18;Phaser.Keyboard.CAPS_LOCK=20;Phaser.Keyboard.ESC=27;Phaser.Keyboard.SPACEBAR=32;Phaser.Keyboard.PAGE_UP=33;Phaser.Keyboard.PAGE_DOWN=34;Phaser.Keyboard.END=35;Phaser.Keyboard.HOME=36;Phaser.Keyboard.LEFT=37;Phaser.Keyboard.UP=38;Phaser.Keyboard.RIGHT=39;Phaser.Keyboard.DOWN=40;Phaser.Keyboard.INSERT=45;Phaser.Keyboard.DELETE=46;Phaser.Keyboard.HELP=47;Phaser.Keyboard.NUM_LOCK=144;Phaser.Mouse=function(b){this.game=b;this.callbackContext=this.game;this.mouseDownCallback=null;this.mouseMoveCallback=null;this.mouseUpCallback=null};Phaser.Mouse.LEFT_BUTTON=0;Phaser.Mouse.MIDDLE_BUTTON=1;Phaser.Mouse.RIGHT_BUTTON=2;Phaser.Mouse.prototype={game:null,disabled:false,locked:false,start:function(){var b=this;if(this.game.device.android&&this.game.device.chrome==false){return}this._onMouseDown=function(c){return b.onMouseDown(c)};this._onMouseMove=function(c){return b.onMouseMove(c)};this._onMouseUp=function(c){return b.onMouseUp(c)};this.game.renderer.view.addEventListener("mousedown",this._onMouseDown,true);this.game.renderer.view.addEventListener("mousemove",this._onMouseMove,true);this.game.renderer.view.addEventListener("mouseup",this._onMouseUp,true)},onMouseDown:function(b){if(this.mouseDownCallback){this.mouseDownCallback.call(this.callbackContext,b)}if(this.game.input.disabled||this.disabled){return}b.identifier=0;this.game.input.mousePointer.start(b)},onMouseMove:function(b){if(this.mouseMoveCallback){this.mouseMoveCallback.call(this.callbackContext,b)}if(this.game.input.disabled||this.disabled){return}b.identifier=0;this.game.input.mousePointer.move(b)},onMouseUp:function(b){if(this.mouseUpCallback){this.mouseUpCallback.call(this.callbackContext,b)}if(this.game.input.disabled||this.disabled){return}b.identifier=0;this.game.input.mousePointer.stop(b)},requestPointerLock:function(){if(this.game.device.pointerLock){var b=this.game.stage.canvas;b.requestPointerLock=b.requestPointerLock||b.mozRequestPointerLock||b.webkitRequestPointerLock;b.requestPointerLock();var c=this;this._pointerLockChange=function(d){return c.pointerLockChange(d)};document.addEventListener("pointerlockchange",this._pointerLockChange,false);document.addEventListener("mozpointerlockchange",this._pointerLockChange,false);document.addEventListener("webkitpointerlockchange",this._pointerLockChange,false)}},pointerLockChange:function(c){var b=this.game.stage.canvas;if(document.pointerLockElement===b||document.mozPointerLockElement===b||document.webkitPointerLockElement===b){this.locked=true}else{this.locked=false}},releasePointerLock:function(){document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock;document.exitPointerLock();document.removeEventListener("pointerlockchange",this._pointerLockChange);document.removeEventListener("mozpointerlockchange",this._pointerLockChange);document.removeEventListener("webkitpointerlockchange",this._pointerLockChange)},stop:function(){this.game.stage.canvas.removeEventListener("mousedown",this._onMouseDown);this.game.stage.canvas.removeEventListener("mousemove",this._onMouseMove);this.game.stage.canvas.removeEventListener("mouseup",this._onMouseUp)}};Phaser.MSPointer=function(b){this.game=b;this.callbackContext=this.game;this.mouseDownCallback=null;this.mouseMoveCallback=null;this.mouseUpCallback=null};Phaser.MSPointer.prototype={game:null,disabled:false,_onMSPointerDown:null,_onMSPointerMove:null,_onMSPointerUp:null,start:function(){var b=this;if(this.game.device.mspointer==true){this._onMSPointerDown=function(c){return b.onPointerDown(c)};this._onMSPointerMove=function(c){return b.onPointerMove(c)};this._onMSPointerUp=function(c){return b.onPointerUp(c)};this.game.renderer.view.addEventListener("MSPointerDown",this._onMSPointerDown,false);this.game.renderer.view.addEventListener("MSPointerMove",this._onMSPointerMove,false);this.game.renderer.view.addEventListener("MSPointerUp",this._onMSPointerUp,false);this.game.renderer.view.style["-ms-content-zooming"]="none";this.game.renderer.view.style["-ms-touch-action"]="none"}},onPointerDown:function(b){if(this.game.input.disabled||this.disabled){return}b.preventDefault();b.identifier=b.pointerId;this.game.input.startPointer(b)},onPointerMove:function(b){if(this.game.input.disabled||this.disabled){return}b.preventDefault();b.identifier=b.pointerId;this.game.input.updatePointer(b)},onPointerUp:function(b){if(this.game.input.disabled||this.disabled){return}b.preventDefault();b.identifier=b.pointerId;this.game.input.stopPointer(b)},stop:function(){this.game.stage.canvas.removeEventListener("MSPointerDown",this._onMSPointerDown);this.game.stage.canvas.removeEventListener("MSPointerMove",this._onMSPointerMove);this.game.stage.canvas.removeEventListener("MSPointerUp",this._onMSPointerUp)}};Phaser.Pointer=function(b,c){this._holdSent=false;this._history=[];this._nextDrop=0;this._stateReset=false;this.positionDown=null;this.position=null;this.circle=null;this.withinGame=false;this.clientX=-1;this.clientY=-1;this.pageX=-1;this.pageY=-1;this.screenX=-1;this.screenY=-1;this.x=-1;this.y=-1;this.isMouse=false;this.isDown=false;this.isUp=true;this.timeDown=0;this.timeUp=0;this.previousTapTime=0;this.totalTouches=0;this.msSinceLastClick=Number.MAX_VALUE;this.targetObject=null;this.game=b;this.id=c;this.active=false;this.position=new Phaser.Point();this.positionDown=new Phaser.Point();this.circle=new Phaser.Circle(0,0,44);if(c==0){this.isMouse=true}};Phaser.Pointer.prototype={start:function(b){this.identifier=b.identifier;this.target=b.target;if(b.button){this.button=b.button}if(this.game.paused==true&&this.game.stage.scale.incorrectOrientation==false){this.game.paused=false;return this}this._history.length=0;this.active=true;this.withinGame=true;this.isDown=true;this.isUp=false;this.msSinceLastClick=this.game.time.now-this.timeDown;this.timeDown=this.game.time.now;this._holdSent=false;this.move(b);this.positionDown.setTo(this.x,this.y);if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.x=this.x*this.game.input.scale.x;this.game.input.y=this.y*this.game.input.scale.y;this.game.input.position.setTo(this.x,this.y);this.game.input.onDown.dispatch(this);this.game.input.resetSpeed(this.x,this.y)}this._stateReset=false;this.totalTouches++;if(this.isMouse==false){this.game.input.currentPointers++}if(this.targetObject!==null){this.targetObject._touchedHandler(this)}return this},update:function(){if(this.active){if(this._holdSent==false&&this.duration>=this.game.input.holdRate){if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onHold.dispatch(this)}this._holdSent=true}if(this.game.input.recordPointerHistory&&this.game.time.now>=this._nextDrop){this._nextDrop=this.game.time.now+this.game.input.recordRate;this._history.push({x:this.position.x,y:this.position.y});if(this._history.length>this.game.input.recordLimit){this._history.shift()}}}},move:function(c){if(this.game.input.pollLocked){return}if(c.button){this.button=c.button}this.clientX=c.clientX;this.clientY=c.clientY;this.pageX=c.pageX;this.pageY=c.pageY;this.screenX=c.screenX;this.screenY=c.screenY;this.x=(this.pageX-this.game.stage.offset.x)*this.game.input.scale.x;this.y=(this.pageY-this.game.stage.offset.y)*this.game.input.scale.y;this.position.setTo(this.x,this.y);this.circle.x=this.x;this.circle.y=this.y;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.activePointer=this;this.game.input.x=this.x;this.game.input.y=this.y;this.game.input.position.setTo(this.game.input.x,this.game.input.y);this.game.input.circle.x=this.game.input.x;this.game.input.circle.y=this.game.input.y}if(this.game.paused){return this}if(this.targetObject!==null&&this.targetObject.isDragged==true){if(this.targetObject.update(this)==false){this.targetObject=null}return this}this._highestRenderOrderID=-1;this._highestRenderObject=null;this._highestInputPriorityID=-1;if(this.game.input.interactiveItems.total>0){var b=this.game.input.interactiveItems.next;do{if(b.priorityID>this._highestInputPriorityID||(b.priorityID==this._highestInputPriorityID&&b.sprite.renderOrderID>this._highestRenderOrderID)){if(b.checkPointerOver(this)){this._highestRenderOrderID=b.sprite.renderOrderID;this._highestInputPriorityID=b.priorityID;this._highestRenderObject=b}}b=b.next}while(b!=null)}if(this._highestRenderObject==null){if(this.targetObject){this.targetObject._pointerOutHandler(this);this.targetObject=null}}else{if(this.targetObject==null){this.targetObject=this._highestRenderObject;this._highestRenderObject._pointerOverHandler(this)}else{if(this.targetObject==this._highestRenderObject){if(this._highestRenderObject.update(this)==false){this.targetObject=null}}else{this.targetObject._pointerOutHandler(this);this.targetObject=this._highestRenderObject;this.targetObject._pointerOverHandler(this)}}}return this},leave:function(b){this.withinGame=false;this.move(b)},stop:function(c){if(this._stateReset){c.preventDefault();return}this.timeUp=this.game.time.now;if(this.game.input.multiInputOverride==Phaser.Input.MOUSE_OVERRIDES_TOUCH||this.game.input.multiInputOverride==Phaser.Input.MOUSE_TOUCH_COMBINE||(this.game.input.multiInputOverride==Phaser.Input.TOUCH_OVERRIDES_MOUSE&&this.game.input.currentPointers==0)){this.game.input.onUp.dispatch(this);if(this.duration>=0&&this.duration<=this.game.input.tapRate){if(this.timeUp-this.previousTapTime<this.game.input.doubleTapRate){this.game.input.onTap.dispatch(this,true)}else{this.game.input.onTap.dispatch(this,false)}this.previousTapTime=this.timeUp}}if(this.id>0){this.active=false}this.withinGame=false;this.isDown=false;this.isUp=true;if(this.isMouse==false){this.game.input.currentPointers--}if(this.game.input.interactiveItems.total>0){var b=this.game.input.interactiveItems.next;do{if(b){b._releasedHandler(this)}b=b.next}while(b!=null)}if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null;return this},justPressed:function(b){b=b||this.game.input.justPressedRate;return(this.isDown===true&&(this.timeDown+b)>this.game.time.now)},justReleased:function(b){b=b||this.game.input.justReleasedRate;return(this.isUp===true&&(this.timeUp+b)>this.game.time.now)},reset:function(){if(this.isMouse==false){this.active=false}this.identifier=null;this.isDown=false;this.isUp=true;this.totalTouches=0;this._holdSent=false;this._history.length=0;this._stateReset=true;if(this.targetObject){this.targetObject._releasedHandler(this)}this.targetObject=null},toString:function(){return"[{Pointer (id="+this.id+" identifer="+this.identifier+" active="+this.active+" duration="+this.duration+" withinGame="+this.withinGame+" x="+this.x+" y="+this.y+" clientX="+this.clientX+" clientY="+this.clientY+" screenX="+this.screenX+" screenY="+this.screenY+" pageX="+this.pageX+" pageY="+this.pageY+")}]"}};Object.defineProperty(Phaser.Pointer.prototype,"duration",{get:function(){if(this.isUp){return -1}return this.game.time.now-this.timeDown}});Object.defineProperty(Phaser.Pointer.prototype,"worldX",{get:function(){return this.game.world.camera.x+this.x}});Object.defineProperty(Phaser.Pointer.prototype,"worldY",{get:function(){return this.game.world.camera.y+this.y}});Phaser.Touch=function(b){this.game=b;this.callbackContext=this.game;this.touchStartCallback=null;this.touchMoveCallback=null;this.touchEndCallback=null;this.touchEnterCallback=null;this.touchLeaveCallback=null;this.touchCancelCallback=null;this.preventDefault=true};Phaser.Touch.prototype={game:null,disabled:false,_onTouchStart:null,_onTouchMove:null,_onTouchEnd:null,_onTouchEnter:null,_onTouchLeave:null,_onTouchCancel:null,_onTouchMove:null,start:function(){var b=this;if(this.game.device.touch){this._onTouchStart=function(c){return b.onTouchStart(c)};this._onTouchMove=function(c){return b.onTouchMove(c)};this._onTouchEnd=function(c){return b.onTouchEnd(c)};this._onTouchEnter=function(c){return b.onTouchEnter(c)};this._onTouchLeave=function(c){return b.onTouchLeave(c)};this._onTouchCancel=function(c){return b.onTouchCancel(c)};this.game.renderer.view.addEventListener("touchstart",this._onTouchStart,false);this.game.renderer.view.addEventListener("touchmove",this._onTouchMove,false);this.game.renderer.view.addEventListener("touchend",this._onTouchEnd,false);this.game.renderer.view.addEventListener("touchenter",this._onTouchEnter,false);this.game.renderer.view.addEventListener("touchleave",this._onTouchLeave,false);this.game.renderer.view.addEventListener("touchcancel",this._onTouchCancel,false)}},consumeDocumentTouches:function(){this._documentTouchMove=function(b){b.preventDefault()};document.addEventListener("touchmove",this._documentTouchMove,false)},onTouchStart:function(c){if(this.touchStartCallback){this.touchStartCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}if(this.preventDefault){c.preventDefault()}for(var b=0;b<c.changedTouches.length;b++){this.game.input.startPointer(c.changedTouches[b])}},onTouchCancel:function(c){if(this.touchCancelCallback){this.touchCancelCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}if(this.preventDefault){c.preventDefault()}for(var b=0;b<c.changedTouches.length;b++){this.game.input.stopPointer(c.changedTouches[b])}},onTouchEnter:function(c){if(this.touchEnterCallback){this.touchEnterCallback.call(this.callbackContext,c)}if(this.game.input.disabled||this.disabled){return}if(this.preventDefault){c.preventDefault()}for(var b=0;b<c.changedTouches.length;b++){}},onTouchLeave:function(c){if(this.touchLeaveCallback){this.touchLeaveCallback.call(this.callbackContext,c)}if(this.preventDefault){c.preventDefault()}for(var b=0;b<c.changedTouches.length;b++){}},onTouchMove:function(c){if(this.touchMoveCallback){this.touchMoveCallback.call(this.callbackContext,c)}if(this.preventDefault){c.preventDefault()}for(var b=0;b<c.changedTouches.length;b++){this.game.input.updatePointer(c.changedTouches[b])}},onTouchEnd:function(c){if(this.touchEndCallback){this.touchEndCallback.call(this.callbackContext,c)}if(this.preventDefault){c.preventDefault()}for(var b=0;b<c.changedTouches.length;b++){this.game.input.stopPointer(c.changedTouches[b])}},stop:function(){if(this.game.device.touch){this.game.stage.canvas.removeEventListener("touchstart",this._onTouchStart);this.game.stage.canvas.removeEventListener("touchmove",this._onTouchMove);this.game.stage.canvas.removeEventListener("touchend",this._onTouchEnd);this.game.stage.canvas.removeEventListener("touchenter",this._onTouchEnter);this.game.stage.canvas.removeEventListener("touchleave",this._onTouchLeave);this.game.stage.canvas.removeEventListener("touchcancel",this._onTouchCancel)}}};Phaser.InputHandler=function(b){this.game=b.game;this.sprite=b;this.enabled=false;this.parent=null;this.next=null;this.prev=null;this.last=this;this.first=this;this.priorityID=0;this.useHandCursor=false;this.isDragged=false;this.allowHorizontalDrag=true;this.allowVerticalDrag=true;this.bringToTop=false;this.snapOffset=null;this.snapOnDrag=false;this.snapOnRelease=false;this.snapX=0;this.snapY=0;this.pixelPerfect=false;this.pixelPerfectAlpha=255;this.draggable=false;this.boundsRect=null;this.boundsSprite=null;this.consumePointerEvent=false;this._tempPoint=new Phaser.Point};Phaser.InputHandler.prototype={start:function(d,b){d=d||0;b=b||false;if(this.enabled==false){this.game.input.interactiveItems.add(this);this.useHandCursor=b;this.priorityID=d;this._pointerData=[];for(var c=0;c<10;c++){this._pointerData.push({id:c,x:0,y:0,isDown:false,isUp:false,isOver:false,isOut:false,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:false})}this.snapOffset=new Phaser.Point;this.enabled=true;if(this.sprite.events&&this.sprite.events.onInputOver==null){this.sprite.events.onInputOver=new Phaser.Signal;this.sprite.events.onInputOut=new Phaser.Signal;this.sprite.events.onInputDown=new Phaser.Signal;this.sprite.events.onInputUp=new Phaser.Signal;this.sprite.events.onDragStart=new Phaser.Signal;this.sprite.events.onDragStop=new Phaser.Signal}}return this.sprite},reset:function(){this.enabled=false;for(var b=0;b<10;b++){this._pointerData[b]={id:b,x:0,y:0,isDown:false,isUp:false,isOver:false,isOut:false,timeOver:0,timeOut:0,timeDown:0,timeUp:0,downDuration:0,isDragged:false}}},stop:function(){if(this.enabled==false){return}else{this.enabled=false;this.game.input.interactiveItems.remove(this)}},destroy:function(){if(this.enabled){this.stop();this.sprite=null}},pointerX:function(b){b=b||0;return this._pointerData[b].x},pointerY:function(b){b=b||0;return this._pointerData[b].y},pointerDown:function(b){b=b||0;return this._pointerData[b].isDown},pointerUp:function(b){b=b||0;return this._pointerData[b].isUp},pointerTimeDown:function(b){b=b||0;return this._pointerData[b].timeDown},pointerTimeUp:function(b){b=b||0;return this._pointerData[b].timeUp},pointerOver:function(b){b=b||0;return this._pointerData[b].isOver},pointerOut:function(b){b=b||0;return this._pointerData[b].isOut},pointerTimeOver:function(b){b=b||0;return this._pointerData[b].timeOver},pointerTimeOut:function(b){b=b||0;return this._pointerData[b].timeOut},pointerDragged:function(b){b=b||0;return this._pointerData[b].isDragged},checkPointerOver:function(d){if(this.enabled&&this.sprite.visible){this.sprite.getLocalUnmodifiedPosition(this._tempPoint,d.x,d.y);var b=-(this.sprite.texture.frame.width)*this.sprite.anchor.x;var c;if(this._tempPoint.x>b&&this._tempPoint.x<b+this.sprite.texture.frame.width){c=-(this.sprite.texture.frame.height)*this.sprite.anchor.y;if(this._tempPoint.y>c&&this._tempPoint.y<c+this.sprite.texture.frame.height){if(this.pixelPerfect){return this.checkPixel(this._tempPoint.x,this._tempPoint.y)}else{return true}}}}else{return false}},checkPixel:function(b,d){b+=(this.sprite.texture.frame.width*this.sprite.anchor.x);d+=(this.sprite.texture.frame.height*this.sprite.anchor.y);if(this.sprite.texture.baseTexture.source){this.game.input.hitContext.clearRect(0,0,1,1);this.game.input.hitContext.drawImage(this.sprite.texture.baseTexture.source,b,d,1,1,0,0,1,1);var c=this.game.input.hitContext.getImageData(0,0,1,1);if(c.data[3]>=this.pixelPerfectAlpha){return true}}return false},update:function(b){if(this.enabled==false||this.sprite.visible==false){this._pointerOutHandler(b);return false}if(this.draggable&&this._draggedPointerID==b.id){return this.updateDrag(b)}else{if(this._pointerData[b.id].isOver==true){if(this.checkPointerOver(b)){this._pointerData[b.id].x=b.x-this.sprite.x;this._pointerData[b.id].y=b.y-this.sprite.y;return true}else{this._pointerOutHandler(b);return false}}}},_pointerOverHandler:function(b){if(this._pointerData[b.id].isOver==false){this._pointerData[b.id].isOver=true;this._pointerData[b.id].isOut=false;this._pointerData[b.id].timeOver=this.game.time.now;this._pointerData[b.id].x=b.x-this.sprite.x;this._pointerData[b.id].y=b.y-this.sprite.y;if(this.useHandCursor&&this._pointerData[b.id].isDragged==false){this.game.stage.canvas.style.cursor="pointer"}this.sprite.events.onInputOver.dispatch(this.sprite,b)}},_pointerOutHandler:function(b){this._pointerData[b.id].isOver=false;this._pointerData[b.id].isOut=true;this._pointerData[b.id].timeOut=this.game.time.now;if(this.useHandCursor&&this._pointerData[b.id].isDragged==false){this.game.stage.canvas.style.cursor="default"}this.sprite.events.onInputOut.dispatch(this.sprite,b)},_touchedHandler:function(b){if(this._pointerData[b.id].isDown==false&&this._pointerData[b.id].isOver==true){this._pointerData[b.id].isDown=true;this._pointerData[b.id].isUp=false;this._pointerData[b.id].timeDown=this.game.time.now;this.sprite.events.onInputDown.dispatch(this.sprite,b);if(this.draggable&&this.isDragged==false){this.startDrag(b)}if(this.bringToTop){this.sprite.bringToTop()}}return this.consumePointerEvent},_releasedHandler:function(b){if(this._pointerData[b.id].isDown&&b.isUp){this._pointerData[b.id].isDown=false;this._pointerData[b.id].isUp=true;this._pointerData[b.id].timeUp=this.game.time.now;this._pointerData[b.id].downDuration=this._pointerData[b.id].timeUp-this._pointerData[b.id].timeDown;if(this.checkPointerOver(b)){this.sprite.events.onInputUp.dispatch(this.sprite,b)}else{if(this.useHandCursor){this.game.stage.canvas.style.cursor="default"}}if(this.draggable&&this.isDragged&&this._draggedPointerID==b.id){this.stopDrag(b)}}},updateDrag:function(b){if(b.isUp){this.stopDrag(b);return false}if(this.allowHorizontalDrag){this.sprite.x=b.x+this._dragPoint.x+this.dragOffset.x}if(this.allowVerticalDrag){this.sprite.y=b.y+this._dragPoint.y+this.dragOffset.y}if(this.boundsRect){this.checkBoundsRect()}if(this.boundsSprite){this.checkBoundsSprite()}if(this.snapOnDrag){this.sprite.x=Math.floor(this.sprite.x/this.snapX)*this.snapX;this.sprite.y=Math.floor(this.sprite.y/this.snapY)*this.snapY}return true},justOver:function(c,b){c=c||0;b=b||500;return(this._pointerData[c].isOver&&this.overDuration(c)<b)},justOut:function(c,b){c=c||0;b=b||500;return(this._pointerData[c].isOut&&(this.game.time.now-this._pointerData[c].timeOut<b))},justPressed:function(c,b){c=c||0;b=b||500;return(this._pointerData[c].isDown&&this.downDuration(c)<b)},justReleased:function(c,b){c=c||0;b=b||500;return(this._pointerData[c].isUp&&(this.game.time.now-this._pointerData[c].timeUp<b))},overDuration:function(b){b=b||0;if(this._pointerData[b].isOver){return this.game.time.now-this._pointerData[b].timeOver}return -1},downDuration:function(b){b=b||0;if(this._pointerData[b].isDown){return this.game.time.now-this._pointerData[b].timeDown}return -1},enableDrag:function(c,f,b,e,g,d){if(typeof c=="undefined"){c=false}if(typeof f=="undefined"){f=false}if(typeof b=="undefined"){b=false}e=e||255;g=g||null;d=d||null;this._dragPoint=new Phaser.Point();this.draggable=true;this.bringToTop=f;this.dragOffset=new Phaser.Point();this.dragFromCenter=c;this.pixelPerfect=b;this.pixelPerfectAlpha=e;if(g){this.boundsRect=g}if(d){this.boundsSprite=d}},disableDrag:function(){if(this._pointerData){for(var b=0;b<10;b++){this._pointerData[b].isDragged=false}}this.draggable=false;this.isDragged=false;this._draggedPointerID=-1},startDrag:function(b){this.isDragged=true;this._draggedPointerID=b.id;this._pointerData[b.id].isDragged=true;if(this.dragFromCenter){this.sprite.centerOn(b.x,b.y);this._dragPoint.setTo(this.sprite.x-b.x,this.sprite.y-b.y)}else{this._dragPoint.setTo(this.sprite.x-b.x,this.sprite.y-b.y)}this.updateDrag(b);if(this.bringToTop){this.sprite.bringToTop()}this.sprite.events.onDragStart.dispatch(this.sprite,b)},stopDrag:function(b){this.isDragged=false;this._draggedPointerID=-1;this._pointerData[b.id].isDragged=false;if(this.snapOnRelease){this.sprite.x=Math.floor(this.sprite.x/this.snapX)*this.snapX;this.sprite.y=Math.floor(this.sprite.y/this.snapY)*this.snapY}this.sprite.events.onDragStop.dispatch(this.sprite,b);this.sprite.events.onInputUp.dispatch(this.sprite,b)},setDragLock:function(b,c){b=b||true;c=c||true;this.allowHorizontalDrag=b;this.allowVerticalDrag=c},enableSnap:function(e,d,c,b){if(typeof c=="undefined"){c=true}if(typeof b=="undefined"){b=false}this.snapX=e;this.snapY=d;this.snapOnDrag=c;this.snapOnRelease=b},disableSnap:function(){this.snapOnDrag=false;this.snapOnRelease=false},checkBoundsRect:function(){if(this.sprite.x<this.boundsRect.left){this.sprite.x=this.boundsRect.x}else{if((this.sprite.x+this.sprite.width)>this.boundsRect.right){this.sprite.x=this.boundsRect.right-this.sprite.width}}if(this.sprite.y<this.boundsRect.top){this.sprite.y=this.boundsRect.top}else{if((this.sprite.y+this.sprite.height)>this.boundsRect.bottom){this.sprite.y=this.boundsRect.bottom-this.sprite.height}}},checkBoundsSprite:function(){if(this.sprite.x<this.boundsSprite.x){this.sprite.x=this.boundsSprite.x}else{if((this.sprite.x+this.sprite.width)>(this.boundsSprite.x+this.boundsSprite.width)){this.sprite.x=(this.boundsSprite.x+this.boundsSprite.width)-this.sprite.width}}if(this.sprite.y<this.boundsSprite.y){this.sprite.y=this.boundsSprite.y}else{if((this.sprite.y+this.sprite.height)>(this.boundsSprite.y+this.boundsSprite.height)){this.sprite.y=(this.boundsSprite.y+this.boundsSprite.height)-this.sprite.height}}}};Phaser.Events=function(b){this.parent=b;this.onAddedToGroup=new Phaser.Signal;this.onRemovedFromGroup=new Phaser.Signal;this.onKilled=new Phaser.Signal;this.onRevived=new Phaser.Signal;this.onOutOfBounds=new Phaser.Signal;this.onInputOver=null;this.onInputOut=null;this.onInputDown=null;this.onInputUp=null;this.onDragStart=null;this.onDragStop=null;this.onAnimationStart=null;this.onAnimationComplete=null;this.onAnimationLoop=null};Phaser.GameObjectFactory=function(b){this.game=b;this.world=this.game.world};Phaser.GameObjectFactory.prototype={game:null,world:null,existing:function(b){return this.world.group.add(b)},sprite:function(b,e,c,d){return this.world.group.add(new Phaser.Sprite(this.game,b,e,c,d))},child:function(d,b,g,c,e){var f=this.world.group.add(new Phaser.Sprite(this.game,b,g,c,e));d.addChild(f);return f},tween:function(b){return this.game.tweens.create(b)},group:function(c,b){return new Phaser.Group(this.game,c,b)},audio:function(c,d,b){return this.game.sound.add(c,d,b)},tileSprite:function(c,g,e,b,d,f){return this.world.group.add(new Phaser.TileSprite(this.game,c,g,e,b,d,f))},text:function(b,e,d,c){return this.world.group.add(new Phaser.Text(this.game,b,e,d,c))},button:function(b,i,g,h,e,d,f,c){return this.world.group.add(new Phaser.Button(this.game,b,i,g,h,e,d,f,c))},graphics:function(b,c){return this.world.group.add(new Phaser.Graphics(this.game,b,c))},emitter:function(b,d,c){return this.game.particles.add(new Phaser.Particles.Arcade.Emitter(this.game,b,d,c))},bitmapText:function(b,e,d,c){return this.world.group.add(new Phaser.BitmapText(this.game,b,e,d,c))},tilemap:function(b,g,d,e,f,c){return this.world.group.add(new Phaser.Tilemap(this.game,d,b,g,e,f,c))},renderTexture:function(c,d,b){var e=new Phaser.RenderTexture(this.game,c,d,b);this.game.cache.addRenderTexture(c,e);return e}};Phaser.Sprite=function(c,b,f,d,e){b=b||0;f=f||0;d=d||null;e=e||null;this.game=c;this.exists=true;this.alive=true;this.group=null;this.name="";this.type=Phaser.SPRITE;this.renderOrderID=-1;this.lifespan=0;this.events=new Phaser.Events(this);this.animations=new Phaser.AnimationManager(this);this.input=new Phaser.InputHandler(this);this.key=d;if(d instanceof Phaser.RenderTexture){PIXI.Sprite.call(this,d);this.currentFrame=this.game.cache.getTextureFrame(d.name)}else{if(d==null||this.game.cache.checkImageKey(d)==false){d="__default"}PIXI.Sprite.call(this,PIXI.TextureCache[d]);if(this.game.cache.isSpriteSheet(d)){this.animations.loadFrameData(this.game.cache.getFrameData(d));if(e!==null){if(typeof e==="string"){this.frameName=e}else{this.frame=e}}}else{this.currentFrame=this.game.cache.getFrame(d)}}this.anchor=new Phaser.Point();this._cropUUID=null;this._cropRect=null;this.x=b;this.y=f;this.position.x=b;this.position.y=f;this.autoCull=false;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,i01:0,i10:0,idi:1,left:null,right:null,top:null,bottom:null,x:-1,y:-1,scaleX:1,scaleY:1,width:this.currentFrame.sourceSizeW,height:this.currentFrame.sourceSizeH,halfWidth:Math.floor(this.currentFrame.sourceSizeW/2),halfHeight:Math.floor(this.currentFrame.sourceSizeH/2),frameID:this.currentFrame.uuid,frameWidth:this.currentFrame.width,frameHeight:this.currentFrame.height,boundsX:0,boundsY:0,cameraVisible:true};this.offset=new Phaser.Point;this.center=new Phaser.Point(b+Math.floor(this._cache.width/2),f+Math.floor(this._cache.height/2));this.topLeft=new Phaser.Point(b,f);this.topRight=new Phaser.Point(b+this._cache.width,f);this.bottomRight=new Phaser.Point(b+this._cache.width,f+this._cache.height);this.bottomLeft=new Phaser.Point(b,f+this._cache.height);this.bounds=new Phaser.Rectangle(b,f,this._cache.width,this._cache.height);this.body=new Phaser.Physics.Arcade.Body(this);this.velocity=this.body.velocity;this.acceleration=this.body.acceleration;this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds);this.inWorldThreshold=0;this._outOfBoundsFired=false};Phaser.Sprite.prototype=Object.create(PIXI.Sprite.prototype);Phaser.Sprite.prototype.constructor=Phaser.Sprite;Phaser.Sprite.prototype.preUpdate=function(){if(!this.exists){this.renderOrderID=-1;return}if(this.lifespan>0){this.lifespan-=this.game.time.elapsed;if(this.lifespan<=0){this.kill();return}}this._cache.dirty=false;if(this.animations.update()){this._cache.dirty=true}this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}if(this.visible){this.renderOrderID=this.game.world.currentRenderOrderID++}if(this.worldTransform[0]!=this._cache.a00||this.worldTransform[1]!=this._cache.a01){this._cache.a00=this.worldTransform[0];this._cache.a01=this.worldTransform[1];this._cache.i01=this.worldTransform[1];this._cache.scaleX=Math.sqrt((this._cache.a00*this._cache.a00)+(this._cache.a01*this._cache.a01));this._cache.a01*=-1;this._cache.dirty=true}if(this.worldTransform[3]!=this._cache.a10||this.worldTransform[4]!=this._cache.a11){this._cache.a10=this.worldTransform[3];this._cache.i10=this.worldTransform[3];this._cache.a11=this.worldTransform[4];this._cache.scaleY=Math.sqrt((this._cache.a10*this._cache.a10)+(this._cache.a11*this._cache.a11));this._cache.a10*=-1;this._cache.dirty=true}if(this.worldTransform[2]!=this._cache.a02||this.worldTransform[5]!=this._cache.a12){this._cache.a02=this.worldTransform[2];this._cache.a12=this.worldTransform[5];this._cache.dirty=true}if(this.currentFrame.uuid!=this._cache.frameID){this._cache.frameWidth=this.texture.frame.width;this._cache.frameHeight=this.texture.frame.height;this._cache.frameID=this.currentFrame.uuid;this._cache.dirty=true}if(this._cache.dirty){this._cache.width=Math.floor(this.currentFrame.sourceSizeW*this._cache.scaleX);this._cache.height=Math.floor(this.currentFrame.sourceSizeH*this._cache.scaleY);this._cache.halfWidth=Math.floor(this._cache.width/2);this._cache.halfHeight=Math.floor(this._cache.height/2);this._cache.id=1/(this._cache.a00*this._cache.a11+this._cache.a01*-this._cache.a10);this._cache.idi=1/(this._cache.a00*this._cache.a11+this._cache.i01*-this._cache.i10);this.updateBounds()}if(this._cache.dirty){this._cache.cameraVisible=Phaser.Rectangle.intersects(this.game.world.camera.screenView,this.bounds,0);if(this.autoCull==true){this.renderable=this._cache.cameraVisible}this.body.updateBounds(this.center.x,this.center.y,this._cache.scaleX,this._cache.scaleY)}this.body.update()};Phaser.Sprite.prototype.postUpdate=function(){if(this.exists){this.body.postUpdate()}};Phaser.Sprite.prototype.centerOn=function(b,c){this.x=b+(this.x-this.center.x);this.y=c+(this.y-this.center.y)};Phaser.Sprite.prototype.revive=function(){this.alive=true;this.exists=true;this.visible=true;this.events.onRevived.dispatch(this)};Phaser.Sprite.prototype.kill=function(){this.alive=false;this.exists=false;this.visible=false;this.events.onKilled.dispatch(this)};Phaser.Sprite.prototype.reset=function(b,c){this.x=b;this.y=c;this.position.x=b;this.position.y=c;this.alive=true;this.exists=true;this.visible=true;this._outOfBoundsFired=false;this.body.reset()};Phaser.Sprite.prototype.updateBounds=function(){this.offset.setTo(this._cache.a02-(this.anchor.x*this._cache.width),this._cache.a12-(this.anchor.y*this._cache.height));this.getLocalPosition(this.center,this.offset.x+this._cache.halfWidth,this.offset.y+this._cache.halfHeight);this.getLocalPosition(this.topLeft,this.offset.x,this.offset.y);this.getLocalPosition(this.topRight,this.offset.x+this._cache.width,this.offset.y);this.getLocalPosition(this.bottomLeft,this.offset.x,this.offset.y+this._cache.height);this.getLocalPosition(this.bottomRight,this.offset.x+this._cache.width,this.offset.y+this._cache.height);this._cache.left=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.right=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);this._cache.top=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this._cache.bottom=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);this.bounds.setTo(this._cache.left,this._cache.top,this._cache.right-this._cache.left,this._cache.bottom-this._cache.top);this._cache.boundsX=this._cache.x;this._cache.boundsY=this._cache.y;if(this.inWorld==false){this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds,this.inWorldThreshold);if(this.inWorld){this._outOfBoundsFired=false}}else{this.inWorld=Phaser.Rectangle.intersects(this.bounds,this.game.world.bounds,this.inWorldThreshold);if(this.inWorld==false){this.events.onOutOfBounds.dispatch(this);this._outOfBoundsFired=true}}};Phaser.Sprite.prototype.getLocalPosition=function(c,b,d){c.x=((this._cache.a11*this._cache.id*b+-this._cache.a01*this._cache.id*d+(this._cache.a12*this._cache.a01-this._cache.a02*this._cache.a11)*this._cache.id)*this._cache.scaleX)+this._cache.a02;c.y=((this._cache.a00*this._cache.id*d+-this._cache.a10*this._cache.id*b+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.a10)*this._cache.id)*this._cache.scaleY)+this._cache.a12;return c};Phaser.Sprite.prototype.getLocalUnmodifiedPosition=function(c,b,d){c.x=this._cache.a11*this._cache.idi*b+-this._cache.i01*this._cache.idi*d+(this._cache.a12*this._cache.i01-this._cache.a02*this._cache.a11)*this._cache.idi;c.y=this._cache.a00*this._cache.idi*d+-this._cache.i10*this._cache.idi*b+(-this._cache.a12*this._cache.a00+this._cache.a02*this._cache.i10)*this._cache.idi;return c};Phaser.Sprite.prototype.bringToTop=function(){if(this.group){this.group.bringToTop(this)}else{this.game.world.bringToTop(this)}};Phaser.Sprite.prototype.getBounds=function(d){d=d||new Phaser.Rectangle;var f=Phaser.Math.min(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var c=Phaser.Math.max(this.topLeft.x,this.topRight.x,this.bottomLeft.x,this.bottomRight.x);var e=Phaser.Math.min(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);var b=Phaser.Math.max(this.topLeft.y,this.topRight.y,this.bottomLeft.y,this.bottomRight.y);d.x=f;d.y=e;d.width=c-f;d.height=b-e;return d};Object.defineProperty(Phaser.Sprite.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Sprite.prototype,"frame",{get:function(){return this.animations.frame},set:function(b){this.animations.frame=b}});Object.defineProperty(Phaser.Sprite.prototype,"frameName",{get:function(){return this.animations.frameName},set:function(b){this.animations.frameName=b}});Object.defineProperty(Phaser.Sprite.prototype,"inCamera",{get:function(){return this._cache.cameraVisible}});Object.defineProperty(Phaser.Sprite.prototype,"crop",{get:function(){return this._cropRect},set:function(b){if(b instanceof Phaser.Rectangle){if(this._cropUUID==null){this._cropUUID=this.game.rnd.uuid();PIXI.TextureCache[this._cropUUID]=new PIXI.Texture(PIXI.BaseTextureCache[this.key],{x:b.x,y:b.y,width:b.width,height:b.height})}else{PIXI.TextureCache[this._cropUUID].frame=b}this._cropRect=b;this.setTexture(PIXI.TextureCache[this._cropUUID])}}});Object.defineProperty(Phaser.Sprite.prototype,"inputEnabled",{get:function(){return(this.input.enabled)},set:function(b){if(b){if(this.input.enabled==false){this.input.start()}}else{if(this.input.enabled){this.input.stop()}}}});Phaser.TileSprite=function(d,c,h,f,b,e,g){c=c||0;h=h||0;f=f||256;b=b||256;e=e||null;g=g||null;Phaser.Sprite.call(this,d,c,h,e,g);this.texture=PIXI.TextureCache[e];PIXI.TilingSprite.call(this,this.texture,f,b);this.type=Phaser.TILESPRITE;this.tileScale=new Phaser.Point(1,1);this.tilePosition=new Phaser.Point(0,0)};Phaser.TileSprite.prototype=Phaser.Utils.extend(true,PIXI.TilingSprite.prototype,Phaser.Sprite.prototype);Phaser.TileSprite.prototype.constructor=Phaser.TileSprite;Phaser.Text=function(c,b,f,e,d){b=b||0;f=f||0;e=e||"";d=d||"";this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;this._text=e;this._style=d;PIXI.Text.call(this,e,d);this.type=Phaser.TEXT;this.position.x=this.x=b;this.position.y=this.y=f;this.anchor=new Phaser.Point();this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true};Phaser.Text.prototype=Object.create(PIXI.Text.prototype);Phaser.Text.prototype.constructor=Phaser.Text;Phaser.Text.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.Text.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Text.prototype,"text",{get:function(){return this._text},set:function(b){if(b!==this._text){this._text=b;this.dirty=true}}});Object.defineProperty(Phaser.Text.prototype,"style",{get:function(){return this._style},set:function(b){if(b!==this._style){this._style=b;this.dirty=true}}});Phaser.BitmapText=function(c,b,f,e,d){b=b||0;f=f||0;e=e||"";d=d||"";this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;PIXI.BitmapText.call(this,e,d);this.type=Phaser.BITMAPTEXT;this.position.x=b;this.position.y=f;this.anchor=new Phaser.Point();this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:f,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true};Phaser.BitmapText.prototype=Object.create(PIXI.BitmapText.prototype);Phaser.BitmapText.prototype.constructor=Phaser.BitmapText;Phaser.BitmapText.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.BitmapText.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.BitmapText.prototype,"x",{get:function(){return this.position.x},set:function(b){this.position.x=b}});Object.defineProperty(Phaser.BitmapText.prototype,"y",{get:function(){return this.position.y},set:function(b){this.position.y=b}});Phaser.Button=function(j,g,f,h,i,c,d,b,e){g=g||0;f=f||0;h=h||null;i=i||null;c=c||this;Phaser.Sprite.call(this,j,g,f,h,b);this.type=Phaser.BUTTON;this._onOverFrameName=null;this._onOutFrameName=null;this._onDownFrameName=null;this._onUpFrameName=null;this._onOverFrameID=null;this._onOutFrameID=null;this._onDownFrameID=null;this._onUpFrameID=null;this.onInputOver=new Phaser.Signal;this.onInputOut=new Phaser.Signal;this.onInputDown=new Phaser.Signal;this.onInputUp=new Phaser.Signal;this.setFrames(d,b,e);if(i!==null){this.onInputUp.add(i,c)}this.input.start(0,false,true);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)};Phaser.Button.prototype=Phaser.Utils.extend(true,Phaser.Sprite.prototype,PIXI.Sprite.prototype);Phaser.Button.prototype.constructor=Phaser.Button;Phaser.Button.prototype.setFrames=function(c,d,b){if(c!==null){if(typeof c==="string"){this._onOverFrameName=c}else{this._onOverFrameID=c}}if(d!==null){if(typeof d==="string"){this._onOutFrameName=d;this._onUpFrameName=d}else{this._onOutFrameID=d;this._onUpFrameID=d}}if(b!==null){if(typeof b==="string"){this._onDownFrameName=b}else{this._onDownFrameID=b}}};Phaser.Button.prototype.onInputOverHandler=function(b){if(this._onOverFrameName!=null){this.frameName=this._onOverFrameName}else{if(this._onOverFrameID!=null){this.frame=this._onOverFrameID}}if(this.onInputOver){this.onInputOver.dispatch(this,b)}};Phaser.Button.prototype.onInputOutHandler=function(b){if(this._onOutFrameName!=null){this.frameName=this._onOutFrameName}else{if(this._onOutFrameID!=null){this.frame=this._onOutFrameID}}if(this.onInputOut){this.onInputOut.dispatch(this,b)}};Phaser.Button.prototype.onInputDownHandler=function(b){if(this._onDownFrameName!=null){this.frameName=this._onDownFrameName}else{if(this._onDownFrameID!=null){this.frame=this._onDownFrameID}}if(this.onInputDown){this.onInputDown.dispatch(this,b)}};Phaser.Button.prototype.onInputUpHandler=function(b){if(this._onUpFrameName!=null){this.frameName=this._onUpFrameName}else{if(this._onUpFrameID!=null){this.frame=this._onUpFrameID}}if(this.onInputUp){this.onInputUp.dispatch(this,b)}};Phaser.Graphics=function(c,b,d){this.exists=true;this.alive=true;this.group=null;this.name="";this.game=c;PIXI.DisplayObjectContainer.call(this);this.type=Phaser.GRAPHICS;this.position.x=b;this.position.y=d;this.scale=new Phaser.Point(1,1);this.scrollFactor=new Phaser.Point(1,1);this._cache={dirty:false,a00:1,a01:0,a02:b,a10:0,a11:1,a12:d,id:1,x:-1,y:-1,scaleX:1,scaleY:1};this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);this.renderable=true;this.fillAlpha=1;this.lineWidth=0;this.lineColor="black";this.graphicsData=[];this.currentPath={points:[]}};Phaser.Graphics.prototype=Phaser.Utils.extend(true,PIXI.Graphics.prototype,PIXI.DisplayObjectContainer.prototype,Phaser.Sprite.prototype);Phaser.Graphics.prototype.constructor=Phaser.Graphics;Phaser.Graphics.prototype.update=function(){if(!this.exists){return}this._cache.dirty=false;this._cache.x=this.x-(this.game.world.camera.x*this.scrollFactor.x);this._cache.y=this.y-(this.game.world.camera.y*this.scrollFactor.y);if(this.position.x!=this._cache.x||this.position.y!=this._cache.y){this.position.x=this._cache.x;this.position.y=this._cache.y;this._cache.dirty=true}};Object.defineProperty(Phaser.Graphics.prototype,"angle",{get:function(){return Phaser.Math.radToDeg(this.rotation)},set:function(b){this.rotation=Phaser.Math.degToRad(b)}});Object.defineProperty(Phaser.Graphics.prototype,"x",{get:function(){return this.position.x},set:function(b){this.position.x=b}});Object.defineProperty(Phaser.Graphics.prototype,"y",{get:function(){return this.position.y},set:function(b){this.position.y=b}});Phaser.RenderTexture=function(c,d,e,b){this.game=c;this.name=d;PIXI.EventTarget.call(this);this.width=e||100;this.height=b||100;this.indetityMatrix=PIXI.mat3.create();this.frame=new PIXI.Rectangle(0,0,this.width,this.height);this.type=Phaser.RENDERTEXTURE;if(PIXI.gl){this.initWebGL()}else{this.initCanvas()}};Phaser.RenderTexture.prototype=Phaser.Utils.extend(true,PIXI.RenderTexture.prototype);Phaser.RenderTexture.prototype.constructor=Phaser.RenderTexture;Phaser.Canvas={create:function(d,b){d=d||256;b=b||256;var c=document.createElement("canvas");c.width=d;c.height=b;c.style.display="block";return c},getOffset:function(c,b){b=b||new Phaser.Point;var d=c.getBoundingClientRect();var h=c.clientTop||document.body.clientTop||0;var g=c.clientLeft||document.body.clientLeft||0;var e=window.pageYOffset||c.scrollTop||document.body.scrollTop;var f=window.pageXOffset||c.scrollLeft||document.body.scrollLeft;b.x=d.left+f-g;b.y=d.top+e-h;return b},getAspectRatio:function(b){return b.width/b.height},setBackgroundColor:function(c,b){b=b||"rgb(0,0,0)";c.style.backgroundColor=b;return c},setTouchAction:function(b,c){c=c||"none";b.style.msTouchAction=c;b.style["ms-touch-action"]=c;b.style["touch-action"]=c;return b},addToDOM:function(b,c,d){c=c||"";if(typeof d==="undefined"){d=true}if(c!==""){if(document.getElementById(c)){document.getElementById(c).appendChild(b);if(d){document.getElementById(c).style.overflow="hidden"}}else{document.body.appendChild(b)}}else{document.body.appendChild(b)}return b},setTransform:function(f,h,g,d,b,e,c){f.setTransform(d,e,c,b,h,g);return f},setSmoothingEnabled:function(b,c){b.imageSmoothingEnabled=c;b.mozImageSmoothingEnabled=c;b.oImageSmoothingEnabled=c;b.webkitImageSmoothingEnabled=c;b.msImageSmoothingEnabled=c;return b},setImageRenderingCrisp:function(b){b.style["image-rendering"]="crisp-edges";b.style["image-rendering"]="-moz-crisp-edges";b.style["image-rendering"]="-webkit-optimize-contrast";b.style.msInterpolationMode="nearest-neighbor";return b},setImageRenderingBicubic:function(b){b.style["image-rendering"]="auto";b.style.msInterpolationMode="bicubic";return b}};Phaser.StageScaleMode=function(c,d,b){this._startHeight=0;this.forceLandscape=false;this.forcePortrait=false;this.incorrectOrientation=false;this.pageAlignHorizontally=false;this.pageAlignVeritcally=false;this.minWidth=null;this.maxWidth=null;this.minHeight=null;this.maxHeight=null;this.width=0;this.height=0;this.maxIterations=5;this.game=c;this.enterLandscape=new Phaser.Signal();this.enterPortrait=new Phaser.Signal();if(window.orientation){this.orientation=window.orientation}else{if(window.outerWidth>window.outerHeight){this.orientation=90}else{this.orientation=0}}this.scaleFactor=new Phaser.Point(1,1);this.aspectRatio=0;var e=this;window.addEventListener("orientationchange",function(f){return e.checkOrientation(f)},false);window.addEventListener("resize",function(f){return e.checkResize(f)},false)};Phaser.StageScaleMode.EXACT_FIT=0;Phaser.StageScaleMode.NO_SCALE=1;Phaser.StageScaleMode.SHOW_ALL=2;Phaser.StageScaleMode.prototype={startFullScreen:function(){if(this.isFullScreen){return}var b=this.game.canvas;if(b.requestFullScreen){b.requestFullScreen()}else{if(b.mozRequestFullScreen){b.mozRequestFullScreen()}else{if(b.webkitRequestFullScreen){b.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}}}this.game.stage.canvas.style.width="100%";this.game.stage.canvas.style.height="100%"},stopFullScreen:function(){if(document.cancelFullScreen){document.cancelFullScreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}}}},checkOrientationState:function(){if(this.incorrectOrientation){if((this.forceLandscape&&window.innerWidth>window.innerHeight)||(this.forcePortrait&&window.innerHeight>window.innerWidth)){this.game.paused=false;this.incorrectOrientation=false;this.refresh()}}else{if((this.forceLandscape&&window.innerWidth<window.innerHeight)||(this.forcePortrait&&window.innerHeight<window.innerWidth)){this.game.paused=true;this.incorrectOrientation=true;this.refresh()}}},checkOrientation:function(b){this.orientation=window.orientation;if(this.isLandscape){this.enterLandscape.dispatch(this.orientation,true,false)}else{this.enterPortrait.dispatch(this.orientation,false,true)}if(this.game.stage.scaleMode!==Phaser.StageScaleMode.NO_SCALE){this.refresh()}},checkResize:function(b){if(window.outerWidth>window.outerHeight){this.orientation=90}else{this.orientation=0}if(this.isLandscape){this.enterLandscape.dispatch(this.orientation,true,false)}else{this.enterPortrait.dispatch(this.orientation,false,true)}if(this.game.stage.scaleMode!==Phaser.StageScaleMode.NO_SCALE){this.refresh()}},refresh:function(){var b=this;if(this.game.device.iPad==false&&this.game.device.webApp==false&&this.game.device.desktop==false){if(this.game.device.android&&this.game.device.chrome==false){window.scrollTo(0,1)}else{window.scrollTo(0,0)}}if(this._check==null&&this.maxIterations>0){this._iterations=this.maxIterations;this._check=window.setInterval(function(){return b.setScreenSize()},10);this.setScreenSize()}},setScreenSize:function(b){if(typeof b=="undefined"){b=false}if(this.game.device.iPad==false&&this.game.device.webApp==false&&this.game.device.desktop==false){if(this.game.device.android&&this.game.device.chrome==false){window.scrollTo(0,1)}else{window.scrollTo(0,0)}}this._iterations--;if(b||window.innerHeight>this._startHeight||this._iterations<0){document.documentElement.style.minHeight=window.innerHeight+"px";if(this.incorrectOrientation==true){this.setMaximum()}else{if(this.game.stage.scaleMode==Phaser.StageScaleMode.EXACT_FIT){this.setExactFit()}else{if(this.game.stage.scaleMode==Phaser.StageScaleMode.SHOW_ALL){this.setShowAll()}}}this.setSize();clearInterval(this._check);this._check=null}},setSize:function(){if(this.incorrectOrientation==false){if(this.maxWidth&&this.width>this.maxWidth){this.width=this.maxWidth}if(this.maxHeight&&this.height>this.maxHeight){this.height=this.maxHeight}if(this.minWidth&&this.width<this.minWidth){this.width=this.minWidth}if(this.minHeight&&this.height<this.minHeight){this.height=this.minHeight}}this.game.canvas.style.width=this.width+"px";this.game.canvas.style.height=this.height+"px";this.game.input.scale.setTo(this.game.width/this.width,this.game.height/this.height);if(this.pageAlignHorizontally){if(this.width<window.innerWidth&&this.incorrectOrientation==false){this.game.canvas.style.marginLeft=Math.round((window.innerWidth-this.width)/2)+"px"}else{this.game.canvas.style.marginLeft="0px"}}if(this.pageAlignVeritcally){if(this.height<window.innerHeight&&this.incorrectOrientation==false){this.game.canvas.style.marginTop=Math.round((window.innerHeight-this.height)/2)+"px"}else{this.game.canvas.style.marginTop="0px"}}Phaser.Canvas.getOffset(this.game.canvas,this.game.stage.offset);this.aspectRatio=this.width/this.height;this.scaleFactor.x=this.game.width/this.width;this.scaleFactor.y=this.game.height/this.height},setMaximum:function(){this.width=window.innerWidth;this.height=window.innerHeight},setShowAll:function(){var b=Math.min((window.innerHeight/this.game.height),(window.innerWidth/this.game.width));this.width=Math.round(this.game.width*b);this.height=Math.round(this.game.height*b)},setExactFit:function(){var b=window.innerWidth-0;var c=window.innerHeight-5;console.log("available",b,c);if(this.maxWidth&&b>this.maxWidth){this.width=this.maxWidth}else{this.width=b}if(this.maxHeight&&c>this.maxHeight){this.height=this.maxHeight}else{this.height=c}console.log("setExactFit",this.width,this.height,this.game.stage.offset)}};Object.defineProperty(Phaser.StageScaleMode.prototype,"isFullScreen",{get:function(){if(document.fullscreenElement===null||document.mozFullScreenElement===null||document.webkitFullscreenElement===null){return false}return true}});Object.defineProperty(Phaser.StageScaleMode.prototype,"isPortrait",{get:function(){return this.orientation==0||this.orientation==180}});Object.defineProperty(Phaser.StageScaleMode.prototype,"isLandscape",{get:function(){return this.orientation===90||this.orientation===-90}});Phaser.Device=function(){this.patchAndroidClearRectBug=false;this.desktop=false;this.iOS=false;this.android=false;this.chromeOS=false;this.linux=false;this.macOS=false;this.windows=false;this.canvas=false;this.file=false;this.fileSystem=false;this.localStorage=false;this.webGL=false;this.worker=false;this.touch=false;this.mspointer=false;this.css3D=false;this.pointerLock=false;this.arora=false;this.chrome=false;this.epiphany=false;this.firefox=false;this.ie=false;this.ieVersion=0;this.mobileSafari=false;this.midori=false;this.opera=false;this.safari=false;this.webApp=false;this.audioData=false;this.webAudio=false;this.ogg=false;this.opus=false;this.mp3=false;this.wav=false;this.m4a=false;this.webm=false;this.iPhone=false;this.iPhone4=false;this.iPad=false;this.pixelRatio=0;this._checkAudio();this._checkBrowser();this._checkCSS3D();this._checkDevice();this._checkFeatures();this._checkOS()};Phaser.Device.prototype={_checkOS:function(){var b=navigator.userAgent;if(/Android/.test(b)){this.android=true}else{if(/CrOS/.test(b)){this.chromeOS=true}else{if(/iP[ao]d|iPhone/i.test(b)){this.iOS=true}else{if(/Linux/.test(b)){this.linux=true}else{if(/Mac OS/.test(b)){this.macOS=true}else{if(/Windows/.test(b)){this.windows=true}}}}}}if(this.windows||this.macOS||this.linux){this.desktop=true}},_checkFeatures:function(){this.canvas=!!window.CanvasRenderingContext2D;try{this.localStorage=!!localStorage.getItem}catch(b){this.localStorage=false}this.file=!!window.File&&!!window.FileReader&&!!window.FileList&&!!window.Blob;this.fileSystem=!!window.requestFileSystem;this.webGL=(function(){try{return !!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(c){return false}})();this.worker=!!window.Worker;if("ontouchstart" in document.documentElement||window.navigator.msPointerEnabled){this.touch=true}if(window.navigator.msPointerEnabled){this.mspointer=true}this.pointerLock="pointerLockElement" in document||"mozPointerLockElement" in document||"webkitPointerLockElement" in document},_checkBrowser:function(){var b=navigator.userAgent;if(/Arora/.test(b)){this.arora=true}else{if(/Chrome/.test(b)){this.chrome=true}else{if(/Epiphany/.test(b)){this.epiphany=true}else{if(/Firefox/.test(b)){this.firefox=true}else{if(/Mobile Safari/.test(b)){this.mobileSafari=true}else{if(/MSIE (\d+\.\d+);/.test(b)){this.ie=true;this.ieVersion=parseInt(RegExp.$1)}else{if(/Midori/.test(b)){this.midori=true}else{if(/Opera/.test(b)){this.opera=true}else{if(/Safari/.test(b)){this.safari=true}}}}}}}}}if(navigator.standalone){this.webApp=true}},_checkAudio:function(){this.audioData=!!(window.Audio);this.webAudio=!!(window.webkitAudioContext||window.AudioContext);var d=document.createElement("audio");var b=false;try{if(b=!!d.canPlayType){if(d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")){this.ogg=true}if(d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,"")){this.opus=true}if(d.canPlayType("audio/mpeg;").replace(/^no$/,"")){this.mp3=true}if(d.canPlayType('audio/wav; codecs="1"').replace(/^no$/,"")){this.wav=true}if(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/aac;").replace(/^no$/,"")){this.m4a=true}if(d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")){this.webm=true}}}catch(c){}},_checkDevice:function(){this.pixelRatio=window.devicePixelRatio||1;this.iPhone=navigator.userAgent.toLowerCase().indexOf("iphone")!=-1;this.iPhone4=(this.pixelRatio==2&&this.iPhone);this.iPad=navigator.userAgent.toLowerCase().indexOf("ipad")!=-1},_checkCSS3D:function(){var d=document.createElement("p");var e;var c={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(d,null);for(var b in c){if(d.style[b]!==undefined){d.style[b]="translate3d(1px,1px,1px)";e=window.getComputedStyle(d).getPropertyValue(c[b])}}document.body.removeChild(d);this.css3D=(e!==undefined&&e.length>0&&e!=="none")},canPlayAudio:function(b){if(b=="mp3"&&this.mp3){return true}else{if(b=="ogg"&&(this.ogg||this.opus)){return true}else{if(b=="m4a"&&this.m4a){return true}else{if(b=="wav"&&this.wav){return true}else{if(b=="webm"&&this.webm){return true}}}}}return false},isConsoleOpen:function(){if(window.console&&window.console.firebug){return true}if(window.console){console.profile();console.profileEnd();if(console.clear){console.clear()}return console.profiles.length>0}return false}};Phaser.RequestAnimationFrame=function(c){this.game=c;this._isSetTimeOut=false;this.isRunning=false;var d=["ms","moz","webkit","o"];for(var b=0;b<d.length&&!window.requestAnimationFrame;b++){window.requestAnimationFrame=window[d[b]+"RequestAnimationFrame"];window.cancelAnimationFrame=window[d[b]+"CancelAnimationFrame"]}};Phaser.RequestAnimationFrame.prototype={_onLoop:null,start:function(){this.isRunning=true;var b=this;if(!window.requestAnimationFrame){this._isSetTimeOut=true;this._onLoop=function(){return b.updateSetTimeout()};this._timeOutID=window.setTimeout(this._onLoop,0)}else{this._isSetTimeOut=false;this._onLoop=function(c){return b.updateRAF(c)};window.requestAnimationFrame(this._onLoop)}},updateRAF:function(b){this.game.update(b);window.requestAnimationFrame(this._onLoop)},updateSetTimeout:function(){this.game.update(Date.now());this._timeOutID=window.setTimeout(this._onLoop,this.game.time.timeToCall)},stop:function(){if(this._isSetTimeOut){clearTimeout(this._timeOutID)}else{window.cancelAnimationFrame}this.isRunning=false},isSetTimeOut:function(){return this._isSetTimeOut},isRAF:function(){return(this._isSetTimeOut===false)}};Phaser.RandomDataGenerator=function(b){if(typeof b==="undefined"){b=[]}this.sow(b)};Phaser.RandomDataGenerator.prototype={c:1,s0:0,s1:0,s2:0,rnd:function(){var b=2091639*this.s0+this.c*2.3283064365386963e-10;this.c=b|0;this.s0=this.s1;this.s1=this.s2;this.s2=b-this.c;return this.s2},sow:function(c){if(typeof c==="undefined"){c=[]}this.s0=this.hash(" ");this.s1=this.hash(this.s0);this.s2=this.hash(this.s1);var b;for(var d=0;b=c[d++];){this.s0-=this.hash(b);this.s0+=~~(this.s0<0);this.s1-=this.hash(b);this.s1+=~~(this.s1<0);this.s2-=this.hash(b);this.s2+=~~(this.s2<0)}},hash:function(d){var c,b,e;e=4022871197;d=d.toString();for(b=0;b<d.length;b++){e+=d.charCodeAt(b);c=0.02519603282416938*e;e=c>>>0;c-=e;c*=e;e=c>>>0;c-=e;e+=c*4294967296}return(e>>>0)*2.3283064365386963e-10},integer:function(){return this.rnd.apply(this)*4294967296},frac:function(){return this.rnd.apply(this)+(this.rnd.apply(this)*2097152|0)*1.1102230246251565e-16},real:function(){return this.integer()+this.frac()},integerInRange:function(c,b){return Math.floor(this.realInRange(c,b))},realInRange:function(c,b){c=c||0;b=b||0;return this.frac()*(b-c)+c},normal:function(){return 1-2*this.frac()},uuid:function(){var d,c;for(c=d="";d++<36;c+=~d%5|d*3&4?(d^15?8^this.frac()*(d^20?16:4):4).toString(16):"-"){}return c},pick:function(b){return b[this.integerInRange(0,b.length)]},weightedPick:function(b){return b[~~(Math.pow(this.frac(),2)*b.length)]},timestamp:function(d,c){return this.realInRange(d||946684800000,c||1577862000000)},angle:function(){return this.integerInRange(-180,180)}};Phaser.Math={PI2:Math.PI*2,fuzzyEqual:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return Math.abs(d-c)<e},fuzzyLessThan:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return d<c+e},fuzzyGreaterThan:function(d,c,e){if(typeof e==="undefined"){e=0.0001}return d>c-e},fuzzyCeil:function(b,c){if(typeof c==="undefined"){c=0.0001}return Math.ceil(b-c)},fuzzyFloor:function(b,c){if(typeof c==="undefined"){c=0.0001}return Math.floor(b+c)},average:function(){var b=[];for(var d=0;d<(arguments.length-0);d++){b[d]=arguments[d+0]}var e=0;for(var c=0;c<b.length;c++){e+=b[c]}return e/b.length},truncate:function(b){return(b>0)?Math.floor(b):Math.ceil(b)},shear:function(b){return b%1},snapTo:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.round(b/d);return c+b},snapToFloor:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.floor(b/d);return c+b},snapToCeil:function(b,d,c){if(typeof c==="undefined"){c=0}if(d==0){return b}b-=c;b=d*Math.ceil(b/d);return c+b},snapToInArray:function(d,c,f){if(typeof f==="undefined"){f=true}if(f){c.sort()}if(d<c[0]){return c[0]}var e=1;while(c[e]<d){e++}var b=c[e-1];var g=(e<c.length)?c[e]:Number.POSITIVE_INFINITY;return((g-d)<=(d-b))?g:b},roundTo:function(d,b,c){if(typeof b==="undefined"){b=0}if(typeof c==="undefined"){c=10}var e=Math.pow(c,-b);return Math.round(d*e)/e},floorTo:function(d,b,c){if(typeof b==="undefined"){b=0}if(typeof c==="undefined"){c=10}var e=Math.pow(c,-b);return Math.floor(d*e)/e},ceilTo:function(d,b,c){if(typeof b==="undefined"){b=0}if(typeof c==="undefined"){c=10}var e=Math.pow(c,-b);return Math.ceil(d*e)/e},interpolateFloat:function(d,c,e){return(c-d)*e+d},angleBetween:function(c,e,b,d){return Math.atan2(d-e,b-c)},normalizeAngle:function(d,c){if(typeof c==="undefined"){c=true}var b=(c)?GameMath.PI:180;return this.wrap(d,b,-b)},nearestAngleBetween:function(c,b,e){if(typeof e==="undefined"){e=true}var d=(e)?GameMath.PI:180;c=this.normalizeAngle(c,e);b=this.normalizeAngle(b,e);if(c<-d/2&&b>d/2){c+=d*2}if(b<-d/2&&c>d/2){b+=d*2}return b-c},interpolateAngles:function(c,b,d,e,f){if(typeof e==="undefined"){e=true}if(typeof f==="undefined"){f=null}c=this.normalizeAngle(c,e);b=this.normalizeAngleToAnother(b,c,e);return(typeof f==="function")?f(d,c,b-c,1):this.interpolateFloat(c,b,d)},chanceRoll:function(b){if(typeof b==="undefined"){b=50}if(b<=0){return false}else{if(b>=100){return true}else{if(Math.random()*100>=b){return false}else{return true}}}},numberArray:function(e,c){var b=[];for(var d=e;d<=c;d++){b.push(d)}return b},maxAdd:function(d,c,b){d+=c;if(d>b){d=b}return d},minSub:function(d,c,b){d-=c;if(d<b){d=b}return d},wrapValue:function(d,c,b){var e;d=Math.abs(d);c=Math.abs(c);b=Math.abs(b);e=(d+c)%b;return e},randomSign:function(){return(Math.random()>0.5)?1:-1},isOdd:function(b){return(b&1)},isEven:function(b){if(b&1){return false}else{return true}},max:function(){for(var d=1,c=0,b=arguments.length;d<b;d++){if(arguments[c]<arguments[d]){c=d}}return arguments[c]},min:function(){for(var d=1,c=0,b=arguments.length;d<b;d++){if(arguments[d]<arguments[c]){c=d}}return arguments[c]},wrapAngle:function(c){var b=c;if(c>=-180&&c<=180){return c}b=(c+180)%360;if(b<0){b+=360}return b-180},angleLimit:function(e,d,c){var b=e;if(e>c){b=c}else{if(e<d){b=d}}return b},linearInterpolation:function(d,c){var b=d.length-1;var g=b*c;var e=Math.floor(g);if(c<0){return this.linear(d[0],d[1],g)}if(c>1){return this.linear(d[b],d[b-1],b-g)}return this.linear(d[e],d[e+1>b?b:e+1],g-e)},bezierInterpolation:function(e,d){var c=0;var g=e.length-1;for(var f=0;f<=g;f++){c+=Math.pow(1-d,g-f)*Math.pow(d,f)*e[f]*this.bernstein(g,f)}return c},catmullRomInterpolation:function(d,c){var b=d.length-1;var g=b*c;var e=Math.floor(g);if(d[0]===d[b]){if(c<0){e=Math.floor(g=b*(1+c))}return this.catmullRom(d[(e-1+b)%b],d[e],d[(e+1)%b],d[(e+2)%b],g-e)}else{if(c<0){return d[0]-(this.catmullRom(d[0],d[0],d[1],d[1],-g)-d[0])}if(c>1){return d[b]-(this.catmullRom(d[b],d[b],d[b-1],d[b-1],g-b)-d[b])}return this.catmullRom(d[e?e-1:0],d[e],d[b<e+1?b:e+1],d[b<e+2?b:e+2],g-e)}},linear:function(d,c,b){return(c-d)*b+d},bernstein:function(c,b){return this.factorial(c)/this.factorial(b)/this.factorial(c-b)},catmullRom:function(i,h,f,e,j){var g=(f-i)*0.5,d=(e-h)*0.5,c=j*j,b=j*c;return(2*h-2*f+g+d)*b+(-3*h+3*f-2*g-d)*c+g*j+h},difference:function(d,c){return Math.abs(d-c)},getRandom:function(d,e,c){if(typeof e==="undefined"){e=0}if(typeof c==="undefined"){c=0}if(d!=null){var b=c;if((b==0)||(b>d.length-e)){b=d.length-e}if(b>0){return d[e+Math.floor(Math.random()*b)]}}return null},floor:function(b){var c=b|0;return(b>0)?(c):((c!=b)?(c-1):(c))},ceil:function(b){var c=b|0;return(b>0)?((c!=b)?(c+1):(c)):(c)},sinCosGenerator:function(b,j,d,h){if(typeof j==="undefined"){j=1}if(typeof d==="undefined"){d=1}if(typeof h==="undefined"){h=1}var i=j;var l=d;var f=h*Math.PI/b;var e=[];var k=[];for(var g=0;g<b;g++){l-=i*f;i+=l*f;e[g]=l;k[g]=i}return{sin:k,cos:e}},shift:function(b){var c=b.shift();b.push(c);return c},shuffleArray:function(e){for(var d=e.length-1;d>0;d--){var c=Math.floor(Math.random()*(d+1));var b=e[d];e[d]=e[c];e[c]=b}return e},distance:function(e,g,d,f){var c=e-d;var b=g-f;return Math.sqrt(c*c+b*b)},distanceRounded:function(c,e,b,d){return Math.round(Phaser.Math.distance(c,e,b,d))},clamp:function(d,e,c){return(d<e)?e:((d>c)?c:d)},clampBottom:function(b,c){return b<c?c:b},mapLinear:function(c,d,b,f,e){return f+(c-d)*(e-f)/(b-d)},smoothstep:function(c,d,b){if(c<=d){return 0}if(c>=b){return 1}c=(c-d)/(b-d);return c*c*(3-2*c)},smootherstep:function(c,d,b){if(c<=d){return 0}if(c>=b){return 1}c=(c-d)/(b-d);return c*c*c*(c*(c*6-15)+10)},sign:function(b){return(b<0)?-1:((b>0)?1:0)},degToRad:function(){var b=Math.PI/180;return function(c){return c*b}}(),radToDeg:function(){var b=180/Math.PI;return function(c){return c*b}}()};Phaser.QuadTree=function(g,c,i,f,b,e,d,h){this.physicsManager=g;this.ID=g.quadTreeID;g.quadTreeID++;this.maxObjects=e||10;this.maxLevels=d||4;this.level=h||0;this.bounds={x:Math.round(c),y:Math.round(i),width:f,height:b,subWidth:Math.floor(f/2),subHeight:Math.floor(b/2),right:Math.round(c)+Math.floor(f/2),bottom:Math.round(i)+Math.floor(b/2)};this.objects=[];this.nodes=[]};Phaser.QuadTree.prototype={split:function(){this.level++;this.nodes[0]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[1]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.y,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[2]=new Phaser.QuadTree(this.physicsManager,this.bounds.x,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level);this.nodes[3]=new Phaser.QuadTree(this.physicsManager,this.bounds.right,this.bounds.bottom,this.bounds.subWidth,this.bounds.subHeight,this.maxObjects,this.maxLevels,this.level)},insert:function(b){var d=0;var c;if(this.nodes[0]!=null){c=this.getIndex(b);if(c!==-1){this.nodes[c].insert(b);return}}this.objects.push(b);if(this.objects.length>this.maxObjects&&this.level<this.maxLevels){if(this.nodes[0]==null){this.split()}while(d<this.objects.length){c=this.getIndex(this.objects[d]);if(c!==-1){this.nodes[c].insert(this.objects.splice(d,1)[0])}else{d++}}}},getIndex:function(c){var b=-1;if(c.x<this.bounds.right&&c.right<this.bounds.right){if((c.y<this.bounds.bottom&&c.bottom<this.bounds.bottom)){b=1}else{if((c.y>this.bounds.bottom)){b=2}}}else{if(c.x>this.bounds.right){if((c.y<this.bounds.bottom&&c.bottom<this.bounds.bottom)){b=0}else{if((c.y>this.bounds.bottom)){b=3}}}}return b},retrieve:function(b){var c=this.objects;b.body.quadTreeIndex=this.getIndex(b.body);b.body.quadTreeIDs.push(this.ID);if(this.nodes[0]){if(b.body.quadTreeIndex!==-1){c=c.concat(this.nodes[b.body.quadTreeIndex].retrieve(b))}else{c=c.concat(this.nodes[0].retrieve(b));c=c.concat(this.nodes[1].retrieve(b));c=c.concat(this.nodes[2].retrieve(b));c=c.concat(this.nodes[3].retrieve(b))}}return c},clear:function(){this.objects=[];for(var c=0,b=this.nodes.length;c<b;c++){if(this.nodes[c]){this.nodes[c].clear();delete this.nodes[c]}}}};Phaser.Circle=function(b,d,c){b=b||0;d=d||0;c=c||0;this.x=b;this.y=d;this._diameter=c;if(c>0){this._radius=c*0.5}else{this._radius=0}};Phaser.Circle.prototype={circumference:function(){return 2*(Math.PI*this._radius)},setTo:function(b,d,c){this.x=b;this.y=d;this._diameter=c;this._radius=c*0.5;return this},copyFrom:function(b){return this.setTo(b.x,b.y,b.diameter)},copyTo:function(b){b[x]=this.x;b[y]=this.y;b[diameter]=this._diameter;return b},distance:function(c,b){if(typeof b==="undefined"){b=false}if(b){return Phaser.Math.distanceRound(this.x,this.y,c.x,c.y)}else{return Phaser.Math.distance(this.x,this.y,c.x,c.y)}},clone:function(b){if(typeof b==="undefined"){b=new Phaser.Circle()}return b.setTo(a.x,a.y,a.diameter)},contains:function(b,c){return Phaser.Circle.contains(this,b,c)},circumferencePoint:function(d,c,b){return Phaser.Circle.circumferencePoint(this,d,c,b)},offset:function(c,b){this.x+=c;this.y+=b;return this},offsetPoint:function(b){return this.offset(b.x,b.y)},toString:function(){return"[{Phaser.Circle (x="+this.x+" y="+this.y+" diameter="+this.diameter+" radius="+this.radius+")}]"}};Object.defineProperty(Phaser.Circle.prototype,"diameter",{get:function(){return this._diameter},set:function(b){if(b>0){this._diameter=b;this._radius=b*0.5}}});Object.defineProperty(Phaser.Circle.prototype,"radius",{get:function(){return this._radius},set:function(b){if(b>0){this._radius=b;this._diameter=b*2}}});Object.defineProperty(Phaser.Circle.prototype,"left",{get:function(){return this.x-this._radius},set:function(b){if(b>this.x){this._radius=0;this._diameter=0}else{this.radius=this.x-b}}});Object.defineProperty(Phaser.Circle.prototype,"right",{get:function(){return this.x+this._radius},set:function(b){if(b<this.x){this._radius=0;this._diameter=0}else{this.radius=b-this.x}}});Object.defineProperty(Phaser.Circle.prototype,"top",{get:function(){return this.y-this._radius},set:function(b){if(b>this.y){this._radius=0;this._diameter=0}else{this.radius=this.y-b}}});Object.defineProperty(Phaser.Circle.prototype,"bottom",{get:function(){return this.y+this._radius},set:function(b){if(b<this.y){this._radius=0;this._diameter=0}else{this.radius=b-this.y}}});Object.defineProperty(Phaser.Circle.prototype,"area",{get:function(){if(this._radius>0){return Math.PI*this._radius*this._radius}else{return 0}}});Object.defineProperty(Phaser.Circle.prototype,"empty",{get:function(){return(this._diameter==0)},set:function(b){this.setTo(0,0,0)}});Phaser.Circle.contains=function(d,b,f){if(b>=d.left&&b<=d.right&&f>=d.top&&f<=d.bottom){var e=(d.x-b)*(d.x-b);var c=(d.y-f)*(d.y-f);return(e+c)<=(d.radius*d.radius)}return false};Phaser.Circle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.diameter==c.diameter)};Phaser.Circle.intersects=function(d,c){return(Phaser.Math.distance(d.x,d.y,c.x,c.y)<=(d.radius+c.radius))};Phaser.Circle.circumferencePoint=function(b,e,d,c){if(typeof d==="undefined"){d=false}if(typeof c==="undefined"){c=new Phaser.Point()}if(d===true){e=Phaser.Math.radToDeg(e)}c.x=b.x+b.radius*Math.cos(e);c.y=b.y+b.radius*Math.sin(e);return c};Phaser.Circle.intersectsRectangle=function(m,d){var g=Math.abs(m.x-d.x-d.halfWidth);var l=d.halfWidth+m.radius;if(g>l){return false}var f=Math.abs(m.y-d.y-d.halfHeight);var j=d.halfHeight+m.radius;if(f>j){return false}if(g<=d.halfWidth||f<=d.halfHeight){return true}var h=g-d.halfWidth;var e=f-d.halfHeight;var k=h*h;var b=e*e;var i=m.radius*m.radius;return k+b<=i};Phaser.Point=function(b,c){b=b||0;c=c||0;this.x=b;this.y=c};Phaser.Point.prototype={copyFrom:function(b){return this.setTo(b.x,b.y)},invert:function(){return this.setTo(this.y,this.x)},setTo:function(b,c){this.x=b;this.y=c;return this},add:function(b,c){this.x+=b;this.y+=c;return this},subtract:function(b,c){this.x-=b;this.y-=c;return this},multiply:function(b,c){this.x*=b;this.y*=c;return this},divide:function(b,c){this.x/=b;this.y/=c;return this},clampX:function(c,b){this.x=Phaser.Math.clamp(this.x,c,b);return this},clampY:function(c,b){this.y=Phaser.Math.clamp(this.y,c,b);return this},clamp:function(c,b){this.x=Phaser.Math.clamp(this.x,c,b);this.y=Phaser.Math.clamp(this.y,c,b);return this},clone:function(b){if(typeof b==="undefined"){b=new Phaser.Point}return b.setTo(this.x,this.y)},copyFrom:function(b){return this.setTo(b.x,b.y)},copyTo:function(b){b[x]=this.x;b[y]=this.y;return b},distance:function(c,b){return Phaser.Point.distance(this,c,b)},equals:function(b){return(b.x==this.x&&b.y==this.y)},rotate:function(b,f,d,c,e){return Phaser.Point.rotate(this,b,f,d,c,e)},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}};Phaser.Point.add=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x+c.x;e.y=d.y+c.y;return e};Phaser.Point.subtract=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x-c.x;e.y=d.y-c.y;return e};Phaser.Point.multiply=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x*c.x;e.y=d.y*c.y;return e};Phaser.Point.divide=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Point()}e.x=d.x/c.x;e.y=d.y/c.y;return e};Phaser.Point.equals=function(d,c){return(d.x==c.x&&d.y==c.y)};Phaser.Point.distance=function(d,c,e){if(typeof e==="undefined"){e=false}if(e){return Phaser.Math.distanceRound(d.x,d.y,c.x,c.y)}else{return Phaser.Math.distance(d.x,d.y,c.x,c.y)}},Phaser.Point.rotate=function(c,b,g,e,d,f){d=d||false;f=f||null;if(d){e=Phaser.Math.radToDeg(e)}if(f===null){f=Math.sqrt(((b-c.x)*(b-c.x))+((g-c.y)*(g-c.y)))}return c.setTo(b+f*Math.cos(e),g+f*Math.sin(e))};Phaser.Rectangle=function(c,e,d,b){c=c||0;e=e||0;d=d||0;b=b||0;this.x=c;this.y=e;this.width=d;this.height=b};Phaser.Rectangle.prototype={offset:function(c,b){this.x+=c;this.y+=b;return this},offsetPoint:function(b){return this.offset(b.x,b.y)},setTo:function(c,e,d,b){this.x=c;this.y=e;this.width=d;this.height=b;return this},floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y)},copyFrom:function(b){return this.setTo(b.x,b.y,b.width,b.height)},copyTo:function(b){b.x=this.x;b.y=this.y;b.width=this.width;b.height=this.height;return b},inflate:function(c,b){return Phaser.Rectangle.inflate(this,c,b)},size:function(b){return Phaser.Rectangle.size(this,b)},clone:function(b){return Phaser.Rectangle.clone(this,b)},contains:function(b,c){return Phaser.Rectangle.contains(this,b,c)},containsRect:function(c){return Phaser.Rectangle.containsRect(this,c)},equals:function(c){return Phaser.Rectangle.equals(this,c)},intersection:function(c,d){return Phaser.Rectangle.intersection(this,c,output)},intersects:function(c,d){return Phaser.Rectangle.intersects(this,c,d)},intersectsRaw:function(f,d,e,c,b){return Phaser.Rectangle.intersectsRaw(this,f,d,e,c,b)},union:function(c,d){return Phaser.Rectangle.union(this,c,d)},toString:function(){return"[{Rectangle (x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+" empty="+this.empty+")}]"}};Object.defineProperty(Phaser.Rectangle.prototype,"halfWidth",{get:function(){return Math.round(this.width/2)}});Object.defineProperty(Phaser.Rectangle.prototype,"halfHeight",{get:function(){return Math.round(this.height/2)}});Object.defineProperty(Phaser.Rectangle.prototype,"bottom",{get:function(){return this.y+this.height},set:function(b){if(b<=this.y){this.height=0}else{this.height=(this.y-b)}}});Object.defineProperty(Phaser.Rectangle.prototype,"bottomRight",{get:function(){return new Phaser.Point(this.right,this.bottom)},set:function(b){this.right=b.x;this.bottom=b.y}});Object.defineProperty(Phaser.Rectangle.prototype,"left",{get:function(){return this.x},set:function(b){if(b>=this.right){this.width=0}else{this.width=this.right-b}this.x=b}});Object.defineProperty(Phaser.Rectangle.prototype,"right",{get:function(){return this.x+this.width},set:function(b){if(b<=this.x){this.width=0}else{this.width=this.x+b}}});Object.defineProperty(Phaser.Rectangle.prototype,"volume",{get:function(){return this.width*this.height}});Object.defineProperty(Phaser.Rectangle.prototype,"perimeter",{get:function(){return(this.width*2)+(this.height*2)}});Object.defineProperty(Phaser.Rectangle.prototype,"centerX",{get:function(){return this.x+this.halfWidth},set:function(b){this.x=b-this.halfWidth}});Object.defineProperty(Phaser.Rectangle.prototype,"centerY",{get:function(){return this.y+this.halfHeight},set:function(b){this.y=b-this.halfHeight}});Object.defineProperty(Phaser.Rectangle.prototype,"top",{get:function(){return this.y},set:function(b){if(b>=this.bottom){this.height=0;this.y=b}else{this.height=(this.bottom-b)}}});Object.defineProperty(Phaser.Rectangle.prototype,"topLeft",{get:function(){return new Phaser.Point(this.x,this.y)},set:function(b){this.x=b.x;this.y=b.y}});Object.defineProperty(Phaser.Rectangle.prototype,"empty",{get:function(){return(!this.width||!this.height)},set:function(b){this.setTo(0,0,0,0)}});Phaser.Rectangle.inflate=function(c,d,b){c.x-=d;c.width+=2*d;c.y-=b;c.height+=2*b;return c};Phaser.Rectangle.inflatePoint=function(c,b){return Phaser.Phaser.Rectangle.inflate(c,b.x,b.y)};Phaser.Rectangle.size=function(b,c){if(typeof c==="undefined"){c=new Phaser.Point()}return c.setTo(b.width,b.height)};Phaser.Rectangle.clone=function(b,c){if(typeof c==="undefined"){c=new Phaser.Rectangle()}return c.setTo(b.x,b.y,b.width,b.height)};Phaser.Rectangle.contains=function(c,b,d){return(b>=c.x&&b<=c.right&&d>=c.y&&d<=c.bottom)};Phaser.Rectangle.containsPoint=function(c,b){return Phaser.Phaser.Rectangle.contains(c,b.x,b.y)};Phaser.Rectangle.containsRect=function(d,c){if(d.volume>c.volume){return false}return(d.x>=c.x&&d.y>=c.y&&d.right<=c.right&&d.bottom<=c.bottom)};Phaser.Rectangle.equals=function(d,c){return(d.x==c.x&&d.y==c.y&&d.width==c.width&&d.height==c.height)};Phaser.Rectangle.intersection=function(d,c,e){e=e||new Phaser.Rectangle;if(Phaser.Rectangle.intersects(d,c)){e.x=Math.max(d.x,c.x);e.y=Math.max(d.y,c.y);e.width=Math.min(d.right,c.right)-e.x;e.height=Math.min(d.bottom,c.bottom)-e.y}return e};Phaser.Rectangle.intersects=function(d,c,e){e=e||0;return !(d.x>c.right+e||d.right<c.x-e||d.y>c.bottom+e||d.bottom<c.y-e)};Phaser.Rectangle.intersectsRaw=function(b,g,e,f,d,c){if(typeof c==="undefined"){c=0}return !(g>b.right+c||e<b.left-c||f>b.bottom+c||d<b.top-c)};Phaser.Rectangle.union=function(d,c,e){if(typeof e==="undefined"){e=new Phaser.Rectangle()}return e.setTo(Math.min(d.x,c.x),Math.min(d.y,c.y),Math.max(d.right,c.right),Math.max(d.bottom,c.bottom))};Phaser.Net=function(b){this.game=b};Phaser.Net.prototype={getHostName:function(){if(window.location&&window.location.hostname){return window.location.hostname}return null},checkDomainName:function(b){return window.location.hostname.indexOf(b)!==-1},updateQueryString:function(d,f,i,c){if(typeof i==="undefined"){i=false}if(typeof c==="undefined"){c=""}if(c==""){c=window.location.href}var b="";var e=new RegExp("([?|&])"+d+"=.*?(&|#|$)(.*)","gi");if(e.test(c)){if(typeof f!=="undefined"&&f!==null){b=c.replace(e,"$1"+d+"="+f+"$2$3")}else{b=c.replace(e,"$1$3").replace(/(&|\?)$/,"")}}else{if(typeof f!=="undefined"&&f!==null){var h=c.indexOf("?")!==-1?"&":"?";var g=c.split("#");c=g[0]+h+d+"="+f;if(g[1]){c+="#"+g[1]}b=c}else{b=c}}if(i){window.location.href=b}else{return b}},getQueryString:function(f){if(typeof f==="undefined"){f=""}var c={};var b=location.search.substring(1).split("&");for(var e in b){var d=b[e].split("=");if(d.length>1){if(f&&f==this.decodeURI(d[0])){return this.decodeURI(d[1])}else{c[this.decodeURI(d[0])]=this.decodeURI(d[1])}}}return c},decodeURI:function(b){return decodeURIComponent(b.replace(/\+/g," "))}};Phaser.TweenManager=function(b){this.game=b;this._tweens=[];this._add=[];this.game.onPause.add(this.pauseAll,this);this.game.onResume.add(this.resumeAll,this)};Phaser.TweenManager.prototype={REVISION:"11dev",getAll:function(){return this._tweens},removeAll:function(){this._tweens=[]},add:function(b){this._add.push(b)},create:function(b){return new Phaser.Tween(b,this.game)},remove:function(c){var b=this._tweens.indexOf(c);if(b!==-1){this._tweens[b].pendingDelete=true}},update:function(){if(this._tweens.length===0&&this._add.length===0){return false}var b=0;var c=this._tweens.length;while(b<c){if(this._tweens[b].update(this.game.time.now)){b++}else{this._tweens.splice(b,1);c--}}if(this._add.length>0){this._tweens=this._tweens.concat(this._add);this._add.length=0}return true},pauseAll:function(){for(var b=this._tweens.length-1;b>=0;b--){this._tweens[b].pause()}},resumeAll:function(){for(var b=this._tweens.length-1;b>=0;b--){this._tweens[b].resume()}}};Phaser.Tween=function(c,b){this._object=c;this.game=b;this._manager=this.game.tweens;this._valuesStart={};this._valuesEnd={};this._valuesStartRepeat={};this._duration=1000;this._repeat=0;this._yoyo=false;this._reversed=false;this._delayTime=0;this._startTime=null;this._easingFunction=Phaser.Easing.Linear.None;this._interpolationFunction=Phaser.Math.linearInterpolation;this._chainedTweens=[];this._onStartCallback=null;this._onStartCallbackFired=false;this._onUpdateCallback=null;this._onCompleteCallback=null;this._pausedTime=0;this.pendingDelete=false;for(var d in c){this._valuesStart[d]=parseFloat(c[d],10)}this.onStart=new Phaser.Signal();this.onComplete=new Phaser.Signal();this.isRunning=false};Phaser.Tween.prototype={to:function(d,g,h,c,b,f,e){g=g||1000;h=h||null;c=c||false;b=b||0;f=f||0;e=e||false;this._repeat=f;this._duration=g;this._valuesEnd=d;if(h!==null){this._easingFunction=h}if(b>0){this._delayTime=b}this._yoyo=e;if(c){return this.start()}else{return this}},start:function(c){if(this.game===null||this._object===null){return}this._manager.add(this);this.onStart.dispatch(this._object);this.isRunning=true;this._onStartCallbackFired=false;this._startTime=this.game.time.now+this._delayTime;for(var b in this._valuesEnd){if(this._valuesEnd[b] instanceof Array){if(this._valuesEnd[b].length===0){continue}this._valuesEnd[b]=[this._object[b]].concat(this._valuesEnd[b])}this._valuesStart[b]=this._object[b];if((this._valuesStart[b] instanceof Array)===false){this._valuesStart[b]*=1}this._valuesStartRepeat[b]=this._valuesStart[b]||0}return this},stop:function(){this._manager.remove(this);this.isRunning=false;return this},delay:function(b){this._delayTime=b;return this},repeat:function(b){this._repeat=b;return this},yoyo:function(b){this._yoyo=b;return this},easing:function(b){this._easingFunction=b;return this},interpolation:function(b){this._interpolationFunction=b;return this},chain:function(){this._chainedTweens=arguments;return this},onStartCallback:function(b){this._onStartCallback=b;return this},onUpdateCallback:function(b){this._onUpdateCallback=b;return this},onCompleteCallback:function(b){this._onCompleteCallback=b;return this},pause:function(){this._paused=true},resume:function(){this._paused=false;this._startTime+=this.game.time.pauseDuration},update:function(c){if(this.pendingDelete){return false}if(this._paused||c<this._startTime){return true}var j;if(c<this._startTime){return true}if(this._onStartCallbackFired===false){if(this._onStartCallback!==null){this._onStartCallback.call(this._object)}this._onStartCallbackFired=true}var k=(c-this._startTime)/this._duration;k=k>1?1:k;var h=this._easingFunction(k);for(j in this._valuesEnd){var b=this._valuesStart[j]||0;var d=this._valuesEnd[j];if(d instanceof Array){this._object[j]=this._interpolationFunction(d,h)}else{if(typeof(d)==="string"){d=b+parseFloat(d,10)}if(typeof(d)==="number"){this._object[j]=b+(d-b)*h}}}if(this._onUpdateCallback!==null){this._onUpdateCallback.call(this._object,h)}if(k==1){if(this._repeat>0){if(isFinite(this._repeat)){this._repeat--}for(j in this._valuesStartRepeat){if(typeof(this._valuesEnd[j])==="string"){this._valuesStartRepeat[j]=this._valuesStartRepeat[j]+parseFloat(this._valuesEnd[j],10)}if(this._yoyo){var e=this._valuesStartRepeat[j];this._valuesStartRepeat[j]=this._valuesEnd[j];this._valuesEnd[j]=e;this._reversed=!this._reversed}this._valuesStart[j]=this._valuesStartRepeat[j]}this._startTime=c+this._delayTime;this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}return true}else{this.onComplete.dispatch(this._object);if(this._onCompleteCallback!==null){this._onCompleteCallback.call(this._object)}for(var f=0,g=this._chainedTweens.length;f<g;f++){this._chainedTweens[f].start(c)}return false}}return true}};Phaser.Easing={Linear:{None:function(b){return b}},Quadratic:{In:function(b){return b*b},Out:function(b){return b*(2-b)},InOut:function(b){if((b*=2)<1){return 0.5*b*b}return -0.5*(--b*(b-2)-1)}},Cubic:{In:function(b){return b*b*b},Out:function(b){return --b*b*b+1},InOut:function(b){if((b*=2)<1){return 0.5*b*b*b}return 0.5*((b-=2)*b*b+2)}},Quartic:{In:function(b){return b*b*b*b},Out:function(b){return 1-(--b*b*b*b)},InOut:function(b){if((b*=2)<1){return 0.5*b*b*b*b}return -0.5*((b-=2)*b*b*b-2)}},Quintic:{In:function(b){return b*b*b*b*b},Out:function(b){return --b*b*b*b*b+1},InOut:function(b){if((b*=2)<1){return 0.5*b*b*b*b*b}return 0.5*((b-=2)*b*b*b*b+2)}},Sinusoidal:{In:function(b){return 1-Math.cos(b*Math.PI/2)},Out:function(b){return Math.sin(b*Math.PI/2)},InOut:function(b){return 0.5*(1-Math.cos(Math.PI*b))}},Exponential:{In:function(b){return b===0?0:Math.pow(1024,b-1)},Out:function(b){return b===1?1:1-Math.pow(2,-10*b)},InOut:function(b){if(b===0){return 0}if(b===1){return 1}if((b*=2)<1){return 0.5*Math.pow(1024,b-1)}return 0.5*(-Math.pow(2,-10*(b-1))+2)}},Circular:{In:function(b){return 1-Math.sqrt(1-b*b)},Out:function(b){return Math.sqrt(1-(--b*b))},InOut:function(b){if((b*=2)<1){return -0.5*(Math.sqrt(1-b*b)-1)}return 0.5*(Math.sqrt(1-(b-=2)*b)+1)}},Elastic:{In:function(c){var d,b=0.1,e=0.4;if(c===0){return 0}if(c===1){return 1}if(!b||b<1){b=1;d=e/4}else{d=e*Math.asin(1/b)/(2*Math.PI)}return -(b*Math.pow(2,10*(c-=1))*Math.sin((c-d)*(2*Math.PI)/e))},Out:function(c){var d,b=0.1,e=0.4;if(c===0){return 0}if(c===1){return 1}if(!b||b<1){b=1;d=e/4}else{d=e*Math.asin(1/b)/(2*Math.PI)}return(b*Math.pow(2,-10*c)*Math.sin((c-d)*(2*Math.PI)/e)+1)},InOut:function(c){var d,b=0.1,e=0.4;if(c===0){return 0}if(c===1){return 1}if(!b||b<1){b=1;d=e/4}else{d=e*Math.asin(1/b)/(2*Math.PI)}if((c*=2)<1){return -0.5*(b*Math.pow(2,10*(c-=1))*Math.sin((c-d)*(2*Math.PI)/e))}return b*Math.pow(2,-10*(c-=1))*Math.sin((c-d)*(2*Math.PI)/e)*0.5+1}},Back:{In:function(b){var c=1.70158;return b*b*((c+1)*b-c)},Out:function(b){var c=1.70158;return --b*b*((c+1)*b+c)+1},InOut:function(b){var c=1.70158*1.525;if((b*=2)<1){return 0.5*(b*b*((c+1)*b-c))}return 0.5*((b-=2)*b*((c+1)*b+c)+2)}},Bounce:{In:function(b){return 1-TWEEN.Easing.Bounce.Out(1-b)},Out:function(b){if(b<(1/2.75)){return 7.5625*b*b}else{if(b<(2/2.75)){return 7.5625*(b-=(1.5/2.75))*b+0.75}else{if(b<(2.5/2.75)){return 7.5625*(b-=(2.25/2.75))*b+0.9375}else{return 7.5625*(b-=(2.625/2.75))*b+0.984375}}}},InOut:function(b){if(b<0.5){return TWEEN.Easing.Bounce.In(b*2)*0.5}return TWEEN.Easing.Bounce.Out(b*2-1)*0.5+0.5}}};Phaser.Time=function(b){this.game=b;this._started=0;this._timeLastSecond=0;this._pauseStarted=0;this.physicsElapsed=0;this.time=0;this.pausedTime=0;this.now=0;this.elapsed=0;this.fps=0;this.fpsMin=1000;this.fpsMax=0;this.msMin=1000;this.msMax=0;this.frames=0;this.pauseDuration=0;this.timeToCall=0;this.lastTime=0;this.game.onPause.add(this.gamePaused,this);this.game.onResume.add(this.gameResumed,this);this._justResumed=false};Phaser.Time.prototype={totalElapsedSeconds:function(){return(this.now-this._started)*0.001},update:function(b){this.now=b;if(this._justResumed){this.time=this.now;this._justResumed=false}this.timeToCall=this.game.math.max(0,16-(b-this.lastTime));this.elapsed=this.now-this.time;this.msMin=this.game.math.min(this.msMin,this.elapsed);this.msMax=this.game.math.max(this.msMax,this.elapsed);this.frames++;if(this.now>this._timeLastSecond+1000){this.fps=Math.round((this.frames*1000)/(this.now-this._timeLastSecond));this.fpsMin=this.game.math.min(this.fpsMin,this.fps);this.fpsMax=this.game.math.max(this.fpsMax,this.fps);this._timeLastSecond=this.now;this.frames=0}this.time=this.now;this.lastTime=b+this.timeToCall;this.physicsElapsed=1*(this.elapsed/1000);if(this.game.paused){this.pausedTime=this.now-this._pauseStarted}},gamePaused:function(){this._pauseStarted=this.now},gameResumed:function(){this.time=Date.now();this.pauseDuration=this.pausedTime;this._justResumed=true},elapsedSince:function(b){return this.now-b},elapsedSecondsSince:function(b){return(this.now-b)*0.001},reset:function(){this._started=this.now}};Phaser.AnimationManager=function(b){this.sprite=b;this.game=b.game;this.currentFrame=null;this.updateIfVisible=true;this._frameData=null;this._anims={};this._outputFrames=[]};Phaser.AnimationManager.prototype={loadFrameData:function(b){this._frameData=b;this.frame=0},add:function(e,f,d,c,b){if(this._frameData==null){console.warn("No FrameData available for Phaser.Animation "+e);return}d=d||60;if(typeof c==="undefined"){c=false}if(typeof b==="undefined"){b=true}if(this.sprite.events.onAnimationStart==null){this.sprite.events.onAnimationStart=new Phaser.Signal();this.sprite.events.onAnimationComplete=new Phaser.Signal();this.sprite.events.onAnimationLoop=new Phaser.Signal()}this._outputFrames.length=0;this._frameData.getFrameIndexes(f,b,this._outputFrames);this._anims[e]=new Phaser.Animation(this.game,this.sprite,e,this._frameData,this._outputFrames,d,c);this.currentAnim=this._anims[e];this.currentFrame=this.currentAnim.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);return this._anims[e]},validateFrames:function(d,b){if(typeof b=="undefined"){b=true}for(var c=0;c<d.length;c++){if(b==true){if(d[c]>this._frameData.total){return false}}else{if(this._frameData.checkFrameName(d[c])==false){return false}}}return true},play:function(d,c,b){if(this._anims[d]){if(this.currentAnim==this._anims[d]){if(this.currentAnim.isPlaying==false){return this.currentAnim.play(c,b)}}else{this.currentAnim=this._anims[d];return this.currentAnim.play(c,b)}}},stop:function(c,b){if(typeof b=="undefined"){b=false}if(typeof c=="string"){if(this._anims[c]){this.currentAnim=this._anims[c];this.currentAnim.stop(b)}}else{if(this.currentAnim){this.currentAnim.stop(b)}}},update:function(){if(this.updateIfVisible&&this.sprite.visible==false){return false}if(this.currentAnim&&this.currentAnim.update()==true){this.currentFrame=this.currentAnim.currentFrame;this.sprite.currentFrame=this.currentFrame;return true}return false},destroy:function(){this._anims={};this._frameData=null;this._frameIndex=0;this.currentAnim=null;this.currentFrame=null}};Object.defineProperty(Phaser.AnimationManager.prototype,"frameData",{get:function(){return this._frameData}});Object.defineProperty(Phaser.AnimationManager.prototype,"frameTotal",{get:function(){if(this._frameData){return this._frameData.total}else{return -1}}});Object.defineProperty(Phaser.AnimationManager.prototype,"frame",{get:function(){if(this.currentFrame){return this._frameIndex}},set:function(b){if(this._frameData&&this._frameData.getFrame(b)!==null){this.currentFrame=this._frameData.getFrame(b);this._frameIndex=b;this.sprite.currentFrame=this.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}}});Object.defineProperty(Phaser.AnimationManager.prototype,"frameName",{get:function(){if(this.currentFrame){return this.currentFrame.name}},set:function(b){if(this._frameData&&this._frameData.getFrameByName(b)!==null){this.currentFrame=this._frameData.getFrameByName(b);this._frameIndex=this.currentFrame.index;this.sprite.currentFrame=this.currentFrame;this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}else{console.warn("Cannot set frameName: "+b)}}});Phaser.Animation=function(c,g,e,f,h,d,b){this.game=c;this._parent=g;this._frameData=f;this.name=e;this._frames=[];this._frames=this._frames.concat(h);this.delay=1000/d;this.looped=b;this.isFinished=false;this.isPlaying=false;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])};Phaser.Animation.prototype={play:function(c,b){c=c||null;b=b||null;if(c!==null){this.delay=1000/c}if(b!==null){this.looped=b}this.isPlaying=true;this.isFinished=false;this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);if(this._parent.events){this._parent.events.onAnimationStart.dispatch(this._parent,this)}return this},restart:function(){this.isPlaying=true;this.isFinished=false;this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex])},stop:function(b){if(typeof b==="undefined"){b=false}this.isPlaying=false;this.isFinished=true;if(b){this.currentFrame=this._frameData.getFrame(this._frames[0])}},update:function(){if(this.isPlaying==true&&this.game.time.now>=this._timeNextFrame){this._frameIndex++;if(this._frameIndex==this._frames.length){if(this.looped){this._frameIndex=0;this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);this._parent.events.onAnimationLoop.dispatch(this._parent,this)}else{this.onComplete()}}else{this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]);this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}this._timeLastFrame=this.game.time.now;this._timeNextFrame=this.game.time.now+this.delay;return true}return false},destroy:function(){this.game=null;this._parent=null;this._frames=null;this._frameData=null;this.currentFrame=null;this.isPlaying=false},onComplete:function(){this.isPlaying=false;this.isFinished=true;if(this._parent.events){this._parent.events.onAnimationComplete.dispatch(this._parent,this)}}};Object.defineProperty(Phaser.Animation.prototype,"frameTotal",{get:function(){return this._frames.length}});Object.defineProperty(Phaser.Animation.prototype,"frame",{get:function(){if(this.currentFrame!==null){return this.currentFrame.index}else{return this._frameIndex}},set:function(b){this.currentFrame=this._frameData.getFrame(b);if(this.currentFrame!==null){this._frameIndex=b;this._parent.setTexture(PIXI.TextureCache[this.currentFrame.uuid])}}});Phaser.Animation.Frame=function(e,c,h,g,b,d,f){this.index=e;this.x=c;this.y=h;this.width=g;this.height=b;this.name=d;this.uuid=f;this.centerX=Math.floor(g/2);this.centerY=Math.floor(b/2);this.distance=Phaser.Math.distance(0,0,g,b);this.rotated=false;this.rotationDirection="cw";this.trimmed=false;this.sourceSizeW=g;this.sourceSizeH=b;this.spriteSourceSizeX=0;this.spriteSourceSizeY=0;this.spriteSourceSizeW=0;this.spriteSourceSizeH=0};Phaser.Animation.Frame.prototype={setTrim:function(f,e,h,c,b,d,g){this.trimmed=f;if(f){this.width=e;this.height=h;this.sourceSizeW=e;this.sourceSizeH=h;this.centerX=Math.floor(e/2);this.centerY=Math.floor(h/2);this.spriteSourceSizeX=c;this.spriteSourceSizeY=b;this.spriteSourceSizeW=d;this.spriteSourceSizeH=g}}};Phaser.Animation.FrameData=function(){this._frames=[];this._frameNames=[]};Phaser.Animation.FrameData.prototype={addFrame:function(b){b.index=this._frames.length;this._frames.push(b);if(b.name!==""){this._frameNames[b.name]=b.index}return b},getFrame:function(b){if(this._frames[b]){return this._frames[b]}return null},getFrameByName:function(b){if(typeof this._frameNames[b]==="number"){return this._frames[this._frameNames[b]]}return null},checkFrameName:function(b){if(this._frameNames[b]==null){return false}return true},getFrameRange:function(e,b,c){if(typeof c==="undefined"){c=[]}for(var d=e;d<=b;d++){c.push(this._frames[d])}return c},getFrames:function(f,c,d){if(typeof c==="undefined"){c=true}if(typeof d==="undefined"){d=[]}if(typeof f==="undefined"||f.length==0){for(var e=0;e<this._frames.length;e++){d.push(this._frames[e])}}else{for(var e=0,b=f.length;e<b;e++){if(c){d.push(this.getFrame(f[e]))}else{d.push(this.getFrameByName(f[e]))}}}return d},getFrameIndexes:function(f,c,d){if(typeof c==="undefined"){c=true}if(typeof d==="undefined"){d=[]}if(typeof f==="undefined"||f.length==0){for(var e=0,b=this._frames.length;e<b;e++){d.push(this._frames[e].index)}}else{for(var e=0,b=f.length;e<b;e++){if(c){d.push(f[e])}else{d.push(this.getFrameByName(f[e]).index)}}}return d}};Object.defineProperty(Phaser.Animation.FrameData.prototype,"total",{get:function(){return this._frames.length}});Phaser.Animation.Parser={spriteSheet:function(p,o,m,f,e){var j=p.cache.getImage(o);if(j==null){return null}var c=j.width;var q=j.height;var r=Math.round(c/m);var d=Math.round(q/f);var l=r*d;if(e!==-1){l=e}if(c==0||q==0||c<m||q<f||l===0){console.warn("Phaser.Animation.Parser.spriteSheet: width/height zero or width/height < given frameWidth/frameHeight");return null}var h=new Phaser.Animation.FrameData();var n=0;var k=0;for(var g=0;g<l;g++){var b=p.rnd.uuid();h.addFrame(new Phaser.Animation.Frame(g,n,k,m,f,"",b));PIXI.TextureCache[b]=new PIXI.Texture(PIXI.BaseTextureCache[o],{x:n,y:k,width:m,height:f});n+=m;if(n===c){n=0;k+=f}}return h},JSONData:function(b,d,h){if(!d.frames){console.warn("Phaser.Animation.Parser.JSONData: Invalid Texture Atlas JSON given, missing 'frames' array");console.log(d);return}var f=new Phaser.Animation.FrameData();var g=d.frames;var j;for(var c=0;c<g.length;c++){var e=b.rnd.uuid();j=f.addFrame(new Phaser.Animation.Frame(c,g[c].frame.x,g[c].frame.y,g[c].frame.w,g[c].frame.h,g[c].filename,e));PIXI.TextureCache[e]=new PIXI.Texture(PIXI.BaseTextureCache[h],{x:g[c].frame.x,y:g[c].frame.y,width:g[c].frame.w,height:g[c].frame.h});if(g[c].trimmed){j.setTrim(g[c].trimmed,g[c].sourceSize.w,g[c].sourceSize.h,g[c].spriteSourceSize.x,g[c].spriteSourceSize.y,g[c].spriteSourceSize.w,g[c].spriteSourceSize.h);PIXI.TextureCache[e].realSize=g[c].spriteSourceSize;PIXI.TextureCache[e].trim.x=0}}return f},JSONDataHash:function(j,k,f){if(!k.frames){console.warn("Phaser.Animation.Parser.JSONDataHash: Invalid Texture Atlas JSON given, missing 'frames' object");console.log(k);return}var c=new Phaser.Animation.FrameData();var g=k.frames;var e;var d=0;for(var h in g){var b=j.rnd.uuid();e=c.addFrame(new Phaser.Animation.Frame(d,g[h].frame.x,g[h].frame.y,g[h].frame.w,g[h].frame.h,h,b));PIXI.TextureCache[b]=new PIXI.Texture(PIXI.BaseTextureCache[f],{x:g[h].frame.x,y:g[h].frame.y,width:g[h].frame.w,height:g[h].frame.h});if(g[h].trimmed){e.setTrim(g[h].trimmed,g[h].sourceSize.w,g[h].sourceSize.h,g[h].spriteSourceSize.x,g[h].spriteSourceSize.y,g[h].spriteSourceSize.w,g[h].spriteSourceSize.h);PIXI.TextureCache[b].realSize=g[h].spriteSourceSize;PIXI.TextureCache[b].trim.x=0}d++}return c},XMLData:function(k,g,h){if(!g.getElementsByTagName("TextureAtlas")){console.warn("Phaser.Animation.Parser.XMLData: Invalid Texture Atlas XML given, missing <TextureAtlas> tag");return}var d=new Phaser.Animation.FrameData();var j=g.getElementsByTagName("SubTexture");var f;for(var e=0;e<j.length;e++){var b=k.rnd.uuid();var c=j[e].attributes;f=d.addFrame(new Phaser.Animation.Frame(e,c.x.nodeValue,c.y.nodeValue,c.width.nodeValue,c.height.nodeValue,c.name.nodeValue,b));PIXI.TextureCache[b]=new PIXI.Texture(PIXI.BaseTextureCache[h],{x:c.x.nodeValue,y:c.y.nodeValue,width:c.width.nodeValue,height:c.height.nodeValue});if(c.frameX.nodeValue!="-0"||c.frameY.nodeValue!="-0"){f.setTrim(true,c.width.nodeValue,c.height.nodeValue,Math.abs(c.frameX.nodeValue),Math.abs(c.frameY.nodeValue),c.frameWidth.nodeValue,c.frameHeight.nodeValue);PIXI.TextureCache[b].realSize={x:Math.abs(c.frameX.nodeValue),y:Math.abs(c.frameY.nodeValue),w:c.frameWidth.nodeValue,h:c.frameHeight.nodeValue};PIXI.TextureCache[b].trim.x=0}}return d}};Phaser.Cache=function(b){this.game=b;this._canvases={};this._images={};this._textures={};this._sounds={};this._text={};this._tilemaps={};this.addDefaultImage();this.onSoundUnlock=new Phaser.Signal};Phaser.Cache.prototype={addCanvas:function(d,b,c){this._canvases[d]={canvas:b,context:c}},addRenderTexture:function(b,c){var d=new Phaser.Animation.Frame(0,0,0,c.width,c.height,"","");this._textures[b]={texture:c,frame:d}},addSpriteSheet:function(e,d,f,b,c,g){this._images[e]={url:d,data:f,spriteSheet:true,frameWidth:b,frameHeight:c};PIXI.BaseTextureCache[e]=new PIXI.BaseTexture(f);PIXI.TextureCache[e]=new PIXI.Texture(PIXI.BaseTextureCache[e]);this._images[e].frameData=Phaser.Animation.Parser.spriteSheet(this.game,e,b,c,g)},addTilemap:function(c,b,d,f,e){this._tilemaps[c]={url:b,data:d,spriteSheet:true,mapData:f,format:e};PIXI.BaseTextureCache[c]=new PIXI.BaseTexture(d);PIXI.TextureCache[c]=new PIXI.Texture(PIXI.BaseTextureCache[c])},addTextureAtlas:function(d,c,e,b,f){this._images[d]={url:c,data:e,spriteSheet:true};PIXI.BaseTextureCache[d]=new PIXI.BaseTexture(e);PIXI.TextureCache[d]=new PIXI.Texture(PIXI.BaseTextureCache[d]);if(f==Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY){this._images[d].frameData=Phaser.Animation.Parser.JSONData(this.game,b,d)}else{if(f==Phaser.Loader.TEXTURE_ATLAS_JSON_HASH){this._images[d].frameData=Phaser.Animation.Parser.JSONDataHash(this.game,b,d)}else{if(f==Phaser.Loader.TEXTURE_ATLAS_XML_STARLING){this._images[d].frameData=Phaser.Animation.Parser.XMLData(this.game,b,d)}}}},addBitmapFont:function(c,b,e,d){this._images[c]={url:b,data:e,spriteSheet:true};PIXI.BaseTextureCache[c]=new PIXI.BaseTexture(e);PIXI.TextureCache[c]=new PIXI.Texture(PIXI.BaseTextureCache[c]);Phaser.Loader.Parser.bitmapFont(this.game,d,c)},addDefaultImage:function(){this._images.__default={url:null,data:null,spriteSheet:false};this._images.__default.frame=new Phaser.Animation.Frame(0,0,0,32,32,"","");var b=new PIXI.BaseTexture();b.width=32;b.height=32;b.hasLoaded=true;PIXI.BaseTextureCache.__default=b;PIXI.TextureCache.__default=new PIXI.Texture(b)},addImage:function(c,b,d){this._images[c]={url:b,data:d,spriteSheet:false};this._images[c].frame=new Phaser.Animation.Frame(0,0,0,d.width,d.height,"","");PIXI.BaseTextureCache[c]=new PIXI.BaseTexture(d);PIXI.TextureCache[c]=new PIXI.Texture(PIXI.BaseTextureCache[c])},addSound:function(f,e,h,d,g){d=d||true;g=g||false;var c=this.game.sound.touchLocked;var b=false;if(g){b=true}this._sounds[f]={url:e,data:h,isDecoding:false,decoded:b,webAudio:d,audioTag:g}},reloadSound:function(b){var c=this;if(this._sounds[b]){this._sounds[b].data.src=this._sounds[b].url;this._sounds[b].data.addEventListener("canplaythrough",function(){return c.reloadSoundComplete(b)},false);this._sounds[b].data.load()}},reloadSoundComplete:function(b){if(this._sounds[b]){this._sounds[b].locked=false;this.onSoundUnlock.dispatch(b)}},updateSound:function(b,d,c){if(this._sounds[b]){this._sounds[b][d]=c}},decodedSound:function(b,c){this._sounds[b].data=c;this._sounds[b].decoded=true;this._sounds[b].isDecoding=false},addText:function(c,b,d){this._text[c]={url:b,data:d}},getCanvas:function(b){if(this._canvases[b]){return this._canvases[b].canvas}return null},checkImageKey:function(b){if(this._images[b]){return true}return false},getImage:function(b){if(this._images[b]){return this._images[b].data}return null},getTilemap:function(b){if(this._tilemaps[b]){return this._tilemaps[b]}return null},getFrameData:function(b){if(this._images[b]&&this._images[b].frameData){return this._images[b].frameData}return null},getFrameByIndex:function(b,c){if(this._images[b]&&this._images[b].frameData){return this._images[b].frameData.getFrame(c)}return null},getFrameByName:function(b,c){if(this._images[b]&&this._images[b].frameData){return this._images[b].frameData.getFrameByName(c)}return null},getFrame:function(b){if(this._images[b]&&this._images[b].spriteSheet==false){return this._images[b].frame}return null},getTextureFrame:function(b){if(this._textures[b]){return this._textures[b].frame}return null},getTexture:function(b){if(this._textures[b]){return this._textures[b]}return null},getSound:function(b){if(this._sounds[b]){return this._sounds[b]}return null},getSoundData:function(b){if(this._sounds[b]){return this._sounds[b].data}return null},isSoundDecoded:function(b){if(this._sounds[b]){return this._sounds[b].decoded}},isSoundReady:function(b){return(this._sounds[b]&&this._sounds[b].decoded&&this.game.sound.touchLocked==false)},isSpriteSheet:function(b){if(this._images[b]){return this._images[b].spriteSheet}return false},getText:function(b){if(this._text[b]){return this._text[b].data}return null},getKeys:function(d){var b=[];for(var c in d){if(c!=="__default"){b.push(c)}}return b},getImageKeys:function(){return this.getKeys(this._images)},getSoundKeys:function(){return this.getKeys(this._sounds)},getTextKeys:function(){return this.getKeys(this._text)},removeCanvas:function(b){delete this._canvases[b]},removeImage:function(b){delete this._images[b]},removeSound:function(b){delete this._sounds[b]},removeText:function(b){delete this._text[b]},destroy:function(){for(var b in this._canvases){delete this._canvases[b.key]}for(var b in this._images){delete this._images[b.key]}for(var b in this._sounds){delete this._sounds[b.key]}for(var b in this._text){delete this._text[b.key]}}};Phaser.Loader=function(b){this.game=b;this._keys=[];this._fileList={};this._progressChunk=0;this._xhr=new XMLHttpRequest();this.queueSize=0;this.isLoading=false;this.hasLoaded=false;this.progress=0;this.preloadSprite=null;this.crossOrigin="";this.baseURL="";this.onFileComplete=new Phaser.Signal;this.onFileError=new Phaser.Signal;this.onLoadStart=new Phaser.Signal;this.onLoadComplete=new Phaser.Signal};Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY=0;Phaser.Loader.TEXTURE_ATLAS_JSON_HASH=1;Phaser.Loader.TEXTURE_ATLAS_XML_STARLING=2;Phaser.Loader.prototype={setPreloadSprite:function(b,c){c=c||0;this.preloadSprite={sprite:b,direction:c,width:b.width,height:b.height,crop:null};if(c==0){this.preloadSprite.crop=new Phaser.Rectangle(0,0,0,b.height)}else{this.preloadSprite.crop=new Phaser.Rectangle(0,0,b.width,0)}b.crop=this.preloadSprite.crop},checkKeyExists:function(b){if(this._fileList[b]){return true}else{return false}},reset:function(){this.preloadSprite=null;this.queueSize=0;this.isLoading=false},addToFileList:function(e,d,b,c){var f={type:e,key:d,url:b,data:null,error:false,loaded:false};if(typeof c!=="undefined"){for(var g in c){f[g]=c[g]}}this._fileList[d]=f;this._keys.push(d);this.queueSize++},image:function(d,c,b){if(typeof b==="undefined"){b=false}if(b||this.checkKeyExists(d)==false){this.addToFileList("image",d,c)}},text:function(d,c,b){if(typeof b==="undefined"){b=false}if(b||this.checkKeyExists(d)==false){this.addToFileList("text",d,c)}},spritesheet:function(e,d,b,c,f){if(typeof f==="undefined"){f=-1}if(this.checkKeyExists(e)===false){this.addToFileList("spritesheet",e,d,{frameWidth:b,frameHeight:c,frameMax:f})}},audio:function(c,d,b){if(typeof b==="undefined"){b=true}if(this.checkKeyExists(c)===false){this.addToFileList("audio",c,d,{buffer:null,autoDecode:b})}},tilemap:function(b,c,f,e,d){if(typeof f==="undefined"){f=null}if(typeof e==="undefined"){e=null}if(typeof d==="undefined"){d=Phaser.Tilemap.CSV}if(this.checkKeyExists(b)===false){if(f){this.addToFileList("tilemap",b,c,{mapDataURL:f,format:d})}else{switch(d){case Phaser.Tilemap.CSV:break;case Phaser.Tilemap.JSON:if(typeof e==="string"){e=JSON.parse(e)}break}this.addToFileList("tilemap",b,c,{mapDataURL:null,mapData:e,format:d})}}},bitmapFont:function(f,d,c,g){if(typeof c==="undefined"){c=null}if(typeof g==="undefined"){g=null}if(this.checkKeyExists(f)===false){if(c){this.addToFileList("bitmapfont",f,d,{xmlURL:c})}else{if(typeof g==="string"){var b;try{if(window.DOMParser){var i=new DOMParser();b=i.parseFromString(g,"text/xml")}else{b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(g)}}catch(h){b=undefined}if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length){throw new Error("Phaser.Loader. Invalid Bitmap Font XML given")}else{this.addToFileList("bitmapfont",f,d,{xmlURL:null,xmlData:b})}}}}},atlasJSONArray:function(d,c,e,b){this.atlas(d,c,e,b,Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY)},atlasJSONHash:function(d,c,e,b){this.atlas(d,c,e,b,Phaser.Loader.TEXTURE_ATLAS_JSON_HASH)},atlasXML:function(d,c,e,b){this.atlas(d,c,e,b,Phaser.Loader.TEXTURE_ATLAS_XML_STARLING)},atlas:function(f,d,g,b,i){if(typeof g==="undefined"){g=null}if(typeof b==="undefined"){b=null}if(typeof i==="undefined"){i=Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY}if(this.checkKeyExists(f)===false){if(g){this.addToFileList("textureatlas",f,d,{atlasURL:g,format:i})}else{switch(i){case Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY:if(typeof b==="string"){b=JSON.parse(b)}break;case Phaser.Loader.TEXTURE_ATLAS_XML_STARLING:if(typeof b==="string"){var c;try{if(window.DOMParser){var j=new DOMParser();c=j.parseFromString(b,"text/xml")}else{c=new ActiveXObject("Microsoft.XMLDOM");c.async="false";c.loadXML(b)}}catch(h){c=undefined}if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length){throw new Error("Phaser.Loader. Invalid Texture Atlas XML given")}else{b=c}}break}this.addToFileList("textureatlas",f,d,{atlasURL:null,atlasData:b,format:i})}}},removeFile:function(b){delete this._fileList[b]},removeAll:function(){this._fileList={}},start:function(){if(this.isLoading){return}this.progress=0;this.hasLoaded=false;this.isLoading=true;this.onLoadStart.dispatch(this.queueSize);if(this._keys.length>0){this._progressChunk=100/this._keys.length;this.loadFile()}else{this.progress=100;this.hasLoaded=true;this.onLoadComplete.dispatch()}},loadFile:function(){var b=this._fileList[this._keys.shift()];var c=this;switch(b.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":case"tilemap":b.data=new Image();b.data.name=b.key;b.data.onload=function(){return c.fileComplete(b.key)};b.data.onerror=function(){return c.fileError(b.key)};b.data.crossOrigin=this.crossOrigin;b.data.src=this.baseURL+b.url;break;case"audio":b.url=this.getAudioURL(b.url);if(b.url!==null){if(this.game.sound.usingWebAudio){this._xhr.open("GET",this.baseURL+b.url,true);this._xhr.responseType="arraybuffer";this._xhr.onload=function(){return c.fileComplete(b.key)};this._xhr.onerror=function(){return c.fileError(b.key)};this._xhr.send()}else{if(this.game.sound.usingAudioTag){if(this.game.sound.touchLocked){b.data=new Audio();b.data.name=b.key;b.data.preload="auto";b.data.src=this.baseURL+b.url;this.fileComplete(b.key)}else{b.data=new Audio();b.data.name=b.key;b.data.onerror=function(){return c.fileError(b.key)};b.data.preload="auto";b.data.src=this.baseURL+b.url;b.data.addEventListener("canplaythrough",Phaser.GAMES[this.game.id].load.fileComplete(b.key),false);b.data.load()}}}}else{this.fileError(b.key)}break;case"text":this._xhr.open("GET",this.baseURL+b.url,true);this._xhr.responseType="text";this._xhr.onload=function(){return c.fileComplete(b.key)};this._xhr.onerror=function(){return c.fileError(b.key)};this._xhr.send();break}},getAudioURL:function(c){var d;for(var b=0;b<c.length;b++){d=c[b].toLowerCase();d=d.substr((Math.max(0,d.lastIndexOf("."))||Infinity)+1);if(this.game.device.canPlayAudio(d)){return c[b]}}return null},fileError:function(b){this._fileList[b].loaded=true;this._fileList[b].error=true;this.onFileError.dispatch(b);console.warn("Phaser.Loader error loading file: "+b);this.nextFile(b,false)},fileComplete:function(c){if(!this._fileList[c]){console.warn("Phaser.Loader fileComplete invalid key "+c);return}this._fileList[c].loaded=true;var b=this._fileList[c];var e=true;var f=this;switch(b.type){case"image":this.game.cache.addImage(b.key,b.url,b.data);break;case"spritesheet":this.game.cache.addSpriteSheet(b.key,b.url,b.data,b.frameWidth,b.frameHeight,b.frameMax);break;case"tilemap":if(b.mapDataURL==null){this.game.cache.addTilemap(b.key,b.url,b.data,b.mapData,b.format)}else{e=false;this._xhr.open("GET",this.baseURL+b.mapDataURL,true);this._xhr.responseType="text";if(b.format==Phaser.Tilemap.JSON){this._xhr.onload=function(){return f.jsonLoadComplete(b.key)}}else{if(b.format==Phaser.Tilemap.CSV){this._xhr.onload=function(){return f.csvLoadComplete(b.key)}}}this._xhr.onerror=function(){return f.dataLoadError(b.key)};this._xhr.send()}break;case"textureatlas":if(b.atlasURL==null){this.game.cache.addTextureAtlas(b.key,b.url,b.data,b.atlasData,b.format)}else{e=false;this._xhr.open("GET",this.baseURL+b.atlasURL,true);this._xhr.responseType="text";if(b.format==Phaser.Loader.TEXTURE_ATLAS_JSON_ARRAY||b.format==Phaser.Loader.TEXTURE_ATLAS_JSON_HASH){this._xhr.onload=function(){return f.jsonLoadComplete(b.key)}}else{if(b.format==Phaser.Loader.TEXTURE_ATLAS_XML_STARLING){this._xhr.onload=function(){return f.xmlLoadComplete(b.key)}}}this._xhr.onerror=function(){return f.dataLoadError(b.key)};this._xhr.send()}break;case"bitmapfont":if(b.xmlURL==null){this.game.cache.addBitmapFont(b.key,b.url,b.data,b.xmlData)}else{e=false;this._xhr.open("GET",this.baseURL+b.xmlURL,true);this._xhr.responseType="text";this._xhr.onload=function(){return f.xmlLoadComplete(b.key)};this._xhr.onerror=function(){return f.dataLoadError(b.key)};this._xhr.send()}break;case"audio":if(this.game.sound.usingWebAudio){b.data=this._xhr.response;this.game.cache.addSound(b.key,b.url,b.data,true,false);if(b.autoDecode){this.game.cache.updateSound(c,"isDecoding",true);var d=this;var c=b.key;this.game.sound.context.decodeAudioData(b.data,function(g){if(g){d.game.cache.decodedSound(c,g)}})}}else{b.data.removeEventListener("canplaythrough",Phaser.GAMES[this.game.id].load.fileComplete);this.game.cache.addSound(b.key,b.url,b.data,false,true)}break;case"text":b.data=this._xhr.response;this.game.cache.addText(b.key,b.url,b.data);break}if(e){this.nextFile(c,true)}},jsonLoadComplete:function(c){var d=JSON.parse(this._xhr.response);var b=this._fileList[c];if(b.type=="tilemap"){this.game.cache.addTilemap(b.key,b.url,b.data,d,b.format)}else{this.game.cache.addTextureAtlas(b.key,b.url,b.data,d,b.format)}this.nextFile(c,true)},csvLoadComplete:function(c){var d=this._xhr.response;var b=this._fileList[c];this.game.cache.addTilemap(b.key,b.url,b.data,d,b.format);this.nextFile(c,true)},dataLoadError:function(c){var b=this._fileList[c];b.error=true;console.warn("Phaser.Loader dataLoadError: "+c);this.nextFile(c,true)},xmlLoadComplete:function(d){var f=this._xhr.response;var b;try{if(window.DOMParser){var h=new DOMParser();b=h.parseFromString(f,"text/xml")}else{b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(f)}}catch(g){b=undefined}if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length){throw new Error("Phaser.Loader. Invalid XML given")}var c=this._fileList[d];if(c.type=="bitmapfont"){this.game.cache.addBitmapFont(c.key,c.url,c.data,b)}else{if(c.type=="textureatlas"){this.game.cache.addTextureAtlas(c.key,c.url,c.data,b,c.format)}}this.nextFile(d,true)},nextFile:function(b,c){this.progress=Math.round(this.progress+this._progressChunk);if(this.progress>100){this.progress=100}if(this.preloadSprite!==null){if(this.preloadSprite.direction==0){this.preloadSprite.crop.width=(this.preloadSprite.width/100)*this.progress}else{this.preloadSprite.crop.height=(this.preloadSprite.height/100)*this.progress}this.preloadSprite.sprite.crop=this.preloadSprite.crop}this.onFileComplete.dispatch(this.progress,b,c,this.queueSize-this._keys.length,this.queueSize);if(this._keys.length>0){this.loadFile()}else{this.hasLoaded=true;this.isLoading=false;this.removeAll();this.onLoadComplete.dispatch()}}};Phaser.Loader.Parser={bitmapFont:function(q,h,l){if(!h.getElementsByTagName("font")){console.warn("Phaser.Loader.Parser.bitmapFont: Invalid XML given, missing <font> tag");return}var m=PIXI.TextureCache[l];var e={};var c=h.getElementsByTagName("info")[0];var j=h.getElementsByTagName("common")[0];e.font=c.attributes.getNamedItem("face").nodeValue;e.size=parseInt(c.attributes.getNamedItem("size").nodeValue,10);e.lineHeight=parseInt(j.attributes.getNamedItem("lineHeight").nodeValue,10);e.chars={};var k=h.getElementsByTagName("char");for(var d=0;d<k.length;d++){var p=parseInt(k[d].attributes.getNamedItem("id").nodeValue,10);var o={x:parseInt(k[d].attributes.getNamedItem("x").nodeValue,10),y:parseInt(k[d].attributes.getNamedItem("y").nodeValue,10),width:parseInt(k[d].attributes.getNamedItem("width").nodeValue,10),height:parseInt(k[d].attributes.getNamedItem("height").nodeValue,10)};PIXI.TextureCache[p]=new PIXI.Texture(m,o);e.chars[p]={xOffset:parseInt(k[d].attributes.getNamedItem("xoffset").nodeValue,10),yOffset:parseInt(k[d].attributes.getNamedItem("yoffset").nodeValue,10),xAdvance:parseInt(k[d].attributes.getNamedItem("xadvance").nodeValue,10),kerning:{},texture:new PIXI.Texture(m,o)}}var n=h.getElementsByTagName("kerning");for(d=0;d<n.length;d++){var g=parseInt(n[d].attributes.getNamedItem("first").nodeValue,10);var b=parseInt(n[d].attributes.getNamedItem("second").nodeValue,10);var f=parseInt(n[d].attributes.getNamedItem("amount").nodeValue,10);e.chars[b].kerning[g]=f}PIXI.BitmapText.fonts[e.font]=e}};Phaser.Sound=function(c,d,e,b){e=e||1;if(typeof b=="undefined"){b=false}this.game=c;this.name="";this.key=d;this.loop=b;this._volume=e;this.markers={};this.context=null;this._buffer=null;this._muted=false;this.autoplay=false;this.totalDuration=0;this.startTime=0;this.currentTime=0;this.duration=0;this.stopTime=0;this.paused=false;this.isPlaying=false;this.currentMarker="";this.pendingPlayback=false;this.override=false;this.usingWebAudio=this.game.sound.usingWebAudio;this.usingAudioTag=this.game.sound.usingAudioTag;if(this.usingWebAudio){this.context=this.game.sound.context;this.masterGainNode=this.game.sound.masterGain;if(typeof this.context.createGain==="undefined"){this.gainNode=this.context.createGainNode()}else{this.gainNode=this.context.createGain()}this.gainNode.gain.value=e*this.game.sound.volume;this.gainNode.connect(this.masterGainNode)}else{if(this.game.cache.getSound(d)&&this.game.cache.isSoundReady(d)){this._sound=this.game.cache.getSoundData(d);this.totalDuration=0;if(this._sound.duration){this.totalDuration=this._sound.duration}}else{this.game.cache.onSoundUnlock.add(this.soundHasUnlocked,this)}}this.onDecoded=new Phaser.Signal;this.onPlay=new Phaser.Signal;this.onPause=new Phaser.Signal;this.onResume=new Phaser.Signal;this.onLoop=new Phaser.Signal;this.onStop=new Phaser.Signal;this.onMute=new Phaser.Signal;this.onMarkerComplete=new Phaser.Signal};Phaser.Sound.prototype={soundHasUnlocked:function(b){if(b==this.key){this._sound=this.game.cache.getSoundData(this.key);this.totalDuration=this._sound.duration;console.log("sound has unlocked"+this._sound)}},addMarker:function(c,f,d,e,b){e=e||1;if(typeof b=="undefined"){b=false}this.markers[c]={name:c,start:f,stop:d,volume:e,duration:d-f,loop:b}},removeMarker:function(b){delete this.markers[b]},update:function(){if(this.pendingPlayback&&this.game.cache.isSoundReady(this.key)){this.pendingPlayback=false;this.play(this._tempMarker,this._tempPosition,this._tempVolume,this._tempLoop)}if(this.isPlaying){this.currentTime=this.game.time.now-this.startTime;if(this.currentTime>=this.duration){if(this.usingWebAudio){if(this.loop){this.onLoop.dispatch(this);if(this.currentMarker==""){this.currentTime=0;this.startTime=this.game.time.now}else{this.play(this.currentMarker,0,this.volume,true,true)}}else{this.stop()}}else{if(this.loop){this.onLoop.dispatch(this);this.play(this.currentMarker,0,this.volume,true,true)}else{this.stop()}}}}},play:function(d,b,f,c,e){d=d||"";b=b||0;f=f||1;if(typeof c=="undefined"){c=false}if(typeof e=="undefined"){e=false}console.log("play "+d+" position "+b+" volume "+f+" loop "+c);if(this.isPlaying==true&&e==false&&this.override==false){return}if(this.isPlaying&&this.override){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.currentMarker=d;if(d!==""&&this.markers[d]){this.position=this.markers[d].start;this.volume=this.markers[d].volume;this.loop=this.markers[d].loop;this.duration=this.markers[d].duration*1000;this._tempMarker=d;this._tempPosition=this.position;this._tempVolume=this.volume;this._tempLoop=this.loop}else{this.position=b;this.volume=f;this.loop=c;this.duration=0;this._tempMarker=d;this._tempPosition=b;this._tempVolume=f;this._tempLoop=c}if(this.usingWebAudio){if(this.game.cache.isSoundDecoded(this.key)){if(this._buffer==null){this._buffer=this.game.cache.getSoundData(this.key)}this._sound=this.context.createBufferSource();this._sound.buffer=this._buffer;this._sound.connect(this.gainNode);this.totalDuration=this._sound.buffer.duration;if(this.duration==0){this.duration=this.totalDuration*1000}if(this.loop&&d==""){this._sound.loop=true}if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration/1000)}else{this._sound.start(0,this.position,this.duration/1000)}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true;if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).isDecoding==false){this.game.sound.decode(this.key,this)}}}else{if(this.game.cache.getSound(this.key)&&this.game.cache.getSound(this.key).locked){this.game.cache.reloadSound(this.key);this.pendingPlayback=true}else{if(this._sound&&this._sound.readyState==4){this._sound.play();this.totalDuration=this._sound.duration;if(this.duration==0){this.duration=this.totalDuration*1000}this._sound.currentTime=this.position;this._sound.muted=this._muted;if(this._muted){this._sound.volume=0}else{this._sound.volume=this._volume}this.isPlaying=true;this.startTime=this.game.time.now;this.currentTime=0;this.stopTime=this.startTime+this.duration;this.onPlay.dispatch(this)}else{this.pendingPlayback=true}}}},restart:function(d,b,e,c){d=d||"";b=b||0;e=e||1;if(typeof c=="undefined"){c=false}this.play(d,b,e,c,true)},pause:function(){if(this.isPlaying&&this._sound){this.stop();this.isPlaying=false;this.paused=true;this.onPause.dispatch(this)}},resume:function(){if(this.paused&&this._sound){if(this.usingWebAudio){if(typeof this._sound.start==="undefined"){this._sound.noteGrainOn(0,this.position,this.duration)}else{this._sound.start(0,this.position,this.duration)}}else{this._sound.play()}this.isPlaying=true;this.paused=false;this.onResume.dispatch(this)}},stop:function(){if(this.isPlaying&&this._sound){if(this.usingWebAudio){if(typeof this._sound.stop==="undefined"){this._sound.noteOff(0)}else{this._sound.stop(0)}}else{if(this.usingAudioTag){this._sound.pause();this._sound.currentTime=0}}}this.isPlaying=false;var b=this.currentMarker;this.currentMarker="";this.onStop.dispatch(this,b)}};Object.defineProperty(Phaser.Sound.prototype,"isDecoding",{get:function(){return this.game.cache.getSound(this.key).isDecoding}});Object.defineProperty(Phaser.Sound.prototype,"isDecoded",{get:function(){return this.game.cache.isSoundDecoded(this.key)}});Object.defineProperty(Phaser.Sound.prototype,"mute",{get:function(){return this._muted},set:function(b){b=b||null;if(b){this._muted=true;if(this.usingWebAudio){this._muteVolume=this.gainNode.gain.value;this.gainNode.gain.value=0}else{if(this.usingAudioTag&&this._sound){this._muteVolume=this._sound.volume;this._sound.volume=0}}}else{this._muted=false;if(this.usingWebAudio){this.gainNode.gain.value=this._muteVolume}else{if(this.usingAudioTag&&this._sound){this._sound.volume=this._muteVolume}}}this.onMute.dispatch(this)}});Object.defineProperty(Phaser.Sound.prototype,"volume",{get:function(){return this._volume},set:function(b){if(this.usingWebAudio){this._volume=b;this.gainNode.gain.value=b}else{if(this.usingAudioTag&&this._sound){if(b>=0&&b<=1){this._volume=b;this._sound.volume=b}}}}});Phaser.SoundManager=function(b){this.game=b;this.onSoundDecode=new Phaser.Signal;this._muted=false;this._unlockSource=null;this._volume=1;this._sounds=[];this.context=null;this.usingWebAudio=true;this.usingAudioTag=false;this.noAudio=false;this.touchLocked=false;this.channels=32};Phaser.SoundManager.prototype={boot:function(){if(this.game.device.iOS&&this.game.device.webAudio==false){this.channels=1}if(this.game.device.iOS||(window.PhaserGlobal&&window.PhaserGlobal.fakeiOSTouchLock)){this.game.input.touch.callbackContext=this;this.game.input.touch.touchStartCallback=this.unlock;this.game.input.mouse.callbackContext=this;this.game.input.mouse.mouseDownCallback=this.unlock;this.touchLocked=true}else{this.touchLocked=false}if(window.PhaserGlobal){if(window.PhaserGlobal.disableAudio==true){this.usingWebAudio=false;this.noAudio=true;return}if(window.PhaserGlobal.disableWebAudio==true){this.usingWebAudio=false;this.usingAudioTag=true;this.noAudio=false;return}}if(!!window.AudioContext){this.context=new window.AudioContext()}else{if(!!window.webkitAudioContext){this.context=new window.webkitAudioContext()}else{if(!!window.Audio){this.usingWebAudio=false;this.usingAudioTag=true}else{this.usingWebAudio=false;this.noAudio=true}}}if(this.context!==null){if(typeof this.context.createGain==="undefined"){this.masterGain=this.context.createGainNode()}else{this.masterGain=this.context.createGain()}this.masterGain.gain.value=1;this.masterGain.connect(this.context.destination)}},unlock:function(){if(this.touchLocked==false){return}if(this.game.device.webAudio==false||(window.PhaserGlobal&&window.PhaserGlobal.disableWebAudio==true)){this.touchLocked=false;this._unlockSource=null;this.game.input.touch.callbackContext=null;this.game.input.touch.touchStartCallback=null;this.game.input.mouse.callbackContext=null;this.game.input.mouse.mouseDownCallback=null}else{var b=this.context.createBuffer(1,1,22050);this._unlockSource=this.context.createBufferSource();this._unlockSource.buffer=b;this._unlockSource.connect(this.context.destination);this._unlockSource.noteOn(0)}},stopAll:function(){for(var b=0;b<this._sounds.length;b++){if(this._sounds[b]){this._sounds[b].stop()}}},pauseAll:function(){for(var b=0;b<this._sounds.length;b++){if(this._sounds[b]){this._sounds[b].pause()}}},resumeAll:function(){for(var b=0;b<this._sounds.length;b++){if(this._sounds[b]){this._sounds[b].resume()}}},decode:function(c,e){e=e||null;var b=this.game.cache.getSoundData(c);if(b){if(this.game.cache.isSoundDecoded(c)===false){this.game.cache.updateSound(c,"isDecoding",true);var d=this;this.context.decodeAudioData(b,function(f){d.game.cache.decodedSound(c,f);if(e){d.onSoundDecode.dispatch(e)}})}}},update:function(){if(this.touchLocked){if(this.game.device.webAudio&&this._unlockSource!==null){if((this._unlockSource.playbackState===this._unlockSource.PLAYING_STATE||this._unlockSource.playbackState===this._unlockSource.FINISHED_STATE)){this.touchLocked=false;this._unlockSource=null;this.game.input.touch.callbackContext=null;this.game.input.touch.touchStartCallback=null}}}for(var b=0;b<this._sounds.length;b++){this._sounds[b].update()}},add:function(c,d,b){d=d||1;if(typeof b=="undefined"){b=false}var e=new Phaser.Sound(this.game,c,d,b);this._sounds.push(e);return e}};Object.defineProperty(Phaser.SoundManager.prototype,"mute",{get:function(){return this._muted},set:function(c){c=c||null;if(c){if(this._muted){return}this._muted=true;if(this.usingWebAudio){this._muteVolume=this.masterGain.gain.value;this.masterGain.gain.value=0}for(var b=0;b<this._sounds.length;b++){if(this._sounds[b].usingAudioTag){this._sounds[b].mute=true}}}else{if(this._muted==false){return}this._muted=false;if(this.usingWebAudio){this.masterGain.gain.value=this._muteVolume}for(var b=0;b<this._sounds.length;b++){if(this._sounds[b].usingAudioTag){this._sounds[b].mute=false}}}}});Object.defineProperty(Phaser.SoundManager.prototype,"volume",{get:function(){if(this.usingWebAudio){return this.masterGain.gain.value}else{return this._volume}},set:function(c){c=this.game.math.clamp(c,1,0);this._volume=c;if(this.usingWebAudio){this.masterGain.gain.value=c}for(var b=0;b<this._sounds.length;b++){if(this._sounds[b].usingAudioTag){this._sounds[b].volume=this._sounds[b].volume*c}}}});Phaser.Utils.Debug=function(b){this.game=b;this.context=b.context;this.font="14px Courier";this.lineHeight=16;this.renderShadow=true;this.currentX=0;this.currentY=0;this.currentAlpha=1};Phaser.Utils.Debug.prototype={start:function(b,d,c){if(this.context==null){return}b=b||null;d=d||null;c=c||"rgb(255,255,255)";if(b&&d){this.currentX=b;this.currentY=d;this.currentColor=c}this.currentAlpha=this.context.globalAlpha;this.context.save();this.context.setTransform(1,0,0,1,0,0);this.context.fillStyle=c;this.context.font=this.font;this.context.globalAlpha=1},stop:function(){this.context.restore();this.context.globalAlpha=this.currentAlpha},line:function(c,b,d){if(this.context==null){return}b=b||null;d=d||null;if(b!==null){this.currentX=b}if(d!==null){this.currentY=d}if(this.renderShadow){this.context.fillStyle="rgb(0,0,0)";this.context.fillText(c,this.currentX+1,this.currentY+1);this.context.fillStyle=this.currentColor}this.context.fillText(c,this.currentX,this.currentY);this.currentY+=this.lineHeight},renderQuadTree:function(b,c){c=c||"rgba(255,0,0,0.3)";this.start();var e=b.bounds;if(b.nodes.length===0){this.context.strokeStyle=c;this.context.strokeRect(e.x,e.y,e.width,e.height);this.renderText(b.ID+" / "+b.objects.length,e.x+4,e.y+16,"rgb(0,200,0)","12px Courier");this.context.strokeStyle="rgb(0,255,0)";for(var d=0;d<b.objects.length;d++){this.context.strokeRect(b.objects[d].x,b.objects[d].y,b.objects[d].width,b.objects[d].height)}}else{for(var d=0;d<b.nodes.length;d++){this.renderQuadTree(b.nodes[d])}}this.stop()},renderSpriteCorners:function(e,d,c,b){if(this.context==null){return}d=d||false;c=c||false;b=b||"rgb(255,0,255)";this.start(0,0,b);if(c){this.context.strokeStyle="rgba(255,0,255,0.5)";this.context.strokeRect(e.bounds.x,e.bounds.y,e.bounds.width,e.bounds.height);this.context.stroke()}this.context.beginPath();this.context.moveTo(e.topLeft.x,e.topLeft.y);this.context.lineTo(e.topRight.x,e.topRight.y);this.context.lineTo(e.bottomRight.x,e.bottomRight.y);this.context.lineTo(e.bottomLeft.x,e.bottomLeft.y);this.context.closePath();this.context.strokeStyle="rgba(0,0,255,0.8)";this.context.stroke();this.renderPoint(e.center);this.renderPoint(e.topLeft);this.renderPoint(e.topRight);this.renderPoint(e.bottomLeft);this.renderPoint(e.bottomRight);if(d){this.currentColor=b;this.line("x: "+Math.floor(e.topLeft.x)+" y: "+Math.floor(e.topLeft.y),e.topLeft.x,e.topLeft.y);this.line("x: "+Math.floor(e.topRight.x)+" y: "+Math.floor(e.topRight.y),e.topRight.x,e.topRight.y);this.line("x: "+Math.floor(e.bottomLeft.x)+" y: "+Math.floor(e.bottomLeft.y),e.bottomLeft.x,e.bottomLeft.y);this.line("x: "+Math.floor(e.bottomRight.x)+" y: "+Math.floor(e.bottomRight.y),e.bottomRight.x,e.bottomRight.y)}this.stop()},renderSoundInfo:function(d,b,e,c){if(this.context==null){return}c=c||"rgb(255,255,255)";this.start(b,e,c);this.line("Sound: "+d.key+" Locked: "+d.game.sound.touchLocked);this.line("Is Ready?: "+this.game.cache.isSoundReady(d.key)+" Pending Playback: "+d.pendingPlayback);this.line("Decoded: "+d.isDecoded+" Decoding: "+d.isDecoding);this.line("Total Duration: "+d.totalDuration+" Playing: "+d.isPlaying);this.line("Time: "+d.currentTime);this.line("Volume: "+d.volume+" Muted: "+d.mute);this.line("WebAudio: "+d.usingWebAudio+" Audio: "+d.usingAudioTag);if(d.currentMarker!==""){this.line("Marker: "+d.currentMarker+" Duration: "+d.duration);this.line("Start: "+d.markers[d.currentMarker].start+" Stop: "+d.markers[d.currentMarker].stop);this.line("Position: "+d.position)}this.stop()},renderCameraInfo:function(d,b,e,c){if(this.context==null){return}c=c||"rgb(255,255,0)";this.start(b,e,c);this.line("Camera ("+d.width+" x "+d.height+")");this.line("X: "+d.x+" Y: "+d.y);this.stop()},renderPointer:function(f,e,c,d,b){if(this.context==null||f==null){return}e=e||false;c=c||"rgba(0,255,0,0.5)";d=d||"rgba(255,0,0,0.5)";b=b||"rgb(255,255,255)";if(e==true&&f.isUp==true){return}this.start(f.x,f.y-100,b);this.context.beginPath();this.context.arc(f.x,f.y,f.circle.radius,0,Math.PI*2);if(f.active){this.context.fillStyle=c}else{this.context.fillStyle=d}this.context.fill();this.context.closePath();this.context.beginPath();this.context.moveTo(f.positionDown.x,f.positionDown.y);this.context.lineTo(f.position.x,f.position.y);this.context.lineWidth=2;this.context.stroke();this.context.closePath();this.line("ID: "+f.id+" Active: "+f.active);this.line("World X: "+f.worldX+" World Y: "+f.worldY);this.line("Screen X: "+f.x+" Screen Y: "+f.y);this.line("Duration: "+f.duration+" ms");this.stop()},renderSpriteInputInfo:function(d,b,e,c){c=c||"rgb(255,255,255)";this.start(b,e,c);this.line("Sprite Input: ("+d.width+" x "+d.height+")");this.line("x: "+d.input.pointerX().toFixed(1)+" y: "+d.input.pointerY().toFixed(1));this.line("over: "+d.input.pointerOver()+" duration: "+d.input.overDuration().toFixed(0));this.line("down: "+d.input.pointerDown()+" duration: "+d.input.downDuration().toFixed(0));this.line("just over: "+d.input.justOver()+" just out: "+d.input.justOut());this.stop()},renderSpriteCollision:function(d,b,e,c){c=c||"rgb(255,255,255)";this.start(b,e,c);this.line("Sprite Collision: ("+d.width+" x "+d.height+")");this.line("left: "+d.body.touching.left);this.line("right: "+d.body.touching.right);this.line("up: "+d.body.touching.up);this.line("down: "+d.body.touching.down);this.line("velocity.x: "+d.body.velocity.x);this.line("velocity.y: "+d.body.velocity.y);this.stop()},renderInputInfo:function(b,d,c){if(this.context==null){return}c=c||"rgb(255,255,0)";this.start(b,d,c);this.line("Input");this.line("X: "+this.game.input.x+" Y: "+this.game.input.y);this.line("World X: "+this.game.input.worldX+" World Y: "+this.game.input.worldY);this.line("Scale X: "+this.game.input.scale.x.toFixed(1)+" Scale Y: "+this.game.input.scale.x.toFixed(1));this.line("Screen X: "+this.game.input.activePointer.screenX+" Screen Y: "+this.game.input.activePointer.screenY);this.stop()},renderSpriteInfo:function(d,b,e,c){if(this.context==null){return}c=c||"rgb(255, 255, 255)";this.start(b,e,c);this.line("Sprite: ("+d.width+" x "+d.height+") anchor: "+d.anchor.x+" x "+d.anchor.y);this.line("x: "+d.x.toFixed(1)+" y: "+d.y.toFixed(1)+" rotation: "+d.rotation.toFixed(1));this.line("visible: "+d.visible);this.line("in camera: "+d.inCamera);this.line("body x: "+d.body.x.toFixed(1)+" y: "+d.body.y.toFixed(1))},renderWorldTransformInfo:function(d,b,e,c){if(this.context==null){return}c=c||"rgb(255, 255, 255)";this.start(b,e,c);this.line("World Transform");this.line("skewX: "+d.worldTransform[3]);this.line("skewY: "+d.worldTransform[1]);this.line("scaleX: "+d.worldTransform[0]);this.line("scaleY: "+d.worldTransform[4]);this.line("transX: "+d.worldTransform[2]);this.line("transY: "+d.worldTransform[5])},renderLocalTransformInfo:function(d,b,e,c){if(this.context==null){return}c=c||"rgb(255, 255, 255)";this.start(b,e,c);this.line("Local Transform");this.line("skewX: "+d.localTransform[3]);this.line("skewY: "+d.localTransform[1]);this.line("scaleX: "+d.localTransform[0]);this.line("scaleY: "+d.localTransform[4]);this.line("transX: "+d.localTransform[2]);this.line("transY: "+d.localTransform[5]);this.line("sX: "+d._sx);this.line("sY: "+d._sy)},renderPointInfo:function(c,b,e,d){if(this.context==null){return}d=d||"rgb(255, 255, 255)";this.start(b,e,d);this.line("px: "+c.x.toFixed(1)+" py: "+c.y.toFixed(1));this.stop()},renderSpriteBody:function(c,b){if(this.context==null){return}b=b||"rgba(255,0,255, 0.3)";this.start(0,0,b);this.context.fillStyle=b;this.context.fillRect(c.body.x,c.body.y,c.body.width,c.body.height);this.stop()},renderSpriteBounds:function(c,b,d){if(this.context==null){return}b=b||"rgb(255,0,255)";this.start(0,0,b);if(d){this.context.fillStyle=b;this.context.fillRect(c.bounds.x,c.bounds.y,c.bounds.width,c.bounds.height)}else{this.context.strokeStyle=b;this.context.strokeRect(c.bounds.x,c.bounds.y,c.bounds.width,c.bounds.height);this.context.stroke()}this.stop()},renderPixel:function(b,d,c){if(this.context==null){return}c=c||"rgba(0,255,0,1)";this.start();this.context.fillStyle=c;this.context.fillRect(b,d,2,2);this.stop()},renderPoint:function(b,c){if(this.context==null){return}c=c||"rgba(0,255,0,1)";this.start();this.context.fillStyle=c;this.context.fillRect(b.x,b.y,4,4);this.stop()},renderRectangle:function(c,b){if(this.context==null){return}b=b||"rgba(0,255,0,0.3)";this.start();this.context.fillStyle=b;this.context.fillRect(c.x,c.y,c.width,c.height);this.stop()},renderCircle:function(c,b){if(this.context==null){return}b=b||"rgba(0,255,0,0.3)";this.start();this.context.beginPath();this.context.fillStyle=b;this.context.arc(c.x,c.y,c.radius,0,Math.PI*2,false);this.context.fill();this.context.closePath();this.stop()},renderText:function(e,b,f,d,c){if(this.context==null){return}d=d||"rgb(255,255,255)";c=c||"16px Courier";this.start();this.context.font=c;this.context.fillStyle=d;this.context.fillText(e,b,f);this.stop()}};Phaser.Color={getColor32:function(e,d,c,b){return e<<24|d<<16|c<<8|b},getColor:function(d,c,b){return d<<16|c<<8|b},hexToRGB:function(d){var c=(d.charAt(0)=="#")?d.substring(1,7):d;var f=parseInt(c.substring(0,2),16);var e=parseInt(c.substring(2,4),16);var b=parseInt(c.substring(4,6),16);return f<<16|e<<8|b},getColorInfo:function(d){var e=Phaser.Color.getRGB(d);var c=Phaser.Color.RGBtoHSV(d);var b=Phaser.Color.RGBtoHexstring(d)+"\n";b=b.concat("Alpha: "+e.alpha+" Red: "+e.red+" Green: "+e.green+" Blue: "+e.blue)+"\n";b=b.concat("Hue: "+c.hue+" Saturation: "+c.saturation+" Lightnes: "+c.lightness);return b},RGBtoHexstring:function(b){var c=Phaser.Color.getRGB(b);return"0x"+Phaser.Color.colorToHexstring(c.alpha)+Phaser.Color.colorToHexstring(c.red)+Phaser.Color.colorToHexstring(c.green)+Phaser.Color.colorToHexstring(c.blue)},RGBtoWebstring:function(b){var c=Phaser.Color.getRGB(b);return"#"+Phaser.Color.colorToHexstring(c.red)+Phaser.Color.colorToHexstring(c.green)+Phaser.Color.colorToHexstring(c.blue)},colorToHexstring:function(d){var f="0123456789ABCDEF";var e=d%16;var c=(d-e)/16;var b=f.charAt(c)+f.charAt(e);return b},interpolateColor:function(m,l,k,d,h){if(typeof h==="undefined"){h=255}var f=Phaser.Color.getRGB(m);var e=Phaser.Color.getRGB(l);var c=(((e.red-f.red)*d)/k)+f.red;var i=(((e.green-f.green)*d)/k)+f.green;var j=(((e.blue-f.blue)*d)/k)+f.blue;return Phaser.Color.getColor32(h,c,i,j)},interpolateColorWithRGB:function(h,d,j,l,k,e){var c=Phaser.Color.getRGB(h);var i=(((d-c.red)*e)/k)+c.red;var m=(((j-c.green)*e)/k)+c.green;var f=(((l-c.blue)*e)/k)+c.blue;return Phaser.Color.getColor(i,m,f)},interpolateRGB:function(h,d,m,f,n,k,l,e){var c=(((f-h)*e)/l)+h;var i=(((n-d)*e)/l)+d;var j=(((k-m)*e)/l)+m;return Phaser.Color.getColor(c,i,j)},getRandomColor:function(d,c,g){if(typeof d==="undefined"){d=0}if(typeof c==="undefined"){c=255}if(typeof g==="undefined"){g=255}if(c>255){return Phaser.Color.getColor(255,255,255)}if(d>c){return Phaser.Color.getColor(255,255,255)}var f=d+Math.round(Math.random()*(c-d));var e=d+Math.round(Math.random()*(c-d));var b=d+Math.round(Math.random()*(c-d));return Phaser.Color.getColor32(g,f,e,b)},getRGB:function(b){return{alpha:b>>>24,red:b>>16&255,green:b>>8&255,blue:b&255}},getWebRGB:function(c){var f=(c>>>24)/255;var e=c>>16&255;var d=c>>8&255;var b=c&255;return"rgba("+e.toString()+","+d.toString()+","+b.toString()+","+f.toString()+")"},getAlpha:function(b){return b>>>24},getAlphaFloat:function(b){return(b>>>24)/255},getRed:function(b){return b>>16&255},getGreen:function(b){return b>>8&255},getBlue:function(b){return b&255}};Phaser.Physics={};Phaser.Physics.Arcade=function(b){this.game=b;this.gravity=new Phaser.Point;this.bounds=new Phaser.Rectangle(0,0,b.world.width,b.world.height);this.maxObjects=10;this.maxLevels=4;this.OVERLAP_BIAS=4;this.TILE_OVERLAP=false;this.quadTree=new Phaser.QuadTree(this,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.quadTreeID=0;this._bounds1=new Phaser.Rectangle;this._bounds2=new Phaser.Rectangle;this._overlap=0;this._maxOverlap=0;this._velocity1=0;this._velocity2=0;this._newVelocity1=0;this._newVelocity2=0;this._average=0;this._mapData=[];this._result=false;this._total=0};Phaser.Physics.Arcade.prototype={updateMotion:function(b){this._velocityDelta=(this.computeVelocity(0,false,b.angularVelocity,b.angularAcceleration,b.angularDrag,b.maxAngular)-b.angularVelocity)/2;b.angularVelocity+=this._velocityDelta;b.rotation+=b.angularVelocity*this.game.time.physicsElapsed;this._velocityDelta=(this.computeVelocity(1,b,b.velocity.x,b.acceleration.x,b.drag.x)-b.velocity.x)/2;b.velocity.x+=this._velocityDelta;this._delta=b.velocity.x*this.game.time.physicsElapsed;b.x+=this._delta;this._velocityDelta=(this.computeVelocity(2,b,b.velocity.y,b.acceleration.y,b.drag.y)-b.velocity.y)/2;b.velocity.y+=this._velocityDelta;this._delta=b.velocity.y*this.game.time.physicsElapsed;b.y+=this._delta},computeVelocity:function(e,c,g,f,d,b){b=b||10000;if(e==1&&c.allowGravity){g+=this.gravity.x+c.gravity.x}else{if(e==2&&c.allowGravity){g+=this.gravity.y+c.gravity.y}}if(f!==0){g+=f*this.game.time.physicsElapsed}else{if(d!==0){this._drag=d*this.game.time.physicsElapsed;if(g-this._drag>0){g=g-this._drag}else{if(g+this._drag<0){g+=this._drag}else{g=0}}}}if(g!=0){if(g>b){g=b}else{if(g<-b){g=-b}}}return g},preUpdate:function(){this.quadTree.clear();this.quadTreeID=0;this.quadTree=new Phaser.QuadTree(this,this.game.world.bounds.x,this.game.world.bounds.y,this.game.world.bounds.width,this.game.world.bounds.height,this.maxObjects,this.maxLevels)},postUpdate:function(){this.quadTree.clear()},collide:function(f,e,d,c,b){d=d||null;c=c||null;b=b||d;this._result=false;this._total=0;if(f&&e&&f.exists&&e.exists){if(f.type==Phaser.SPRITE){if(e.type==Phaser.SPRITE){this.collideSpriteVsSprite(f,e,d,c,b)}else{if(e.type==Phaser.GROUP||e.type==Phaser.EMITTER){this.collideSpriteVsGroup(f,e,d,c,b)}else{if(e.type==Phaser.TILEMAP){this.collideSpriteVsTilemap(f,e,d,c,b)}}}}else{if(f.type==Phaser.GROUP){if(e.type==Phaser.SPRITE){this.collideSpriteVsGroup(e,f,d,c,b)}else{if(e.type==Phaser.GROUP||e.type==Phaser.EMITTER){this.collideGroupVsGroup(f,e,d,c,b)}else{if(e.type==Phaser.TILEMAP){this.collideGroupVsTilemap(f,e,d,c,b)}}}}else{if(f.type==Phaser.TILEMAP){if(e.type==Phaser.SPRITE){this.collideSpriteVsTilemap(e,f,d,c,b)}else{if(e.type==Phaser.GROUP||e.type==Phaser.EMITTER){this.collideGroupVsTilemap(e,f,d,c,b)}}}else{if(f.type==Phaser.EMITTER){if(e.type==Phaser.SPRITE){this.collideSpriteVsGroup(e,f,d,c,b)}else{if(e.type==Phaser.GROUP||e.type==Phaser.EMITTER){this.collideGroupVsGroup(f,e,d,c,b)}else{if(e.type==Phaser.TILEMAP){this.collideGroupVsTilemap(f,e,d,c,b)}}}}}}}}return(this._total>0)},collideSpriteVsSprite:function(f,e,d,c,b){this.separate(f.body,e.body);if(this._result){if(c){if(c.call(b,f,e)){this._total++;if(d){d.call(b,f,e)}}}else{this._total++;if(d){d.call(b,f,e)}}}},collideGroupVsTilemap:function(g,f,e,d,b){if(g._container.first._iNext){var c=g._container.first._iNext;do{if(c.exists){this.collideSpriteVsTilemap(c,f,e,d,b)}c=c._iNext}while(c!=g._container.last._iNext)}},collideSpriteVsTilemap:function(d,g,f,e,b){this._mapData=g.collisionLayer.getTileOverlaps(d);var c=this._mapData.length;while(c--){if(e){if(e.call(b,d,this._mapData[c].tile)){this._total++;if(f){f.call(b,d,this._mapData[c].tile)}}}else{this._total++;if(f){f.call(b,d,this._mapData[c].tile)}}}},collideSpriteVsGroup:function(e,h,g,f,c){this._potentials=this.quadTree.retrieve(e);for(var d=0,b=this._potentials.length;d<b;d++){if(this._potentials[d].sprite.group==h){this.separate(e.body,this._potentials[d]);if(this._result&&f){this._result=f.call(c,e,this._potentials[d].sprite)}if(this._result){this._total++;if(g){g.call(c,e,this._potentials[d].sprite)}}}}},collideGroupVsGroup:function(b,g,f,e,c){if(b._container.first._iNext){var d=b._container.first._iNext;do{if(d.exists){this.collideSpriteVsGroup(d,g,f,e,c)}d=d._iNext}while(d!=b._container.last._iNext)}},separate:function(c,b){this._result=(this.separateX(c,b)||this.separateY(c,b));if(this._result){c.postUpdate();b.postUpdate()}},separateX:function(c,b){if(c.immovable&&b.immovable){return false}this._overlap=0;if(c.deltaX()!=b.deltaX()){this._bounds1.setTo(c.x-((c.deltaX()>0)?c.deltaX():0),c.lastY,c.width+((c.deltaX()>0)?c.deltaX():-c.deltaX()),c.height);this._bounds2.setTo(b.x-((b.deltaX()>0)?b.deltaX():0),b.lastY,b.width+((b.deltaX()>0)?b.deltaX():-b.deltaX()),b.height);if((this._bounds1.right>this._bounds2.x)&&(this._bounds1.x<this._bounds2.right)&&(this._bounds1.bottom>this._bounds2.y)&&(this._bounds1.y<this._bounds2.bottom)){this._maxOverlap=c.deltaAbsX()+b.deltaAbsX()+this.OVERLAP_BIAS;if(c.deltaX()>b.deltaX()){this._overlap=c.x+c.width-b.x;if((this._overlap>this._maxOverlap)||c.allowCollision.right==false||b.allowCollision.left==false){this._overlap=0}else{c.touching.right=true;b.touching.left=true}}else{if(c.deltaX()<b.deltaX()){this._overlap=c.x-b.width-b.x;if((-this._overlap>this._maxOverlap)||c.allowCollision.left==false||b.allowCollision.right==false){this._overlap=0}else{c.touching.left=true;b.touching.right=true}}}}}if(this._overlap!=0){c.overlapX=this._overlap;b.overlapX=this._overlap;if(c.customSeparateX||b.customSeparateX){return true}this._velocity1=c.velocity.x;this._velocity2=b.velocity.x;if(!c.immovable&&!b.immovable){this._overlap*=0.5;c.x=c.x-this._overlap;b.x+=this._overlap;this._newVelocity1=Math.sqrt((this._velocity2*this._velocity2*b.mass)/c.mass)*((this._velocity2>0)?1:-1);this._newVelocity2=Math.sqrt((this._velocity1*this._velocity1*c.mass)/b.mass)*((this._velocity1>0)?1:-1);this._average=(this._newVelocity1+this._newVelocity2)*0.5;this._newVelocity1-=this._average;this._newVelocity2-=this._average;c.velocity.x=this._average+this._newVelocity1*c.bounce.x;b.velocity.x=this._average+this._newVelocity2*b.bounce.x}else{if(!c.immovable){c.x=c.x-this._overlap;c.velocity.x=this._velocity2-this._velocity1*c.bounce.x}else{if(!b.immovable){b.x+=this._overlap;b.velocity.x=this._velocity1-this._velocity2*b.bounce.x}}}return true}else{return false}},separateY:function(c,b){if(c.immovable&&b.immovable){return false}this._overlap=0;if(c.deltaY()!=b.deltaY()){this._bounds1.setTo(c.x,c.y-((c.deltaY()>0)?c.deltaY():0),c.width,c.height+c.deltaAbsY());this._bounds2.setTo(b.x,b.y-((b.deltaY()>0)?b.deltaY():0),b.width,b.height+b.deltaAbsY());if((this._bounds1.right>this._bounds2.x)&&(this._bounds1.x<this._bounds2.right)&&(this._bounds1.bottom>this._bounds2.y)&&(this._bounds1.y<this._bounds2.bottom)){this._maxOverlap=c.deltaAbsY()+b.deltaAbsY()+this.OVERLAP_BIAS;if(c.deltaY()>b.deltaY()){this._overlap=c.y+c.height-b.y;if((this._overlap>this._maxOverlap)||c.allowCollision.down==false||b.allowCollision.up==false){this._overlap=0}else{c.touching.down=true;b.touching.up=true}}else{if(c.deltaY()<b.deltaY()){this._overlap=c.y-b.height-b.y;if((-this._overlap>this._maxOverlap)||c.allowCollision.up==false||b.allowCollision.down==false){this._overlap=0}else{c.touching.up=true;b.touching.down=true}}}}}if(this._overlap!=0){c.overlapY=this._overlap;b.overlapY=this._overlap;if(c.customSeparateY||b.customSeparateY){return true}this._velocity1=c.velocity.y;this._velocity2=b.velocity.y;if(!c.immovable&&!b.immovable){this._overlap*=0.5;c.y=c.y-this._overlap;b.y+=this._overlap;this._newVelocity1=Math.sqrt((this._velocity2*this._velocity2*b.mass)/c.mass)*((this._velocity2>0)?1:-1);this._newVelocity2=Math.sqrt((this._velocity1*this._velocity1*c.mass)/b.mass)*((this._velocity1>0)?1:-1);this._average=(this._newVelocity1+this._newVelocity2)*0.5;this._newVelocity1-=this._average;this._newVelocity2-=this._average;c.velocity.y=this._average+this._newVelocity1*c.bounce.y;b.velocity.y=this._average+this._newVelocity2*b.bounce.y}else{if(!c.immovable){c.y=c.y-this._overlap;c.velocity.y=this._velocity2-this._velocity1*c.bounce.y;if(b.active&&b.moves&&(c.deltaY()>b.deltaY())){c.x+=b.x-b.lastX}}else{if(!b.immovable){b.y+=this._overlap;b.velocity.y=this._velocity1-this._velocity2*b.bounce.y;if(c.sprite.active&&c.moves&&(c.deltaY()<b.deltaY())){b.x+=c.x-c.lastX}}}}return true}else{return false}},separateTile:function(h,l,k,e,o,j,i,m,n,d,c,b){var f=this.separateTileY(h.body,l,k,e,o,j,n,d,b);var g=this.separateTileX(h.body,l,k,e,o,j,i,m,c);if(g||f){h.body.postUpdate();return true}return false},separateTileX:function(c,h,g,b,j,f,d,i,e){if(c.immovable){return false}this._overlap=0;if(c.deltaX()!=0){this._bounds1.setTo(c.x,c.y,c.width,c.height);if((this._bounds1.right>h)&&(this._bounds1.x<h+b)&&(this._bounds1.bottom>g)&&(this._bounds1.y<g+j)){this._maxOverlap=c.deltaAbsX()+this.OVERLAP_BIAS;if(c.deltaX()>0){this._overlap=c.x+c.width-h;if((this._overlap>this._maxOverlap)||!c.allowCollision.right||!d){this._overlap=0}else{c.touching.right=true}}else{if(c.deltaX()<0){this._overlap=c.x-b-h;if((-this._overlap>this._maxOverlap)||!c.allowCollision.left||!i){this._overlap=0}else{c.touching.left=true}}}}}if(this._overlap!=0){if(e){c.x=c.x-this._overlap;if(c.bounce.x==0){c.velocity.x=0}else{c.velocity.x=-c.velocity.x*c.bounce.x}}return true}else{return false}},separateTileY:function(d,h,g,c,j,f,i,b,e){if(d.immovable){return false}this._overlap=0;if(d.deltaY()!=0){this._bounds1.setTo(d.x,d.y,d.width,d.height);if((this._bounds1.right>h)&&(this._bounds1.x<h+c)&&(this._bounds1.bottom>g)&&(this._bounds1.y<g+j)){this._maxOverlap=d.deltaAbsY()+this.OVERLAP_BIAS;if(d.deltaY()>0){this._overlap=d.bottom-g;if((this._overlap>this._maxOverlap)||!d.allowCollision.down||!b){this._overlap=0}else{d.touching.down=true}}else{this._overlap=d.y-j-g;if((-this._overlap>this._maxOverlap)||!d.allowCollision.up||!i){this._overlap=0}else{d.touching.up=true}}}}if(this._overlap!=0){if(e){d.y=d.y-this._overlap;if(d.bounce.y==0){d.velocity.y=0}else{d.velocity.y=-d.velocity.y*d.bounce.y}}return true}else{return false}},velocityFromAngle:function(e,d,b){d=d||0;b=b||new Phaser.Point;var c=this.game.math.degToRad(e);return b.setTo((Math.cos(c)*d),(Math.sin(c)*d))},moveTowardsObject:function(g,e,f,c){f=f||60;c=c||0;var b=this.angleBetween(g,e);if(c>0){var h=this.distanceBetween(g,e);f=h/(c/1000)}g.body.velocity.x=Math.cos(b)*f;g.body.velocity.y=Math.sin(b)*f},accelerateTowardsObject:function(f,d,e,b,g){b=b||1000;g=g||1000;var c=this.angleBetween(f,d);f.body.velocity.x=0;f.body.velocity.y=0;f.body.acceleration.x=Math.cos(c)*e;f.body.acceleration.y=Math.sin(c)*e;f.body.maxVelocity.x=b;f.body.maxVelocity.y=g},moveTowardsMouse:function(f,e,c){e=e||60;c=c||0;var b=this.angleBetweenMouse(f);if(c>0){var g=this.distanceToMouse(f);e=g/(c/1000)}f.body.velocity.x=Math.cos(b)*e;f.body.velocity.y=Math.sin(b)*e},accelerateTowardsMouse:function(e,d,b,f){b=b||1000;f=f||1000;var c=this.angleBetweenMouse(e);e.body.velocity.x=0;e.body.velocity.y=0;e.body.acceleration.x=Math.cos(c)*d;e.body.acceleration.y=Math.sin(c)*d;e.body.maxVelocity.x=b;e.body.maxVelocity.y=f},moveTowardsPoint:function(f,g,e,c){e=e||60;c=c||0;var b=this.angleBetweenPoint(f,g);if(c>0){var h=this.distanceToPoint(f,g);e=h/(c/1000)}f.body.velocity.x=Math.cos(b)*e;f.body.velocity.y=Math.sin(b)*e},accelerateTowardsPoint:function(e,f,d,b,g){b=b||1000;g=g||1000;var c=this.angleBetweenPoint(e,f);e.body.velocity.x=0;e.body.velocity.y=0;e.body.acceleration.x=Math.cos(c)*d;e.body.acceleration.y=Math.sin(c)*d;e.body.maxVelocity.x=b;e.body.maxVelocity.y=g},distanceBetween:function(e,c){var f=e.center.x-c.center.x;var d=e.center.y-c.center.y;return Math.sqrt(f*f+d*d)},distanceToPoint:function(c,e){var d=c.center.x-e.x;var b=c.center.y-e.y;return Math.sqrt(d*d+b*b)},distanceToMouse:function(c){var d=c.center.x-this.game.input.x;var b=c.center.y-this.game.input.y;return Math.sqrt(d*d+b*b)},angleBetweenPoint:function(c,f,e){e=e||false;var d=f.x-c.center.x;var b=f.y-c.center.y;if(e){return this.game.math.radToDeg(Math.atan2(b,d))}else{return Math.atan2(b,d)}},angleBetween:function(e,c,g){g=g||false;var f=c.center.x-e.center.x;var d=c.center.y-e.center.y;if(g){return this.game.math.radToDeg(Math.atan2(d,f))}else{return Math.atan2(d,f)}},velocityFromFacing:function(b,c){},angleBetweenMouse:function(c,e){e=e||false;var d=this.game.input.x-c.bounds.x;var b=this.game.input.y-c.bounds.y;if(e){return this.game.math.radToDeg(Math.atan2(b,d))}else{return Math.atan2(b,d)}}};Phaser.Physics.Arcade.Body=function(b){this.sprite=b;this.game=b.game;this.offset=new Phaser.Point;this.x=b.x;this.y=b.y;this.lastX=b.x;this.lastY=b.y;this.sourceWidth=b.currentFrame.sourceSizeW;this.sourceHeight=b.currentFrame.sourceSizeH;this.width=b.currentFrame.sourceSizeW;this.height=b.currentFrame.sourceSizeH;this.halfWidth=Math.floor(b.currentFrame.sourceSizeW/2);this.halfHeight=Math.floor(b.currentFrame.sourceSizeH/2);this._sx=b.scale.x;this._sy=b.scale.y;this.velocity=new Phaser.Point;this.acceleration=new Phaser.Point;this.drag=new Phaser.Point;this.gravity=new Phaser.Point;this.bounce=new Phaser.Point;this.maxVelocity=new Phaser.Point(10000,10000);this.angularVelocity=0;this.angularAcceleration=0;this.angularDrag=0;this.maxAngular=1000;this.mass=1;this.quadTreeIDs=[];this.quadTreeIndex=-1;this.allowCollision={none:false,any:true,up:true,down:true,left:true,right:true};this.touching={none:true,up:false,down:false,left:false,right:false};this.wasTouching={none:true,up:false,down:false,left:false,right:false};this.immovable=false;this.moves=true;this.rotation=0;this.allowRotation=true;this.allowGravity=true;this.customSeparateX=false;this.customSeparateY=false;this.overlapX=0;this.overlapY=0;this.collideWorldBounds=false};Phaser.Physics.Arcade.Body.prototype={updateBounds:function(e,d,c,b){if(c!=this._sx||b!=this._sy){this.width=this.sourceWidth*c;this.height=this.sourceHeight*b;this.halfWidth=Math.floor(this.width/2);this.halfHeight=Math.floor(this.height/2);this._sx=c;this._sy=b}},update:function(){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=true;this.touching.up=false;this.touching.down=false;this.touching.left=false;this.touching.right=false;this.lastX=this.x;this.lastY=this.y;this.rotation=this.sprite.angle;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;if(this.moves){this.game.physics.updateMotion(this)}if(this.collideWorldBounds){this.checkWorldBounds()}if(this.allowCollision.none==false&&this.sprite.visible&&this.sprite.alive){this.quadTreeIDs=[];this.quadTreeIndex=-1;this.game.physics.quadTree.insert(this)}if(this.deltaX()!=0){this.sprite.x-=this.deltaX()}if(this.deltaY()!=0){this.sprite.y-=this.deltaY()}this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},postUpdate:function(){this.sprite.x=this.x-this.offset.x+(this.sprite.anchor.x*this.width);this.sprite.y=this.y-this.offset.y+(this.sprite.anchor.y*this.height);if(this.allowRotation){this.sprite.angle=this.rotation}},checkWorldBounds:function(){if(this.x<this.game.world.bounds.x){this.x=this.game.world.bounds.x;this.velocity.x*=-this.bounce.x}else{if(this.right>this.game.world.bounds.right){this.x=this.game.world.bounds.right-this.width;this.velocity.x*=-this.bounce.x}}if(this.y<this.game.world.bounds.y){this.y=this.game.world.bounds.y;this.velocity.y*=-this.bounce.y}else{if(this.bottom>this.game.world.bounds.bottom){this.y=this.game.world.bounds.bottom-this.height;this.velocity.y*=-this.bounce.y}}},setSize:function(d,c,b,e){b=b||this.offset.x;e=e||this.offset.y;this.sourceWidth=d;this.sourceHeight=c;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(b,e)},reset:function(){this.velocity.setTo(0,0);this.acceleration.setTo(0,0);this.angularVelocity=0;this.angularAcceleration=0;this.x=(this.sprite.x-(this.sprite.anchor.x*this.width))+this.offset.x;this.y=(this.sprite.y-(this.sprite.anchor.y*this.height))+this.offset.y;this.lastX=this.x;this.lastY=this.y},deltaAbsX:function(){return(this.deltaX()>0?this.deltaX():-this.deltaX())},deltaAbsY:function(){return(this.deltaY()>0?this.deltaY():-this.deltaY())},deltaX:function(){return this.x-this.lastX},deltaY:function(){return this.y-this.lastY}};Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"bottom",{get:function(){return this.y+this.height},set:function(b){if(b<=this.y){this.height=0}else{this.height=(this.y-b)}}});Object.defineProperty(Phaser.Physics.Arcade.Body.prototype,"right",{get:function(){return this.x+this.width},set:function(b){if(b<=this.x){this.width=0}else{this.width=this.x+b}}});Phaser.Particles=function(b){this.emitters={};this.ID=0};Phaser.Particles.prototype={emitters:null,add:function(b){this.emitters[b.name]=b;return b},remove:function(b){delete this.emitters[b.name]},update:function(){for(var b in this.emitters){if(this.emitters[b].exists){this.emitters[b].update()}}}};Phaser.Particles.Arcade={};Phaser.Particles.Arcade.Emitter=function(c,b,e,d){d=d||50;Phaser.Group.call(this,c);this.name="emitter"+this.game.particles.ID++;this.type=Phaser.EMITTER;this.x=0;this.y=0;this.width=1;this.height=1;this.minParticleSpeed=new Phaser.Point(-100,-100);this.maxParticleSpeed=new Phaser.Point(100,100);this.minParticleScale=1;this.maxParticleScale=1;this.minRotation=-360;this.maxRotation=360;this.gravity=2;this.particleClass=null;this.particleDrag=new Phaser.Point();this.angularDrag=0;this.frequency=100;this.maxParticles=d;this.lifespan=2000;this.bounce=new Phaser.Point();this._quantity=0;this._timer=0;this._counter=0;this._explode=true;this.on=false;this.exists=true;this.emitX=b;this.emitY=e};Phaser.Particles.Arcade.Emitter.prototype=Object.create(Phaser.Group.prototype);Phaser.Particles.Arcade.Emitter.prototype.constructor=Phaser.Particles.Arcade.Emitter;Phaser.Particles.Arcade.Emitter.prototype.update=function(){if(this.on){if(this._explode){this._counter=0;do{this.emitParticle();this._counter++}while(this._counter<this._quantity);this.on=false}else{if(this.game.time.now>=this._timer){this.emitParticle();this._counter++;if(this._quantity>0){if(this._counter>=this._quantity){this.on=false}}this._timer=this.game.time.now+this.frequency}}}};Phaser.Particles.Arcade.Emitter.prototype.makeParticles=function(j,f,c,h,k){if(typeof f=="undefined"){f=0}c=c||this.maxParticles;h=h||0;if(typeof k=="undefined"){k=false}var e;var d=0;var b=j;var g=0;while(d<c){if(this.particleClass==null){if(typeof j=="object"){b=this.game.rnd.pick(j)}if(typeof f=="object"){g=this.game.rnd.pick(f)}e=new Phaser.Sprite(this.game,0,0,b,g)}else{}if(h>0){e.body.allowCollision.any=true;e.body.allowCollision.none=false}else{e.body.allowCollision.none=true}e.body.collideWorldBounds=k;e.exists=false;e.visible=false;e.anchor.setTo(0.5,0.5);this.add(e);d++}return this};Phaser.Particles.Arcade.Emitter.prototype.kill=function(){this.on=false;this.alive=false;this.exists=false};Phaser.Particles.Arcade.Emitter.prototype.revive=function(){this.alive=true;this.exists=true};Phaser.Particles.Arcade.Emitter.prototype.start=function(b,e,d,c){if(typeof b!=="boolean"){b=true}e=e||0;d=d||250;c=c||0;this.revive();this.visible=true;this.on=true;this._explode=b;this.lifespan=e;this.frequency=d;if(b){this._quantity=c}else{this._quantity+=c}this._counter=0;this._timer=this.game.time.now+d};Phaser.Particles.Arcade.Emitter.prototype.emitParticle=function(){var c=this.getFirstExists(false);if(c==null){return}if(this.width>1||this.height>1){c.reset(this.emiteX-this.game.rnd.integerInRange(this.left,this.right),this.emiteY-this.game.rnd.integerInRange(this.top,this.bottom))}else{c.reset(this.emitX,this.emitY)}c.lifespan=this.lifespan;c.body.bounce.setTo(this.bounce.x,this.bounce.y);if(this.minParticleSpeed.x!=this.maxParticleSpeed.x){c.body.velocity.x=this.game.rnd.integerInRange(this.minParticleSpeed.x,this.maxParticleSpeed.x)}else{c.body.velocity.x=this.minParticleSpeed.x}if(this.minParticleSpeed.y!=this.maxParticleSpeed.y){c.body.velocity.y=this.game.rnd.integerInRange(this.minParticleSpeed.y,this.maxParticleSpeed.y)}else{c.body.velocity.y=this.minParticleSpeed.y}c.body.gravity.y=this.gravity;if(this.minRotation!=this.maxRotation){c.body.angularVelocity=this.game.rnd.integerInRange(this.minRotation,this.maxRotation)}else{c.body.angularVelocity=this.minRotation}if(this.minParticleScale!==1||this.maxParticleScale!==1){var b=this.game.rnd.realInRange(this.minParticleScale,this.maxParticleScale);c.scale.setTo(b,b)}c.body.drag.x=this.particleDrag.x;c.body.drag.y=this.particleDrag.y;c.body.angularDrag=this.angularDrag};Phaser.Particles.Arcade.Emitter.prototype.setSize=function(c,b){this.width=c;this.height=b};Phaser.Particles.Arcade.Emitter.prototype.setXSpeed=function(c,b){c=c||0;b=b||0;this.minParticleSpeed.x=c;this.maxParticleSpeed.x=b};Phaser.Particles.Arcade.Emitter.prototype.setYSpeed=function(c,b){c=c||0;b=b||0;this.minParticleSpeed.y=c;this.maxParticleSpeed.y=b};Phaser.Particles.Arcade.Emitter.prototype.setRotation=function(c,b){c=c||0;b=b||0;this.minRotation=c;this.maxRotation=b};Phaser.Particles.Arcade.Emitter.prototype.at=function(b){this.emitX=b.center.x;this.emitY=b.center.y};Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"alpha",{get:function(){return this._container.alpha},set:function(b){this._container.alpha=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"visible",{get:function(){return this._container.visible},set:function(b){this._container.visible=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"x",{get:function(){return this.emitX},set:function(b){this.emitX=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"y",{get:function(){return this.emitY},set:function(b){this.emitY=b}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"left",{get:function(){return Math.floor(this.x-(this.width/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"right",{get:function(){return Math.floor(this.x+(this.width/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"top",{get:function(){return Math.floor(this.y-(this.height/2))}});Object.defineProperty(Phaser.Particles.Arcade.Emitter.prototype,"bottom",{get:function(){return Math.floor(this.y+(this.height/2))}});Phaser.Tilemap=function(d,e,b,i,g,h,c){if(typeof g==="undefined"){g=true}if(typeof h==="undefined"){h=0}if(typeof c==="undefined"){c=0}this.game=d;this.group=null;this.name="";this.key=e;this.renderOrderID=0;this.collisionCallback=null;this.exists=true;this.visible=true;this.tiles=[];this.layers=[];var f=this.game.cache.getTilemap(e);PIXI.DisplayObjectContainer.call(this);this.position.x=b;this.position.y=i;this.type=Phaser.TILEMAP;this.renderer=new Phaser.TilemapRenderer(this.game);this.mapFormat=f.format;switch(this.mapFormat){case Phaser.Tilemap.CSV:this.parseCSV(f.mapData,e,h,c);break;case Phaser.Tilemap.JSON:this.parseTiledJSON(f.mapData,e);break}if(this.currentLayer&&g){this.game.world.setSize(this.currentLayer.widthInPixels,this.currentLayer.heightInPixels,true)}};Phaser.Tilemap.prototype=Object.create(PIXI.DisplayObjectContainer.prototype);Phaser.Tilemap.prototype.constructor=Phaser.Tilemap;Phaser.Tilemap.CSV=0;Phaser.Tilemap.JSON=1;Phaser.Tilemap.prototype.parseCSV=function(d,j,h,g){var f=new Phaser.TilemapLayer(this,0,j,Phaser.Tilemap.CSV,"TileLayerCSV"+this.layers.length.toString(),h,g);d=d.trim();var k=d.split("\n");for(var e=0;e<k.length;e++){var c=k[e].split(",");if(c.length>0){f.addColumn(c)}}f.updateBounds();f.createCanvas();var b=f.parseTileOffsets();this.currentLayer=f;this.collisionLayer=f;this.layers.push(f);this.generateTiles(b)};Phaser.Tilemap.prototype.parseTiledJSON=function(g,f){for(var e=0;e<g.layers.length;e++){var d=new Phaser.TilemapLayer(this,e,f,Phaser.Tilemap.JSON,g.layers[e].name,g.tilewidth,g.tileheight);if(!g.layers[e].data){continue}d.alpha=g.layers[e].opacity;d.visible=g.layers[e].visible;d.tileMargin=g.tilesets[0].margin;d.tileSpacing=g.tilesets[0].spacing;var k=0;var j;for(var b=0;b<g.layers[e].data.length;b++){if(k==0){j=[]}j.push(g.layers[e].data[b]);k++;if(k==g.layers[e].width){d.addColumn(j);k=0}}d.updateBounds();d.createCanvas();var h=d.parseTileOffsets();this.currentLayer=d;this.collisionLayer=d;this.layers.push(d)}this.generateTiles(h)};Phaser.Tilemap.prototype.generateTiles=function(c){for(var b=0;b<c;b++){this.tiles.push(new Phaser.Tile(this.game,this,b,this.currentLayer.tileWidth,this.currentLayer.tileHeight))}};Phaser.Tilemap.prototype.setCollisionCallback=function(b,c){this.collisionCallbackContext=b;this.collisionCallback=c};Phaser.Tilemap.prototype.setCollisionRange=function(d,f,e,l,h,j,k,c,b){if(typeof k==="undefined"){k=false}if(typeof c==="undefined"){c=true}if(typeof b==="undefined"){b=true}for(var g=d;g<f;g++){this.tiles[g].setCollision(e,l,h,j,k,c,b)}};Phaser.Tilemap.prototype.setCollisionByIndex=function(k,d,j,f,g,h,c,b){if(typeof h==="undefined"){h=false}if(typeof c==="undefined"){c=true}if(typeof b==="undefined"){b=true}for(var e=0;e<k.length;e++){this.tiles[k[e]].setCollision(d,j,f,g,h,c,b)}};Phaser.Tilemap.prototype.getTileByIndex=function(b){if(this.tiles[b]){return this.tiles[b]}return null};Phaser.Tilemap.prototype.getTile=function(b,d,c){if(typeof c==="undefined"){c=this.currentLayer.ID}return this.tiles[this.layers[c].getTileIndex(b,d)]};Phaser.Tilemap.prototype.getTileFromWorldXY=function(b,d,c){if(typeof c==="undefined"){c=this.currentLayer.ID}return this.tiles[this.layers[c].getTileFromWorldXY(b,d)]};Phaser.Tilemap.prototype.getTileFromInputXY=function(b){if(typeof b==="undefined"){b=this.currentLayer.ID}return this.tiles[this.layers[b].getTileFromWorldXY(this.game.input.worldX,this.game.input.worldY)]};Phaser.Tilemap.prototype.getTileOverlaps=function(b){return this.currentLayer.getTileOverlaps(b)};Phaser.Tilemap.prototype.collide=function(c,d,b){c=c||this.game.world.group;d=d||null;b=b||null;if(d&&b){this.collisionCallback=d;this.collisionCallbackContext=b}if(c instanceof Phaser.Group){c.forEachAlive(this.collideGameObject,this)}else{this.collideGameObject(c)}};Phaser.Tilemap.prototype.collideGameObject=function(b){if(b instanceof Phaser.Group||b instanceof Phaser.Tilemap){return false}if(b.exists&&b.body.allowCollision.none==false){this._tempCollisionData=this.collisionLayer.getTileOverlaps(b);if(this.collisionCallback&&this._tempCollisionData.length>0){this.collisionCallback.call(this.collisionCallbackContext,b,this._tempCollisionData)}return true}else{return false}};Phaser.Tilemap.prototype.putTile=function(b,e,c,d){if(typeof d==="undefined"){d=this.currentLayer.ID}this.layers[d].putTile(b,e,c)};Phaser.Tilemap.prototype.update=function(){this.renderer.render(this)};Phaser.Tilemap.prototype.destroy=function(){this.tiles.length=0;this.layers.length=0};Object.defineProperty(Phaser.Tilemap.prototype,"widthInPixels",{get:function(){return this.currentLayer.widthInPixels}});Object.defineProperty(Phaser.Tilemap.prototype,"heightInPixels",{get:function(){return this.currentLayer.heightInPixels}});Phaser.TilemapLayer=function(f,i,e,d,c,h,b){this.exists=true;this.visible=true;this.widthInTiles=0;this.heightInTiles=0;this.widthInPixels=0;this.heightInPixels=0;this.tileMargin=0;this.tileSpacing=0;this.parent=f;this.game=f.game;this.ID=i;this.name=c;this.key=e;this.type=Phaser.TILEMAPLAYER;this.mapFormat=d;this.tileWidth=h;this.tileHeight=b;this.boundsInTiles=new Phaser.Rectangle();var g=this.game.cache.getTilemap(e);this.tileset=g.data;this._alpha=1;this.canvas=null;this.context=null;this.baseTexture=null;this.texture=null;this.sprite=null;this.mapData=[];this._tempTileBlock=[];this._tempBlockResults=[]};Phaser.TilemapLayer.prototype={putTileWorldXY:function(b,d,c){b=this.game.math.snapToFloor(b,this.tileWidth)/this.tileWidth;d=this.game.math.snapToFloor(d,this.tileHeight)/this.tileHeight;if(d>=0&&d<this.mapData.length){if(b>=0&&b<this.mapData[d].length){this.mapData[d][b]=c}}},putTile:function(b,d,c){if(d>=0&&d<this.mapData.length){if(b>=0&&b<this.mapData[d].length){this.mapData[d][b]=c}}},swapTile:function(g,f,c,h,d,b){c=c||0;h=h||0;d=d||this.widthInTiles;b=b||this.heightInTiles;this.getTempBlock(c,h,d,b);for(var e=0;e<this._tempTileBlock.length;e++){if(this._tempTileBlock[e].tile.index==g){this._tempTileBlock[e].newIndex=true}if(this._tempTileBlock[e].tile.index==f){this.mapData[this._tempTileBlock[e].y][this._tempTileBlock[e].x]=g}}for(var e=0;e<this._tempTileBlock.length;e++){if(this._tempTileBlock[e].newIndex==true){this.mapData[this._tempTileBlock[e].y][this._tempTileBlock[e].x]=f}}},fillTile:function(d,c,g,e,b){c=c||0;g=g||0;e=e||this.widthInTiles;b=b||this.heightInTiles;this.getTempBlock(c,g,e,b);for(var f=0;f<this._tempTileBlock.length;f++){this.mapData[this._tempTileBlock[f].y][this._tempTileBlock[f].x]=d}},randomiseTiles:function(d,c,g,e,b){c=c||0;g=g||0;e=e||this.widthInTiles;b=b||this.heightInTiles;this.getTempBlock(c,g,e,b);for(var f=0;f<this._tempTileBlock.length;f++){this.mapData[this._tempTileBlock[f].y][this._tempTileBlock[f].x]=this.game.math.getRandom(d)}},replaceTile:function(g,f,c,h,d,b){c=c||0;h=h||0;d=d||this.widthInTiles;b=b||this.heightInTiles;this.getTempBlock(c,h,d,b);for(var e=0;e<this._tempTileBlock.length;e++){if(this._tempTileBlock[e].tile.index==g){this.mapData[this._tempTileBlock[e].y][this._tempTileBlock[e].x]=f}}},getTileBlock:function(c,g,e,b){var d=[];this.getTempBlock(c,g,e,b);for(var f=0;f<this._tempTileBlock.length;f++){d.push({x:this._tempTileBlock[f].x,y:this._tempTileBlock[f].y,tile:this._tempTileBlock[f].tile})}return d},getTileFromWorldXY:function(b,c){b=Phaser.Math.snapToFloor(b,this.tileWidth)/this.tileWidth;c=Phaser.Math.snapToFloor(c,this.tileHeight)/this.tileHeight;return this.getTileIndex(b,c)},getTileOverlaps:function(b){this._tempBlockResults.length=0;if(b.body.x<0||b.body.x>this.widthInPixels||b.body.y<0||b.body.bottom>this.heightInPixels){return this._tempBlockResults}this._tempTileX=this.game.math.snapToFloor(b.body.x,this.tileWidth)/this.tileWidth;this._tempTileY=this.game.math.snapToFloor(b.body.y,this.tileHeight)/this.tileHeight;this._tempTileW=(this.game.math.snapToCeil(b.body.width,this.tileWidth)+this.tileWidth)/this.tileWidth;this._tempTileH=(this.game.math.snapToCeil(b.body.height,this.tileHeight)+this.tileHeight)/this.tileHeight;this.getTempBlock(this._tempTileX,this._tempTileY,this._tempTileW,this._tempTileH,true);for(var c=0;c<this._tempTileBlock.length;c++){if(this.game.physics.separateTile(b,this._tempTileBlock[c].x*this.tileWidth,this._tempTileBlock[c].y*this.tileHeight,this.tileWidth,this.tileHeight,this._tempTileBlock[c].tile.mass,this._tempTileBlock[c].tile.collideLeft,this._tempTileBlock[c].tile.collideRight,this._tempTileBlock[c].tile.collideUp,this._tempTileBlock[c].tile.collideDown,this._tempTileBlock[c].tile.separateX,this._tempTileBlock[c].tile.separateY)){this._tempBlockResults.push({x:this._tempTileBlock[c].x,y:this._tempTileBlock[c].y,tile:this._tempTileBlock[c].tile})}}return this._tempBlockResults},getTempBlock:function(d,h,g,c,f){if(typeof f==="undefined"){f=false}if(d<0){d=0}if(h<0){h=0}if(g>this.widthInTiles){g=this.widthInTiles}if(c>this.heightInTiles){c=this.heightInTiles}this._tempTileBlock=[];for(var b=h;b<h+c;b++){for(var e=d;e<d+g;e++){if(f){if(this.mapData[b]&&this.mapData[b][e]&&this.parent.tiles[this.mapData[b][e]].collideNone==false){this._tempTileBlock.push({x:e,y:b,tile:this.parent.tiles[this.mapData[b][e]]})}}else{if(this.mapData[b]&&this.mapData[b][e]){this._tempTileBlock.push({x:e,y:b,tile:this.parent.tiles[this.mapData[b][e]]})}}}}},getTileIndex:function(b,c){if(c>=0&&c<this.mapData.length){if(b>=0&&b<this.mapData[c].length){return this.mapData[c][b]}}return null},addColumn:function(b){var d=[];for(var e=0;e<b.length;e++){d[e]=parseInt(b[e])}if(this.widthInTiles==0){this.widthInTiles=d.length;this.widthInPixels=this.widthInTiles*this.tileWidth}this.mapData.push(d);this.heightInTiles++;this.heightInPixels+=this.tileHeight},createCanvas:function(){var c=this.game.width;var b=this.game.height;if(this.widthInPixels<c){c=this.widthInPixels}if(this.heightInPixels<b){b=this.heightInPixels}this.canvas=Phaser.Canvas.create(c,b);this.context=this.canvas.getContext("2d");this.baseTexture=new PIXI.BaseTexture(this.canvas);this.texture=new PIXI.Texture(this.baseTexture);this.sprite=new PIXI.Sprite(this.texture);this.parent.addChild(this.sprite)},updateBounds:function(){this.boundsInTiles.setTo(0,0,this.widthInTiles,this.heightInTiles)},parseTileOffsets:function(){this.tileOffsets=[];var d=0;if(this.mapFormat==Phaser.Tilemap.JSON){this.tileOffsets[0]=null;d=1}for(var b=this.tileMargin;b<this.tileset.height;b+=(this.tileHeight+this.tileSpacing)){for(var c=this.tileMargin;c<this.tileset.width;c+=(this.tileWidth+this.tileSpacing)){this.tileOffsets[d]={x:c,y:b};d++}}return this.tileOffsets.length}};Object.defineProperty(Phaser.TilemapLayer.prototype,"alpha",{get:function(){return this._alpha},set:function(b){if(this.sprite){this.sprite.alpha=b}this._alpha=b}});Phaser.Tile=function(c,f,d,e,b){this.mass=1;this.collideNone=true;this.collideLeft=false;this.collideRight=false;this.collideUp=false;this.collideDown=false;this.separateX=true;this.separateY=true;this.game=c;this.tilemap=f;this.index=d;this.width=e;this.height=b};Phaser.Tile.prototype={destroy:function(){this.tilemap=null},setCollision:function(g,e,b,h,f,d,c){if(f){this.resetCollision()}this.separateX=d;this.separateY=c;this.collideNone=true;this.collideLeft=g;this.collideRight=e;this.collideUp=b;this.collideDown=h;if(g||e||b||h){this.collideNone=false}},resetCollision:function(){this.collideNone=true;this.collideLeft=false;this.collideRight=false;this.collideUp=false;this.collideDown=false},toString:function(){return""}};Phaser.TilemapRenderer=function(b){this.game=b;this._ga=1;this._dx=0;this._dy=0;this._dw=0;this._dh=0;this._tx=0;this._ty=0;this._tl=0;this._maxX=0;this._maxY=0;this._startX=0;this._startY=0};Phaser.TilemapRenderer.prototype={render:function(e){this._tl=e.layers.length;for(var c=0;c<this._tl;c++){if(e.layers[c].visible==false||e.layers[c].alpha<0.1){continue}var b=e.layers[c];this._maxX=this.game.math.ceil(b.canvas.width/b.tileWidth)+1;this._maxY=this.game.math.ceil(b.canvas.height/b.tileHeight)+1;this._startX=this.game.math.floor(this.game.camera.x/b.tileWidth);this._startY=this.game.math.floor(this.game.camera.y/b.tileHeight);if(this._startX<0){this._startX=0}if(this._startY<0){this._startY=0}if(this._maxX>b.widthInTiles){this._maxX=b.widthInTiles}if(this._maxY>b.heightInTiles){this._maxY=b.heightInTiles}if(this._startX+this._maxX>b.widthInTiles){this._startX=b.widthInTiles-this._maxX}if(this._startY+this._maxY>b.heightInTiles){this._startY=b.heightInTiles-this._maxY}this._dx=-(this.game.camera.x-(this._startX*b.tileWidth));this._dy=-(this.game.camera.y-(this._startY*b.tileHeight));this._tx=this._dx;this._ty=this._dy;if(b.alpha!==1){this._ga=b.context.globalAlpha;b.context.globalAlpha=b.alpha}b.context.clearRect(0,0,b.canvas.width,b.canvas.height);for(var f=this._startY;f<this._startY+this._maxY;f++){this._columnData=b.mapData[f];for(var d=this._startX;d<this._startX+this._maxX;d++){if(b.tileOffsets[this._columnData[d]]){b.context.drawImage(b.tileset,b.tileOffsets[this._columnData[d]].x,b.tileOffsets[this._columnData[d]].y,b.tileWidth,b.tileHeight,this._tx,this._ty,b.tileWidth,b.tileHeight)}this._tx+=b.tileWidth}this._tx=this._dx;this._ty+=b.tileHeight}if(this._ga>-1){b.context.globalAlpha=this._ga}if(this.game.renderType==Phaser.WEBGL){PIXI.texturesToUpdate.push(b.baseTexture)}}return true}};