for(vara=0,c=this.children.length;c>a;a++)this.children[a].postUpdate()},b.Sprite.prototype.loadTexture=function(a,c,d){c=c||0,(d||"undefined"==typeofd)&&this.animations.stop(),this.key=a;vare=!0,f=this.smoothed;ainstanceofb.RenderTexture?(this.key=a.key,this.setTexture(a)):ainstanceofb.BitmapData?this.setTexture(a.texture):ainstanceofPIXI.Texture?this.setTexture(a):null===a||"undefined"==typeofa?(this.key="__default",this.setTexture(PIXI.TextureCache[this.key])):"string"!=typeofa||this.game.cache.checkImageKey(a)?(this.setTexture(newPIXI.Texture(PIXI.BaseTextureCache[a])),e=!this.animations.loadFrameData(this.game.cache.getFrameData(a),c)):(console.warn("Texture with key '"+a+"' not found."),this.key="__missing",this.setTexture(PIXI.TextureCache[this.key])),e&&(this._frame=b.Rectangle.clone(this.texture.frame)),f||(this.smoothed=!1)},b.Sprite.prototype.setFrame=function(a){this._frame=a,this.texture.frame.x=a.x,this.texture.frame.y=a.y,this.texture.frame.width=a.width,this.texture.frame.height=a.height,this.texture.crop.x=a.x,this.texture.crop.y=a.y,this.texture.crop.width=a.width,this.texture.crop.height=a.height,a.trimmed&&(this.texture.trim?(this.texture.trim.x=a.spriteSourceSizeX,this.texture.trim.y=a.spriteSourceSizeY,this.texture.trim.width=a.sourceSizeW,this.texture.trim.height=a.sourceSizeH):this.texture.trim={x:a.spriteSourceSizeX,y:a.spriteSourceSizeY,width:a.sourceSizeW,height:a.sourceSizeH},this.texture.width=a.sourceSizeW,this.texture.height=a.sourceSizeH,this.texture.frame.width=a.sourceSizeW,this.texture.frame.height=a.sourceSizeH),this.cropRect?this.updateCrop():this.game.renderType===b.WEBGL&&PIXI.WebGLRenderer.updateTextureFrame(this.texture)},b.Sprite.prototype.resetFrame=function(){this._frame&&this.setFrame(this._frame)},b.Sprite.prototype.crop=function(a,c){"undefined"==typeofc&&(c=!1),a?(c&&null!==this.cropRect?this.cropRect.setTo(a.x,a.y,a.width,a.height):this.cropRect=c&&null===this.cropRect?newb.Rectangle(a.x,a.y,a.width,a.height):a,this.updateCrop()):(this._crop=null,this.cropRect=null,this.resetFrame())},b.Sprite.prototype.updateCrop=function(){if(this.cropRect){this._crop=b.Rectangle.clone(this.cropRect,this._crop),this._crop.x+=this._frame.x,this._crop.y+=this._frame.y;vara=Math.max(this._frame.x,this._crop.x),c=Math.max(this._frame.y,this._crop.y),d=Math.min(this._frame.right,this._crop.right)-a,e=Math.min(this._frame.bottom,this._crop.bottom)-c;this.texture.crop.x=a,this.texture.crop.y=c,this.texture.crop.width=d,this.texture.crop.height=e,this.texture.frame.width=Math.min(d,this.cropRect.width),this.texture.frame.height=Math.min(e,this.cropRect.height),this.texture.width=this.texture.frame.width,this.texture.height=this.texture.frame.height,this.game.renderType===b.WEBGL&&PIXI.WebGLRenderer.updateTextureFrame(this.texture)}},b.Sprite.prototype.revive=function(a){return"undefined"==typeofa&&(a=1),this.alive=!0,this.exists=!0,this.visible=!0,this.health=a,this.events&&this.events.onRevived.dispatch(this),this},b.Sprite.prototype.kill=function(){returnthis.alive=!1,this.exists=!1,this.visible=!1,this.events&&this.events.onKilled.dispatch(this),this},b.Sprite.prototype.destroy=function(a){if(null!==this.game&&1!==this._cache[8]){"undefined"==typeofa&&(a=!0),this._cache[8]=1,this.events&&this.events.onDestroy.dispatch(this),this.parent&&(this.parentinstanceofb.Group?this.parent.remove(this):this.parent.removeChild(this)),this.input&&this.input.destroy(),this.animations&&this.animations.destroy(),this.body&&this.body.destroy(),this.events&&this.events.destroy();varc=this.children.length;if(a)for(;c--;)this.children[c].destroy(a);elsefor(;c--;)this.removeChild(this.children[c]);this._crop&&(this._crop=null),this._frame&&(this._frame=null),this.alive=!1,this.exists=!1,this.visible=!1,this.filters=null,this.mask=null,this.game=null,this._cache[8]=0}},b.Sprite.prototype.damage=function(a){returnthis.alive&&(this.health-=a,this.health<=0&&this.kill()),this},b.Sprite.prototype.reset=function(a,b,c){return"undefined"==typeofc&&(c=1),this.world.setTo(a,b),this.position.x=a,thi
},stop:function(a,b){"undefined"==typeofb&&(b=!1),"string"==typeofa?this._anims[a]&&(this.currentAnim=this._anims[a],this.currentAnim.stop(b)):this.currentAnim&&this.currentAnim.stop(b)},update:function(){returnthis.updateIfVisible&&!this.sprite.visible?!1:this.currentAnim&&this.currentAnim.update()===!0?(this.currentFrame=this.currentAnim.currentFrame,!0):!1},next:function(a){this.currentAnim&&(this.currentAnim.next(a),this.currentFrame=this.currentAnim.currentFrame)},previous:function(a){this.currentAnim&&(this.currentAnim.previous(a),this.currentFrame=this.currentAnim.currentFrame)},getAnimation:function(a){return"string"==typeofa&&this._anims[a]?this._anims[a]:null},refreshFrame:function(){this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)},destroy:function(){vara=null;for(varainthis._anims)this._anims.hasOwnProperty(a)&&this._anims[a].destroy();this._anims={},this._frameData=null,this._frameIndex=0,this.currentAnim=null,this.currentFrame=null}},b.AnimationManager.prototype.constructor=b.AnimationManager,Object.defineProperty(b.AnimationManager.prototype,"frameData",{get:function(){returnthis._frameData}}),Object.defineProperty(b.AnimationManager.prototype,"frameTotal",{get:function(){returnthis._frameData.total}}),Object.defineProperty(b.AnimationManager.prototype,"paused",{get:function(){returnthis.currentAnim.isPaused},set:function(a){this.currentAnim.paused=a}}),Object.defineProperty(b.AnimationManager.prototype,"frame",{get:function(){returnthis.currentFrame?this._frameIndex:void0},set:function(a){"number"==typeofa&&null!==this._frameData.getFrame(a)&&(this.currentFrame=this._frameData.getFrame(a),this.currentFrame&&(this._frameIndex=a,this.sprite.setFrame(this.currentFrame),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1)))}}),Object.defineProperty(b.AnimationManager.prototype,"frameName",{get:function(){returnthis.currentFrame?this.currentFrame.name:void0},set:function(a){"string"==typeofa&&null!==this._frameData.getFrameByName(a)?(this.currentFrame=this._frameData.getFrameByName(a),this.currentFrame&&(this._frameIndex=this.currentFrame.index,this.sprite.setFrame(this.currentFrame),this.sprite.__tilePattern&&(this.__tilePattern=!1,this.tilingTexture=!1))):console.warn("Cannot set frameName: "+a)}}),b.Animation=function(a,c,d,e,f,g,h){this.game=a,this._parent=c,this._frameData=e,this.name=d,this._frames=[],this._frames=this._frames.concat(f),this.delay=1e3/g,this.loop=h,this.loopCount=0,this.killOnComplete=!1,this.isFinished=!1,this.isPlaying=!1,this.isPaused=!1,this._pauseStartTime=0,this._frameIndex=0,this._frameDiff=0,this._frameSkip=1,this.currentFrame=this._frameData.getFrame(this._frames[this._frameIndex]),this.onStart=newb.Signal,this.onUpdate=null,this.onComplete=newb.Signal,this.onLoop=newb.Signal,this.game.onPause.add(this.onPause,this),this.game.onResume.add(this.onResume,this)},b.Animation.prototype={play:function(a,b,c){return"number"==typeofa&&(this.delay=1e3/a),"boolean"==typeofb&&(this.loop=b),"undefined"!=typeofc&&(this.killOnComplete=c),this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,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.setFrame(this.currentFrame),this._parent.__tilePattern&&(this._parent.__tilePattern=!1,this._parent.tilingTexture=!1),this._parent.events.onAnimationStart.dispatch(this._parent,this),this.onStart.dispatch(this._parent,this),this},restart:function(){this.isPlaying=!0,this.isFinished=!1,this.paused=!1,this.loopCount=0,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.setFrame(this.currentFrame),this.onStart.dispatch(this._parent,this)},setFrame:function(a,b){varc;if("undefined"==typeofb&&(b=!1),"string"==typeofa)for(vard=0
null!==a.data?this.packLoadComplete(this._packIndex,!1):this.xhrLoad(this._packIndex,this.baseURL+a.url,"text","packLoadComplete","packLoadError")},packLoadComplete:function(a,c){if("undefined"==typeofc&&(c=!0),!this._packList[a])returnvoidconsole.warn("Phaser.Loader packLoadComplete invalid index "+a);vard=this._packList[a];if(d.loaded=!0,c)vare=JSON.parse(this._xhr.responseText);elsevare=this._packList[a].data;if(e[d.key])for(varf,g=0;g<e[d.key].length;g++)switch(f=e[d.key][g],f.type){case"image":this.image(f.key,f.url,f.overwrite);break;case"text":this.text(f.key,f.url,f.overwrite);break;case"json":this.json(f.key,f.url,f.overwrite);break;case"script":this.script(f.key,f.url,f.callback,d.callbackContext);break;case"binary":this.binary(f.key,f.url,f.callback,d.callbackContext);break;case"spritesheet":this.spritesheet(f.key,f.url,f.frameWidth,f.frameHeight,f.frameMax,f.margin,f.spacing);break;case"audio":this.audio(f.key,f.urls,f.autoDecode);break;case"tilemap":this.tilemap(f.key,f.url,f.data,b.Tilemap[f.format]);break;case"physics":this.physics(f.key,f.url,f.data,b.Loader[f.format]);break;case"bitmapFont":this.bitmapFont(f.key,f.textureURL,f.xmlURL,f.xmlData,f.xSpacing,f.ySpacing);break;case"atlasJSONArray":this.atlasJSONArray(f.key,f.textureURL,f.atlasURL,f.atlasData);break;case"atlasJSONHash":this.atlasJSONHash(f.key,f.textureURL,f.atlasURL,f.atlasData);break;case"atlasXML":this.atlasXML(f.key,f.textureURL,f.atlasURL,f.atlasData);break;case"atlas":this.atlas(f.key,f.textureURL,f.atlasURL,f.atlasData,b.Loader[f.format])}this.nextPack(a,!0)},packError:function(a){this._packList[a].loaded=!0,this._packList[a].error=!0,this.onFileError.dispatch(this._packList[a].key,this._packList[a]),console.warn("Phaser.Loader error loading pack file: "+this._packList[a].key+" from URL "+this._packList[a].url),this.nextPack(a,!1)},nextPack:function(a,b){this.onPackComplete.dispatch(this._packList[a].key,b,this.totalLoadedPacks(),this._packList.length),this._packIndex++,this._packIndex<this._packList.length?this.loadPack():this.beginLoad()},loadFile:function(){if(!this._fileList[this._fileIndex])returnvoidconsole.warn("Phaser.Loader loadFile invalid index "+this._fileIndex);vara=this._fileList[this._fileIndex],c=this;switch(this.onFileStart.dispatch(this.progress,a.key),a.type){case"image":case"spritesheet":case"textureatlas":case"bitmapfont":a.data=newImage,a.data.name=a.key,a.data.onload=function(){returnc.fileComplete(c._fileIndex)},a.data.onerror=function(){returnc.fileError(c._fileIndex)},this.crossOrigin&&(a.data.crossOrigin=this.crossOrigin),a.data.src=this.baseURL+a.url;break;case"audio":a.url=this.getAudioURL(a.url),null!==a.url?this.game.sound.usingWebAudio?this.xhrLoad(this._fileIndex,this.baseURL+a.url,"arraybuffer","fileComplete","fileError"):this.game.sound.usingAudioTag&&(this.game.sound.touchLocked?(a.data=newAudio,a.data.name=a.key,a.data.preload="auto",a.data.src=this.baseURL+a.url,this.fileComplete(this._fileIndex)):(a.data=newAudio,a.data.name=a.key,a.data.onerror=function(){returnc.fileError(c._fileIndex)},a.data.preload="auto",a.data.src=this.baseURL+a.url,a.data.addEventListener("canplaythrough",b.GAMES[this.game.id].load.fileComplete(this._fileIndex),!1),a.data.load())):this.fileError(this._fileIndex);break;case"json":this.useXDomainRequest&&window.XDomainRequest?(this._ajax=newwindow.XDomainRequest,this._ajax.timeout=3e3,this._ajax.onerror=function(){returnc.dataLoadError(c._fileIndex)},this._ajax.ontimeout=function(){returnc.dataLoadError(c._fileIndex)},this._ajax.onprogress=function(){},this._ajax.onload=function(){returnc.jsonLoadComplete(c._fileIndex)},this._ajax.open("GET",this.baseURL+a.url,!0),setTimeout(function(){this._ajax.send()},0)):this.xhrLoad(this._fileIndex,this.baseURL+a.url,"text","jsonLoadComplete","dataLoadError");break;case"tilemap":if(a.format===b.Tilemap.TILED_JSON)this.xhrLoad(this._fileIndex,this.baseURL+a.url,"text","jsonLoadComplete","dataLoadError");else{if(a.format!==b.Tilemap.CSV)thrownewError("Phaser.Loader. Invalid Tilemap format: "+a.format);this.xhrLoad(t
},getEmptyData:function(a,b,c,d){vare={};e.width=0,e.height=0,e.tileWidth=0,e.tileHeight=0,"undefined"!=typeofa&&null!==a&&(e.tileWidth=a),"undefined"!=typeofb&&null!==b&&(e.tileHeight=b),"undefined"!=typeofc&&null!==c&&(e.width=c),"undefined"!=typeofd&&null!==d&&(e.height=d),e.orientation="orthogonal",e.version="1",e.properties={},e.widthInPixels=0,e.heightInPixels=0;varf=[],g={name:"layer",x:0,y:0,width:0,height:0,widthInPixels:0,heightInPixels:0,alpha:1,visible:!0,properties:{},indexes:[],callbacks:[],bodies:[],data:[]};returnf.push(g),e.layers=f,e.images=[],e.objects={},e.collision={},e.tilesets=[],e.tiles=[],e},parseTiledJSON:function(a){functionc(a,b){varc={};for(vardinb){vare=b[d];c[e]=a[e]}returnc}if("orthogonal"!==a.orientation)returnconsole.warn("TilemapParser.parseTiledJSON: Only orthogonal map types are supported in this version of Phaser"),null;vard={};d.width=a.width,d.height=a.height,d.tileWidth=a.tilewidth,d.tileHeight=a.tileheight,d.orientation=a.orientation,d.format=b.Tilemap.TILED_JSON,d.version=a.version,d.properties=a.properties,d.widthInPixels=d.width*d.tileWidth,d.heightInPixels=d.height*d.tileHeight;for(vare=[],f=0;f<a.layers.length;f++)if("tilelayer"===a.layers[f].type){varg={name:a.layers[f].name,x:a.layers[f].x,y:a.layers[f].y,width:a.layers[f].width,height:a.layers[f].height,widthInPixels:a.layers[f].width*a.tilewidth,heightInPixels:a.layers[f].height*a.tileheight,alpha:a.layers[f].opacity,visible:a.layers[f].visible,properties:{},indexes:[],callbacks:[],bodies:[]};a.layers[f].properties&&(g.properties=a.layers[f].properties);for(varh=0,i=[],j=[],k=0,l=a.layers[f].data.length;l>k;k++)i.push(a.layers[f].data[k]>0?newb.Tile(g,a.layers[f].data[k],h,j.length,a.tilewidth,a.tileheight):newb.Tile(g,-1,h,j.length,a.tilewidth,a.tileheight)),h++,h===a.layers[f].width&&(j.push(i),h=0,i=[]);g.data=j,e.push(g)}d.layers=e;for(varm=[],f=0;f<a.layers.length;f++)if("imagelayer"===a.layers[f].type){varn={name:a.layers[f].name,image:a.layers[f].image,x:a.layers[f].x,y:a.layers[f].y,alpha:a.layers[f].opacity,visible:a.layers[f].visible,properties:{}};a.layers[f].properties&&(n.properties=a.layers[f].properties),m.push(n)}d.images=m;for(varo=[],f=0;f<a.tilesets.length;f++){varp=a.tilesets[f],q=newb.Tileset(p.name,p.firstgid,p.tilewidth,p.tileheight,p.margin,p.spacing,p.properties);p.tileproperties&&(q.tileProperties=p.tileproperties),q.rows=Math.round((p.imageheight-p.margin)/(p.tileheight+p.spacing)),q.columns=Math.round((p.imagewidth-p.margin)/(p.tilewidth+p.spacing)),q.total=q.rows*q.columns,q.rows%1!==0||q.columns%1!==0?console.warn("TileSet image dimensions do not match expected dimensions. Tileset width/height must be evenly divisible by Tilemap tile width/height."):o.push(q)}d.tilesets=o;for(varr={},s={},f=0;f<a.layers.length;f++)if("objectgroup"===a.layers[f].type){r[a.layers[f].name]=[],s[a.layers[f].name]=[];for(vart=0,l=a.layers[f].objects.length;l>t;t++)if(a.layers[f].objects[t].gid){varu={gid:a.layers[f].objects[t].gid,name:a.layers[f].objects[t].name,x:a.layers[f].objects[t].x,y:a.layers[f].objects[t].y,visible:a.layers[f].objects[t].visible,properties:a.layers[f].objects[t].properties};r[a.layers[f].name].push(u)}elseif(a.layers[f].objects[t].polyline){varu={name:a.layers[f].objects[t].name,type:a.layers[f].objects[t].type,x:a.layers[f].objects[t].x,y:a.layers[f].objects[t].y,width:a.layers[f].objects[t].width,height:a.layers[f].objects[t].height,visible:a.layers[f].objects[t].visible,properties:a.layers[f].objects[t].properties};u.polyline=[];for(varv=0;v<a.layers[f].objects[t].polyline.length;v++)u.polyline.push([a.layers[f].objects[t].polyline[v].x,a.layers[f].objects[t].polyline[v].y]);s[a.layers[f].name].push(u),r[a.layers[f].name].push(u)}elseif(a.layers[f].objects[t].polygon){varu=c(a.layers[f].objects[t],["name","type","x","y","visible","properties"]);u.polygon=[];for(varv=0;v<a.layers[f].objects[t].polygon.length;v++)u.polygon.push([a.layers[f].objects[t].polygon[v].x,a.layers[f].objects[t].polygon[v].y]);r[a.layers[f].name].push(u)}elseif(a.layers[f].ob