},destroy:function(){this.clearCurrentState(),this.callbackContext=null,this.onInitCallback=null,this.onShutDownCallback=null,this.onPreloadCallback=null,this.onLoadRenderCallback=null,this.onLoadUpdateCallback=null,this.onCreateCallback=null,this.onUpdateCallback=null,this.onRenderCallback=null,this.onPausedCallback=null,this.onResumedCallback=null,this.onPauseUpdateCallback=null,this.game=null,this.states={},this._pendingState=null}},c.StateManager.prototype.constructor=c.StateManager,c.Signal=function(){this._bindings=[],this._prevParams=null;vara=this;this.dispatch=function(){c.Signal.prototype.dispatch.apply(a,arguments)},this.memorize=!1,this._shouldPropagate=!0,this.active=!0},c.Signal.prototype={validateListener:function(a,b){if("function"!=typeofa)thrownewError("Phaser.Signal: listener is a required param of {fn}() and should be a Function.".replace("{fn}",b))},_registerListener:function(a,b,d,e){varf,g=this._indexOfListener(a,d);if(-1!==g){if(f=this._bindings[g],f.isOnce()!==b)thrownewError("You cannot add"+(b?"":"Once")+"() then add"+(b?"Once":"")+"() the same listener without removing the relationship first.")}elsef=newc.SignalBinding(this,a,b,d,e),this._addBinding(f);returnthis.memorize&&this._prevParams&&f.execute(this._prevParams),f},_addBinding:function(a){varb=this._bindings.length;dob--;while(this._bindings[b]&&a._priority<=this._bindings[b]._priority);this._bindings.splice(b+1,0,a)},_indexOfListener:function(a,b){for(varc,d=this._bindings.length;d--;)if(c=this._bindings[d],c._listener===a&&c.context===b)returnd;return-1},has:function(a,b){return-1!==this._indexOfListener(a,b)},add:function(a,b,c){returnthis.validateListener(a,"add"),this._registerListener(a,!1,b,c)},addOnce:function(a,b,c){returnthis.validateListener(a,"addOnce"),this._registerListener(a,!0,b,c)},remove:function(a,b){this.validateListener(a,"remove");varc=this._indexOfListener(a,b);return-1!==c&&(this._bindings[c]._destroy(),this._bindings.splice(c,1)),a},removeAll:function(a){"undefined"==typeofa&&(a=null);for(varb=this._bindings.length;b--;)a?this._bindings[b].context===a&&(this._bindings[b]._destroy(),this._bindings.splice(b,1)):this._bindings[b]._destroy();a||(this._bindings.length=0)},getNumListeners:function(){returnthis._bindings.length},halt:function(){this._shouldPropagate=!1},dispatch:function(){if(this.active){vara,b=Array.prototype.slice.call(arguments),c=this._bindings.length;if(this.memorize&&(this._prevParams=b),c){a=this._bindings.slice(),this._shouldPropagate=!0;doc--;while(a[c]&&this._shouldPropagate&&a[c].execute(b)!==!1)}}},forget:function(){this._prevParams=null},dispose:function(){this.removeAll(),deletethis._bindings,deletethis._prevParams},toString:function(){return"[Phaser.Signal active:"+this.active+" numListeners:"+this.getNumListeners()+"]"}},c.Signal.prototype.constructor=c.Signal,c.SignalBinding=function(a,b,c,d,e){this._listener=b,this._isOnce=c,this.context=d,this._signal=a,this._priority=e||0,this.callCount=0,this.active=!0,this.params=null},c.SignalBinding.prototype={execute:function(a){varb,c;returnthis.active&&this._listener&&(c=this.params?this.params.concat(a):a,b=this._listener.apply(this.context,c),this.callCount++,this._isOnce&&this.detach()),b},detach:function(){returnthis.isBound()?this._signal.remove(this._listener,this.context):null},isBound:function(){return!!this._signal&&!!this._listener},isOnce:function(){returnthis._isOnce},getListener:function(){returnthis._listener},getSignal:function(){returnthis._signal},_destroy:function(){deletethis._signal,deletethis._listener,deletethis.context},toString:function(){return"[Phaser.SignalBinding isOnce:"+this._isOnce+", isBound:"+this.isBound()+", active:"+this.active+"]"}},c.SignalBinding.prototype.constructor=c.SignalBinding,c.Filter=function(a,b,d){this.game=a,this.type=c.WEBGL_FILTER,this.passes=[this],this.shaders=[],this.dirty=!0,this.padding=0,this.prevPoint=newc.Point;vare=newDate;if(this.uniforms={resolution:{type:"2f",value:{x:256,y:256}},time:{type:"1f",value:0},mouse:{type:"2f",value:{x:0,y:0}},date
for(vara=0,b=this.children.length;b>a;a++)this.children[a].preUpdate();return!0},c.TileSprite.prototype.update=function(){},c.TileSprite.prototype.postUpdate=function(){this.exists&&this.body&&this.body.postUpdate(),1===this._cache[7]&&(this.position.x=this.game.camera.view.x+this.cameraOffset.x,this.position.y=this.game.camera.view.y+this.cameraOffset.y);for(vara=0,b=this.children.length;b>a;a++)this.children[a].postUpdate()},c.TileSprite.prototype.autoScroll=function(a,b){this._scroll.set(a,b)},c.TileSprite.prototype.stopScroll=function(){this._scroll.set(0,0)},c.TileSprite.prototype.loadTexture=function(a,b){b=b||0,this.key=a,ainstanceofc.RenderTexture?(this.key=a.key,this.setTexture(a)):ainstanceofc.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])),this.animations.loadFrameData(this.game.cache.getFrameData(a),b)):(console.warn("Texture with key '"+a+"' not found."),this.key="__missing",this.setTexture(PIXI.TextureCache[this.key])),this.texture.baseTexture.dirty()},c.TileSprite.prototype.setFrame=function(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):!a.trimmed&&this.texture.trim&&(this.texture.trim=null),this.texture._updateUvs()},c.TileSprite.prototype.destroy=function(a){if(null!==this.game&&!this.destroyPhase){"undefined"==typeofa&&(a=!0),this._cache[8]=1,this.events&&this.events.onDestroy.dispatch(this),this.filters&&(this.filters=null),this.parent&&(this.parentinstanceofc.Group?this.parent.remove(this):this.parent.removeChild(this)),this.animations.destroy(),this.events.destroy();varb=this.children.length;if(a)for(;b--;)this.children[b].destroy(a);elsefor(;b--;)this.removeChild(this.children[b]);this.exists=!1,this.visible=!1,this.alive=!1,this.filters=null,this.mask=null,this.game=null,this._cache[8]=0}},c.TileSprite.prototype.play=function(a,b,c,d){returnthis.animations.play(a,b,c,d)},c.TileSprite.prototype.reset=function(a,b){returnthis.world.setTo(a,b),this.position.x=a,this.position.y=b,this.alive=!0,this.exists=!0,this.visible=!0,this.renderable=!0,this._outOfBoundsFired=!1,this.tilePosition.x=0,this.tilePosition.y=0,this.body&&this.body.reset(a,b,!1,!1),this._cache[4]=1,this},Object.defineProperty(c.TileSprite.prototype,"angle",{get:function(){returnc.Math.wrapAngle(c.Math.radToDeg(this.rotation))},set:function(a){this.rotation=c.Math.degToRad(c.Math.wrapAngle(a))}}),Object.defineProperty(c.TileSprite.prototype,"frame",{get:function(){returnthis.animations.frame},set:function(a){a!==this.animations.frame&&(this.animations.frame=a)}}),Object.defineProperty(c.TileSprite.prototype,"frameName",{get:function(){returnthis.animations.frameName},set:function(a){a!==this.animations.frameName&&(this.animations.frameName=a)}}),Object.defineProperty(c.TileSprite.prototype,"fixedToCamera",{get:function(){return!!this._cache[7]},set:function(a){a?(this._cache[7]=1,this.cameraOffset.set(this.x,this.y)):this._cache[7]=0}}),Object.defineProperty(c.TileSprite.prototype,"exists",{get:function(){return!!this._cache[6]},set:function(a){a?(this._cache[6]=1,this.body&&this.body.type===c.Physics.P2JS&&this.body.addToWorld(),this.visible=!0):(this._cache[6]=0,this.body&&this.body.type===c.Physics.P2JS&&(this.body.safeRemove=!0),this.visible=!1)}}),Object
});vard=/^(?:#|0x)?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);if(d){vare=parseInt(d[1],16),f=parseInt(d[2],16),g=parseInt(d[3],16);b?(b.r=e,b.g=f,b.b=g):b=c.Color.createColor(e,f,g)}returnb},webToColor:function(a,b){b||(b=c.Color.createColor());vard=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(a);returnd&&(b.r=parseInt(d[1],10),b.g=parseInt(d[2],10),b.b=parseInt(d[3],10),b.a=void0!==d[4]?parseFloat(d[4]):1),b},valueToColor:function(a,b){if(b||(b=c.Color.createColor()),"string"==typeofa)return0===a.indexOf("rgb")?c.Color.webToColor(a,b):(b.a=1,c.Color.hexToColor(a,b));if("number"==typeofa){vard=c.Color.getRGB(a);returnb.r=d.r,b.g=d.g,b.b=d.b,b.a=d.a/255,b}returnb},componentToHex:function(a){varb=a.toString(16);return1==b.length?"0"+b:b},HSVColorWheel:function(a,b){"undefined"==typeofa&&(a=1),"undefined"==typeofb&&(b=1);for(vard=[],e=0;359>=e;e++)d.push(c.Color.HSVtoRGB(e/359,a,b));returnd},HSLColorWheel:function(a,b){"undefined"==typeofa&&(a=.5),"undefined"==typeofb&&(b=.5);for(vard=[],e=0;359>=e;e++)d.push(c.Color.HSLtoRGB(e/359,a,b));returnd},interpolateColor:function(a,b,d,e,f){"undefined"==typeoff&&(f=255);varg=c.Color.getRGB(a),h=c.Color.getRGB(b),i=(h.red-g.red)*e/d+g.red,j=(h.green-g.green)*e/d+g.green,k=(h.blue-g.blue)*e/d+g.blue;returnc.Color.getColor32(f,i,j,k)},interpolateColorWithRGB:function(a,b,d,e,f,g){varh=c.Color.getRGB(a),i=(b-h.red)*g/f+h.red,j=(d-h.green)*g/f+h.green,k=(e-h.blue)*g/f+h.blue;returnc.Color.getColor(i,j,k)},interpolateRGB:function(a,b,d,e,f,g,h,i){varj=(e-a)*i/h+a,k=(f-b)*i/h+b,l=(g-d)*i/h+d;returnc.Color.getColor(j,k,l)},getRandomColor:function(a,b,d){if("undefined"==typeofa&&(a=0),"undefined"==typeofb&&(b=255),"undefined"==typeofd&&(d=255),b>255||a>b)returnc.Color.getColor(255,255,255);vare=a+Math.round(Math.random()*(b-a)),f=a+Math.round(Math.random()*(b-a)),g=a+Math.round(Math.random()*(b-a));returnc.Color.getColor32(d,e,f,g)},getRGB:function(a){returna>16777215?{alpha:a>>>24,red:a>>16&255,green:a>>8&255,blue:255&a,a:a>>>24,r:a>>16&255,g:a>>8&255,b:255&a}:{alpha:255,red:a>>16&255,green:a>>8&255,blue:255&a,a:255,r:a>>16&255,g:a>>8&255,b:255&a}},getWebRGB:function(a){if("object"==typeofa)return"rgba("+a.r.toString()+","+a.g.toString()+","+a.b.toString()+","+(a.a/255).toString()+")";varb=c.Color.getRGB(a);return"rgba("+b.r.toString()+","+b.g.toString()+","+b.b.toString()+","+(b.a/255).toString()+")"},getAlpha:function(a){returna>>>24},getAlphaFloat:function(a){return(a>>>24)/255},getRed:function(a){returna>>16&255},getGreen:function(a){returna>>8&255},getBlue:function(a){return255&a}},c.Physics=function(a,b){b=b||{},this.game=a,this.config=b,this.arcade=null,this.p2=null,this.ninja=null,this.box2d=null,this.chipmunk=null,this.parseConfig()},c.Physics.ARCADE=0,c.Physics.P2JS=1,c.Physics.NINJA=2,c.Physics.BOX2D=3,c.Physics.CHIPMUNK=4,c.Physics.prototype={parseConfig:function(){this.config.hasOwnProperty("arcade")&&this.config.arcade!==!0||!c.Physics.hasOwnProperty("Arcade")||(this.arcade=newc.Physics.Arcade(this.game),this.game.time.deltaCap=.2),this.config.hasOwnProperty("ninja")&&this.config.ninja===!0&&c.Physics.hasOwnProperty("Ninja")&&(this.ninja=newc.Physics.Ninja(this.game)),this.config.hasOwnProperty("p2")&&this.config.p2===!0&&c.Physics.hasOwnProperty("P2")&&(this.p2=newc.Physics.P2(this.game,this.config)),this.config.hasOwnProperty("box2d")&&this.config.box2d===!0&&c.Physics.hasOwnProperty("BOX2D")&&(this.box2d=newc.Physics.BOX2D(this.game,this.config))},startSystem:function(a){if(a===c.Physics.ARCADE?this.arcade=newc.Physics.Arcade(this.game):a===c.Physics.P2JS&&(this.p2=newc.Physics.P2(this.game,this.config)),a===c.Physics.NINJA)this.ninja=newc.Physics.Ninja(this.game);elseif(a===c.Physics.BOX2D&&null===this.box2d)this.box2d=newc.Physics.Box2D(this.game,this.config);elseif(a===c.Physics.CHIPMUNK&&null===this.chipmunk)thrownewError("The Chipmunk physics system has not been implemented yet.")},enable:function(a,b,d){"undefined"==typeofb&&(b=c.Physics.ARCADE),"undefined"==typeofd&&(d=
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=newc.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=b(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].objects[t].ellipse){varu=b(a.layers[f].objects[t],["name","type","ellipse","x","y","width","height","visible","properties"]);r[a.layers[f].name].push(u)}else{varu=b(a.layers[f].objects[t],["name","type","x","y","width","height","visible","properties"]);u.rectangle=!0,r[a.layers[f].name].push(u)}}d.objects=r,d.collision=s,d.tiles=[];for(varf=0;f<d.tilesets.length;f++)for(varp=d.tilesets[f],h=p.tileMargin,w=p.tileMargin,x=0,y=0,z=0,k=p.firstgid;k<p.firstgid+p.total&&(d.tiles[k]=[h,w,f],h+=p.tileWidth+p.tileSpacing,x++,x!==p.total)&&(y++,y!==p.columns||(h=p.tileMargin,w+=p.tileHeight+p.tileSpacing,y=0,z++,z!==p.rows));k++);varf,A,B,g,C,D,p;for(f=0;f<d.layers.length;f++)for(g=d.layers[f],A=0;A<g.data.length;A++)for(i=g.data[A],B=0;B<i.length;B++)C=i[B],C.index<0||(D=d.tiles[C.index][2],p=d.tilesets[D],p.tileProperties&&p.tileProperties[C.index-p.firstgid]&&(C.properties=p.tileProperties[C.index-p.firstgid]));returnd}},c.Tileset=function(a,b,c,d,e,f,g){("undefined"==typeofc||0>=c)&&(c=32),("undefined"==typeofd||0>=d)&&(d=32),"undefined"==typeofe&&(e=0),"undefined"==typeoff&&(f=0),this.name=a,this.firstgid=0|b,this.tileWidth=0|c,this.tileHeight=0|d,this.tileMargin=0|e,this.tileSpacing=0|f,this.properties=g||{},this.image=null,this.rows=0,this.columns=0,this.total=0,this.drawCoords=[]},c.Tileset.prototype={draw:function(a,b,c,d){vare=d-this.firstgid<<1;e>=0&&e+1<this.drawCoords.length&&a.drawImage(this.image,this.drawCoords[e],this.drawCoords[e+1],this.tileWidth,this.tileHeight,b,c,this.tileWidth,this.tileHeight)},containsTileIndex:function(a){returna>=this.firstgid&&a<this.firstgid+this.total},setImage:function(a){this.image=a,this.updateTileData()},setSpacing:function(a,b){this.tileMargin=0|a,this.tileSpacing=0|b,this.updateTileData()},updateTileData:function(){vara=this.image;this.rows=Math.round((a.height-this.tileMargi
returne=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=e*a[0][0]+f*a[0][1],h=b[1][1]-b[0][1],i=b[0][0]-b[1][0],j=h*b[0][0]+i*b[0][1],k=e*i-h*f,d.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(e*j-h*g)/k),l},c.segmentsIntersect=function(a,b,c,d){vare=b[0]-a[0],f=b[1]-a[1],g=d[0]-c[0],h=d[1]-c[1];if(g*f-h*e==0)return!1;vari=(e*(c[1]-a[1])+f*(a[0]-c[0]))/(g*f-h*e),j=(g*(a[1]-c[1])+h*(c[0]-a[0]))/(h*e-g*f);returni>=0&&1>=i&&j>=0&&1>=j}},{"./Scalar":6,__browserify_Buffer:1,__browserify_process:2}],4:[function(a,b){functionc(){}a("__browserify_process"),a("__browserify_Buffer");b.exports=c,c.area=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},c.left=function(a,b,d){returnc.area(a,b,d)>0},c.leftOn=function(a,b,d){returnc.area(a,b,d)>=0},c.right=function(a,b,d){returnc.area(a,b,d)<0},c.rightOn=function(a,b,d){returnc.area(a,b,d)<=0};vard=[],e=[];c.collinear=function(a,b,f,g){if(g){varh=d,i=e;h[0]=b[0]-a[0],h[1]=b[1]-a[1],i[0]=f[0]-b[0],i[1]=f[1]-b[1];varj=h[0]*i[0]+h[1]*i[1],k=Math.sqrt(h[0]*h[0]+h[1]*h[1]),l=Math.sqrt(i[0]*i[0]+i[1]*i[1]),m=Math.acos(j/(k*l));returng>m}return0==c.area(a,b,f)},c.sqdist=function(a,b){varc=b[0]-a[0],d=b[1]-a[1];returnc*c+d*d}},{__browserify_Buffer:1,__browserify_process:2}],5:[function(a,b){functionc(){this.vertices=[]}functiond(a,b,c,d,e){e=e||0;varf=b[1]-a[1],h=a[0]-b[0],i=f*a[0]+h*a[1],j=d[1]-c[1],k=c[0]-d[0],l=j*c[0]+k*c[1],m=f*k-j*h;returng.eq(m,0,e)?[0,0]:[(k*i-h*l)/m,(f*l-j*i)/m]}vare=(a("__browserify_process"),a("__browserify_Buffer"),a("./Line")),f=a("./Point"),g=a("./Scalar");b.exports=c,c.prototype.at=function(a){varb=this.vertices,c=b.length;returnb[0>a?a%c+c:a%c]},c.prototype.first=function(){returnthis.vertices[0]},c.prototype.last=function(){returnthis.vertices[this.vertices.length-1]},c.prototype.clear=function(){this.vertices.length=0},c.prototype.append=function(a,b,c){if("undefined"==typeofb)thrownewError("From is not given!");if("undefined"==typeofc)thrownewError("To is not given!");if(b>c-1)thrownewError("lol1");if(c>a.vertices.length)thrownewError("lol2");if(0>b)thrownewError("lol3");for(vard=b;c>d;d++)this.vertices.push(a.vertices[d])},c.prototype.makeCCW=function(){for(vara=0,b=this.vertices,c=1;c<this.vertices.length;++c)(b[c][1]<b[a][1]||b[c][1]==b[a][1]&&b[c][0]>b[a][0])&&(a=c);f.left(this.at(a-1),this.at(a),this.at(a+1))||this.reverse()},c.prototype.reverse=function(){for(vara=[],b=0,c=this.vertices.length;b!==c;b++)a.push(this.vertices.pop());this.vertices=a},c.prototype.isReflex=function(a){returnf.right(this.at(a-1),this.at(a),this.at(a+1))};varh=[],i=[];c.prototype.canSee=function(a,b){varc,d,g=h,j=i;if(f.leftOn(this.at(a+1),this.at(a),this.at(b))&&f.rightOn(this.at(a-1),this.at(a),this.at(b)))return!1;d=f.sqdist(this.at(a),this.at(b));for(vark=0;k!==this.vertices.length;++k)if((k+1)%this.vertices.length!==a&&k!==a&&f.leftOn(this.at(a),this.at(b),this.at(k+1))&&f.rightOn(this.at(a),this.at(b),this.at(k))&&(g[0]=this.at(a),g[1]=this.at(b),j[0]=this.at(k),j[1]=this.at(k+1),c=e.lineInt(g,j),f.sqdist(this.at(a),c)<d))return!1;return!0},c.prototype.copy=function(a,b,d){vare=d||newc;if(e.clear(),b>a)for(varf=a;b>=f;f++)e.vertices.push(this.vertices[f]);else{for(varf=0;b>=f;f++)e.vertices.push(this.vertices[f]);for(varf=a;f<this.vertices.length;f++)e.vertices.push(this.vertices[f])}returne},c.prototype.getCutEdges=function(){for(vara=[],b=[],d=[],e=newc,f=Number.MAX_VALUE,g=0;g<this.vertices.length;++g)if(this.isReflex(g))for(varh=0;h<this.vertices.length;++h)if(this.canSee(g,h)){b=this.copy(g,h,e).getCutEdges(),d=this.copy(h,g,e).getCutEdges();for(vari=0;i<d.length;i++)b.push(d[i]);b.length<f&&(a=b,f=b.length,a.push([this.at(g),this.at(h)]))}returna},c.prototype.decomp=function(){vara=this.getCutEdges();returna.length>0?this.slice(a):[this]},c.prototype.slice=function(a){if(0==a.length)return[this];if(ainstanceofArray&&a.length&&a[0]instanceofArray&&2==a[0].length&&a[0][0]instanceofArray){for(varb=[this],c=0;c<a.length;c++)for(vard=a[c],e=0;e<b.length;e++){varf=b[e],g=f.slice(d);if(g){b.splice(e,1),b.push(g
varC=f.dot(p,t);if(q[0]>=u[0]&&q[0]<v[0]&&0>=C){if(l)return!0;B=!0,f.scale(p,t,-C),f.add(r,q,p),f.copy(s,t);varD=this.createContactEquation(e,a,i,b);f.copy(D.normalA,s),f.scale(D.contactPointB,D.normalA,-m),h(D.contactPointB,D.contactPointB,c),g(D.contactPointB,D.contactPointB,a.position),f.copy(D.contactPointA,r),f.sub(D.contactPointA,D.contactPointA,e.position),this.contactEquations.push(D),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(D))}}if(B=!1,m>0)for(varA=w;x>=A;A++)if(f.set(u,A*o,n[A]),f.add(u,u,j),f.sub(p,c,u),f.squaredLength(p)<Math.pow(m,2)){if(l)return!0;B=!0;varD=this.createContactEquation(e,a,i,b);f.copy(D.normalA,p),f.normalize(D.normalA,D.normalA),f.scale(D.contactPointB,D.normalA,-m),h(D.contactPointB,D.contactPointB,c),g(D.contactPointB,D.contactPointB,a.position),g(D.contactPointA,u,j),h(D.contactPointA,D.contactPointA,j),g(D.contactPointA,D.contactPointA,e.position),this.contactEquations.push(D),this.enableFriction&&this.frictionEquations.push(this.createFrictionFromContact(D))}returnB?1:0};varnb=f.create(),ob=f.create(),pb=f.create(),qb=newp([f.create(),f.create(),f.create(),f.create()]);c.prototype[q.RECTANGLE|q.HEIGHTFIELD]=c.prototype[q.CONVEX|q.HEIGHTFIELD]=c.prototype.convexHeightfield=function(a,b,c,d,e,g,h,i,j){vark=g.data,l=g.elementWidth,m=nb,n=ob,o=pb,p=qb,q=Math.floor((a.aabb.lowerBound[0]-h[0])/l),r=Math.ceil((a.aabb.upperBound[0]-h[0])/l);0>q&&(q=0),r>=k.length&&(r=k.length-1);for(vars=k[q],t=k[r],u=q;r>u;u++)k[u]<t&&(t=k[u]),k[u]>s&&(s=k[u]);if(a.aabb.lowerBound[1]>s)returnj?!1:0;for(varv=0,u=q;r>u;u++){f.set(m,u*l,k[u]),f.set(n,(u+1)*l,k[u+1]),f.add(m,m,h),f.add(n,n,h);varw=100;f.set(o,.5*(n[0]+m[0]),.5*(n[1]+m[1]-w)),f.sub(p.vertices[0],n,o),f.sub(p.vertices[1],m,o),f.copy(p.vertices[2],p.vertices[1]),f.copy(p.vertices[3],p.vertices[0]),p.vertices[2][1]-=w,p.vertices[3][1]-=w,v+=this.convexConvex(a,b,c,d,e,p,o,0,j)}returnv}},{"../equations/ContactEquation":22,"../equations/Equation":23,"../equations/FrictionEquation":24,"../math/vec2":31,"../objects/Body":32,"../shapes/Circle":38,"../shapes/Convex":39,"../shapes/Rectangle":44,"../shapes/Shape":45,"../utils/TupleDictionary":49,"../utils/Utils":50,__browserify_Buffer:1,__browserify_process:2}],14:[function(a,b){functionc(){e.call(this,e.SAP),this.axisList=[],this.axisIndex=0;vara=this;this._addBodyHandler=function(b){a.axisList.push(b.body)},this._removeBodyHandler=function(b){varc=a.axisList.indexOf(b.body);-1!==c&&a.axisList.splice(c,1)}}vard=(a("__browserify_process"),a("__browserify_Buffer"),a("../utils/Utils")),e=a("../collision/Broadphase");b.exports=c,c.prototype=newe,c.prototype.setWorld=function(a){this.axisList.length=0,d.appendArray(this.axisList,a.bodies),a.off("addBody",this._addBodyHandler).off("removeBody",this._removeBodyHandler),a.on("addBody",this._addBodyHandler).on("removeBody",this._removeBodyHandler),this.world=a},c.sortAxisList=function(a,b){b=0|b;for(varc=1,d=a.length;d>c;c++){for(vare=a[c],f=c-1;f>=0&&!(a[f].aabb.lowerBound[b]<=e.aabb.lowerBound[b]);f--)a[f+1]=a[f];a[f+1]=e}returna},c.prototype.getCollisionPairs=function(){vara=this.axisList,b=this.result,d=this.axisIndex;b.length=0;for(varf=a.length;f--;){varg=a[f];g.aabbNeedsUpdate&&g.updateAABB()}c.sortAxisList(a,d);for(varh=0,i=0|a.length;h!==i;h++)for(varj=a[h],k=h+1;i>k;k++){varl=a[k],m=l.aabb.lowerBound[d]<=j.aabb.upperBound[d];if(!m)break;e.canCollide(j,l)&&this.boundingVolumeCheck(j,l)&&b.push(j,l)}returnb}},{"../collision/Broadphase":10,"../utils/Utils":50,__browserify_Buffer:1,__browserify_process:2}],15:[function(a,b){functionc(a,b,c,e){this.type=c,e=d.defaults(e,{collideConnected:!0,wakeUpBodies:!0}),this.equations=[],this.bodyA=a,this.bodyB=b,this.collideConnected=e.collideConnected,e.wakeUpBodies&&(a&&a.wakeUp(),b&&b.wakeUp())}a("__browserify_process"),a("__browserify_Buffer");b.exports=c;vard=a("../utils/Utils");c.prototype.update=function(){thrownewError("method update() not implmemented in this Constraint subclass!")},c.DISTANCE=1,c.GEAR=2,c.LOCK=3,c.PRISMATIC=4,c.REVOLUTE=5,c.