!function(t){"use strict";"function"==typeof define&&define.amd?define(["RBush","SAT"],t):"object"==typeof exports?module.exports=t(require("rbush"),require("sat")):window.Crash=t(window.rbush,window.SAT)}(function(e,p){"use strict";var s={},i=[],r=function(t){t||(t={}),this.__options={maxEntries:t.maxEntries||9,maxChecks:"number"==typeof t.maxChecks?t.maxChecks:100,overlapLimit:"number"==typeof t.overlapLimit||!1===t.overlapLimit?t.overlapLimit:.5},this.rbush=new e(this.__options.maxEntries,[".aabb.x1",".aabb.y1",".aabb.x2",".aabb.y2"]),this.MAX_CHECKS=this.__options.maxChecks,this.OVERLAP_LIMIT=this.__options.overlapLimit,this.RESPONSE=new p.Response,this.BREAK=!1,this.__moved=[],this.__listeners=[],this.createColliders(this)};return r.RBush=r.prototype.RBush=e,r.SAT=r.prototype.SAT=p,r.Vector=r.prototype.Vector=p.Vector,r.V=r.prototype.V=p.Vector,r.Response=r.prototype.Response=p.Response,r.extend=r.prototype.extend=function(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},r.getTestString=r.prototype.getTestString=function(t,e){return"circle"===t?"circle"===e?"testCircleCircle":"testCirclePolygon":"circle"===e?"testPolygonCircle":"testPolygonPolygon"},r.prototype.reset=function(){return this.clear(),this.__listeners=[],this.BREAK=!1,this.MAX_CHECKS=this.__options.maxChecks,this.OVERLAP_LIMIT=this.__options.overlapLimit,this.RESPONSE.clear(),this},r.prototype.onCollision=function(t){return this.__listeners.push(t),this},r.prototype.offCollision=function(t){var e=this.__listeners.indexOf(t);return-1a&&(a=u.x),u.yp&&(p=u.y)}e.x1=o.x+r,e.y1=o.y+n,e.x2=o.x+a,e.y2=o.y+p},r.updateAABBCircle=r.prototype.updateAABBCircle=function(t){var e=t.aabb,o=t.sat.r,s=t.sat.pos;e.x1=s.x-o,e.y1=s.y-o,e.x2=s.x+o,e.y2=s.y+o},r.updateAABBPoint=r.prototype.updateAABBPoint=function(t){var e=t.aabb,o=t.sat.pos;e.x1=e.x2=o.x,e.y1=e.y2=o.x},r.updateAABBBox=r.prototype.updateAABBBox=function(t){var e=t.sat.calcPoints,o=t.aabb,s=t.sat.pos;o.x1=s.x+e[0].x,o.y1=s.y+e[0].y,o.x2=s.x+e[2].x,o.y2=s.y+e[2].y},r.test=r.prototype.test=function(t,e,o){o=o||this.RESPONSE;var s=this.getTestString(t.type,e.type);return o.clear(),p[s](t.sat,e.sat,o)},r.prototype.testAll=function(t,e){e=e||this.RESPONSE;var o=this.search(t);t:for(var s=0,i=o.length;sthis.OVERLAP_LIMIT)&&(this.__onCollision(t,r,e),this.BREAK))break t}t.lastPos.copy(t.pos);var a=this.BREAK;return this.BREAK=!1,!a},r.prototype.check=function(t){for(var e=0;this.__moved.length&&e