arcade-physics
Version:
Use Arcade Physics without Phaser.
2 lines • 66.8 kB
JavaScript
/*! For license information please see arcade-physics.min.js.LICENSE.txt */
var PHYSICS;(()=>{var t={6729:t=>{"use strict";var e=Object.prototype.hasOwnProperty,i="~";function s(){}function o(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,n){if("function"!=typeof s)throw new TypeError("The listener must be a function");var h=new o(s,r||t,n),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],h]:t._events[l].push(h):(t._events[l]=h,t._eventsCount++),t}function n(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function h(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),h.prototype.eventNames=function(){var t,s,o=[];if(0===this._eventsCount)return o;for(s in t=this._events)e.call(t,s)&&o.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},h.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var o=0,r=s.length,n=new Array(r);o<r;o++)n[o]=s[o].fn;return n},h.prototype.listenerCount=function(t){var e=i?i+t:t,s=this._events[e];return s?s.fn?1:s.length:0},h.prototype.emit=function(t,e,s,o,r,n){var h=i?i+t:t;if(!this._events[h])return!1;var l,a,u=this._events[h],c=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),c){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,s),!0;case 4:return u.fn.call(u.context,e,s,o),!0;case 5:return u.fn.call(u.context,e,s,o,r),!0;case 6:return u.fn.call(u.context,e,s,o,r,n),!0}for(a=1,l=new Array(c-1);a<c;a++)l[a-1]=arguments[a];u.fn.apply(u.context,l)}else{var d,f=u.length;for(a=0;a<f;a++)switch(u[a].once&&this.removeListener(t,u[a].fn,void 0,!0),c){case 1:u[a].fn.call(u[a].context);break;case 2:u[a].fn.call(u[a].context,e);break;case 3:u[a].fn.call(u[a].context,e,s);break;case 4:u[a].fn.call(u[a].context,e,s,o);break;default:if(!l)for(d=1,l=new Array(c-1);d<c;d++)l[d-1]=arguments[d];u[a].fn.apply(u[a].context,l)}}return!0},h.prototype.on=function(t,e,i){return r(this,t,e,i,!1)},h.prototype.once=function(t,e,i){return r(this,t,e,i,!0)},h.prototype.removeListener=function(t,e,s,o){var r=i?i+t:t;if(!this._events[r])return this;if(!e)return n(this,r),this;var h=this._events[r];if(h.fn)h.fn!==e||o&&!h.once||s&&h.context!==s||n(this,r);else{for(var l=0,a=[],u=h.length;l<u;l++)(h[l].fn!==e||o&&!h[l].once||s&&h[l].context!==s)&&a.push(h[l]);a.length?this._events[r]=1===a.length?a[0]:a:n(this,r)}return this},h.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&n(this,e)):(this._events=new s,this._eventsCount=0),this},h.prototype.off=h.prototype.removeListener,h.prototype.addListener=h.prototype.on,h.prefixed=i,h.EventEmitter=h,t.exports=h},2582:function(t){t.exports=function(){"use strict";function t(t,s,o,r,n){!function t(i,s,o,r,n){for(;r>o;){if(r-o>600){var h=r-o+1,l=s-o+1,a=Math.log(h),u=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*u*(h-u)/h)*(l-h/2<0?-1:1);t(i,s,Math.max(o,Math.floor(s-l*u/h+c)),Math.min(r,Math.floor(s+(h-l)*u/h+c)),n)}var d=i[s],f=o,y=r;for(e(i,o,s),n(i[r],d)>0&&e(i,o,r);f<y;){for(e(i,f,y),f++,y--;n(i[f],d)<0;)f++;for(;n(i[y],d)>0;)y--}0===n(i[o],d)?e(i,o,y):e(i,++y,r),y<=s&&(o=y+1),s<=y&&(r=y-1)}}(t,s,o||0,r||t.length-1,n||i)}function e(t,e,i){var s=t[e];t[e]=t[i],t[i]=s}function i(t,e){return t<e?-1:t>e?1:0}var s=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(t,e,i){if(!i)return e.indexOf(t);for(var s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function r(t,e){n(t,0,t.children.length,e,t)}function n(t,e,i,s,o){o||(o=y(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(var r=e;r<i;r++){var n=t.children[r];h(o,t.leaf?s(n):n)}return o}function h(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function a(t,e){return t.minY-e.minY}function u(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function c(t){return t.maxX-t.minX+(t.maxY-t.minY)}function d(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function f(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function y(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function p(e,i,s,o,r){for(var n=[i,s];n.length;)if(!((s=n.pop())-(i=n.pop())<=o)){var h=i+Math.ceil((s-i)/o/2)*o;t(e,h,i,s,r),n.push(i,h,h,s)}}return s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(t){var e=this.data,i=[];if(!f(t,e))return i;for(var s=this.toBBox,o=[];e;){for(var r=0;r<e.children.length;r++){var n=e.children[r],h=e.leaf?s(n):n;f(t,h)&&(e.leaf?i.push(n):d(t,h)?this._all(n,i):o.push(n))}e=o.pop()}return i},s.prototype.collides=function(t){var e=this.data;if(!f(t,e))return!1;for(var i=[];e;){for(var s=0;s<e.children.length;s++){var o=e.children[s],r=e.leaf?this.toBBox(o):o;if(f(t,r)){if(e.leaf||d(t,r))return!0;i.push(o)}}e=i.pop()}return!1},s.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var s=this.data;this.data=i,i=s}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},s.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},s.prototype.clear=function(){return this.data=y([]),this},s.prototype.remove=function(t,e){if(!t)return this;for(var i,s,r,n=this.data,h=this.toBBox(t),l=[],a=[];n||l.length;){if(n||(n=l.pop(),s=l[l.length-1],i=a.pop(),r=!0),n.leaf){var u=o(t,n.children,e);if(-1!==u)return n.children.splice(u,1),l.push(n),this._condense(l),this}r||n.leaf||!d(n,h)?s?(i++,n=s.children[i],r=!1):n=null:(l.push(n),a.push(i),i=0,s=n,n=n.children[0])}return this},s.prototype.toBBox=function(t){return t},s.prototype.compareMinX=function(t,e){return t.minX-e.minX},s.prototype.compareMinY=function(t,e){return t.minY-e.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(t){return this.data=t,this},s.prototype._all=function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},s.prototype._build=function(t,e,i,s){var o,n=i-e+1,h=this._maxEntries;if(n<=h)return r(o=y(t.slice(e,i+1)),this.toBBox),o;s||(s=Math.ceil(Math.log(n)/Math.log(h)),h=Math.ceil(n/Math.pow(h,s-1))),(o=y([])).leaf=!1,o.height=s;var l=Math.ceil(n/h),a=l*Math.ceil(Math.sqrt(h));p(t,e,i,a,this.compareMinX);for(var u=e;u<=i;u+=a){var c=Math.min(u+a-1,i);p(t,u,c,l,this.compareMinY);for(var d=u;d<=c;d+=l){var f=Math.min(d+l-1,c);o.children.push(this._build(t,d,f,s-1))}}return r(o,this.toBBox),o},s.prototype._chooseSubtree=function(t,e,i,s){for(;s.push(e),!e.leaf&&s.length-1!==i;){for(var o=1/0,r=1/0,n=void 0,h=0;h<e.children.length;h++){var l=e.children[h],a=u(l),c=(d=t,f=l,(Math.max(f.maxX,d.maxX)-Math.min(f.minX,d.minX))*(Math.max(f.maxY,d.maxY)-Math.min(f.minY,d.minY))-a);c<r?(r=c,o=a<o?a:o,n=l):c===r&&a<o&&(o=a,n=l)}e=n||e.children[0]}var d,f;return e},s.prototype._insert=function(t,e,i){var s=i?t:this.toBBox(t),o=[],r=this._chooseSubtree(s,this.data,e,o);for(r.children.push(t),h(r,s);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(s,o,e)},s.prototype._split=function(t,e){var i=t[e],s=i.children.length,o=this._minEntries;this._chooseSplitAxis(i,o,s);var n=this._chooseSplitIndex(i,o,s),h=y(i.children.splice(n,i.children.length-n));h.height=i.height,h.leaf=i.leaf,r(i,this.toBBox),r(h,this.toBBox),e?t[e-1].children.push(h):this._splitRoot(i,h)},s.prototype._splitRoot=function(t,e){this.data=y([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(t,e,i){for(var s,o,r,h,l,a,c,d=1/0,f=1/0,y=e;y<=i-e;y++){var p=n(t,0,y,this.toBBox),v=n(t,y,i,this.toBBox),_=(o=p,r=v,void 0,void 0,void 0,void 0,h=Math.max(o.minX,r.minX),l=Math.max(o.minY,r.minY),a=Math.min(o.maxX,r.maxX),c=Math.min(o.maxY,r.maxY),Math.max(0,a-h)*Math.max(0,c-l)),x=u(p)+u(v);_<d?(d=_,s=y,f=x<f?x:f):_===d&&x<f&&(f=x,s=y)}return s||i-e},s.prototype._chooseSplitAxis=function(t,e,i){var s=t.leaf?this.compareMinX:l,o=t.leaf?this.compareMinY:a;this._allDistMargin(t,e,i,s)<this._allDistMargin(t,e,i,o)&&t.children.sort(s)},s.prototype._allDistMargin=function(t,e,i,s){t.children.sort(s);for(var o=this.toBBox,r=n(t,0,e,o),l=n(t,i-e,i,o),a=c(r)+c(l),u=e;u<i-e;u++){var d=t.children[u];h(r,t.leaf?o(d):d),a+=c(r)}for(var f=i-e-1;f>=e;f--){var y=t.children[f];h(l,t.leaf?o(y):y),a+=c(l)}return a},s.prototype._adjustParentBBoxes=function(t,e,i){for(var s=i;s>=0;s--)h(e[s],t)},s.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():r(t[e],this.toBBox)},s}()},406:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Circle=void 0,s(i(6713));const o=s(i(3035)),r=s(i(9511)),n=s(i(2029)),h=s(i(5449)),l=s(i(7084));e.Circle=class{constructor(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.type=h.default.CIRCLE,this.x=t,this.y=e,this._radius=i,this._diameter=2*i}contains(t,e){return(0,o.default)(this,t,e)}getPoint(t,e){return(0,r.default)(this,t,e)}getPoints(t,e,i){return(0,n.default)(this,t,e,i)}getRandomPoint(t){return(0,l.default)(this,t)}setTo(t,e,i){return this.x=t,this.y=e,this._radius=i,this._diameter=2*i,this}setEmpty(){return this._radius=0,this._diameter=0,this}setPosition(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}isEmpty(){return this._radius<=0}get radius(){return this._radius}set radius(t){this._radius=t,this._diameter=2*t}get diameter(){return this._diameter}set diameter(t){this._diameter=t,this._radius=.5*t}get left(){return this.x-this._radius}set left(t){this.x=t+this._radius}get right(){return this.x+this._radius}set right(t){this.x=t-this._radius}get top(){return this.y-this._radius}set top(t){this.y=t+this._radius}get bottom(){return this.y+this._radius}set bottom(t){this.y=t-this._radius}}},4254:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=t=>Math.PI*t.radius*2},8163:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(7066));e.default=(t,e,i)=>(void 0===i&&(i=new o.default),i.x=t.x+t.radius*Math.cos(e),i.y=t.y+t.radius*Math.sin(e),i)},3035:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>t.radius>0&&e>=t.left&&e<=t.right&&i>=t.top&&i<=t.bottom&&(t.x-e)*(t.x-e)+(t.y-i)*(t.y-i)<=t.radius*t.radius},9511:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(8163)),r=s(i(576)),n=s(i(4025)),h=s(i(7066));e.default=(t,e,i)=>{void 0===i&&(i=new h.default);const s=(0,r.default)(e,0,n.default.PI2);return(0,o.default)(t,s,i)}},2029:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(4254)),r=s(i(8163)),n=s(i(576)),h=s(i(4025));e.default=(t,e,i,s)=>{void 0===s&&(s=[]),!e&&i>0&&(e=(0,o.default)(t)/i);for(let i=0;i<e;i++){const o=(0,n.default)(i/e,0,h.default.PI2);s.push((0,r.default)(t,o))}return s}},7084:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(7066));e.default=(t,e)=>{void 0===e&&(e=new o.default);const i=2*Math.PI*Math.random(),s=Math.random()+Math.random(),r=s>1?2-s:s,n=r*Math.cos(i),h=r*Math.sin(i);return e.x=t.x+n*t.radius,e.y=t.y+h*t.radius,e}},5449:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={CIRCLE:0,ELLIPSE:1,LINE:2,POINT:3,POLYGON:4,RECTANGLE:5,TRIANGLE:6}},777:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(8083));e.default=(t,e)=>(0,o.default)(t.x,t.y,e.x,e.y)<=t.radius+e.radius},6108:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e)=>{const i=e.width/2,s=e.height/2,o=Math.abs(t.x-e.x-i),r=Math.abs(t.y-e.y-s),n=i+t.radius,h=s+t.radius;if(o>n||r>h)return!1;if(o<=i||r<=s)return!0;{const e=o-i,n=r-s;return e*e+n*n<=t.radius*t.radius}}},7383:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(7066));e.default=(t,e,i)=>(void 0===i&&(i=new o.default),i.x=t.x1+(t.x2-t.x1)*e,i.y=t.y1+(t.y2-t.y1)*e,i)},2977:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(3096)),r=s(i(7066));e.default=(t,e,i,s)=>{void 0===s&&(s=[]),!e&&i>0&&(e=(0,o.default)(t)/i);const n=t.x1,h=t.y1,l=t.x2,a=t.y2;for(let t=0;t<e;t++){const i=t/e,o=n+(l-n)*i,u=h+(a-h)*i;s.push(new r.default(o,u))}return s}},3096:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=t=>Math.sqrt((t.x2-t.x1)*(t.x2-t.x1)+(t.y2-t.y1)*(t.y2-t.y1))},4835:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(6713)),r=s(i(7383)),n=s(i(2977)),h=s(i(5449)),l=s(i(2111)),a=s(i(9990)),u=new o.default({initialize:function(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=h.default.LINE,this.x1=t,this.y1=e,this.x2=i,this.y2=s},getPoint:function(t,e){return(0,r.default)(this,t,e)},getPoints:function(t,e,i){return(0,n.default)(this,t,e,i)},getRandomPoint:function(t){return(0,l.default)(this,t)},setTo:function(t,e,i,s){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.x1=t,this.y1=e,this.x2=i,this.y2=s,this},getPointA:function(t){return void 0===t&&(t=new a.default),t.set(this.x1,this.y1),t},getPointB:function(t){return void 0===t&&(t=new a.default),t.set(this.x2,this.y2),t},left:{get:function(){return Math.min(this.x1,this.x2)},set:function(t){this.x1<=this.x2?this.x1=t:this.x2=t}},right:{get:function(){return Math.max(this.x1,this.x2)},set:function(t){this.x1>this.x2?this.x1=t:this.x2=t}},top:{get:function(){return Math.min(this.y1,this.y2)},set:function(t){this.y1<=this.y2?this.y1=t:this.y2=t}},bottom:{get:function(){return Math.max(this.y1,this.y2)},set:function(t){this.y1>this.y2?this.y1=t:this.y2=t}}});e.default=u},2111:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(7066));e.default=(t,e)=>{void 0===e&&(e=new o.default);const i=Math.random();return e.x=t.x1+i*(t.x2-t.x1),e.y=t.y1+i*(t.y2-t.y1),e}},7066:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(6713)),r=s(i(5449)),n=new o.default({initialize:function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.type=r.default.POINT,this.x=t,this.y=e},setTo:function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this}});e.default=n},6756:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>!(t.width<=0||t.height<=0)&&t.x<=e&&t.x+t.width>=e&&t.y<=i&&t.y+t.height>=i},5461:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(2568)),r=s(i(7066));e.default=(t,e,i)=>{if(void 0===i&&(i=new r.default),e<=0||e>=1)return i.x=t.x,i.y=t.y,i;let s=(0,o.default)(t)*e;return e>.5?(s-=t.width+t.height,s<=t.width?(i.x=t.right-s,i.y=t.bottom):(i.x=t.x,i.y=t.bottom-(s-t.width))):s<=t.width?(i.x=t.x+s,i.y=t.y):(i.x=t.right,i.y=t.y+(s-t.width)),i}},3318:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(5461)),r=s(i(2568));e.default=(t,e,i,s)=>{void 0===s&&(s=[]),!e&&i>0&&(e=(0,r.default)(t)/i);for(let i=0;i<e;i++){const r=i/e;s.push((0,o.default)(t,r))}return s}},2568:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=t=>2*(t.width+t.height)},462:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(7066));e.default=(t,e)=>(void 0===e&&(e=new o.default),e.x=t.x+Math.random()*t.width,e.y=t.y+Math.random()*t.height,e)},302:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Rectangle=void 0;const o=s(i(6756)),r=s(i(5461)),n=s(i(3318)),h=s(i(5449)),l=s(i(4835)),a=s(i(462));e.Rectangle=class{constructor(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=0),this.type=h.default.RECTANGLE,this.x=t,this.y=e,this.width=i,this.height=s}contains(t,e){return(0,o.default)(this,t,e)}getPoint(t,e){return(0,r.default)(this,t,e)}getPoints(t,e,i){return(0,n.default)(this,t,e,i)}getRandomPoint(t){return(0,a.default)(this,t)}setTo(t,e,i,s){return this.x=t,this.y=e,this.width=i,this.height=s,this}setEmpty(){return this.setTo(0,0,0,0)}setPosition(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}setSize(t,e){return void 0===e&&(e=t),this.width=t,this.height=e,this}isEmpty(){return this.width<=0||this.height<=0}getLineA(t){return void 0===t&&(t=new l.default),t.setTo(this.x,this.y,this.right,this.y),t}getLineB(t){return void 0===t&&(t=new l.default),t.setTo(this.right,this.y,this.right,this.bottom),t}getLineC(t){return void 0===t&&(t=new l.default),t.setTo(this.right,this.bottom,this.x,this.bottom),t}getLineD(t){return void 0===t&&(t=new l.default),t.setTo(this.x,this.bottom,this.x,this.y),t}get left(){return this.x}set left(t){t>=this.right?this.width=0:this.width=this.right-t,this.x=t}get right(){return this.x+this.width}set right(t){t<=this.x?this.width=0:this.width=t-this.x}get top(){return this.y}set top(t){t>=this.bottom?this.height=0:this.height=this.bottom-t,this.y=t}get bottom(){return this.y+this.height}set bottom(t){t<=this.y?this.height=0:this.height=t-this.y}get centerX(){return this.x+this.width/2}set centerX(t){this.x=t-this.width/2}get centerY(){return this.y+this.height/2}set centerY(t){this.y=t-this.height/2}}},7132:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>Math.max(e,Math.min(i,t))},2386:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(4025));e.default=t=>t*o.default.DEG_TO_RAD},576:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=s(i(7132));e.default=(t,e,i)=>(i-e)*(t=(0,o.default)(t,0,1))+e},9990:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Vector2=void 0;const s=i(7996);class o{constructor(t,e){this.x=0,this.y=0,"object"==typeof t?(this.x=t.x||0,this.y=t.y||0):(void 0===e&&(e=t),this.x=t||0,this.y=e||0)}clone(){return new o(this.x,this.y)}copy(t){return this.x=t.x||0,this.y=t.y||0,this}setFromObject(t){return this.x=t.x||0,this.y=t.y||0,this}set(t,e){return void 0===e&&(e=t),this.x=t,this.y=e,this}setTo(t,e){return this.set(t,e)}setToPolar(t,e){return null==e&&(e=1),this.x=Math.cos(t)*e,this.y=Math.sin(t)*e,this}equals(t){return this.x===t.x&&this.y===t.y}fuzzyEquals(t,e){return s(this.x,t.x,e)&&s(this.y,t.y,e)}angle(){let t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),t}setAngle(t){return this.setToPolar(t,this.length())}add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.x-=t.x,this.y-=t.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}scale(t){return isFinite(t)?(this.x*=t,this.y*=t):(this.x=0,this.y=0),this}divide(t){return this.x/=t.x,this.y/=t.y,this}negate(){return this.x=-this.x,this.y=-this.y,this}distance(t){const e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)}distanceSq(t){const e=t.x-this.x,i=t.y-this.y;return e*e+i*i}length(){const t=this.x,e=this.y;return Math.sqrt(t*t+e*e)}setLength(t){return this.normalize().scale(t)}lengthSq(){const t=this.x,e=this.y;return t*t+e*e}normalize(){const t=this.x,e=this.y;let i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x=t*i,this.y=e*i),this}normalizeRightHand(){const t=this.x;return this.x=-1*this.y,this.y=t,this}normalizeLeftHand(){const t=this.x;return this.x=this.y,this.y=-1*t,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lerp(t,e){void 0===e&&(e=0);const i=this.x,s=this.y;return this.x=i+e*(t.x-i),this.y=s+e*(t.y-s),this}transformMat3(t){const e=this.x,i=this.y,s=t.val;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}transformMat4(t){const e=this.x,i=this.y,s=t.val;return this.x=s[0]*e+s[4]*i+s[12],this.y=s[1]*e+s[5]*i+s[13],this}reset(){return this.x=0,this.y=0,this}limit(t){const e=this.length();return e&&e>t&&this.scale(t/e),this}reflect(t){return t=t.clone().normalize(),this.subtract(t.scale(2*this.dot(t)))}mirror(t){return this.reflect(t).negate()}rotate(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e*this.x-i*this.y,i*this.x+e*this.y)}}e.Vector2=o,o.ZERO=new o,o.RIGHT=new o(1,0),o.LEFT=new o(-1,0),o.UP=new o(0,-1),o.DOWN=new o(0,1),o.ONE=new o(1,1)},1716:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>{const s=i-e;return e+((t-e)%s+s)%s}},4625:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e)=>Math.atan2(e.y-t.y,e.x-t.x)},4025:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.PI2=2*Math.PI]="PI2",t[t.TAU=.5*Math.PI]="TAU",t[t.EPSILON=1e-6]="EPSILON",t[t.DEG_TO_RAD=Math.PI/180]="DEG_TO_RAD",t[t.RAD_TO_DEG=180/Math.PI]="RAD_TO_DEG",t[t.MIN_SAFE_INTEGER=Number.MIN_SAFE_INTEGER||-9007199254740991]="MIN_SAFE_INTEGER",t[t.MAX_SAFE_INTEGER=Number.MAX_SAFE_INTEGER||9007199254740991]="MAX_SAFE_INTEGER"}(i||(i={})),e.default=i},8083:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i,s)=>{const o=t-i,r=e-s;return Math.sqrt(o*o+r*r)}},2236:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i,s)=>{const o=t-i,r=e-s;return o*o+r*r}},7996:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>(void 0===i&&(i=1e-4),Math.abs(t-e)<i)},9252:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>(void 0===i&&(i=1e-4),t>e-i)},2221:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=(t,e,i)=>(void 0===i&&(i=1e-4),t<e+i)},2062:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ArcadePhysics=void 0;const o=s(i(2386)),r=s(i(8083)),n=s(i(2236)),h=i(7468),l=s(i(1233)),a=s(i(4153)),u=i(9990),c=i(7408);e.ArcadePhysics=class{constructor(t){const e={sys:{scale:{width:t.width,height:t.height},settings:{physics:t}}};this.scene=e,this.systems=e.sys,this.config=this.getConfig(),this.world,this.add,this.boot()}boot(){this.world||(this.world=new c.World(this.scene,this.config)),this.add||(this.add=new h.Factory(this.world))}start(){this.world||(this.world=new c.World(this.scene,this.config),this.add=new h.Factory(this.world)),this.systems.events}enableUpdate(){}disableUpdate(){}getConfig(){var t,e,i;const s=(null===(e=null===(t=this.systems.game)||void 0===t?void 0:t.config)||void 0===e?void 0:e.physics)||{},o=(null===(i=this.systems.settings)||void 0===i?void 0:i.physics)||{};return Object.assign(Object.assign({},s),o)}overlap(t,e,i,s,o){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===o&&(o=i),this.world.collideObjects(t,e,i,s,o,!0)}collide(t,e,i,s,o){return void 0===i&&(i=null),void 0===s&&(s=null),void 0===o&&(o=i),this.world.collideObjects(t,e,i,s,o,!1)}pause(){return this.world.pause()}resume(){return this.world.resume()}accelerateTo(t,e,i,s,o,r){void 0===s&&(s=60);const n=Math.atan2(i-t.y,e-t.x);return t.body.acceleration.setToPolar(n,s),void 0!==o&&void 0!==r&&t.body.maxVelocity.set(o,r),n}accelerateToObject(t,e,i,s,o){return this.accelerateTo(t,e.x,e.y,i,s,o)}closest(t,e=this.world.bodies){let i=Number.MAX_VALUE,s=null;const o=t.x,r=t.y;e.size;for(const h of e){const e=h.body||h;if(t===h||t===e||t===e.gameObject||t===e.center)continue;const l=(0,n.default)(o,r,e.center.x,e.center.y);l<i&&(s=h,i=l)}return s}furthest(t,e=this.world.bodies){let i=-1,s=null;const o=t.x,r=t.y;e.size;for(const h of e){const e=h.body||h;if(t===h||t===e||t===e.gameObject||t===e.center)continue;const l=(0,n.default)(o,r,e.center.x,e.center.y);l>i&&(s=h,i=l)}return s}moveTo(t,e,i,s=60,o=0){const n=Math.atan2(i-t.y,e-t.x);return o>0&&(s=(0,r.default)(t.x,t.y,e,i)/(o/1e3)),t.velocity.setToPolar(n,s),n}moveToObject(t,e,i=60,s=0){return this.moveTo(t,e.x,e.y,i,s)}velocityFromAngle(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new u.Vector2),i.setToPolar((0,o.default)(t),e)}velocityFromRotation(t,e,i){return void 0===e&&(e=60),void 0===i&&(i=new u.Vector2),i.setToPolar(t,e)}overlapRect(t,e,i,s,o=!0,r=!1){return(0,a.default)(this.world,t,e,i,s,o,r)}overlapCirc(t,e,i,s,o){return(0,l.default)(this.world,t,e,i,s,o)}shutdown(){this.world&&(this.systems.events,this.add.destroy(),this.world.destroy(),this.add=null,this.world=null)}destroy(){this.shutdown(),this.scene=null,this.systems=null}}},6751:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Body=void 0;const o=s(i(9915)),r=s(i(9940)),n=i(302),h=s(i(6756)),l=i(9990);e.Body=class{constructor(t,e,i,s=64,r=64){this.enable=!0,this.isCircle=!1,this.radius=0,this.allowRotation=!0,this.velocity=new l.Vector2,this.newVelocity=new l.Vector2,this.deltaMax=new l.Vector2,this.acceleration=new l.Vector2,this.allowDrag=!0,this.drag=new l.Vector2,this.allowGravity=!0,this.gravity=new l.Vector2,this.bounce=new l.Vector2,this.worldBounce=null,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.maxVelocity=new l.Vector2(1e4,1e4),this.maxSpeed=-1,this.friction=new l.Vector2(1,0),this.useDamping=!1,this.angularVelocity=0,this.angularAcceleration=0,this.angularDrag=0,this.maxAngular=1e3,this.mass=1,this.angle=0,this.speed=0,this.facing=o.default.FACING.FACING_NONE,this.immovable=!1,this.pushable=!0,this.moves=!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=o.default.PHYSICS_TYPE.DYNAMIC_BODY,this._dx=0,this._dy=0,this._tx=0,this._ty=0,this._bounds=new n.Rectangle,this.isBody=!0,this.world=t,this.debugShowBody=t.defaults.debugShowBody,this.debugShowVelocity=t.defaults.debugShowVelocity,this.debugBodyColor=t.defaults.bodyDebugColor,this.position=new l.Vector2(e,i),this.prev=this.position.clone(),this.prevFrame=this.position.clone(),this.rotation=0,this.preRotation=0,this.width=s,this.height=r,this.sourceWidth=s,this.sourceHeight=r,this.halfWidth=Math.abs(s/2),this.halfHeight=Math.abs(r/2),this.center=new l.Vector2(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.customBoundsRectangle=t.bounds,this._sx=1,this._sy=1}get minX(){return this.x}get minY(){return this.y}get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}updateCenter(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)}resetFlags(t=!1){const e=this.wasTouching,i=this.touching,s=this.blocked;t?(e.none=!0,e.up=!1,e.down=!1,e.left=!1,e.right=!1):(e.none=i.none,e.up=i.up,e.down=i.down,e.left=i.left,e.right=i.right),i.none=!0,i.up=!1,i.down=!1,i.left=!1,i.right=!1,s.none=!0,s.up=!1,s.down=!1,s.left=!1,s.right=!1,this.overlapR=0,this.overlapX=0,this.overlapY=0,this.embedded=!1}preUpdate(t,e){t&&this.resetFlags(),this.preRotation=this.rotation,this.moves&&(this.prev.x=this.position.x,this.prev.y=this.position.y,this.prevFrame.x=this.position.x,this.prevFrame.y=this.position.y),t&&this.update(e)}update(t){if(this.prev.x=this.position.x,this.prev.y=this.position.y,this.moves){this.world.updateMotion(this,t);const e=this.velocity.x,i=this.velocity.y;this.newVelocity.set(e*t,i*t),this.position.add(this.newVelocity),this.updateCenter(),this.angle=Math.atan2(i,e),this.speed=Math.sqrt(e*e+i*i),this.collideWorldBounds&&this.checkWorldBounds()&&this.onWorldBounds&&this.world.emit(r.default.WORLD_BOUNDS,this,this.blocked.up,this.blocked.down,this.blocked.left,this.blocked.right)}this._dx=this.position.x-this.prev.x,this._dy=this.position.y-this.prev.y}postUpdate(){let t=this.position.x-this.prevFrame.x,e=this.position.y-this.prevFrame.y;if(this.moves){const i=this.deltaMax.x,s=this.deltaMax.y;0!==i&&0!==t&&(t<0&&t<-i?t=-i:t>0&&t>i&&(t=i)),0!==s&&0!==e&&(e<0&&e<-s?e=-s:e>0&&e>s&&(e=s))}t<0?this.facing=o.default.FACING.FACING_LEFT:t>0&&(this.facing=o.default.FACING.FACING_RIGHT),e<0?this.facing=o.default.FACING.FACING_UP:e>0&&(this.facing=o.default.FACING.FACING_DOWN),this.allowRotation,this._tx=t,this._ty=e}setBoundsRectangle(t){return this.customBoundsRectangle=t||this.world.bounds,this}checkWorldBounds(){const t=this.position,e=this.customBoundsRectangle,i=this.world.checkCollision,s=this.worldBounce?-this.worldBounce.x:-this.bounce.x,o=this.worldBounce?-this.worldBounce.y:-this.bounce.y;let r=!1;return t.x<e.x&&i.left?(t.x=e.x,this.velocity.x*=s,this.blocked.left=!0,r=!0):this.right>e.right&&i.right&&(t.x=e.right-this.width,this.velocity.x*=s,this.blocked.right=!0,r=!0),t.y<e.y&&i.up?(t.y=e.y,this.velocity.y*=o,this.blocked.up=!0,r=!0):this.bottom>e.bottom&&i.down&&(t.y=e.bottom-this.height,this.velocity.y*=o,this.blocked.down=!0,r=!0),r&&(this.blocked.none=!1,this.updateCenter()),r}setSize(t,e){return this.sourceWidth=t,this.sourceHeight=e,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(),this.isCircle=!1,this.radius=0,this}setCircle(t){return 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.updateCenter()):this.isCircle=!1,this}reset(t,e){this.stop(),this.position.set(t,e),this.prev.copy(this.position),this.prevFrame.copy(this.position),this.updateCenter(),this.resetFlags(!0)}stop(){return this.velocity.set(0),this.acceleration.set(0),this.speed=0,this.angularVelocity=0,this.angularAcceleration=0,this}getBounds(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t}hitTest(t,e){return this.isCircle?this.radius>0&&t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom&&(this.center.x-t)*(this.center.x-t)+(this.center.y-e)*(this.center.y-e)<=this.radius*this.radius:(0,h.default)(this,t,e)}onFloor(){return this.blocked.down}onCeiling(){return this.blocked.up}onWall(){return this.blocked.left||this.blocked.right}deltaAbsX(){return this._dx>0?this._dx:-this._dx}deltaAbsY(){return this._dy>0?this._dy:-this._dy}deltaX(){return this._dx}deltaY(){return this._dy}deltaXFinal(){return this._tx}deltaYFinal(){return this._ty}deltaZ(){return this.rotation-this.preRotation}destroy(){this.enable=!1,this.world&&this.world.pendingDestroy.add(this)}drawDebug(t){var e,i;const s=this.position,o=s.x+this.halfWidth,r=s.y+this.halfHeight,n=(e,i,s,o)=>{t.moveTo(e,i),t.lineTo(s,o)},h=(e,i,s)=>{t.lineWidth=e,t.strokeStyle=(t=>{let e=(255&(t>>>=0)).toString(16),i=((65280&t)>>>8).toString(16),s=((16711680&t)>>>16).toString(16);return"0"===e&&(e="00"),"0"===i&&(i="00"),"0"===s&&(s="00"),`#${e}${i}${s}`})(i)};this.debugShowBody&&(t.beginPath(),h(1,this.debugBodyColor),this.isCircle?((e,i,s)=>{t.arc(e,i,s,0,2*Math.PI)})(o,r,this.width/2):(this.checkCollision.up&&n(s.x,s.y,s.x+this.width,s.y),this.checkCollision.right&&n(s.x+this.width,s.y,s.x+this.width,s.y+this.height),this.checkCollision.down&&n(s.x,s.y+this.height,s.x+this.width,s.y+this.height),this.checkCollision.left&&n(s.x,s.y,s.x,s.y+this.height)),t.stroke()),this.debugShowVelocity&&(t.beginPath(),h(1,(null===(i=null===(e=this.world)||void 0===e?void 0:e.defaults)||void 0===i?void 0:i.velocityDebugColor)||65280),n(o,r,o+this.velocity.x/2,r+this.velocity.y/2),t.stroke())}willDrawDebug(){return this.debugShowBody||this.debugShowVelocity}setCollideWorldBounds(t,e,i,s){void 0===t&&(t=!0),this.collideWorldBounds=t;const o=void 0!==e,r=void 0!==i;return(o||r)&&(this.worldBounce||(this.worldBounce=new l.Vector2),o&&(this.worldBounce.x=e),r&&(this.worldBounce.y=i)),void 0!==s&&(this.onWorldBounds=s),this}setVelocity(t,e){return this.velocity.set(t,e),t=this.velocity.x,e=this.velocity.y,this.speed=Math.sqrt(t*t+e*e),this}setVelocityX(t){this.velocity.x=t;const e=t,i=this.velocity.y;return this.speed=Math.sqrt(e*e+i*i),this}setVelocityY(t){this.velocity.y=t;const e=this.velocity.x,i=t;return this.speed=Math.sqrt(e*e+i*i),this}setMaxVelocity(t,e){return this.maxVelocity.set(t,e),this}setMaxVelocityX(t){return this.maxVelocity.x=t,this}setMaxVelocityY(t){return this.maxVelocity.y=t,this}setMaxSpeed(t){return this.maxSpeed=t,this}setBounce(t,e){return this.bounce.set(t,e),this}setBounceX(t){return this.bounce.x=t,this}setBounceY(t){return this.bounce.y=t,this}setAcceleration(t,e){return this.acceleration.set(t,e),this}setAccelerationX(t){return this.acceleration.x=t,this}setAccelerationY(t){return this.acceleration.y=t,this}setAllowDrag(t){return void 0===t&&(t=!0),this.allowDrag=t,this}setAllowGravity(t){return void 0===t&&(t=!0),this.allowGravity=t,this}setAllowRotation(t){return void 0===t&&(t=!0),this.allowRotation=t,this}setDrag(t,e){return this.drag.set(t,e),this}setDamping(t){return this.useDamping=t,this}setDragX(t){return this.drag.x=t,this}setDragY(t){return this.drag.y=t,this}setGravity(t,e){return this.gravity.set(t,e),this}setGravityX(t){return this.gravity.x=t,this}setGravityY(t){return this.gravity.y=t,this}setFriction(t,e){return this.friction.set(t,e),this}setFrictionX(t){return this.friction.x=t,this}setFrictionY(t){return this.friction.y=t,this}setAngularVelocity(t){return this.angularVelocity=t,this}setAngularAcceleration(t){return this.angularAcceleration=t,this}setAngularDrag(t){return this.angularDrag=t,this}setMass(t){return this.mass=t,this}setImmovable(t){return void 0===t&&(t=!0),this.immovable=t,this}setEnable(t){return void 0===t&&(t=!0),this.enable=t,this}processX(t,e,i,s){this.x+=t,this.updateCenter(),null!==e&&(this.velocity.x=e);const o=this.blocked;i&&(o.left=!0),s&&(o.right=!0)}processY(t,e,i,s){this.y+=t,this.updateCenter(),null!==e&&(this.velocity.y=e);const o=this.blocked;i&&(o.up=!0),s&&(o.down=!0)}get x(){return this.position.x}set x(t){this.position.x=t}get y(){return this.position.y}set y(t){this.position.y=t}get left(){return this.position.x}get right(){return this.position.x+this.width}get top(){return this.position.y}get bottom(){return this.position.y+this.height}}},333:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Collider=void 0,e.Collider=class{constructor(t,e,i,s,o,r,n){this.world=t,this.overlapOnly=e,this.body1=i,this.body2=s,this.collideCallback=o,this.processCallback=r,this.callbackContext=n,this.name="",this.active=!0}setName(t){return this.name=t,this}update(){this.world.collideObjects(this.body1,this.body2,this.collideCallback,this.processCallback,this.callbackContext,this.overlapOnly)}destroy(){this.world.removeCollider(this),this.active=!1,this.world=null,this.body1=null,this.body2=null,this.collideCallback=null,this.processCallback=null,this.callbackContext=null}}},7468:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const s=i(6751),o=i(4432);e.Factory=class{constructor(t){this.world=t,this.scene=t.scene,this.sys=t.scene.sys}body(t,e,i=64,o=64){const r=new s.Body(this.world,t,e,i,o);return this.world.add(r),r}staticBody(t,e,i=64,s=64){const r=new o.StaticBody(this.world,t,e,i,s);return this.world.add(r),r}collider(t,e,i,s,o){return this.world.addCollider(t,e,i,s,o)}overlap(t,e,i,s,o){return this.world.addOverlap(t,e,i,s,o)}destroy(){this.world=null,this.scene=null,this.sys=null}}},2611:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GetOverlapX=void 0;const o=s(i(9915));e.GetOverlapX=(t,e,i,s)=>{let r=0;const n=t.deltaAbsX()+e.deltaAbsX()+s;return 0===t._dx&&0===e._dx?(t.embedded=!0,e.embedded=!0):t._dx>e._dx?(r=t.right-e.x,r>n&&!i||!1===t.checkCollision.right||!1===e.checkCollision.left?r=0:(t.touching.none=!1,t.touching.right=!0,e.touching.none=!1,e.touching.left=!0,e.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.right=!0),t.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.left=!0))):t._dx<e._dx&&(r=t.x-e.width-e.x,-r>n&&!i||!1===t.checkCollision.left||!1===e.checkCollision.right?r=0:(t.touching.none=!1,t.touching.left=!0,e.touching.none=!1,e.touching.right=!0,e.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.left=!0),t.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.right=!0))),t.overlapX=r,e.overlapX=r,r}},6154:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GetOverlapY=void 0;const o=s(i(9915));e.GetOverlapY=(t,e,i,s)=>{let r=0;const n=t.deltaAbsY()+e.deltaAbsY()+s;return 0===t._dy&&0===e._dy?(t.embedded=!0,e.embedded=!0):t._dy>e._dy?(r=t.bottom-e.y,r>n&&!i||!1===t.checkCollision.down||!1===e.checkCollision.up?r=0:(t.touching.none=!1,t.touching.down=!0,e.touching.none=!1,e.touching.up=!0,e.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.down=!0),t.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.up=!0))):t._dy<e._dy&&(r=t.y-e.bottom,-r>n&&!i||!1===t.checkCollision.up||!1===e.checkCollision.down?r=0:(t.touching.none=!1,t.touching.up=!0,e.touching.none=!1,e.touching.down=!0,e.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(t.blocked.none=!1,t.blocked.up=!0),t.physicsType!==o.default.PHYSICS_TYPE.STATIC_BODY||i||(e.blocked.none=!1,e.blocked.down=!0))),t.overlapY=r,e.overlapY=r,r}},453:(t,e)=>{"use strict";let i,s,o,r,n,h,l,a,u,c,d,f,y,p,v,_,x;Object.defineProperty(e,"__esModule",{value:!0}),e.RunImmovableBody2=e.RunImmovableBody1=e.Run=e.Check=e.BlockCheck=e.Set=void 0,e.Set=(t,n,h)=>{i=t,s=n;const g=i.velocity.x,m=s.velocity.x;return o=i.pushable,u=i._dx<0,c=i._dx>0,d=0===i._dx,v=Math.abs(i.right-s.x)<=Math.abs(s.right-i.x),l=m-g*i.bounce.x,r=s.pushable,f=s._dx<0,y=s._dx>0,p=0===s._dx,_=!v,a=g-m*s.bounce.x,x=Math.abs(h),(0,e.BlockCheck)()},e.BlockCheck=()=>c&&v&&s.blocked.right?(i.processX(-x,l,!1,!0),1):u&&_&&s.blocked.left?(i.processX(x,l,!0),1):y&&_&&i.blocked.right?(s.processX(-x,a,!1,!0),2):f&&v&&i.blocked.left?(s.processX(x,a,!0),2):0,e.Check=()=>{const t=i.velocity.x,o=s.velocity.x;let r=Math.sqrt(o*o*s.mass/i.mass)*(o>0?1:-1),l=Math.sqrt(t*t*i.mass/s.mass)*(t>0?1:-1);const a=.5*(r+l);return r-=a,l-=a,n=a+r*i.bounce.x,h=a+l*s.bounce.x,u&&_?(0,e.Run)(0):f&&v?(0,e.Run)(1):c&&v?(0,e.Run)(2):!(!y||!_)&&(0,e.Run)(3)},e.Run=t=>{if(o&&r)x*=.5,0===t||3===t?(i.processX(x,n),s.processX(-x,h)):(i.processX(-x,n),s.processX(x,h));else if(o&&!r)0===t||3===t?i.processX(x,l,!0):i.processX(-x,l,!1,!0);else if(!o&&r)0===t||3===t?s.processX(-x,a,!1,!0):s.processX(x,a,!0);else{const e=.5*x;0===t?p?(i.processX(x,0,!0),s.processX(0,null,!1,!0)):y?(i.processX(e,0,!0),s.processX(-e,0,!1,!0)):(i.processX(e,s.velocity.x,!0),s.processX(-e,null,!1,!0)):1===t?d?(i.processX(0,null,!1,!0),s.processX(x,0,!0)):c?(i.processX(-e,0,!1,!0),s.processX(e,0,!0)):(i.processX(-e,null,!1,!0),s.processX(e,i.velocity.x,!0)):2===t?p?(i.processX(-x,0,!1,!0),s.processX(0,null,!0)):f?(i.processX(-e,0,!1,!0),s.processX(e,0,!0)):(i.processX(-e,s.velocity.x,!1,!0),s.processX(e,null,!0)):3===t&&(d?(i.processX(0,null,!0),s.processX(-x,0,!1,!0)):u?(i.processX(e,0,!0),s.processX(-e,0,!1,!0)):(i.processX(e,s.velocity.y,!0),s.processX(-e,null,!1,!0)))}return!0},e.RunImmovableBody1=t=>{1===t?s.velocity.x=0:v?s.processX(x,a,!0):s.processX(-x,a,!1,!0),i.moves&&(s.y+=(i.y-i.prev.y)*i.friction.y,s._dy=s.y-s.prev.y)},e.RunImmovableBody2=t=>{2===t?i.velocity.x=0:_?i.processX(x,l,!0):i.processX(-x,l,!1,!0),s.moves&&(i.y+=(s.y-s.prev.y)*s.friction.y,i._dy=i.y-i.prev.y)}},6907:(t,e)=>{"use strict";let i,s,o,r,n,h,l,a,u,c,d,f,y,p,v,_,x;Object.defineProperty(e,"__esModule",{value:!0}),e.RunImmovableBody2=e.RunImmovableBody1=e.Run=e.Check=e.BlockCheck=e.Set=void 0,e.Set=(t,n,h)=>{i=t,s=n;const g=i.velocity.y,m=s.velocity.y;return o=i.pushable,u=i._dy<0,c=i._dy>0,d=0===i._dy,v=Math.abs(i.bottom-s.y)<=Math.abs(s.bottom-i.y),l=m-g*i.bounce.y,r=s.pushable,f=s._dy<0,y=s._dy>0,p=0===s._dy,_=!v,a=g-m*s.bounce.y,x=Math.abs(h),(0,e.BlockCheck)()},e.BlockCheck=()=>c&&v&&s.blocked.down?(i.processY(-x,l,!1,!0),1):u&&_&&s.blocked.up?(i.processY(x,l,!0),1):y&&_&&i.blocked.down?(s.processY(-x,a,!1,!0),2):f&&v&&i.blocked.up?(s.processY(x,a,!0),2):0,e.Check=()=>{const t=i.velocity.y,o=s.velocity.y;let r=Math.sqrt(o*o*s.mass/i.mass)*(o>0?1:-1),l=Math.sqrt(t*t*i.mass/s.mass)*(t>0?1:-1);const a=.5*(r+l);return r-=a,l-=a,n=a+r*i.bounce.y,h=a+l*s.bounce.y,u&&_?(0,e.Run)(0):f&&v?(0,e.Run)(1):c&&v?(0,e.Run)(2):!(!y||!_)&&(0,e.Run)(3)},e.Run=t=>{if(o&&r)x*=.5,0===t||3===t?(i.processY(x,n),s.processY(-x,h)):(i.processY(-x,n),s.processY(x,h));else if(o&&!r)0===t||3===t?i.processY(x,l,!0):i.processY(-x,l,!1,!0);else if(!o&&r)0===t||3===t?s.processY(-x,a,!1,!0):s.processY(x,a,!0);else{const e=.5*x;0===t?p?(i.processY(x,0,!0),s.processY(0,null,!1,!0)):y?(i.processY(e,0,!0),s.processY(-e,0,!1,!0)):(i.processY(e,s.velocity.y,!0),s.processY(-e,null,!1,!0)):1===t?d?(i.processY(0,null,!1,!0),s.processY(x,0,!0)):c?(i.processY(-e,0,!1,!0),s.processY(e,0,!0)):(i.processY(-e,null,!1,!0),s.processY(e,i.velocity.y,!0)):2===t?p?(i.processY(-x,0,!1,!0),s.processY(0,null,!0)):f?(i.processY(-e,0,!1,!0),s.processY(e,0,!0)):(i.processY(-e,s.velocity.y,!1,!0),s.processY(e,null,!0)):3===t&&(d?(i.processY(0,null,!0),s.processY(-x,0,!1,!0)):u?(i.processY(e,0,!0),s.processY(-e,0,!1,!0)):(i.processY(e,s.velocity.y,!0),s.processY(-e,null,!1,!0)))}return!0},e.RunImmovableBody1=t=>{1===t?s.velocity.y=0:v?s.processY(x,a,!0):s.processY(-x,a,!1,!0),i.moves&&(s.x+=(i.x-i.prev.x)*i.friction.x,s._dx=s.x-s.prev.x)},e.RunImmovableBody2=t=>{2===t?i.velocity.y=0:_?i.processY(x,l,!0):i.processY(-x,l,!1,!0),s.moves&&(i.x+=(s.x-s.prev.x)*s.friction.x,i._dx=i.x-i.prev.x)}},8735:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(e,i);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,o)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.SeparateX=void 0;const n=i(2611),h=r(i(453));e.SeparateX=(t,e,i,s)=>{const o=(0,n.GetOverlapX)(t,e,i,s),r=t.immovable,l=e.immovable;if(i||0===o||r&&l||t.customSeparateX||e.customSeparateX)return 0!==o||t.embedded&&e.embedded;const a=h.Set(t,e,o);return r||l?(r?h.RunImmovableBody1(a):l&&h.RunImmovableBody2(a),!0):a>0||h.Check()}},2212:function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i);var o=Object.getOwnPropertyDescriptor(e,i);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,s,o)}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)"default"!==i&&Object.prototype.hasOwnProperty.call(t,i)&&s(e,t,i);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.SeparateY=void 0;const n=i(6154),h=r(i(6907));e.SeparateY=(t,e,i,s)=>{const o=(0,n.GetOverlapY)(t,e,i,s),r=t.immovable,l=e.immovable;if(i||0===o||r&&l||t.customSeparateY||e.customSeparateY)return 0!==o||t.embedded&&e.embedded;const a=h.Set(t,e,o);return r||l?(r?h.RunImmovableBody1(a):l&&h.RunImmovableBody2(a),!0):a>0||h.Check()}},4432:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.StaticBody=void 0;const o=s(i(3035)),r=s(i(6756)),n=s(i(9915)),h=i(9990);e.StaticBody=class{constructor(t,e,i,s=64,o=64){this.world=t,this.enable=!0,this.isCircle=!1,this.radius=0,this.offset=new h.Vector2,this._dx=0,this._dy=0,this.isBody=!0,this.debugShowBody=t.defaults.debugShowStaticBody,this.debugBodyColor=t.defaults.staticBodyDebugColor,this.position=new h.Vector2(e,i),this.width=s,this.height=o,this.halfWidth=Math.abs(this.width/2),this.halfHeight=Math.abs(this.height/2),this.center=new h.Vector2(this.position.x+this.halfWidth,this.position.y+this.halfHeight),this.velocity=h.Vector2.ZERO,this.allowGravity=!1,this.gravity=h.Vector2.ZERO,this.bounce=h.Vector2.ZERO,this.onWorldBounds=!1,this.onCollide=!1,this.onOverlap=!1,this.mass=1,this.immovable=!0,this.pushable=!1,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=n.default.PHYSICS_TYPE.STATIC_BODY,this._dx=0,this._dy=0}get minX(){return this.x}get minY(){return this.y}get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}preUpdate(){}update(){}setSize(t,e){return this.world.staticTree.remove(this),this.width=t,this.height=e,this.halfWidth=Math.floor(t/2),this.halfHeight=Math.floor(e/2),this.updateCenter(),this.isCircle=!1,this.radius=0,this.world.staticTree.insert(this),this}setCircle(t,e,i){return void 0===e&&(e=this.offset.x),void 0===i&&(i=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(e,i),this.updateCenter(),this.world.staticTree.insert(this)):this.isCircle=!1,this}updateCenter(){this.center.set(this.position.x+this.halfWidth,this.position.y+this.halfHeight)}reset(t,e){this.world.staticTree.remove(this),this.position.set(t,e),this.updateCenter(),this.world.staticTree.insert(this)}stop(){return this}getBounds(t){return t.x=this.x,t.y=this.y,t.right=this.right,t.bottom=this.bottom,t}hitTest(t,e){return this.isCircle?(0,o.default)(this,t,e):(0,r.default)(this,t,e)}postUpdate(){}deltaAbsX(){return 0}deltaAbsY(){return 0}deltaX(){return 0}deltaY(){return 0}deltaZ(){return 0}destroy(){this.enable=!1,this.world.pendingDestroy.add(this)}drawDebug(t){const e=this.position,i=e.x+this.halfWidth,s=e.y+this.halfHeight;var o;this.debugShowBody&&(t.beginPath(),1,o=this.debugBodyColor||255,t.lineWidth=1,t.strokeStyle=(t=>{let e=(255&(t>>>=0)).toString(16),i=((65280&t)>>>8).toString(16),s=((16711680&t)>>>16).toString(16);return"0"===e&&(e="00"),"0"===i&&(i="00"),"0"===s&&(s="00"),`#${e}${i}${s}`})(o),this.isCircle?((e,i,s)=>{t.arc(e,i,s,0,2*Math.PI)})(i,s,this.width/2):((e,i,s,o)=>{t.rect(e,i,s,o)})(e.x,e.y,this.width,this.height),t.stroke())}willDrawDebug(){return this.debugShowBody}setMass(t){return t<=0&&(t=.1),this.mass=t,this}get x(){return this.position.x}set x(t){this.world.staticTree.remove(this),this.position.x=t,this.world.staticTree.insert(this)}get y(){return this.position.y}set y(t){this.world.staticTree.remove(this),this.position.y=t,this.world.staticTree.insert(this)}get left(){return this.position.x}get right(){return this.position.x+this.width}get top(){return this.position.y}get bottom(){return this.position.y+this.height}}},7408:function(t,e,i){"use strict";var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0})