!function(a){if("object"==typeofexports)module.exports=a();elseif("function"==typeofdefine,1){varb;"undefined"!=typeofwindow?b=window:"undefined"!=typeofglobal?b=global:"undefined"!=typeofself&&(b=self),b.p2=a()}elsedefine(a)}(function(){returnfunctiona(b,c,d){functione(g,h){if(!c[g]){if(!b[g]){vari="function"==typeofrequire&&require;if(!h&&i)returni(g,!0);if(f)returnf(g,!0);thrownewError("Cannot find module '"+g+"'")}varj=c[g]={exports:{}};b[g][0].call(j.exports,function(a){varc=b[g][1][a];returne(c?c:a)},j,j.exports,a,b,c,d)}returnc[g].exports}for(varf="function"==typeofrequire&&require,g=0;g<d.length;g++)e(d[g]);returne}({1:[function(a,b,c){functiond(){}vare=a("./Scalar");b.exports=d,d.lineInt=function(a,b,c){c=c||0;vard,f,g,h,i,j,k,l=[0,0];returnd=a[1][1]-a[0][1],f=a[0][0]-a[1][0],g=d*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=d*i-h*f,e.eq(k,0,c)||(l[0]=(i*g-f*j)/k,l[1]=(d*j-h*g)/k),l},d.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":4}],2:[function(a,b,c){functiond(){}b.exports=d,d.area=function(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])},d.left=function(a,b,c){returnd.area(a,b,c)>0},d.leftOn=function(a,b,c){returnd.area(a,b,c)>=0},d.right=function(a,b,c){returnd.area(a,b,c)<0},d.rightOn=function(a,b,c){returnd.area(a,b,c)<=0};vare=[],f=[];d.collinear=function(a,b,c,g){if(g){varh=e,i=f;h[0]=b[0]-a[0],h[1]=b[1]-a[1],i[0]=c[0]-b[0],i[1]=c[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==d.area(a,b,c)},d.sqdist=function(a,b){varc=b[0]-a[0],d=b[1]-a[1];returnc*c+d*d}},{}],3:[function(a,b,c){functiond(){this.vertices=[]}functione(a,b,c,d,e){e=e||0;varf=b[1]-a[1],g=a[0]-b[0],i=f*a[0]+g*a[1],j=d[1]-c[1],k=c[0]-d[0],l=j*c[0]+k*c[1],m=f*k-j*g;returnh.eq(m,0,e)?[0,0]:[(k*i-g*l)/m,(f*l-j*i)/m]}varf=a("./Line"),g=a("./Point"),h=a("./Scalar");b.exports=d,d.prototype.at=function(a){varb=this.vertices,c=b.length;returnb[0>a?a%c+c:a%c]},d.prototype.first=function(){returnthis.vertices[0]},d.prototype.last=function(){returnthis.vertices[this.vertices.length-1]},d.prototype.clear=function(){this.vertices.length=0},d.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])},d.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);g.left(this.at(a-1),this.at(a),this.at(a+1))||this.reverse()},d.prototype.reverse=function(){for(vara=[],b=0,c=this.vertices.length;b!==c;b++)a.push(this.vertices.pop());this.vertices=a},d.prototype.isReflex=function(a){returng.right(this.at(a-1),this.at(a),this.at(a+1))};vari=[],j=[];d.prototype.canSee=function(a,b){varc,d,e=i,h=j;if(g.leftOn(this.at(a+1),this.at(a),this.at(b))&&g.rightOn(this.at(a-1),this.at(a),this.at(b)))return!1;d=g.sqdist(this.at(a),this.at(b));for(vark=0;k!==this.vertices.length;++k)if((k+1)%this.vertices.length!==a&&k!==a&&g.leftOn(this.at(a),this.at(b),this.at(k+1))&&g.rightOn(this.at(a),this.at(b),this.at(k))&&(e[0]=this.at(a),e[1]=this.at(b),h[0]=this.at(k),h[1]=this.at(k+1),c=f.lineInt(e,h),g.sqdist(this.at(a),c)<d))return!1;return!0},d.prototype.copy=function(a,b,c){vare=c||newd;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},d.prototype.getCutEdges=function(){for(vara=[],b=[],c=[],e=newd,f=Number.MAX_VALUE,g=0;g<this.vertices.length;++g)if(this.isReflex(g))for(varh=0;h<thi
this.allowSleep=void0!==a.allowSleep?a.allowSleep:!0,this.wantsToSleep=!1,this.sleepState=d.AWAKE,this.sleepSpeedLimit=void0!==a.sleepSpeedLimit?a.sleepSpeedLimit:.2,this.sleepTimeLimit=void0!==a.sleepTimeLimit?a.sleepTimeLimit:1,this.gravityScale=void0!==a.gravityScale?a.gravityScale:1,this.collisionResponse=void0!==a.collisionResponse?a.collisionResponse:!0,this.idleTime=0,this.timeLastSleepy=0,this.ccdSpeedThreshold=void0!==a.ccdSpeedThreshold?a.ccdSpeedThreshold:-1,this.ccdIterations=void0!==a.ccdIterations?a.ccdIterations:10,this.concavePath=null,this._wakeUpAfterNarrowphase=!1,this.updateMassProperties()}vare=a("../math/vec2"),f=a("poly-decomp"),g=a("../shapes/Convex"),h=a("../collision/RaycastResult"),i=a("../collision/Ray"),j=a("../collision/AABB"),k=a("../events/EventEmitter");b.exports=d,d.prototype=newk,d.prototype.constructor=d,d._idCounter=0,d.prototype.updateSolveMassProperties=function(){this.sleepState===d.SLEEPING||this.type===d.KINEMATIC?(this.invMassSolve=0,this.invInertiaSolve=0):(this.invMassSolve=this.invMass,this.invInertiaSolve=this.invInertia)},d.prototype.setDensity=function(a){varb=this.getArea();this.mass=b*a,this.updateMassProperties()},d.prototype.getArea=function(){for(vara=0,b=0;b<this.shapes.length;b++)a+=this.shapes[b].area;returna},d.prototype.getAABB=function(){returnthis.aabbNeedsUpdate&&this.updateAABB(),this.aabb};varl=newj,m=e.create();d.prototype.updateAABB=function(){for(vara=this.shapes,b=a.length,c=m,d=this.angle,f=0;f!==b;f++){varg=a[f],h=g.angle+d;e.rotate(c,g.position,d),e.add(c,c,this.position),g.computeAABB(l,c,h),0===f?this.aabb.copy(l):this.aabb.extend(l)}this.aabbNeedsUpdate=!1},d.prototype.updateBoundingRadius=function(){for(vara=this.shapes,b=a.length,c=0,d=0;d!==b;d++){varf=a[d],g=e.length(f.position),h=f.boundingRadius;g+h>c&&(c=g+h)}this.boundingRadius=c},d.prototype.addShape=function(a,b,c){if(a.body)thrownewError("A shape can only be added to one body.");a.body=this,b?e.copy(a.position,b):e.set(a.position,0,0),a.angle=c||0,this.shapes.push(a),this.updateMassProperties(),this.updateBoundingRadius(),this.aabbNeedsUpdate=!0},d.prototype.removeShape=function(a){varb=this.shapes.indexOf(a);return-1!==b?(this.shapes.splice(b,1),this.aabbNeedsUpdate=!0,a.body=null,!0):!1},d.prototype.updateMassProperties=function(){if(this.type===d.STATIC||this.type===d.KINEMATIC)this.mass=Number.MAX_VALUE,this.invMass=0,this.inertia=Number.MAX_VALUE,this.invInertia=0;else{vara=this.shapes,b=a.length,c=this.mass/b,f=0;if(this.fixedRotation)this.inertia=Number.MAX_VALUE,this.invInertia=0;else{for(varg=0;b>g;g++){varh=a[g],i=e.squaredLength(h.position),j=h.computeMomentOfInertia(c);f+=j+c*i}this.inertia=f,this.invInertia=f>0?1/f:0}this.invMass=1/this.mass,e.set(this.massMultiplier,this.fixedX?0:1,this.fixedY?0:1)}};e.create();d.prototype.applyForce=function(a,b){if(e.add(this.force,this.force,a),b){varc=e.crossLength(b,a);this.angularForce+=c}};varn=e.create(),o=e.create(),p=e.create();d.prototype.applyForceLocal=function(a,b){b=b||p;varc=n,d=o;this.vectorToWorldFrame(c,a),this.vectorToWorldFrame(d,b),this.applyForce(c,d)};varq=e.create();d.prototype.applyImpulse=function(a,b){if(this.type===d.DYNAMIC){varc=q;if(e.scale(c,a,this.invMass),e.multiply(c,this.massMultiplier,c),e.add(this.velocity,c,this.velocity),b){varf=e.crossLength(b,a);f*=this.invInertia,this.angularVelocity+=f}}};varr=e.create(),s=e.create(),t=e.create();d.prototype.applyImpulseLocal=function(a,b){b=b||t;varc=r,d=s;this.vectorToWorldFrame(c,a),this.vectorToWorldFrame(d,b),this.applyImpulse(c,d)},d.prototype.toLocalFrame=function(a,b){e.toLocalFrame(a,b,this.position,this.angle)},d.prototype.toWorldFrame=function(a,b){e.toGlobalFrame(a,b,this.position,this.angle)},d.prototype.vectorToLocalFrame=function(a,b){e.vectorToLocalFrame(a,b,this.angle)},d.prototype.vectorToWorldFrame=function(a,b){e.vectorToGlobalFrame(a,b,this.angle)},d.prototype.fromPolygon=function(a,b){b=b||{};for(varc=this.shapes.length;c>=0;--c)this.removeShape(this.shapes[c]);vard=newf.Polygon;if(d.vertices=a,d.makeCCW(
}functione(a){for(varb=a.length;b--;)a[b]=0}varf=a("../math/vec2"),g=a("./Solver"),h=a("../utils/Utils"),i=a("../equations/FrictionEquation");b.exports=d,d.prototype=newg,d.prototype.constructor=d,d.prototype.solve=function(a,b){this.sortEquations();varc=0,g=this.iterations,j=this.frictionIterations,k=this.equations,l=k.length,m=Math.pow(this.tolerance*l,2),n=b.bodies,o=b.bodies.length,p=(f.add,f.set,this.useZeroRHS),q=this.lambda;if(this.usedIterations=0,l)for(varr=0;r!==o;r++){vars=n[r];s.updateSolveMassProperties()}q.length<l&&(q=this.lambda=newh.ARRAY_TYPE(l+this.arrayStep),this.Bs=newh.ARRAY_TYPE(l+this.arrayStep),this.invCs=newh.ARRAY_TYPE(l+this.arrayStep)),e(q);for(vart=this.invCs,u=this.Bs,q=this.lambda,r=0;r!==k.length;r++){varv=k[r];(v.timeStep!==a||v.needsUpdate)&&(v.timeStep=a,v.update()),u[r]=v.computeB(v.a,v.b,a),t[r]=v.computeInvC(v.epsilon)}varv,w,r,x;if(0!==l){for(r=0;r!==o;r++){vars=n[r];s.resetConstraintVelocity()}if(j){for(c=0;c!==j;c++){for(w=0,x=0;x!==l;x++){v=k[x];vary=d.iterateEquation(x,v,v.epsilon,u,t,q,p,a,c);w+=Math.abs(y)}if(this.usedIterations++,m>=w*w)break}for(d.updateMultipliers(k,q,1/a),x=0;x!==l;x++){varz=k[x];if(zinstanceofi){for(varA=0,B=0;B!==z.contactEquations.length;B++)A+=z.contactEquations[B].multiplier;A*=z.frictionCoefficient/z.contactEquations.length,z.maxForce=A,z.minForce=-A}}}for(c=0;c!==g;c++){for(w=0,x=0;x!==l;x++){v=k[x];vary=d.iterateEquation(x,v,v.epsilon,u,t,q,p,a,c);w+=Math.abs(y)}if(this.usedIterations++,m>=w*w)break}for(r=0;r!==o;r++)n[r].addConstraintVelocity();d.updateMultipliers(k,q,1/a)}},d.updateMultipliers=function(a,b,c){for(vard=a.length;d--;)a[d].multiplier=b[d]*c},d.iterateEquation=function(a,b,c,d,e,f,g,h,i){varj=d[a],k=e[a],l=f[a],m=b.computeGWlambda(),n=b.maxForce,o=b.minForce;g&&(j=0);varp=k*(j-m-c*l),q=l+p;returno*h>q?p=o*h-l:q>n*h&&(p=n*h-l),f[a]+=p,b.addToWlambda(p),p}},{"../equations/FrictionEquation":23,"../math/vec2":30,"../utils/Utils":57,"./Solver":47}],47:[function(a,b,c){functiond(a,b){a=a||{},e.call(this),this.type=b,this.equations=[],this.equationSortFunction=a.equationSortFunction||!1}vare=(a("../utils/Utils"),a("../events/EventEmitter"));b.exports=d,d.prototype=newe,d.prototype.constructor=d,d.prototype.solve=function(a,b){thrownewError("Solver.solve should be implemented by subclasses!")};varf={bodies:[]};d.prototype.solveIsland=function(a,b){this.removeAllEquations(),b.equations.length&&(this.addEquations(b.equations),f.bodies.length=0,b.getBodies(f.bodies),f.bodies.length&&this.solve(a,f))},d.prototype.sortEquations=function(){this.equationSortFunction&&this.equations.sort(this.equationSortFunction)},d.prototype.addEquation=function(a){a.enabled&&this.equations.push(a)},d.prototype.addEquations=function(a){for(varb=0,c=a.length;b!==c;b++){vard=a[b];d.enabled&&this.equations.push(d)}},d.prototype.removeEquation=function(a){varb=this.equations.indexOf(a);-1!==b&&this.equations.splice(b,1)},d.prototype.removeAllEquations=function(){this.equations.length=0},d.GS=1,d.ISLAND=2},{"../events/EventEmitter":26,"../utils/Utils":57}],48:[function(a,b,c){functiond(){f.apply(this,arguments)}vare=a("../equations/ContactEquation"),f=a("./Pool");b.exports=d,d.prototype=newf,d.prototype.constructor=d,d.prototype.create=function(){returnnewe},d.prototype.destroy=function(a){returna.bodyA=a.bodyB=null,this}},{"../equations/ContactEquation":21,"./Pool":55}],49:[function(a,b,c){functiond(){f.apply(this,arguments)}vare=a("../equations/FrictionEquation"),f=a("./Pool");b.exports=d,d.prototype=newf,d.prototype.constructor=d,d.prototype.create=function(){returnnewe},d.prototype.destroy=function(a){returna.bodyA=a.bodyB=null,this}},{"../equations/FrictionEquation":23,"./Pool":55}],50:[function(a,b,c){functiond(){f.apply(this,arguments)}vare=a("../world/IslandNode"),f=a("./Pool");b.exports=d,d.prototype=newf,d.prototype.constructor=d,d.prototype.create=function(){returnnewe},d.prototype.destroy=function(a){returna.reset(),this}},{"../world/IslandNode":60,"./Pool":55}],51:[function(a,b,c){functiond(){f.apply(th
returnb},b.DisplayObjectContainer.prototype.setChildIndex=function(a,b){if(0>b||b>=this.children.length)thrownewError("The supplied index is out of bounds");varc=this.getChildIndex(a);this.children.splice(c,1),this.children.splice(b,0,a)},b.DisplayObjectContainer.prototype.getChildAt=function(a){if(0>a||a>=this.children.length)thrownewError("getChildAt: Supplied index "+a+" does not exist in the child list, or the supplied DisplayObject must be a child of the caller");returnthis.children[a]},b.DisplayObjectContainer.prototype.removeChild=function(a){varb=this.children.indexOf(a);if(-1!==b)returnthis.removeChildAt(b)},b.DisplayObjectContainer.prototype.removeChildAt=function(a){varb=this.getChildAt(a);returnthis.stage&&b.removeStageReference(),b.parent=void0,this.children.splice(a,1),b},b.DisplayObjectContainer.prototype.removeChildren=function(a,b){varc=a||0,d="number"==typeofb?b:this.children.length,e=d-c;if(e>0&&d>=e){for(varf=this.children.splice(c,e),g=0;g<f.length;g++){varh=f[g];this.stage&&h.removeStageReference(),h.parent=void0}returnf}if(0===e&&0===this.children.length)return[];thrownewError("removeChildren: Range Error, numeric values are outside the acceptable range")},b.DisplayObjectContainer.prototype.updateTransform=function(){if(this.visible&&(this.displayObjectUpdateTransform(),!this._cacheAsBitmap))for(vara=0;a<this.children.length;a++)this.children[a].updateTransform()},b.DisplayObjectContainer.prototype.displayObjectContainerUpdateTransform=b.DisplayObjectContainer.prototype.updateTransform,b.DisplayObjectContainer.prototype.getBounds=function(){if(0===this.children.length)returnb.EmptyRectangle;for(vara,c,d,e=1/0,f=1/0,g=-(1/0),h=-(1/0),i=!1,j=0,k=this.children.length;k>j;j++){varl=this.children[j];l.visible&&(i=!0,a=this.children[j].getBounds(),e=e<a.x?e:a.x,f=f<a.y?f:a.y,c=a.width+a.x,d=a.height+a.y,g=g>c?g:c,h=h>d?h:d)}if(!i)returnb.EmptyRectangle;varm=this._bounds;returnm.x=e,m.y=f,m.width=g-e,m.height=h-f,m},b.DisplayObjectContainer.prototype.getLocalBounds=function(){vara=this.worldTransform;this.worldTransform=b.identityMatrix;for(varc=0,d=this.children.length;d>c;c++)this.children[c].updateTransform();vare=this.getBounds();returnthis.worldTransform=a,e},b.DisplayObjectContainer.prototype.setStageReference=function(a){this.stage=a;for(varb=0;b<this.children.length;b++)this.children[b].setStageReference(a)},b.DisplayObjectContainer.prototype.removeStageReference=function(){for(vara=0;a<this.children.length;a++)this.children[a].removeStageReference();this.stage=null},b.DisplayObjectContainer.prototype._renderWebGL=function(a){if(this.visible&&!(this.alpha<=0)){if(this._cacheAsBitmap)returnvoidthis._renderCachedSprite(a);varb;if(this._mask||this._filters){for(this._filters&&(a.spriteBatch.flush(),a.filterManager.pushFilter(this._filterBlock)),this._mask&&(a.spriteBatch.stop(),a.maskManager.pushMask(this.mask,a),a.spriteBatch.start()),b=0;b<this.children.length;b++)this.children[b]._renderWebGL(a);a.spriteBatch.stop(),this._mask&&a.maskManager.popMask(this._mask,a),this._filters&&a.filterManager.popFilter(),a.spriteBatch.start()}elsefor(b=0;b<this.children.length;b++)this.children[b]._renderWebGL(a)}},b.DisplayObjectContainer.prototype._renderCanvas=function(a){if(this.visible!==!1&&0!==this.alpha){if(this._cacheAsBitmap)returnvoidthis._renderCachedSprite(a);this._mask&&a.maskManager.pushMask(this._mask,a);for(varb=0;b<this.children.length;b++)this.children[b]._renderCanvas(a);this._mask&&a.maskManager.popMask(a)}},b.Sprite=function(a){b.DisplayObjectContainer.call(this),this.anchor=newb.Point,this.texture=a||b.Texture.emptyTexture,this._width=0,this._height=0,this.tint=16777215,this.cachedTint=-1,this.tintedTexture=null,this.blendMode=b.blendModes.NORMAL,this.shader=null,this.texture.baseTexture.hasLoaded&&this.onTextureUpdate(),this.renderable=!0},b.Sprite.prototype=Object.create(b.DisplayObjectContainer.prototype),b.Sprite.prototype.constructor=b.Sprite,Object.defineProperty(b.Sprite.prototype,"width",{get:function(){returnthis.scale.x*this.texture.frame
this},set:function(a,b){returnthis.x=a||0,this.y=b||(0!==b?this.x:0),this},add:function(a,b){returnthis.x+=a,this.y+=b,this},subtract:function(a,b){returnthis.x-=a,this.y-=b,this},multiply:function(a,b){returnthis.x*=a,this.y*=b,this},divide:function(a,b){returnthis.x/=a,this.y/=b,this},clampX:function(a,b){returnthis.x=c.Math.clamp(this.x,a,b),this},clampY:function(a,b){returnthis.y=c.Math.clamp(this.y,a,b),this},clamp:function(a,b){returnthis.x=c.Math.clamp(this.x,a,b),this.y=c.Math.clamp(this.y,a,b),this},clone:function(a){returnvoid0===a||null===a?a=newc.Point(this.x,this.y):a.setTo(this.x,this.y),a},copyTo:function(a){returna.x=this.x,a.y=this.y,a},distance:function(a,b){returnc.Point.distance(this,a,b)},equals:function(a){returna.x===this.x&&a.y===this.y},angle:function(a,b){returnvoid0===b&&(b=!1),b?c.Math.radToDeg(Math.atan2(a.y-this.y,a.x-this.x)):Math.atan2(a.y-this.y,a.x-this.x)},rotate:function(a,b,d,e,f){returnc.Point.rotate(this,a,b,d,e,f)},getMagnitude:function(){returnMath.sqrt(this.x*this.x+this.y*this.y)},getMagnitudeSq:function(){returnthis.x*this.x+this.y*this.y},setMagnitude:function(a){returnthis.normalize().multiply(a,a)},normalize:function(){if(!this.isZero()){vara=this.getMagnitude();this.x/=a,this.y/=a}returnthis},isZero:function(){return0===this.x&&0===this.y},dot:function(a){returnthis.x*a.x+this.y*a.y},cross:function(a){returnthis.x*a.y-this.y*a.x},perp:function(){returnthis.setTo(-this.y,this.x)},rperp:function(){returnthis.setTo(this.y,-this.x)},normalRightHand:function(){returnthis.setTo(-1*this.y,this.x)},floor:function(){returnthis.setTo(Math.floor(this.x),Math.floor(this.y))},ceil:function(){returnthis.setTo(Math.ceil(this.x),Math.ceil(this.y))},toString:function(){return"[{Point (x="+this.x+" y="+this.y+")}]"}},c.Point.prototype.constructor=c.Point,c.Point.add=function(a,b,d){returnvoid0===d&&(d=newc.Point),d.x=a.x+b.x,d.y=a.y+b.y,d},c.Point.subtract=function(a,b,d){returnvoid0===d&&(d=newc.Point),d.x=a.x-b.x,d.y=a.y-b.y,d},c.Point.multiply=function(a,b,d){returnvoid0===d&&(d=newc.Point),d.x=a.x*b.x,d.y=a.y*b.y,d},c.Point.divide=function(a,b,d){returnvoid0===d&&(d=newc.Point),d.x=a.x/b.x,d.y=a.y/b.y,d},c.Point.equals=function(a,b){returna.x===b.x&&a.y===b.y},c.Point.angle=function(a,b){returnMath.atan2(a.y-b.y,a.x-b.x)},c.Point.negative=function(a,b){returnvoid0===b&&(b=newc.Point),b.setTo(-a.x,-a.y)},c.Point.multiplyAdd=function(a,b,d,e){returnvoid0===e&&(e=newc.Point),e.setTo(a.x+b.x*d,a.y+b.y*d)},c.Point.interpolate=function(a,b,d,e){returnvoid0===e&&(e=newc.Point),e.setTo(a.x+(b.x-a.x)*d,a.y+(b.y-a.y)*d)},c.Point.perp=function(a,b){returnvoid0===b&&(b=newc.Point),b.setTo(-a.y,a.x)},c.Point.rperp=function(a,b){returnvoid0===b&&(b=newc.Point),b.setTo(a.y,-a.x)},c.Point.distance=function(a,b,d){vare=c.Math.distance(a.x,a.y,b.x,b.y);returnd?Math.round(e):e},c.Point.project=function(a,b,d){void0===d&&(d=newc.Point);vare=a.dot(b)/b.getMagnitudeSq();return0!==e&&d.setTo(e*b.x,e*b.y),d},c.Point.projectUnit=function(a,b,d){void0===d&&(d=newc.Point);vare=a.dot(b);return0!==e&&d.setTo(e*b.x,e*b.y),d},c.Point.normalRightHand=function(a,b){returnvoid0===b&&(b=newc.Point),b.setTo(-1*a.y,a.x)},c.Point.normalize=function(a,b){void0===b&&(b=newc.Point);vard=a.getMagnitude();return0!==d&&b.setTo(a.x/d,a.y/d),b},c.Point.rotate=function(a,b,d,e,f,g){if(f&&(e=c.Math.degToRad(e)),void0===g){a.subtract(b,d);varh=Math.sin(e),i=Math.cos(e),j=i*a.x-h*a.y,k=h*a.x+i*a.y;a.x=j+b,a.y=k+d}else{varl=e+Math.atan2(a.y-d,a.x-b);a.x=b+g*Math.cos(l),a.y=d+g*Math.sin(l)}returna},c.Point.centroid=function(a,b){if(void0===b&&(b=newc.Point),"[object Array]"!==Object.prototype.toString.call(a))thrownewError("Phaser.Point. Parameter 'points' must be an array");vard=a.length;if(1>d)thrownewError("Phaser.Point. Parameter 'points' array must not be empty");if(1===d)returnb.copyFrom(a[0]),b;for(vare=0;d>e;e++)c.Point.add(b,a[e],b);returnb.divide(d,d),b},c.Point.parse=function(a,b,d){b=b||"x",d=d||"y";vare=newc.Point;returna[b]&&(e.x=pa
this.interactiveItems=newc.ArraySet,this._localPoint=newc.Point,this._pollCounter=0,this._oldPosition=null,this._x=0,this._y=0},c.Input.MOUSE_OVERRIDES_TOUCH=0,c.Input.TOUCH_OVERRIDES_MOUSE=1,c.Input.MOUSE_TOUCH_COMBINE=2,c.Input.MAX_POINTERS=10,c.Input.prototype={boot:function(){this.mousePointer=newc.Pointer(this.game,0,c.PointerMode.CURSOR),this.addPointer(),this.addPointer(),this.mouse=newc.Mouse(this.game),this.touch=newc.Touch(this.game),this.mspointer=newc.MSPointer(this.game),c.Keyboard&&(this.keyboard=newc.Keyboard(this.game)),c.Gamepad&&(this.gamepad=newc.Gamepad(this.game)),this.onDown=newc.Signal,this.onUp=newc.Signal,this.onTap=newc.Signal,this.onHold=newc.Signal,this.scale=newc.Point(1,1),this.speed=newc.Point,this.position=newc.Point,this._oldPosition=newc.Point,this.circle=newc.Circle(0,0,44),this.activePointer=this.mousePointer,this.hitCanvas=PIXI.CanvasPool.create(this,1,1),this.hitContext=this.hitCanvas.getContext("2d"),this.mouse.start(),this.touch.start(),this.mspointer.start(),this.mousePointer.active=!0,this.keyboard&&this.keyboard.start();vara=this;this._onClickTrampoline=function(b){a.onClickTrampoline(b)},this.game.canvas.addEventListener("click",this._onClickTrampoline,!1)},destroy:function(){this.mouse.stop(),this.touch.stop(),this.mspointer.stop(),this.keyboard&&this.keyboard.stop(),this.gamepad&&this.gamepad.stop(),this.moveCallbacks=[],PIXI.CanvasPool.remove(this),this.game.canvas.removeEventListener("click",this._onClickTrampoline)},addMoveCallback:function(a,b){this.moveCallbacks.push({callback:a,context:b})},deleteMoveCallback:function(a,b){for(varc=this.moveCallbacks.length;c--;)if(this.moveCallbacks[c].callback===a&&this.moveCallbacks[c].context===b)returnvoidthis.moveCallbacks.splice(c,1)},addPointer:function(){if(this.pointers.length>=c.Input.MAX_POINTERS)returnconsole.warn("Phaser.Input.addPointer: Maximum limit of "+c.Input.MAX_POINTERS+" pointers reached."),null;vara=this.pointers.length+1,b=newc.Pointer(this.game,a,c.PointerMode.TOUCH);returnthis.pointers.push(b),this["pointer"+a]=b,b},update:function(){if(this.keyboard&&this.keyboard.update(),this.pollRate>0&&this._pollCounter<this.pollRate)returnvoidthis._pollCounter++;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.gamepad&&this.gamepad.active&&this.gamepad.update();for(vara=0;a<this.pointers.length;a++)this.pointers[a].update();this._pollCounter=0},reset:function(a){if(this.game.isBooted&&!this.resetLocked){void0===a&&(a=!1),this.mousePointer.reset(),this.keyboard&&this.keyboard.reset(a),this.gamepad&&this.gamepad.reset();for(varb=0;b<this.pointers.length;b++)this.pointers[b].reset();"none"!==this.game.canvas.style.cursor&&(this.game.canvas.style.cursor="inherit"),a&&(this.onDown.dispose(),this.onUp.dispose(),this.onTap.dispose(),this.onHold.dispose(),this.onDown=newc.Signal,this.onUp=newc.Signal,this.onTap=newc.Signal,this.onHold=newc.Signal,this.moveCallbacks=[]),this._pollCounter=0}},resetSpeed:function(a,b){this._oldPosition.setTo(a,b),this.speed.setTo(0,0)},startPointer:function(a){if(this.maxPointers>=0&&this.countActivePointers(this.maxPointers)>=this.maxPointers)returnnull;if(!this.pointer1.active)returnthis.pointer1.start(a);if(!this.pointer2.active)returnthis.pointer2.start(a);for(varb=2;b<this.pointers.length;b++){varc=this.pointers[b];if(!c.active)returnc.start(a)}returnnull},updatePointer:function(a){if(this.pointer1.active&&this.pointer1.identifier===a.identifier)returnthis.pointer1.move(a);if(this.pointer2.active&&this.pointer2.identifier===a.identifier)returnthis.pointer2.move(a);for(varb=2;b<this.pointers.length;b++){varc=this.pointers[b];if(c.active&&c.identifier===a.identifier)returnc.move(a)}returnnull},stopPointer:function(a){if(this.pointer1.active&&this.pointer1.identifier===a.identifier)returnthis.pointer1.stop(a);if(this.pointer2.active&&this.pointer2.identifier===a.identifier)returnthis.pointer2.stop(a);for(varb=2;b<this.pointer
null===this.snapshot?voidconsole.warn("Video.grab cannot run because Phaser.BitmapData is unavailable"):(a&&this.snapshot.cls(),this.snapshot.copy(this.video,0,0,this.width,this.height,0,0,this.width,this.height,0,0,0,1,1,b,c),this.snapshot)},removeVideoElement:function(){if(this.video){for(this.video.parentNode&&this.video.parentNode.removeChild(this.video);this.video.hasChildNodes();)this.video.removeChild(this.video.firstChild);this.video.removeAttribute("autoplay"),this.video.removeAttribute("src"),this.video=null}},destroy:function(){this.stop(),this.removeVideoElement(),this.touchLocked&&this.game.input.touch.removeTouchLockCallback(this.unlock,this),this._retryID&&window.clearTimeout(this._retryID)}},Object.defineProperty(c.Video.prototype,"currentTime",{get:function(){returnthis.video?this.video.currentTime:0},set:function(a){this.video.currentTime=a}}),Object.defineProperty(c.Video.prototype,"duration",{get:function(){returnthis.video?this.video.duration:0}}),Object.defineProperty(c.Video.prototype,"progress",{get:function(){returnthis.video?this.video.currentTime/this.video.duration:0}}),Object.defineProperty(c.Video.prototype,"mute",{get:function(){returnthis._muted},set:function(a){if(a=a||null){if(this._muted)return;this._codeMuted=!0,this.setMute()}else{if(!this._muted)return;this._codeMuted=!1,this.unsetMute()}}}),Object.defineProperty(c.Video.prototype,"paused",{get:function(){returnthis._paused},set:function(a){if(a=a||null,!this.touchLocked)if(a){if(this._paused)return;this._codePaused=!0,this.setPause()}else{if(!this._paused)return;this._codePaused=!1,this.setResume()}}}),Object.defineProperty(c.Video.prototype,"volume",{get:function(){returnthis.video?this.video.volume:1},set:function(a){0>a?a=0:a>1&&(a=1),this.video&&(this.video.volume=a)}}),Object.defineProperty(c.Video.prototype,"playbackRate",{get:function(){returnthis.video?this.video.playbackRate:1},set:function(a){this.video&&(this.video.playbackRate=a)}}),Object.defineProperty(c.Video.prototype,"loop",{get:function(){returnthis.video?this.video.loop:!1},set:function(a){a&&this.video?this.video.loop="loop":this.video&&(this.video.loop="")}}),Object.defineProperty(c.Video.prototype,"playing",{get:function(){return!(this.video.paused&&this.video.ended)}}),c.Video.prototype.constructor=c.Video,void0===PIXI.blendModes&&(PIXI.blendModes=c.blendModes),void0===PIXI.scaleModes&&(PIXI.scaleModes=c.scaleModes),void0===PIXI.Texture.emptyTexture&&(PIXI.Texture.emptyTexture=newPIXI.Texture(newPIXI.BaseTexture)),void0===PIXI.DisplayObject._tempMatrix&&(PIXI.DisplayObject._tempMatrix=newPIXI.Matrix),void0===PIXI.RenderTexture.tempMatrix&&(PIXI.RenderTexture.tempMatrix=newPIXI.Matrix),PIXI.Graphics&&void0===PIXI.Graphics.POLY&&(PIXI.Graphics.POLY=c.POLYGON,PIXI.Graphics.RECT=c.RECTANGLE,PIXI.Graphics.CIRC=c.CIRCLE,PIXI.Graphics.ELIP=c.ELLIPSE,PIXI.Graphics.RREC=c.ROUNDEDRECTANGLE),PIXI.TextureSilentFail=!0,"undefined"!=typeofexports?("undefined"!=typeofmodule&&module.exports&&(exports=module.exports=c),exports.Phaser=c):"undefined"!=typeofdefine&&define.amd?define("Phaser",function(){returnb.Phaser=c}()):b.Phaser=c,c}.call(this);