UNPKG

phaser4-rex-plugins

Version:
1 lines 866 kB
var t,e;t=void 0,e=function(){class t{constructor(t){this.scene=t,t.events.once("destroy",this.destroy,this)}destroy(){this.scene=null}static register(e,i){t.prototype[e]=i}}var e=function(t,e,i){return"__BASE"===i?`${t},${e}`:`${i}:${t},${e}`};function i(t){if(null===t||"object"!=typeof t)return t;if(Array.isArray(t))return t.map((t=>i(t)));if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(Object.getPrototypeOf(t)!==Object.prototype)return t;const e={};for(let s in t)t.hasOwnProperty(s)&&(e[s]=i(t[s]));return e}const s=Phaser.Utils.Objects.IsPlainObject,r=Phaser.Utils.Objects.GetValue;var n=function(t){return"string"==typeof t&&(t=a[t]),t};const a={scale:0,repeat:1};var o=function(t,e){return 0===t||t===this.columns.count-1||0===e||e===this.rows.count-1},h=function(){},l={_beginDraw:h,_drawImage:h,_drawTileSprite:h,_endDraw:h,setGetFrameNameCallback:function(t){return void 0===t&&(t=e),this.getFrameNameCallback=t,this},setBaseTexture:function(t,e,s,r){Array.isArray(e)&&(r=s,s=e,e=void 0),null==e&&(e="__BASE"),"number"==typeof s&&arguments.length>=6?(s=[arguments[2],void 0,arguments[3]],r=[arguments[4],void 0,arguments[5]]):void 0===s&&void 0===r&&void 0!==this.columns.data&&void 0!==this.rows.data?(s=this.columns.data,r=this.rows.data):(s=i(s),r=i(r)),this.textureKey=t,this.baseFrameName=e,this.columns.data=s,this.columns.count=s?s.length:0,this.columns.stretch=0,this.columns.minWidth=0,this.columns.scale=1,this.rows.data=r,this.rows.count=r?r.length:0,this.rows.stretch=0,this.rows.minHeight=0,this.rows.scale=1;var n=this.scene.sys.textures.get(t);if(!n)return this.clear(),this;if(!s||!r)return this.clear(),this;for(var a=n.get(e),o=a.width,h=0,l=0,d=s.length;l<d;l++)void 0===s[l]?h++:"number"==typeof s[l]?o-=s[l]:o-=s[l].width;var c=h>0?o/h:0,u=a.height,p=0;for(l=0,d=r.length;l<d;l++)void 0===r[l]?p++:"number"==typeof r[l]?u-=r[l]:u-=r[l].width;for(var g,v,f,m,y,b=p?u/p:0,x=0,C=0,w=0,S=r.length;w<S;w++){void 0===r[w]&&(r[w]=b),"number"==typeof r[w]&&(r[w]={height:r[w],stretch:w%2}),f=(g=r[w]).height,this.rows.stretch+=0|g.stretch,this.rows.minHeight+=g.stretch>0?0:f,x=0,l=0;for(var k=s.length;l<k;l++){if(void 0===s[l]&&(s[l]=c),"number"==typeof s[l]&&(s[l]={width:s[l],stretch:l%2}),m=(v=s[l]).width,0===w&&(this.columns.stretch+=0|v.stretch,this.columns.minWidth+=v.stretch>0?0:m),m>=1&&f>=1){var T=typeof(y=this.getFrameNameCallback(l,w,e));"string"!==T&&"number"!==T||n.add(y,0,x+a.cutX,C+a.cutY,m,f)}x+=m}C+=f}return this.updateTexture(),this},updateTexture:function(){if(this.clear(),void 0===this.textureKey)return this;var t=this.scene.sys.textures.get(this.textureKey);if(!t)return this;var e,i,s,r,n,a,o,h=this.columns.minWidth*this.maxFixedPartScaleX,l=this.rows.minHeight*this.maxFixedPartScaleY,d=this.width-h,c=this.height-l,u=d>=0?this.maxFixedPartScaleX:this.width/h,p=c>=0?this.maxFixedPartScaleY:this.height/l;if(this.preserveRatio){var g=Math.min(u,p);if(u>g){var v=(u-g)*h;d>=0?d+=v:d=v,u=g}if(p>g){var f=(p-g)*l;c>=0?c+=f:c=f,p=g}}this.columns.scale=u,this.rows.scale=p,e=d>0&&this.columns.stretch>0?d/this.columns.stretch:0,i=c>0&&this.rows.stretch>0?c/this.rows.stretch:0;var m=0,y=0;this._beginDraw();for(var b=0,x=this.rows.count;b<x;b++){o=0===(n=this.rows.data[b]).stretch?n.height*p:i*n.stretch,m=0;for(var C=0,w=this.columns.count;C<w;C++)a=0===(r=this.columns.data[C]).stretch?r.width*u:e*r.stretch,s=this.getFrameNameCallback(C,b,this.baseFrameName),t.has(s)&&a>0&&o>0&&(0==(0===n.stretch&&0===r.stretch||0===this.getStretchMode(C,b)?0:1)?this._drawImage(this.textureKey,s,m,y,a,o):this._drawTileSprite(this.textureKey,s,m,y,a,o)),m+=a;y+=o}this._endDraw()},setStretchMode:function(t){return s(t)?(this.stretchMode.edge=n(r(t,"edge",0)),this.stretchMode.internal=n(r(t,"internal",0))):(t=n(t),this.stretchMode.edge=t,this.stretchMode.internal=t),this},getStretchMode:function(t,e){return o.call(this,t,e)?this.stretchMode.edge:this.stretchMode.internal},setPreserveRatio:function(t){return null==t&&(t=!0),this.preserveRatio=t,this},setMaxFixedPartScale:function(t,e){return void 0===e&&(e=t),this.maxFixedPartScaleX=t,this.maxFixedPartScaleY=e,this}};const d=Phaser.Utils.Objects.IsPlainObject,c=Phaser.Utils.Objects.GetValue;var u=function(t,e){class i extends t{constructor(t,i,s,r,n,a,o,h,l,u){if(d(i)?(i=c(u=i,"x",0),s=c(u,"y",0),r=c(u,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(r)?(r=c(u=r,"width",1),n=c(u,"height",1),a=c(u,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(a)?(a=c(u=a,"key",void 0),o=c(u,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):d(o)?(o=c(u=o,"baseFrame",void 0),h=c(u,"columns",void 0),l=c(u,"rows",void 0)):Array.isArray(o)?(u=l,l=h,h=o,o=c(u,"baseFrame",void 0)):d(h)&&(h=c(u=h,"columns",void 0),l=c(u,"rows",void 0)),void 0===o&&(o=c(u,"frame",void 0)),void 0===h){var p=c(u,"leftWidth",void 0),g=c(u,"rightWidth",void 0);void 0!==p&&void 0!==g&&(h=[p,void 0,g])}if(void 0===l){var v=c(u,"topHeight",void 0),f=c(u,"bottomHeight",void 0);void 0!==v&&void 0!==f&&(l=[v,void 0,f])}super(t),this.type=e,this.setPosition(i,s).setSize(r,n).setOrigin(.5,.5),this.columns={},this.rows={},this.stretchMode={},this._tileSprite=void 0,this._image=void 0,this.setGetFrameNameCallback(c(u,"getFrameNameCallback",void 0)),this.setStretchMode(c(u,"stretchMode",0)),this.setPreserveRatio(c(u,"preserveRatio",!0));var m=c(u,"maxFixedPartScale",1),y=c(u,"maxFixedPartScaleX",m),b=c(u,"maxFixedPartScaleY",void 0);this.setMaxFixedPartScale(y,b),this.setBaseTexture(a,o,h,l)}get minWidth(){return this.columns.minWidth}get minHeight(){return this.rows.minHeight}get fixedPartScaleX(){return this.columns.scale}get fixedPartScaleY(){return this.rows.scale}resize(t,e){return this.width===t&&this.height===e||(super.resize?super.resize(t,e):super.setSize(t,e),this.updateTexture()),this}get leftWidth(){return this.columns.data[0]}get rightWidth(){return this.columns.data[this.columns.count-1]}get topHeight(){return this.rows.data[0]}get bottomHeight(){return this.rows.data[this.rows.count-1]}}return Object.assign(i.prototype,l),i};const p=Phaser.Game;var g=function(t){return t instanceof p};const v=Phaser.Scene;var f=function(t){return t instanceof v},m=function(t){return null==t||"object"!=typeof t?null:g(t)?t:g(t.game)?t.game:f(t)?t.sys.game:f(t.scene)?t.scene.sys.game:void 0};const y=Phaser.GameObjects;var b=void 0,x=function(t,e){if(b||(b={},m(t).events.once("destroy",(function(){for(var t in b)b[t].destroy();b=void 0}))),!b.hasOwnProperty(e)){var i=m(t).scene.systemScene;(t=new y[e](i)).setOrigin(0),b[e]=t}return b[e]};const C=Phaser.GameObjects.RenderTexture;let w=class extends(u(C,"rexNinePatch")){};var S={_drawImage:function(t,e,i,s,r,n){var a=x(this,"Image").setTexture(t,e).setDisplaySize(r,n);this.draw(a,i,s).render()},_drawTileSprite:function(t,e,i,s,r,n){var a=x(this,"TileSprite").setTexture(t,e).setSize(r,n);this.draw(a,i,s).render()}};Object.assign(w.prototype,S);var k=function(t){return null==t||""===t||0===t.length},T=function(t,e,i,s){if(void 0===s&&(s="."),"object"==typeof t){if(k(e)){if(null==i)return;"object"==typeof i&&(t=i)}else{"string"==typeof e&&(e=e.split(s));var r=e.pop(),n=function(t,e,i){var s=t;if(k(e));else{var r;"string"==typeof e&&(e=e.split("."));for(var n=0,a=e.length;n<a;n++){var o;null!=s[r=e[n]]&&"object"==typeof s[r]||(o=n===a-1?void 0===i?{}:i:{},s[r]=o),s=s[r]}}return s}(t,e);n[r]=i}return t}};t.register("ninePatch",(function(t,e,i,s,r,n,a,o){var h=new w(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),T(window,"RexPlugins.UI.NinePatch",w);const P=Phaser.GameObjects.GetCalcMatrix;var O=new(0,Phaser.GameObjects.Components.TransformMatrix);const M=Phaser.Renderer.Canvas.SetTransform;var E={renderWebGL:function(t,e,i,s){var r=e.getRenderList(),n=i.camera;if(0!==r.length&&0!==h)for(var a=P(e,n,s,!i.useCanvas),o=O.copyFrom(a.calc),h=n.alpha*e.alpha,l=e._displayOriginX,d=e._displayOriginY,c=e.customRenderNodes,u=e.defaultRenderNodes,p=c.Submitter||u.Submitter,g=0,v=r.length;g<v;g++)r[g].webglRender(p,i,s,o,h,l,d)},renderCanvas:function(t,e,i,s){var r=t.currentContext,n=e.getRenderList();if(0!==n.length&&M(t,r,e,i,s)){i.addToRenderList(e);var a=i.roundPixels,o=-e._displayOriginX,h=-e._displayOriginY;r.translate(o,h);for(var l=0,d=n.length;l<d;l++)n[l].canvasRender(r,o,h,a);r.restore()}}},_=function(t,e){if(this.width===t&&this.height===e)return this;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};const R=Phaser.Utils.Array.Remove;var L=function(){return this.poolManager&&this.poolManager.freeMultiple(this.children.list),this.children.list.length=0,this.lastAppendedChildren.length=0,this.dirty=!0,this},B={setTint(t){return this.tint=t,this.tintFill=!1,this},setTintFill(t){return this.tint=t,this.tintFill=!0,this},clearTint(){return this.setTint(16777215),this}},D={setTexture:function(t,e){return this.texture=this.scene.sys.textures.get(t),this.frame=this.texture.get(e),this},resize:_,setSize:_,addChild:function(t){return this.lastAppendedChildren.length=0,Array.isArray(t)?(this.children.add(t),this.lastAppendedChildren.push(...t)):(this.children.add(t),this.lastAppendedChildren.push(t)),this},removeChild:function(t){return this.poolManager&&this.poolManager.free(t),R(this.children.list,t),this.lastAppendedChildren.length=0,this.dirty=!0,this},removeChildren:L,clear:L,getLastAppendedChildren:function(){return this.lastAppendedChildren},getChildren:function(){return this.children.list}};Object.assign(D,B);class I{constructor(){this.items=[]}destroy(){this.clear(),this.items=void 0}pop(){return this.items.length>0?this.items.pop():null}push(t){return this.items.push(t),this}pushMultiple(t){return this.items.push.apply(this.items,t),t.length=0,this}clear(){return this.items.length=0,this}}const A=Phaser.Utils.Objects.GetValue;var F={};let j=class{constructor(t){this.pools=A(t,"pools",F)}destroy(){this.pools=void 0}free(t){if(!this.pools)return this;var e=t.type;return this.pools.hasOwnProperty(e)||(this.pools[e]=new I),this.pools[e].push(t),t.onFree(),this}freeMultiple(t){if(!this.pools)return this;for(var e=0,i=t.length;e<i;e++)this.free(t[e]);return this}allocate(t){return this.pools&&this.pools.hasOwnProperty(t)?this.pools[t].pop():null}};var z=!1,Y=function(t){if(!z){void 0===t&&(t=0);var e=Phaser.VERSION.split("."),i=parseInt(e[0]);if(4===i){var s=parseInt(e[1]);s<t&&console.error(`Minimum supported version : ${i}.${s}`)}else console.error(`Can't supported version : ${i}`);z=!0}};Y();const X=Phaser.GameObjects.GameObject,W=Phaser.Utils.Objects.IsPlainObject,V=Phaser.Utils.Objects.GetValue,G=Phaser.Structs.List,U=Phaser.Utils.Array.StableSort,H=Phaser.Renderer.WebGL.RenderNodes.Defaults.DefaultBlitterNodes;class N extends X{constructor(t,e,i,s,r,n){W(e)&&(e=V(n=e,"x",0),i=V(n,"y",0),s=V(n,"texture"),r=V(n,"frame")),void 0===e&&(e=0),void 0===i&&(i=0),super(t,"rexBlitter"),this.children=new G,this.renderList=[],this.displayListDirty=!1,this.lastAppendedChildren=[];var a=V(n,"reuseBob",!0);this.poolManager=a?new j(n):void 0,this.setTexture(s,r),this.setPosition(e,i),this.initRenderNodes(this._defaultRenderNodesMap),this.setOrigin(0,0),this.clearTint()}get _defaultRenderNodesMap(){return H}preDestroy(){this.removeChildren(),this.children.destroy(),this.renderList.length=0,this.poolManager&&this.poolManager.destroy()}getRenderList(){if(this.displayListDirty){this.renderList.length=0;for(var t=!1,e=this.children.list,i=0,s=e.length;i<s;i++){var r=e[i];$(r)&&(this.renderList.push(r),t||(t=0!==r.depth))}t&&U(this.renderList,K),this.displayListDirty=!1}return this.renderList}}var $=function(t){return t.active&&t.visible&&t.alpha>0},K=function(t,e){return t._depth-e._depth};const J=Phaser.GameObjects.Components;Phaser.Class.mixin(N,[J.Alpha,J.BlendMode,J.ComputedSize,J.Depth,J.GetBounds,J.Mask,J.RenderNodes,J.Origin,J.ScrollFactor,J.Transform,J.Visible,E,D]);const Z="image";var q=function(t,e,i){if(!t||"number"==typeof t)return i;if("string"==typeof e){if(t.hasOwnProperty(e))return t[e];if(-1===e.indexOf("."))return i;e=e.split(".")}for(var s=e,r=t,n=i,a=0;a<s.length;a++){if(e=s[a],!r.hasOwnProperty(e)){n=i;break}r=n=r[e]}return n},Q=function(t){if("object"!=typeof t||null===t)return t;if(Array.isArray(t))t.length=0;else for(var e in t)delete t[e];return t},tt={enableData(){return void 0===this.data&&(this.data={}),this},setData(t,e){if(this.enableData(),1===arguments.length){var i=t;for(t in i)this.data[t]=i[t]}else this.data[t]=e;return this},getData(t,e){return this.enableData(),void 0===t?this.data:q(this.data,t,e)},incData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)+e),this},mulData(t,e,i){return void 0===i&&(i=0),this.enableData(),this.setData(t,this.getData(t,i)*e),this},clearData(){return this.data&&Q(this.data),this}};let et=class{constructor(t,e){this.type=e,this.data=void 0,this.setParent(t).reset().setActive()}destroy(){this.parent&&this.parent.removeChild(this)}setParent(t){return this.parent=t,this}setDisplayListDirty(t){return t&&this.parent&&(this.parent.displayListDirty=!0),this}get active(){return this._active}set active(t){this.setDisplayListDirty(this._active!=t),this._active=t}setActive(t){return void 0===t&&(t=!0),this.active=t,this}modifyPorperties(t){return this}reset(){this.clearData()}onFree(){this.reset().setActive(!1).setParent()}};Object.assign(et.prototype,tt);const it=Phaser.Math.DegToRad,st=Phaser.Math.RadToDeg,rt=Phaser.Utils.Objects.GetValue;let nt=class extends et{get visible(){return this._visible}set visible(t){this.setDisplayListDirty(this._visible!=t),this._visible=t}setVisible(t){return void 0===t&&(t=!0),this.visible=t,this}get alpha(){return this._alpha}set alpha(t){this.setDisplayListDirty(!!this._alpha!=!!t),this._alpha=t}setAlpha(t){return this.alpha=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setPosition(t,e){return this.x=t,this.y=e,this}setRotation(t){return this.rotation=t,this}get angle(){return st(this.rotation)}set angle(t){this.rotation=it(t)}setAngle(t){return this.angle=t,this}setScaleX(t){return this.scaleX=t,this}get width(){return this._width}set width(t){this._width=t}setWidth(t,e){return void 0===e&&(e=!1),this.width=t,e&&(this.scaleY=this.scaleX),this}setScaleY(t){return this.scaleY=t,this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}get height(){return this._height}set height(t){this._height=t}setHeight(t,e){return void 0===e&&(e=!1),this.height=t,e&&(this.scaleX=this.scaleY),this}setScale(t,e){return void 0===e&&(e=t),this.scaleX=t,this.scaleY=e,this}get displayWidth(){return this._width*this.scaleX}set displayWidth(t){this.scaleX=t/this._width}setDisplayWidth(t,e){return void 0===e&&(e=!1),this.displayWidth=t,e&&(this.scaleY=this.scaleX),this}get displayHeight(){return this._height*this.scaleY}set displayHeight(t){this.scaleY=t/this._height}setDisplayHeight(t,e){return void 0===e&&(e=!1),this.displayHeight=t,e&&(this.scaleX=this.scaleY),this}setOriginX(t){return this.originX=t,this._displayOriginX=this.width*t,this}setOriginY(t){return this.originY=t,this._displayOriginY=this.height*t,this}setOrigin(t,e){return void 0===e&&(e=t),this.setOriginX(t).setOriginY(e),this}get depth(){return this._depth}set depth(t){this.setDisplayListDirty(this._depth!=t),this._depth=t}setDepth(t){return void 0===t&&(t=0),this.depth=t,this}modifyPorperties(t){if(!t)return this;t.hasOwnProperty("x")&&this.setX(t.x),t.hasOwnProperty("y")&&this.setY(t.y),t.hasOwnProperty("rotation")?this.setRotation(t.rotation):t.hasOwnProperty("angle")&&this.setAngle(t.angle),t.hasOwnProperty("alpha")&&this.setAlpha(t.alpha);var e=rt(t,"width",void 0),i=rt(t,"height",void 0),s=rt(t,"scale",void 0),r=rt(t,"scaleX",s),n=rt(t,"scaleY",s);void 0!==e?void 0===i&&void 0===n?this.setWidth(e,!0):this.setWidth(e):void 0!==r?this.setScaleX(r):t.hasOwnProperty("displayWidth")&&this.setDisplayWidth(t.displayWidth),void 0!==i?void 0===e&&void 0===r?this.setHeight(i,!0):this.setHeight(i):void 0!==n?this.setScaleY(n):t.hasOwnProperty("displayHeight")&&this.setDisplayHeight(t.displayHeight);var a=rt(t,"origin",void 0);return void 0!==a?this.setOrigin(a):(t.hasOwnProperty("originX")&&this.setOriginX(t.originX),t.hasOwnProperty("originY")&&this.setOriginY(t.originY)),t.hasOwnProperty("depth")&&this.setDepth(t.depth),this}reset(){return super.reset(),this.setVisible().setAlpha(1).setPosition(0,0).setRotation(0).setScale(1,1).setOrigin(0).setDepth(0),this}webglRender(t,e,i,s,r,n,a,o){}canvasRender(t,e,i,s){}};const at=Phaser.GameObjects.Components.TransformMatrix,ot=Phaser.Renderer.WebGL.Utils.getTintAppendFloatAlpha;var ht=new at,lt={quad:new Float32Array(8)},dt={},ct={};const ut=Phaser.Utils.Objects.IsPlainObject;let pt=class extends nt{constructor(t,e){super(t,Z),this._crop=gt(),this.setFrame(e)}get width(){return this._width}set width(t){}get height(){return this._height}set height(t){}setFrame(t){return arguments.length>0&&!ut(t)&&(t=this.parent.texture.get(t)),this.frame=t,t?(this._width=t.realWidth,this._height=t.realHeight):(this._width=0,this._height=0),this}setFlipX(t){return void 0===t&&(t=!0),this.flipX=t,this}setFlipY(t){return void 0===t&&(t=!0),this.flipY=t,this}resetFlip(){return this.flipX=!1,this.flipY=!1,this}get tint(){return void 0===this._tint?this.parent.tint:this._tint}set tint(t){this._tint=t}setTint(t){return this.tint=t,this.tintFill=!1,this}setTintFill(t){return this.tint=t,this.tintFill=!0,this}clearTint(){return this.setTint(16777215),this}resetTint(){return this.tint=void 0,this.tintFill=void 0,this}get tintFill(){return void 0===this._tintFill?this.parent.tintFill:this._tintFill}set tintFill(t){this._tintFill=t}setCrop(t,e,i,s){return void 0===t?(this.isCropped=!1,this):this.frame?0===t&&0===e&&i===this._width&&s===this._height?(this.isCropped=!1,this):(this.frame.setCropUVs(this._crop,t,e,i,s,this.flipX,this.flipY),this.isCropped=!0,this):this}reset(){return super.reset(),this.resetFlip().resetTint().setFrame().setCrop(),this}modifyPorperties(t){return t?(t.hasOwnProperty("width")&&(t.displayWidth=t.width,delete t.width),t.hasOwnProperty("height")&&(t.displayHeight=t.height,delete t.height),t.hasOwnProperty("frame")&&this.setFrame(t.frame),super.modifyPorperties(t),t.hasOwnProperty("flipX")&&this.setFlipX(t.flipX),t.hasOwnProperty("flipY")&&this.setFlipY(t.flipY),t.hasOwnProperty("tint")&&this.setTint(t.tint),t.hasOwnProperty("tintFill")&&this.setTintFill(t.tintFill),this):this}};var gt=function(t){return void 0===t&&(t={}),t.u0=0,t.v0=0,t.u1=0,t.v1=0,t.x=0,t.y=0,t.width=0,t.height=0,t.flipX=!1,t.flipY=!1,t.cx=0,t.cy=0,t.cw=0,t.ch=0,t},vt={webglRender:function(t,e,i,s,r,n,a){var o=this.frame;if(o){var h,l,d,c,u=this._width,p=this._height,g=u*this.originX,v=p*this.originY,f=this.x-n,m=this.y-a;if(this.isCropped){var y=this._crop;y.flipX===this.flipX&&y.flipY===this.flipY||o.updateCropUVs(y,this.flipX,this.flipY),y.u0,y.v0,y.u1,y.v1,d=y.width,c=y.height,h=y.x,l=y.y}else this.frame.u0,this.frame.v0,this.frame.u1,this.frame.v1,d=u,c=p,h=0,l=0;var b=1,x=1;this.flipX&&(f+=u-2*g,b=-1),this.flipY&&(m+=p-2*v,x=-1),ht.applyITRS(f,m,this.rotation,this.scaleX*b,this.scaleY*x),s.multiply(ht,ht);var C=-g+h,w=-v+l,S=C+d,k=w+c;ht.setQuad(C,w,S,k,lt.quad),dt.frame=o,dt.uvSource=o;var T=ot(this.tint,this.alpha*r);ct.tintTopLeft=T,ct.tintBottomLeft=T,ct.tintTopRight=T,ct.tintBottomRight=T,t.run(e,this.parent,i,0,dt,lt,ct,void 0,0)}},canvasRender:function(t,e,i,s){var r=this.frame;if(r){t.save();var n,a,o,h,l=this._width,d=this._height,c=l*this.originX,u=d*this.originY,p=this.x-c,g=this.y-u;if(this.isCropped){var v=this._crop;v.flipX===this.flipX&&v.flipY===this.flipY||r.updateCropUVs(v,this.flipX,this.flipY),o=v.cw,h=v.ch,n=v.cx,a=v.cy}else o=r.cutWidth,h=r.cutHeight,n=r.cutX,a=r.cutY;var f=1,m=1;this.flipX&&(p+=l,f=-1),this.flipY&&(g+=d,m=-1);var y=r.source.resolution,b=o/y,x=h/y;s&&(p=Math.floor(p+.5),g=Math.floor(g+.5),b+=.5,x+=.5),t.translate(p,g),t.rotate(this.rotation),t.scale(this.scaleX*f,this.scaleY*m),t.drawImage(r.source.image,n,a,o,h,0,0,b,x),t.restore()}}};Object.assign(pt.prototype,vt);var ft=function(t,e){"string"==typeof e&&(e={frame:e});var i=t.poolManager?t.poolManager.allocate(Z):null;return null===i?i=new pt(t):i.setParent(t).setActive(),i.modifyPorperties(e),t.addChild(i),i},mt={_drawImage:function(t,e,i,s,r,n){ft(this,{frame:e,x:i,y:s,width:r,height:n})},_drawTileSprite:function(t,e,i,s,r,n){var a=this.texture.get(e),o=a.width,h=a.height,l=r%o,d=n%h;0===l&&(l=o),0===d&&(d=h);for(var c=Math.ceil(r/o),u=Math.ceil(n/h),p=c-1,g=u-1,v=0;v<c;v++)for(var f=0;f<u;f++){let t=ft(this,{frame:e,x:i+v*o,y:s+f*h});var m=v===p?l:o,y=f===g?d:h;m===o&&y===h||t.setCrop(0,0,m,y)}}};class yt extends(u(N,"rexNinePatch2")){setBaseTexture(t,e,i,s){return this.setTexture(t,e),super.setBaseTexture(t,e,i,s),this}}Object.assign(yt.prototype,mt),t.register("ninePatch2",(function(t,e,i,s,r,n,a,o){var h=new yt(this.scene,t,e,i,s,r,n,a,o);return this.scene.add.existing(h),h})),T(window,"RexPlugins.UI.NinePatch2",yt);var bt=Phaser.Renderer.WebGL.Utils,xt=function(t,e,i,s,r,n,a,o){var h,l,d,c,u,p=bt.getTintAppendFloatAlpha(r.fillColor,r.fillAlpha*n),g=r.pathData,v=r.pathIndexes,f=g.length,m=Array(2*f),y=Array(f),b=0,x=0;for(h=0;h<f;h+=2)l=g[h]-a,d=g[h+1]-o,c=i.getX(l,d),u=i.getY(l,d),m[b++]=c,m[b++]=u,y[x++]=p;e.batch(t,v,m,y)},Ct=Phaser.Renderer.WebGL.Utils,wt=function(t,e,i,s,r,n,a,o){var h=Ct.getTintAppendFloatAlpha(r.strokeColor,r.strokeAlpha*n),l=r.pathData,d=l.length-1,c=r.lineWidth,u=!r.closePath,p=s.customRenderNodes.StrokePath||s.defaultRenderNodes.StrokePath,g=[];u&&(d-=2);for(var v=0;v<d;v+=2){var f=l[v]-a,m=l[v+1]-o;v>0&&f===l[v-2]&&m===l[v-1]||g.push({x:f,y:m,width:c})}p.run(t,e,g,c,u,i,h,h,h,h)};const St=Phaser.GameObjects.GetCalcMatrix;var kt=function(t,e,i,s){var r=i||e.fillColor,n=s||e.fillAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.fillStyle="rgba("+a+","+o+","+h+","+n+")"},Tt=function(t,e,i,s){var r=i||e.strokeColor,n=s||e.strokeAlpha,a=(16711680&r)>>>16,o=(65280&r)>>>8,h=255&r;t.strokeStyle="rgba("+a+","+o+","+h+","+n+")",t.lineWidth=e.lineWidth};const Pt=Phaser.Renderer.Canvas.SetTransform;var Ot={renderWebGL:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1);var r=i.camera;r.addToRenderList(e);var n=St(e,r,s,!i.useCanvas).calc,a=e._displayOriginX,o=e._displayOriginY,h=e.alpha,l=e.customRenderNodes.Submitter||e.defaultRenderNodes.Submitter;e.isFilled&&xt(i,l,n,0,e,h,a,o),e.isStroked&&wt(i,l,n,e,e,h,a,o)},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateData(),e.dirty=!1),i.addToRenderList(e);var r=t.currentContext;if(Pt(t,r,e,i,s)){var n=e._displayOriginX,a=e._displayOriginY,o=e.pathData,h=o.length-1,l=o[0]-n,d=o[1]-a;r.beginPath(),r.moveTo(l,d),e.closePath||(h-=2);for(var c=2;c<h;c+=2){var u=o[c]-n,p=o[c+1]-a;r.lineTo(u,p)}r.closePath(),e.isFilled&&(kt(r,e),r.fill()),e.isStroked&&(Tt(r,e),r.stroke()),r.restore()}}};const Mt=Phaser.GameObjects.Shape;class Et extends Mt{get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.isFilled=null!=t&&this._fillAlpha>0}get fillAlpha(){return this._fillAlpha}set fillAlpha(t){this._fillAlpha=t,this.isFilled=t>0&&null!=this._fillColor}setFillStyle(t,e){return void 0===e&&(e=1),this.fillColor=t,this.fillAlpha=e,this}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.isStroked=null!=t&&this._strokeAlpha>0&&this._lineWidth>0}get strokeAlpha(){return this._strokeAlpha}set strokeAlpha(t){this._strokeAlpha=t,this.isStroked=t>0&&null!=this._strokeColor&&this._lineWidth>0}get lineWidth(){return this._lineWidth}set lineWidth(t){this._lineWidth=t,this.isStroked=t>0&&null!=this._strokeColor}setStrokeStyle(t,e,i){return void 0===i&&(i=1),this.lineWidth=t,this.strokeColor=e,this.strokeAlpha=i,this}updateData(){return this}get width(){return this.geom.width}set width(t){this.resize(t,this.height)}get height(){return this.geom.height}set height(t){this.resize(this.width,t)}setSize(t,e){var i=this.input;return i&&!i.customHitArea&&(i.hitArea.width=t,i.hitArea.height=e),this}resize(t,e){return this.setSize(t,e),this}}Object.assign(Et.prototype,Ot);const _t=Phaser.Utils.Objects.GetValue;let Rt=class{constructor(t,e,i,s,r){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=0),this.cornerRadius={},this._width=0,this._height=0,this.setTo(t,e,i,s,r)}setTo(t,e,i,s,r){return this.setPosition(t,e),this.setRadius(r),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setSize(t,e){return this.width=t,this.height=e,this}get minWidth(){var t=this.cornerRadius;return Math.max(t.tl.x+t.tr.x,t.bl.x+t.br.x)}get minHeight(){var t=this.cornerRadius;return Math.max(t.tl.y+t.bl.y,t.tr.y+t.br.y)}get width(){return this._width}set width(t){null==t&&(t=0),this._width=Math.max(t,this.minWidth)}get height(){return this._height}set height(t){null==t&&(t=0),this._height=Math.max(t,this.minHeight)}get radius(){var t=this.cornerRadius;return Math.max(t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y)}set radius(t){var e,i;"number"==typeof t?(e=t,i=t):(e=_t(t,"x",0),i=_t(t,"y",0));var s=this.cornerRadius;s.tl=Lt(_t(t,"tl",void 0),e,i),s.tr=Lt(_t(t,"tr",void 0),e,i),s.bl=Lt(_t(t,"bl",void 0),e,i),s.br=Lt(_t(t,"br",void 0),e,i)}get radiusTL(){var t=this.cornerRadius.tl;return Math.max(t.x,t.y)}set radiusTL(t){Bt(this.cornerRadius.tl,t)}get radiusTR(){var t=this.cornerRadius.tr;return Math.max(t.x,t.y)}set radiusTR(t){Bt(this.cornerRadius.tr,t)}get radiusBL(){var t=this.cornerRadius.bl;return Math.max(t.x,t.y)}set radiusBL(t){Bt(this.cornerRadius.bl,t)}get radiusBR(){var t=this.cornerRadius.br;return Math.max(t.x,t.y)}set radiusBR(t){Bt(this.cornerRadius.br,t)}};var Lt=function(t,e,i){return void 0===t?t={x:e,y:i}:"number"==typeof t&&(t={x:t,y:t}),Dt(t),t},Bt=function(t,e){"number"==typeof e?(t.x=e,t.y=e):(t.x=_t(e,"x",0),t.y=_t(e,"y",0)),Dt(t)},Dt=function(t){t.convex=t.x>=0||t.y>=0,t.x=Math.abs(t.x),t.y=Math.abs(t.y)},It=function(t){return t.x>0&&t.y>0},At=function(t,e,i){var s=i.length;if(s>=2){var r=i[s-2],n=i[s-1];if(t===r&&e===n)return i}return i.push(t,e),i};const Ft=Phaser.Math.DegToRad;var jt=function(t,e,i,s,r,n,a,o,h){a&&n>r?n-=360:!a&&n<r&&(n+=360);var l=Ft(n-r)/o;r=Ft(r);for(var d=0;d<=o;d++){var c=r+l*d,u=t+i*Math.cos(c),p=e+s*Math.sin(c);At(u,p,h)}return h};const zt=Phaser.Utils.Objects.IsPlainObject,Yt=Phaser.Utils.Objects.GetValue,Xt=Phaser.Geom.Polygon.Earcut;let Wt=class extends Et{constructor(t,e,i,s,r,n,a,o){var h,l,d,c;if(zt(e)){var u=e;e=u.x,i=u.y,s=u.width,r=u.height,n=u.radius,a=u.color,o=u.alpha,h=u.strokeColor,l=u.strokeAlpha,d=u.strokeWidth,c=u.shape}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=0);var p=new Rt;if(super(t,"rexRoundRectangleShape",p),this.setShapeType(c),0===this.shapeType){var g=Yt(n,"radius",n);p.setTo(0,0,s,r,g)}else g={x:s/2,y:r/2},p.setTo(0,0,s,r,g);this.setIteration(Yt(n,"iteration",void 0)),this.setPosition(e,i),this.setFillStyle(a,o),void 0===d&&(d=2),this.setStrokeStyle(d,h,l),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i,s=t.width,r=t.height,n=t.cornerRadius,a=this.iteration+1;if(i=n.tl,It(i))if(i.convex){var o=i.x,h=i.y;jt(o,h,i.x,i.y,180,270,!1,a,e)}else jt(o=0,h=0,i.x,i.y,90,0,!0,a,e);else At(0,0,e);return i=n.tr,It(i)?i.convex?(o=s-i.x,h=i.y,jt(o,h,i.x,i.y,270,360,!1,a,e)):jt(o=s,h=0,i.x,i.y,180,90,!0,a,e):At(s,0,e),i=n.br,It(i)?i.convex?(o=s-i.x,h=r-i.y,jt(o,h,i.x,i.y,0,90,!1,a,e)):jt(o=s,h=r,i.x,i.y,270,180,!0,a,e):At(s,r,e),i=n.bl,It(i)?i.convex?(o=i.x,h=r-i.y,jt(o,h,i.x,i.y,90,180,!1,a,e)):jt(o=0,h=r,i.x,i.y,360,270,!0,a,e):At(0,r,e),e.push(e[0],e[1]),this.pathIndexes=Xt(e),this}setShapeType(t){return"string"==typeof t&&(t=Vt[t]),this.shapeType=t,this}setSize(t,e){return void 0===e&&(e=t),this.geom.width===t&&this.geom.height===e||(this.geom.setSize(t,e),1===this.shapeType&&this.setRadius({x:t/2,y:e/2}),this.updateDisplayOrigin(),this.dirty=!0,super.setSize(t,e)),this}get radius(){return this.geom.radius}set radius(t){this.geom.setRadius(t),this.updateDisplayOrigin(),this.dirty=!0}get radiusTL(){return this.geom.radiusTL}set radiusTL(t){this.geom.radiusTL=t,this.dirty=!0}get radiusTR(){return this.geom.radiusTR}set radiusTR(t){this.geom.radiusTR=t,this.dirty=!0}get radiusBL(){return this.geom.radiusBL}set radiusBL(t){this.geom.radiusBL=t,this.dirty=!0}get radiusBR(){return this.geom.radiusBR}set radiusBR(t){this.geom.radiusBR=t,this.dirty=!0}setRadius(t){return void 0===t&&(t=0),this.radius=t,this}setRadiusTL(t){return void 0===t&&(t=0),this.radiusTL=t,this}setRadiusTR(t){return void 0===t&&(t=0),this.radiusTR=t,this}setRadiusBL(t){return void 0===t&&(t=0),this.radiusBL=t,this}setRadiusBR(t){return void 0===t&&(t=0),this.radiusBR=t,this}get cornerRadius(){return this.geom.cornerRadius}set cornerRadius(t){this.radius=t}setCornerRadius(t){return this.setRadius(t)}get iteration(){return this._iteration}set iteration(t){void 0!==this._iteration?this._iteration!==t&&(this._iteration=t,this.dirty=!0):this._iteration=t}setIteration(t){return void 0===t&&(t=6),this.iteration=t,this}};const Vt={rectangle:0,circle:1};t.register("roundRectangle",(function(t,e,i,s,r,n,a){var o=new Wt(this.scene,t,e,i,s,r,n,a);return this.scene.add.existing(o),o})),T(window,"RexPlugins.UI.RoundRectangle",Wt);var Gt={renderWebGL:function(t,e,i,s){if(e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height){i.camera.addToRenderList(e);var r=e.customRenderNodes,n=e.defaultRenderNodes;(r.Submitter||n.Submitter).run(i,e,s,0,r.Texturer||n.Texturer,r.Transformer||n.Transformer)}},renderCanvas:function(t,e,i,s){e.dirty&&(e.updateTexture(),e.dirty=!1),0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const Ut=Phaser.Display.Color;var Ht={clear(){return this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},fill(t){return this.context.fillStyle=t,this.context.fillRect(0,0,this.canvas.width,this.canvas.height),this.dirty=!0,this},drawFrame(t,e,i,s,r,n,a,o,h,l){var d=this.scene.sys.textures.getFrame(t,e);if(!d)return this;var c=d.cutWidth,u=d.cutHeight;void 0===i&&(i=0),void 0===s&&(s=0),void 0===r&&(r=c),void 0===n&&(n=u),void 0===a&&(a=0),void 0===o&&(o=0),void 0===h&&(h=c),void 0===l&&(l=u);var p=d.cutX+a,g=d.cutY+o;return this.context.drawImage(d.source.image,p,g,h,l,i,s,r,n),this.dirty=!0,this},getDataURL(t,e){return this.canvas.toDataURL(t,e)},getPixel(t,e,i){void 0===i&&(i=new Ut);var s=this.context.getImageData(t,e,1,1);return i.setTo(s.data[0],s.data[1],s.data[2],s.data[3]),i},setPixel(t,e,i,s,r,n){if("number"!=typeof i){var a=i;i=a.red,s=a.green,r=a.blue,n=a.alpha}void 0===n&&(n=0!==i||0!==s||0!==r?255:0);var o=this.context.createImageData(1,1);return o.data[0]=i,o.data[1]=s,o.data[2]=r,o.data[3]=n,this.context.putImageData(o,t,e),this.dirty=!0,this}},Nt=function(t,e,i,s,r,n,a){var o,h=t.sys.textures,l=t.renderer;void 0===s&&(s=0),void 0===r&&(r=0),void 0===n&&(n=e.width),void 0===a&&(a=e.height);var d=(o=h.exists(i)?h.get(i):h.createCanvas(i,n,a)).getSourceImage();d.width!==n&&(d.width=n),d.height!==a&&(d.height=a);var c=d.getContext("2d",{willReadFrequently:!0});c.clearRect(0,0,n,a),c.drawImage(e,s,r,n,a),l.gl&&o&&l.canvasToTexture(d,o.source[0].glTexture,!0,0)},$t={updateTexture(t,e){var i=this.canvas,s=this.context;if(t){var r=this.resolution;1!==r&&(this.context.save(),this.context.scale(r,r)),e?t.call(e,i,s):t(i,s),1!==r&&this.context.restore()}var n=i.width,a=i.height;n===this.frame.width&&a===this.frame.height||(this.frame.setSize(n,a),this.frame.source.updateSize(n,a),this.frame.updateUVs()),this.renderer&&this.renderer.gl&&(this.frame.source.glTexture=this.renderer.canvasToTexture(i,this.frame.source.glTexture,!0),this.frame.glTexture.spectorMetadata={textureKey:"Canvas Game Object"}),this.dirty=!1;var o=this.input;return o&&!o.customHitArea&&(o.hitArea.width=this.width,o.hitArea.height=this.height),this},generateTexture(t,e,i,s,r){var n=this.canvas;return void 0===s?s=n.width:s*=this.resolution,void 0===r?r=n.height:r*=this.resolution,Nt(this.scene,n,t,e,i,s,r),this},loadTexture(t,e){var i=this.scene.sys.textures.getFrame(t,e);return i?(this.width!==i.cutWidth||this.height!==i.cutHeight?this.setSize(i.cutWidth,i.cutHeight):this.clear(),this.drawFrame(t,e),this.dirty=!0,this):this}};Y();const Kt=Phaser.Display.Canvas.CanvasPool,Jt=Phaser.GameObjects.GameObject,Zt=Phaser.Utils.String.UUID,qt=Phaser.Renderer.WebGL.RenderNodes.Defaults.DefaultImageNodes;let Qt=class extends Jt{constructor(t,e,i,s,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=1),void 0===n&&(n=1),super(t,"rexCanvas"),this.renderer=t.sys.game.renderer,this._width=s,this._height=r,this.resolution=n,s=Math.max(Math.ceil(s*this.resolution),1),r=Math.max(Math.ceil(r*this.resolution),1),this.canvas=Kt.create(this,s,r),this.dirty=!1,this.setPosition(e,i),this.setOrigin(.5,.5),this.initRenderNodes(this._defaultRenderNodesMap),this._crop=this.resetCropObject(),this._textureKey=Zt(),this.texture=t.sys.textures.addCanvas(this._textureKey,this.canvas),this.context=this.texture.context,this.frame=this.texture.get(),this.frame.source.resolution=this.resolution,this.renderer&&this.renderer.gl&&(this.renderer.deleteTexture(this.frame.source.glTexture),this.frame.source.glTexture=null),this.dirty=!0}preDestroy(){Kt.remove(this.canvas),this.canvas=null,this.context=null;var t=this.texture;t&&t.destroy()}get _defaultRenderNodesMap(){return qt}setResolution(t){if(this.resolution===t)return this;this.resolution=t;var e=Math.max(Math.ceil(this.width*t),1),i=Math.max(Math.ceil(this.height*t),1);return this.canvas.width=e,this.canvas.height=i,this.frame.source.resolution=t,this.dirty=!0,this}get width(){return this._width}set width(t){this.setSize(t,this._height)}get height(){return this._height}set height(t){this.setSize(this._width,t)}setCanvasSize(t,e){return this._width===t&&this._height===e||(this._width=t,this._height=e,this.updateDisplayOrigin(),t=Math.max(Math.ceil(t*this.resolution),1),e=Math.max(Math.ceil(e*this.resolution),1),this.canvas.width=t,this.canvas.height=e,this.frame.setSize(t,e),this.frame.source.updateSize(t,e),this.frame.updateUVs(),this.dirty=!0),this}setSize(t,e){return this.setCanvasSize(t,e),this}get displayWidth(){return this.scaleX*this._width}set displayWidth(t){this.scaleX=t/this._width}get displayHeight(){return this.scaleY*this._height}set displayHeight(t){this.scaleY=t/this._height}setDisplaySize(t,e){return this.displayWidth=t,this.displayHeight=e,this}getCanvas(t){return t||(this.dirty=!0),this.canvas}getContext(t){return t||(this.dirty=!0),this.context}needRedraw(){return this.dirty=!0,this}resize(t,e){return this.setSize(t,e),this}};const te=Phaser.GameObjects.Components;Phaser.Class.mixin(Qt,[te.Alpha,te.BlendMode,te.Crop,te.Depth,te.Flip,te.GetBounds,te.Lighting,te.Mask,te.Origin,te.RenderNodes,te.ScrollFactor,te.Tint,te.Transform,te.Visible,Gt,Ht,$t]);const ee=Phaser.Utils.String.Pad;var ie=function(t,e,i){if(null==t)return t;switch(typeof t){case"string":default:return t;case"number":return`#${ee(Math.floor(t).toString(16),6,"0",1)}`;case"function":return t(e,i);case"object":return t.hasOwnProperty("r")?t.hasOwnProperty("a")?`rgba(${t.r},${t.g},${t.b},${t.a})`:`rgb(${t.r},${t.g},${t.b})`:t.hasOwnProperty("h")?t.hasOwnProperty("a")?`hsla(${t.h},${t.s},${t.l},${t.a})`:`hsl(${t.h},${t.s},${t.l})`:t}};const se=Phaser.Math.DegToRad;var re=function(t,e,i,s,r,n,a){var o,h,l,d,c,u=new Rt(e,i,s,r,n),p=u.minWidth,g=u.minHeight,v=s>=p?1:s/p,f=r>=g?1:r/g,m=u.cornerRadius;t.save(),t.beginPath(),t.translate(e,i),o=m.tl,ae(o)?(h=o.x*v,l=o.y*f,ne(o)?oe(t,h,l,h,l,180,270,!1,a):oe(t,0,0,h,l,90,0,!0,a),d=0,c=l):(t.lineTo(0,0),d=0,c=0),o=m.tr,ae(o)?(h=o.x*v,l=o.y*f,ne(o)?oe(t,s-h,l,h,l,270,360,!1,a):oe(t,s,0,h,l,180,90,!0,a)):t.lineTo(s,0),o=m.br,ae(o)?(h=o.x*v,l=o.y*f,ne(o)?oe(t,s-h,r-l,h,l,0,90,!1,a):oe(t,s,r,h,l,270,180,!0,a)):t.lineTo(s,r),o=m.bl,ae(o)?(h=o.x*v,l=o.y*f,ne(o)?oe(t,h,r-l,h,l,90,180,!1,a):oe(t,0,r,h,l,360,270,!0,a)):t.lineTo(0,r),t.lineTo(d,c),t.closePath(),t.restore()},ne=function(t){return!t.hasOwnProperty("convex")||t.convex},ae=function(t){return t.x>0&&t.y>0},oe=function(t,e,i,s,r,n,a,o,h){if(o&&a>n?a-=360:!o&&a<n&&(a+=360),n=se(n),a=se(a),null==h)t.ellipse(e,i,s,r,0,n,a,o);else for(var l,d,c,u=(a-n)/(h+=1),p=0;p<=h;p++)c=n+u*p,l=e+s*Math.cos(c),d=i+r*Math.sin(c),t.lineTo(l,d)},he=function(t,e,i,s,r,n,a,o){if(null!=e||null!=i){var h=t.canvas.width,l=t.canvas.height;null==i&&(s=0);var d=s/2;h=Math.max(1,h-s),l=Math.max(1,l-s),function(t,e,i,s,r,n,a,o,h,l,d,c,u){var p;(re(e,i,s,r,n,a,u),null!=o)&&(null!=d&&((p=c?e.createLinearGradient(0,0,r,0):e.createLinearGradient(0,0,0,n)).addColorStop(0,o),p.addColorStop(1,d),o=p),e.fillStyle=o,e.fill());null!=h&&l>0&&(e.strokeStyle=h,e.lineWidth=l,e.stroke())}(t.canvas,t.context,d,d,h,l,r,e,i,s,n,a,o)}},le=function(){he(this,this.fillStyle,this.strokeStyle,this.lineWidth,this.radius,this.fillColor2,this.isHorizontalGradient,this.iteration)};const de=Phaser.Utils.Objects.GetValue;let ce=class extends Qt{constructor(t,e,i,s,r,n,a,o,h,l,d,c){void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s),void 0===n&&(n=0),void 0===c&&(c=1),super(t,e,i,s,r,c),this.type="rexRoundRectangleCanvas";var u=de(n,"radius",n),p=de(n,"iteration",void 0);this.setRadius(u),this.setIteration(p),this.setFillStyle(a,l,d),this.setStrokeStyle(o,h)}get radius(){return this._radius}set radius(t){this.dirty|=this._radius!=t,this._radius=t}setRadius(t){return this.radius=t,this}get iteration(){return this._iteration}set iteration(t){this.dirty|=this._iteration!=t,this._iteration=t}setIteration(t){return this.iteration=t,this}get fillStyle(){return this._fillStyle}set fillStyle(t){t=ie(t,this.canvas,this.context),this.dirty|=this._fillStyle!=t,this._fillStyle=t}get fillColor2(){return this._fillColor2}set fillColor2(t){t=ie(t,this.canvas,this.context),this.dirty|=this._fillColor2!=t,this._fillColor2=t}get isHorizontalGradient(){return this._isHorizontalGradient}set isHorizontalGradient(t){this.dirty|=this._isHorizontalGradient!=t,this._isHorizontalGradient=t}setFillStyle(t,e,i){return void 0===i&&(i=!0),this.fillStyle=t,this.fillColor2=e,this.isHorizontalGradient=i,this}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){t=ie(t,this.canvas,this.context),this.dirty|=this._strokeStyle!=t,this._strokeStyle=t}get lineWidth(){return this._lineWidth}set lineWidth(t){this.dirty|=this._lineWidth!=t,this._lineWidth=t}setStrokeStyle(t,e){return this.strokeStyle=t,this.lineWidth=e,this}updateTexture(){return super.updateTexture((function(){this.clear(),le.call(this)}),this),this}};t.register("roundRectangleCanvas",(function(t,e,i,s,r,n,a,o,h,l){var d=new ce(this.scene,t,e,i,s,r,n,a,o,h,l);return this.scene.add.existing(d),d})),T(window,"RexPlugins.UI.RoundRectangleCanvas",ce);var ue=function(t,e){if(!t)return!1;if(t.hasOwnProperty(e))return!0;for(;t;){if(Object.getOwnPropertyDescriptor(t,e))return!0;t=t.__proto__}return!1},pe=function(t,e,i){e&&!ue(t,`${e}X`)&&(Object.defineProperty(t,`${e}X`,{get:function(){return i.x},set:function(e){i.x=e,t.dirty=!0}}),Object.defineProperty(t,`${e}Y`,{get:function(){return i.y},set:function(e){i.y=e,t.dirty=!0}}),Object.defineProperty(t,`${e}T`,{get:function(){return i.t},set:function(e){i.t=e,t.dirty=!0}}))},ge={setTLPosition(t,e){return this.geom.setTLPosition(t,e),this.dirty=!0,this},setTRPosition(t,e){return this.geom.setTRPosition(t,e),this.dirty=!0,this},setBLPosition(t,e){return this.geom.setBLPosition(t,e),this.dirty=!0,this},setBRPosition(t,e){return this.geom.setBRPosition(t,e),this.dirty=!0,this},resetCornerPosition(){return this.geom.resetCornerPosition(),this.dirty=!0,this},insertTopSidePoint(t,e,i,s){var r=this.geom.topSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertTopSidePoint(n.t,n.x,n.y),pe(this,n.key,r[r.length-1]);else this.geom.insertTopSidePoint(t,e,i),pe(this,s,r[r.length-1]);return this.dirty=!0,this},insertRightSidePoint(t,e,i,s){var r=this.geom.rightSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertRightSidePoint(n.t,n.x,n.y),pe(this,n.key,r[r.length-1]);else this.geom.insertRightSidePoint(t,e,i),pe(this,s,r[r.length-1]);return this.dirty=!0,this},insertBottomSidePoint(t,e,i,s){var r=this.geom.bottomSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertBottomSidePoint(n.t,n.x,n.y),pe(this,n.key,r[r.length-1]);else this.geom.insertBottomSidePoint(t,e,i),pe(this,s,r[r.length-1]);return this.dirty=!0,this},insertLeftSidePoint(t,e,i,s){var r=this.geom.leftSidePoints;if(Array.isArray(t))for(var n,a=0,o=(r=t).length;a<o;a++)n=r[a],this.geom.insertLeftSidePoint(n.t,n.x,n.y),pe(this,n.key,r[r.length-1]);else this.geom.insertLeftSidePoint(t,e,i),pe(this,s,r[r.length-1]);return this.dirty=!0,this},clearTopSidePoints(){return this.geom.clearTopSidePoints(),this.dirty=!0,this},clearRightSidePoints(){return this.geom.clearRightSidePoints(),this.dirty=!0,this},clearBottomSidePoints(){return this.geom.clearBottomSidePoints(),this.dirty=!0,this},clearLeftSidePoints(){return this.geom.clearLeftSidePoints(),this.dirty=!0,this},clearAllSidesPoints(){return this.geom.clearAllSidesPoints(),this.dirty=!0,this}};class ve{constructor(t,e,i,s){void 0===t&&(t=0),void 0===e&&(e=t),void 0===i&&(i=0),void 0===s&&(s=0),this.setTo(t,e,i,s),this.tlx=0,this.tly=0,this.trx=0,this.try=0,this.blx=0,this.bly=0,this.brx=0,this.bry=0,this.topSidePoints=[],this.rightSidePoints=[],this.bottomSidePoints=[],this.leftSidePoints=[]}setTo(t,e,i,s){return this.setPosition(t,e),this.setSize(i,s),this}setPosition(t,e){return this.x=t,this.y=e,this}setSize(t,e){return this.width=t,this.height=e,this}setTLPosition(t,e){return this.tlx=t,this.tly=e,this}setTRPosition(t,e){return this.trx=t,this.try=e,this}setBLPosition(t,e){return this.blx=t,this.bly=e,this}setBRPosition(t,e){return this.brx=t,this.bry=e,this}resetCornerPosition(){return this.setTLPosition(0,0).setTRPosition(0,0).setBLPosition(0,0).setBRPosition(0,0),this}insertTopSidePoint(t,e,i){return fe(this.topSidePoints,t,e,i),this}insertRightSidePoint(t,e,i){return fe(this.rightSidePoints,t,e,i),this}insertBottomSidePoint(t,e,i){return fe(this.bottomSidePoints,t,e,i),this}insertLeftSidePoint(t,e,i){return fe(this.leftSidePoints,t,e,i),this}clearTopSidePoints(){return this.topSidePoints.length=0,this}clearRightSidePoints(){return this.rightSidePoints.length=0,this}clearBottomSidePoints(){return this.bottomSidePoints.length=0,this}clearLeftSidePoints(){return this.leftSidePoints.length=0,this}clearAllSidesPoints(){return this.clearTopSidePoints().clearRightSidePoints().clearBottomSidePoints().clearLeftSidePoints(),this}}var fe=function(t,e,i,s){if("number"!=typeof e){var r=e;e=r.t,i=r.x,s=r.y}t.push({t:e,x:i,y:s})};const me=Phaser.Utils.Objects.IsPlainObject,ye=Phaser.Utils.Objects.GetValue,be=Phaser.Math.Linear,xe=Phaser.Geom.Polygon.Earcut;class Ce extends Et{constructor(t,e,i,s,r,n,a){var o,h,l;if(me(e)){var d=e;e=d.x,i=d.y,s=d.width,r=d.height,n=d.color,a=d.alpha,o=d.strokeColor,h=d.strokeAlpha,l=d.strokeWidth}void 0===e&&(e=0),void 0===i&&(i=0),void 0===s&&(s=1),void 0===r&&(r=s);var c=new ve;super(t,"rexQuadShape",c),c.setTo(0,0,s,r),this.setPosition(e,i),this.setFillStyle(n,a),void 0!==o&&void 0===l&&(l=2),this.setStrokeStyle(l,o,h),this.setTLPosition(ye(d,"tlx",0),ye(d,"tly",0)).setTRPosition(ye(d,"trx",0),ye(d,"try",0)).setBLPosition(ye(d,"blx",0),ye(d,"bly",0)).setBRPosition(ye(d,"brx",0),ye(d,"bry",0));var u=ye(d,"leftSidePoints");u&&this.insertLeftSidePoint(u);var p=ye(d,"topSidePoints");p&&this.insertTopSidePoint(p);var g=ye(d,"rightSidePoints");g&&this.insertRightSidePoint(g);var v=ye(d,"bottomSidePoints");v&&this.insertBottomSidePoint(v),this.updateDisplayOrigin(),this.dirty=!0}updateData(){var t=this.geom,e=this.pathData;e.length=0;var i=t.width,s=t.height,r=0+t.tlx,n=0+t.tly,a=i+t.trx,o=0+t.try,h=i+t.brx,l=s+t.bry,d=0+t.blx,c=s+t.bly,u=t.topSidePoints,p=t.rightSidePoints,g=t.bottomSidePoints,v=t.leftSidePoints;At(r,n,e),we(u);for(var f=0,m=u.length;f<m;f++){var y=u[f],b=be(r,a,y.t)+y.x,x=be(n,o,y.t)+y.y;At(b,x,e)}for(At(a,o,e),we(p),f=0,m=p.length;f<m;f++)y=p[f],b=be(a,h,y.t)+y.x,x=be(o,l,y.t)+y.y,At(b,x,e);for(At(h,l,e),we(g),f=g.length-1;f>=0;f--)y=g[f],b=be(d,h,y.t)+y.x,x=be(c,l,y.t)+y.y,At(b,x,e);for(At(d,c,e),we(v),f=v.length-1;f>=0;f--)y=v[f],b=be(r,d,y.t)+y.x,x=be(n,c,y.t)+y.y,At(b,x,e);return e.push(e[0],e[1]),this.pathIndexes=xe(e),this}get tlx(){return this.geom.tlx}set tlx(t){this.geom.tlx=t,this.dirty=!0}get tly(){return this.geom.tly}set tly(t){this.geom.tly=t,this.dirty=!0}get trx(){return this.geom.trx}set trx(t){this.geom.trx=t,this.dirty=!0}get try(){return this.geom.try}set try(t){this.geom.try=t,this.dirty=!0}get blx(){return this.geom.blx}set blx(t){this.geom.blx=t,this.dirty=!0}get bly(){return this.geom.bly}set bly(t){this.geom.bly=t,this.dirty=!0}get brx(){return this.geom.brx}set brx(t){this.geom.brx=t,this.dirty=!0}get bry(){return this.geom.bry}set bry(t){this.geom.bry=t,this.dirty=!0}get leftSidePoints(){return this.geom.leftSidePoints}get topSidePoints(){return this.geom.topSidePoints}get bottomSidePoints(){return this.geom.bottomSidePoints}get rightSidePoints(){return this.geom.rightSidePoints}}var we=function(t){t.length<=1||t.sort((function(t,e){return t.t-e.t}))};Object.assign(Ce.prototype,ge),t.register("QuadShape",(function(t,e,i,s,r,n){var a=new Ce(this.scene,t,e,i,s,r,n);return this.scene.add.existing(a),a})),T(window,"RexPlugins.UI.QuadShape",Ce);var Se={renderWebGL:function(t,e,i,s){if(0!==e.width&&0!==e.height){i.camera.addToRenderList(e);var r=e.customRenderNodes,n=e.defaultRenderNodes;(r.Submitter||n.Submitter).run(i,e,s,0,r.Texturer||n.Texturer,r.Transformer||n.Transformer)}},renderCanvas:function(t,e,i,s){0!==e.width&&0!==e.height&&(i.addToRenderList(e),t.batchSprite(e,e.frame,i,s))}};const ke=Phaser.Display.Canvas.CanvasPool;Y();const Te=Phaser.GameObjects.GameObject;class Pe extends Te{setStyle(t){return this.style.setStyle(t)}setFont(t){return this.style.setFont(t)}setFontFamily(t){return this.style.setFontFamily(t)}setFontSize(t){return this.style.setFontSize(t)}setFontStyle(t){return this.style.setFontStyle(t)}setTestString(t){return this.style.setTestString(t)}setFixedSize(t,e){return this.style.setFixedSize(t,e)}setBackgroundColor(t,e,i){return this.style.setBackgroundColor(t,e,i)}setBackgroundStrokeColor(t,e){return this.style.setBackgroundStrokeColor(t,e)}setBackgroundCornerRadius(t,e){return this.style.setBackgroundCornerRadius(t,e)}setFill(t){return this.style.setFill(t)}setColor(t){return this.style.setColor(t)}setStroke(t,e){return this.style.setStroke(t,e)}setShadow(t,e,i,s,r,n){return this.style.setShadow(t,e,i,s,r,n)}setShadowOffset(t,e){return this.style.setShadowOffset(t,e)}setShadowColor(t){return this.style.setShadowColor(t)}setShadowBlur(t){return this.style.setShadowBlur(t)}setShadowStroke(t){return this.style.setShadowStroke(t)}setShadowFill(t){return this.style.setShadowFill(t)}setUnderline(t,e,i){return this.style.setUnderline(t,e,i)}setUnderlineColor(t){return this.style.setUnderlineColor(t)}setUnderlineThickness(t){return this.style.setUnderlineThickness(t)}setUnderlineOffset(t){return this.style.setUnderlineOffset(t)}setStrikethrough(t,e,i){return this.style.setStrikethrough(t,e,i)}setStrikethroughColor(t){return this.style.setStrikethroughColor(t)}setStrikethroughThickness(t){return this.style.setStrikethroughThickness(t)}setStrikethroughOffset(t){return this.style.setStrikethroughOffset(t)}setWrapMode(t){return this.style.setWrapMode(t)}setWrapWidth(t){return this.style.setWrapWidth(t)}setWordWrapWidth(t){return this.style.setWrapWidth(t)}setAlign(t){return this.style.setHAlign(t)}setHAlign(t){return this.style.setHAlign(t)}setVAlign(t){return this.style.setVAlign(t)}get lineSpacing(){return this.style.lineSpacing}set lineSpacing(t){this.style.lineSpacing=t}setLineSpacing(t){return this.style.lineSpacing=t,this.updateText(!0),this}get letterSpacing(){return this.style.letterSpacing}set letterSpacing(t){this.style.letterSpacing=t}setLetterSpacing(t){return this.style.letterSpacing=t,this.updateText(!0),this}setXOffset(t){return this.style.setXOffset(t)}setMaxLines(t){return this.style.setMaxLines(t)}setResolution(t){return this.style.setResolution(t)}getTextMetrics(){return this.style.getTextMetrics()}setTextMetrics(t,e){return this.style.setTextMetrics(t,e)}measureTextMargins(t,e){return function(t,e,i){void 0===i&&(i={});var s=ke.create(this),r=s.getContext("2d",{willReadFrequently:!0});t.syncFont(s,r);var n=r.measureText(e),a=Math.ceil(n.width*t.baselineX),o=a,h=2*o;if(o=o*t.baselineY|0,s.width=a,s.height=h,r.fillStyle="#f00",r.fillRect(0,0,a,h),r.font=t._font,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(t.testString,0,o),i.left=0,0===a||0===h||!r.getImageData(0,0,a,h))return ke.remove(s),i;for(var l=r.getImageData(0,0,a,h).data,d=!1,c=0;c<a;c++){for(var u=0;u<h;u++)if(255!==l[4*(u*a+c)]){i.left=c,d=!0;break}if(d)break}return ke.remove(s),i}(this.style,t,e)}}const Oe=Phaser.GameObjects.Components;Phaser.Class.mixin(Pe,[Oe.Alpha,Oe.BlendMode,Oe.ComputedSize,Oe.Crop,Oe.Depth,Oe.Flip,Oe.GetBounds,Oe.Lighting,Oe.Mask,Oe.Origin,Oe.RenderNodes,Oe.ScrollFactor,Oe.Tint,Oe.Transform,Oe.Visible,Se]);var Me={backgroundColor:["backgroundColor",null,ie],backgroundColor2:["backgroundColor2",null,ie],backgroundHorizontalGradient:["backgroundHorizontalGradient",!0,null],backgroundStrokeColor:["backgroundStrokeColor",null,ie],backgroundStrokeLineWidth:["backgroundStrokeLineWidth",2,null],backgroundCornerRadius:["backgroundCornerRadius",0,n