},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.LinkedList=function(){this.next=null,this.prev=null,this.first=null,this.last=null,this.total=0},c.LinkedList.prototype={add:function(a){return0===this.total&&null===this.first&&null===this.last?(this.first=a,this.last=a,this.next=a,a.prev=this,this.total++,a):(this.last.next=a,a.prev=this.last,this.last=a,this.total++,a)},reset:function(){this.first=null,this.last=null,this.next=null,this.prev=null,this.total=0},remove:function(a){return1===this.total?(this.reset(),void(a.next=a.prev=null)):(a===this.first?this.first=this.first.next:a===this.last&&(this.last=this.last.prev),a.prev&&(a.prev.next=a.next),a.next&&(a.next.prev=a.prev),a.next=a.prev=null,null===this.first&&(this.last=null),voidthis.total--)},callAll:function(a){if(this.first&&this.last){varb=this.first;dob&&b[a]&&b[a].call(b),b=b.next;while(b!=this.last.next)}}},c.LinkedList.prototype.constructor=c.LinkedList,c.ArrayList=function(){this.total=0,this.position=0,this.list=[]},c.ArrayList.prototype={add:function(a){returnthis.exists(a)||(this.list.push(a),this.total++),a},getIndex:function(a){returnthis.list.indexOf(a)},exists:function(a){returnthis.list.indexOf(a)>-1},reset:function(){this.list.length=0,this.total=0},remove:function(a){varb=this.list.indexOf(a);returnb>-1?(this.list.splice(b,1),this.total--,a):void0},setAll:function(a,b){for(varc=this.list.length;c--;)this.list[c]&&this.list[c][a]&&(this.list[c][a]=b)},callAll:function(a){for(varb=Array.prototype.splice.call(arguments,1),c=this.list.length;c--;)this.list[c]&&this.list[c][a]&&this.list[c][a].apply(this.list[c],b)}},Object.defineProperty(c.ArrayList.prototype,"first",{get:function(){returnthis.position=0,this.total>0?this.list[0]:null}}),Object.defineProperty(c.ArrayList.prototype,"next",{get:function(){returnthis.position<this.total?(this.position++,this.list[this.position]):null}}),c.ArrayList.prototype.constructor=c.ArrayList,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]
},fitSprite:function(a){this.manager.scaleSprite(a),a.x=this.manager.bounds.centerX,a.y=this.manager.bounds.centerY},debug:function(){this.game.debug.text(this.boundsFluid.width+" x "+this.boundsFluid.height,this.boundsFluid.x+4,this.boundsFluid.y+16),this.game.debug.geom(this.boundsFluid,"rgba(255,0,0,0.9",!1)}},c.FlexGrid.prototype.constructor=c.FlexGrid,c.FlexLayer=function(a,b,d,e){c.Group.call(this,a.game,null,"__flexLayer"+a.game.rnd.uuid(),!1),this.manager=a.manager,this.grid=a,this.persist=!1,this.position=b,this.bounds=d,this.scale=e,this.topLeft=d.topLeft,this.topMiddle=newc.Point(d.halfWidth,0),this.topRight=d.topRight,this.bottomLeft=d.bottomLeft,this.bottomMiddle=newc.Point(d.halfWidth,d.bottom),this.bottomRight=d.bottomRight},c.FlexLayer.prototype=Object.create(c.Group.prototype),c.FlexLayer.prototype.constructor=c.FlexLayer,c.FlexLayer.prototype.resize=function(){},c.FlexLayer.prototype.debug=function(){this.game.debug.text(this.bounds.width+" x "+this.bounds.height,this.bounds.x+4,this.bounds.y+16),this.game.debug.geom(this.bounds,"rgba(0,0,255,0.9",!1),this.game.debug.geom(this.topLeft,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topMiddle,"rgba(255,255,255,0.9"),this.game.debug.geom(this.topRight,"rgba(255,255,255,0.9")},c.ScaleManager=function(a,b,d){this.game=a,this.grid=null,this.width=0,this.height=0,this.minWidth=null,this.maxWidth=null,this.minHeight=null,this.maxHeight=null,this.offset=newc.Point,this.forceLandscape=!1,this.forcePortrait=!1,this.incorrectOrientation=!1,this._pageAlignHorizontally=!1,this._pageAlignVertically=!1,this.maxIterations=5,this.enterLandscape=newc.Signal,this.enterPortrait=newc.Signal,this.enterIncorrectOrientation=newc.Signal,this.leaveIncorrectOrientation=newc.Signal,this.fullScreenTarget=null,this.createFullScreenTarget=function(){vara=document.createElement("div");returna.style.margin="0",a.style.padding="0",a.style.background="#000",a},this._createdFullScreenTarget=null,this.enterFullScreen=newc.Signal,this.leaveFullScreen=newc.Signal,this.fullScreenFailed=newc.Signal,this.screenOrientation=c.DOM.getScreenOrientation(),this.scaleFactor=newc.Point(1,1),this.scaleFactorInversed=newc.Point(1,1),this.margin={left:0,top:0,right:0,bottom:0,x:0,y:0},this.bounds=newc.Rectangle,this.aspectRatio=0,this.sourceAspectRatio=0,this.event=null,this.windowConstraints={bottom:!0,right:!0},this.compatibility={supportsFullScreen:!1,orientationFallback:null,noMargins:!1,scrollTo:null,forceMinimumDocumentHeight:!0,showAllCanExpand:!0},this._scaleMode=c.ScaleManager.NO_SCALE,this._fullScreenScaleMode=c.ScaleManager.NO_SCALE,this.parentIsWindow=!1,this.parentNode=null,this.parentScaleFactor=newc.Point(1,1),this.trackParentInterval=2e3,this.onSizeChange=newc.Signal,this.onResize=null,this.onResizeContext=null,this._fullScreenRestore=null,this._gameSize=newc.Rectangle,this._userScaleFactor=newc.Point(1,1),this._lastUpdate=0,this._updateThrottle=0,this._updateThrottleReset=100,this._parentBounds=newc.Rectangle,this._lastReportedCanvasSize=newc.Rectangle,this._lastReportedGameSize=newc.Rectangle,a.config&&this.parseConfig(a.config),this.setupScale(b,d)},c.ScaleManager.EXACT_FIT=0,c.ScaleManager.NO_SCALE=1,c.ScaleManager.SHOW_ALL=2,c.ScaleManager.RESIZE=3,c.ScaleManager.USER_SCALE=4,c.ScaleManager.prototype={boot:function(){vara=this.compatibility;a.supportsFullScreen=this.game.device.fullscreen&&!this.game.device.cocoonJS,this.game.device.iPad||this.game.device.webApp||this.game.device.desktop||(a.scrollTo=this.game.device.android&&!this.game.device.chrome?newc.Point(0,1):newc.Point(0,0)),a.orientationFallback=this.game.device.desktop?"screen":"";varb=this;this._orientationChange=function(a){returnb.orientationChange(a)},this._windowResize=function(a){returnb.windowResize(a)},window.addEventListener("orientationchange",this._orientationChange,!1),window.addEventListener("resize",this._windowResize,!1),this.compatibility.supportsFullScreen&&(this._fullScreenChange=function(a){returnb.fullScreenChange(a)},this._fullScreenError=function(a){returnb.fullScreenErr
},c.TileSprite.prototype=Object.create(PIXI.TilingSprite.prototype),c.TileSprite.prototype.constructor=c.TileSprite,c.TileSprite.prototype.preUpdate=function(){if(1===this._cache[4]&&this.exists)returnthis.world.setTo(this.parent.position.x+this.position.x,this.parent.position.y+this.position.y),this.worldTransform.tx=this.world.x,this.worldTransform.ty=this.world.y,this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,this.body&&this.body.preUpdate(),this._cache[4]=0,!1;if(this._cache[0]=this.world.x,this._cache[1]=this.world.y,this._cache[2]=this.rotation,!this.exists||!this.parent.exists)returnthis._cache[3]=-1,!1;(this.autoCull||this.checkWorldBounds)&&this._bounds.copyFrom(this.getBounds()),this.autoCull&&(this.renderable=this.game.world.camera.screenView.intersects(this._bounds)),this.checkWorldBounds&&(1===this._cache[5]&&this.game.world.bounds.intersects(this._bounds)?(this._cache[5]=0,this.events.onEnterBounds.dispatch(this)):0!==this._cache[5]||this.game.world.bounds.intersects(this._bounds)||(this._cache[5]=1,this.events.onOutOfBounds.dispatch(this))),this.world.setTo(this.game.camera.x+this.worldTransform.tx,this.game.camera.y+this.worldTransform.ty),this.visible&&(this._cache[3]=this.game.stage.currentRenderOrderID++),this.animations.update(),0!==this._scroll.x&&(this.tilePosition.x+=this._scroll.x*this.game.time.physicsElapsed),0!==this._scroll.y&&(this.tilePosition.y+=this._scroll.y*this.game.time.physicsElapsed),this.body&&this.body.preUpdate();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=
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=!1),b===c.Physics.ARCADE?this.arcade.enable(a):b===c.Physics.P2JS&&this.p2?this.p2.enable(a,d):b===c.Physics.NINJA&&this.ninja?this.ninja.enableAABB(a):b===c.Physics.BOX2D&&this.box2d&&this.box2d.enable(a)},preUpdate:function(){this.p2&&this.p2.preUpdate(),this.box2d&&this.box2d.preUpdate()},update:function(){this.p2&&this.p2.update(),this.box2d&&this.box2d.update()},setBoundsToWorld:function(){this.arcade&&this.arcade.setBoundsToWorld(),this.ninja&&this.ninja.setBoundsToWorld(),this.p2&&this.p2.setBoundsToWorld(),this.box2d&&this.box2d.setBoundsToWorld()},clear:function(){this.p2&&this.p2.clear(),this.box2d&&this.box2d.clear()},destroy:function(){this.p2&&this.p2.destroy(),this.box2d&&this.box2d.destroy(),this.arcade=null,this.ninja=null,this.p2=null,this.box2d=null}},c.Physics.prototype.constructor=c.Physics,c.Physics.Arcade=function(a){this.game=a,this.gravity=newc.Point,this.bounds=newc.Rectangle(0,0,a.world.width,a.world.height),this.checkCollision={up:!0,down:!0,left:!0,right:!0},this.maxObjects=10,this.maxLevels=4,this.OVERLAP_BIAS=4,this.TILE_BIAS=16,this.forceX=!1,this.skipQuadTree=!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[0],g[1]);break}}returnb}vard=a,c=this.vertices.indexOf(d[0]),e=this.vertices.indexOf(d[1]);return-1!=c&&-1!=e?[this.copy(c,e),this.copy(e,c)]:!1},c.prototype.isSimple=function(){for(vara=this.vertices,b=0;b<a.length-1;b++)for(varc=0;b-1>c;c++)if(e.segmentsIntersect(a[b],a[b+1],a[c],a[c+1]))return!1;for(varb=1;b<a.length-2;b++)if(e.segmentsIntersect(a[0],a[a.length-1],a[b],a[b+1]))return!1;return!0},c.prototype.quickDecomp=function(a,b,e,g,h,i){h=h||100,i=i||0,g=g||25,a="undefined"!=typeofa?a:[],b=b||[],e=e||[];varj=[0,0],k=[0,0],l=[0,0],m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=newc,u=newc,v=this,w=this.vertices;if(w.length<3)returna;if(i++,i>h)returnconsole.warn("quickDecomp: max level ("+h+") reached."),a;for(varx=0;x<this.vertices.length;++x)if(v.isReflex(x)){b.push(v.vertices[x]),m=n=Number.MAX_VALUE;for(vary=0;y<this.vertices.length;++y)f.left(v.at(x-1),v.at(x),v.at(y))&&f.rightOn(v.at(x-1),v.at(x),v.at(y-1))&&(l=d(v.at(x-1),v.at(x),v.at(y),v.at(y-1)),f.right(v.at(x+1),v.at(x),l)&&(o=f.sqdist(v.vertices[x],l),n>o&&(n=o,k=l,r=y))),f.left(v.at(x+1),v.at(x),v.at(y+1))&&f.rightOn(v.at(x+1),v.at(x),v.at(y))&&(l=d(v.at(x+1),v.at(x),v.at(y),v.at(y+1)),f.left(v.at(x-1),v.at(x),l)&&(o=f.sqdist(v.vertices[x],l),m>o&&(m=o,j=l,q=y)));if(r==(q+1)%this.vertices.length)l[0]=(k[0]+j[0])/2,l[1]=(k[1]+j[1])/2,e.push(l),q>x?(t.append(v,x,q+1),t.vertices.push(l),u.vertices.push(l),0!=r&&u.append(v,r,v.vertices.length),u.append(v,0,x+1)):(0!=x&&t.append(v,x,v.vertices.length),t.append(v,0,q+1),t.vertices.push(l),u.vertices.push(l),u.append(v,r,x+1));else{if(r>q&&(q+=this.vertices.length),p=Number.MAX_VALUE,r>q)returna;for(vary=r;q>=y;++y)f.leftOn(v.at(x-1),v.at(x),v.at(y))&&f.rightOn(v.a
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.prototype.setStiffness=function(a){for(varb=this.equations,c=0;c!==b.length;c++){vard=b[c];d.stiffness=a,d.needsUpdate=!0}},c.prototype.setRelaxation=function(a){for(varb=this.equations,c=0;c!==b.length;c++){vard=b[c];d.relaxation=a,d.needsUpdate=!0}}},{"../utils/Utils":50,__browserify_Buffer:1,__browserify_process:2}],16:[function(a,b){functionc(a,b,c){c=g.defaults(c,{localAnchorA:[0,0],localAnchorB:[0,0]}),d.call(this,a,b,d.DISTANCE,c),this.localAnchorA=f.fromValues(c.localAnchorA[0],c.localAnchorA[1]),this.localAnchorB=f.fromValues(c.localAnchorB[0],c.localAnchorB[1]);varh=this.localAnchorA,i=this.localAnchorB;if(this.distance=0,"number"==typeofc.distance)this.distance=c.distance;else{varj=f.create(),k=f.create(),l=f.create();f.rotate(j,h,a.angle),f.rotate(k,i,b.angle),f.add(l,b.position,k),f.sub(l,l,j),f.sub(l,l,a.position),this.distance=f.length(l)}varm;m="undefined"==typeofc.maxForce?Number.MAX_VALUE:c.maxForce;varn=newe(a,b,-m,m);this.equations=[n],this.maxForce=m;varl=f.create(),o=f.create(),p=f.create(),q=this;n.computeGq=function(){vara=this.bodyA,b=this.bodyB,c=a.position,d=b.position;returnf.rotate(o,h,a.angle),f.rotate(p,i,b.angle),f.add(l,d,p),f.sub(l,l,o),f.sub(l,l,c),f.length(l)-q.distance},this.setMaxForce(m),this.upperLimitEnabled=!1,this.upperLimit=1,this.lowerLimitEnabled=!1,this.lowerLimit=0,this.position=0}vard=(a("__browserify_process"),a("__browserify_Buffer"),a("./Constraint")),e=a("../equations/Equation"),f=a("../math/vec2"),g=a("../utils/Utils");b.exports=c,c.prototype=newd;varh=f.create(),i=f.create(),j=f.create();c.prototype.update=function(){vara=this.equations[0],b=this.bodyA,c=this.bodyB,d=(this.dist