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).rexlosspinner=e()}(this,function(){"use strict";function s(t){return(s="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 c(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 a(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),t}function t(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}}),e&&i(t,e)}function o(t){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function i(t,e){return(i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(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 function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(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=o(n);if(s){var i=o(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return r(this,t)}}function u(t,e,i){return(u="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=o(t)););return t}(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(i):s.value}})(t,e,i||t)}var e=Phaser.GameObjects.Components.TransformMatrix,k=new e,_=new e,E=new e,w={camera:k,sprite:_,calc:E},l=Phaser.Renderer.Canvas.SetTransform,h={renderWebGL:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s,r,h,o,a,u,l=t.pipelines.set(e.pipeline),c=(s=e,r=i,h=n,o=k,u=E,(a=_).applyITRS(s.x,s.y,s.rotation,s.scaleX,s.scaleY),o.copyFrom(r.matrix),h?(o.multiplyWithOffset(h,-r.scrollX*s.scrollFactorX,-r.scrollY*s.scrollFactorY),a.e=s.x,a.f=s.y):(a.e-=r.scrollX*s.scrollFactorX,a.f-=r.scrollY*s.scrollFactorY),o.multiply(a,u),w),f=l.calcMatrix.copyFrom(c.calc),p=e._displayOriginX,v=e._displayOriginY,d=i.alpha*e.alpha;t.pipelines.preBatch(e);for(var y=e.geom,m=0,g=y.length;m<g;m++)y[m].webglRender(l,f,d,p,v);t.pipelines.postBatch(e)},renderCanvas:function(t,e,i,n){e.updateData(),i.addToRenderList(e);var s=t.currentContext;if(l(t,s,e,i,n)){for(var r=e._displayOriginX,h=e._displayOriginY,o=e.geom,a=0,u=o.length;a<u;a++)o[a].canvasRender(s,r,h);s.restore()}}},p=Phaser.GameObjects.Shape,v=Phaser.Utils.Array.Remove,d=function(){t(o,p);var h=f(o);function o(t,e,i,n,s){var r;return c(this,o),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=n),(r=h.call(this,t,"rexShapes",[]))._width=-1,r._height=-1,r.dirty=!0,r.isSizeChanged=!0,r.shapes={},r.setPosition(e,i),r.setSize(n,s),r.updateDisplayOrigin(),r}return a(o,[{key:"width",get:function(){return this._width},set:function(t){this.setSize(t,this._height)}},{key:"height",get:function(){return this._height},set:function(t){this.setSize(this._width,t)}},{key:"setDirty",value:function(t){return void 0===t&&(t=!0),this.dirty=t,this}},{key:"setSize",value:function(t,e){this.isSizeChanged=this.isSizeChanged||this._width!==t||this._height!==e,this.dirty=this.dirty||this.isSizeChanged,this._width=t,this._height=e,this.updateDisplayOrigin();var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}},{key:"resize",value:function(t,e){return this.setSize(t,e),this}},{key:"updateShapes",value:function(){}},{key:"updateData",value:function(){if(!this.dirty)return this;this.updateShapes();for(var t=this.geom,e=0,i=t.length;e<i;e++){var n=t[e];n.dirty&&n.updateData()}return this.dirty=!1,this.isSizeChanged=!1,this}},{key:"clear",value:function(){return this.geom.length=0,function(t){if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e]}(this.shapes),this}},{key:"getShape",value:function(t){return this.shapes[t]}},{key:"getShapes",value:function(){return this.geom}},{key:"addShape",value:function(t){this.geom.push(t);var e=t.name;return e&&(this.shapes[e]=t),this.dirty=!0,this}},{key:"deleteShape",value:function(t){var e=this.getShape(t);return e&&(delete this.shapes[t],v(this.geom,e)),this}}]),o}();Object.assign(d.prototype,h);function y(t){return t instanceof g}var m={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):[]}},g=Phaser.Scene,S=Phaser.Utils.Objects.GetValue,b=function(){function n(t,e){var i;c(this,n),this.parent=t,this.scene=null==(i=t)||"object"!==s(i)?null:y(i)?i:i.scene&&y(i.scene)?i.scene:i.parent&&i.parent.scene&&y(i.parent.scene)?i.parent.scene:void 0,this.isShutdown=!1,this.setEventEmitter(S(e,"eventEmitter",!0)),this.parent&&this.parent===this.scene?this.scene.events.once("shutdown",this.onSceneDestroy,this):this.parent&&this.parent.once&&this.parent.once("destroy",this.onParentDestroy,this)}return a(n,[{key:"shutdown",value:function(){this.isShutdown||(this.parent&&this.parent===this.scene?this.scene.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)}}]),n}();Object.assign(b.prototype,m);var P=function(){t(n,b);var i=f(n);function n(t,e){return c(this,n),void 0===e&&(e={}),e.hasOwnProperty("eventEmitter")||(e.eventEmitter=!1),i.call(this,t,e)}return a(n,[{key:"shutdown",value:function(t){this.isShutdown||(this.stop(),u(o(n.prototype),"shutdown",this).call(this,t))}},{key:"start",value:function(t){return this.isRunning||(this.tween=this.scene.tweens.add(t).on("complete",this.complete,this),!1===this.getEventEmitter()&&this.setEventEmitter(this.tween)),this}},{key:"restart",value:function(t){return this.stop().start(t),this}},{key:"stop",value:function(){return this.tween&&(this.getEventEmitter()===this.tween&&this.setEventEmitter(!1),this.tween.remove(),this.tween=void 0),this}},{key:"pause",value:function(){return this.tween&&this.tween.pause(),this}},{key:"resume",value:function(){return this.tween&&this.tween.resume(),this}},{key:"complete",value:function(){return this.stop(),this.getEventEmitter()&&this.emit("complete"),this}},{key:"isRunning",get:function(){return!!this.tween}}]),n}(),D={start:function(t){return this.tweenTask||(this.tweenTask=new P(this)),void 0!==t&&(this.duration=t,this.tweenTask.stop()),this.tweenTask.isRunning||(this.setValue(0),this.tweenTask.start({targets:this,value:1,ease:this.ease,duration:this.duration,repeat:-1,yoyo:!1}),this.setDirty()),this},stop:function(){return this.tweenTask&&(this.tweenTask.stop(),this.setDirty()),this},pause:function(){return this.tweenTask&&(this.tweenTask.pause(),this.setDirty()),this},resume:function(){return this.tweenTask&&(this.tweenTask.pause(),this.setDirty()),this}},R=Phaser.Utils.Objects.GetValue,T=function(){t(l,d);var u=f(l);function l(t,e){var i;c(this,l);var n=R(e,"x",0),s=R(e,"y",0),r=R(e,"width",64),h=R(e,"height",64);(i=u.call(this,t,n,s,r,h)).setDuration(R(e,"duration",1e3)),i.setEase(R(e,"ease","Linear"));var o=R(e,"color",16777215),a=R(e,"start",!0);return i.buildShapes(e),i.setColor(o),i.setValue(0),a&&i.start(),i}return a(l,[{key:"buildShapes",value:function(){}},{key:"centerX",get:function(){return this.width/2}},{key:"centerY",get:function(){return this.height/2}},{key:"radius",get:function(){return Math.min(this.centerX,this.centerY)}},{key:"color",get:function(){return this._color},set:function(t){this.dirty=this.dirty||this._color!==t,this._color=t,this.setShapesColor(t)}},{key:"setColor",value:function(t){return this.color=t,this}},{key:"setShapesColor",value:function(){}},{key:"value",get:function(){return this._value},set:function(t){t=Phaser.Math.Clamp(t,0,1),this.dirty=this.dirty||this._value!=t,this._value=t}},{key:"setValue",value:function(t){return this.value=t,this}},{key:"setDuration",value:function(t){return this.duration=t,this}},{key:"setEase",value:function(t){return this.ease=t,this}},{key:"isRunning",get:function(){return!!this.tweenTask&&this.tweenTask.isRunning}}]),l}();Object.assign(T.prototype,D);var O={fillStyle:function(t,e){return void 0===t?this.isFilled=!1:(void 0===e&&(e=1),this.isFilled=!0,this.fillColor=t,this.fillAlpha=e),this},lineStyle:function(t,e,i){return void 0===t||void 0===e?this.isStroked=!1:(void 0===i&&(i=1),this.isStroked=!0,this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i),this}},x={setData:function(t,e){return void 0===this.data&&(this.data={}),this.data[t]=e,this},getData:function(t,e){return void 0===this.data&&(this.data={}),this.data.hasOwnProperty(t)||(this.data[t]=e),this.data[t]}},C=function(){function t(){c(this,t),this.name=void 0,this.dirty=!0,this.data=void 0,this.isFilled=!1,this.fillColor=void 0,this.fillAlpha=1,this.isStroked=!1,this.lineWidth=1,this.strokeColor=void 0,this.strokeAlpha=1}return a(t,[{key:"setName",value:function(t){return this.name=t,this}},{key:"reset",value:function(){return this.fillStyle(),this.lineStyle(),this}},{key:"webglRender",value:function(){}},{key:"canvasRender",value:function(){}},{key:"updateData",value:function(){}}]),t}();Object.assign(C.prototype,O,x);var A=Phaser.Renderer.WebGL.Utils,j=Phaser.Renderer.WebGL.Utils,L=Phaser.Geom.Polygon.Earcut,M=function(){t(i,C);var e=f(i);function i(){var t;return c(this,i),(t=e.call(this)).pathData=[],t.pathIndexes=[],t.closePath=!1,t}return a(i,[{key:"updateData",value:function(){return this.pathIndexes=L(this.pathData),this}},{key:"webglRender",value:function(t,e,i,n,s){this.isFilled&&function(t,e,i,n,s,r){for(var h=A.getTintAppendFloatAlpha(i.fillColor,i.fillAlpha*n),o=i.pathData,a=i.pathIndexes,u=0;u<a.length;u+=3){var l=2*a[u],c=2*a[u+1],f=2*a[u+2],p=o[0+l]-s,v=o[1+l]-r,d=o[0+c]-s,y=o[1+c]-r,m=o[0+f]-s,g=o[1+f]-r,k=e.getX(p,v),_=e.getY(p,v),E=e.getX(d,y),w=e.getY(d,y),S=e.getX(m,g),b=e.getY(m,g);t.batchTri(i,k,_,E,w,S,b,0,0,1,1,h,h,h,2)}}(t,e,this,i,n,s),this.isStroked&&function(t,e,i,n,s){var r=t.strokeTint,h=j.getTintAppendFloatAlpha(e.strokeColor,e.strokeAlpha*i);r.TL=h,r.TR=h,r.BL=h,r.BR=h;var o=e.pathData,a=o.length-1,u=e.lineWidth,l=u/2,c=o[0]-n,f=o[1]-s;e.closePath||(a-=2);for(var p=2;p<a;p+=2){var v=o[p]-n,d=o[p+1]-s;t.batchLine(c,f,v,d,l,l,u,p-2,!!e.closePath&&p===a-1),c=v,f=d}}(t,this,i,n,s)}},{key:"canvasRender",value:function(t,e,i){var n,s,r,h,o,a,u,l,c,f,p,v,d,y,m,g,k,_,E=this.pathData,w=E.length-1,S=E[0]-e,b=E[1]-i;t.beginPath(),t.moveTo(S,b),this.closePath||(w-=2);for(var P=2;P<w;P+=2){var D=E[P]-e,R=E[P+1]-i;t.lineTo(D,R)}this.closePath&&t.closePath(),this.isFilled&&(n=t,s=this,o=r||s.fillColor,a=h||s.fillAlpha,u=(16711680&o)>>>16,l=(65280&o)>>>8,c=255&o,n.fillStyle="rgba("+u+","+l+","+c+","+a+")",t.fill()),this.isStroked&&(f=t,p=this,y=v||p.strokeColor,m=d||p.strokeAlpha,g=(16711680&y)>>>16,k=(65280&y)>>>8,_=255&y,f.strokeStyle="rgba("+g+","+k+","+_+","+m+")",f.lineWidth=p.lineWidth,t.stroke())}}]),i}();Phaser.Math.DegToRad,Phaser.Math.DegToRad;var X=function(){t(h,M);var r=f(h);function h(t,e,i,n){var s;return c(this,h),void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),(s=r.call(this)).setP0(t,e),s.setP1(i,n),s}return a(h,[{key:"x0",get:function(){return this._x0},set:function(t){this.dirty=this.dirty||this._x0!==t,this._x0=t}},{key:"y0",get:function(){return this._y0},set:function(t){this.dirty=this.dirty||this._y0!==t,this._y0=t}},{key:"setP0",value:function(t,e){return this.x0=t,this.y0=e,this}},{key:"x1",get:function(){return this._x1},set:function(t){this.dirty=this.dirty||this._x1!==t,this._x1=t}},{key:"y1",get:function(){return this._y1},set:function(t){this.dirty=this.dirty||this._y1!==t,this._y1=t}},{key:"setP1",value:function(t,e){return this.x1=t,this.y1=e,this}},{key:"updateData",value:function(){return this.pathData.length=0,this.pathData.push(this.x0,this.y0),this.pathData.push(this.x1,this.y1),this.pathData.push(this.x0,this.y0),u(o(h.prototype),"updateData",this).call(this),this}}]),h}();Phaser.Math.Interpolation.QuadraticBezier,Phaser.Math.RotateAround,Phaser.Geom.Polygon,Phaser.Math.DegToRad,Phaser.Math.Distance.Between,Phaser.Math.Linear,Phaser.Renderer.WebGL.Utils,Phaser.Renderer.WebGL.Utils;var Y=Phaser.Math.Linear;return function(){t(s,T);var n=f(s);function s(t,e){var i;return c(this,s),(i=n.call(this,t,e)).type="rexSpinnerLos",i}return a(s,[{key:"buildShapes",value:function(){for(var t=0;t<12;t++)this.addShape(new X)}},{key:"updateShapes",value:function(){for(var t=this.centerX,e=this.centerY,i=this.prevCenterX!==t||this.prevCenterY!==e,n=this.radius,s=n/2,r=Math.ceil(n/20),h=this.getShapes(),o=0,a=h.length;o<a;o++){var u=h[o],l=o/a,c=2*Math.PI*l,f=Y(.25,1,(1-this.value+l)%1);u.lineStyle(r,this.color,f),i&&u.setP0(t+Math.cos(c)*s,e+Math.sin(c)*s).setP1(t+Math.cos(c)*n,e+Math.sin(c)*n)}this.prevCenterX=t,this.prevCenterY=e}}]),s}()});
  