text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).rexpress=e()}(void 0,function(){function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function t(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function e(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&s(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c(n){var s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}();return function(){var t,e=a(n);if(s){var i=a(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return u(t)}(this,t)}}function l(){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(arguments.length<3?t:i):s.value}}).apply(this,arguments)}function r(t){return t instanceof f}function o(t){return null==t||"object"!==i(t)?null:r(t)?t:t.scene&&r(t.scene)?t.scene:t.parent&&t.parent.scene&&r(t.parent.scene)?t.parent.scene:void 0}var d={setEventEmitter:function(t,e){return void 0===e&&(e=Phaser.Events.EventEmitter),this._privateEE=!0===t||void 0===t,this._eventEmitter=this._privateEE?new e:t,this},destroyEventEmitter:function(){return this._eventEmitter&&this._privateEE&&this._eventEmitter.shutdown(),this},getEventEmitter:function(){return this._eventEmitter},on:function(){return this._eventEmitter&&this._eventEmitter.on.apply(this._eventEmitter,arguments),this},once:function(){return this._eventEmitter&&this._eventEmitter.once.apply(this._eventEmitter,arguments),this},off:function(){return this._eventEmitter&&this._eventEmitter.off.apply(this._eventEmitter,arguments),this},emit:function(t){return this._eventEmitter&&t&&this._eventEmitter.emit.apply(this._eventEmitter,arguments),this},addListener:function(){return this._eventEmitter&&this._eventEmitter.addListener.apply(this._eventEmitter,arguments),this},removeListener:function(){return this._eventEmitter&&this._eventEmitter.removeListener.apply(this._eventEmitter,arguments),this},removeAllListeners:function(){return this._eventEmitter&&this._eventEmitter.removeAllListeners.apply(this._eventEmitter,arguments),this},listenerCount:function(){return this._eventEmitter?this._eventEmitter.listenerCount.apply(this._eventEmitter,arguments):0},listeners:function(){return this._eventEmitter?this._eventEmitter.listeners.apply(this._eventEmitter,arguments):[]},eventNames:function(){return this._eventEmitter?this._eventEmitter.eventNames.apply(this._eventEmitter,arguments):[]}},f=Phaser.Scene,v=Phaser.Utils.Objects.GetValue,p=function(){function i(t,e){h(this,i),this.parent=t,this.scene=o(t),this.isShutdown=!1,this.setEventEmitter(v(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.sys.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return t(i,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.sys.events.off("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.off("destroy",this.onParentDestroy,this),this.destroyEventEmitter(),this.parent=void 0,this.scene=void 0,this.isShutdown=!0)}},{key:"destroy",value:function(t){this.shutdown(t)}},{key:"onSceneDestroy",value:function(){this.destroy(!0)}},{key:"onParentDestroy",value:function(t,e){this.destroy(e)}}]),i}();Object.assign(p.prototype,d);function y(t,e,i){if(t&&"number"!=typeof t){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;for(var n=e.split("."),s=t,r=i,o=0;o<n.length;o++){if(!s.hasOwnProperty(n[o])){r=i;break}r=s[n[o]],s=s[n[o]]}return r}return i}var g=Phaser.Utils.Objects.GetValue,m=function(){e(s,p);var n=c(s);function s(t,e){var i;return h(this,s),(i=n.call(this,t,e))._isRunning=!1,i.isPaused=!1,i.tickingState=!1,i.setTickingMode(g(e,"tickingMode",1)),i}return t(s,[{key:"boot",value:function(){2!==this.tickingMode||this.tickingState||this.startTicking()}},{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),this.tickingState&&this.stopTicking(),l(a(s.prototype),"shutdown",this).call(this,t))}},{key:"setTickingMode",value:function(t){"string"==typeof t&&(t=b[t]),this.tickingMode=t}},{key:"startTicking",value:function(){this.tickingState=!0}},{key:"stopTicking",value:function(){this.tickingState=!1}},{key:"isRunning",get:function(){return this._isRunning},set:function(t){this._isRunning!==t&&(this._isRunning=t,1===this.tickingMode&&t!=this.tickingState&&(t?this.startTicking():this.stopTicking()))}},{key:"start",value:function(){return this.isPaused=!1,this.isRunning=!0,this}},{key:"pause",value:function(){return this.isRunning&&(this.isPaused=!0,this.isRunning=!1),this}},{key:"resume",value:function(){return this.isPaused&&(this.isRunning=!0),this}},{key:"stop",value:function(){return this.isPaused=!1,this.isRunning=!1,this}},{key:"complete",value:function(){this.isPaused=!1,this.isRunning=!1,this.emit("complete",this.parent,this)}}]),s}(),b={no:0,lazy:1,always:2},k=Phaser.Utils.Objects.GetValue,E=function(){e(r,m);var s=c(r);function r(t,e){var i;h(this,r);var n=o(t);return n===t&&(t=void 0),((i=s.call(this,n,e)).gameObject=t)&&t.setInteractive(k(e,"inputConfig",void 0)),i._enable=void 0,i.resetFromJSON(e),i.boot(),i}return t(r,[{key:"resetFromJSON",value:function(t){return this.setEnable(k(t,"enable",!0)),this.setDetectBounds(),void 0===this.gameObject?this.setDetectBounds(k(t,"bounds",void 0)):this.setDetectBounds(),this.tracerState=S,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,this.isTouchingAnyObject=!1,this}},{key:"boot",value:function(){l(a(r.prototype),"boot",this).call(this),this.gameObject?this.gameObject.on("pointerdown",this.onPointerDown,this):this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(t){this.scene&&(this.gameObject||this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.gameObject=void 0,this.bounds=void 0,this.pointer=void 0,this.lastPointer=void 0,this.movedState=!1,l(a(r.prototype),"shutdown",this).call(this,t))}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"setDetectBounds",value:function(t){return this.bounds=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t,e){this.enable&&void 0===this.pointer&&(this.bounds&&!this.bounds.contains(t.x,t.y)||this.pointer===t||(this.pointer=t,this.lastPointer=t,this.movedState=!1,this.tracerState=w,void 0===this.gameObject&&(this.isTouchingAnyObject=0<e.length),this.onDragStart()))}},{key:"onPointerUp",value:function(t){this.enable&&(this.bounds&&!this.bounds.contains(t.x,t.y)||this.pointer!==t||(this.pointer=void 0,this.movedState=!1,this.tracerState=S,this.onDragEnd()))}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=this.pointer===t;!i&&e||(i&&!e?this.onPointerUp(t):(this.movedState||(this.movedState=t.x!==t.downX||t.y!==t.downY),this.movedState&&this.onDrag()))}}},{key:"dragCancel",value:function(){return this.tracerState===w&&this.onDragEnd(),this.pointer=void 0,this.tracerState=S,this}},{key:"onDragStart",value:function(){this.emit("dragstart",this)}},{key:"onDragEnd",value:function(){this.emit("dragend",this)}},{key:"onDrag",value:function(){this.emit("drag",this)}},{key:"preUpdate",value:function(){}},{key:"postUpdate",value:function(){}},{key:"startTicking",value:function(){l(a(r.prototype),"startTicking",this).call(this),this.scene.sys.events.on("preupdate",this.preUpdate,this),this.scene.sys.events.on("postupdate",this.postUpdate,this)}},{key:"stopTicking",value:function(){l(a(r.prototype),"stopTicking",this).call(this),this.scene&&(this.scene.sys.events.off("preupdate",this.preUpdate,this),this.scene.sys.events.off("postupdate",this.postUpdate,this))}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}},{key:"cancel",value:function(){return this.state=D,this}}]),r}(),S=0,w=1,D="IDLE",P=function(){function o(t){h(this,o);var e=y(t,"states",void 0);e&&this.addStates(e);var i=y(t,"extend",void 0);if(i)for(var n in i)this.hasOwnProperty(n)&&void 0!==this[n]||(this[n]=i[n]);var s=y(t,"eventEmitter",void 0),r=y(t,"EventEmitterClass",void 0);this.setEventEmitter(s,r),this._stateLock=!1,this.resetFromJSON(t)}return t(o,[{key:"shutdown",value:function(){this.destroyEventEmitter()}},{key:"destroy",value:function(){this.shutdown()}},{key:"resetFromJSON",value:function(t){this.setEnable(y(t,"enable",!0)),this.start(y(t,"start",void 0));var e=y(t,"init",void 0);return e&&e.call(this),this}},{key:"toJSON",value:function(){return{curState:this.state,prevState:this.prevState,enable:this.enable,start:this._start}}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"state",get:function(){return this._state},set:function(t){if(this.enable&&!this._stateLock&&this._state!==t){if(this._prevState=this._state,this._state=t,this._stateLock=!0,this.emit("statechange",this),null!=this._prevState){var e="exit_"+this._prevState,i=this[e];i&&i.call(this),this.emit(e,this)}if(this._stateLock=!1,null!=this._state){var n="enter_"+this._state,s=this[n];s&&s.call(this),this.emit(n,this)}}}},{key:"prevState",get:function(){return this._prevState}},{key:"start",value:function(t){return this._start=t,this._prevState=void 0,this._state=t,this}},{key:"goto",value:function(t){return null!=t&&(this.state=t),this}},{key:"next",value:function(){var t,e=this["next_"+this.state];return e&&(t="string"==typeof e?e:e.call(this)),this.goto(t),this}},{key:"addState",value:function(t,e){"string"!=typeof t&&(t=(e=t).name);var i=e.next;i&&(this["next_"+t]=i);var n=e.exit;n&&(this["exit_"+t]=n);var s=e.enter;return s&&(this["enter_"+t]=s),this}},{key:"addStates",value:function(t){if(Array.isArray(t))for(var e=0,i=t.length;e<i;e++)this.addState(t[e]);else for(var n in t)this.addState(n,t[n]);return this}},{key:"runMethod",value:function(t,e,i,n,s,r){var o=this[t+"_"+this.state];if(o){var h=arguments.length;switch(h){case 1:return o.call(this);case 2:return o.call(this,e);case 3:return o.call(this,e,i);case 4:return o.call(this,e,i,n);case 5:return o.call(this,e,i,n,s);case 6:return o.call(this,e,i,n,s,r)}for(var a=new Array(h-1),u=1;u<h;u++)a[u-1]=arguments[u];return o.apply(this,a)}}},{key:"update",value:function(t,e){this.runMethod("update",t,e)}},{key:"preupdate",value:function(t,e){this.runMethod("preupdate",t,e)}},{key:"postupdate",value:function(t,e){this.runMethod("postupdate",t,e)}}]),o}();Object.assign(P.prototype,d),Phaser.Utils.Objects.GetValue,Phaser.Math.Distance.Between;var _=Phaser.Utils.Objects.GetValue,O=function(){e(o,E);var r=c(o);function o(t,e){var i;h(this,o);var n=u(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.start()},exit:function(){n.stop()}},RECOGNIZED:{enter:function(){n.emit("pressstart",n,n.gameObject,n.lastPointer)},exit:function(){n.emit("pressend",n,n.gameObject,n.lastPointer)}}},init:function(){this.state=x},eventEmitter:!1};return i.setRecongizedStateObject(new P(s)),i}return t(o,[{key:"resetFromJSON",value:function(t){return l(a(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(_(t,"threshold",9)),this.setHoldTime(_(t,"time",251)),this}},{key:"onDragStart",value:function(){this.state=T,0===this.holdTime&&(this.state=j)}},{key:"onDragEnd",value:function(){this.state=x}},{key:"onDrag",value:function(){this.state!==x&&this.pointer.getDistance()>this.dragThreshold&&(this.state=x)}},{key:"preUpdate",value:function(t){this.isRunning&&this.enable&&this.state===T&&t-this.pointer.downTime>=this.holdTime&&(this.state=j)}},{key:"isPressed",get:function(){return this.state===j}},{key:"setHoldTime",value:function(t){return this.holdTime=t,this}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(),x="IDLE",T="BEGIN",j="RECOGNIZED";Phaser.Utils.Objects.GetValue;var R=Phaser.Math.Distance.Between,M=Phaser.Math.Angle.Between,N={getDt:function(){return this.scene.sys.game.loop.delta},getVelocity:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return R(e.x,e.y,t.x,t.y)/(.001*this.getDt())},getVelocityX:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.x-e.x)/(.001*this.getDt())},getVelocityY:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return Math.abs(t.y-e.y)/(.001*this.getDt())},getVelocityAngle:function(){var t=this.pointer.position,e=this.pointer.prevPosition;return M(e.x,e.y,t.x,t.y)}},U={"up&down":0,"left&right":1,"4dir":2,"8dir":3},A={},B=Phaser.Utils.Objects.GetValue,C=Phaser.Math.RadToDeg,V=function(){e(o,E);var r=c(o);function o(t,e){var i;h(this,o);var n=u(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.x=0,n.y=0,n.worldX=0,n.worldY=0},exit:function(){var t=n.lastPointer;n.x=t.x,n.y=t.y,n.worldX=t.worldX,n.worldY=t.worldY}},BEGIN:{enter:function(){n.validDrag=!1}},RECOGNIZED:{enter:function(){n.start(),n.updateDirectionStates(),n.emit("swipe",n,n.gameObject,n.lastPointer)},exit:function(){n.stop(),n.clearDirectionStates()}}},init:function(){this.state=I},eventEmitter:!1};return i.setRecongizedStateObject(new P(s)),i.clearDirectionStates(),i}return t(o,[{key:"resetFromJSON",value:function(t){return l(a(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(B(t,"threshold",10)),this.setVelocityThreshold(B(t,"velocityThreshold",1e3)),this.setDirectionMode(B(t,"dir","8dir")),this}},{key:"onDragStart",value:function(){this.state=L}},{key:"onDragEnd",value:function(){this.state=I}},{key:"onDrag",value:function(){this.state===L&&(this.validDrag||(this.validDrag=0===this.dragThreshold||this.pointer.getDistance()>=this.dragThreshold),this.validDrag&&this.dragVelocity>this.velocityThreshold&&(this.state=X))}},{key:"postUpdate",value:function(){this.isRunning&&this.enable&&this.state===X&&(this.state=I)}},{key:"isSwiped",get:function(){return this.state===X}},{key:"dragVelocity",get:function(){var t;switch(this.dirMode){case 0:t=this.getVelocityY();break;case 1:t=this.getVelocityX();break;default:t=this.getVelocity()}return t}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}},{key:"setVelocityThreshold",value:function(t){return this.velocityThreshold=t,this}},{key:"setDirectionMode",value:function(t){return"string"==typeof t&&(t=U[t]),this.dirMode=t,this}},{key:"updateDirectionStates",value:function(){return function(t,e,i){switch(void 0===i?i={}:!0===i&&(i=A),i.left=!1,i.right=!1,i.up=!1,i.down=!1,t=(t+360)%360,e){case 0:t<180?i.down=!0:i.up=!0;break;case 1:90<t&&t<=270?i.left=!0:i.right=!0;break;case 2:45<t&&t<=135?i.down=!0:135<t&&t<=225?i.left=!0:225<t&&t<=315?i.up=!0:i.right=!0;break;case 3:22.5<t&&t<=67.5?(i.down=!0,i.right=!0):67.5<t&&t<=112.5?i.down=!0:112.5<t&&t<=157.5?(i.down=!0,i.left=!0):157.5<t&&t<=202.5?i.left=!0:202.5<t&&t<=247.5?(i.left=!0,i.up=!0):247.5<t&&t<=292.5?i.up=!0:(292.5<t&&t<=337.5&&(i.up=!0),i.right=!0)}}(C(this.getVelocityAngle()),this.dirMode,this),this}},{key:"clearDirectionStates",value:function(){return this.left=!1,this.right=!1,this.up=!1,this.down=!1,this}}]),o}();Object.assign(V.prototype,N);function G(t){if("object"!==i(t)||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t}var I="IDLE",L="BEGIN",X="RECOGNIZED",Y=Phaser.Utils.Objects.GetValue,J=Phaser.Utils.Array.SpliceOne,z=Phaser.Math.Distance.Between,F=Phaser.Math.Angle.Between,Z=function(){function n(t,e){h(this,n);var i=t.input.manager.pointersTotal-1;i<2&&t.input.addPointer(2-i),this.scene=t,this.setEventEmitter(Y(e,"eventEmitter",void 0)),this._enable=void 0,this.pointers=[],this.movedState={},this.resetFromJSON(e),this.boot()}return t(n,[{key:"resetFromJSON",value:function(t){return this.setEnable(Y(t,"enable",!0)),this.bounds=Y(t,"bounds",void 0),this.tracerState=W,this.pointers.length=0,G(this.movedState),this}},{key:"boot",value:function(){this.scene.input.on("pointerdown",this.onPointerDown,this),this.scene.input.on("pointerup",this.onPointerUp,this),this.scene.input.on("pointermove",this.onPointerMove,this),this.scene.sys.events.once("shutdown",this.destroy,this)}},{key:"shutdown",value:function(){this.scene&&(this.destroyEventEmitter(),this.pointers.length=0,G(this.movedState),this.scene.input.off("pointerdown",this.onPointerDown,this),this.scene.input.off("pointerup",this.onPointerUp,this),this.scene.input.off("pointermove",this.onPointerMove,this),this.scene.sys.events.off("shutdown",this.destroy,this),this.scene=void 0)}},{key:"destroy",value:function(){this.shutdown()}},{key:"enable",get:function(){return this._enable},set:function(t){if(this._enable!==t)return t||this.dragCancel(),this._enable=t,this}},{key:"setEnable",value:function(t){return void 0===t&&(t=!0),this.enable=t,this}},{key:"toggleEnable",value:function(){return this.setEnable(!this.enable),this}},{key:"onPointerDown",value:function(t){if(this.enable&&(2!==this.pointers.length&&(!this.bounds||this.bounds.contains(t.x,t.y))&&-1===this.pointers.indexOf(t)))switch(this.movedState[t.id]=!1,this.pointers.push(t),this.tracerState){case W:this.tracerState=q,this.onDrag1Start();break;case q:this.tracerState=K,this.onDrag2Start()}}},{key:"onPointerUp",value:function(t){if(this.enable&&(!this.bounds||this.bounds.contains(t.x,t.y))){var e=this.pointers.indexOf(t);if(-1!==e)switch(delete this.movedState[t.id],J(this.pointers,e),this.tracerState){case q:this.tracerState=W,this.onDrag1End();break;case K:this.tracerState=q,this.onDrag2End(),this.onDrag1Start()}}}},{key:"onPointerMove",value:function(t){if(this.enable&&t.isDown){var e=!this.bounds||this.bounds.contains(t.x,t.y),i=-1!==this.pointers.indexOf(t);if(i||!e)if(i&&!e)this.onPointerUp(t);else if(this.movedState[t.id]||(this.movedState[t.id]=t.x!==t.downX||t.y!==t.downY),this.movedState[t.id])switch(this.tracerState){case q:this.onDrag1();break;case K:this.onDrag2()}}}},{key:"dragCancel",value:function(){return this.tracerState===K&&this.onDrag2End(),this.pointers.length=0,G(this.movedState),this.tracerState=W,this}},{key:"onDrag1Start",value:function(){this.emit("drag1start",this)}},{key:"onDrag1End",value:function(){this.emit("drag1end",this)}},{key:"onDrag1",value:function(){this.emit("drag1",this)}},{key:"onDrag2Start",value:function(){this.emit("drag2start",this)}},{key:"onDrag2End",value:function(){this.emit("drag2end",this)}},{key:"onDrag2",value:function(){this.emit("drag2",this)}},{key:"distanceBetween",get:function(){if(this.tracerState!==K)return 0;var t=this.pointers[0],e=this.pointers[1];return z(t.x,t.y,e.x,e.y)}},{key:"angleBetween",get:function(){if(this.tracerState!==K)return 0;var t=this.pointers[0],e=this.pointers[1];return F(t.x,t.y,e.x,e.y)}},{key:"drag1Vector",get:function(){var t=this.pointers[0];if(t&&this.movedState[t.id]){var e=t.position,i=t.prevPosition;H.x=e.x-i.x,H.y=e.y-i.y}else H.x=0,H.y=0;return H}},{key:"centerX",get:function(){if(this.tracerState!==K)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.x+e.x)/2}},{key:"centerY",get:function(){if(this.tracerState!==K)return 0;var t=this.pointers[0].position,e=this.pointers[1].position;return(t.y+e.y)/2}},{key:"prevCenterX",get:function(){if(this.tracerState!==K)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.x+e.x)/2}},{key:"prevCenterY",get:function(){if(this.tracerState!==K)return 0;var t=this.movedState[this.pointers[0].id]?this.pointers[0].prevPosition:this.pointers[0].position,e=this.movedState[this.pointers[1].id]?this.pointers[1].prevPosition:this.pointers[1].position;return(t.y+e.y)/2}},{key:"movementCenterX",get:function(){return this.centerX-this.prevCenterX}},{key:"movementCenterY",get:function(){return this.centerY-this.prevCenterY}},{key:"setRecongizedStateObject",value:function(t){return this.recongizedState=t,this}},{key:"state",get:function(){return this.recongizedState.state},set:function(t){this.recongizedState.state=t}},{key:"cancel",value:function(){return this.state=Q,this}}]),n}();Object.assign(Z.prototype,d);var H={},W=0,q=1,K=2,Q="IDLE";Phaser.Utils.Objects.GetValue;function $(t,e,i,n){return tt(t,e,i,n),t.rotation+=n,t}var tt=Phaser.Math.RotateAround,et={},it=Phaser.Utils.Objects.GetValue,nt=Phaser.Math.Angle.WrapDegrees,st=Phaser.Math.Angle.ShortestBetween,rt=Phaser.Math.RadToDeg,ot=Phaser.Math.DegToRad,ht=function(){e(o,Z);var r=c(o);function o(t,e){var i;h(this,o);var n=u(i=r.call(this,t,e)),s={states:{IDLE:{enter:function(){n.prevAngle=void 0,n.angle=0}},BEGIN:{},RECOGNIZED:{enter:function(){n.emit("rotatestart",n)},exit:function(){n.emit("rotateend",n)}}},init:function(){this.state=ut},eventEmitter:!1};return i.setRecongizedStateObject(new P(s)),i}return t(o,[{key:"resetFromJSON",value:function(t){return l(a(o.prototype),"resetFromJSON",this).call(this,t),this.setDragThreshold(it(t,"threshold",0)),this}},{key:"onDrag2Start",value:function(){this.prevAngle=nt(rt(this.angleBetween)),this.state=ct,0===this.dragThreshold&&(this.state=lt)}},{key:"onDrag2End",value:function(){this.state=ut}},{key:"onDrag2",value:function(){switch(this.state){case ct:if(this.pointers[0].getDistance()>=this.dragThreshold&&this.pointers[1].getDistance()>=this.dragThreshold){var t=nt(rt(this.angleBetween));this.angle=st(this.prevAngle,t),this.prevAngle=t,this.state=lt}break;case lt:t=nt(rt(this.angleBetween));this.angle=st(this.prevAngle,t),this.prevAngle=t,this.emit("rotate",this)}}},{key:"isRotated",get:function(){return this.state===lt}},{key:"rotation",get:function(){return ot(this.angle)}},{key:"setDragThreshold",value:function(t){return this.dragThreshold=t,this}}]),o}(),at={spinObject:function(t,e){if(!this.isRotation)return this;void 0===e&&(e=this.pointers[0].camera);var i,n,s,r=this.movementCenterX,o=this.movementCenterY,h=(i=this.centerX,n=this.centerY,void 0===(s=!0)?s={}:!0===s&&(s=et),e.getWorldPoint(i,n,s),s),a=h.x,u=h.y,c=this.rotation;if(Array.isArray(t))for(var l=t,d=0,f=l.length;d<f;d++)(t=l[d]).x+=r,t.y+=o,$(t,a,u,c);else t.x+=r,t.y+=o,$(t,a,u,c);return this}};Object.assign(ht.prototype,at);var ut="IDLE",ct="BEGIN",lt="RECOGNIZED";return O});
  