Add-N
"),r.push(""),r.push("");var h=[r.join("\n")],a=this;try{var n=new window.Blob(h,{type:"image/svg+xml;charset=utf-8"})}catch(o){return a.state=t.FILE_ERRORED,void a.onProcessComplete()}this.data=new Image,this.data.crossOrigin=this.crossOrigin,this.data.onload=function(){i.revokeObjectURL(a.data),a.onProcessComplete()},this.data.onerror=function(){i.revokeObjectURL(a.data),a.onProcessError()},i.createObjectURL(this.data,n,"image/svg+xml")},addToCache:function(){var e=this.cache.addImage(this.key,this.data);this.pendingDestroy(e)}});s.register("htmlTexture",function(e,t,i,s,r){if(Array.isArray(e))for(var h=0;h0},isLoading:function(){return this.state===s.LOADER_LOADING||this.state===s.LOADER_PROCESSING},isReady:function(){return this.state===s.LOADER_IDLE||this.state===s.LOADER_COMPLETE},start:function(){this.isReady()&&(this.progress=0,this.totalFailed=0,this.totalComplete=0,this.totalToLoad=this.list.size,this.emit(h.START,this),0===this.list.size?this.loadComplete():(this.state=s.LOADER_LOADING,this.inflight.clear(),this.queue.clear(),this.updateProgress(),this.checkLoadQueue(),this.systems.events.on(o.UPDATE,this.update,this)))},updateProgress:function(){this.progress=1-(this.list.size+this.inflight.size)/this.totalToLoad,this.emit(h.PROGRESS,this.progress)},update:function(){this.state===s.LOADER_LOADING&&this.list.size>0&&this.inflight.size0&&t>e&&(t=e)),0!==h&&0!==s&&(s<0&&s<-h?s=-h:s>0&&s>h&&(s=h)),this.gameObject.x+=t,this.gameObject.y+=s}t<0?this.facing=i.FACING_LEFT:t>0&&(this.facing=i.FACING_RIGHT),s<0?this.facing=i.FACING_UP:s>0&&(this.facing=i.FACING_DOWN),this.allowRotation&&(this.gameObject.angle+=this.deltaZ()),this._tx=t,this._ty=s},setBoundsRectangle:function(t){return this.customBoundsRectangle=t||this.world.bounds,this},checkWorldBounds:function(){var t=this.position,i=this.customBoundsRectangle,s=this.world.checkCollision,e=this.worldBounce?-this.worldBounce.x:-this.bounce.x,h=this.worldBounce?-this.worldBounce.y:-this.bounce.y,o=!1;return t.xi.right&&s.right&&(t.x=i.right-this.width,this.velocity.x*=e,this.blocked.right=!0,o=!0),t.yi.bottom&&s.down&&(t.y=i.bottom-this.height,this.velocity.y*=h,this.blocked.down=!0,o=!0),o&&(this.blocked.none=!1),o},setOffset:function(t,i){return void 0===i&&(i=t),this.offset.set(t,i),this.updateCenter(),this},setSize:function(t,i,s){void 0===s&&(s=!0);var e=this.gameObject;if(!t&&e.frame&&(t=e.frame.realWidth),!i&&e.frame&&(i=e.frame.realHeight),this.sourceWidth=t,this.sourceHeight=i,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.updateCenter(),s&&e.getCenter){var h=e.displayWidth/2,o=e.displayHeight/2;this.offset.set(h-this.halfWidth,o-this.halfHeight)}return this.isCircle=!1,this.radius=0,this},setCircle:function(t,i,s){return void 0===i&&(i=this.offset.x),void 0===s&&(s=this.offset.y),t>0?(this.isCircle=!0,this.radius=t,this.sourceWidth=2*t,this.sourceHeight=2*t,this.width=this.sourceWidth*this._sx,this.height=this.sourceHeight*this._sy,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(i,s),this.updateCenter()):this.isCircle=!1,this},reset:function(t,i){this.stop();var s=this.gameObject;s.setPosition(t,i),s.getTopLeft?s.getTopLeft(this.position):this.position.set(t,i),this.prev.copy(this.position),this.prevFrame.copy(this.position),this.rotation=s.angle,this.preRotation=s.angle,this.updateBounds(),this.updateCenter()},stop:function(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(t,i){return this.isCircle?this.radius>0&&t>=this.left&&t<=this.right&&i>=this.top&&i<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-i)*(this.center.y-i)<=this.radius*this.radius:o(this,t,i)},onFloor:function(){return this.blocked.down},onCeiling:function(){return this.blocked.up},onWall:function(){return this.blocked.left||this.blocked.right},deltaAbsX:function(){return this._dx>0?this._dx:-this._dx},deltaAbsY:function(){return this._dy>0?this._dy:-this._dy},deltaX:function(){return this._dx},deltaY:function(){return this._dy},deltaXFinal:function(){return this._tx},deltaYFinal:function(){return this._ty},deltaZ:function(){return this.rotation-this.preRotation},destroy:function(){this.enable=!1,this.world&&this.world.pendingDestroy.set(this)},drawDebug:function(t){var i=this.position,s=i.x+this.halfWidth,e=i.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor),this.isCircle?t.strokeCircle(s,e,this.width/2):(this.checkCollision.up&&t.lineBetween(i.x,i.y,i.x+this.width,i.y),this.checkCollision.right&&t.lineBetween(i.x+this.width,i.y,i.x+this.width,i.y+this.height),this.checkCollision.down&&t.lineBetween(i.x,i.y+this.height,i.x+this.width,i.y+this.height),this.checkCollision.left&&t.lineBetween(i.x,i.y,i.x,i.y+this.height))),this.debugShowVelocity&&(t.lineStyle(t.defaultStrokeWidth,this.world.defaults.velocityDebugColor,1),t.lineBetween(s,e,s+this.velocity.x/2,e+this.velocity.y/2))},willDrawDebug:function(){return this.debugShowBody||this.debugShowVelocity},setCollideWorldBounds:function(t,i,s){void 0===t&&(t=!0),this.collideWorldBounds=t;var e=void 0!==i,h=void 0!==s;return(e||h)&&(this.worldBounce||(this.worldBounce=new n),e&&(this.worldBounce.x=i),h&&(this.worldBounce.y=s)),this},setVelocity:function(t,i){return this.velocity.set(t,i),t=this.velocity.x,i=this.velocity.y,this.speed=Math.sqrt(t*t+i*i),this},setVelocityX:function(t){this.velocity.x=t;var i=t,s=this.velocity.y;return this.speed=Math.sqrt(i*i+s*s),this},setVelocityY:function(t){this.velocity.y=t;var i=this.velocity.x,s=t;return this.speed=Math.sqrt(i*i+s*s),this},setMaxVelocity:function(t,i){return this.maxVelocity.set(t,i),this},setMaxSpeed:function(t){return this.maxSpeed=t,this},setBounce:function(t,i){return this.bounce.set(t,i),this},setBounceX:function(t){return this.bounce.x=t,this},setBounceY:function(t){return this.bounce.y=t,this},setAcceleration:function(t,i){return this.acceleration.set(t,i),this},setAccelerationX:function(t){return this.acceleration.x=t,this},setAccelerationY:function(t){return this.acceleration.y=t,this},setAllowDrag:function(t){return void 0===t&&(t=!0),this.allowDrag=t,this},setAllowGravity:function(t){return void 0===t&&(t=!0),this.allowGravity=t,this},setAllowRotation:function(t){return void 0===t&&(t=!0),this.allowRotation=t,this},setDrag:function(t,i){return this.drag.set(t,i),this},setDragX:function(t){return this.drag.x=t,this},setDragY:function(t){return this.drag.y=t,this},setGravity:function(t,i){return this.gravity.set(t,i),this},setGravityX:function(t){return this.gravity.x=t,this},setGravityY:function(t){return this.gravity.y=t,this},setFriction:function(t,i){return this.friction.set(t,i),this},setFrictionX:function(t){return this.friction.x=t,this},setFrictionY:function(t){return this.friction.y=t,this},setAngularVelocity:function(t){return this.angularVelocity=t,this},setAngularAcceleration:function(t){return this.angularAcceleration=t,this},setAngularDrag:function(t){return this.angularDrag=t,this},setMass:function(t){return this.mass=t,this},setImmovable:function(t){return void 0===t&&(t=!0),this.immovable=t,this},setEnable:function(t){return void 0===t&&(t=!0),this.enable=t,this},x:{get:function(){return this.position.x},set:function(t){this.position.x=t}},y:{get:function(){return this.position.y},set:function(t){this.position.y=t}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});module.exports=r;
},{"../../utils/Class":"JASv","./const":"FWI5","./events":"csuF","../../math/RadToDeg":"vauQ","../../geom/rectangle/Rectangle":"wYVB","../../geom/rectangle/Contains":"mjUt","../../math/Vector2":"qKN5"}],"Upa6":[function(require,module,exports) {
var t=require("../../utils/Class"),l=new t({initialize:function(t,l,i,s,e,c,o){this.world=t,this.name="",this.active=!0,this.overlapOnly=l,this.object1=i,this.object2=s,this.collideCallback=e,this.processCallback=c,this.callbackContext=o},setName:function(t){return this.name=t,this},update:function(){this.world.collideObjects(this.object1,this.object2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)},destroy:function(){this.world.removeCollider(this),this.active=!1,this.world=null,this.object1=null,this.object2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}});module.exports=l;
},{"../../utils/Class":"JASv"}],"WS1S":[function(require,module,exports) {
var e=require("./const"),o=function(o,n,c,i){var t=0,l=o.deltaAbsX()+n.deltaAbsX()+i;return 0===o._dx&&0===n._dx?(o.embedded=!0,n.embedded=!0):o._dx>n._dx?(t=o.right-n.x)>l&&!c||!1===o.checkCollision.right||!1===n.checkCollision.left?t=0:(o.touching.none=!1,o.touching.right=!0,n.touching.none=!1,n.touching.left=!0,n.physicsType===e.STATIC_BODY&&(o.blocked.none=!1,o.blocked.right=!0),o.physicsType===e.STATIC_BODY&&(n.blocked.none=!1,n.blocked.left=!0)):o._dxl&&!c||!1===o.checkCollision.left||!1===n.checkCollision.right?t=0:(o.touching.none=!1,o.touching.left=!0,n.touching.none=!1,n.touching.right=!0,n.physicsType===e.STATIC_BODY&&(o.blocked.none=!1,o.blocked.left=!0),o.physicsType===e.STATIC_BODY&&(n.blocked.none=!1,n.blocked.right=!0))),o.overlapX=t,n.overlapX=t,t};module.exports=o;
},{"./const":"FWI5"}],"JFvb":[function(require,module,exports) {
var o=require("./const"),e=function(e,n,c,d){var i=0,l=e.deltaAbsY()+n.deltaAbsY()+d;return 0===e._dy&&0===n._dy?(e.embedded=!0,n.embedded=!0):e._dy>n._dy?(i=e.bottom-n.y)>l&&!c||!1===e.checkCollision.down||!1===n.checkCollision.up?i=0:(e.touching.none=!1,e.touching.down=!0,n.touching.none=!1,n.touching.up=!0,n.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.down=!0),e.physicsType===o.STATIC_BODY&&(n.blocked.none=!1,n.blocked.up=!0)):e._dyl&&!c||!1===e.checkCollision.up||!1===n.checkCollision.down?i=0:(e.touching.none=!1,e.touching.up=!0,n.touching.none=!1,n.touching.down=!0,n.physicsType===o.STATIC_BODY&&(e.blocked.none=!1,e.blocked.up=!0),e.physicsType===o.STATIC_BODY&&(n.blocked.none=!1,n.blocked.down=!0))),e.overlapY=i,n.overlapY=i,i};module.exports=e;
},{"./const":"FWI5"}],"wjuU":[function(require,module,exports) {
var l=function(l,a){return l.collisionCallback?!l.collisionCallback.call(l.collisionCallbackContext,a,l):!l.layer.callbacks[l.index]||!l.layer.callbacks[l.index].callback.call(l.layer.callbacks[l.index].callbackContext,a,l)};module.exports=l;
},{}],"eoRJ":[function(require,module,exports) {
var t=require("../utils/array/QuickSelect");function i(t){if(!(this instanceof i))return new i(t,[".left",".top",".right",".bottom"]);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}function n(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function x(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,h,e){for(var a,o=[n,r];o.length;)(r=o.pop())-(n=o.pop())<=h||(a=n+Math.ceil((r-n)/h/2)*h,t(i,a,n,r,e),o.push(n,a,a,r))}i.prototype={all:function(){return this._all(this.data,[])},search:function(t){var i=this.data,n=[],r=this.toBBox;if(!f(t,i))return n;for(var h,e,a,o,s=[];i;){for(h=0,e=i.children.length;h=0&&a[i].children.length>this._maxEntries;)this._split(a,i),i--;this._adjustParentBBoxes(h,a,i)},_split:function(t,i){var n=t[i],h=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,h);var a=this._chooseSplitIndex(n,e,h),o=x(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,r(n,this.toBBox),r(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},_splitRoot:function(t,i){this.data=x([t,i]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},_chooseSplitIndex:function(t,i,n){var r,e,a,o,l,m,c,f;for(m=c=1/0,r=i;r<=n-i;r++)o=u(e=h(t,0,r,this.toBBox),a=h(t,r,n,this.toBBox)),l=s(e)+s(a),o=i;a--)o=t.children[a],e(u,t.leaf?s(o):o),c+=l(u);return c},_adjustParentBBoxes:function(t,i,n){for(var r=n;r>=0;r--)e(i[r],t)},_condense:function(t){for(var i,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(i=t[n-1].children).splice(i.indexOf(t[n]),1):this.clear():r(t[n],this.toBBox)},compareMinX:function(t,i){return t.left-i.left},compareMinY:function(t,i){return t.top-i.top},toBBox:function(t){return{minX:t.left,minY:t.top,maxX:t.right,maxY:t.bottom}}},module.exports=i;
},{"../utils/array/QuickSelect":"MEkw"}],"vdLB":[function(require,module,exports) {
var o=function(o,e){e<0?(o.blocked.none=!1,o.blocked.left=!0):e>0&&(o.blocked.none=!1,o.blocked.right=!0),o.position.x-=e,0===o.bounce.x?o.velocity.x=0:o.velocity.x=-o.velocity.x*o.bounce.x};module.exports=o;
},{}],"oBoz":[function(require,module,exports) {
var e=require("./ProcessTileSeparationX"),t=function(t,i,l,r,o,a){var c=0,h=i.faceLeft,f=i.faceRight,n=i.collideLeft,s=i.collideRight;return a||(h=!0,f=!0,n=!0,s=!0),t.deltaX()<0&&s&&t.checkCollision.left?f&&t.x0&&n&&t.checkCollision.right&&h&&t.right>l&&(c=t.right-l)>o&&(c=0),0!==c&&(t.customSeparateX?t.overlapX=c:e(t,c)),c};module.exports=t;
},{"./ProcessTileSeparationX":"vdLB"}],"VFIE":[function(require,module,exports) {
var o=function(o,e){e<0?(o.blocked.none=!1,o.blocked.up=!0):e>0&&(o.blocked.none=!1,o.blocked.down=!0),o.position.y-=e,0===o.bounce.y?o.velocity.y=0:o.velocity.y=-o.velocity.y*o.bounce.y};module.exports=o;
},{}],"Es5q":[function(require,module,exports) {
var o=require("./ProcessTileSeparationY"),e=function(e,t,l,a,c,r){var i=0,n=t.faceTop,p=t.faceBottom,d=t.collideUp,s=t.collideDown;return r||(n=!0,p=!0,d=!0,s=!0),e.deltaY()<0&&s&&e.checkCollision.up?p&&e.y0&&d&&e.checkCollision.down&&n&&e.bottom>l&&(i=e.bottom-l)>c&&(i=0),0!==i&&(e.customSeparateY?e.overlapY=i:o(e,i)),i};module.exports=e;
},{"./ProcessTileSeparationY":"VFIE"}],"m4LE":[function(require,module,exports) {
var t=function(t,o){return!(o.right<=t.left||o.bottom<=t.top||o.position.x>=t.right||o.position.y>=t.bottom)};module.exports=t;
},{}],"YqIp":[function(require,module,exports) {
var t=require("./TileCheckX"),e=require("./TileCheckY"),a=require("./TileIntersectsBody"),r=function(r,i,o,s,l,f,h){var n=s.left,b=s.top,u=s.right,c=s.bottom,d=o.faceLeft||o.faceRight,m=o.faceTop||o.faceBottom;if(h||(d=!0,m=!0),!d&&!m)return!1;var M=0,p=0,A=0,T=1;if(i.deltaAbsX()>i.deltaAbsY()?A=-1:i.deltaAbsX()0?1:-1),c=Math.sqrt(v*v*o.mass/m.mass)*(v>0?1:-1),x=.5*(s+c);s-=x,c-=x,o.velocity.x=x+s*o.bounce.x,m.velocity.x=x+c*m.bounce.x}return!0};module.exports=o;
},{"./GetOverlapX":"WS1S"}],"xEeA":[function(require,module,exports) {
var e=require("./GetOverlapY"),o=function(o,m,t,a){var r=e(o,m,t,a);if(t||0===r||o.immovable&&m.immovable||o.customSeparateY||m.customSeparateY)return 0!==r||o.embedded&&m.embedded;var v=o.velocity.y,y=m.velocity.y;if(o.immovable||m.immovable)o.immovable?(m.y+=r,m.velocity.y=v-y*m.bounce.y,o.moves&&(m.x+=(o.x-o.prev.x)*o.friction.x)):(o.y-=r,o.velocity.y=y-v*o.bounce.y,m.moves&&(o.x+=(m.x-m.prev.x)*m.friction.x));else{r*=.5,o.y-=r,m.y+=r;var i=Math.sqrt(y*y*m.mass/o.mass)*(y>0?1:-1),s=Math.sqrt(v*v*o.mass/m.mass)*(v>0?1:-1),c=.5*(i+s);i-=c,s-=c,o.velocity.y=c+i*o.bounce.y,m.velocity.y=c+s*m.bounce.y}return!0};module.exports=o;
},{"./GetOverlapY":"JFvb"}],"NZWW":[function(require,module,exports) {
var t=require("../../geom/circle/Contains"),i=require("../../utils/Class"),s=require("./const"),e=require("../../geom/rectangle/Contains"),h=require("../../math/Vector2"),o=new i({initialize:function(t,i){var e=i.width?i.width:64,o=i.height?i.height:64;this.world=t,this.gameObject=i,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new h,this.position=new h(i.x-i.displayOriginX,i.y-i.displayOriginY),this.width=e,this.height=o,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new h(i.x+this.halfWidth,i.y+this.halfHeight),this.velocity=h.ZERO,this.allowGravity=!1,this.gravity=h.ZERO,this.bounce=h.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.customSeparateX=!1,this.customSeparateY=!1,this.overlapX=0,this.overlapY=0,this.overlapR=0,this.embedded=!1,this.collideWorldBounds=!1,this.checkCollision={none:!1,up:!0,down:!0,left:!0,right:!0},this.touching={none:!0,up:!1,down:!1,left:!1,right:!1},this.wasTouching={none:!0,up:!1,down:!1,left:!1,right:!1},this.blocked={none:!0,up:!1,down:!1,left:!1,right:!1},this.physicsType=s.STATIC_BODY,this._dx=0,this._dy=0},setGameObject:function(t,i){return t&&t!==this.gameObject&&(this.gameObject.body=null,t.body=this,this.gameObject=t),i&&this.updateFromGameObject(),this},updateFromGameObject:function(){this.world.staticTree.remove(this);var t=this.gameObject;return t.getTopLeft(this.position),this.width=t.displayWidth,this.height=t.displayHeight,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.world.staticTree.insert(this),this},setOffset:function(t,i){return void 0===i&&(i=t),this.world.staticTree.remove(this),this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(t,i),this.position.x+=this.offset.x,this.position.y+=this.offset.y,this.updateCenter(),this.world.staticTree.insert(this),this},setSize:function(t,i,s){void 0===s&&(s=!0);var e=this.gameObject;if(!t&&e.frame&&(t=e.frame.realWidth),!i&&e.frame&&(i=e.frame.realHeight),this.world.staticTree.remove(this),this.width=t,this.height=i,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(i/2),s&&e.getCenter){var h=e.displayWidth/2,o=e.displayHeight/2;this.position.x-=this.offset.x,this.position.y-=this.offset.y,this.offset.set(h-this.halfWidth,o-this.halfHeight),this.position.x+=this.offset.x,this.position.y+=this.offset.y}return this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this},setCircle:function(t,i,s){return void 0===i&&(i=this.offset.x),void 0===s&&(s=this.offset.y),t>0?(this.world.staticTree.remove(this),this.isCircle=!0,this.radius=t,this.width=2*t,this.height=2*t,this.halfWidth=Math.floor(this.width/2),this.halfHeight=Math.floor(this.height/2),this.offset.set(i,s),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this},updateCenter:function(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)},reset:function(t,i){var s=this.gameObject;void 0===t&&(t=s.x),void 0===i&&(i=s.y),this.world.staticTree.remove(this),s.setPosition(t,i),s.getTopLeft(this.position),this.updateCenter(),this.world.staticTree.insert(this)},stop:function(){return this},getBounds:function(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t},hitTest:function(i,s){return this.isCircle?t(this,i,s):e(this,i,s)},postUpdate:function(){},deltaAbsX:function(){return 0},deltaAbsY:function(){return 0},deltaX:function(){return 0},deltaY:function(){return 0},deltaZ:function(){return 0},destroy:function(){this.enable=!1,this.world.pendingDestroy.set(this)},drawDebug:function(t){var i=this.position,s=i.x+this.halfWidth,e=i.y+this.halfHeight;this.debugShowBody&&(t.lineStyle(t.defaultStrokeWidth,this.debugBodyColor,1),this.isCircle?t.strokeCircle(s,e,this.width/2):t.strokeRect(i.x,i.y,this.width,this.height))},willDrawDebug:function(){return this.debugShowBody},setMass:function(t){return t<=0&&(t=.1),this.mass=t,this},x:{get:function(){return this.position.x},set:function(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}},y:{get:function(){return this.position.y},set:function(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}},left:{get:function(){return this.position.x}},right:{get:function(){return this.position.x+this.width}},top:{get:function(){return this.position.y}},bottom:{get:function(){return this.position.y+this.height}}});module.exports=o;
},{"../../geom/circle/Contains":"inZZ","../../utils/Class":"JASv","./const":"FWI5","../../geom/rectangle/Contains":"mjUt","../../math/Vector2":"qKN5"}],"EaXf":[function(require,module,exports) {
var e=require("./Body"),t=require("../../math/Clamp"),i=require("../../utils/Class"),r=require("./Collider"),s=require("./const"),o=require("../../math/distance/DistanceBetween"),l=require("eventemitter3"),a=require("./events"),n=require("../../math/fuzzy/Equal"),h=require("../../math/fuzzy/GreaterThan"),c=require("../../math/fuzzy/LessThan"),d=require("./GetOverlapX"),u=require("./GetOverlapY"),y=require("../../utils/object/GetValue"),p=require("../../structs/ProcessQueue"),m=require("./tilemap/ProcessTileCallbacks"),b=require("../../geom/rectangle/Rectangle"),v=require("../../structs/RTree"),f=require("./tilemap/SeparateTile"),g=require("./SeparateX"),x=require("./SeparateY"),T=require("../../structs/Set"),C=require("./StaticBody"),w=require("./tilemap/TileIntersectsBody"),O=require("../../gameobjects/components/TransformMatrix"),S=require("../../math/Vector2"),B=require("../../math/Wrap"),A=new i({Extends:l,initialize:function(e,t){l.call(this),this.scene=e,this.bodies=new T,this.staticBodies=new T,this.pendingDestroy=new T,this.colliders=new p,this.gravity=new S(y(t,"gravity.x",0),y(t,"gravity.y",0)),this.bounds=new b(y(t,"x",0),y(t,"y",0),y(t,"width",e.sys.scale.width),y(t,"height",e.sys.scale.height)),this.checkCollision={up:y(t,"checkCollision.up",!0),down:y(t,"checkCollision.down",!0),left:y(t,"checkCollision.left",!0),right:y(t,"checkCollision.right",!0)},this.fps=y(t,"fps",60),this._elapsed=0,this._frameTime=1/this.fps,this._frameTimeMS=1e3*this._frameTime,this.stepsLastFrame=0,this.timeScale=y(t,"timeScale",1),this.OVERLAP_BIAS=y(t,"overlapBias",4),this.TILE_BIAS=y(t,"tileBias",16),this.forceX=y(t,"forceX",!1),this.isPaused=y(t,"isPaused",!1),this._total=0,this.drawDebug=y(t,"debug",!1),this.debugGraphic,this.defaults={debugShowBody:y(t,"debugShowBody",!0),debugShowStaticBody:y(t,"debugShowStaticBody",!0),debugShowVelocity:y(t,"debugShowVelocity",!0),bodyDebugColor:y(t,"debugBodyColor",16711935),staticBodyDebugColor:y(t,"debugStaticBodyColor",255),velocityDebugColor:y(t,"debugVelocityColor",65280)},this.maxEntries=y(t,"maxEntries",16),this.useTree=y(t,"useTree",!0),this.tree=new v(this.maxEntries),this.staticTree=new v(this.maxEntries),this.treeMinMax={minX:0,minY:0,maxX:0,maxY:0},this._tempMatrix=new O,this._tempMatrix2=new O,this.drawDebug&&this.createDebugGraphic()},enable:function(e,t){void 0===t&&(t=s.DYNAMIC_BODY),Array.isArray(e)||(e=[e]);for(var i=0;i=o;for(i=0;i=o;)this._elapsed-=o,this.step(s)}},step:function(e){var t,i,r=this.bodies.entries,s=r.length;for(t=0;t0){var h=this.tree,c=this.staticTree;for(r=(i=n.entries).length,e=0;e-1&&p>m&&(e.velocity.normalize().scale(m),p=m),e.speed=p},separate:function(e,t,i,r,s){if(!e.enable||!t.enable||e.checkCollision.none||t.checkCollision.none||!this.intersects(e,t))return!1;if(i&&!1===i.call(r,e.gameObject,t.gameObject))return!1;if(e.isCircle&&t.isCircle)return this.separateCircle(e,t,s);if(e.isCircle!==t.isCircle){var o=e.isCircle?t:e,l=e.isCircle?e:t,n={x:o.x,y:o.y,right:o.right,bottom:o.bottom},h=l.center;if((h.yn.bottom)&&(h.xn.right))return this.separateCircle(e,t,s)}var c=!1,d=!1;this.forceX||Math.abs(this.gravity.y+e.gravity.y)l.right&&(s=o(n.x,n.y,l.right,l.y)-n.radius):n.y>l.bottom&&(n.xl.right&&(s=o(n.x,n.y,l.right,l.bottom)-n.radius)),s*=-1}else s=e.halfWidth+t.halfWidth-o(e.center.x,e.center.y,t.center.x,t.center.y);if(i||0===s||e.immovable&&t.immovable||e.customSeparateX||t.customSeparateX)return 0!==s&&(e.onOverlap||t.onOverlap)&&this.emit(a.OVERLAP,e.gameObject,t.gameObject,e,t),0!==s;var h=e.center.x-t.center.x,c=e.center.y-t.center.y,y=Math.sqrt(Math.pow(h,2)+Math.pow(c,2)),p=(t.center.x-e.center.x)/y||0,m=(t.center.y-e.center.y)/y||0,b=2*(e.velocity.x*p+e.velocity.y*m-t.velocity.x*p-t.velocity.y*m)/(e.mass+t.mass);e.immovable||(e.velocity.x=e.velocity.x-b*e.mass*p,e.velocity.y=e.velocity.y-b*e.mass*m),t.immovable||(t.velocity.x=t.velocity.x+b*t.mass*p,t.velocity.y=t.velocity.y+b*t.mass*m);var v=t.velocity.x-e.velocity.x,f=t.velocity.y-e.velocity.y,g=Math.atan2(f,v),x=this._frameTime;return e.immovable||t.immovable||(s/=2),e.immovable||(e.x+=e.velocity.x*x-s*Math.cos(g),e.y+=e.velocity.y*x-s*Math.sin(g)),t.immovable||(t.x+=t.velocity.x*x+s*Math.cos(g),t.y+=t.velocity.y*x+s*Math.sin(g)),e.velocity.x*=e.bounce.x,e.velocity.y*=e.bounce.y,t.velocity.x*=t.bounce.x,t.velocity.y*=t.bounce.y,(e.onCollide||t.onCollide)&&this.emit(a.COLLIDE,e.gameObject,t.gameObject,e,t),!0},intersects:function(e,t){return e!==t&&(e.isCircle||t.isCircle?e.isCircle?t.isCircle?o(e.center.x,e.center.y,t.center.x,t.center.y)<=e.halfWidth+t.halfWidth:this.circleBodyIntersects(e,t):this.circleBodyIntersects(t,e):!(e.right<=t.position.x||e.bottom<=t.position.y||e.position.x>=t.right||e.position.y>=t.bottom))},circleBodyIntersects:function(e,i){var r=t(e.center.x,i.left,i.right),s=t(e.center.y,i.top,i.bottom);return(e.center.x-r)*(e.center.x-r)+(e.center.y-s)*(e.center.y-s)<=e.halfWidth*e.halfWidth},overlap:function(e,t,i,r,s){return void 0===i&&(i=null),void 0===r&&(r=null),void 0===s&&(s=i),this.collideObjects(e,t,i,r,s,!0)},collide:function(e,t,i,r,s){return void 0===i&&(i=null),void 0===r&&(r=null),void 0===s&&(s=i),this.collideObjects(e,t,i,r,s,!1)},collideObjects:function(e,t,i,r,s,o){var l,a;e.isParent&&void 0===e.physicsType&&(e=e.children.entries),t&&t.isParent&&void 0===t.physicsType&&(t=t.children.entries);var n=Array.isArray(e),h=Array.isArray(t);if(this._total=0,n||h)if(!n&&h)for(l=0;l0},collideHandler:function(e,t,i,r,s,o){if(void 0===t&&e.isParent)return this.collideGroupVsGroup(e,e,i,r,s,o);if(!e||!t)return!1;if(e.body){if(t.body)return this.collideSpriteVsSprite(e,t,i,r,s,o);if(t.isParent)return this.collideSpriteVsGroup(e,t,i,r,s,o);if(t.isTilemap)return this.collideSpriteVsTilemapLayer(e,t,i,r,s,o)}else if(e.isParent){if(t.body)return this.collideSpriteVsGroup(t,e,i,r,s,o);if(t.isParent)return this.collideGroupVsGroup(e,t,i,r,s,o);if(t.isTilemap)return this.collideGroupVsTilemapLayer(e,t,i,r,s,o)}else if(e.isTilemap){if(t.body)return this.collideSpriteVsTilemapLayer(t,e,i,r,s,o);if(t.isParent)return this.collideGroupVsTilemapLayer(t,e,i,r,s,o)}},collideSpriteVsSprite:function(e,t,i,r,s,o){return!(!e.body||!t.body)&&(this.separate(e.body,t.body,r,s,o)&&(i&&i.call(s,e,t),this._total++),!0)},collideSpriteVsGroup:function(e,t,i,r,o,l){var a,n,h,c=e.body;if(0!==t.length&&c&&c.enable)if(this.useTree){var d=this.treeMinMax;d.minX=c.left,d.minY=c.top,d.maxX=c.right,d.maxY=c.bottom;var u=t.physicsType===s.DYNAMIC_BODY?this.tree.search(d):this.staticTree.search(d);for(n=u.length,a=0;ad.baseTileWidth){var u=(d.tileWidth-d.baseTileWidth)*t.scaleX;a-=u,h+=u}d.tileHeight>d.baseTileHeight&&(c+=(d.tileHeight-d.baseTileHeight)*t.scaleY);var y=t.getTilesWithinWorldXY(a,n,h,c);return 0!==y.length&&this.collideSpriteVsTilesHandler(e,y,i,r,s,o,!0)},collideSpriteVsTilesHandler:function(e,t,i,r,s,o,l){for(var n,h,c=e.body,d={left:0,right:0,top:0,bottom:0},u=!1,y=0;ys&&(o=d,s=h)}}return o},moveTo:function(e,t,i,o,r){void 0===o&&(o=60),void 0===r&&(r=0);var n=Math.atan2(i-e.y,t-e.x);return r>0&&(o=s(e.x,e.y,t,i)/(r/1e3)),e.body.velocity.setToPolar(n,o),n},moveToObject:function(e,t,s,i){return this.moveTo(e,t.x,t.y,s,i)},velocityFromAngle:function(e,s,i){return void 0===s&&(s=60),void 0===i&&(i=new h),i.setToPolar(t(e),s)},velocityFromRotation:function(e,t,s){return void 0===t&&(t=60),void 0===s&&(s=new h),s.setToPolar(e,t)},overlapRect:function(e,t,s,i,o,r){return c(this.world,e,t,s,i,o,r)},overlapCirc:function(e,t,s,i,o){return l(this.world,e,t,s,i,o)},shutdown:function(){if(this.world){var e=this.systems.events;e.off(u.UPDATE,this.world.update,this.world),e.off(u.POST_UPDATE,this.world.postUpdate,this.world),e.off(u.SHUTDOWN,this.shutdown,this),this.add.destroy(),this.world.destroy(),this.add=null,this.world=null}},destroy:function(){this.shutdown(),this.scene.sys.events.off(u.START,this.start,this),this.scene=null,this.systems=null}});d.register("ArcadePhysics",v,"arcadePhysics"),module.exports=v;
},{"../../utils/Class":"JASv","../../math/DegToRad":"VYZO","../../math/distance/DistanceBetween":"ovvS","../../math/distance/DistanceSquared":"OAF7","./Factory":"Hlve","../../utils/object/GetFastValue":"cEup","../../utils/object/Merge":"NXFV","./components/OverlapCirc":"oRz8","./components/OverlapRect":"Um7c","../../plugins/PluginCache":"ZrqD","../../scene/events":"zvkO","../../math/Vector2":"qKN5","./World":"EaXf"}],"Waxg":[function(require,module,exports) {
var e=require("./const"),r=require("../../utils/object/Extend"),i={ArcadePhysics:require("./ArcadePhysics"),Body:require("./Body"),Collider:require("./Collider"),Components:require("./components"),Events:require("./events"),Factory:require("./Factory"),Group:require("./PhysicsGroup"),Image:require("./ArcadeImage"),Sprite:require("./ArcadeSprite"),StaticBody:require("./StaticBody"),StaticGroup:require("./StaticPhysicsGroup"),World:require("./World")};i=r(!1,i,e),module.exports=i;
},{"./const":"FWI5","../../utils/object/Extend":"SFmW","./ArcadePhysics":"oHzV","./Body":"gwNI","./Collider":"Upa6","./components":"rtKR","./events":"csuF","./Factory":"Hlve","./PhysicsGroup":"GovP","./ArcadeImage":"xNJw","./ArcadeSprite":"EKCX","./StaticBody":"NZWW","./StaticPhysicsGroup":"xy7Y","./World":"EaXf"}],"gq5x":[function(require,module,exports) {
module.exports={NEVER:0,LITE:1,PASSIVE:2,ACTIVE:4,FIXED:8};
},{}],"SiLD":[function(require,module,exports) {
var r=require("../../math/Clamp"),e=function(e,t,u,n,a){if(u)return r(t+u*e,-a,a);if(n){var i=n*e;return t-i>0?t-i:t+i<0?t+i:0}return r(t,-a,a)};module.exports=e;
},{"../../math/Clamp":"eCA1"}],"iMVb":[function(require,module,exports) {
module.exports={NONE:0,A:1,B:2,BOTH:3};
},{}],"hCPk":[function(require,module,exports) {
var n=function(n,e){if(n.standing=!1,e.collision.y&&(n.bounciness>0&&Math.abs(n.vel.y)>n.minBounceVelocity?n.vel.y*=-n.bounciness:(n.vel.y>0&&(n.standing=!0),n.vel.y=0)),e.collision.x&&(n.bounciness>0&&Math.abs(n.vel.x)>n.minBounceVelocity?n.vel.x*=-n.bounciness:n.vel.x=0),e.collision.slope){var l=e.collision.slope;if(n.bounciness>0){var s=n.vel.x*l.nx+n.vel.y*l.ny;n.vel.x=(n.vel.x-l.nx*s*2)*n.bounciness,n.vel.y=(n.vel.y-l.ny*s*2)*n.bounciness}else{var o=l.x*l.x+l.y*l.y,i=(n.vel.x*l.x+n.vel.y*l.y)/o;n.vel.x=l.x*i,n.vel.y=l.y*i;var v=Math.atan2(l.x,l.y);v>n.slopeStanding.min&&v=i.pos.x+i.size.x||this.pos.x+this.size.x<=i.pos.x||this.pos.y>=i.pos.y+i.size.y||this.pos.y+this.size.y<=i.pos.y)},resetSize:function(i,t,s,e){return this.pos.x=i,this.pos.y=t,this.size.x=s,this.size.y=e,this},toJSON:function(){return{name:this.name,size:{x:this.size.x,y:this.size.y},pos:{x:this.pos.x,y:this.pos.y},vel:{x:this.vel.x,y:this.vel.y},accel:{x:this.accel.x,y:this.accel.y},friction:{x:this.friction.x,y:this.friction.y},maxVel:{x:this.maxVel.x,y:this.maxVel.y},gravityFactor:this.gravityFactor,bounciness:this.bounciness,minBounceVelocity:this.minBounceVelocity,type:this.type,checkAgainst:this.checkAgainst,collides:this.collides}},fromJSON:function(){},check:function(){},collideWith:function(i,t){this.parent&&this.parent._collideCallback&&this.parent._collideCallback.call(this.parent._callbackScope,this,i,t)},handleMovementTrace:function(){return!0},destroy:function(){this.world.remove(this),this.enabled=!1,this.world=null,this.gameObject=null,this.parent=null}});module.exports=l;
},{"../../utils/Class":"JASv","./COLLIDES":"gq5x","./GetVelocity":"SiLD","./TYPE":"iMVb","./UpdateMotion":"hCPk"}],"Jk1d":[function(require,module,exports) {
module.exports={COLLIDE:require("./COLLIDE_EVENT"),PAUSE:require("./PAUSE_EVENT"),RESUME:require("./RESUME_EVENT")};
},{"./COLLIDE_EVENT":"TRUm","./PAUSE_EVENT":"XFXR","./RESUME_EVENT":"swsX"}],"hGUM":[function(require,module,exports) {
var e=.5,o=1/3,r=2/3;module.exports={2:[0,1,1,0,!0],3:[0,1,1,e,!0],4:[0,e,1,0,!0],5:[0,1,1,r,!0],6:[0,r,1,o,!0],7:[0,o,1,0,!0],8:[e,1,0,0,!0],9:[1,0,e,1,!0],10:[e,1,1,0,!0],11:[0,0,e,1,!0],12:[0,0,1,0,!1],13:[1,1,0,0,!0],14:[1,e,0,0,!0],15:[1,1,0,e,!0],16:[1,o,0,0,!0],17:[1,r,0,o,!0],18:[1,1,0,r,!0],19:[1,1,e,0,!0],20:[e,0,0,1,!0],21:[0,1,e,0,!0],22:[e,0,1,1,!0],23:[1,1,0,1,!1],24:[0,0,1,1,!0],25:[0,0,1,e,!0],26:[0,e,1,1,!0],27:[0,0,1,o,!0],28:[0,o,1,r,!0],29:[0,r,1,1,!0],30:[o,1,0,0,!0],31:[1,0,r,1,!0],32:[r,1,1,0,!0],33:[0,0,o,1,!0],34:[1,0,1,1,!1],35:[1,0,0,1,!0],36:[1,e,0,1,!0],37:[1,0,0,e,!0],38:[1,r,0,1,!0],39:[1,o,0,r,!0],40:[1,0,0,o,!0],41:[r,1,o,0,!0],42:[r,0,o,1,!0],43:[o,1,r,0,!0],44:[o,0,r,1,!0],45:[0,1,0,0,!1],52:[1,1,r,0,!0],53:[o,0,0,1,!0],54:[0,1,o,0,!0],55:[r,0,1,1,!0]};
},{}],"c6pU":[function(require,module,exports) {
var i=require("../../utils/Class"),t=require("./DefaultDefs"),s=new i({initialize:function(i,s){void 0===i&&(i=32),this.tilesize=i,this.data=Array.isArray(s)?s:[],this.width=Array.isArray(s)?s[0].length:0,this.height=Array.isArray(s)?s.length:0,this.lastSlope=55,this.tiledef=t},trace:function(i,t,s,e,a,o){var l={collision:{x:!1,y:!1,slope:!1},pos:{x:i+s,y:t+e},tile:{x:0,y:0}};if(!this.data)return l;var h=Math.ceil(Math.max(Math.abs(s),Math.abs(e))/this.tilesize);if(h>1)for(var r=s/h,f=e/h,n=0;n0?o:0,v=e<0?x:0,d=Math.max(Math.floor(s/x),0),k=Math.min(Math.ceil((s+l)/x),M);n=Math.floor((i.pos.x+u)/x);var D=Math.floor((t+u)/x);if((f>0||n===D||D<0||D>=y)&&(D=-1),n>=0&&n1&&c<=this.lastSlope&&this.checkDef(i,c,t,s,h,r,o,l,D,p));p++)if(1===(c=this.data[p][n])||c>this.lastSlope||c>1&&this.checkDef(i,c,t,s,h,r,o,l,n,p)){if(c>1&&c<=this.lastSlope&&i.collision.slope)break;i.collision.x=!0,i.tile.x=c,i.pos.x=n*x-u+v,t=i.pos.x,h=0;break}}if(a){var S=a>0?l:0,b=a<0?x:0,m=Math.max(Math.floor(i.pos.x/x),0),A=Math.min(Math.ceil((i.pos.x+o)/x),y);p=Math.floor((i.pos.y+S)/x);var z=Math.floor((s+S)/x);if((f>0||p===z||z<0||z>=M)&&(z=-1),p>=0&&p1&&c<=this.lastSlope&&this.checkDef(i,c,t,s,h,r,o,l,n,z));n++)if(1===(c=this.data[p][n])||c>this.lastSlope||c>1&&this.checkDef(i,c,t,s,h,r,o,l,n,p)){if(c>1&&c<=this.lastSlope&&i.collision.slope)break;i.collision.y=!0,i.tile.y=c,i.pos.y=p*x-S+b;break}}},checkDef:function(i,t,s,e,a,o,l,h,r,f){var n=this.tiledef[t];if(!n)return!1;var p=this.tilesize,c=(r+n[0])*p,x=(f+n[1])*p,y=(n[2]-n[0])*p,M=(n[3]-n[1])*p,u=n[4],v=s+a+(M<0?l:0)-c,d=e+o+(y>0?h:0)-x;if(y*d-M*v>0){if(a*-M+o*y<0)return u;var k=Math.sqrt(y*y+M*M),D=M/k,S=-y/k,b=v*D+d*S,m=D*b,A=S*b;return m*m+A*A>=a*a+o*o?u||y*(d-o)-M*(v-a)<.5:(i.pos.x=s+a-m,i.pos.y=e+o-A,i.collision.slope={x:y,y:M,nx:D,ny:S},!0)}return!1}});module.exports=s;
},{"../../utils/Class":"JASv","./DefaultDefs":"hGUM"}],"ztPj":[function(require,module,exports) {
var t={setAccelerationX:function(t){return this.accel.x=t,this},setAccelerationY:function(t){return this.accel.y=t,this},setAcceleration:function(t,e){return this.accel.x=t,this.accel.y=e,this}};module.exports=t;
},{}],"UMHP":[function(require,module,exports) {
var e={setBodySize:function(e,t){return void 0===t&&(t=e),this.body.size.x=Math.round(e),this.body.size.y=Math.round(t),this},setBodyScale:function(e,t){void 0===t&&(t=e);var i=this.body.gameObject;return i?(i.setScale(e,t),this.setBodySize(i.width*i.scaleX,i.height*i.scaleY)):this.setBodySize(this.body.size.x*e,this.body.size.y*t)}};module.exports=e;
},{}],"knkl":[function(require,module,exports) {
var t=require("../TYPE"),e={getBodyType:function(){return this.body.type},setTypeNone:function(){return this.body.type=t.NONE,this},setTypeA:function(){return this.body.type=t.A,this},setTypeB:function(){return this.body.type=t.B,this}};module.exports=e;
},{"../TYPE":"iMVb"}],"SsyU":[function(require,module,exports) {
var n={setBounce:function(n){return this.body.bounciness=n,this},setMinBounceVelocity:function(n){return this.body.minBounceVelocity=n,this},bounce:{get:function(){return this.body.bounciness},set:function(n){this.body.bounciness=n}}};module.exports=n;
},{}],"pWqi":[function(require,module,exports) {
var t=require("../TYPE"),s={setAvsB:function(){return this.setTypeA(),this.setCheckAgainstB()},setBvsA:function(){return this.setTypeB(),this.setCheckAgainstA()},setCheckAgainstNone:function(){return this.body.checkAgainst=t.NONE,this},setCheckAgainstA:function(){return this.body.checkAgainst=t.A,this},setCheckAgainstB:function(){return this.body.checkAgainst=t.B,this},checkAgainst:{get:function(){return this.body.checkAgainst},set:function(t){this.body.checkAgainst=t}}};module.exports=s;
},{"../TYPE":"iMVb"}],"HZTQ":[function(require,module,exports) {
var i=require("../COLLIDES"),l={_collideCallback:null,_callbackScope:null,setCollideCallback:function(i,l){return this._collideCallback=i,l&&(this._callbackScope=l),this},setCollidesNever:function(){return this.body.collides=i.NEVER,this},setLiteCollision:function(){return this.body.collides=i.LITE,this},setPassiveCollision:function(){return this.body.collides=i.PASSIVE,this},setActiveCollision:function(){return this.body.collides=i.ACTIVE,this},setFixedCollision:function(){return this.body.collides=i.FIXED,this},collides:{get:function(){return this.body.collides},set:function(i){this.body.collides=i}}};module.exports=l;
},{"../COLLIDES":"gq5x"}],"sOA4":[function(require,module,exports) {
var i={setFrictionX:function(i){return this.friction.x=i,this},setFrictionY:function(i){return this.friction.y=i,this},setFriction:function(i,t){return this.friction.x=i,this.friction.y=t,this}};module.exports=i;
},{}],"B15I":[function(require,module,exports) {
var t={setGravity:function(t){return this.body.gravityFactor=t,this},gravity:{get:function(){return this.body.gravityFactor},set:function(t){this.body.gravityFactor=t}}};module.exports=t;
},{}],"AOT4":[function(require,module,exports) {
var t={setOffset:function(t,s,e,o){return this.body.offset.x=t,this.body.offset.y=s,e&&this.setBodySize(e,o),this}};module.exports=t;
},{}],"Iav7":[function(require,module,exports) {
var e={setGameObject:function(e,t){return void 0===t&&(t=!0),e?(this.body.gameObject=e,t&&this.syncGameObject()):this.body.gameObject=null,this},syncGameObject:function(){var e=this.body.gameObject;return e&&this.setBodySize(e.width*e.scaleX,e.height*e.scaleY),this}};module.exports=e;
},{}],"jjUg":[function(require,module,exports) {
var t={setVelocityX:function(t){return this.vel.x=t,this},setVelocityY:function(t){return this.vel.y=t,this},setVelocity:function(t,e){return void 0===e&&(e=t),this.vel.x=t,this.vel.y=e,this},setMaxVelocity:function(t,e){return void 0===e&&(e=t),this.maxVel.x=t,this.maxVel.y=e,this}};module.exports=t;
},{}],"oDzl":[function(require,module,exports) {
module.exports={Acceleration:require("./Acceleration"),BodyScale:require("./BodyScale"),BodyType:require("./BodyType"),Bounce:require("./Bounce"),CheckAgainst:require("./CheckAgainst"),Collides:require("./Collides"),Debug:require("./Debug"),Friction:require("./Friction"),Gravity:require("./Gravity"),Offset:require("./Offset"),SetGameObject:require("./SetGameObject"),Velocity:require("./Velocity")};
},{"./Acceleration":"ztPj","./BodyScale":"UMHP","./BodyType":"knkl","./Bounce":"SsyU","./CheckAgainst":"pWqi","./Collides":"HZTQ","./Debug":"WF5N","./Friction":"sOA4","./Gravity":"B15I","./Offset":"AOT4","./SetGameObject":"Iav7","./Velocity":"jjUg"}],"YXLM":[function(require,module,exports) {
var i=require("../../utils/Class"),e=require("./components"),t=new i({Mixins:[e.Acceleration,e.BodyScale,e.BodyType,e.Bounce,e.CheckAgainst,e.Collides,e.Debug,e.Friction,e.Gravity,e.Offset,e.SetGameObject,e.Velocity],initialize:function(i,e,t,s,o){this.body=i.create(e,t,s,o),this.body.parent=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});module.exports=t;
},{"../../utils/Class":"JASv","./components":"oDzl"}],"OHB8":[function(require,module,exports) {
var e=require("../../utils/Class"),i=require("./components"),t=require("../../gameobjects/image/Image"),s=new e({Extends:t,Mixins:[i.Acceleration,i.BodyScale,i.BodyType,i.Bounce,i.CheckAgainst,i.Collides,i.Debug,i.Friction,i.Gravity,i.Offset,i.SetGameObject,i.Velocity],initialize:function(e,i,s,h,o){t.call(this,e.scene,i,s,h,o),this.body=e.create(i-this.frame.centerX,s-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});module.exports=s;
},{"../../utils/Class":"JASv","./components":"oDzl","../../gameobjects/image/Image":"DnOy"}],"hwW6":[function(require,module,exports) {
var e=require("../../utils/Class"),i=require("./components"),t=require("../../gameobjects/sprite/Sprite"),s=new e({Extends:t,Mixins:[i.Acceleration,i.BodyScale,i.BodyType,i.Bounce,i.CheckAgainst,i.Collides,i.Debug,i.Friction,i.Gravity,i.Offset,i.SetGameObject,i.Velocity],initialize:function(e,i,s,h,o){t.call(this,e.scene,i,s,h,o),this.body=e.create(i-this.frame.centerX,s-this.frame.centerY,this.width,this.height),this.body.parent=this,this.body.gameObject=this,this.size=this.body.size,this.offset=this.body.offset,this.vel=this.body.vel,this.accel=this.body.accel,this.friction=this.body.friction,this.maxVel=this.body.maxVel}});module.exports=s;
},{"../../utils/Class":"JASv","./components":"oDzl","../../gameobjects/sprite/Sprite":"ZUCM"}],"LDHt":[function(require,module,exports) {
var t=require("../../utils/Class"),e=require("./ImpactBody"),i=require("./ImpactImage"),r=require("./ImpactSprite"),s=new t({initialize:function(t){this.world=t,this.sys=t.scene.sys},body:function(t,i,r,s){return new e(this.world,t,i,r,s)},existing:function(t){var e=t.x-t.frame.centerX,i=t.y-t.frame.centerY,r=t.width,s=t.height;return t.body=this.world.create(e,i,r,s),t.body.parent=t,t.body.gameObject=t,t},image:function(t,e,r,s){var n=new i(this.world,t,e,r,s);return this.sys.displayList.add(n),n},sprite:function(t,e,i,s){var n=new r(this.world,t,e,i,s);return this.sys.displayList.add(n),this.sys.updateList.add(n),n},destroy:function(){this.world=null,this.sys=null}});module.exports=s;
},{"../../utils/Class":"JASv","./ImpactBody":"YXLM","./ImpactImage":"OHB8","./ImpactSprite":"hwW6"}],"TO6M":[function(require,module,exports) {
var s=function(s,o,e,x){var p=o.pos.x+o.size.x-e.pos.x;if(x){var i=o===x?e:o;x.vel.x=-x.vel.x*x.bounciness+i.vel.x;var l=s.collisionMap.trace(x.pos.x,x.pos.y,x===o?-p:p,0,x.size.x,x.size.y);x.pos.x=l.pos.x}else{var a=(o.vel.x-e.vel.x)/2;o.vel.x=-a,e.vel.x=a;var v=s.collisionMap.trace(o.pos.x,o.pos.y,-p/2,0,o.size.x,o.size.y);o.pos.x=Math.floor(v.pos.x);var r=s.collisionMap.trace(e.pos.x,e.pos.y,p/2,0,e.size.x,e.size.y);e.pos.x=Math.ceil(r.pos.x)}};module.exports=s;
},{}],"hed1":[function(require,module,exports) {
var s=function(s,e,o,y){var i,l,p=e.pos.y+e.size.y-o.pos.y;if(y){var a=e===y?o:e;y.vel.y=-y.vel.y*y.bounciness+a.vel.y,i=0,y===e&&Math.abs(y.vel.y-a.vel.y)0))l=s.collisionMap.trace(e.pos.x,e.pos.y,0,-(e.pos.y+e.size.y-o.pos.y),e.size.x,e.size.y),e.pos.y=l.pos.y,e.bounciness>0&&e.vel.y>e.minBounceVelocity?e.vel.y*=-e.bounciness:(e.standing=!0,e.vel.y=0);else{var v=(e.vel.y-o.vel.y)/2;e.vel.y=-v,o.vel.y=v,i=o.vel.x*s.delta,l=s.collisionMap.trace(e.pos.x,e.pos.y,i,-p/2,e.size.x,e.size.y),e.pos.y=l.pos.y;var c=s.collisionMap.trace(o.pos.x,o.pos.y,0,p/2,o.size.x,o.size.y);o.pos.y=c.pos.y}};module.exports=s;
},{}],"qtfM":[function(require,module,exports) {
var l=require("./COLLIDES"),e=require("./events"),i=require("./SeparateX"),t=require("./SeparateY"),s=function(s,a,r){var x=null;a.collides===l.LITE||r.collides===l.FIXED?x=a:r.collides!==l.LITE&&a.collides!==l.FIXED||(x=r),a.last.x+a.size.x>r.last.x&&a.last.xr.last.y&&a.last.yi.ACTIVE&&h(this,e,t))},setCollidesNever:function(e){for(var t=0;t0;t--){var r=Math.floor(n.random()*(t+1)),o=e[t];e[t]=e[r],e[r]=o}return e},n.choose=function(e){return e[Math.floor(n.random()*e.length)]},n.isElement=function(n){return"undefined"!=typeof HTMLElement?n instanceof HTMLElement:!!(n&&n.nodeType&&n.nodeName)},n.isArray=function(n){return"[object Array]"===Object.prototype.toString.call(n)},n.isFunction=function(n){return"function"==typeof n},n.isPlainObject=function(n){return"object"==typeof n&&n.constructor===Object},n.isString=function(n){return"[object String]"===toString.call(n)},n.clamp=function(n,e,t){return nt?t:n},n.sign=function(n){return n<0?-1:1},n.now=function(){if("undefined"!=typeof window&&window.performance){if(window.performance.now)return window.performance.now();if(window.performance.webkitNow)return window.performance.webkitNow()}return new Date-n._nowStartTime},n.random=function(n,t){return t=void 0!==t?t:1,(n=void 0!==n?n:0)+e()*(t-n)};var e=function(){return n._seed=(9301*n._seed+49297)%233280,n._seed/233280};n.colorToNumber=function(n){return 3==(n=n.replace("#","")).length&&(n=n.charAt(0)+n.charAt(0)+n.charAt(1)+n.charAt(1)+n.charAt(2)+n.charAt(2)),parseInt(n,16)},n.logLevel=1,n.log=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.log.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.info=function(){console&&n.logLevel>0&&n.logLevel<=2&&console.info.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.warn=function(){console&&n.logLevel>0&&n.logLevel<=3&&console.warn.apply(console,["matter-js:"].concat(Array.prototype.slice.call(arguments)))},n.nextId=function(){return n._nextId++},n.indexOf=function(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0;t0)return!1}return!0},r.scale=function(n,e,o,a){if(1===e&&1===o)return n;var l,u;a=a||r.centre(n);for(var f=0;f=0?f-1:r.length-1],c=r[f],s=r[(f+1)%r.length],i=e[f0&&(a|=2),3===a)return!1;return 0!==a||null},r.hull=function(r){var n,e,o=[],a=[];for((r=r.slice(0)).sort(function(r,t){var n=r.x-t.x;return 0!==n?n:r.y-t.y}),e=0;e=2&&t.cross3(a[a.length-2],a[a.length-1],n)<=0;)a.pop();a.push(n)}for(e=r.length-1;e>=0;e-=1){for(n=r[e];o.length>=2&&t.cross3(o[o.length-2],o[o.length-1],n)<=0;)o.pop();o.push(n)}return o.pop(),a.pop(),o.concat(a)};
},{"../geometry/Vector":"SoZW","../core/Common":"lVTS"}],"spdM":[function(require,module,exports) {
var e={};module.exports=e;var n=require("./Common");e.on=function(e,n,t){for(var r,s=n.split(" "),o=0;o0){r||(r={}),s=t.split(" ");for(var l=0;l0&&t.motion=t.sleepThreshold&&e.set(t,!0)):t.sleepCounter>0&&(t.sleepCounter-=1)}else e.set(t,!1)}},e.afterCollisions=function(i,o){for(var s=o*o*o,n=0;ne._motionWakeThreshold*s&&e.set(a,!1)}}}},e.set=function(e,o){var s=e.isSleeping;o?(e.isSleeping=!0,e.sleepCounter=e.sleepThreshold,e.positionImpulse.x=0,e.positionImpulse.y=0,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.anglePrev=e.angle,e.speed=0,e.angularSpeed=0,e.motion=0,s||i.trigger(e,"sleepStart")):(e.isSleeping=!1,e.sleepCounter=0,s&&i.trigger(e,"sleepEnd"))};
},{"./Events":"spdM"}],"DuOH":[function(require,module,exports) {
var x={};module.exports=x,x.create=function(m){var n={min:{x:0,y:0},max:{x:0,y:0}};return m&&x.update(n,m),n},x.update=function(x,m,n){x.min.x=1/0,x.max.x=-1/0,x.min.y=1/0,x.max.y=-1/0;for(var y=0;yx.max.x&&(x.max.x=a.x),a.xx.max.y&&(x.max.y=a.y),a.y0?x.max.x+=n.x:x.min.x+=n.x,n.y>0?x.max.y+=n.y:x.min.y+=n.y)},x.contains=function(x,m){return m.x>=x.min.x&&m.x<=x.max.x&&m.y>=x.min.y&&m.y<=x.max.y},x.overlaps=function(x,m){return x.min.x<=m.max.x&&x.max.x>=m.min.x&&x.max.y>=m.min.y&&x.min.y<=m.max.y},x.translate=function(x,m){x.min.x+=m.x,x.max.x+=m.x,x.min.y+=m.y,x.max.y+=m.y},x.shift=function(x,m){var n=x.max.x-x.min.x,y=x.max.y-x.min.y;x.min.x=m.x,x.max.x=m.x+n,x.min.y=m.y,x.max.y=m.y+y};
},{}],"AlFY":[function(require,module,exports) {
var r={};module.exports=r;var e=require("../geometry/Vector"),o=require("../core/Common");r.fromVertices=function(r){for(var t={},n=0;n0&&t.rotateAbout(l.position,s,e.position,l.position)}},e.setVelocity=function(e,i){e.positionPrev.x=e.position.x-i.x,e.positionPrev.y=e.position.y-i.y,e.velocity.x=i.x,e.velocity.y=i.y,e.speed=t.magnitude(e.velocity)},e.setAngularVelocity=function(e,i){e.anglePrev=e.angle-i,e.angularVelocity=i,e.angularSpeed=Math.abs(e.angularVelocity)},e.translate=function(i,n){e.setPosition(i,t.add(i.position,n))},e.rotate=function(i,t,n){if(n){var s=Math.cos(t),r=Math.sin(t),a=i.position.x-n.x,o=i.position.y-n.y;e.setPosition(i,{x:n.x+(a*s-o*r),y:n.y+(a*r+o*s)}),e.setAngle(i,i.angle+t)}else e.setAngle(i,i.angle+t)},e.scale=function(t,n,s,o){var l=0,c=0;o=o||t.position;for(var p=0;p0&&(l+=y.area,c+=y.inertia),y.position.x=o.x+(y.position.x-o.x)*n,y.position.y=o.y+(y.position.y-o.y)*s,r.update(y.bounds,y.vertices,t.velocity)}t.parts.length>1&&(t.area=l,t.isStatic||(e.setMass(t,t.density*l),e.setInertia(t,c))),t.circleRadius&&(n===s?t.circleRadius*=n:t.circleRadius=null)},e.update=function(e,n,s,o){var l=Math.pow(n*s*e.timeScale,2),c=1-e.frictionAir*s*e.timeScale,p=e.position.x-e.positionPrev.x,y=e.position.y-e.positionPrev.y;e.velocity.x=p*c*o+e.force.x/e.mass*l,e.velocity.y=y*c*o+e.force.y/e.mass*l,e.positionPrev.x=e.position.x,e.positionPrev.y=e.position.y,e.position.x+=e.velocity.x,e.position.y+=e.velocity.y,e.angularVelocity=(e.angle-e.anglePrev)*c*o+e.torque/e.inertia*l,e.anglePrev=e.angle,e.angle+=e.angularVelocity,e.speed=t.magnitude(e.velocity),e.angularSpeed=Math.abs(e.angularVelocity);for(var v=0;v0&&(u.position.x+=e.velocity.x,u.position.y+=e.velocity.y),0!==e.angularVelocity&&(i.rotate(u.vertices,e.angularVelocity,e.position),a.rotate(u.axes,e.angularVelocity),v>0&&t.rotateAbout(u.position,e.angularVelocity,e.position,u.position)),r.update(u.bounds,u.vertices,e.velocity)}},e.applyForce=function(e,i,t){e.force.x+=t.x,e.force.y+=t.y;var n=i.x-e.position.x,s=i.y-e.position.y;e.torque+=n*t.y-s*t.x},e._totalProperties=function(e){for(var i={mass:0,area:0,inertia:0,centre:{x:0,y:0}},n=1===e.parts.length?0:1;n=0&&h<=1&&l>=0&&l<=1}function t(r,n,t){return(n[0]-r[0])*(t[1]-r[1])-(t[0]-r[0])*(n[1]-r[1])}function e(r,n,e){return t(r,n,e)>0}function u(r,n,e){return t(r,n,e)>=0}function f(r,n,e){return t(r,n,e)<0}function o(r,n,e){return t(r,n,e)<=0}module.exports={decomp:x,quickDecomp:E,isSimple:C,removeCollinearPoints:L,removeDuplicatePoints:N,makeCCW:s};var i=[],h=[];function l(r,n,e,u){if(u){var f=i,o=h;f[0]=n[0]-r[0],f[1]=n[1]-r[1],o[0]=e[0]-n[0],o[1]=e[1]-n[1];var l=f[0]*o[0]+f[1]*o[1],a=Math.sqrt(f[0]*f[0]+f[1]*f[1]),c=Math.sqrt(o[0]*o[0]+o[1]*o[1]);return Math.acos(l/(a*c))t[n][0])&&(n=u);return!e(c(r,n-1),c(r,n),c(r,n+1))&&(p(r),!0)}function p(r){for(var n=[],t=r.length,e=0;e!==t;e++)n.push(r.pop());for(e=0;e!==t;e++)r[e]=n[e]}function m(r,n){return f(c(r,n-1),c(r,n),c(r,n+1))}var A=[],M=[];function d(n,t,e){var f,i,h=A,l=M;if(u(c(n,t+1),c(n,t),c(n,e))&&o(c(n,t-1),c(n,t),c(n,e)))return!1;i=a(c(n,t),c(n,e));for(var g=0;g!==n.length;++g)if((g+1)%n.length!==t&&g!==t&&u(c(n,t),c(n,e),c(n,g+1))&&o(c(n,t),c(n,e),c(n,g))&&(h[0]=c(n,t),h[1]=c(n,e),l[0]=c(n,g),l[1]=c(n,g+1),f=r(h,l),a(c(n,t),f)0?y(r,n):[r]}function y(r,n){if(0===n.length)return[r];if(n instanceof Array&&n.length&&n[0]instanceof Array&&2===n[0].length&&n[0][0]instanceof Array){for(var t=[r],e=0;el)return console.warn("quickDecomp: max level ("+l+") reached."),n;for(var X=0;Xx&&(x+=r.length),q=Number.MAX_VALUE,x3&&e>=0;--e)l(c(r,e-1),c(r,e),c(r,e+1),n)&&(r.splice(e%r.length,1),t++);return t}function N(r,n){for(var t=r.length-1;t>=1;--t)for(var e=r[t],u=t-1;u>=0;--u)V(e,r[u],n)&&r.splice(t,1)}function U(r,n,t){return t=t||0,Math.abs(r-n)<=t}function V(r,n,t){return U(r[0],n[0],t)&&U(r[1],n[1],t)}
},{}],"bOCr":[function(require,module,exports) {
var e={};module.exports=e;var r=require("../geometry/Vertices"),t=require("../core/Common"),i=require("../body/Body"),a=require("../geometry/Bounds"),o=require("../geometry/Vector"),n=require("../../poly-decomp");e.rectangle=function(e,a,o,n,c){c=c||{};var l={label:"Rectangle Body",position:{x:e,y:a},vertices:r.fromPath("L 0 0 L "+o+" 0 L "+o+" "+n+" L 0 "+n)};if(c.chamfer){var s=c.chamfer;l.vertices=r.chamfer(l.vertices,s.radius,s.quality,s.qualityMin,s.qualityMax),delete c.chamfer}return i.create(t.extend({},l,c))},e.trapezoid=function(e,a,o,n,c,l){l=l||{};var s,u=o*(c*=.5),v=u+(1-2*c)*o,d=v+u;s=c<.5?"L 0 0 L "+u+" "+-n+" L "+v+" "+-n+" L "+d+" 0":"L 0 0 L "+v+" "+-n+" L "+d+" 0";var f={label:"Trapezoid Body",position:{x:e,y:a},vertices:r.fromPath(s)};if(l.chamfer){var h=l.chamfer;f.vertices=r.chamfer(f.vertices,h.radius,h.quality,h.qualityMin,h.qualityMax),delete l.chamfer}return i.create(t.extend({},f,l))},e.circle=function(r,i,a,o,n){o=o||{};var c={label:"Circle Body",circleRadius:a};n=n||25;var l=Math.ceil(Math.max(10,Math.min(n,a)));return l%2==1&&(l+=1),e.polygon(r,i,l,a,t.extend({},c,o))},e.polygon=function(a,o,n,c,l){if(l=l||{},n<3)return e.circle(a,o,c,l);for(var s=2*Math.PI/n,u="",v=.5*s,d=0;d0&&r.area(q)1?(d=i.create(t.extend({parts:f.slice(0)},l)),i.setPosition(d,{x:a,y:o}),d):f[0]},e.flagCoincidentParts=function(e,r){void 0===r&&(r=5);for(var t=0;t0?1:.7),i.damping=i.damping||0,i.angularStiffness=i.angularStiffness||0,i.angleA=i.bodyA?i.bodyA.angle:i.angleA,i.angleB=i.bodyB?i.bodyB.angle:i.angleB,i.plugin={};var r={visible:!0,type:"line",anchors:!0,lineColor:null,lineOpacity:null,lineThickness:null,pinSize:null,anchorColor:null,anchorSize:null};return 0===i.length&&i.stiffness>.1?(r.type="pin",r.anchors=!1):i.stiffness<.9&&(r.type="spring"),i.render=a.extend(r,i.render),i},n.preSolveAll=function(n){for(var i=0;i0&&(g.position.x+=p.x,g.position.y+=p.y),0!==p.angle&&(i.rotate(g.vertices,p.angle,l.position),s.rotate(g.axes,p.angle),y>0&&e.rotateAbout(g.position,p.angle,l.position,g.position)),t.update(g.bounds,g.vertices,l.velocity)}p.angle*=n._warming,p.x*=n._warming,p.y*=n._warming}}},n.pointAWorld=function(n){return{x:(n.bodyA?n.bodyA.position.x:0)+n.pointA.x,y:(n.bodyA?n.bodyA.position.y:0)+n.pointA.y}},n.pointBWorld=function(n){return{x:(n.bodyB?n.bodyB.position.x:0)+n.pointB.x,y:(n.bodyB?n.bodyB.position.y:0)+n.pointB.y}};
},{"../geometry/Vertices":"JhJa","../geometry/Vector":"SoZW","../core/Sleeping":"zP33","../geometry/Bounds":"DuOH","../geometry/Axes":"AlFY","../core/Common":"lVTS"}],"fXQ4":[function(require,module,exports) {
var n={};module.exports=n;var e=require("../body/Composite"),r=require("../constraint/Constraint"),o=require("../core/Common"),t=require("../body/Body"),a=require("./Bodies");n.stack=function(n,r,o,a,d,i,s){for(var c,u=e.create({label:"Stack"}),y=n,b=r,l=0,x=0;xf&&(f=C),t.translate(B,{x:.5*p,y:.5*C}),y=B.bounds.max.x+d,e.addBody(u,B),c=B,l+=1}else y+=d}b+=f+i,y=n}return u},n.chain=function(n,t,a,d,i,s){for(var c=n.bodies,u=1;u0)for(c=0;c0&&(b=l[c-1+(s-1)*t],e.addConstraint(n,r.create(o.extend({bodyA:b,bodyB:y},i)))),d&&cb||i<(c=b-c)||i>o-1-c))return 1===y&&t.translate(u,{x:(i+(o%2==1?1:-1))*l,y:0}),s(e+(u?i*l:0)+i*d,r,i,c,u,y)})},n.newtonsCradle=function(n,o,t,d,i){for(var s=e.create({label:"Newtons Cradle"}),c=0;c1;if(!p||e!=p.x||t!=p.y){p&&r?(b=p.x,l=p.y):(b=0,l=0);var c={x:b+e,y:l+t};!r&&p||(p=c),u.push(c),y=b+e,f=l+t}},v=function(e){var t=e.pathSegTypeAsLetter.toUpperCase();if("Z"!==t){switch(t){case"M":case"L":case"T":case"C":case"S":case"Q":y=e.x,f=e.y;break;case"H":y=e.x;break;case"V":f=e.y}A(y,f,e.pathSegType)}};for(e._svgPathToAbsolute(t),o=t.getTotalLength(),g=[],c=0;c0?this.setFromTileCollision(i):this.setFromTileRectangle(i)}},setFromTileRectangle:function(e){void 0===e&&(e={}),r(e,"isStatic")||(e.isStatic=!0),r(e,"addToWorld")||(e.addToWorld=!0);var i=this.tile.getBounds(),o=i.x+i.width/2,s=i.y+i.height/2,l=t.rectangle(o,s,i.width,i.height,e);return this.setBody(l,e.addToWorld),this},setFromTileCollision:function(i){void 0===i&&(i={}),r(i,"isStatic")||(i.isStatic=!0),r(i,"addToWorld")||(i.addToWorld=!0);for(var o=this.tile.tilemapLayer.scaleX,d=this.tile.tilemapLayer.scaleY,a=this.tile.getLeft(),h=this.tile.getTop(),n=this.tile.getCollisionGroup(),y=s(n,"objects",[]),c=[],u=0;u1&&(i.parts=c,this.setBody(e.create(i),i.addToWorld)),this},setBody:function(t,e){return void 0===e&&(e=!0),this.body&&this.removeBody(),this.body=t,this.body.gameObject=this,e&&this.world.add(this.body),this},removeBody:function(){return this.body&&(this.world.remove(this.body),this.body.gameObject=void 0,this.body=void 0),this},destroy:function(){this.removeBody(),this.tile.physics.matterBody=void 0}});module.exports=d;
},{"./lib/factory/Bodies":"bOCr","./lib/body/Body":"ZQ7a","../../utils/Class":"JASv","./components":"kAkt","../../utils/object/GetFastValue":"cEup","../../utils/object/HasValue":"hJUo","./lib/geometry/Vertices":"JhJa"}],"CbDk":[function(require,module,exports) {
var e={};module.exports=e;var r=require("../geometry/Vertices"),o=require("../geometry/Vector");e.collides=function(t,i,a){var n,s,p,d,l=!1;if(a){var x=t.parent,v=i.parent,u=x.speed*x.speed+x.angularSpeed*x.angularSpeed+v.speed*v.speed+v.angularSpeed*v.angularSpeed;l=a&&a.collided&&u<.2,d=a}else d={collided:!1,bodyA:t,bodyB:i};if(a&&l){var c=d.axisBody,y=c===t?i:t,m=[c.axes[a.axisNumber]];if(p=e._overlapAxes(c.vertices,y.vertices,m),d.reused=!0,p.overlap<=0)return d.collided=!1,d}else{if((n=e._overlapAxes(t.vertices,i.vertices,t.axes)).overlap<=0)return d.collided=!1,d;if((s=e._overlapAxes(i.vertices,t.vertices,i.axes)).overlap<=0)return d.collided=!1,d;n.overlapa?a=s:s=0?n.index-1:l.length-1],d.x=a.x-x.x,d.y=a.y-x.y,p=-o.dot(t,d),s=a,a=l[(n.index+1)%l.length],d.x=a.x-x.x,d.y=a.y-x.y,(i=-o.dot(t,d))1?1:0;d
1?1:0;v0:0!=(r.mask&e.category)&&0!=(e.mask&r.category)};
},{"./SAT":"CbDk","./Pair":"cKvI","../geometry/Bounds":"DuOH"}],"OTzz":[function(require,module,exports) {
var t=require("./lib/geometry/Bounds"),i=require("../../utils/Class"),s=require("./lib/body/Composite"),n=require("./lib/constraint/Constraint"),o=require("./lib/collision/Detector"),e=require("./events"),r=require("../../input/events"),l=require("../../utils/object/Merge"),h=require("./lib/core/Sleeping"),a=require("../../math/Vector2"),u=require("./lib/geometry/Vertices"),p=new i({initialize:function(t,i,s){void 0===s&&(s={});this.scene=t,this.world=i,this.camera=null,this.pointer=null,this.active=!0,this.position=new a,this.body=null,this.part=null,this.constraint=n.create(l(s,{label:"Pointer Constraint",pointA:{x:0,y:0},pointB:{x:0,y:0},length:.01,stiffness:.1,angularStiffness:1,collisionFilter:{category:1,mask:4294967295,group:0}})),this.world.on(e.BEFORE_UPDATE,this.update,this),t.sys.input.on(r.POINTER_DOWN,this.onDown,this),t.sys.input.on(r.POINTER_UP,this.onUp,this)},onDown:function(t){this.pointer||(this.pointer=t,this.camera=t.camera)},onUp:function(t){t===this.pointer&&(this.pointer=null)},getBody:function(i){var n=this.position,r=this.constraint;this.camera.getWorldPoint(i.x,i.y,n);for(var l=s.allBodies(this.world.localWorld),h=0;h1?1:0;os?(n.warn("Plugin.register:",e.toString(i),"was upgraded to",e.toString(r)),e._registry[r.name]=r):t-1},e.isFor=function(n,r){var i=n.for&&e.dependencyParse(n.for);return!n.for||r.name===i.name&&e.versionSatisfies(r.version,i.range)},e.use=function(r,i){if(r.uses=(r.uses||[]).concat(i||[]),0!==r.uses.length){for(var t=e.dependencies(r),s=n.topologicalSort(t),a=[],o=0;o0&&!u.silent&&n.info(a.join(" "))}else n.warn("Plugin.use:",e.toString(r),"does not specify any dependencies to install.")},e.dependencies=function(r,i){var t=e.dependencyParse(r),s=t.name;if(!(s in(i=i||{}))){r=e.resolve(r)||r,i[s]=n.map(r.uses||[],function(i){e.isPlugin(i)&&e.register(i);var s=e.dependencyParse(i),a=e.resolve(i);return a&&!e.versionSatisfies(a.version,s.range)?(n.warn("Plugin.dependencies:",e.toString(a),"does not satisfy",e.toString(s),"used by",e.toString(t)+"."),a._warned=!0,r._warned=!0):a||(n.warn("Plugin.dependencies:",e.toString(i),"used by",e.toString(t),"could not be resolved."),r._warned=!0),s.name});for(var a=0;a=t[2];if("^"===i.operator)return t[0]>0?a[0]===t[0]&&s.number>=i.number:t[1]>0?a[1]===t[1]&&a[2]>=t[2]:a[2]===t[2]}return n===r||"*"===n};
},{"./Common":"lVTS"}],"Ywbp":[function(require,module,exports) {
var e={};module.exports=e;var r=require("./Plugin"),t=require("./Common");e.name="matter-js",e.version="0.14.2",e.uses=[],e.used=[],e.use=function(){r.use(e,Array.prototype.slice.call(arguments))},e.before=function(r,a){return r=r.replace(/^Matter./,""),t.chainPathBefore(e,r,a)},e.after=function(r,a){return r=r.replace(/^Matter./,""),t.chainPathAfter(e,r,a)};
},{"./Plugin":"y68X","./Common":"lVTS"}],"OARP":[function(require,module,exports) {
var e={};module.exports=e;var r=require("./Composite"),o=require("../constraint/Constraint"),t=require("../core/Common");e.create=function(e){var o=r.create(),a={label:"World",gravity:{x:0,y:1,scale:.001},bounds:{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}};return t.extend(o,a,e)};
},{"./Composite":"Tlkx","../constraint/Constraint":"sj0G","../core/Common":"lVTS"}],"U9pO":[function(require,module,exports) {
var e={};module.exports=e;var t=require("./Pair"),r=require("./Detector"),o=require("../core/Common");e.create=function(t){var i={controller:e,detector:r.collisions,buckets:{},pairs:{},pairsList:[],bucketWidth:48,bucketHeight:48};return o.extend(i,t)},e.update=function(t,r,o,i){var n,a,s,u,d,c=o.world,g=t.buckets,l=!1,f=o.metrics;for(f.broadphaseTests=0,n=0;nc.bounds.max.x||b.bounds.max.yc.bounds.max.y)){var h=e._getRegion(t,b);if(!b.region||h.id!==b.region.id||i){f.broadphaseTests+=1,b.region&&!i||(b.region=h);var m=e._regionUnion(h,b.region);for(a=m.startCol;a<=m.endCol;a++)for(s=m.startRow;s<=m.endRow;s++){u=g[d=e._getBucketId(a,s)];var v=a>=h.startCol&&a<=h.endCol&&s>=h.startRow&&s<=h.endRow,R=a>=b.region.startCol&&a<=b.region.endCol&&s>=b.region.startRow&&s<=b.region.endRow;!v&&R&&R&&u&&e._bucketRemoveBody(t,u,b),(b.region===h||v&&!R||i)&&(u||(u=e._createBucket(g,d)),e._bucketAddBody(t,u,b))}b.region=h,l=!0}}}l&&(t.pairsList=e._createActivePairsList(t))},e.clear=function(e){e.buckets={},e.pairs={},e.pairsList=[]},e._regionUnion=function(t,r){var o=Math.min(t.startCol,r.startCol),i=Math.max(t.endCol,r.endCol),n=Math.min(t.startRow,r.startRow),a=Math.max(t.endRow,r.endRow);return e._createRegion(o,i,n,a)},e._getRegion=function(t,r){var o=r.bounds,i=Math.floor(o.min.x/t.bucketWidth),n=Math.floor(o.max.x/t.bucketWidth),a=Math.floor(o.min.y/t.bucketHeight),s=Math.floor(o.max.y/t.bucketHeight);return e._createRegion(i,n,a,s)},e._createRegion=function(e,t,r,o){return{id:e+","+t+","+r+","+o,startCol:e,endCol:t,startRow:r,endRow:o}},e._getBucketId=function(e,t){return"C"+e+"R"+t},e._createBucket=function(e,t){return e[t]=[]},e._bucketAddBody=function(e,r,o){for(var i=0;i