From ff3e45491ea4728bf82fb3438c0e897633208d7f Mon Sep 17 00:00:00 2001 From: koneko Date: Sat, 18 Jan 2025 22:49:25 +0000 Subject: [PATCH] deploy: 132554f1006b0d1455b05d01b76521efdc44abe1 --- ...-BZg7nHli.js => SharedSystems-CDyPO8xU.js} | 2 +- ...-BWeZKVf6.js => WebGLRenderer-BBZmp4E6.js} | 2 +- ...Br-xQwCk.js => WebGPURenderer-t84VRX_L.js} | 2 +- ...All-vIdgy7Bw.js => browserAll-UnvbWQW3.js} | 2 +- ...Bd32TehW.js => colorToUniform-BUxjB9ZS.js} | 2 +- assets/gui/frame_04.png | Bin 0 -> 14648 bytes assets/gui/{slot_02.PNG => frame_inv.png} | Bin assets/gui/gem_amount.png | Bin 0 -> 3284 bytes assets/gui/gem_amount_0.png | Bin 0 -> 2243 bytes assets/gui/gem_amount_1.png | Bin 0 -> 3045 bytes assets/gui/gem_amount_2.png | Bin 0 -> 3195 bytes assets/gui/gem_amount_3.png | Bin 0 -> 2950 bytes assets/gui/gem_amount_4.png | Bin 0 -> 3049 bytes assets/gui/gem_amount_5.png | Bin 0 -> 3053 bytes assets/gui/gem_amount_6.png | Bin 0 -> 3197 bytes .../{index-C__ClTeD.js => index-D98sUruZ.js} | 30 +++++++++--------- ...l-C2VXGd2x.js => webworkerAll-BX7Du1kd.js} | 2 +- index.html | 2 +- latest_commit | 2 +- 19 files changed, 23 insertions(+), 23 deletions(-) rename assets/{SharedSystems-BZg7nHli.js => SharedSystems-CDyPO8xU.js} (99%) rename assets/{WebGLRenderer-BWeZKVf6.js => WebGLRenderer-BBZmp4E6.js} (99%) rename assets/{WebGPURenderer-Br-xQwCk.js => WebGPURenderer-t84VRX_L.js} (99%) rename assets/{browserAll-vIdgy7Bw.js => browserAll-UnvbWQW3.js} (99%) rename assets/{colorToUniform-Bd32TehW.js => colorToUniform-BUxjB9ZS.js} (98%) create mode 100755 assets/gui/frame_04.png rename assets/gui/{slot_02.PNG => frame_inv.png} (100%) create mode 100644 assets/gui/gem_amount.png create mode 100644 assets/gui/gem_amount_0.png create mode 100644 assets/gui/gem_amount_1.png create mode 100644 assets/gui/gem_amount_2.png create mode 100644 assets/gui/gem_amount_3.png create mode 100644 assets/gui/gem_amount_4.png create mode 100644 assets/gui/gem_amount_5.png create mode 100644 assets/gui/gem_amount_6.png rename assets/{index-C__ClTeD.js => index-D98sUruZ.js} (69%) rename assets/{webworkerAll-C2VXGd2x.js => webworkerAll-BX7Du1kd.js} (99%) diff --git a/assets/SharedSystems-BZg7nHli.js b/assets/SharedSystems-CDyPO8xU.js similarity index 99% rename from assets/SharedSystems-BZg7nHli.js rename to assets/SharedSystems-CDyPO8xU.js index e8741d3..bc89fea 100644 --- a/assets/SharedSystems-BZg7nHli.js +++ b/assets/SharedSystems-CDyPO8xU.js @@ -1,4 +1,4 @@ -import{u as We,G as te,v as re,x as Ve,l as se,M as g,E as u,e as D,y as ne,z as _,F as je,R as E,H as ae,I as ie,J as Ne,a as m,S as p,j as B,w as oe,K as $,L as $e,d as q,B as k,k as U,N as M,T as b,O as S,Q as qe,c as Ke,C as w,V as le,W as ue,X as de,Y as ce,Z as Ye,P as Je,h as Xe,b as K,D as he,_ as Y,$ as Qe,a0 as Ze,a1 as et}from"./index-C__ClTeD.js";import{S as fe,T as J,B as tt,c as rt}from"./colorToUniform-Bd32TehW.js";const pe=class A extends We{constructor(e){e={...A.defaultOptions,...e},super(e),this.enabled=!0,this._state=fe.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.addResource("uTexture",0,1)}apply(e,t,r,n){e.applyFilter(this,t,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){const{gpu:t,gl:r,...n}=e;let a,i;return t&&(a=te.from(t)),r&&(i=re.from(r)),new A({gpuProgram:a,glProgram:i,...n})}};pe.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1};let st=pe;var nt=`in vec2 vMaskCoord; +import{u as We,G as te,v as re,x as Ve,l as se,M as g,E as u,e as D,y as ne,z as _,F as je,R as E,H as ae,I as ie,J as Ne,a as m,S as p,j as B,w as oe,K as $,L as $e,d as q,B as k,k as U,N as M,T as b,O as S,Q as qe,c as Ke,C as w,V as le,W as ue,X as de,Y as ce,Z as Ye,P as Je,h as Xe,b as K,D as he,_ as Y,$ as Qe,a0 as Ze,a1 as et}from"./index-D98sUruZ.js";import{S as fe,T as J,B as tt,c as rt}from"./colorToUniform-BUxjB9ZS.js";const pe=class A extends We{constructor(e){e={...A.defaultOptions,...e},super(e),this.enabled=!0,this._state=fe.for2d(),this.blendMode=e.blendMode,this.padding=e.padding,typeof e.antialias=="boolean"?this.antialias=e.antialias?"on":"off":this.antialias=e.antialias,this.resolution=e.resolution,this.blendRequired=e.blendRequired,this.addResource("uTexture",0,1)}apply(e,t,r,n){e.applyFilter(this,t,r,n)}get blendMode(){return this._state.blendMode}set blendMode(e){this._state.blendMode=e}static from(e){const{gpu:t,gl:r,...n}=e;let a,i;return t&&(a=te.from(t)),r&&(i=re.from(r)),new A({gpuProgram:a,glProgram:i,...n})}};pe.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1};let st=pe;var nt=`in vec2 vMaskCoord; in vec2 vTextureCoord; uniform sampler2D uTexture; diff --git a/assets/WebGLRenderer-BWeZKVf6.js b/assets/WebGLRenderer-BBZmp4E6.js similarity index 99% rename from assets/WebGLRenderer-BWeZKVf6.js rename to assets/WebGLRenderer-BBZmp4E6.js index f9199a8..f4b5574 100644 --- a/assets/WebGLRenderer-BWeZKVf6.js +++ b/assets/WebGLRenderer-BBZmp4E6.js @@ -1,4 +1,4 @@ -import{E as l,B as A,w as m,D as S,K,a2 as Ae,v as Be,u as G,a as p,T as $,S as R,O as L,k as H,j as B,l as U,s as z,M as Y,a3 as q,a4 as Ne,a5 as Ie,a6 as Z,a7 as De,e as x,A as ye,R as Ce}from"./index-C__ClTeD.js";import{S as O,b as Q}from"./colorToUniform-Bd32TehW.js";import{e as Ge,G as Ue,c as Oe,b as Pe,U as Fe,R as Me,B as J,d as N,f as Le,S as He,a as we}from"./SharedSystems-BZg7nHli.js";class ee{constructor(){this._didUpload=!1,this._tempState=O.for2d()}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(e,r,s){const n=e.renderer;n.shader.bind(s,this._didUpload),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(r,s.glProgram)}execute(e,r){const s=e.renderer;this._didUpload=!0,this._tempState.blendMode=r.blendMode,s.state.set(this._tempState);const n=r.textures.textures;for(let i=0;i(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(T||{});class Ve{constructor(e,r){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}}class te{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=e}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,s=this.getGlBuffer(e);r.bindBuffer(s.type,s.buffer)}bindBufferBase(e,r){const{_gl:s}=this;if(this._boundBufferBases[r]!==e){const n=this.getGlBuffer(e);this._boundBufferBases[r]=e,s.bindBufferBase(s.UNIFORM_BUFFER,r,n.buffer)}}bindBufferRange(e,r,s){const{_gl:n}=this;s=s||0;const i=this.getGlBuffer(e);n.bindBufferRange(n.UNIFORM_BUFFER,r||0,i.buffer,s*256,256)}updateBuffer(e){const{_gl:r}=this,s=this.getGlBuffer(e);if(e._updateID===s.updateID)return s;s.updateID=e._updateID,r.bindBuffer(s.type,s.buffer);const n=e.data;if(s.byteLength>=e.data.byteLength)r.bufferSubData(s.type,0,n,0,e._updateSize/n.BYTES_PER_ELEMENT);else{const i=e.descriptor.usage&A.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;s.byteLength=n.byteLength,r.bufferData(s.type,n,i)}return s}destroyAll(){const e=this._gl;for(const r in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[r].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,r){const s=this._gpuBuffers[e.uid],n=this._gl;r||n.deleteBuffer(s.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){const{_gl:r}=this;let s=T.ARRAY_BUFFER;e.descriptor.usage&A.INDEX?s=T.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&A.UNIFORM&&(s=T.UNIFORM_BUFFER);const n=new Ve(r.createBuffer(),s);return this._gpuBuffers[e.uid]=n,e.on("destroy",this.onBufferDestroy,this),n}}te.extension={type:[l.WebGLSystem],name:"buffer"};const P=class re{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...re.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(m("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=S.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const s=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:s,premultipliedAlpha:n,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&m("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width{var r;this.gl.isContextLost()&&((r=this.extensions.loseContext)==null||r.restoreContext())},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){var r;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(r=this.extensions.loseContext)==null||r.loseContext()}forceContextLoss(){var e;(e=this.extensions.loseContext)==null||e.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&m("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=this.supports,n=this.webGLVersion===2,i=this.extensions;s.uint32Indices=n||!!i.uint32ElementIndex,s.uniformBufferObject=n,s.vertexArrayObject=n||!!i.vertexArrayObject,s.srgbTextures=n||!!i.srgb,s.nonPowOf2wrapping=n,s.nonPowOf2mipmaps=n,s.msaa=n,s.uint32Indices||m("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};P.extension={type:[l.WebGLSystem],name:"context"};P.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let ke=P;var y=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(y||{}),se=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(se||{}),f=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(f||{});const w={uint8x2:f.UNSIGNED_BYTE,uint8x4:f.UNSIGNED_BYTE,sint8x2:f.BYTE,sint8x4:f.BYTE,unorm8x2:f.UNSIGNED_BYTE,unorm8x4:f.UNSIGNED_BYTE,snorm8x2:f.BYTE,snorm8x4:f.BYTE,uint16x2:f.UNSIGNED_SHORT,uint16x4:f.UNSIGNED_SHORT,sint16x2:f.SHORT,sint16x4:f.SHORT,unorm16x2:f.UNSIGNED_SHORT,unorm16x4:f.UNSIGNED_SHORT,snorm16x2:f.SHORT,snorm16x4:f.SHORT,float16x2:f.HALF_FLOAT,float16x4:f.HALF_FLOAT,float32:f.FLOAT,float32x2:f.FLOAT,float32x3:f.FLOAT,float32x4:f.FLOAT,uint32:f.UNSIGNED_INT,uint32x2:f.UNSIGNED_INT,uint32x3:f.UNSIGNED_INT,uint32x4:f.UNSIGNED_INT,sint32:f.INT,sint32x2:f.INT,sint32x3:f.INT,sint32x4:f.INT};function Xe(t){return w[t]??w.float32}const We={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class ne{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=n=>r.bindVertexArrayOES(n),e.deleteVertexArray=n=>r.deleteVertexArrayOES(n));const s=this._renderer.context.extensions.vertexAttribDivisorANGLE;s&&(e.drawArraysInstanced=(n,i,a,o)=>{s.drawArraysInstancedANGLE(n,i,a,o)},e.drawElementsInstanced=(n,i,a,o,c)=>{s.drawElementsInstancedANGLE(n,i,a,o,c)},e.vertexAttribDivisor=(n,i)=>s.vertexAttribDivisorANGLE(n,i)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,r){const s=this.gl;this._activeGeometry=e;const n=this.getVao(e,r);this._activeVao!==n&&(this._activeVao=n,s.bindVertexArray(n)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let s=0;s1?i.drawElementsInstanced(o,r||a.indexBuffer.data.length,u,(s||0)*c,n):i.drawElements(o,r||a.indexBuffer.data.length,u,(s||0)*c)}else n>1?i.drawArraysInstanced(o,s||0,r||a.getSize(),n):i.drawArrays(o,s||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ne.extension={type:[l.WebGLSystem],name:"geometry"};const je=new Ae({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),F=class ie{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:s}={...ie.defaultOptions,...e};this.useBackBuffer=r,this._antialias=s,this._renderer.context.supports.msaa||(m("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=O.for2d();const n=new Be({vertex:` +import{E as l,B as A,w as m,D as S,K,a2 as Ae,v as Be,u as G,a as p,T as $,S as R,O as L,k as H,j as B,l as U,s as z,M as Y,a3 as q,a4 as Ne,a5 as Ie,a6 as Z,a7 as De,e as x,A as ye,R as Ce}from"./index-D98sUruZ.js";import{S as O,b as Q}from"./colorToUniform-BUxjB9ZS.js";import{e as Ge,G as Ue,c as Oe,b as Pe,U as Fe,R as Me,B as J,d as N,f as Le,S as He,a as we}from"./SharedSystems-CDyPO8xU.js";class ee{constructor(){this._didUpload=!1,this._tempState=O.for2d()}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(e,r,s){const n=e.renderer;n.shader.bind(s,this._didUpload),n.shader.updateUniformGroup(n.globalUniforms.uniformGroup),n.geometry.bind(r,s.glProgram)}execute(e,r){const s=e.renderer;this._didUpload=!0,this._tempState.blendMode=r.blendMode,s.state.set(this._tempState);const n=r.textures.textures;for(let i=0;i(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(T||{});class Ve{constructor(e,r){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}}class te{constructor(e){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=e}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(e){return this._gpuBuffers[e.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,s=this.getGlBuffer(e);r.bindBuffer(s.type,s.buffer)}bindBufferBase(e,r){const{_gl:s}=this;if(this._boundBufferBases[r]!==e){const n=this.getGlBuffer(e);this._boundBufferBases[r]=e,s.bindBufferBase(s.UNIFORM_BUFFER,r,n.buffer)}}bindBufferRange(e,r,s){const{_gl:n}=this;s=s||0;const i=this.getGlBuffer(e);n.bindBufferRange(n.UNIFORM_BUFFER,r||0,i.buffer,s*256,256)}updateBuffer(e){const{_gl:r}=this,s=this.getGlBuffer(e);if(e._updateID===s.updateID)return s;s.updateID=e._updateID,r.bindBuffer(s.type,s.buffer);const n=e.data;if(s.byteLength>=e.data.byteLength)r.bufferSubData(s.type,0,n,0,e._updateSize/n.BYTES_PER_ELEMENT);else{const i=e.descriptor.usage&A.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;s.byteLength=n.byteLength,r.bufferData(s.type,n,i)}return s}destroyAll(){const e=this._gl;for(const r in this._gpuBuffers)e.deleteBuffer(this._gpuBuffers[r].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(e,r){const s=this._gpuBuffers[e.uid],n=this._gl;r||n.deleteBuffer(s.buffer),this._gpuBuffers[e.uid]=null}createGLBuffer(e){const{_gl:r}=this;let s=T.ARRAY_BUFFER;e.descriptor.usage&A.INDEX?s=T.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&A.UNIFORM&&(s=T.UNIFORM_BUFFER);const n=new Ve(r.createBuffer(),s);return this._gpuBuffers[e.uid]=n,e.on("destroy",this.onBufferDestroy,this),n}}te.extension={type:[l.WebGLSystem],name:"buffer"};const P=class re{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...re.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(m("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=S.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const s=this._renderer.background.alpha<1,n=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:s,premultipliedAlpha:n,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&m("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width{var r;this.gl.isContextLost()&&((r=this.extensions.loseContext)==null||r.restoreContext())},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){var r;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(r=this.extensions.loseContext)==null||r.loseContext()}forceContextLoss(){var e;(e=this.extensions.loseContext)==null||e.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&m("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=this.supports,n=this.webGLVersion===2,i=this.extensions;s.uint32Indices=n||!!i.uint32ElementIndex,s.uniformBufferObject=n,s.vertexArrayObject=n||!!i.vertexArrayObject,s.srgbTextures=n||!!i.srgb,s.nonPowOf2wrapping=n,s.nonPowOf2mipmaps=n,s.msaa=n,s.uint32Indices||m("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};P.extension={type:[l.WebGLSystem],name:"context"};P.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let ke=P;var y=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(y||{}),se=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(se||{}),f=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(f||{});const w={uint8x2:f.UNSIGNED_BYTE,uint8x4:f.UNSIGNED_BYTE,sint8x2:f.BYTE,sint8x4:f.BYTE,unorm8x2:f.UNSIGNED_BYTE,unorm8x4:f.UNSIGNED_BYTE,snorm8x2:f.BYTE,snorm8x4:f.BYTE,uint16x2:f.UNSIGNED_SHORT,uint16x4:f.UNSIGNED_SHORT,sint16x2:f.SHORT,sint16x4:f.SHORT,unorm16x2:f.UNSIGNED_SHORT,unorm16x4:f.UNSIGNED_SHORT,snorm16x2:f.SHORT,snorm16x4:f.SHORT,float16x2:f.HALF_FLOAT,float16x4:f.HALF_FLOAT,float32:f.FLOAT,float32x2:f.FLOAT,float32x3:f.FLOAT,float32x4:f.FLOAT,uint32:f.UNSIGNED_INT,uint32x2:f.UNSIGNED_INT,uint32x3:f.UNSIGNED_INT,uint32x4:f.UNSIGNED_INT,sint32:f.INT,sint32x2:f.INT,sint32x3:f.INT,sint32x4:f.INT};function Xe(t){return w[t]??w.float32}const We={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class ne{constructor(e){this._geometryVaoHash=Object.create(null),this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=n=>r.bindVertexArrayOES(n),e.deleteVertexArray=n=>r.deleteVertexArrayOES(n));const s=this._renderer.context.extensions.vertexAttribDivisorANGLE;s&&(e.drawArraysInstanced=(n,i,a,o)=>{s.drawArraysInstancedANGLE(n,i,a,o)},e.drawElementsInstanced=(n,i,a,o,c)=>{s.drawElementsInstancedANGLE(n,i,a,o,c)},e.vertexAttribDivisor=(n,i)=>s.vertexAttribDivisorANGLE(n,i)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(e,r){const s=this.gl;this._activeGeometry=e;const n=this.getVao(e,r);this._activeVao!==n&&(this._activeVao=n,s.bindVertexArray(n)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let s=0;s1?i.drawElementsInstanced(o,r||a.indexBuffer.data.length,u,(s||0)*c,n):i.drawElements(o,r||a.indexBuffer.data.length,u,(s||0)*c)}else n>1?i.drawArraysInstanced(o,s||0,r||a.getSize(),n):i.drawArrays(o,s||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ne.extension={type:[l.WebGLSystem],name:"geometry"};const je=new Ae({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),F=class ie{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:s}={...ie.defaultOptions,...e};this.useBackBuffer=r,this._antialias=s,this._renderer.context.supports.msaa||(m("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=O.for2d();const n=new Be({vertex:` attribute vec2 aPosition; out vec2 vUv; diff --git a/assets/WebGPURenderer-Br-xQwCk.js b/assets/WebGPURenderer-t84VRX_L.js similarity index 99% rename from assets/WebGPURenderer-Br-xQwCk.js rename to assets/WebGPURenderer-t84VRX_L.js index 8094faf..d333af4 100644 --- a/assets/WebGPURenderer-Br-xQwCk.js +++ b/assets/WebGPURenderer-t84VRX_L.js @@ -1,4 +1,4 @@ -import{g as w,E as l,f as ne,D as P,S as T,B as S,d as oe,h as R,i as C,w as E,j as b,k as ae,T as ue,l as A,m as U,M as k,o as L,p as ce,q as de,s as he,t as D,u as z,a as M,e as G,A as pe,R as le}from"./index-C__ClTeD.js";import{S as F,l as fe,a as ge}from"./colorToUniform-Bd32TehW.js";import{c as me,u as _e,U as be,B as ye,G as xe,e as Ge,R as Be,t as Se,S as Pe,a as Te}from"./SharedSystems-BZg7nHli.js";const y=F.for2d();class O{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),y.blendMode="normal",s.pipeline.getPipeline(t,n,y);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=w(u.textures,u.count)}y.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,y);t.bindGroup._touch(s.textureGC.count),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}O.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class H{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const f in i){const h=e.resources[f]??e.resources[i[f]];let p;if(h._resourceType==="uniformGroup"){const d=h;o.ubo.updateUniformGroup(d);const g=d.buffer;p={buffer:o.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=o.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=o.texture.getGpuSource(d).createView({})}n.push({binding:i[f],resource:p})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){for(const e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}}H.extension={type:[l.WebGPUSystem],name:"bindGroup"};class W{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){const t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){for(const e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(ne(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}}W.extension={type:[l.WebGPUSystem],name:"buffer"};class ve{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await P.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}v.extension={type:[l.WebGPUSystem],name:"device"};v.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class V{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(s,e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u||t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u||t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}V.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class N{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:T.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}N.extension={type:[l.WebGPUSystem],name:"stencil"};const x={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}};function Ce(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Ue(a,e){const{size:t,align:r}=x[a.data.type],s=(r-t)/4;return` +import{g as w,E as l,f as ne,D as P,S as T,B as S,d as oe,h as R,i as C,w as E,j as b,k as ae,T as ue,l as A,m as U,M as k,o as L,p as ce,q as de,s as he,t as D,u as z,a as M,e as G,A as pe,R as le}from"./index-D98sUruZ.js";import{S as F,l as fe,a as ge}from"./colorToUniform-BUxjB9ZS.js";import{c as me,u as _e,U as be,B as ye,G as xe,e as Ge,R as Be,t as Se,S as Pe,a as Te}from"./SharedSystems-CDyPO8xU.js";const y=F.for2d();class O{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),y.blendMode="normal",s.pipeline.getPipeline(t,n,y);const o=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,o,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=w(u.textures,u.count)}y.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),o=s.pipeline.getPipeline(this._geometry,r,y);t.bindGroup._touch(s.textureGC.count),i.setPipeline(o),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}O.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class H{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],o=this._renderer;for(const f in i){const h=e.resources[f]??e.resources[i[f]];let p;if(h._resourceType==="uniformGroup"){const d=h;o.ubo.updateUniformGroup(d);const g=d.buffer;p={buffer:o.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:o.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:o.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=o.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=o.texture.getGpuSource(d).createView({})}n.push({binding:i[f],resource:p})}const u=o.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){for(const e of Object.keys(this._hash))this._hash[e]=null;this._hash=null,this._renderer=null}}H.extension={type:[l.WebGPUSystem],name:"bindGroup"};class W{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(e){this._gpu=e}getGPUBuffer(e){return this._gpuBuffers[e.uid]||this.createGPUBuffer(e)}updateBuffer(e){const t=this._gpuBuffers[e.uid]||this.createGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){for(const e in this._gpuBuffers)this._gpuBuffers[e].destroy();this._gpuBuffers={}}createGPUBuffer(e){this._gpuBuffers[e.uid]||(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this),e.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(e));const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e.data&&(ne(e.data.buffer,t.getMappedRange()),t.unmap()),this._gpuBuffers[e.uid]=t,t}onBufferChange(e){this._gpuBuffers[e.uid].destroy(),e._updateID=0,this._gpuBuffers[e.uid]=this.createGPUBuffer(e)}onBufferDestroy(e){this._managedBuffers.splice(this._managedBuffers.indexOf(e),1),this._destroyBuffer(e)}destroy(){this._managedBuffers.forEach(e=>this._destroyBuffer(e)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(e){this._gpuBuffers[e.uid].destroy(),e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this),e.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[e.uid]=null}}W.extension={type:[l.WebGPUSystem],name:"buffer"};class ve{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r{this.gpu=t,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await P.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this._renderer=null}}v.extension={type:[l.WebGPUSystem],name:"device"};v.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class V{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(s,e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:o,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u||t.instanceCount,o||0):this.renderPassEncoder.draw(n||t.getSize(),u||t.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const o in r)this._setVertexBuffer(o,r[o]);for(const o in i)this.setBindGroup(o,i[o],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}V.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class N{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:T.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}N.extension={type:[l.WebGPUSystem],name:"stencil"};const x={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}};function Ce(a){const e=a.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function Ue(a,e){const{size:t,align:r}=x[a.data.type],s=(r-t)/4;return` v = uv.${a.data.name}; ${e!==0?`offset += ${e};`:""} diff --git a/assets/browserAll-vIdgy7Bw.js b/assets/browserAll-UnvbWQW3.js similarity index 99% rename from assets/browserAll-vIdgy7Bw.js rename to assets/browserAll-UnvbWQW3.js index fd34f42..27d1d05 100644 --- a/assets/browserAll-vIdgy7Bw.js +++ b/assets/browserAll-UnvbWQW3.js @@ -1 +1 @@ -import{P as m,r as J,E as w,b as L,U as Q,c as ee,w as y,e as z,C as Z}from"./index-C__ClTeD.js";import"./webworkerAll-C2VXGd2x.js";import"./colorToUniform-Bd32TehW.js";class M{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=M.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var O=/iPhone/i,C=/iPod/i,S=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,H=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,A=/Silk/i,g=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,R=/BlackBerry/i,F=/BB10/i,Y=/Opera Mini/i,K=/\b(CriOS|Chrome)(?:.+)Mobile/i,$=/Mobile(?:.+)Firefox\b/i,G=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function te(r){return function(e){return e.test(r)}}function W(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=te(t),s={apple:{phone:n(O)&&!n(g),ipod:n(C),tablet:!n(O)&&(n(S)||G(e))&&!n(g),universal:n(U),device:(n(O)||n(C)||n(S)||n(U)||G(e))&&!n(g)},amazon:{phone:n(b),tablet:!n(b)&&n(A),device:n(b)||n(A)},android:{phone:!n(g)&&n(b)||!n(g)&&n(k),tablet:!n(g)&&!n(b)&&!n(k)&&(n(A)||n(H)),device:!n(g)&&(n(b)||n(A)||n(k)||n(H))||n(/\bokhttp\b/i)},windows:{phone:n(g),tablet:n(X),device:n(g)||n(X)},other:{blackberry:n(R),blackberry10:n(F),opera:n(Y),firefox:n($),chrome:n(K),device:n(R)||n(F)||n(Y)||n($)||n(K)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const ie=W.default??W,ne=ie(globalThis.navigator),se=9,I=100,oe=0,re=0,j=2,N=1,ae=-1e3,he=-1e3,le=2;class V{constructor(e,t=ne){this._mobileInfo=t,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook();const i=document.createElement("div");i.style.width=`${I}px`,i.style.height=`${I}px`,i.style.position="absolute",i.style.top=`${oe}px`,i.style.left=`${re}px`,i.style.zIndex=j.toString(),this._div=i,this._renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){const e=document.createElement("button");e.style.width=`${N}px`,e.style.height=`${N}px`,e.style.position="absolute",e.style.top=`${ae}px`,e.style.left=`${he}px`,e.style.zIndex=le.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),(e=this._renderer.view.canvas.parentNode)==null||e.appendChild(this._div))}_deactivate(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),(e=this._div.parentNode)==null||e.removeChild(this._div))}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i title : ${e.title}
tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(t=document.createElement("button"),t.style.width=`${I}px`,t.style.height=`${I}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=j.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{container:i}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new M(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,t.forEach(o=>n.dispatchEvent(s,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===se&&this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}}V.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};const ue={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1};class de{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(L.system.add(this._tickerUpdate,this,Q.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(L.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTimei.priority-n.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,n=t.length;i=0;n--)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let s=i.length-1;s>=0;s--)n.forEach(o=>{e.currentTarget=i[s],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i=0;h--){const l=v[h],u=this.hitTestMoveRecursive(l,this._isInteractive(t)?t:l.eventMode,i,n,s,o||s(e,i));if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=e.isInteractive();(u.length>0||d)&&(d&&this._allInteractiveElements.push(e),u.push(e)),this._hitElements.length===0&&(this._hitElements=u),a=!0}}}const c=this._isInteractive(t),p=e.isInteractive();return p&&p&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:c&&!s(e,i)&&n(e,i)?p?[e]:[]:null}hitTestRecursive(e,t,i,n,s){if(this._interactivePrune(e)||s(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(E.pauseUpdate=!1),e.interactiveChildren&&e.children){const c=e.children,p=i;for(let v=c.length-1;v>=0;v--){const h=c[v],l=this.hitTestRecursive(h,this._isInteractive(t)?t:h.eventMode,p,n,s);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const u=e.isInteractive();return(l.length>0||u)&&l.push(e),l}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&n(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.includeInBuild||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,P),!e.hitArea.contains(P.x,P.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i0&&s!==t.target){const v=e.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(e,v,s);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!t.composedPath().includes(s)){const l=this.createPointerEvent(e,"pointerleave",s);for(l.eventPhase=l.AT_TARGET;l.target&&!t.composedPath().includes(l.target);)l.currentTarget=l.target,this.notifyTarget(l),i&&this.notifyTarget(l,"mouseleave"),l.target=l.target.parent;this.freeEvent(l)}this.freeEvent(h)}if(s!==t.target){const v=e.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(t,v);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let l=s==null?void 0:s.parent;for(;l&&l!==this.rootTarget.parent&&l!==t.target;)l=l.parent;if(!l||l===this.rootTarget.parent){const d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==s&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(p=t.target)==null?void 0:p.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),n=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const s=this.clonePointerEvent(i,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),n&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(s)}mapPointerOut(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),s=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");const o=this.createPointerEvent(e,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(s),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),s=this.findMountedTarget(n.pressTargetsByButton[e.button]);let o=s;if(s&&!i.composedPath().includes(s)){let a=s;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const c=i.button===2;this.notifyTarget(i,c?"rightupoutside":"mouseupoutside")}a=a.parent}delete n.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const c=n.clicksByButton[e.button];if(c.target===a.target&&t-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=t,a.detail=c.clickCount,a.pointerType==="mouse"){const p=a.button===2;this.dispatchEvent(a,p?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(i){let s=i;for(;s;)n.currentTarget=s,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),s=s.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof T)){y("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[i]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{canvas:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,x._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=t.length;i0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,o=n.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,t.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=fe),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=ge[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};B.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};B.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let q=B;const me={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??q.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof t=="object"?t.signal:void 0,s=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;r=i?`${r}capture`:r;const a=typeof e=="function"?e:e.handleEvent,c=this;n&&n.addEventListener("abort",()=>{c.off(r,a,o)}),s?c.once(r,a,o):c.on(r,a,o)},removeEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;r=i?`${r}capture`:r,e=typeof e=="function"?e:e.handleEvent,this.off(r,e,n)},dispatchEvent(r){if(!(r instanceof M))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};z.add(V);Z.mixin(ue);z.add(q);Z.mixin(me); +import{P as m,r as J,E as w,b as L,U as Q,c as ee,w as y,e as z,C as Z}from"./index-D98sUruZ.js";import"./webworkerAll-BX7Du1kd.js";import"./colorToUniform-BUxjB9ZS.js";class M{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=M.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new m,this.page=new m,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,n,s){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var O=/iPhone/i,C=/iPod/i,S=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,H=/Android/i,b=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,A=/Silk/i,g=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,R=/BlackBerry/i,F=/BB10/i,Y=/Opera Mini/i,K=/\b(CriOS|Chrome)(?:.+)Mobile/i,$=/Mobile(?:.+)Firefox\b/i,G=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function te(r){return function(e){return e.test(r)}}function W(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var n=te(t),s={apple:{phone:n(O)&&!n(g),ipod:n(C),tablet:!n(O)&&(n(S)||G(e))&&!n(g),universal:n(U),device:(n(O)||n(C)||n(S)||n(U)||G(e))&&!n(g)},amazon:{phone:n(b),tablet:!n(b)&&n(A),device:n(b)||n(A)},android:{phone:!n(g)&&n(b)||!n(g)&&n(k),tablet:!n(g)&&!n(b)&&!n(k)&&(n(A)||n(H)),device:!n(g)&&(n(b)||n(A)||n(k)||n(H))||n(/\bokhttp\b/i)},windows:{phone:n(g),tablet:n(X),device:n(g)||n(X)},other:{blackberry:n(R),blackberry10:n(F),opera:n(Y),firefox:n($),chrome:n(K),device:n(R)||n(F)||n(Y)||n($)||n(K)},any:!1,phone:!1,tablet:!1};return s.any=s.apple.device||s.android.device||s.windows.device||s.other.device,s.phone=s.apple.phone||s.android.phone||s.windows.phone,s.tablet=s.apple.tablet||s.android.tablet||s.windows.tablet,s}const ie=W.default??W,ne=ie(globalThis.navigator),se=9,I=100,oe=0,re=0,j=2,N=1,ae=-1e3,he=-1e3,le=2;class V{constructor(e,t=ne){this._mobileInfo=t,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook();const i=document.createElement("div");i.style.width=`${I}px`,i.style.height=`${I}px`,i.style.position="absolute",i.style.top=`${oe}px`,i.style.left=`${re}px`,i.style.zIndex=j.toString(),this._div=i,this._renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){const e=document.createElement("button");e.style.width=`${N}px`,e.style.height=`${N}px`,e.style.position="absolute",e.style.top=`${ae}px`,e.style.left=`${he}px`,e.style.zIndex=le.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),(e=this._renderer.view.canvas.parentNode)==null||e.appendChild(this._div))}_deactivate(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),(e=this._div.parentNode)==null||e.removeChild(this._div))}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i title : ${e.title}
tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let t=this._pool.pop();t||(t=document.createElement("button"),t.style.width=`${I}px`,t.style.height=`${I}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=j.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this._updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{container:i}=e.target,n=this._renderer.events.rootBoundary,s=Object.assign(new M(n),{target:i});n.rootTarget=this._renderer.lastObjectRendered,t.forEach(o=>n.dispatchEvent(s,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===se&&this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){this._destroyTouchHook(),this._div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this._pool=null,this._children=null,this._renderer=null}}V.extension={type:[w.WebGLSystem,w.WebGPUSystem],name:"accessibility"};const ue={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1};class de{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(L.system.add(this._tickerUpdate,this,Q.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(L.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTimei.priority-n.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,n=t.length;i=0;n--)if(e.currentTarget=i[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let s=i.length-1;s>=0;s--)n.forEach(o=>{e.currentTarget=i[s],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i=0;h--){const l=v[h],u=this.hitTestMoveRecursive(l,this._isInteractive(t)?t:l.eventMode,i,n,s,o||s(e,i));if(u){if(u.length>0&&!u[u.length-1].parent)continue;const d=e.isInteractive();(u.length>0||d)&&(d&&this._allInteractiveElements.push(e),u.push(e)),this._hitElements.length===0&&(this._hitElements=u),a=!0}}}const c=this._isInteractive(t),p=e.isInteractive();return p&&p&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:c&&!s(e,i)&&n(e,i)?p?[e]:[]:null}hitTestRecursive(e,t,i,n,s){if(this._interactivePrune(e)||s(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(E.pauseUpdate=!1),e.interactiveChildren&&e.children){const c=e.children,p=i;for(let v=c.length-1;v>=0;v--){const h=c[v],l=this.hitTestRecursive(h,this._isInteractive(t)?t:h.eventMode,p,n,s);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const u=e.isInteractive();return(l.length>0||u)&&l.push(e),l}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&n(e,i)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.includeInBuild||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,P),!e.hitArea.contains(P.x,P.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i0&&s!==t.target){const v=e.type==="mousemove"?"mouseout":"pointerout",h=this.createPointerEvent(e,v,s);if(this.dispatchEvent(h,"pointerout"),i&&this.dispatchEvent(h,"mouseout"),!t.composedPath().includes(s)){const l=this.createPointerEvent(e,"pointerleave",s);for(l.eventPhase=l.AT_TARGET;l.target&&!t.composedPath().includes(l.target);)l.currentTarget=l.target,this.notifyTarget(l),i&&this.notifyTarget(l,"mouseleave"),l.target=l.target.parent;this.freeEvent(l)}this.freeEvent(h)}if(s!==t.target){const v=e.type==="mousemove"?"mouseover":"pointerover",h=this.clonePointerEvent(t,v);this.dispatchEvent(h,"pointerover"),i&&this.dispatchEvent(h,"mouseover");let l=s==null?void 0:s.parent;for(;l&&l!==this.rootTarget.parent&&l!==t.target;)l=l.parent;if(!l||l===this.rootTarget.parent){const d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==s&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),i&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(h)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(p=t.target)==null?void 0:p.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),n=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),n&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const s=this.clonePointerEvent(i,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),n&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(s)}mapPointerOut(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),s=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");const o=this.createPointerEvent(e,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(s),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),s=this.findMountedTarget(n.pressTargetsByButton[e.button]);let o=s;if(s&&!i.composedPath().includes(s)){let a=s;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const c=i.button===2;this.notifyTarget(i,c?"rightupoutside":"mouseupoutside")}a=a.parent}delete n.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const c=n.clicksByButton[e.button];if(c.target===a.target&&t-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=t,a.detail=c.clickCount,a.pointerType==="mouse"){const p=a.button===2;this.dispatchEvent(a,p?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(i){let s=i;for(;s;)n.currentTarget=s,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),s=s.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof T)){y("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[i]=n,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{canvas:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,x._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,n=t.length;i0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",n=this._normalizeToPointerData(e);for(let s=0,o=n.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=e.type,t.push(s)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=fe),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=ge[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};B.extension={name:"events",type:[w.WebGLSystem,w.CanvasSystem,w.WebGPUSystem],priority:-1};B.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let q=B;const me={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(r){this.eventMode=r?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??q.defaultEventMode},set eventMode(r){this._internalEventMode=r},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof t=="object"?t.signal:void 0,s=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;r=i?`${r}capture`:r;const a=typeof e=="function"?e:e.handleEvent,c=this;n&&n.addEventListener("abort",()=>{c.off(r,a,o)}),s?c.once(r,a,o):c.on(r,a,o)},removeEventListener(r,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;r=i?`${r}capture`:r,e=typeof e=="function"?e:e.handleEvent,this.off(r,e,n)},dispatchEvent(r){if(!(r instanceof M))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};z.add(V);Z.mixin(ue);z.add(q);Z.mixin(me); diff --git a/assets/colorToUniform-Bd32TehW.js b/assets/colorToUniform-BUxjB9ZS.js similarity index 98% rename from assets/colorToUniform-Bd32TehW.js rename to assets/colorToUniform-BUxjB9ZS.js index 1eb4d2c..9f7878f 100644 --- a/assets/colorToUniform-Bd32TehW.js +++ b/assets/colorToUniform-BUxjB9ZS.js @@ -1,4 +1,4 @@ -import{T as _,a as M,n as g}from"./index-C__ClTeD.js";const P={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},u=0,h=1,c=2,d=3,f=4,p=5,x=class b{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<, diff --git a/assets/gui/frame_04.png b/assets/gui/frame_04.png new file mode 100755 index 0000000000000000000000000000000000000000..7828160c8c607261fc17b65922f85b43981c4f67 GIT binary patch literal 14648 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 S#>w>n0000v%`BId^h=L zW@k>jXKp$7+`An*w3l`dw0q$H?184%uKb!cYj#EF)?f?p4_MgL)bwX-+fmY2xC5x* zEQG%Ux`XAQN206?*A2i@@IKfCtO19CzrjlIJLm;ggFnEg39s)vg4c1@i*4nsx_YVj zj$jDb1zZODfbBsy&=qW0l;Oxa9uy+ZFH%&w5JBI8k3l!Eim$Z{{0LS6ziPvUijPLf zj-U{S7UBSmnu$U4!BQ$}C2s=f7xk4Yyf%p6--F2wd$R}uRPs77qO!95J_$@H(h11A z7VNLxT+arl6;X#=GElx9xDOnWR!N`PGQdW;6jU%FXAdy3^f-}!Cf9R|baIrfC>#c6 zgYNZ|^KL9St_TB>aVIFv3e9#VPB@zD6`)g;@r@FpXgW9xY#6E-?>7L~hv-5!!SASl zc%7EE8}IG_`-WuYevj~e;9js#;`u09(AsY|iy}@Tg4eEQSE?%_v1uaLtNl26_0{A< zs7=0iR>AO$2K!~@E9>hs;NLdnfHL|Mp}jTMR->z6LD&q49s^$oiK_{g@yJSAdS8xKnh>IUD{ij`li)Y3 z&R!5QJn6#@W|;&)KN;93a|c`So(%2=E}k+M_yz&P^31$WG1q|8K~q)%(4PmK0-L9* zyd~jx5Y!2Fp-d&=*NNF?A{cfDhvlgNJX0I}@|Cqjo`Ya;CP?#6QU^cCu~8obB7>Y0 zGP!zfzncc{xIB&v=|iU7@g}f&h_;3!9)kCXATLD5*oOk={NsZRYb$>P^dn;Fv(hC_ z?ax&`nb@H}2N)kzb)&QaYBi(gLPt-~IZ=2D*P4SF@1{Zf8hARBWf_Q_fxt(wyaikX z1i7I(0L+H)Td*=J^8~|`ls;%Ye;06dXU3+b@cRee-yR?Fdw*3T4$x0(uz}a6KO5rw@8x>Y1_2$ zl^0O)pDG&IETIxT2E-;k zT))ROy^vvzzBk_xlXy*St!Z7rs41rW5<}EVG_L(a#R0pjrKC9^whP!&a*w_tYcsx& z>58`4s@9$6fbAoduYfLhvNKXg44Jb)%xt8SsvOnGEbt)$b1h9{YL$WJGiaR&LM7Ev zX%3Jurns~;SJ>9Y5ZE&Zp<;J+y|7M6b3o9Wgr6oXU2Npa)rBn0_}()JFeZuCAKisHB^c zPBkVY%(b_y0g`+`7oI&+WUXRkp?gc{27`{=&%=hAQ#kKdg;tCv4ITwUOUk+53)};m zx1`gGOJ`u_wK)singxC41@;6zfGMxK+vU8!w61*+ya1Z#O0MSA&8h_F`osxlgD+?; z2cXM+2X~HI3cpR(n7Q&=wOh=y2_XkO4pA2gL8iU^#0f*WnvPnpen7sbPg2hX_`$&7 zsDHfBIKLfa{zu=`g%H` zJq8j7Zf5|y_I&8)rRss$9T@w(eQ6FjBgUXgnxrKR;5w_wmVhi%;tzm-}M5`1Cn zj;fPh22X;RWo9jh9tppvH==abBTAb4MO@uL&0OHS1=uR%3k){`kEH|$!8EB!OYqc2 zF8-2C_&sN6Ys$PwsSNl$uXu5-4^eY_JYn$2iMvBHB9e|(en5sz1)z4 z5$2J&*rjqguk&)Q+#!62fGhKiBk;Jl>Apc`$5k;T{kgYeLKbPzj|UB%>xDmaTmg>< zv)mU9nj3X`BiWere9)^1y)Z^_qIn0d&b>iH>JTj9o%4BA(P0oi2NuQXjdDOqGXfvw z-X*Z(LfwKPdqeO6h*_%Ell2HMZG9n?j`&wW z7#=bN8MlSxBwgj;kgP)9qs)bp6-;#k&kdvugo@JVSTelE2kFH-*Dc2Xh3E?kQISm? zI6_x-Bc4qu(imiI0&Y%|$upP4I~1ue=ztOdNe*x)Q(z#I> R)Vu%y002ovPDHLkV1g~(Al(1} literal 0 HcmV?d00001 diff --git a/assets/gui/gem_amount_1.png b/assets/gui/gem_amount_1.png new file mode 100644 index 0000000000000000000000000000000000000000..936deb97381b77a983f2f61dd339b3ecd87a96c8 GIT binary patch literal 3045 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 literal 0 HcmV?d00001 diff --git a/assets/gui/gem_amount_2.png b/assets/gui/gem_amount_2.png new file mode 100644 index 0000000000000000000000000000000000000000..a98bb3e828e5fd321d946c75d11d331e294436ea GIT binary patch literal 3195 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 literal 0 HcmV?d00001 diff --git a/assets/gui/gem_amount_3.png b/assets/gui/gem_amount_3.png new file mode 100644 index 0000000000000000000000000000000000000000..d1cbf01517063bcda9b5625b42fe4c78612f474a GIT binary patch literal 2950 zcmV;13wiX3P)6dr1j|7#y-G%58Bx5~l{e2b;6~u|8JRknP&DQ$ zTCx{dtENS&wR89d@C;Z6RBzw^4pei=5jWk=%>)|*HL2RpS4evt9E2v^JF*l;VL<1< z2EGkmC=Ht<`3iUr+zl=Vp8@Xx)4|GM4X^@Gt@|k2LYi8&CAbnS2^vz?4C{Cn%m&j& z>BCTEsdNMIJ+L>}4BQ-qu#~6M;c##XSbeApLLthp1hxlPgJr;um+57GTo2Tk*M_KU zPjD{it32YcGC6S4(bo+ z2l%c4#Hv7p>Uyssdm~V5b_EyLb-?yehXO6A=P%f4(&zE2{h7`0e>VxC_8Wyi0Gz|U z^|}p_|0HmtW!sc1=cVky;6mU=DoT92y)p$pQDh{28=za>o+x-4I1)@9qVu1nj7wl| zt`19~yhczVIEBVh_z(fzsHMeyKC^Ki&k&kp#BRFm)Fi+6T z2PztHWTdO>0=n60m91%ImJO&W>;6DLzLDsVBX$t@Ja9koAkd!t z7AyjeoSl%|1nICi;@bhw52_Jm&k!C0^TD;?Xkc23qBbBVfIMR{Wr|zl4sQbV<;2JvY?}A(wr)BK;vTZ$aERF4lIdm$&EL-B&N2!QEiQFReP$HK`EhGDC!z(vtMoQUplYmbHqz9mm;m0I5@q;qRL7;z5w4|*${NYNnarY08oh16 zEa1}T3NXDQ4Ap#Ra05K%@ce1mn`jS`s}Xq=Qd&?j_oO8$1M<8dcxc%vxom>%z>mRV z;0aTeo+hEU?d9n?#FnW>kjE(UfU%9)fU<>c;_KFOvsA@xzcZ>zUll(JsQRY>1Eu9r zan2j6b9y*+TxwI~bae+gj$#6Eo;DH{yH>k)*T(8nJes~cZGw6)CZ9{+F2HG1Y{#_? zP8p|*d2*(JTl#^eaGVXGV;ZK7>Y~4V--qve0v!@PK@UrIC%<9n&Z!jscBylxcaQB0 z6=^qYi-t63|6=&urFa}wjiB-Mf#prhOS)>e5EyIk?*aH`JYaRwZtPqFfnf-LD{$*L z9u!`pD(y7z0QKjEcNl92-?Sx8mwF<@RX|JIBi^?K-vv9?mC|4W!`Hni@I+ClM+05H zfMNW9Yv6gIAupHOTH?Dq%5hY+0lKVz37vP2xrsRm=^1Q@QczP*jVyb@LdK>ypYi-p#`clF!W^@x*T;$l~ofwt1}!mA#wOW zI^Q+IalE|kE{kXi6nS;7$*{=md-@T#iK49Nrg+RHDfhW8Vs#Ty$50fw>hd+6~ z1rEvTd}+>{Ng=PLR6|i&e1ax;R^O^T`PTtXArCpKS78)_b6;&ZFx1i59`dXYPN@@A z?KQbjz^$mKL#H#hYJ;HUm5)oMSLO5(oO3?)7(WU;WU;)PCs!FaP+DnK(g=||y_sNh z;AYGSZ>(+ZJnsajfnR~Kl%1h%-zT3(<%?r^llKH+U;_`ANrQ)|&wgp>h=$X!nvHc| zVI4YG1~E0d?jc+zOjiiPy8%u&4>4k)FvD4Y02hL50)HOOcZX@a>%IcJBPFOFvpRy& zZon&X(XBG+M}hJ^!RmZ1FI~mA>UFnj8Gp<3{!o8T{ITB!%6PW~QsCm}?rG z^J4``-!U{ar&FOtpuIjoo z^K9O|xpQBYE>3HV9TwMMi`(J0&UdGa&}O({@sQQyt%YulA$jWQW$iV{uYK^4^!6OJ zZzTYQK?UBn_zBFt5zd`@MllqcOtOyvl`!X1aDv@?_myLnfH1N$BPtwi-8+KV= zQUFB;D)j<_dxw4*-j4vgcHJQOdHKqtvmWto48k3sdzkDtcb<{Ty{L3C(1mr&IS+Jx zSJ%!1r=8lMx_e=&m2VL1eCt&p#zYk){V?G2=e61aYo054co}Kd1=l;&lk`fC%cuvS z24TIftIIqWOP_Nn(^z#U0thNOD+s^?4IA(BW`x-~+y~f!)NecJGG-Y3QBcGu?WlUL wZ{ek<`{;c2bSPKGlldkkFe!ma3G^lKUtG9Jpo2;@HUIzs07*qoM6N<$f=6+Sh5!Hn literal 0 HcmV?d00001 diff --git a/assets/gui/gem_amount_4.png b/assets/gui/gem_amount_4.png new file mode 100644 index 0000000000000000000000000000000000000000..96363d5066e6e87b7cdf563897a8564a0995ae6c GIT binary patch literal 3049 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 literal 0 HcmV?d00001 diff --git a/assets/gui/gem_amount_5.png b/assets/gui/gem_amount_5.png new file mode 100644 index 0000000000000000000000000000000000000000..a6c3d8145f5542381c479f3b2fa8d7fb07cf328a GIT binary patch literal 3053 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.map(i=>d[i]); -var ya=Object.defineProperty;var _a=(s,t,e)=>t in s?ya(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var x=(s,t,e)=>_a(s,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();const ba="modulepreload",wa=function(s){return"/"+s},Pi={},Je=function(t,e,i){let r=Promise.resolve();if(e&&e.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(e.map(h=>{if(h=wa(h),h in Pi)return;Pi[h]=!0;const c=h.endsWith(".css"),l=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${l}`))return;const u=document.createElement("link");if(u.rel=c?"stylesheet":ba,c||(u.as="script"),u.crossOrigin="",u.href=h,o&&u.setAttribute("nonce",o),document.head.appendChild(u),c)return new Promise((d,f)=>{u.addEventListener("load",d),u.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${h}`)))})}))}function n(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&n(o.reason);return t().catch(n)})};var P=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(P||{});const Ws=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Oe=(s,t)=>Ws(s).priority??t,rt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Ws).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(Ws).forEach(t=>{t.type.forEach(e=>{var n,a;const i=this._addHandlers,r=this._queue;i[e]?(a=i[e])==null||a.call(i,t):(r[e]=r[e]||[],(n=r[e])==null||n.push(t))})}),this},handle(s,t,e){var a;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((a=n[s])==null||a.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,a)=>Oe(a.value,e)-Oe(n.value,e)))},i=>{const r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>Oe(n,e)-Oe(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}},va={extension:{type:P.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Je(()=>import("./browserAll-vIdgy7Bw.js"),__vite__mapDeps([0,1,2]))}},Sa={extension:{type:P.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Je(()=>import("./webworkerAll-C2VXGd2x.js"),__vite__mapDeps([1,2]))}};class at{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new at(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function oi(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Er={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,c,l){this.fn=h,this.context=c,this.once=l||!1}function n(h,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var f=new r(l,u||h,d),p=e?e+c:c;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,c){--h._eventsCount===0?h._events=new i:delete h._events[c]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)t.call(l,u)&&c.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},o.prototype.listeners=function(c){var l=e?e+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);dWt[s],uY:s=>Ut[s],vX:s=>Dt[s],vY:s=>Ht[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Us[s][t],sub:(s,t)=>Us[s][$.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?$.S:$.N:Math.abs(t)*2<=Math.abs(s)?s>0?$.E:$.W:t>0?s>0?$.SE:$.SW:s>0?$.NE:$.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=Fr[$.inv(t)];r.tx=e,r.ty=i,s.append(r)}},Ue=[new it,new it,new it,new it];class W{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new W(0,0,0,0)}clone(){return new W(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&e=h&&t<=c&&e>=l&&e<=u&&!(t>d&&tp&&et.right?t.right:this.right)<=k)return!1;const A=this.yt.bottom?t.bottom:this.bottom)>A}const i=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=i||a<=n)return!1;const o=Ue[0].set(t.left,t.top),h=Ue[1].set(t.left,t.bottom),c=Ue[2].set(t.right,t.top),l=Ue[3].set(t.right,t.bottom);if(c.x<=o.x||h.y<=o.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(o,o),e.apply(h,h),e.apply(c,c),e.apply(l,l),Math.max(o.x,h.x,c.x,l.x)<=i||Math.min(o.x,h.x,c.x,l.x)>=r||Math.max(o.y,h.y,c.y,l.y)<=n||Math.min(o.y,h.y,c.y,l.y)>=a))return!1;const d=u*(h.y-o.y),f=u*(o.x-h.x),p=d*i+f*n,m=d*r+f*n,g=d*i+f*a,y=d*r+f*a;if(Math.max(p,m,g,y)<=d*o.x+f*o.y||Math.min(p,m,g,y)>=d*l.x+f*l.y)return!1;const _=u*(o.y-c.y),b=u*(c.x-o.x),v=_*i+b*n,C=_*r+b*n,E=_*i+b*a,M=_*r+b*a;return!(Math.max(v,C,E,M)<=_*o.x+b*o.y||Math.min(v,C,E,M)>=_*l.x+b*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t=t||new W,t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const fs={default:-1};function J(s="default"){return fs[s]===void 0&&(fs[s]=-1),++fs[s]}const ki={},z="8.0.0",Ia="8.3.4";function L(s,t,e=3){if(ki[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-UnvbWQW3.js","assets/webworkerAll-BX7Du1kd.js","assets/colorToUniform-BUxjB9ZS.js","assets/WebGPURenderer-t84VRX_L.js","assets/SharedSystems-CDyPO8xU.js","assets/WebGLRenderer-BBZmp4E6.js"])))=>i.map(i=>d[i]); +var ya=Object.defineProperty;var _a=(s,t,e)=>t in s?ya(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var x=(s,t,e)=>_a(s,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();const ba="modulepreload",wa=function(s){return"/"+s},ki={},Je=function(t,e,i){let r=Promise.resolve();if(e&&e.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),o=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=Promise.allSettled(e.map(h=>{if(h=wa(h),h in ki)return;ki[h]=!0;const c=h.endsWith(".css"),l=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${l}`))return;const u=document.createElement("link");if(u.rel=c?"stylesheet":ba,c||(u.as="script"),u.crossOrigin="",u.href=h,o&&u.setAttribute("nonce",o),document.head.appendChild(u),c)return new Promise((d,f)=>{u.addEventListener("load",d),u.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${h}`)))})}))}function n(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return r.then(a=>{for(const o of a||[])o.status==="rejected"&&n(o.reason);return t().catch(n)})};var P=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(P||{});const Os=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},We=(s,t)=>Os(s).priority??t,nt={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Os).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(Os).forEach(t=>{t.type.forEach(e=>{var n,a;const i=this._addHandlers,r=this._queue;i[e]?(a=i[e])==null||a.call(i,t):(r[e]=r[e]||[],(n=r[e])==null||n.push(t))})}),this},handle(s,t,e){var a;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((a=n[s])==null||a.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,a)=>We(a.value,e)-We(n.value,e)))},i=>{const r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>We(n,e)-We(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}},va={extension:{type:P.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Je(()=>import("./browserAll-UnvbWQW3.js"),__vite__mapDeps([0,1,2]))}},Sa={extension:{type:P.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Je(()=>import("./webworkerAll-BX7Du1kd.js"),__vite__mapDeps([1,2]))}};class at{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new at(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function hi(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Fr={exports:{}};(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,c,l){this.fn=h,this.context=c,this.once=l||!1}function n(h,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var f=new r(l,u||h,d),p=e?e+c:c;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,c){--h._eventsCount===0?h._events=new i:delete h._events[c]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)t.call(l,u)&&c.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},o.prototype.listeners=function(c){var l=e?e+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);dOt[s],uY:s=>Ut[s],vX:s=>Dt[s],vY:s=>Ht[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Us[s][t],sub:(s,t)=>Us[s][$.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?$.S:$.N:Math.abs(t)*2<=Math.abs(s)?s>0?$.E:$.W:t>0?s>0?$.SE:$.SW:s>0?$.NE:$.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=Rr[$.inv(t)];r.tx=e,r.ty=i,s.append(r)}},Ue=[new rt,new rt,new rt,new rt];class D{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new D(0,0,0,0)}clone(){return new D(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&e=h&&t<=c&&e>=l&&e<=u&&!(t>d&&tp&&et.right?t.right:this.right)<=k)return!1;const A=this.yt.bottom?t.bottom:this.bottom)>A}const i=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=i||a<=n)return!1;const o=Ue[0].set(t.left,t.top),h=Ue[1].set(t.left,t.bottom),c=Ue[2].set(t.right,t.top),l=Ue[3].set(t.right,t.bottom);if(c.x<=o.x||h.y<=o.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(o,o),e.apply(h,h),e.apply(c,c),e.apply(l,l),Math.max(o.x,h.x,c.x,l.x)<=i||Math.min(o.x,h.x,c.x,l.x)>=r||Math.max(o.y,h.y,c.y,l.y)<=n||Math.min(o.y,h.y,c.y,l.y)>=a))return!1;const d=u*(h.y-o.y),f=u*(o.x-h.x),p=d*i+f*n,m=d*r+f*n,g=d*i+f*a,_=d*r+f*a;if(Math.max(p,m,g,_)<=d*o.x+f*o.y||Math.min(p,m,g,_)>=d*l.x+f*l.y)return!1;const b=u*(o.y-c.y),w=u*(c.x-o.x),v=b*i+w*n,C=b*r+w*n,E=b*i+w*a,M=b*r+w*a;return!(Math.max(v,C,E,M)<=b*o.x+w*o.y||Math.min(v,C,E,M)>=b*l.x+w*l.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t=t||new D,t.copyFrom(this),t}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const fs={default:-1};function J(s="default"){return fs[s]===void 0&&(fs[s]=-1),++fs[s]}const Bi={},O="8.0.0",Ia="8.3.4";function W(s,t,e=3){if(Bi[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t} Deprecated since v${s}`):(i=i.split(` `).splice(e).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} Deprecated since v${s}`),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} -Deprecated since v${s}`),console.warn(i))),ki[t]=!0}const Rr=()=>{};function Bi(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function Ii(s){return!(s&s-1)&&!!s}function Ea(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const Ei=Object.create(null);function Fa(s){const t=Ei[s];return t===void 0&&(Ei[s]=J("resource")),t}const Gr=class Lr extends ot{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Lr.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){L(z,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Fa(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Gr.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Ra=Gr;const zr=class Or extends ot{constructor(t={}){super(),this.options=t,this.uid=J("textureSource"),this._resourceType="textureSource",this._resourceId=J("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Or.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Ra(Ea(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=J("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i=i||this._resolution,t=t||this.width,e=e||this.height;const r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=J("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Ii(this.pixelWidth)&&Ii(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};zr.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Mt=zr;class hi extends Mt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}hi.extension=P.TextureSource;const Fi=new O;class Ga{constructor(t,e){this.mapCoord=new O,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let r=0;rthis.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new W);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Ri,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);const a=n.a,o=n.b,h=n.c,c=n.d,l=n.tx,u=n.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*t+h*e+l,y=o*t+c*e+u;gp&&(p=g),y>m&&(m=y),g=a*i+h*e+l,y=o*i+c*e+u,gp&&(p=g),y>m&&(m=y),g=a*t+h*r+l,y=o*t+c*r+u,gp&&(p=g),y>m&&(m=y),g=a*i+h*r+l,y=o*i+c*r+u,gp&&(p=g),y>m&&(m=y),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=a*e+h*n+l,f=o*e+c*n+u,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=a*r+h*n+l,f=o*r+c*n+u,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,r){return this.minXe&&(this.maxX=e),this.minYr&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new bt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,r){let n=this.minX,a=this.minY,o=this.maxX,h=this.maxY;r||(r=this.matrix);const c=r.a,l=r.b,u=r.c,d=r.d,f=r.tx,p=r.ty;for(let m=e;mo?_:o,h=b>h?b:h}this.minX=n,this.minY=a,this.maxX=o,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}var za={grad:.9,turn:360,rad:360/(2*Math.PI)},vt=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},et=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},dt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Wr=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Gi=function(s){return{r:dt(s.r,0,255),g:dt(s.g,0,255),b:dt(s.b,0,255),a:dt(s.a)}},ps=function(s){return{r:et(s.r),g:et(s.g),b:et(s.b),a:et(s.a,3)}},Oa=/^#([0-9a-f]{3,8})$/i,De=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Ur=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),a=n-Math.min(t,e,i),o=a?n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},Dr=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),a=i*(1-e),o=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),c=n%6;return{r:255*[i,o,a,a,h,i][c],g:255*[h,i,i,o,a,a][c],b:255*[a,a,h,i,i,o][c],a:r}},Li=function(s){return{h:Wr(s.h),s:dt(s.s,0,100),l:dt(s.l,0,100),a:dt(s.a)}},zi=function(s){return{h:et(s.h),s:et(s.s),l:et(s.l),a:et(s.a,3)}},Oi=function(s){return Dr((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},be=function(s){return{h:(t=Ur(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},Wa=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ua=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Da=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ha=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ds={string:[[function(s){var t=Oa.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?et(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?et(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Da.exec(s)||Ha.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Gi({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(s){var t=Wa.exec(s)||Ua.exec(s);if(!t)return null;var e,i,r=Li({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(za[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Oi(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return vt(t)&&vt(e)&&vt(i)?Gi({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!vt(t)||!vt(e)||!vt(i))return null;var a=Li({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Oi(a)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!vt(t)||!vt(e)||!vt(i))return null;var a=function(o){return{h:Wr(o.h),s:dt(o.s,0,100),v:dt(o.v,0,100),a:dt(o.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Dr(a)},"hsv"]]},Wi=function(s,t){for(var e=0;e=.5},s.prototype.toHex=function(){return t=ps(this.rgba),e=t.r,i=t.g,r=t.b,a=(n=t.a)<1?De(et(255*n)):"","#"+De(e)+De(i)+De(r)+a;var t,e,i,r,n,a},s.prototype.toRgb=function(){return ps(this.rgba)},s.prototype.toRgbString=function(){return t=ps(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return zi(be(this.rgba))},s.prototype.toHslString=function(){return t=zi(be(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Ur(this.rgba),{h:et(t.h),s:et(t.s),v:et(t.v),a:et(t.a,3)};var t},s.prototype.invert=function(){return xt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),xt(gs(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),xt(gs(this.rgba,-t))},s.prototype.grayscale=function(){return xt(gs(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),xt(Ui(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),xt(Ui(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?xt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):et(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=be(this.rgba);return typeof t=="number"?xt({h:t,s:e.s,l:e.l,a:e.a}):et(e.h)},s.prototype.isEqual=function(t){return this.toHex()===xt(t).toHex()},s}(),xt=function(s){return s instanceof Hs?s:new Hs(s)},Di=[],$a=function(s){s.forEach(function(t){Di.indexOf(t)<0&&(t(Hs,Ds),Di.push(t))})};function Va(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,c=i[this.toHex()];if(c)return c;if(a!=null&&a.closest){var l=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new s(e[f]).toRgb();for(var p in e){var m=(o=l,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));mn===e[a]);if(t!==null&&e!==null){const n=Object.keys(t),a=Object.keys(e);return n.length!==a.length?!1:n.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=me._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,i=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=me.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=xt(t);a.isValid()&&({r:e,g:i,b:r,a:n}=a.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof me||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Jt.shared=new Jt;Jt._temp=new Jt;Jt.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Z=Jt;const Ya={cullArea:null,cullable:!1,cullableChildren:!0};class li{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e0?e=this._pool[--this._index]:e=new this._classType,(i=e.init)==null||i.call(e,t),e}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class Xa{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new li(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const At=new Xa;function ja(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r0&&i<=e){for(let a=e-1;a>=s;a--){const o=this.children[a];o&&(r.push(o),o.parent=null)}ja(this.children,s,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(r);for(let a=0;a=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||L(z,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(s.parent){const r=s.parent.children.indexOf(s);if(s.parent===this&&r===t)return s;r!==-1&&s.parent.children.splice(r,1)}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s.didViewUpdate=!1,s._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(s),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",s,this,t),s.emit("added",this),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=s;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var s;(s=this.parent)==null||s.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),s.setFromMatrix(e),s}};class Hi{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;ei.priority-r.priority);const e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0),this._updateIsSimple()},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(s){const t=this._maskEffect;(t==null?void 0:t.mask)!==s&&(t&&(this.removeEffect(t),Ns.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=Ns.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){var s;return(s=this._maskEffect)==null?void 0:s.mask},set filters(s){var n;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new Hi);s=s;const e=(s==null?void 0:s.length)>0,i=((n=t.filters)==null?void 0:n.length)>0,r=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),r&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){var s;return(s=this._filterEffect)==null?void 0:s.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new Hi),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},Qa={label:null,get name(){return L(z,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){L(z,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let i=0;i-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let i=0;i0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;tthis.addChild(r)),(i=t.parent)==null||i.addChild(this)}static mixin(t){Object.defineProperties(st.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||L(z,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r1){for(let r=0;r-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=At.get(ao,this),this.groupTransform=O.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),At.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new O),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}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 position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Ta}set angle(t){this.rotation=t*Ma}get pivot(){return this._pivot===_s&&(this._pivot=new at(this,0,0)),this._pivot}set pivot(t){this._pivot===_s&&(this._pivot=new at(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ys&&(this._skew=new at(this,0,0)),this._skew}set skew(t){this._skew===ys&&(this._skew=new at(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===bs&&(this._scale=new at(this,1,1)),this._scale}set scale(t){this._scale===bs&&(this._scale=new at(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,r=this._pivot,n=this._position,a=i._x,o=i._y,h=r._x,c=r._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*o,e.d=this._sy*o,e.tx=n._x-(h*e.a+c*e.c),e.ty=n._y-(h*e.b+c*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=$i,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=Z.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=$i,this._onUpdate())}get tint(){const t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ho,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ws,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ws,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=ws,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var r;if(this.destroyed)return;this.destroyed=!0;const e=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.children)for(let n=0;n=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}class nt extends rs{constructor(t=G.EMPTY){t instanceof G&&(t={texture:t});const{texture:e=G.EMPTY,anchor:i,roundPixels:r,width:n,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new at({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof G?new nt(t):new nt(G.from(t,e))}set texture(t){t||(t=G.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){La(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,i=this._sourceBounds,{width:r,height:n}=e.orig;i.maxX=-t._x*r,i.minX=i.maxX+r,i.maxY=-t._y*n,i.minY=i.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const lo=new bt;function jr(s,t,e){const i=lo;s.measurable=!0,Hr(s,e,i),t.addBoundsMask(i),s.measurable=!1}function qr(s,t,e){const i=te.get();s.measurable=!0;const r=Ct.get().identity(),n=Kr(s,e,r);$r(s,i,n),s.measurable=!1,t.addBoundsMask(i),Ct.return(r),te.return(i)}function Kr(s,t,e){return s?(s!==t&&(Kr(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(Q("Mask bounds, renderable is not inside the root container"),e)}class Zr{constructor(t){this.priority=0,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof nt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){jr(this.mask,t,e)}addLocalBounds(t,e){qr(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof nt}}Zr.extension=P.MaskEffect;class Qr{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Qr.extension=P.MaskEffect;class Jr{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){jr(this.mask,t,e)}addLocalBounds(t,e){qr(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof st}}Jr.extension=P.MaskEffect;const co={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};let Vi=co;const j={get(){return Vi},set(s){Vi=s}};class tn extends Mt{constructor(t){t.resource||(t.resource=j.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}tn.extension=P.TextureSource;class re extends Mt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=j.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,Q("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}re.extension=P.TextureSource;var es=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(es||{});class vs{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const en=class ht{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new vs(null,null,1/0),this.deltaMS=1/ht.targetFPMS,this.elapsedMS=1/ht.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=es.NORMAL){return this._addListener(new vs(t,e,i))}addOnce(t,e,i=es.NORMAL){return this._addListener(new vs(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{var a;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const h=document.createElement("video");h.onloadeddata=()=>o(h),h.onerror=()=>o(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),(a=t.getExtension("WEBGL_lose_context"))==null||a.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ss}const ns=class rn extends Mt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...rn.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=_t.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await sn(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(_t.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(_t.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(_t.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ns.extension=P.TextureSource;ns.defaultOptions={...Mt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};ns.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ke=ns;const gt=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class uo{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||Q(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=gt(t);let r;for(let h=0;h{n.set(h,e)});const a=[...n.keys()],o={cacheKeys:a,keys:i};i.forEach(h=>{this._cacheMap.set(h,o)}),a.forEach(h=>{const c=r?r[h]:e;this._cache.has(h)&&this._cache.get(h)!==c&&Q("[Cache] already has key:",h),this._cache.set(h,n.get(h))})}remove(t){if(!this._cacheMap.has(t)){Q(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const V=new uo,$s=[];rt.handleByList(P.TextureSource,$s);function nn(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let r=0;r<$s.length;r++){const n=$s[r];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function fo(s={},t=!1){const e=s&&s.resource,i=e?s.resource:s,r=e?s:{resource:s};if(!t&&V.has(i))return V.get(i);const n=new G({source:nn(r)});return n.on("destroy",()=>{V.has(i)&&V.remove(i)}),t||V.set(i,n),n}function po(s,t=!1){return typeof s=="string"?V.get(s):s instanceof Mt?new G({source:s}):fo(s,t)}G.from=po;Mt.from=nn;rt.add(Zr,Qr,Jr,Ke,re,tn,hi);var Et=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Et||{});function pt(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function de(s){return s.split("?")[0].split("#")[0]}function go(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mo(s,t,e){return s.replace(new RegExp(go(t),"g"),e)}function xo(s,t){let e="",i=0,r=-1,n=0,a=-1;for(let o=0;o<=s.length;++o){if(o2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=o,n=0;continue}}}else e.length>0?e+=`/${s.slice(r+1,o)}`:e=s.slice(r+1,o),i=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const lt={toPosix(s){return mo(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){pt(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(pt(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=de(this.toPosix(t??j.get().getBaseUrl())),r=de(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?lt.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(pt(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=xo(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return pt(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(pt(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),a=s;s=s.slice(n.length);for(let o=s.length-1;o>=1;--o)if(t=s.charCodeAt(o),t===47){if(!r){i=o;break}}else r=!1;return i===-1?e?"/":this.isUrl(a)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){pt(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){pt(s),t&&pt(t),s=de(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let a=t.length-1,o=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(i=n):(a=-1,i=o))}return e===i?i=o:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){pt(s),s=de(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let a=s.length-1;a>=0;--a){const o=s.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}i===-1&&(r=!1,i=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){pt(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=de(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,a=0,o=-1,h=!0,c=s.length-1,l=0;for(;c>=r;--c){if(e=s.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}o===-1&&(h=!1,o=c+1),e===46?n===-1?n=c:l!==1&&(l=1):n!==-1&&(l=-1)}return n===-1||o===-1||l===0||l===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&i?t.base=t.name=s.slice(1,o):t.base=t.name=s.slice(a,o)):(a===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,o)):(t.name=s.slice(a,n),t.base=s.slice(a,o)),t.ext=s.slice(n,o)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function an(s,t,e,i,r){const n=t[e];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");r.push(a)}),an(s,r,0,e,i)}else i.push(s);return i}const ss=s=>!Array.isArray(s);class ne{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return gt(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(a=>(a==null?void 0:a.src)??a):n!=null&&n.src?n.src:n,!0)}addManifest(t){this._manifest&&Q("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,a])=>typeof a=="string"||Array.isArray(a)?{alias:n,src:a}:{alias:n,...a})),r.forEach(n=>{const a=n.src,o=n.alias;let h;if(typeof o=="string"){const c=this._createBundleAssetId(t,o);i.push(c),h=[o,c]}else{const c=o.map(l=>this._createBundleAssetId(t,l));i.push(...c),h=[...o,...c]}this.add({...n,alias:h,src:a})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=n=>{this.hasKey(n)&&Q(`[Resolver] already has key: ${n} overwriting`)},gt(e).forEach(n=>{const{src:a}=n;let{data:o,format:h,loadParser:c}=n;const l=gt(a).map(f=>typeof f=="string"?yo(f):Array.isArray(f)?f:[f]),u=this.getAlias(n);Array.isArray(u)?u.forEach(i):i(u);const d=[];l.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g{this._assetMap[f]=d})})}resolveBundle(t){const e=ss(t);t=gt(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const c=a[h];o[this._extractAssetIdFromBundle(r,h)]=c}i[r]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=ss(t);t=gt(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=this._getPreferredOrder(n);a==null||a.priority.forEach(o=>{a.params[o].forEach(h=>{const c=n.filter(l=>l[o]?l[o]===h:!1);c.length&&(n=c)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=lt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??_o(t.src),t}}ne.RETINA_PREFIX=/@([0-9\.]+)x/;function _o(s){return s.split(".").pop().split("?").shift().split("#").shift()}const Vs=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},on=class xe{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof G?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=xe.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=xe.BATCH_SIZE;for(;e-t{this._batchIndex*xe.BATCH_SIZE{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[r]=t.textures[r]}),!e){const r=lt.dirname(s[0]);t.linkedSheets.forEach((n,a)=>{const o=hn([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(i,o)})}return i}const wo={extension:P.Asset,cache:{test:s=>s instanceof Yi,getCacheableAssets:(s,t)=>hn(s,t,!1)},resolver:{extension:{type:P.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&bo.includes(r)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=ne.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:P.LoadParser,priority:Et.Normal,name:"spritesheetLoader"},async testParse(s,t){return lt.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var c,l;const{texture:i,imageFilename:r}=(t==null?void 0:t.data)??{};let n=lt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof G)a=i;else{const u=Vs(n+(r??s.meta.image),t.src);a=(await e.load([u]))[u]}const o=new Yi(a.source,s);await o.parse();const h=(c=s==null?void 0:s.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(h)){const u=[];for(const f of h){if(typeof f!="string")continue;let p=n+f;(l=t.data)!=null&&l.ignoreMultiPack||(p=Vs(p,t.src),u.push(e.load({src:p,data:{ignoreMultiPack:!0}})))}const d=await Promise.all(u);o.linkedSheets=d,d.forEach(f=>{f.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==f))})}return o},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};rt.add(wo);const As=Object.create(null),Xi=Object.create(null);function ci(s,t){let e=Xi[s];return e===void 0&&(As[t]===void 0&&(As[t]=1),Xi[s]=e=As[t]++),e}let Vt;function ln(){return(!Vt||Vt!=null&&Vt.isContextLost())&&(Vt=j.get().createCanvas().getContext("webgl",{})),Vt}let He;function vo(){if(!He){He="mediump";const s=ln();s&&s.getShaderPrecisionFormat&&(He=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return He}function So(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),` +Deprecated since v${s}`),console.warn(i))),Bi[t]=!0}const Gr=()=>{};function Ii(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function Ei(s){return!(s&s-1)&&!!s}function Ea(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const Fi=Object.create(null);function Fa(s){const t=Fi[s];return t===void 0&&(Fi[s]=J("resource")),t}const Lr=class zr extends ht{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...zr.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){W(O,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Fa(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Lr.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Ra=Lr;const Wr=class Or extends ht{constructor(t={}){super(),this.options=t,this.uid=J("textureSource"),this._resourceType="textureSource",this._resourceId=J("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...Or.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Ra(Ea(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=J("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i=i||this._resolution,t=t||this.width,e=e||this.height;const r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=J("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Ei(this.pixelWidth)&&Ei(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Wr.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Mt=Wr;class li extends Mt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}li.extension=P.TextureSource;const Ri=new U;class Ga{constructor(t,e){this.mapCoord=new U,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let r=0;rthis.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new D);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Gi,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);const a=n.a,o=n.b,h=n.c,c=n.d,l=n.tx,u=n.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*t+h*e+l,_=o*t+c*e+u;gp&&(p=g),_>m&&(m=_),g=a*i+h*e+l,_=o*i+c*e+u,gp&&(p=g),_>m&&(m=_),g=a*t+h*r+l,_=o*t+c*r+u,gp&&(p=g),_>m&&(m=_),g=a*i+h*r+l,_=o*i+c*r+u,gp&&(p=g),_>m&&(m=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=a*e+h*n+l,f=o*e+c*n+u,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=a*r+h*n+l,f=o*r+c*n+u,this.minX=dthis.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,r){return this.minXe&&(this.maxX=e),this.minYr&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new wt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,r){let n=this.minX,a=this.minY,o=this.maxX,h=this.maxY;r||(r=this.matrix);const c=r.a,l=r.b,u=r.c,d=r.d,f=r.tx,p=r.ty;for(let m=e;mo?b:o,h=w>h?w:h}this.minX=n,this.minY=a,this.maxX=o,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}var za={grad:.9,turn:360,rad:360/(2*Math.PI)},St=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},st=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},ft=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Ur=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Li=function(s){return{r:ft(s.r,0,255),g:ft(s.g,0,255),b:ft(s.b,0,255),a:ft(s.a)}},ps=function(s){return{r:st(s.r),g:st(s.g),b:st(s.b),a:st(s.a,3)}},Wa=/^#([0-9a-f]{3,8})$/i,De=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Dr=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),a=n-Math.min(t,e,i),o=a?n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},Hr=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),a=i*(1-e),o=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),c=n%6;return{r:255*[i,o,a,a,h,i][c],g:255*[h,i,i,o,a,a][c],b:255*[a,a,h,i,i,o][c],a:r}},zi=function(s){return{h:Ur(s.h),s:ft(s.s,0,100),l:ft(s.l,0,100),a:ft(s.a)}},Wi=function(s){return{h:st(s.h),s:st(s.s),l:st(s.l),a:st(s.a,3)}},Oi=function(s){return Hr((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},ve=function(s){return{h:(t=Dr(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},Oa=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ua=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Da=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ha=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ds={string:[[function(s){var t=Wa.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?st(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?st(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Da.exec(s)||Ha.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Li({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(s){var t=Oa.exec(s)||Ua.exec(s);if(!t)return null;var e,i,r=zi({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(za[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Oi(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return St(t)&&St(e)&&St(i)?Li({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!St(t)||!St(e)||!St(i))return null;var a=zi({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Oi(a)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!St(t)||!St(e)||!St(i))return null;var a=function(o){return{h:Ur(o.h),s:ft(o.s,0,100),v:ft(o.v,0,100),a:ft(o.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Hr(a)},"hsv"]]},Ui=function(s,t){for(var e=0;e=.5},s.prototype.toHex=function(){return t=ps(this.rgba),e=t.r,i=t.g,r=t.b,a=(n=t.a)<1?De(st(255*n)):"","#"+De(e)+De(i)+De(r)+a;var t,e,i,r,n,a},s.prototype.toRgb=function(){return ps(this.rgba)},s.prototype.toRgbString=function(){return t=ps(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return Wi(ve(this.rgba))},s.prototype.toHslString=function(){return t=Wi(ve(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Dr(this.rgba),{h:st(t.h),s:st(t.s),v:st(t.v),a:st(t.a,3)};var t},s.prototype.invert=function(){return yt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),yt(gs(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),yt(gs(this.rgba,-t))},s.prototype.grayscale=function(){return yt(gs(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),yt(Di(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),yt(Di(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?yt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):st(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=ve(this.rgba);return typeof t=="number"?yt({h:t,s:e.s,l:e.l,a:e.a}):st(e.h)},s.prototype.isEqual=function(t){return this.toHex()===yt(t).toHex()},s}(),yt=function(s){return s instanceof Hs?s:new Hs(s)},Hi=[],$a=function(s){s.forEach(function(t){Hi.indexOf(t)<0&&(t(Hs,Ds),Hi.push(t))})};function Va(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,c=i[this.toHex()];if(c)return c;if(a!=null&&a.closest){var l=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in e)n[f]=new s(e[f]).toRgb();for(var p in e){var m=(o=l,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));mn===e[a]);if(t!==null&&e!==null){const n=Object.keys(t),a=Object.keys(e);return n.length!==a.length?!1:n.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=ye._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,i=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=ye.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=yt(t);a.isValid()&&({r:e,g:i,b:r,a:n}=a.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof ye||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Jt.shared=new Jt;Jt._temp=new Jt;Jt.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Z=Jt;const Ya={cullArea:null,cullable:!1,cullableChildren:!0};class ci{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e0?e=this._pool[--this._index]:e=new this._classType,(i=e.init)==null||i.call(e,t),e}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class Xa{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new ci(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const Ct=new Xa;function ja(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r0&&i<=e){for(let a=e-1;a>=s;a--){const o=this.children[a];o&&(r.push(o),o.parent=null)}ja(this.children,s,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(r);for(let a=0;a=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||W(O,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(s.parent){const r=s.parent.children.indexOf(s);if(s.parent===this&&r===t)return s;r!==-1&&s.parent.children.splice(r,1)}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s.didViewUpdate=!1,s._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(s),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",s,this,t),s.emit("added",this),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=s;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var s;(s=this.parent)==null||s.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),s.setFromMatrix(e),s}};class Ni{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;ei.priority-r.priority);const e=this.renderGroup||this.parentRenderGroup;e&&(e.structureDidChange=!0),this._updateIsSimple()},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(s){const t=this._maskEffect;(t==null?void 0:t.mask)!==s&&(t&&(this.removeEffect(t),Ns.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=Ns.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){var s;return(s=this._maskEffect)==null?void 0:s.mask},set filters(s){var n;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new Ni);s=s;const e=(s==null?void 0:s.length)>0,i=((n=t.filters)==null?void 0:n.length)>0,r=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),r&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){var s;return(s=this._filterEffect)==null?void 0:s.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new Ni),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},Qa={label:null,get name(){return W(O,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){W(O,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let i=0;i-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let i=0;i0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;tthis.addChild(r)),(i=t.parent)==null||i.addChild(this)}static mixin(t){Object.defineProperties(it.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||W(O,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r1){for(let r=0;r-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=Ct.get(ao,this),this.groupTransform=U.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),Ct.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new U),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}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 position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Ta}set angle(t){this.rotation=t*Ma}get pivot(){return this._pivot===_s&&(this._pivot=new at(this,0,0)),this._pivot}set pivot(t){this._pivot===_s&&(this._pivot=new at(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ys&&(this._skew=new at(this,0,0)),this._skew}set skew(t){this._skew===ys&&(this._skew=new at(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===bs&&(this._scale=new at(this,1,1)),this._scale}set scale(t){this._scale===bs&&(this._scale=new at(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,r=this._pivot,n=this._position,a=i._x,o=i._y,h=r._x,c=r._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*o,e.d=this._sy*o,e.tx=n._x-(h*e.a+c*e.c),e.ty=n._y-(h*e.b+c*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Vi,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=Z.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=Vi,this._onUpdate())}get tint(){const t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ho,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ws,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ws,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=ws,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var r;if(this.destroyed)return;this.destroyed=!0;const e=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.children)for(let n=0;n=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}class tt extends rs{constructor(t=G.EMPTY){t instanceof G&&(t={texture:t});const{texture:e=G.EMPTY,anchor:i,roundPixels:r,width:n,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new at({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof G?new tt(t):new tt(G.from(t,e))}set texture(t){t||(t=G.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){La(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,i=this._sourceBounds,{width:r,height:n}=e.orig;i.maxX=-t._x*r,i.minX=i.maxX+r,i.maxY=-t._y*n,i.minY=i.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const lo=new wt;function qr(s,t,e){const i=lo;s.measurable=!0,Nr(s,e,i),t.addBoundsMask(i),s.measurable=!1}function Kr(s,t,e){const i=te.get();s.measurable=!0;const r=Tt.get().identity(),n=Zr(s,e,r);Vr(s,i,n),s.measurable=!1,t.addBoundsMask(i),Tt.return(r),te.return(i)}function Zr(s,t,e){return s?(s!==t&&(Zr(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(Q("Mask bounds, renderable is not inside the root container"),e)}class Qr{constructor(t){this.priority=0,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof tt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){qr(this.mask,t,e)}addLocalBounds(t,e){Kr(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof tt}}Qr.extension=P.MaskEffect;class Jr{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Jr.extension=P.MaskEffect;class tn{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){qr(this.mask,t,e)}addLocalBounds(t,e){Kr(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof it}}tn.extension=P.MaskEffect;const co={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};let Yi=co;const j={get(){return Yi},set(s){Yi=s}};class en extends Mt{constructor(t){t.resource||(t.resource=j.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}en.extension=P.TextureSource;class re extends Mt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=j.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,Q("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}re.extension=P.TextureSource;var es=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(es||{});class vs{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const sn=class lt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new vs(null,null,1/0),this.deltaMS=1/lt.targetFPMS,this.elapsedMS=1/lt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=es.NORMAL){return this._addListener(new vs(t,e,i))}addOnce(t,e,i=es.NORMAL){return this._addListener(new vs(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{var a;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const h=document.createElement("video");h.onloadeddata=()=>o(h),h.onerror=()=>o(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),(a=t.getExtension("WEBGL_lose_context"))==null||a.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ss}const ns=class nn extends Mt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...nn.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=bt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await rn(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(bt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(bt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(bt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ns.extension=P.TextureSource;ns.defaultOptions={...Mt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};ns.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Ke=ns;const mt=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class uo{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){const e=this._cache.get(t);return e||Q(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=mt(t);let r;for(let h=0;h{n.set(h,e)});const a=[...n.keys()],o={cacheKeys:a,keys:i};i.forEach(h=>{this._cacheMap.set(h,o)}),a.forEach(h=>{const c=r?r[h]:e;this._cache.has(h)&&this._cache.get(h)!==c&&Q("[Cache] already has key:",h),this._cache.set(h,n.get(h))})}remove(t){if(!this._cacheMap.has(t)){Q(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const V=new uo,$s=[];nt.handleByList(P.TextureSource,$s);function an(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let r=0;r<$s.length;r++){const n=$s[r];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function fo(s={},t=!1){const e=s&&s.resource,i=e?s.resource:s,r=e?s:{resource:s};if(!t&&V.has(i))return V.get(i);const n=new G({source:an(r)});return n.on("destroy",()=>{V.has(i)&&V.remove(i)}),t||V.set(i,n),n}function po(s,t=!1){return typeof s=="string"?V.get(s):s instanceof Mt?new G({source:s}):fo(s,t)}G.from=po;Mt.from=an;nt.add(Qr,Jr,tn,Ke,re,en,li);var Et=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Et||{});function gt(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function pe(s){return s.split("?")[0].split("#")[0]}function go(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mo(s,t,e){return s.replace(new RegExp(go(t),"g"),e)}function xo(s,t){let e="",i=0,r=-1,n=0,a=-1;for(let o=0;o<=s.length;++o){if(o2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=o,n=0;continue}}}else e.length>0?e+=`/${s.slice(r+1,o)}`:e=s.slice(r+1,o),i=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const ut={toPosix(s){return mo(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){gt(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(gt(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=pe(this.toPosix(t??j.get().getBaseUrl())),r=pe(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?ut.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(gt(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=xo(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return gt(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(gt(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),a=s;s=s.slice(n.length);for(let o=s.length-1;o>=1;--o)if(t=s.charCodeAt(o),t===47){if(!r){i=o;break}}else r=!1;return i===-1?e?"/":this.isUrl(a)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){gt(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){gt(s),t&>(t),s=pe(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let a=t.length-1,o=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(i=n):(a=-1,i=o))}return e===i?i=o:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){gt(s),s=pe(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let a=s.length-1;a>=0;--a){const o=s.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}i===-1&&(r=!1,i=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){gt(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=pe(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,a=0,o=-1,h=!0,c=s.length-1,l=0;for(;c>=r;--c){if(e=s.charCodeAt(c),e===47){if(!h){a=c+1;break}continue}o===-1&&(h=!1,o=c+1),e===46?n===-1?n=c:l!==1&&(l=1):n!==-1&&(l=-1)}return n===-1||o===-1||l===0||l===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&i?t.base=t.name=s.slice(1,o):t.base=t.name=s.slice(a,o)):(a===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,o)):(t.name=s.slice(a,n),t.base=s.slice(a,o)),t.ext=s.slice(n,o)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function on(s,t,e,i,r){const n=t[e];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");r.push(a)}),on(s,r,0,e,i)}else i.push(s);return i}const ss=s=>!Array.isArray(s);class ne{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return mt(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(a=>(a==null?void 0:a.src)??a):n!=null&&n.src?n.src:n,!0)}addManifest(t){this._manifest&&Q("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,a])=>typeof a=="string"||Array.isArray(a)?{alias:n,src:a}:{alias:n,...a})),r.forEach(n=>{const a=n.src,o=n.alias;let h;if(typeof o=="string"){const c=this._createBundleAssetId(t,o);i.push(c),h=[o,c]}else{const c=o.map(l=>this._createBundleAssetId(t,l));i.push(...c),h=[...o,...c]}this.add({...n,alias:h,src:a})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=n=>{this.hasKey(n)&&Q(`[Resolver] already has key: ${n} overwriting`)},mt(e).forEach(n=>{const{src:a}=n;let{data:o,format:h,loadParser:c}=n;const l=mt(a).map(f=>typeof f=="string"?yo(f):Array.isArray(f)?f:[f]),u=this.getAlias(n);Array.isArray(u)?u.forEach(i):i(u);const d=[];l.forEach(f=>{f.forEach(p=>{let m={};if(typeof p!="object"){m.src=p;for(let g=0;g{this._assetMap[f]=d})})}resolveBundle(t){const e=ss(t);t=mt(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const c=a[h];o[this._extractAssetIdFromBundle(r,h)]=c}i[r]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=ss(t);t=mt(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const a=this._getPreferredOrder(n);a==null||a.priority.forEach(o=>{a.params[o].forEach(h=>{const c=n.filter(l=>l[o]?l[o]===h:!1);c.length&&(n=c)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,format:a}=e;return(this._basePath||this._rootPath)&&(t.src=ut.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=n??t.loadParser,t.format=a??t.format??_o(t.src),t}}ne.RETINA_PREFIX=/@([0-9\.]+)x/;function _o(s){return s.split(".").pop().split("?").shift().split("#").shift()}const Vs=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},hn=class _e{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof G?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const i=parseFloat(e.meta.scale);i?(this.resolution=i,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=_e.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=_e.BATCH_SIZE;for(;e-t{this._batchIndex*_e.BATCH_SIZE{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[r]=t.textures[r]}),!e){const r=ut.dirname(s[0]);t.linkedSheets.forEach((n,a)=>{const o=ln([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(i,o)})}return i}const wo={extension:P.Asset,cache:{test:s=>s instanceof Xi,getCacheableAssets:(s,t)=>ln(s,t,!1)},resolver:{extension:{type:P.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&bo.includes(r)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=ne.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",extension:{type:P.LoadParser,priority:Et.Normal,name:"spritesheetLoader"},async testParse(s,t){return ut.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var c,l;const{texture:i,imageFilename:r}=(t==null?void 0:t.data)??{};let n=ut.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(i instanceof G)a=i;else{const u=Vs(n+(r??s.meta.image),t.src);a=(await e.load([u]))[u]}const o=new Xi(a.source,s);await o.parse();const h=(c=s==null?void 0:s.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(h)){const u=[];for(const f of h){if(typeof f!="string")continue;let p=n+f;(l=t.data)!=null&&l.ignoreMultiPack||(p=Vs(p,t.src),u.push(e.load({src:p,data:{ignoreMultiPack:!0}})))}const d=await Promise.all(u);o.linkedSheets=d,d.forEach(f=>{f.linkedSheets=[o].concat(o.linkedSheets.filter(p=>p!==f))})}return o},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};nt.add(wo);const As=Object.create(null),ji=Object.create(null);function ui(s,t){let e=ji[s];return e===void 0&&(As[t]===void 0&&(As[t]=1),ji[s]=e=As[t]++),e}let Vt;function cn(){return(!Vt||Vt!=null&&Vt.isContextLost())&&(Vt=j.get().createCanvas().getContext("webgl",{})),Vt}let He;function vo(){if(!He){He="mediump";const s=cn();s&&s.getShaderPrecisionFormat&&(He=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return He}function So(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),` #ifdef GL_ES // This checks if it is WebGL1 #define in varying @@ -22,12 +22,12 @@ Deprecated since v${s}`),console.warn(i))),ki[t]=!0}const Rr=()=>{};function Bi( `}function Ao(s,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let r=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float; ${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function Co(s,t){return t?`#version 300 es ${s}`:s}const To={},Mo={};function Po(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?To:Mo;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`} -${s}`}function ko(s,t){return t?s.replace("#version 300 es",""):s}const Cs={stripVersion:ko,ensurePrecision:Ao,addProgramDefines:So,setProgramName:Po,insertVersion:Co},Ts=Object.create(null),cn=class Ys{constructor(t){t={...Ys.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:vo()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(Cs).forEach(a=>{const o=i[a];r=Cs[a](r,o,!0),n=Cs[a](n,o,!1)}),this.fragment=r,this.vertex=n,this._key=ci(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Ts[e]||(Ts[e]=new Ys(t)),Ts[e]}};cn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let un=cn;const ji={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Bo(s){return ji[s]??ji.float32}const Io={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"};function Eo({source:s,entryPoint:t}){const e={},i=s.indexOf(`fn ${t}`);if(i!==-1){const r=s.indexOf("->",i);if(r!==-1){const n=s.substring(i,r),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let o;for(;(o=a.exec(n))!==null;){const h=Io[o[3]]??"float32";e[o[2]]={location:parseInt(o[1],10),format:h,stride:Bo(h).stride,offset:0,instance:!1,start:0}}}}return e}function Ms(s){var u,d;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,n=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,c=(u=s.match(t))==null?void 0:u.map(f=>({group:parseInt(f.match(e)[1],10),binding:parseInt(f.match(i)[1],10),name:f.match(r)[2],isUniform:f.match(r)[1]==="",type:f.match(n)[1]}));if(!c)return{groups:[],structs:[]};const l=((d=s.match(a))==null?void 0:d.map(f=>{const p=f.match(h)[1],m=f.match(o).reduce((g,y)=>{const[_,b]=y.split(":");return g[_.trim()]=b.trim(),g},{});return m?{name:p,members:m}:null}).filter(({name:f})=>c.some(p=>p.type===f)))??[];return{groups:c,structs:l}}var ye=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(ye||{});function Fo({groups:s}){const t=[];for(let e=0;ee.has(a.name)?!1:(e.add(a.name),!0)),n=[...s.groups,...t.groups].filter(a=>{const o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:r,groups:n}}const Ps=Object.create(null);class as{constructor(t){var o,h;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:r,gpuLayout:n,name:a}=t;if(this.name=a,this.fragment=e,this.vertex=i,e.source===i.source){const c=Ms(e.source);this.structsAndGroups=c}else{const c=Ms(i.source),l=Ms(e.source);this.structsAndGroups=Go(c,l)}this.layout=r??Ro(this.structsAndGroups),this.gpuLayout=n??Fo(this.structsAndGroups),this.autoAssignGlobalUniforms=((o=this.layout[0])==null?void 0:o.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((h=this.layout[1])==null?void 0:h.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ci(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Eo(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Ps[e]||(Ps[e]=new as(t)),Ps[e]}}const dn=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],Lo=dn.reduce((s,t)=>(s[t]=!0,s),{});function zo(s,t){switch(s){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const fn=class pn{constructor(t,e){this._touched=0,this.uid=J("uniform"),this._resourceType="uniformGroup",this._resourceId=J("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...pn.defaultOptions,...e},this.uniformStructures=t;const i={};for(const r in t){const n=t[r];if(n.name=r,n.size=n.size??1,!Lo[n.type])throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${dn.join(", ")}`);n.value??(n.value=zo(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ci(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};fn.defaultOptions={ubo:!1,isStatic:!1};let gn=fn;class Ze{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var r,n;const i=this.resources[e];t!==i&&(i&&((r=t.off)==null||r.call(t,"change",this.onResourceChange,this)),(n=t.on)==null||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const i in e)e[i]._touched=t}destroy(){var e;const t=this.resources;for(const i in t){const r=t[i];(e=r.off)==null||e.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}var Xs=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.BOTH=3]="BOTH",s))(Xs||{});class ui extends ot{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:r,resources:n,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=e,this.glProgram=i,a===void 0&&(a=0,e&&(a|=Xs.WEBGPU),i&&(a|=Xs.WEBGL)),this.compatibleRenderers=a;const h={};if(!n&&!r&&(n={}),n&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&o)for(const c in o)for(const l in o[c]){const u=o[c][l];h[u]={group:c,binding:l,name:u}}else if(e&&r&&!o){const c=e.structsAndGroups.groups;o={},c.forEach(l=>{o[l.group]=o[l.group]||{},o[l.group][l.binding]=l.name,h[l.name]=l})}else if(n){r={},o={},e&&e.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,h[u.name]=u});let c=0;for(const l in n)h[l]||(r[99]||(r[99]=new Ze,this._ownedBindGroups.push(r[99])),h[l]={group:99,binding:c,name:l},o[99]=o[99]||{},o[99][c]=l,c++);for(const l in n){const u=l;let d=n[l];!d.source&&!d._resourceType&&(d=new gn(d));const f=h[u];f&&(r[f.group]||(r[f.group]=new Ze,this._ownedBindGroups.push(r[f.group])),r[f.group].setResource(d,f.binding))}}this.groups=r,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(r,h)}addResource(t,e,i){var r,n;(r=this._uniformBindMap)[e]||(r[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new Ze,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const r in e){const n=e[r];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(a){t[n.group].setResource(a,n.binding)}})}return i}destroy(t=!1){var e,i;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const{gpu:e,gl:i,...r}=t;let n,a;return e&&(n=as.from(e)),i&&(a=un.from(i)),new ui({gpuProgram:n,glProgram:a,...r})}}const js=[];rt.handleByNamedList(P.Environment,js);async function Oo(s){if(!s)for(let t=0;t80*e){o=c=s[0],h=l=s[1];for(var p=e;pc&&(c=u),d>l&&(l=d);f=Math.max(c-o,l-h),f=f!==0?32767/f:0}return Ae(n,a,e,o,h,f,0),a}function mn(s,t,e,i,r){var n,a;if(r===Zs(s,t,e,i)>0)for(n=t;n=t;n-=i)a=qi(n,s[n],s[n+1],a);return a&&hs(a,a.next)&&(Te(a),a=a.next),a}function $t(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(hs(e,e.next)||Y(e.prev,e,e.next)===0)){if(Te(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Ae(s,t,e,i,r,n,a){if(s){!a&&n&&qo(s,i,r,n);for(var o=s,h,c;s.prev!==s.next;){if(h=s.prev,c=s.next,n?Do(s,i,r,n):Uo(s)){t.push(h.i/e|0),t.push(s.i/e|0),t.push(c.i/e|0),Te(s),s=c.next,o=c.next;continue}if(s=c,s===o){a?a===1?(s=Ho($t(s),t,e),Ae(s,t,e,i,r,n,2)):a===2&&No(s,t,e,i,r,n):Ae($t(s),t,e,i,r,n,1);break}}}}function Uo(s){var t=s.prev,e=s,i=s.next;if(Y(t,e,i)>=0)return!1;for(var r=t.x,n=e.x,a=i.x,o=t.y,h=e.y,c=i.y,l=rn?r>a?r:a:n>a?n:a,f=o>h?o>c?o:c:h>c?h:c,p=i.next;p!==t;){if(p.x>=l&&p.x<=d&&p.y>=u&&p.y<=f&&qt(r,o,n,h,a,c,p.x,p.y)&&Y(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Do(s,t,e,i){var r=s.prev,n=s,a=s.next;if(Y(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,c=a.x,l=r.y,u=n.y,d=a.y,f=oh?o>c?o:c:h>c?h:c,g=l>u?l>d?l:d:u>d?u:d,y=qs(f,p,t,e,i),_=qs(m,g,t,e,i),b=s.prevZ,v=s.nextZ;b&&b.z>=y&&v&&v.z<=_;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==r&&b!==a&&qt(o,l,h,u,c,d,b.x,b.y)&&Y(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&qt(o,l,h,u,c,d,v.x,v.y)&&Y(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=y;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==r&&b!==a&&qt(o,l,h,u,c,d,b.x,b.y)&&Y(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=_;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&qt(o,l,h,u,c,d,v.x,v.y)&&Y(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ho(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!hs(r,n)&&xn(r,i,i.next,n)&&Ce(r,n)&&Ce(n,r)&&(t.push(r.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Te(i),Te(i.next),i=s=n),i=i.next}while(i!==s);return $t(i)}function No(s,t,e,i,r,n){var a=s;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Qo(a,o)){var h=yn(a,o);a=$t(a,a.next),h=$t(h,h.next),Ae(a,t,e,i,r,n,0),Ae(h,t,e,i,r,n,0);return}o=o.next}a=a.next}while(a!==s)}function $o(s,t,e,i){var r=[],n,a,o,h,c;for(n=0,a=t.length;n=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=i&&o>n&&(n=o,a=e.x=e.x&&e.x>=c&&i!==e.x&&qt(ra.x||e.x===a.x&&jo(a,e)))&&(a=e,u=d)),e=e.next;while(e!==h);return a}function jo(s,t){return Y(s.prev,s,t.prev)<0&&Y(t.next,s,s.next)<0}function qo(s,t,e,i){var r=s;do r.z===0&&(r.z=qs(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,Ko(r)}function Ko(s){var t,e,i,r,n,a,o,h,c=1;do{for(e=s,s=null,n=null,a=0;e;){for(a++,i=e,o=0,t=0;t0||h>0&&i;)o!==0&&(h===0||!i||e.z<=i.z)?(r=e,e=e.nextZ,o--):(r=i,i=i.nextZ,h--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;e=i}n.nextZ=null,c*=2}while(a>1);return s}function qs(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function Zo(s){var t=s,e=s;do(t.x=(s-a)*(n-o)&&(s-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(i-o)}function Qo(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!Jo(s,t)&&(Ce(s,t)&&Ce(t,s)&&th(s,t)&&(Y(s.prev,s,t.prev)||Y(s,t.prev,t))||hs(s,t)&&Y(s.prev,s,s.next)>0&&Y(t.prev,t,t.next)>0)}function Y(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function hs(s,t){return s.x===t.x&&s.y===t.y}function xn(s,t,e,i){var r=$e(Y(s,t,e)),n=$e(Y(s,t,i)),a=$e(Y(e,i,s)),o=$e(Y(e,i,t));return!!(r!==n&&a!==o||r===0&&Ne(s,e,t)||n===0&&Ne(s,i,t)||a===0&&Ne(e,s,i)||o===0&&Ne(e,t,i))}function Ne(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function $e(s){return s>0?1:s<0?-1:0}function Jo(s,t){var e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&xn(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Ce(s,t){return Y(s.prev,s,s.next)<0?Y(s,t,s.next)>=0&&Y(s,s.prev,t)>=0:Y(s,t,s.prev)<0||Y(s,s.next,t)<0}function th(s,t){var e=s,i=!1,r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function yn(s,t){var e=new Ks(s.i,s.x,s.y),i=new Ks(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function qi(s,t,e,i){var r=new Ks(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Te(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Ks(s,t,e){this.i=s,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}os.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,a=Math.abs(Zs(s,0,n,e));if(r)for(var o=0,h=t.length;o0&&(i+=s[r-1].length,e.holes.push(i))}return e};var eh=di.exports;const sh=oi(eh);var _n=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=16384]="COLOR",s[s.STENCIL=1024]="STENCIL",s[s.DEPTH=256]="DEPTH",s[s.COLOR_DEPTH=16640]="COLOR_DEPTH",s[s.COLOR_STENCIL=17408]="COLOR_STENCIL",s[s.DEPTH_STENCIL=1280]="DEPTH_STENCIL",s[s.ALL=17664]="ALL",s))(_n||{});class ih{constructor(t){this.items=[],this._name=t}emit(t,e,i,r,n,a,o,h){const{name:c,items:l}=this;for(let u=0,d=l.length;u{this.runners[e]=new ih(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,e){const i=e.reduce((r,n)=>(r[n.name]=n.value,r),{});t.forEach(r=>{const n=r.value,a=r.name,o=i[a];this.renderPipes[a]=new n(this,o?new o:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Wo())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};bn.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let vn=bn,Ve;function nh(s){return Ve!==void 0||(Ve=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??vn.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let r=j.get().createCanvas().getContext("webgl",t);const n=!!((e=r==null?void 0:r.getContextAttributes())!=null&&e.stencil);if(r){const a=r.getExtension("WEBGL_lose_context");a&&a.loseContext()}return r=null,n}catch{return!1}})()),Ve}let Ye;async function ah(s={}){return Ye!==void 0||(Ye=await(async()=>{const t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),Ye}const Ki=["webgl","webgpu","canvas"];async function oh(s){let t=[];s.preference?(t.push(s.preference),Ki.forEach(n=>{n!==s.preference&&t.push(n)})):t=Ki.slice();let e,i={};for(let n=0;n{const{WebGPURenderer:h}=await import("./WebGPURenderer-Br-xQwCk.js");return{WebGPURenderer:h}},__vite__mapDeps([3,2,4]));e=o,i={...s,...s.webgpu};break}else if(a==="webgl"&&nh(s.failIfMajorPerformanceCaveat??vn.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:o}=await Je(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-BWeZKVf6.js");return{WebGLRenderer:h}},__vite__mapDeps([5,2,4]));e=o,i={...s,...s.webgl};break}else if(a==="canvas")throw i={...s},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");const r=new e;return await r.init(i),r}const Sn="8.4.0";class An{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,Sn)}static destroy(){}}An.extension=P.Application;class hh{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,Sn)}destroy(){this._renderer=null}}hh.extension={type:[P.WebGLSystem,P.WebGPUSystem],name:"initHook",priority:-10};const Cn=class Qs{constructor(...t){this.stage=new st,t[0]!==void 0&&L(z,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await oh(t),Qs._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return L(z,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const i=Qs._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Cn._plugins=[];let Tn=Cn;rt.handleByList(P.Application,Tn._plugins);rt.add(An);class Mn extends ot{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return L(z,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return L(z,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return L(z,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return L(z,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return L(z,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}const Pn=class Js{constructor(t,e,i,r){this.uid=J("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=i,this.y1=r}addColorStop(t,e){return this.gradientStops.push({offset:t,color:Z.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){const t=Js.defaultTextureSize,{gradientStops:e}=this,i=j.get().createCanvas();i.width=t,i.height=t;const r=i.getContext("2d"),n=r.createLinearGradient(0,0,Js.defaultTextureSize,1);for(let m=0;m`${r.offset}-${r.color}`).join("-"),e=this.texture.uid,i=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${i}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};Pn.defaultTextureSize=256;let Me=Pn;const Zi={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class ls{constructor(t,e){this.uid=J("fillPattern"),this.transform=new O,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Zi[e].addressModeU,t.source.style.addressModeV=Zi[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}var lh=uh,ks={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},ch=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function uh(s){var t=[];return s.replace(ch,function(e,i,r){var n=i.toLowerCase();for(r=fh(r),n=="m"&&r.length>2&&(t.push([i].concat(r.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(r.length==ks[n])return r.unshift(i),t.push(r);if(r.length0&&(r=i.pop(),r?(n=r.startX,a=r.startY):(n=0,a=0)),r=null;break;default:Q(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&r===null&&(r={startX:n,startY:a},i.push(r))}return t}class fi{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new fi(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}strokeContains(t,e,i){if(this.radius===0)return!1;const r=this.x-t,n=this.y-e,a=this.radius,o=i/2,h=Math.sqrt(r*r+n*n);return ha-o}getBounds(t){return t=t||new W,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class pi{constructor(t=0,e=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=r}clone(){return new pi(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,e,i){const{halfWidth:r,halfHeight:n}=this;if(r<=0||n<=0)return!1;const a=i/2,o=r-a,h=n-a,c=r+a,l=n+a,u=t-this.x,d=e-this.y,f=u*u/(o*o)+d*d/(h*h),p=u*u/(c*c)+d*d/(l*l);return f>1&&p<=1}getBounds(t){return t=t||new W,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function mh(s,t,e,i,r,n){const a=s-e,o=t-i,h=r-e,c=n-i,l=a*h+o*c,u=h*h+c*c;let d=-1;u!==0&&(d=l/u);let f,p;d<0?(f=e,p=i):d>1?(f=r,p=n):(f=e+d*h,p=i+d*c);const m=s-f,g=t-p;return m*m+g*g}class we{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;re!=l>e&&t<(c-o)*((e-h)/(l-h))+o&&(i=!i)}return i}strokeContains(t,e,i){const r=i/2,n=r*r,{points:a}=this,o=a.length-(this.closePath?0:2);for(let h=0;hr?c:r,n=la?l:a}return t.x=i,t.width=r-i,t.y=n,t.height=a-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Xe=(s,t,e,i,r,n)=>{const a=s-e,o=t-i,h=Math.sqrt(a*a+o*o);return h>=r-n&&h<=r+n};class gi{constructor(t=0,e=0,i=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n}getBounds(t){return t=t||new W,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new gi(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const a=i*i;if(r*r+n*n<=a||(r=t-(this.x+this.width-i),r*r+n*n<=a)||(n=e-(this.y+this.height-i),r*r+n*n<=a)||(r=t-(this.x+i),r*r+n*n<=a))return!0}return!1}strokeContains(t,e,i){const{x:r,y:n,width:a,height:o,radius:h}=this,c=i/2,l=r+h,u=n+h,d=a-h*2,f=o-h*2,p=r+a,m=n+o;return(t>=r-c&&t<=r+c||t>=p-c&&t<=p+c)&&e>=u&&e<=u+f||(e>=n-c&&e<=n+c||e>=m-c&&e<=m+c)&&t>=l&&t<=l+d?!0:tp-h&&ep-h&&e>m-h&&Xe(t,e,p-h,m-h,h,c)||tm-h&&Xe(t,e,l,m-h,h,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const xh=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +${s}`}function ko(s,t){return t?s.replace("#version 300 es",""):s}const Cs={stripVersion:ko,ensurePrecision:Ao,addProgramDefines:So,setProgramName:Po,insertVersion:Co},Ts=Object.create(null),un=class Ys{constructor(t){t={...Ys.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:vo()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(Cs).forEach(a=>{const o=i[a];r=Cs[a](r,o,!0),n=Cs[a](n,o,!1)}),this.fragment=r,this.vertex=n,this._key=ui(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Ts[e]||(Ts[e]=new Ys(t)),Ts[e]}};un.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let dn=un;const qi={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function Bo(s){return qi[s]??qi.float32}const Io={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"};function Eo({source:s,entryPoint:t}){const e={},i=s.indexOf(`fn ${t}`);if(i!==-1){const r=s.indexOf("->",i);if(r!==-1){const n=s.substring(i,r),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let o;for(;(o=a.exec(n))!==null;){const h=Io[o[3]]??"float32";e[o[2]]={location:parseInt(o[1],10),format:h,stride:Bo(h).stride,offset:0,instance:!1,start:0}}}}return e}function Ms(s){var u,d;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,n=/:\s*(\w+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,c=(u=s.match(t))==null?void 0:u.map(f=>({group:parseInt(f.match(e)[1],10),binding:parseInt(f.match(i)[1],10),name:f.match(r)[2],isUniform:f.match(r)[1]==="",type:f.match(n)[1]}));if(!c)return{groups:[],structs:[]};const l=((d=s.match(a))==null?void 0:d.map(f=>{const p=f.match(h)[1],m=f.match(o).reduce((g,_)=>{const[b,w]=_.split(":");return g[b.trim()]=w.trim(),g},{});return m?{name:p,members:m}:null}).filter(({name:f})=>c.some(p=>p.type===f)))??[];return{groups:c,structs:l}}var be=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(be||{});function Fo({groups:s}){const t=[];for(let e=0;ee.has(a.name)?!1:(e.add(a.name),!0)),n=[...s.groups,...t.groups].filter(a=>{const o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:r,groups:n}}const Ps=Object.create(null);class as{constructor(t){var o,h;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:r,gpuLayout:n,name:a}=t;if(this.name=a,this.fragment=e,this.vertex=i,e.source===i.source){const c=Ms(e.source);this.structsAndGroups=c}else{const c=Ms(i.source),l=Ms(e.source);this.structsAndGroups=Go(c,l)}this.layout=r??Ro(this.structsAndGroups),this.gpuLayout=n??Fo(this.structsAndGroups),this.autoAssignGlobalUniforms=((o=this.layout[0])==null?void 0:o.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((h=this.layout[1])==null?void 0:h.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ui(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Eo(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Ps[e]||(Ps[e]=new as(t)),Ps[e]}}const fn=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],Lo=fn.reduce((s,t)=>(s[t]=!0,s),{});function zo(s,t){switch(s){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const pn=class gn{constructor(t,e){this._touched=0,this.uid=J("uniform"),this._resourceType="uniformGroup",this._resourceId=J("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...gn.defaultOptions,...e},this.uniformStructures=t;const i={};for(const r in t){const n=t[r];if(n.name=r,n.size=n.size??1,!Lo[n.type])throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${fn.join(", ")}`);n.value??(n.value=zo(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ui(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};pn.defaultOptions={ubo:!1,isStatic:!1};let mn=pn;class Ze{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var r,n;const i=this.resources[e];t!==i&&(i&&((r=t.off)==null||r.call(t,"change",this.onResourceChange,this)),(n=t.on)==null||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const i in e)e[i]._touched=t}destroy(){var e;const t=this.resources;for(const i in t){const r=t[i];(e=r.off)==null||e.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}var Xs=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.BOTH=3]="BOTH",s))(Xs||{});class di extends ht{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:r,resources:n,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=e,this.glProgram=i,a===void 0&&(a=0,e&&(a|=Xs.WEBGPU),i&&(a|=Xs.WEBGL)),this.compatibleRenderers=a;const h={};if(!n&&!r&&(n={}),n&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&o)for(const c in o)for(const l in o[c]){const u=o[c][l];h[u]={group:c,binding:l,name:u}}else if(e&&r&&!o){const c=e.structsAndGroups.groups;o={},c.forEach(l=>{o[l.group]=o[l.group]||{},o[l.group][l.binding]=l.name,h[l.name]=l})}else if(n){r={},o={},e&&e.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,h[u.name]=u});let c=0;for(const l in n)h[l]||(r[99]||(r[99]=new Ze,this._ownedBindGroups.push(r[99])),h[l]={group:99,binding:c,name:l},o[99]=o[99]||{},o[99][c]=l,c++);for(const l in n){const u=l;let d=n[l];!d.source&&!d._resourceType&&(d=new mn(d));const f=h[u];f&&(r[f.group]||(r[f.group]=new Ze,this._ownedBindGroups.push(r[f.group])),r[f.group].setResource(d,f.binding))}}this.groups=r,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(r,h)}addResource(t,e,i){var r,n;(r=this._uniformBindMap)[e]||(r[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new Ze,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const r in e){const n=e[r];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(a){t[n.group].setResource(a,n.binding)}})}return i}destroy(t=!1){var e,i;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const{gpu:e,gl:i,...r}=t;let n,a;return e&&(n=as.from(e)),i&&(a=dn.from(i)),new di({gpuProgram:n,glProgram:a,...r})}}const js=[];nt.handleByNamedList(P.Environment,js);async function Wo(s){if(!s)for(let t=0;t80*e){o=c=s[0],h=l=s[1];for(var p=e;pc&&(c=u),d>l&&(l=d);f=Math.max(c-o,l-h),f=f!==0?32767/f:0}return Te(n,a,e,o,h,f,0),a}function xn(s,t,e,i,r){var n,a;if(r===Zs(s,t,e,i)>0)for(n=t;n=t;n-=i)a=Ki(n,s[n],s[n+1],a);return a&&hs(a,a.next)&&(Pe(a),a=a.next),a}function $t(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(hs(e,e.next)||Y(e.prev,e,e.next)===0)){if(Pe(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Te(s,t,e,i,r,n,a){if(s){!a&&n&&qo(s,i,r,n);for(var o=s,h,c;s.prev!==s.next;){if(h=s.prev,c=s.next,n?Do(s,i,r,n):Uo(s)){t.push(h.i/e|0),t.push(s.i/e|0),t.push(c.i/e|0),Pe(s),s=c.next,o=c.next;continue}if(s=c,s===o){a?a===1?(s=Ho($t(s),t,e),Te(s,t,e,i,r,n,2)):a===2&&No(s,t,e,i,r,n):Te($t(s),t,e,i,r,n,1);break}}}}function Uo(s){var t=s.prev,e=s,i=s.next;if(Y(t,e,i)>=0)return!1;for(var r=t.x,n=e.x,a=i.x,o=t.y,h=e.y,c=i.y,l=rn?r>a?r:a:n>a?n:a,f=o>h?o>c?o:c:h>c?h:c,p=i.next;p!==t;){if(p.x>=l&&p.x<=d&&p.y>=u&&p.y<=f&&qt(r,o,n,h,a,c,p.x,p.y)&&Y(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Do(s,t,e,i){var r=s.prev,n=s,a=s.next;if(Y(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,c=a.x,l=r.y,u=n.y,d=a.y,f=oh?o>c?o:c:h>c?h:c,g=l>u?l>d?l:d:u>d?u:d,_=qs(f,p,t,e,i),b=qs(m,g,t,e,i),w=s.prevZ,v=s.nextZ;w&&w.z>=_&&v&&v.z<=b;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==r&&w!==a&&qt(o,l,h,u,c,d,w.x,w.y)&&Y(w.prev,w,w.next)>=0||(w=w.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&qt(o,l,h,u,c,d,v.x,v.y)&&Y(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;w&&w.z>=_;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==r&&w!==a&&qt(o,l,h,u,c,d,w.x,w.y)&&Y(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;v&&v.z<=b;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&qt(o,l,h,u,c,d,v.x,v.y)&&Y(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Ho(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!hs(r,n)&&yn(r,i,i.next,n)&&Me(r,n)&&Me(n,r)&&(t.push(r.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Pe(i),Pe(i.next),i=s=n),i=i.next}while(i!==s);return $t(i)}function No(s,t,e,i,r,n){var a=s;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Qo(a,o)){var h=_n(a,o);a=$t(a,a.next),h=$t(h,h.next),Te(a,t,e,i,r,n,0),Te(h,t,e,i,r,n,0);return}o=o.next}a=a.next}while(a!==s)}function $o(s,t,e,i){var r=[],n,a,o,h,c;for(n=0,a=t.length;n=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=i&&o>n&&(n=o,a=e.x=e.x&&e.x>=c&&i!==e.x&&qt(ra.x||e.x===a.x&&jo(a,e)))&&(a=e,u=d)),e=e.next;while(e!==h);return a}function jo(s,t){return Y(s.prev,s,t.prev)<0&&Y(t.next,s,s.next)<0}function qo(s,t,e,i){var r=s;do r.z===0&&(r.z=qs(r.x,r.y,t,e,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==s);r.prevZ.nextZ=null,r.prevZ=null,Ko(r)}function Ko(s){var t,e,i,r,n,a,o,h,c=1;do{for(e=s,s=null,n=null,a=0;e;){for(a++,i=e,o=0,t=0;t0||h>0&&i;)o!==0&&(h===0||!i||e.z<=i.z)?(r=e,e=e.nextZ,o--):(r=i,i=i.nextZ,h--),n?n.nextZ=r:s=r,r.prevZ=n,n=r;e=i}n.nextZ=null,c*=2}while(a>1);return s}function qs(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function Zo(s){var t=s,e=s;do(t.x=(s-a)*(n-o)&&(s-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(i-o)}function Qo(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!Jo(s,t)&&(Me(s,t)&&Me(t,s)&&th(s,t)&&(Y(s.prev,s,t.prev)||Y(s,t.prev,t))||hs(s,t)&&Y(s.prev,s,s.next)>0&&Y(t.prev,t,t.next)>0)}function Y(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function hs(s,t){return s.x===t.x&&s.y===t.y}function yn(s,t,e,i){var r=$e(Y(s,t,e)),n=$e(Y(s,t,i)),a=$e(Y(e,i,s)),o=$e(Y(e,i,t));return!!(r!==n&&a!==o||r===0&&Ne(s,e,t)||n===0&&Ne(s,i,t)||a===0&&Ne(e,s,i)||o===0&&Ne(e,t,i))}function Ne(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function $e(s){return s>0?1:s<0?-1:0}function Jo(s,t){var e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&yn(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Me(s,t){return Y(s.prev,s,s.next)<0?Y(s,t,s.next)>=0&&Y(s,s.prev,t)>=0:Y(s,t,s.prev)<0||Y(s,s.next,t)<0}function th(s,t){var e=s,i=!1,r=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==s);return i}function _n(s,t){var e=new Ks(s.i,s.x,s.y),i=new Ks(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Ki(s,t,e,i){var r=new Ks(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Pe(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Ks(s,t,e){this.i=s,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}os.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,a=Math.abs(Zs(s,0,n,e));if(r)for(var o=0,h=t.length;o0&&(i+=s[r-1].length,e.holes.push(i))}return e};var eh=fi.exports;const sh=hi(eh);var bn=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=16384]="COLOR",s[s.STENCIL=1024]="STENCIL",s[s.DEPTH=256]="DEPTH",s[s.COLOR_DEPTH=16640]="COLOR_DEPTH",s[s.COLOR_STENCIL=17408]="COLOR_STENCIL",s[s.DEPTH_STENCIL=1280]="DEPTH_STENCIL",s[s.ALL=17664]="ALL",s))(bn||{});class ih{constructor(t){this.items=[],this._name=t}emit(t,e,i,r,n,a,o,h){const{name:c,items:l}=this;for(let u=0,d=l.length;u{this.runners[e]=new ih(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,e){const i=e.reduce((r,n)=>(r[n.name]=n.value,r),{});t.forEach(r=>{const n=r.value,a=r.name,o=i[a];this.renderPipes[a]=new n(this,o?new o:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Oo())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};wn.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Sn=wn,Ve;function nh(s){return Ve!==void 0||(Ve=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??Sn.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let r=j.get().createCanvas().getContext("webgl",t);const n=!!((e=r==null?void 0:r.getContextAttributes())!=null&&e.stencil);if(r){const a=r.getExtension("WEBGL_lose_context");a&&a.loseContext()}return r=null,n}catch{return!1}})()),Ve}let Ye;async function ah(s={}){return Ye!==void 0||(Ye=await(async()=>{const t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),Ye}const Zi=["webgl","webgpu","canvas"];async function oh(s){let t=[];s.preference?(t.push(s.preference),Zi.forEach(n=>{n!==s.preference&&t.push(n)})):t=Zi.slice();let e,i={};for(let n=0;n{const{WebGPURenderer:h}=await import("./WebGPURenderer-t84VRX_L.js");return{WebGPURenderer:h}},__vite__mapDeps([3,2,4]));e=o,i={...s,...s.webgpu};break}else if(a==="webgl"&&nh(s.failIfMajorPerformanceCaveat??Sn.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:o}=await Je(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-BBZmp4E6.js");return{WebGLRenderer:h}},__vite__mapDeps([5,2,4]));e=o,i={...s,...s.webgl};break}else if(a==="canvas")throw i={...s},new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!e)throw new Error("No available renderer for the current environment");const r=new e;return await r.init(i),r}const An="8.4.0";class Cn{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,An)}static destroy(){}}Cn.extension=P.Application;class hh{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,An)}destroy(){this._renderer=null}}hh.extension={type:[P.WebGLSystem,P.WebGPUSystem],name:"initHook",priority:-10};const Tn=class Qs{constructor(...t){this.stage=new it,t[0]!==void 0&&W(O,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await oh(t),Qs._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return W(O,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const i=Qs._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Tn._plugins=[];let Mn=Tn;nt.handleByList(P.Application,Mn._plugins);nt.add(Cn);class Pn extends ht{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return W(O,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return W(O,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return W(O,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return W(O,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return W(O,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}const kn=class Js{constructor(t,e,i,r){this.uid=J("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=i,this.y1=r}addColorStop(t,e){return this.gradientStops.push({offset:t,color:Z.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){const t=Js.defaultTextureSize,{gradientStops:e}=this,i=j.get().createCanvas();i.width=t,i.height=t;const r=i.getContext("2d"),n=r.createLinearGradient(0,0,Js.defaultTextureSize,1);for(let m=0;m`${r.offset}-${r.color}`).join("-"),e=this.texture.uid,i=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${i}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};kn.defaultTextureSize=256;let ke=kn;const Qi={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class ls{constructor(t,e){this.uid=J("fillPattern"),this.transform=new U,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Qi[e].addressModeU,t.source.style.addressModeV=Qi[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}var lh=uh,ks={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},ch=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function uh(s){var t=[];return s.replace(ch,function(e,i,r){var n=i.toLowerCase();for(r=fh(r),n=="m"&&r.length>2&&(t.push([i].concat(r.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(r.length==ks[n])return r.unshift(i),t.push(r);if(r.length0&&(r=i.pop(),r?(n=r.startX,a=r.startY):(n=0,a=0)),r=null;break;default:Q(`Unknown SVG path command: ${c}`)}c!=="Z"&&c!=="z"&&r===null&&(r={startX:n,startY:a},i.push(r))}return t}class pi{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new pi(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}strokeContains(t,e,i){if(this.radius===0)return!1;const r=this.x-t,n=this.y-e,a=this.radius,o=i/2,h=Math.sqrt(r*r+n*n);return ha-o}getBounds(t){return t=t||new D,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class gi{constructor(t=0,e=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=r}clone(){return new gi(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,e,i){const{halfWidth:r,halfHeight:n}=this;if(r<=0||n<=0)return!1;const a=i/2,o=r-a,h=n-a,c=r+a,l=n+a,u=t-this.x,d=e-this.y,f=u*u/(o*o)+d*d/(h*h),p=u*u/(c*c)+d*d/(l*l);return f>1&&p<=1}getBounds(t){return t=t||new D,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function mh(s,t,e,i,r,n){const a=s-e,o=t-i,h=r-e,c=n-i,l=a*h+o*c,u=h*h+c*c;let d=-1;u!==0&&(d=l/u);let f,p;d<0?(f=e,p=i):d>1?(f=r,p=n):(f=e+d*h,p=i+d*c);const m=s-f,g=t-p;return m*m+g*g}class Se{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;re!=l>e&&t<(c-o)*((e-h)/(l-h))+o&&(i=!i)}return i}strokeContains(t,e,i){const r=i/2,n=r*r,{points:a}=this,o=a.length-(this.closePath?0:2);for(let h=0;hr?c:r,n=la?l:a}return t.x=i,t.width=r-i,t.y=n,t.height=a-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Xe=(s,t,e,i,r,n)=>{const a=s-e,o=t-i,h=Math.sqrt(a*a+o*o);return h>=r-n&&h<=r+n};class mi{constructor(t=0,e=0,i=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n}getBounds(t){return t=t||new D,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new mi(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const a=i*i;if(r*r+n*n<=a||(r=t-(this.x+this.width-i),r*r+n*n<=a)||(n=e-(this.y+this.height-i),r*r+n*n<=a)||(r=t-(this.x+i),r*r+n*n<=a))return!0}return!1}strokeContains(t,e,i){const{x:r,y:n,width:a,height:o,radius:h}=this,c=i/2,l=r+h,u=n+h,d=a-h*2,f=o-h*2,p=r+a,m=n+o;return(t>=r-c&&t<=r+c||t>=p-c&&t<=p+c)&&e>=u&&e<=u+f||(e>=n-c&&e<=n+c||e>=m-c&&e<=m+c)&&t>=l&&t<=l+d?!0:tp-h&&ep-h&&e>m-h&&Xe(t,e,p-h,m-h,h,c)||tm-h&&Xe(t,e,l,m-h,h,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const xh=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function yh(s){let t="";for(let e=0;e0&&(t+=` -else `),e>>=0;return Bn[e]||wh(s,t,e)}let Bs=0;function wh(s,t,e){const i={};let r=0;Bs||(Bs=kn());for(let a=0;a0){const a=new Uint8Array(s,e*8,n);new Uint8Array(t,e*8,n).set(a)}}const vh={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var Sh=(s=>(s[s.DISABLED=0]="DISABLED",s[s.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",s[s.MASK_ACTIVE=2]="MASK_ACTIVE",s[s.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",s[s.NONE=4]="NONE",s))(Sh||{});function tr(s,t){return t.alphaMode==="no-premultiply-alpha"&&vh[s]||s}class Ah{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?In[--ti]:new Ch}function sr(s){In[ti++]=s}let pe=0;const En=class Qe{constructor(t={}){this.uid=J("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Qe.defaultOptions.maxTextures=Qe.defaultOptions.maxTextures??kn(),t={...Qe.defaultOptions,...t};const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new Qi(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const o=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer;let l=this._batchIndexSize,u=this._batchIndexStart,d="startBatch";const f=this.maxTextures;for(let p=this.elementStart;p=f||b)&&(this._finishBatch(i,u,l-u,r,a,t,d),d="renderBatch",u=l,a=_,i=er(),r=i.textures,r.clear(),++pe),m._textureId=y._textureBindLocation=r.count,r.ids[y.uid]=r.count,r.textures[r.count++]=y,m._batch=i,l+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,o,h,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,o,h,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(i,u,l-u,r,a,t,d),u=l,++pe),this.elementStart=this.elementSize,this._batchIndexStart=u,this._batchIndexSize=l}_finishBatch(t,e,i,r,n,a,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=r,t.blendMode=n,t.start=e,t.size=i,++pe,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new Qi(e);Ji(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(K||{});class Bt extends ot{constructor(t){let{data:e,size:i}=t;const{usage:r,label:n,shrinkToFit:a}=t;super(),this.uid=J("buffer"),this._resourceType="buffer",this._resourceId=J("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i??(e==null?void 0:e.byteLength);const o=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:o,label:n},this.shrinkToFit=a??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&K.STATIC)}set static(t){t?this.descriptor.usage|=K.STATIC:this.descriptor.usage&=~K.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,r.length!==t.length){!this.shrinkToFit&&t.byteLengtho&&(o=f),p>h&&(h=p),fe.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const kh=new Float32Array(1),Bh=new Uint32Array(1);class Ih extends Rn{constructor(){const e=new Bt({data:kh,label:"attribute-batch-buffer",usage:K.VERTEX|K.COPY_DST,shrinkToFit:!1}),i=new Bt({data:Bh,label:"index-batch-buffer",usage:K.INDEX|K.COPY_DST,shrinkToFit:!1}),r=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:5*4}},indexBuffer:i})}}function ir(s,t,e){if(s)for(const i in s){const r=i.toLocaleLowerCase(),n=t[r];if(n){let a=s[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(a)}else Q(`${i} placement hook does not exist in shader`)}}const Eh=/\{\{(.*?)\}\}/g;function rr(s){var i;const t={};return(((i=s.match(Eh))==null?void 0:i.map(r=>r.replace(/[{()}]/g,"")))??[]).forEach(r=>{t[r]=[]}),t}function nr(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function ar(s,t,e=!1){const i=[];nr(t,i),s.forEach(o=>{o.header&&nr(o.header,i)});const r=i;e&&r.sort();const n=r.map((o,h)=>` @location(${h}) ${o},`).join(` +else `),e>>=0;return In[e]||wh(s,t,e)}let Bs=0;function wh(s,t,e){const i={};let r=0;Bs||(Bs=Bn());for(let a=0;a0){const a=new Uint8Array(s,e*8,n);new Uint8Array(t,e*8,n).set(a)}}const vh={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var Sh=(s=>(s[s.DISABLED=0]="DISABLED",s[s.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",s[s.MASK_ACTIVE=2]="MASK_ACTIVE",s[s.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",s[s.NONE=4]="NONE",s))(Sh||{});function er(s,t){return t.alphaMode==="no-premultiply-alpha"&&vh[s]||s}class Ah{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?En[--ti]:new Ch}function ir(s){En[ti++]=s}let me=0;const Fn=class Qe{constructor(t={}){this.uid=J("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Qe.defaultOptions.maxTextures=Qe.defaultOptions.maxTextures??Bn(),t={...Qe.defaultOptions,...t};const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new Ji(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const o=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer;let l=this._batchIndexSize,u=this._batchIndexStart,d="startBatch";const f=this.maxTextures;for(let p=this.elementStart;p=f||w)&&(this._finishBatch(i,u,l-u,r,a,t,d),d="renderBatch",u=l,a=b,i=sr(),r=i.textures,r.clear(),++me),m._textureId=_._textureBindLocation=r.count,r.ids[_.uid]=r.count,r.textures[r.count++]=_,m._batch=i,l+=m.indexSize,m.packAsQuad?(this.packQuadAttributes(m,o,h,m._attributeStart,m._textureId),this.packQuadIndex(c,m._indexStart,m._attributeStart/this.vertexSize)):(this.packAttributes(m,o,h,m._attributeStart,m._textureId),this.packIndex(m,c,m._indexStart,m._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(i,u,l-u,r,a,t,d),u=l,++me),this.elementStart=this.elementSize,this._batchIndexStart=u,this._batchIndexSize=l}_finishBatch(t,e,i,r,n,a,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=r,t.blendMode=n,t.start=e,t.size=i,++me,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new Ji(e);tr(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(K||{});class Bt extends ht{constructor(t){let{data:e,size:i}=t;const{usage:r,label:n,shrinkToFit:a}=t;super(),this.uid=J("buffer"),this._resourceType="buffer",this._resourceId=J("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i??(e==null?void 0:e.byteLength);const o=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:o,label:n},this.shrinkToFit=a??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&K.STATIC)}set static(t){t?this.descriptor.usage|=K.STATIC:this.descriptor.usage&=~K.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,r.length!==t.length){!this.shrinkToFit&&t.byteLengtho&&(o=f),p>h&&(h=p),fe.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const kh=new Float32Array(1),Bh=new Uint32Array(1);class Ih extends Gn{constructor(){const e=new Bt({data:kh,label:"attribute-batch-buffer",usage:K.VERTEX|K.COPY_DST,shrinkToFit:!1}),i=new Bt({data:Bh,label:"index-batch-buffer",usage:K.INDEX|K.COPY_DST,shrinkToFit:!1}),r=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:5*4}},indexBuffer:i})}}function rr(s,t,e){if(s)for(const i in s){const r=i.toLocaleLowerCase(),n=t[r];if(n){let a=s[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(a)}else Q(`${i} placement hook does not exist in shader`)}}const Eh=/\{\{(.*?)\}\}/g;function nr(s){var i;const t={};return(((i=s.match(Eh))==null?void 0:i.map(r=>r.replace(/[{()}]/g,"")))??[]).forEach(r=>{t[r]=[]}),t}function ar(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function or(s,t,e=!1){const i=[];ar(t,i),s.forEach(o=>{o.header&&ar(o.header,i)});const r=i;e&&r.sort();const n=r.map((o,h)=>` @location(${h}) ${o},`).join(` `);let a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",` ${n} -`),a}function or(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function Fh(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function Rh(s){const t=/@.*?\s+/g;return s.replace(t,"")}function Gh(s,t){const e=[];or(t,e),s.forEach(h=>{h.header&&or(h.header,e)});let i=0;const r=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${i++}) ${h}`).join(`, +`),a}function hr(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function Fh(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function Rh(s){const t=/@.*?\s+/g;return s.replace(t,"")}function Gh(s,t){const e=[];hr(t,e),s.forEach(h=>{h.header&&hr(h.header,e)});let i=0;const r=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${i++}) ${h}`).join(`, `),n=e.sort().map(h=>` var ${Rh(h)};`).join(` `),a=`return VSOutput( ${e.sort().map(h=>` ${Fh(h)}`).join(`, @@ -37,11 +37,11 @@ ${r} ${n} `),o=o.replace("{{return}}",` ${a} -`),o}function hr(s,t){let e=s;for(const i in t){const r=t[i];r.join(` +`),o}function lr(s,t){let e=s;for(const i in t){const r=t[i];r.join(` `).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----// ${r.join(` `)} -//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const kt=Object.create(null),Is=new Map;let Lh=0;function zh({template:s,bits:t}){const e=Gn(s,t);if(kt[e])return kt[e];const{vertex:i,fragment:r}=Wh(s,t);return kt[e]=Ln(i,r,t),kt[e]}function Oh({template:s,bits:t}){const e=Gn(s,t);return kt[e]||(kt[e]=Ln(s.vertex,s.fragment,t)),kt[e]}function Wh(s,t){const e=t.map(a=>a.vertex).filter(a=>!!a),i=t.map(a=>a.fragment).filter(a=>!!a);let r=ar(e,s.vertex,!0);r=Gh(e,r);const n=ar(i,s.fragment,!0);return{vertex:r,fragment:n}}function Gn(s,t){return t.map(e=>(Is.has(e)||Is.set(e,Lh++),Is.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function Ln(s,t,e){const i=rr(s),r=rr(t);return e.forEach(n=>{ir(n.vertex,i,n.name),ir(n.fragment,r,n.name)}),{vertex:hr(s,i),fragment:hr(t,r)}}const Uh=` +//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const kt=Object.create(null),Is=new Map;let Lh=0;function zh({template:s,bits:t}){const e=Ln(s,t);if(kt[e])return kt[e];const{vertex:i,fragment:r}=Oh(s,t);return kt[e]=zn(i,r,t),kt[e]}function Wh({template:s,bits:t}){const e=Ln(s,t);return kt[e]||(kt[e]=zn(s.vertex,s.fragment,t)),kt[e]}function Oh(s,t){const e=t.map(a=>a.vertex).filter(a=>!!a),i=t.map(a=>a.fragment).filter(a=>!!a);let r=or(e,s.vertex,!0);r=Gh(e,r);const n=or(i,s.fragment,!0);return{vertex:r,fragment:n}}function Ln(s,t){return t.map(e=>(Is.has(e)||Is.set(e,Lh++),Is.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function zn(s,t,e){const i=nr(s),r=nr(t);return e.forEach(n=>{rr(n.vertex,i,n.name),rr(n.fragment,r,n.name)}),{vertex:lr(s,i),fragment:lr(t,r)}}const Uh=` @in aPosition: vec2; @in aUV: vec2; @@ -179,7 +179,7 @@ ${r.join(` uniform mat3 uWorldTransformMatrix; uniform vec4 uWorldColorAlpha; uniform vec2 uResolution; - `}};function Yh({bits:s,name:t}){const e=zh({template:{fragment:Dh,vertex:Uh},bits:[$h,...s]});return as.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Xh({bits:s,name:t}){return new un({name:t,...Oh({template:{vertex:Hh,fragment:Nh},bits:[Vh,...s]})})}const jh={name:"color-bit",vertex:{header:` + `}};function Yh({bits:s,name:t}){const e=zh({template:{fragment:Dh,vertex:Uh},bits:[$h,...s]});return as.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Xh({bits:s,name:t}){return new dn({name:t,...Wh({template:{vertex:Hh,fragment:Nh},bits:[Vh,...s]})})}const jh={name:"color-bit",vertex:{header:` @in aColor: vec4; `,main:` vColor *= vec4(aColor.rgb * aColor.a, aColor.a); @@ -238,12 +238,12 @@ ${r.join(` { return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; } - `}},lr={};function il(s){let t=lr[s];if(t)return t;const e=new Int32Array(s);for(let i=0;i>16&255,i=s>>8&255,r=s&255,n=t>>16&255,a=t>>8&255,o=t&255,h=e*n/255,c=i*a/255,l=r*o/255;return(h<<16)+(c<<8)+l}const ll=new O;class Un{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?hl(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||ll}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0}}const Pe={extension:{type:P.ShapeBuilder,name:"circle"},build(s,t){let e,i,r,n,a,o;if(s.type==="circle"){const v=s;e=v.x,i=v.y,a=o=v.radius,r=n=0}else if(s.type==="ellipse"){const v=s;e=v.x,i=v.y,a=v.halfWidth,o=v.halfHeight,r=n=0}else{const v=s,C=v.width/2,E=v.height/2;e=v.x+C,i=v.y+E,a=o=Math.max(0,Math.min(v.radius,Math.min(C,E))),r=C-a,n=E-o}if(!(a>=0&&o>=0&&r>=0&&n>=0))return t;const h=Math.ceil(2.3*Math.sqrt(a+o)),c=h*8+(r?4:0)+(n?4:0);if(c===0)return t;if(h===0)return t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n,t;let l=0,u=h*4+(r?2:0)+2,d=u,f=c,p=r+a,m=n,g=e+p,y=e-p,_=i+m;if(t[l++]=g,t[l++]=_,t[--u]=_,t[--u]=y,n){const v=i-m;t[d++]=y,t[d++]=v,t[--f]=v,t[--f]=g}for(let v=1;v0&&(r[n++]=h,r[n++]=c,r[n++]=h-1),h++;r[n++]=c+1,r[n++]=c,r[n++]=h-1}},cl={...Pe,extension:{...Pe.extension,name:"ellipse"}},ul={...Pe,extension:{...Pe.extension,name:"roundedRectangle"}},dl=1e-4,ur=1e-4;function fl(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,r=s[t-2],n=s[t-1];iu&&(u+=Math.PI*2);let d=l;const f=u-l,p=Math.abs(f),m=Math.sqrt(h*h+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,o){a.push(s,t),a.push(e,i);for(let _=1,b=d;_=0&&(l.join==="round"?_+=Ot(S,A,S-F*B,A-I*B,S-N*B,A-q*B,g,!1)+4:_+=2,g.push(S-N*R,A-q*R),g.push(S+N*B,A+q*B));continue}const Ci=(-F+M)*(-I+A)-(-F+S)*(-I+k),Ti=(-N+X)*(-q+A)-(-N+S)*(-q+wt),Le=(Pt*Ti-le*Ci)/Ge,ze=(ce*Ci-he*Ti)/Ge,us=(Le-S)*(Le-S)+(ze-A)*(ze-A),Rt=S+(Le-S)*B,Gt=A+(ze-A)*B,Lt=S-(Le-S)*R,zt=A-(ze-A)*R,ma=Math.min(Pt*Pt+he*he,le*le+ce*ce),Mi=ue?B:R,xa=ma+Mi*Mi*C;us<=xa?l.join==="bevel"||us/C>E?(ue?(g.push(Rt,Gt),g.push(S+F*R,A+I*R),g.push(Rt,Gt),g.push(S+N*R,A+q*R)):(g.push(S-F*B,A-I*B),g.push(Lt,zt),g.push(S-N*B,A-q*B),g.push(Lt,zt)),_+=2):l.join==="round"?ue?(g.push(Rt,Gt),g.push(S+F*R,A+I*R),_+=Ot(S,A,S+F*R,A+I*R,S+N*R,A+q*R,g,!0)+4,g.push(Rt,Gt),g.push(S+N*R,A+q*R)):(g.push(S-F*B,A-I*B),g.push(Lt,zt),_+=Ot(S,A,S-F*B,A-I*B,S-N*B,A-q*B,g,!1)+4,g.push(S-N*B,A-q*B),g.push(Lt,zt)):(g.push(Rt,Gt),g.push(Lt,zt)):(g.push(S-F*B,A-I*B),g.push(S+F*R,A+I*R),l.join==="round"?ue?_+=Ot(S,A,S+F*R,A+I*R,S+N*R,A+q*R,g,!0)+2:_+=Ot(S,A,S-F*B,A-I*B,S-N*B,A-q*B,g,!1)+2:l.join==="miter"&&us/C<=E&&(ue?(g.push(Lt,zt),g.push(Lt,zt)):(g.push(Rt,Gt),g.push(Rt,Gt)),_+=2),g.push(S-N*B,A-q*B),g.push(S+N*R,A+q*R),_+=2)}M=s[(y-2)*2],k=s[(y-2)*2+1],S=s[(y-1)*2],A=s[(y-1)*2+1],F=-(k-A),I=M-S,ft=Math.sqrt(F*F+I*I),F/=ft,I/=ft,F*=v,I*=v,g.push(S-F*B,A-I*B),g.push(S+F*R,A+I*R),p||(l.cap==="round"?_+=Ot(S-F*(B-R)*.5,A-I*(B-R)*.5,S-F*B,A-I*B,S+F*R,A+I*R,g,!1)+2:l.cap==="square"&&(_+=dr(S,A,F,I,B,R,!1,g)));const ga=ur*ur;for(let H=b;H<_+b-2;++H)M=g[H*2],k=g[H*2+1],S=g[(H+1)*2],A=g[(H+1)*2+1],X=g[(H+2)*2],wt=g[(H+2)*2+1],!(Math.abs(M*(A-wt)+S*(wt-k)+X*(k-A))=0&&a>=0&&(t[0]=i,t[1]=r,t[2]=i+n,t[3]=r,t[4]=i+n,t[5]=r+a,t[6]=i,t[7]=r+a),t},triangulate(s,t,e,i,r,n){let a=0;i*=e,t[i+a]=s[0],t[i+a+1]=s[1],a+=e,t[i+a]=s[2],t[i+a+1]=s[3],a+=e,t[i+a]=s[6],t[i+a+1]=s[7],a+=e,t[i+a]=s[4],t[i+a+1]=s[5],a+=e;const o=i/e;r[n++]=o,r[n++]=o+1,r[n++]=o+2,r[n++]=o+1,r[n++]=o+3,r[n++]=o+2}},yl={extension:{type:P.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,t},triangulate(s,t,e,i,r,n){let a=0;i*=e,t[i+a]=s[0],t[i+a+1]=s[1],a+=e,t[i+a]=s[2],t[i+a+1]=s[3],a+=e,t[i+a]=s[4],t[i+a+1]=s[5];const o=i/e;r[n++]=o,r[n++]=o+1,r[n++]=o+2}},cs={};rt.handleByMap(P.ShapeBuilder,cs);rt.add(xl,ml,yl,Pe,cl,ul);const _l=new W;function bl(s,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r{const f=h.length,p=a.length/2,m=[],g=cs[l.type];if(g.build(l,m),u&&Wn(m,u),i){const v=l.closePath??!0;pl(m,t,!1,v,a,2,p,h)}else if(e&&c===d){c!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const v=[],C=m.slice();vl(e.shapePath).forEach(M=>{v.push(C.length/2),C.push(...M)}),Dn(C,v,a,2,p,h,f)}else g.triangulate(m,a,2,p,h,f);const y=o.length/2,_=t.texture;if(_!==G.WHITE){const v=t.matrix;v&&(u&&v.append(u.clone().invert()),al(a,2,p,o,y,2,a.length/2-p,v))}else ol(o,y,2,a.length/2-p);const b=At.get(Un);b.indexOffset=f,b.indexSize=h.length-f,b.attributeOffset=p,b.attributeSize=a.length/2-p,b.baseColor=t.color,b.alpha=t.alpha,b.texture=_,b.geometryData=n,r.push(b)})}function vl(s){if(!s)return[];const t=s.shapePrimitives,e=[];for(let i=0;i{At.return(i)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};mi.extension={type:[P.WebGLSystem,P.WebGPUSystem,P.CanvasSystem],name:"graphicsContext"};mi.defaultOptions={bezierSmoothness:.5};let Hn=mi;const Cl=8,je=11920929e-14,Tl=1;function Nn(s,t,e,i,r,n,a,o,h,c){const u=Math.min(.99,Math.max(0,c??Hn.defaultOptions.bezierSmoothness));let d=(Tl-u)/1;return d*=d,Ml(t,e,i,r,n,a,o,h,s,d),s}function Ml(s,t,e,i,r,n,a,o,h,c){si(s,t,e,i,r,n,a,o,h,c,0),h.push(a,o)}function si(s,t,e,i,r,n,a,o,h,c,l){if(l>Cl)return;const u=(s+e)/2,d=(t+i)/2,f=(e+r)/2,p=(i+n)/2,m=(r+a)/2,g=(n+o)/2,y=(u+f)/2,_=(d+p)/2,b=(f+m)/2,v=(p+g)/2,C=(y+b)/2,E=(_+v)/2;if(l>0){let M=a-s,k=o-t;const S=Math.abs((e-a)*k-(i-o)*M),A=Math.abs((r-a)*k-(n-o)*M);if(S>je&&A>je){if((S+A)*(S+A)<=c*(M*M+k*k)){h.push(C,E);return}}else if(S>je){if(S*S<=c*(M*M+k*k)){h.push(C,E);return}}else if(A>je){if(A*A<=c*(M*M+k*k)){h.push(C,E);return}}else if(M=C-(s+a)/2,k=E-(t+o)/2,M*M+k*k<=c){h.push(C,E);return}}si(s,t,u,d,y,_,C,E,h,c,l+1),si(C,E,b,v,m,g,a,o,h,c,l+1)}const Pl=8,kl=11920929e-14,Bl=1;function Il(s,t,e,i,r,n,a,o){const c=Math.min(.99,Math.max(0,o??Hn.defaultOptions.bezierSmoothness));let l=(Bl-c)/1;return l*=l,El(t,e,i,r,n,a,s,l),s}function El(s,t,e,i,r,n,a,o){ii(a,s,t,e,i,r,n,o,0),a.push(r,n)}function ii(s,t,e,i,r,n,a,o,h){if(h>Pl)return;const c=(t+i)/2,l=(e+r)/2,u=(i+n)/2,d=(r+a)/2,f=(c+u)/2,p=(l+d)/2;let m=n-t,g=a-e;const y=Math.abs((i-n)*g-(r-a)*m);if(y>kl){if(y*y<=o*(m*m+g*g)){s.push(f,p);return}}else if(m=f-(t+n)/2,g=p-(e+a)/2,m*m+g*g<=o){s.push(f,p);return}ii(s,t,e,c,l,f,p,o,h+1),ii(s,f,p,u,d,n,a,o,h+1)}function $n(s,t,e,i,r,n,a,o){let h=Math.abs(r-n);(!a&&r>n||a&&n>r)&&(h=2*Math.PI-h),o=o||Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI))),o=Math.max(o,3);let c=h/o,l=r;c*=a?-1:1;for(let u=0;uu*h)}const ve=Math.PI*2,Rs={centerX:0,centerY:0,ang1:0,ang2:0},Gs=({x:s,y:t},e,i,r,n,a,o,h)=>{s*=e,t*=i;const c=r*s-n*t,l=n*s+r*t;return h.x=c+a,h.y=l+o,h};function Rl(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),n=Math.sin(s),a=Math.cos(s+t),o=Math.sin(s+t);return[{x:r-n*i,y:n+r*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}const pr=(s,t,e,i)=>{const r=s*i-t*e<0?-1:1;let n=s*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},Gl=(s,t,e,i,r,n,a,o,h,c,l,u,d)=>{const f=Math.pow(r,2),p=Math.pow(n,2),m=Math.pow(l,2),g=Math.pow(u,2);let y=f*p-f*g-p*m;y<0&&(y=0),y/=f*g+p*m,y=Math.sqrt(y)*(a===o?-1:1);const _=y*r/n*u,b=y*-n/r*l,v=c*_-h*b+(s+e)/2,C=h*_+c*b+(t+i)/2,E=(l-_)/r,M=(u-b)/n,k=(-l-_)/r,S=(-u-b)/n,A=pr(1,0,E,M);let X=pr(E,M,k,S);o===0&&X>0&&(X-=ve),o===1&&X<0&&(X+=ve),d.centerX=v,d.centerY=C,d.ang1=A,d.ang2=X};function Ll(s,t,e,i,r,n,a,o=0,h=0,c=0){if(n===0||a===0)return;const l=Math.sin(o*ve/360),u=Math.cos(o*ve/360),d=u*(t-i)/2+l*(e-r)/2,f=-l*(t-i)/2+u*(e-r)/2;if(d===0&&f===0)return;n=Math.abs(n),a=Math.abs(a);const p=Math.pow(d,2)/Math.pow(n,2)+Math.pow(f,2)/Math.pow(a,2);p>1&&(n*=Math.sqrt(p),a*=Math.sqrt(p)),Gl(t,e,i,r,n,a,h,c,l,u,d,f,Rs);let{ang1:m,ang2:g}=Rs;const{centerX:y,centerY:_}=Rs;let b=Math.abs(g)/(ve/4);Math.abs(1-b)<1e-7&&(b=1);const v=Math.max(Math.ceil(b),1);g/=v;let C=s[s.length-2],E=s[s.length-1];const M={x:0,y:0};for(let k=0;k{const h=o.x-a.x,c=o.y-a.y,l=Math.sqrt(h*h+c*c),u=h/l,d=c/l;return{len:l,nx:u,ny:d}},r=(a,o)=>{a===0?s.moveTo(o.x,o.y):s.lineTo(o.x,o.y)};let n=t[t.length-1];for(let a=0;a0&&(f=-1,p=!0);const m=d/2;let g,y=Math.abs(Math.cos(m)*h/Math.sin(m));y>Math.min(l.len/2,u.len/2)?(y=Math.min(l.len/2,u.len/2),g=Math.abs(y*Math.sin(m)/Math.cos(m))):g=h;const _=o.x+u.nx*y+-u.ny*g*f,b=o.y+u.ny*y+u.nx*g*f,v=Math.atan2(l.ny,l.nx)+Math.PI/2*f,C=Math.atan2(u.ny,u.nx)-Math.PI/2*f;a===0&&s.moveTo(_+Math.cos(v)*g,b+Math.sin(v)*g),s.arc(_,b,g,v,C,p),n=o}}function Ol(s,t,e,i){const r=(o,h)=>Math.sqrt((o.x-h.x)**2+(o.y-h.y)**2),n=(o,h,c)=>({x:o.x+(h.x-o.x)*c,y:o.y+(h.y-o.y)*c}),a=t.length;for(let o=0;o=2;u-=2)l[u]===l[u-2]&&l[u-1]===l[u-3]&&l.splice(u-1,2);return this.poly(l,!0,a)}ellipse(t,e,i,r,n){return this.drawShape(new pi(t,e,i,r),n),this}roundRect(t,e,i,r,n,a){return this.drawShape(new gi(t,e,i,r,n),a),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new we,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new we,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,a=i;i=n.a*i+n.c*r+n.tx,r=n.b*a+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;eparseInt(k,10)),t.context.poly(_,!0),e&&t.context.fill(),i&&t.context.stroke();break;case"polyline":b=s.getAttribute("points"),_=b.match(/\d+/g).map(k=>parseInt(k,10)),t.context.poly(_,!1),i&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}for(let k=0;k{this._fill=Nt({...this._originalFill},ut.defaultFillStyle)})),this._fill=Nt(t===0?"black":t,ut.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...ut.defaultStrokeStyle,...t},()=>{this._stroke=is({...this._originalStroke},ut.defaultStrokeStyle)})),this._stroke=is(t,ut.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Xl(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=jt.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new jt({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var i,r,n,a;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const o=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(i=this._fill)!=null&&i.texture&&this._fill.texture.destroy(o),(r=this._originalFill)!=null&&r.texture&&this._originalFill.texture.destroy(o),(n=this._stroke)!=null&&n.texture&&this._stroke.texture.destroy(o),(a=this._originalStroke)!=null&&a.texture&&this._originalStroke.texture.destroy(o)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,r,n)=>(i[r]=n,e==null||e(r,n),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(Z.isColorLike(t)||t instanceof Me||t instanceof ls)}};yi.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};yi.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ct=yi;function Kl(s){const t=s;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=ct.defaultDropShadow;s.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){L(z,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(Z.isColorLike(e))i.color=e;else if(e instanceof Me||e instanceof ls)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");s.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){L(z,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;s.fontSize==null?s.fontSize=ct.defaultTextStyle.fontSize:typeof s.fontSize=="string"?e=parseInt(s.fontSize,10):e=s.fontSize;const i=new Me(0,0,0,e*1.7),r=t.fillGradientStops.map(n=>Z.shared.setValue(n).toNumber());r.forEach((n,a)=>{const o=a/(r.length-1);i.addColorStop(o,n)}),s.fill={fill:i}}}class Zl{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=j.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=Bi(t),e=Bi(e);const r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const wr=new Zl,Ql=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function ri(s){const t=typeof s.fontSize=="number"?`${s.fontSize}px`:s.fontSize;let e=s.fontFamily;Array.isArray(s.fontFamily)||(e=s.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Ql.includes(r)&&(r=`"${r}"`),e[i]=r}return`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${t} ${e.join(",")}`}const Ls={willReadFrequently:!0},mt=class T{static get experimentalLetterSpacingSupported(){let t=T._experimentalLetterSpacingSupported;if(t!==void 0){const e=j.get().getCanvasRenderingContext2D().prototype;t=T._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,r,n,a,o,h,c){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=c}static measureText(t=" ",e,i=T._canvas,r=e.wordWrap){var _;const n=`${t}:${e.styleKey}`;if(T._measurementCache[n])return T._measurementCache[n];const a=ri(e),o=T.measureFont(a);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const h=T.__context;h.font=a;const l=(r?T._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(l.length);let d=0;for(let b=0;b0&&(r?n-=e:n+=(T.graphemeSegmenter(t).length-1)*e),n}static _wordWrap(t,e,i=T._canvas){const r=i.getContext("2d",Ls);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:c,whiteSpace:l}=e,u=T._collapseSpaces(l),d=T._collapseNewlines(l);let f=!u;const p=e.wordWrapWidth+c,m=T._tokenize(t);for(let g=0;gp)if(a!==""&&(o+=T._addLine(a),a="",n=0),T.canBreakWords(y,e.breakWords)){const b=T.wordWrapSplit(y);for(let v=0;vp&&(o+=T._addLine(a),f=!1,a="",n=0),a+=C,n+=k}}else{a.length>0&&(o+=T._addLine(a),a="",n=0);const b=g===m.length-1;o+=T._addLine(y,!b),f=!1,a="",n=0}else _+n>p&&(f=!1,o+=T._addLine(a),a="",n=0),(a.length>0||!T.isBreakingSpace(y)||f)&&(a+=y,n+=_)}return o+=T._addLine(a,!1),o}static _addLine(t,e=!0){return t=T._trimRight(t),t=e?`${t} -`:t,t}static _getFromCache(t,e,i,r){let n=i[t];return typeof n!="number"&&(n=T._measureText(t,e,r)+e,i[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!T.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:T._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:T._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let r=0;r{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>[...s.segment(t)].map(e=>e.segment)}return s=>[...s]})();mt.experimentalLetterSpacing=!1;mt._fonts={};mt._newlines=[10,13];mt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];mt._measurementCache={};let ni=mt;function vr(s,t){if(s.texture===G.WHITE&&!s.fill)return Z.shared.setValue(s.color).setAlpha(s.alpha??1).toHexa();if(s.fill){if(s.fill instanceof ls){const e=s.fill,i=t.createPattern(e.texture.source.resource,"repeat"),r=e.transform.copyTo(O.shared);return r.scale(e.texture.frame.width,e.texture.frame.height),i.setTransform(r),i}else if(s.fill instanceof Me){const e=s.fill;if(e.type==="linear"){const i=t.createLinearGradient(e.x0,e.y0,e.x1,e.y1);return e.gradientStops.forEach(r=>{i.addColorStop(r.offset,Z.shared.setValue(r.color).toHex())}),i}}}else{const e=t.createPattern(s.texture.source.resource,"repeat"),i=s.matrix.copyTo(O.shared);return i.scale(s.texture.frame.width,s.texture.frame.height),e.setTransform(i),e}return Q("FillStyle not recognised",s),"red"}function Xn(s){if(s==="")return[];typeof s=="string"&&(s=[s]);const t=[];for(let e=0,i=s.length;e!this._currentChars.includes(y)).filter((y,_,b)=>b.indexOf(y)===_);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:r,context:n}=i.canvasAndContext,a=i.texture.source;const o=this._style;let h=this._currentX,c=this._currentY;const l=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*l,d=o.fontStyle==="italic"?2:1;let f=0,p=!1;for(let y=0;ythis._textureSize&&(c+=f,f=M,h=0,c+f>this._textureSize)){a.update();const S=this._nextPage();r=S.canvasAndContext.canvas,n=S.canvasAndContext.context,a=S.texture.source,c=0}const k=v/l-(((m=o.dropShadow)==null?void 0:m.distance)??0)-(((g=o._stroke)==null?void 0:g.width)??0);if(this.chars[_]={id:_.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:k,kerning:{}},p){this._drawGlyph(n,b,h+u,c+u,l,o);const S=a.width*l,A=a.height*l,X=new W(h/S*a.width,c/A*a.height,E/S*a.width,M/A*a.height);this.chars[_].texture=new G({source:a,frame:X}),h+=Math.ceil(E)}}a.update(),this._currentX=h,this._currentY=c,this._skipKerning&&this._applyKerning(e,n)}get pageTextures(){return L(z,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){const i=this._measureCache;for(let r=0;r{const m=n.width;for(let g=0;g{let p=n.chars.length-1;if(i){let m=n.chars[p];for(;m===" ";)n.width-=e.chars[m].xAdvance,m=n.chars[--p]}r.width=Math.max(r.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,r.lines.push(n),r.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;p>16&255,i=s>>8&255,r=s&255,n=t>>16&255,a=t>>8&255,o=t&255,h=e*n/255,c=i*a/255,l=r*o/255;return(h<<16)+(c<<8)+l}const ll=new U;class Dn{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?hl(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||ll}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0}}const Be={extension:{type:P.ShapeBuilder,name:"circle"},build(s,t){let e,i,r,n,a,o;if(s.type==="circle"){const v=s;e=v.x,i=v.y,a=o=v.radius,r=n=0}else if(s.type==="ellipse"){const v=s;e=v.x,i=v.y,a=v.halfWidth,o=v.halfHeight,r=n=0}else{const v=s,C=v.width/2,E=v.height/2;e=v.x+C,i=v.y+E,a=o=Math.max(0,Math.min(v.radius,Math.min(C,E))),r=C-a,n=E-o}if(!(a>=0&&o>=0&&r>=0&&n>=0))return t;const h=Math.ceil(2.3*Math.sqrt(a+o)),c=h*8+(r?4:0)+(n?4:0);if(c===0)return t;if(h===0)return t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n,t;let l=0,u=h*4+(r?2:0)+2,d=u,f=c,p=r+a,m=n,g=e+p,_=e-p,b=i+m;if(t[l++]=g,t[l++]=b,t[--u]=b,t[--u]=_,n){const v=i-m;t[d++]=_,t[d++]=v,t[--f]=v,t[--f]=g}for(let v=1;v0&&(r[n++]=h,r[n++]=c,r[n++]=h-1),h++;r[n++]=c+1,r[n++]=c,r[n++]=h-1}},cl={...Be,extension:{...Be.extension,name:"ellipse"}},ul={...Be,extension:{...Be.extension,name:"roundedRectangle"}},dl=1e-4,dr=1e-4;function fl(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,r=s[t-2],n=s[t-1];iu&&(u+=Math.PI*2);let d=l;const f=u-l,p=Math.abs(f),m=Math.sqrt(h*h+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,o){a.push(s,t),a.push(e,i);for(let b=1,w=d;b=0&&(l.join==="round"?b+=Wt(S,A,S-F*B,A-I*B,S-N*B,A-q*B,g,!1)+4:b+=2,g.push(S-N*R,A-q*R),g.push(S+N*B,A+q*B));continue}const Ti=(-F+M)*(-I+A)-(-F+S)*(-I+k),Mi=(-N+X)*(-q+A)-(-N+S)*(-q+vt),Le=(Pt*Mi-ue*Ti)/Ge,ze=(de*Ti-ce*Mi)/Ge,us=(Le-S)*(Le-S)+(ze-A)*(ze-A),Rt=S+(Le-S)*B,Gt=A+(ze-A)*B,Lt=S-(Le-S)*R,zt=A-(ze-A)*R,ma=Math.min(Pt*Pt+ce*ce,ue*ue+de*de),Pi=fe?B:R,xa=ma+Pi*Pi*C;us<=xa?l.join==="bevel"||us/C>E?(fe?(g.push(Rt,Gt),g.push(S+F*R,A+I*R),g.push(Rt,Gt),g.push(S+N*R,A+q*R)):(g.push(S-F*B,A-I*B),g.push(Lt,zt),g.push(S-N*B,A-q*B),g.push(Lt,zt)),b+=2):l.join==="round"?fe?(g.push(Rt,Gt),g.push(S+F*R,A+I*R),b+=Wt(S,A,S+F*R,A+I*R,S+N*R,A+q*R,g,!0)+4,g.push(Rt,Gt),g.push(S+N*R,A+q*R)):(g.push(S-F*B,A-I*B),g.push(Lt,zt),b+=Wt(S,A,S-F*B,A-I*B,S-N*B,A-q*B,g,!1)+4,g.push(S-N*B,A-q*B),g.push(Lt,zt)):(g.push(Rt,Gt),g.push(Lt,zt)):(g.push(S-F*B,A-I*B),g.push(S+F*R,A+I*R),l.join==="round"?fe?b+=Wt(S,A,S+F*R,A+I*R,S+N*R,A+q*R,g,!0)+2:b+=Wt(S,A,S-F*B,A-I*B,S-N*B,A-q*B,g,!1)+2:l.join==="miter"&&us/C<=E&&(fe?(g.push(Lt,zt),g.push(Lt,zt)):(g.push(Rt,Gt),g.push(Rt,Gt)),b+=2),g.push(S-N*B,A-q*B),g.push(S+N*R,A+q*R),b+=2)}M=s[(_-2)*2],k=s[(_-2)*2+1],S=s[(_-1)*2],A=s[(_-1)*2+1],F=-(k-A),I=M-S,pt=Math.sqrt(F*F+I*I),F/=pt,I/=pt,F*=v,I*=v,g.push(S-F*B,A-I*B),g.push(S+F*R,A+I*R),p||(l.cap==="round"?b+=Wt(S-F*(B-R)*.5,A-I*(B-R)*.5,S-F*B,A-I*B,S+F*R,A+I*R,g,!1)+2:l.cap==="square"&&(b+=fr(S,A,F,I,B,R,!1,g)));const ga=dr*dr;for(let H=w;H=0&&a>=0&&(t[0]=i,t[1]=r,t[2]=i+n,t[3]=r,t[4]=i+n,t[5]=r+a,t[6]=i,t[7]=r+a),t},triangulate(s,t,e,i,r,n){let a=0;i*=e,t[i+a]=s[0],t[i+a+1]=s[1],a+=e,t[i+a]=s[2],t[i+a+1]=s[3],a+=e,t[i+a]=s[6],t[i+a+1]=s[7],a+=e,t[i+a]=s[4],t[i+a+1]=s[5],a+=e;const o=i/e;r[n++]=o,r[n++]=o+1,r[n++]=o+2,r[n++]=o+1,r[n++]=o+3,r[n++]=o+2}},yl={extension:{type:P.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,t},triangulate(s,t,e,i,r,n){let a=0;i*=e,t[i+a]=s[0],t[i+a+1]=s[1],a+=e,t[i+a]=s[2],t[i+a+1]=s[3],a+=e,t[i+a]=s[4],t[i+a+1]=s[5];const o=i/e;r[n++]=o,r[n++]=o+1,r[n++]=o+2}},cs={};nt.handleByMap(P.ShapeBuilder,cs);nt.add(xl,ml,yl,Be,cl,ul);const _l=new D;function bl(s,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r{const f=h.length,p=a.length/2,m=[],g=cs[l.type];if(g.build(l,m),u&&Un(m,u),i){const v=l.closePath??!0;pl(m,t,!1,v,a,2,p,h)}else if(e&&c===d){c!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const v=[],C=m.slice();vl(e.shapePath).forEach(M=>{v.push(C.length/2),C.push(...M)}),Hn(C,v,a,2,p,h,f)}else g.triangulate(m,a,2,p,h,f);const _=o.length/2,b=t.texture;if(b!==G.WHITE){const v=t.matrix;v&&(u&&v.append(u.clone().invert()),al(a,2,p,o,_,2,a.length/2-p,v))}else ol(o,_,2,a.length/2-p);const w=Ct.get(Dn);w.indexOffset=f,w.indexSize=h.length-f,w.attributeOffset=p,w.attributeSize=a.length/2-p,w.baseColor=t.color,w.alpha=t.alpha,w.texture=b,w.geometryData=n,r.push(w)})}function vl(s){if(!s)return[];const t=s.shapePrimitives,e=[];for(let i=0;i{Ct.return(i)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};xi.extension={type:[P.WebGLSystem,P.WebGPUSystem,P.CanvasSystem],name:"graphicsContext"};xi.defaultOptions={bezierSmoothness:.5};let Nn=xi;const Cl=8,je=11920929e-14,Tl=1;function $n(s,t,e,i,r,n,a,o,h,c){const u=Math.min(.99,Math.max(0,c??Nn.defaultOptions.bezierSmoothness));let d=(Tl-u)/1;return d*=d,Ml(t,e,i,r,n,a,o,h,s,d),s}function Ml(s,t,e,i,r,n,a,o,h,c){si(s,t,e,i,r,n,a,o,h,c,0),h.push(a,o)}function si(s,t,e,i,r,n,a,o,h,c,l){if(l>Cl)return;const u=(s+e)/2,d=(t+i)/2,f=(e+r)/2,p=(i+n)/2,m=(r+a)/2,g=(n+o)/2,_=(u+f)/2,b=(d+p)/2,w=(f+m)/2,v=(p+g)/2,C=(_+w)/2,E=(b+v)/2;if(l>0){let M=a-s,k=o-t;const S=Math.abs((e-a)*k-(i-o)*M),A=Math.abs((r-a)*k-(n-o)*M);if(S>je&&A>je){if((S+A)*(S+A)<=c*(M*M+k*k)){h.push(C,E);return}}else if(S>je){if(S*S<=c*(M*M+k*k)){h.push(C,E);return}}else if(A>je){if(A*A<=c*(M*M+k*k)){h.push(C,E);return}}else if(M=C-(s+a)/2,k=E-(t+o)/2,M*M+k*k<=c){h.push(C,E);return}}si(s,t,u,d,_,b,C,E,h,c,l+1),si(C,E,w,v,m,g,a,o,h,c,l+1)}const Pl=8,kl=11920929e-14,Bl=1;function Il(s,t,e,i,r,n,a,o){const c=Math.min(.99,Math.max(0,o??Nn.defaultOptions.bezierSmoothness));let l=(Bl-c)/1;return l*=l,El(t,e,i,r,n,a,s,l),s}function El(s,t,e,i,r,n,a,o){ii(a,s,t,e,i,r,n,o,0),a.push(r,n)}function ii(s,t,e,i,r,n,a,o,h){if(h>Pl)return;const c=(t+i)/2,l=(e+r)/2,u=(i+n)/2,d=(r+a)/2,f=(c+u)/2,p=(l+d)/2;let m=n-t,g=a-e;const _=Math.abs((i-n)*g-(r-a)*m);if(_>kl){if(_*_<=o*(m*m+g*g)){s.push(f,p);return}}else if(m=f-(t+n)/2,g=p-(e+a)/2,m*m+g*g<=o){s.push(f,p);return}ii(s,t,e,c,l,f,p,o,h+1),ii(s,f,p,u,d,n,a,o,h+1)}function Vn(s,t,e,i,r,n,a,o){let h=Math.abs(r-n);(!a&&r>n||a&&n>r)&&(h=2*Math.PI-h),o=o||Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI))),o=Math.max(o,3);let c=h/o,l=r;c*=a?-1:1;for(let u=0;uu*h)}const Ae=Math.PI*2,Rs={centerX:0,centerY:0,ang1:0,ang2:0},Gs=({x:s,y:t},e,i,r,n,a,o,h)=>{s*=e,t*=i;const c=r*s-n*t,l=n*s+r*t;return h.x=c+a,h.y=l+o,h};function Rl(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),n=Math.sin(s),a=Math.cos(s+t),o=Math.sin(s+t);return[{x:r-n*i,y:n+r*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}const gr=(s,t,e,i)=>{const r=s*i-t*e<0?-1:1;let n=s*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},Gl=(s,t,e,i,r,n,a,o,h,c,l,u,d)=>{const f=Math.pow(r,2),p=Math.pow(n,2),m=Math.pow(l,2),g=Math.pow(u,2);let _=f*p-f*g-p*m;_<0&&(_=0),_/=f*g+p*m,_=Math.sqrt(_)*(a===o?-1:1);const b=_*r/n*u,w=_*-n/r*l,v=c*b-h*w+(s+e)/2,C=h*b+c*w+(t+i)/2,E=(l-b)/r,M=(u-w)/n,k=(-l-b)/r,S=(-u-w)/n,A=gr(1,0,E,M);let X=gr(E,M,k,S);o===0&&X>0&&(X-=Ae),o===1&&X<0&&(X+=Ae),d.centerX=v,d.centerY=C,d.ang1=A,d.ang2=X};function Ll(s,t,e,i,r,n,a,o=0,h=0,c=0){if(n===0||a===0)return;const l=Math.sin(o*Ae/360),u=Math.cos(o*Ae/360),d=u*(t-i)/2+l*(e-r)/2,f=-l*(t-i)/2+u*(e-r)/2;if(d===0&&f===0)return;n=Math.abs(n),a=Math.abs(a);const p=Math.pow(d,2)/Math.pow(n,2)+Math.pow(f,2)/Math.pow(a,2);p>1&&(n*=Math.sqrt(p),a*=Math.sqrt(p)),Gl(t,e,i,r,n,a,h,c,l,u,d,f,Rs);let{ang1:m,ang2:g}=Rs;const{centerX:_,centerY:b}=Rs;let w=Math.abs(g)/(Ae/4);Math.abs(1-w)<1e-7&&(w=1);const v=Math.max(Math.ceil(w),1);g/=v;let C=s[s.length-2],E=s[s.length-1];const M={x:0,y:0};for(let k=0;k{const h=o.x-a.x,c=o.y-a.y,l=Math.sqrt(h*h+c*c),u=h/l,d=c/l;return{len:l,nx:u,ny:d}},r=(a,o)=>{a===0?s.moveTo(o.x,o.y):s.lineTo(o.x,o.y)};let n=t[t.length-1];for(let a=0;a0&&(f=-1,p=!0);const m=d/2;let g,_=Math.abs(Math.cos(m)*h/Math.sin(m));_>Math.min(l.len/2,u.len/2)?(_=Math.min(l.len/2,u.len/2),g=Math.abs(_*Math.sin(m)/Math.cos(m))):g=h;const b=o.x+u.nx*_+-u.ny*g*f,w=o.y+u.ny*_+u.nx*g*f,v=Math.atan2(l.ny,l.nx)+Math.PI/2*f,C=Math.atan2(u.ny,u.nx)-Math.PI/2*f;a===0&&s.moveTo(b+Math.cos(v)*g,w+Math.sin(v)*g),s.arc(b,w,g,v,C,p),n=o}}function Wl(s,t,e,i){const r=(o,h)=>Math.sqrt((o.x-h.x)**2+(o.y-h.y)**2),n=(o,h,c)=>({x:o.x+(h.x-o.x)*c,y:o.y+(h.y-o.y)*c}),a=t.length;for(let o=0;o=2;u-=2)l[u]===l[u-2]&&l[u-1]===l[u-3]&&l.splice(u-1,2);return this.poly(l,!0,a)}ellipse(t,e,i,r,n){return this.drawShape(new gi(t,e,i,r),n),this}roundRect(t,e,i,r,n,a){return this.drawShape(new mi(t,e,i,r,n),a),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Se,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Se,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,a=i;i=n.a*i+n.c*r+n.tx,r=n.b*a+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;eparseInt(k,10)),t.context.poly(b,!0),e&&t.context.fill(),i&&t.context.stroke();break;case"polyline":w=s.getAttribute("points"),b=w.match(/\d+/g).map(k=>parseInt(k,10)),t.context.poly(b,!1),i&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}for(let k=0;k{this._fill=Nt({...this._originalFill},dt.defaultFillStyle)})),this._fill=Nt(t===0?"black":t,dt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...dt.defaultStrokeStyle,...t},()=>{this._stroke=is({...this._originalStroke},dt.defaultStrokeStyle)})),this._stroke=is(t,dt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Xl(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=jt.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new jt({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var i,r,n,a;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const o=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(i=this._fill)!=null&&i.texture&&this._fill.texture.destroy(o),(r=this._originalFill)!=null&&r.texture&&this._originalFill.texture.destroy(o),(n=this._stroke)!=null&&n.texture&&this._stroke.texture.destroy(o),(a=this._originalStroke)!=null&&a.texture&&this._originalStroke.texture.destroy(o)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,r,n)=>(i[r]=n,e==null||e(r,n),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(Z.isColorLike(t)||t instanceof ke||t instanceof ls)}};_i.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};_i.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ot=_i;function Kl(s){const t=s;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=ot.defaultDropShadow;s.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){W(O,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(Z.isColorLike(e))i.color=e;else if(e instanceof ke||e instanceof ls)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");s.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){W(O,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;s.fontSize==null?s.fontSize=ot.defaultTextStyle.fontSize:typeof s.fontSize=="string"?e=parseInt(s.fontSize,10):e=s.fontSize;const i=new ke(0,0,0,e*1.7),r=t.fillGradientStops.map(n=>Z.shared.setValue(n).toNumber());r.forEach((n,a)=>{const o=a/(r.length-1);i.addColorStop(o,n)}),s.fill={fill:i}}}class Zl{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=j.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=Ii(t),e=Ii(e);const r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const vr=new Zl,Ql=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function ri(s){const t=typeof s.fontSize=="number"?`${s.fontSize}px`:s.fontSize;let e=s.fontFamily;Array.isArray(s.fontFamily)||(e=s.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Ql.includes(r)&&(r=`"${r}"`),e[i]=r}return`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${t} ${e.join(",")}`}const Ls={willReadFrequently:!0},xt=class T{static get experimentalLetterSpacingSupported(){let t=T._experimentalLetterSpacingSupported;if(t!==void 0){const e=j.get().getCanvasRenderingContext2D().prototype;t=T._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,r,n,a,o,h,c){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=c}static measureText(t=" ",e,i=T._canvas,r=e.wordWrap){var b;const n=`${t}:${e.styleKey}`;if(T._measurementCache[n])return T._measurementCache[n];const a=ri(e),o=T.measureFont(a);o.fontSize===0&&(o.fontSize=e.fontSize,o.ascent=e.fontSize);const h=T.__context;h.font=a;const l=(r?T._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),u=new Array(l.length);let d=0;for(let w=0;w0&&(r?n-=e:n+=(T.graphemeSegmenter(t).length-1)*e),n}static _wordWrap(t,e,i=T._canvas){const r=i.getContext("2d",Ls);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:c,whiteSpace:l}=e,u=T._collapseSpaces(l),d=T._collapseNewlines(l);let f=!u;const p=e.wordWrapWidth+c,m=T._tokenize(t);for(let g=0;gp)if(a!==""&&(o+=T._addLine(a),a="",n=0),T.canBreakWords(_,e.breakWords)){const w=T.wordWrapSplit(_);for(let v=0;vp&&(o+=T._addLine(a),f=!1,a="",n=0),a+=C,n+=k}}else{a.length>0&&(o+=T._addLine(a),a="",n=0);const w=g===m.length-1;o+=T._addLine(_,!w),f=!1,a="",n=0}else b+n>p&&(f=!1,o+=T._addLine(a),a="",n=0),(a.length>0||!T.isBreakingSpace(_)||f)&&(a+=_,n+=b)}return o+=T._addLine(a,!1),o}static _addLine(t,e=!0){return t=T._trimRight(t),t=e?`${t} +`:t,t}static _getFromCache(t,e,i,r){let n=i[t];return typeof n!="number"&&(n=T._measureText(t,e,r)+e,i[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!T.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:T._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:T._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let r=0;r{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>[...s.segment(t)].map(e=>e.segment)}return s=>[...s]})();xt.experimentalLetterSpacing=!1;xt._fonts={};xt._newlines=[10,13];xt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];xt._measurementCache={};let ni=xt;function Sr(s,t){if(s.texture===G.WHITE&&!s.fill)return Z.shared.setValue(s.color).setAlpha(s.alpha??1).toHexa();if(s.fill){if(s.fill instanceof ls){const e=s.fill,i=t.createPattern(e.texture.source.resource,"repeat"),r=e.transform.copyTo(U.shared);return r.scale(e.texture.frame.width,e.texture.frame.height),i.setTransform(r),i}else if(s.fill instanceof ke){const e=s.fill;if(e.type==="linear"){const i=t.createLinearGradient(e.x0,e.y0,e.x1,e.y1);return e.gradientStops.forEach(r=>{i.addColorStop(r.offset,Z.shared.setValue(r.color).toHex())}),i}}}else{const e=t.createPattern(s.texture.source.resource,"repeat"),i=s.matrix.copyTo(U.shared);return i.scale(s.texture.frame.width,s.texture.frame.height),e.setTransform(i),e}return Q("FillStyle not recognised",s),"red"}function jn(s){if(s==="")return[];typeof s=="string"&&(s=[s]);const t=[];for(let e=0,i=s.length;e!this._currentChars.includes(_)).filter((_,b,w)=>w.indexOf(_)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let i;this._currentPageIndex===-1?i=this._nextPage():i=this.pages[this._currentPageIndex];let{canvas:r,context:n}=i.canvasAndContext,a=i.texture.source;const o=this._style;let h=this._currentX,c=this._currentY;const l=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*l,d=o.fontStyle==="italic"?2:1;let f=0,p=!1;for(let _=0;_this._textureSize&&(c+=f,f=M,h=0,c+f>this._textureSize)){a.update();const S=this._nextPage();r=S.canvasAndContext.canvas,n=S.canvasAndContext.context,a=S.texture.source,c=0}const k=v/l-(((m=o.dropShadow)==null?void 0:m.distance)??0)-(((g=o._stroke)==null?void 0:g.width)??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:k,kerning:{}},p){this._drawGlyph(n,w,h+u,c+u,l,o);const S=a.width*l,A=a.height*l,X=new D(h/S*a.width,c/A*a.height,E/S*a.width,M/A*a.height);this.chars[b].texture=new G({source:a,frame:X}),h+=Math.ceil(E)}}a.update(),this._currentX=h,this._currentY=c,this._skipKerning&&this._applyKerning(e,n)}get pageTextures(){return W(O,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){const i=this._measureCache;for(let r=0;r{const m=n.width;for(let g=0;g{let p=n.chars.length-1;if(i){let m=n.chars[p];for(;m===" ";)n.width-=e.chars[m].xAdvance,m=n.chars[--p]}r.width=Math.max(r.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,r.lines.push(n),r.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;pf?(l(),c(h),g||n.charPositions.push(0)):(h.start=n.width,c(h),g||n.charPositions.push(0)),m==="\r"||m===` -`)n.width!==0&&l();else if(!g){const C=y.xAdvance+(y.kerning[a]||0)+d;n.width+=C,n.spaceWidth=C,n.spacesIndex.push(n.charPositions.length),n.chars.push(m)}}else{const v=y.kerning[a]||0,C=y.xAdvance+v+d;h.positions[h.index++]=h.width+v,h.chars.push(m),h.width+=C}a=m}return l(),t.align==="center"?tc(r):t.align==="right"?ec(r):t.align==="justify"&&sc(r),r}function tc(s){for(let t=0;t50&&Q("BitmapText",`You have dynamically created ${qe} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),o.once("destroy",()=>{qe--,V.remove(i)}),V.set(i,o)}const n=V.get(i);return(a=n.ensureCharacters)==null||a.call(n,t),n}getLayout(t,e,i=!0){const r=this.getFont(t,e);return Jl([...t],e,r,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var c,l,u,d;let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:(c=t[2])==null?void 0:c.chars,resolution:(l=t[2])==null?void 0:l.resolution,padding:(u=t[2])==null?void 0:u.padding,skipKerning:(d=t[2])==null?void 0:d.skipKerning},L(z,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const i=e==null?void 0:e.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};const r=e.style,n=r instanceof ct?r:new ct(r),a=n._fill.fill!==null&&n._fill.fill!==void 0,o=new Sr({style:n,overrideFill:a,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=Xn(e.chars);return o.ensureCharacters(h.join("")),V.set(`${i}-bitmap`,o),o.once("destroy",()=>V.remove(`${i}-bitmap`)),o}uninstall(t){const e=`${t}-bitmap`,i=V.get(e);i&&(V.remove(e),i.destroy())}}const Ar=new ic;class Kn extends Mn{constructor(t,e){super();const{textures:i,data:r}=t;Object.keys(r.pages).forEach(n=>{const a=r.pages[parseInt(n,10)],o=i[a.id];this.pages.push({texture:o})}),Object.keys(r.chars).forEach(n=>{const a=r.chars[n],{frame:o,source:h}=i[a.page],c=new W(a.x+o.x,a.y+o.y,a.width,a.height),l=new G({source:h,frame:c});this.chars[n]={id:n.codePointAt(0),xOffset:a.xOffset,yOffset:a.yOffset,xAdvance:a.xAdvance,kerning:a.kerning??{},texture:l}}),this.baseRenderedFontSize=r.fontSize,this.baseMeasurementFontSize=r.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:r.fontSize},this.baseLineOffset=r.baseLineOffset,this.lineHeight=r.lineHeight,this.fontFamily=r.fontFamily,this.distanceField=r.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t")?Cr.test(j.get().parseXML(s)):!1},parse(s){return Cr.parse(j.get().parseXML(s))}},rc=[".xml",".fnt"],nc={extension:{type:P.CacheParser,name:"cacheBitmapFont"},test:s=>s instanceof Kn,getCacheableAssets(s,t){const e={};return s.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},ac={extension:{type:P.LoadParser,priority:Et.Normal},name:"loadBitmapFont",test(s){return rc.includes(lt.extname(s).toLowerCase())},async testParse(s){return zs.test(s)||Tr.test(s)},async parse(s,t,e){const i=zs.test(s)?zs.parse(s):Tr.parse(s),{src:r}=t,{pages:n}=i,a=[],o=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;uh[u.src]);return new Kn({data:i,textures:c},r)},async load(s,t){return await(await j.get().fetch(s)).text()},async unload(s,t,e){await Promise.all(s.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),s.destroy()}};class oc{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(s)&&s.every(t=>t instanceof G),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};async function Zn(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const lc={extension:{type:P.DetectionParser,priority:1},test:async()=>Zn("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")},Mr=["png","jpg","jpeg"],cc={extension:{type:P.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Mr],remove:async s=>s.filter(t=>!Mr.includes(t))},uc="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function _i(s){return uc?!1:document.createElement("video").canPlayType(s)!==""}const dc={extension:{type:P.DetectionParser,priority:0},test:async()=>_i("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")},fc={extension:{type:P.DetectionParser,priority:0},test:async()=>_i("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")},pc={extension:{type:P.DetectionParser,priority:0},test:async()=>_i("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")},gc={extension:{type:P.DetectionParser,priority:0},test:async()=>Zn("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")};class mc{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var a,o;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||Q(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h({alias:[c],src:c,data:{}})),o=a.length,h=a.map(async c=>{const l=lt.toAbsolute(c.src);if(!r[c.src])try{this.promiseCache[l]||(this.promiseCache[l]=this._getLoadPromiseAndParser(l,c)),r[c.src]=await this.promiseCache[l].promise,e&&e(++i/o)}catch(u){throw delete this.promiseCache[l],delete r[c.src],new Error(`[Loader.load] Failed to load ${l}. -${u}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const i=gt(t,r=>({alias:[r],src:r})).map(async r=>{var o,h;const n=lt.toAbsolute(r.src),a=this.promiseCache[n];if(a){const c=await a.promise;delete this.promiseCache[n],await((h=(o=a.parser)==null?void 0:o.unload)==null?void 0:h.call(o,c,r,this))}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&Q(`[Assets] loadParser name conflict "${e.name}"`):Q("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}}function ae(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function oe(s,t){const e=s.split("?")[0],i=lt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const xc=".json",yc="application/json",_c={extension:{type:P.LoadParser,priority:Et.Low},name:"loadJson",test(s){return ae(s,yc)||oe(s,xc)},async load(s){return await(await j.get().fetch(s)).json()}},bc=".txt",wc="text/plain",vc={name:"loadTxt",extension:{type:P.LoadParser,priority:Et.Low,name:"loadTxt"},test(s){return ae(s,wc)||oe(s,bc)},async load(s){return await(await j.get().fetch(s)).text()}},Sc=["normal","bold","100","200","300","400","500","600","700","800","900"],Ac=[".ttf",".otf",".woff",".woff2"],Cc=["font/ttf","font/otf","font/woff","font/woff2"],Tc=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Mc(s){const t=lt.extname(s),r=lt.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1));let n=r.length>0;for(const o of r)if(!o.match(Tc)){n=!1;break}let a=r.join(" ");return n||(a=`"${a.replace(/[\\"]/g,"\\$&")}"`),a}const Pc=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function kc(s){return Pc.test(s)?s:encodeURI(s)}const Bc={extension:{type:P.LoadParser,priority:Et.Low},name:"loadWebFont",test(s){return ae(s,Cc)||oe(s,Ac)},async load(s,t){var i,r,n;const e=j.get().getFontFaceSet();if(e){const a=[],o=((i=t.data)==null?void 0:i.family)??Mc(s),h=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(l=>Sc.includes(l)))??["normal"],c=t.data??{};for(let l=0;l{V.remove(t.family),j.get().getFontFaceSet().delete(t)})}};function bi(s,t=1){var i;const e=(i=ne.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}function wi(s,t,e){s.label=e,s._sourceOrigin=e;const i=new G({source:s,label:e}),r=()=>{delete t.promiseCache[e],V.has(e)&&V.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(Q("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),r())}),i.once("destroy",()=>{s.destroyed||(Q("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),i}const Ic=".svg",Ec="image/svg+xml",Fc={extension:{type:P.LoadParser,priority:Et.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(s){return ae(s,Ec)||oe(s,Ic)},async load(s,t,e){return t.data.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Gc(s):Rc(s,t,e,this.config.crossOrigin)},unload(s){s.destroy(!0)}};async function Rc(s,t,e,i){var g,y,_;const n=await(await j.get().fetch(s)).blob(),a=URL.createObjectURL(n),o=new Image;o.src=a,o.crossOrigin=i,await o.decode(),URL.revokeObjectURL(a);const h=document.createElement("canvas"),c=h.getContext("2d"),l=((g=t.data)==null?void 0:g.resolution)||bi(s),u=((y=t.data)==null?void 0:y.width)??o.width,d=((_=t.data)==null?void 0:_.height)??o.height;h.width=u*l,h.height=d*l,c.drawImage(o,0,0,u*l,d*l);const{parseAsGraphicsContext:f,...p}=t.data,m=new re({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:l,...p});return wi(m,e,s)}async function Gc(s){const e=await(await j.get().fetch(s)).text(),i=new ut;return i.svg(e),i}const Lc=`(function () { +`)n.width!==0&&l();else if(!g){const C=_.xAdvance+(_.kerning[a]||0)+d;n.width+=C,n.spaceWidth=C,n.spacesIndex.push(n.charPositions.length),n.chars.push(m)}}else{const v=_.kerning[a]||0,C=_.xAdvance+v+d;h.positions[h.index++]=h.width+v,h.chars.push(m),h.width+=C}a=m}return l(),t.align==="center"?tc(r):t.align==="right"?ec(r):t.align==="justify"&&sc(r),r}function tc(s){for(let t=0;t50&&Q("BitmapText",`You have dynamically created ${qe} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),o.once("destroy",()=>{qe--,V.remove(i)}),V.set(i,o)}const n=V.get(i);return(a=n.ensureCharacters)==null||a.call(n,t),n}getLayout(t,e,i=!0){const r=this.getFont(t,e);return Jl([...t],e,r,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var c,l,u,d;let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:(c=t[2])==null?void 0:c.chars,resolution:(l=t[2])==null?void 0:l.resolution,padding:(u=t[2])==null?void 0:u.padding,skipKerning:(d=t[2])==null?void 0:d.skipKerning},W(O,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const i=e==null?void 0:e.name;if(!i)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};const r=e.style,n=r instanceof ot?r:new ot(r),a=n._fill.fill!==null&&n._fill.fill!==void 0,o=new Ar({style:n,overrideFill:a,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=jn(e.chars);return o.ensureCharacters(h.join("")),V.set(`${i}-bitmap`,o),o.once("destroy",()=>V.remove(`${i}-bitmap`)),o}uninstall(t){const e=`${t}-bitmap`,i=V.get(e);i&&(V.remove(e),i.destroy())}}const Cr=new ic;class Zn extends Pn{constructor(t,e){super();const{textures:i,data:r}=t;Object.keys(r.pages).forEach(n=>{const a=r.pages[parseInt(n,10)],o=i[a.id];this.pages.push({texture:o})}),Object.keys(r.chars).forEach(n=>{const a=r.chars[n],{frame:o,source:h}=i[a.page],c=new D(a.x+o.x,a.y+o.y,a.width,a.height),l=new G({source:h,frame:c});this.chars[n]={id:n.codePointAt(0),xOffset:a.xOffset,yOffset:a.yOffset,xAdvance:a.xAdvance,kerning:a.kerning??{},texture:l}}),this.baseRenderedFontSize=r.fontSize,this.baseMeasurementFontSize=r.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:r.fontSize},this.baseLineOffset=r.baseLineOffset,this.lineHeight=r.lineHeight,this.fontFamily=r.fontFamily,this.distanceField=r.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t")?Tr.test(j.get().parseXML(s)):!1},parse(s){return Tr.parse(j.get().parseXML(s))}},rc=[".xml",".fnt"],nc={extension:{type:P.CacheParser,name:"cacheBitmapFont"},test:s=>s instanceof Zn,getCacheableAssets(s,t){const e={};return s.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},ac={extension:{type:P.LoadParser,priority:Et.Normal},name:"loadBitmapFont",test(s){return rc.includes(ut.extname(s).toLowerCase())},async testParse(s){return zs.test(s)||Mr.test(s)},async parse(s,t,e){const i=zs.test(s)?zs.parse(s):Mr.parse(s),{src:r}=t,{pages:n}=i,a=[],o=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;uh[u.src]);return new Zn({data:i,textures:c},r)},async load(s,t){return await(await j.get().fetch(s)).text()},async unload(s,t,e){await Promise.all(s.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),s.destroy()}};class oc{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(s)&&s.every(t=>t instanceof G),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};async function Qn(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const lc={extension:{type:P.DetectionParser,priority:1},test:async()=>Qn("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")},Pr=["png","jpg","jpeg"],cc={extension:{type:P.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Pr],remove:async s=>s.filter(t=>!Pr.includes(t))},uc="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function bi(s){return uc?!1:document.createElement("video").canPlayType(s)!==""}const dc={extension:{type:P.DetectionParser,priority:0},test:async()=>bi("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")},fc={extension:{type:P.DetectionParser,priority:0},test:async()=>bi("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")},pc={extension:{type:P.DetectionParser,priority:0},test:async()=>bi("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")},gc={extension:{type:P.DetectionParser,priority:0},test:async()=>Qn("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")};class mc{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var a,o;let r=null,n=null;if(e.loadParser&&(n=this._parserHash[e.loadParser],n||Q(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h({alias:[c],src:c,data:{}})),o=a.length,h=a.map(async c=>{const l=ut.toAbsolute(c.src);if(!r[c.src])try{this.promiseCache[l]||(this.promiseCache[l]=this._getLoadPromiseAndParser(l,c)),r[c.src]=await this.promiseCache[l].promise,e&&e(++i/o)}catch(u){throw delete this.promiseCache[l],delete r[c.src],new Error(`[Loader.load] Failed to load ${l}. +${u}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const i=mt(t,r=>({alias:[r],src:r})).map(async r=>{var o,h;const n=ut.toAbsolute(r.src),a=this.promiseCache[n];if(a){const c=await a.promise;delete this.promiseCache[n],await((h=(o=a.parser)==null?void 0:o.unload)==null?void 0:h.call(o,c,r,this))}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&Q(`[Assets] loadParser name conflict "${e.name}"`):Q("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}}function ae(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function oe(s,t){const e=s.split("?")[0],i=ut.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const xc=".json",yc="application/json",_c={extension:{type:P.LoadParser,priority:Et.Low},name:"loadJson",test(s){return ae(s,yc)||oe(s,xc)},async load(s){return await(await j.get().fetch(s)).json()}},bc=".txt",wc="text/plain",vc={name:"loadTxt",extension:{type:P.LoadParser,priority:Et.Low,name:"loadTxt"},test(s){return ae(s,wc)||oe(s,bc)},async load(s){return await(await j.get().fetch(s)).text()}},Sc=["normal","bold","100","200","300","400","500","600","700","800","900"],Ac=[".ttf",".otf",".woff",".woff2"],Cc=["font/ttf","font/otf","font/woff","font/woff2"],Tc=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Mc(s){const t=ut.extname(s),r=ut.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1));let n=r.length>0;for(const o of r)if(!o.match(Tc)){n=!1;break}let a=r.join(" ");return n||(a=`"${a.replace(/[\\"]/g,"\\$&")}"`),a}const Pc=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function kc(s){return Pc.test(s)?s:encodeURI(s)}const Bc={extension:{type:P.LoadParser,priority:Et.Low},name:"loadWebFont",test(s){return ae(s,Cc)||oe(s,Ac)},async load(s,t){var i,r,n;const e=j.get().getFontFaceSet();if(e){const a=[],o=((i=t.data)==null?void 0:i.family)??Mc(s),h=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(l=>Sc.includes(l)))??["normal"],c=t.data??{};for(let l=0;l{V.remove(t.family),j.get().getFontFaceSet().delete(t)})}};function wi(s,t=1){var i;const e=(i=ne.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}function vi(s,t,e){s.label=e,s._sourceOrigin=e;const i=new G({source:s,label:e}),r=()=>{delete t.promiseCache[e],V.has(e)&&V.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(Q("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),r())}),i.once("destroy",()=>{s.destroyed||(Q("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),i}const Ic=".svg",Ec="image/svg+xml",Fc={extension:{type:P.LoadParser,priority:Et.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(s){return ae(s,Ec)||oe(s,Ic)},async load(s,t,e){return t.data.parseAsGraphicsContext??this.config.parseAsGraphicsContext?Gc(s):Rc(s,t,e,this.config.crossOrigin)},unload(s){s.destroy(!0)}};async function Rc(s,t,e,i){var g,_,b;const n=await(await j.get().fetch(s)).blob(),a=URL.createObjectURL(n),o=new Image;o.src=a,o.crossOrigin=i,await o.decode(),URL.revokeObjectURL(a);const h=document.createElement("canvas"),c=h.getContext("2d"),l=((g=t.data)==null?void 0:g.resolution)||wi(s),u=((_=t.data)==null?void 0:_.width)??o.width,d=((b=t.data)==null?void 0:b.height)??o.height;h.width=u*l,h.height=d*l,c.drawImage(o,0,0,u*l,d*l);const{parseAsGraphicsContext:f,...p}=t.data,m=new re({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:l,...p});return vi(m,e,s)}async function Gc(s){const e=await(await j.get().fetch(s)).text(),i=new dt;return i.svg(e),i}const Lc=`(function () { 'use strict'; const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII="; @@ -293,4 +293,4 @@ ${u}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const i=gt }; })(); -`;let Qt=null;class Qn{constructor(){Qt||(Qt=URL.createObjectURL(new Blob([zc],{type:"application/javascript"}))),this.worker=new Worker(Qt)}}Qn.revokeObjectURL=function(){Qt&&(URL.revokeObjectURL(Qt),Qt=null)};let Pr=0,Os;class Oc{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ai;e.addEventListener("message",i=>{e.terminate(),ai.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Os===void 0&&(Os=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((r,n)=>{this._queue.push({id:t,arguments:e,resolve:r,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[Pr]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Pr++,id:i})}}const kr=new Oc,Wc=[".jpeg",".jpg",".png",".webp",".avif"],Uc=["image/jpeg","image/png","image/webp","image/avif"];async function Dc(s,t){var r;const e=await j.get().fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const i=await e.blob();return((r=t==null?void 0:t.data)==null?void 0:r.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const Jn={name:"loadTextures",extension:{type:P.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return ae(s,Uc)||oe(s,Wc)},async load(s,t,e){var n;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await kr.isImageBitmapSupported()?i=await kr.loadImageBitmap(s,t):i=await Dc(s,t):i=await new Promise(a=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=s,i.complete?a(i):i.onload=()=>{a(i)}});const r=new re({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((n=t.data)==null?void 0:n.resolution)||bi(s),...t.data});return wi(r,e,s)},unload(s){s.destroy(!0)}},ta=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Hc=ta.map(s=>`video/${s.substring(1)}`);function Nc(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=Vc(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function $c(s){return new Promise((t,e)=>{s.addEventListener("canplaythrough",i),s.addEventListener("error",r),s.load();function i(){n(),t()}function r(a){n(),e(a)}function n(){s.removeEventListener("canplaythrough",i),s.removeEventListener("error",r)}})}function Vc(s,t=globalThis.location){if(s.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}const Yc={name:"loadVideo",extension:{type:P.LoadParser,name:"loadVideo"},test(s){const t=ae(s,Hc),e=oe(s,ta);return t||e},async load(s,t,e){var h,c;const i={...Ke.defaultOptions,resolution:((h=t.data)==null?void 0:h.resolution)||bi(s),alphaMode:((c=t.data)==null?void 0:c.alphaMode)||await sn(),...t.data},r=document.createElement("video"),n={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(n).forEach(l=>{const u=n[l];u!==void 0&&r.setAttribute(l,u)}),i.muted===!0&&(r.muted=!0),Nc(r,s,i.crossorigin);const a=document.createElement("source");let o;if(s.startsWith("data:"))o=s.slice(5,s.indexOf(";"));else if(!s.startsWith("blob:")){const l=s.split("?")[0].slice(s.lastIndexOf(".")+1).toLowerCase();o=Ke.MIME_TYPES[l]||`video/${l}`}return a.src=s,o&&(a.type=o),new Promise(l=>{const u=async()=>{const d=new Ke({...i,resource:r});r.removeEventListener("canplay",u),t.data.preload&&await $c(r),l(wi(d,e,s))};r.addEventListener("canplay",u),r.appendChild(a)})},unload(s){s.destroy(!0)}},ea={extension:{type:P.ResolveParser,name:"resolveTexture"},test:Jn.test,parse:s=>{var t;return{resolution:parseFloat(((t=ne.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:s.split(".").pop(),src:s}}},Xc={extension:{type:P.ResolveParser,priority:-2,name:"resolveJson"},test:s=>ne.RETINA_PREFIX.test(s)&&s.endsWith(".json"),parse:ea.parse};class jc{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ne,this.loader=new mc,this.cache=V,this._backgroundLoader=new oc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){Q("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=ss(t),r=gt(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(c=>!this.resolver.hasKey(c))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return i?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const c=()=>{e==null||e(++o/h)},l=a.map(u=>{const d=r[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{n[u]=f})});return await Promise.all(l),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return V.get(t);const e={};for(let i=0;i{const o=r[a.src],h=[a.src];a.alias&&h.push(...a.alias),h.forEach(c=>{n[c]=o}),V.set(h,o)}),n}async unload(t){this._initialized||await this.init();const e=gt(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=gt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{V.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const _e=new jc;rt.handleByList(P.LoadParser,_e.loader.parsers).handleByList(P.ResolveParser,_e.resolver.parsers).handleByList(P.CacheParser,_e.cache.parsers).handleByList(P.DetectionParser,_e.detections);rt.add(hc,cc,lc,gc,dc,fc,pc,_c,vc,Bc,Fc,Jn,Yc,ac,nc,ea,Xc);const Br={loader:P.LoadParser,resolver:P.ResolveParser,cache:P.CacheParser,detection:P.DetectionParser};rt.handle(P.Asset,s=>{const t=s.ref;Object.entries(Br).filter(([e])=>!!t[e]).forEach(([e,i])=>rt.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(Br).filter(e=>!!t[e]).forEach(e=>rt.remove(t[e]))});class It extends rs{constructor(t){t instanceof ut&&(t={context:t});const{context:e,roundPixels:i,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new ut,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new It(this._context.clone()):(this._ownedContext=null,new It(this._context))}lineStyle(t,e,i){L(z,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),i&&(r.alpha=i),this.context.strokeStyle=r,this}beginFill(t,e){L(z,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const i={};return t&&(i.color=t),e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){L(z,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==ut.defaultStrokeStyle.width||t.color!==ut.defaultStrokeStyle.color||t.alpha!==ut.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return L(z,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return L(z,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return L(z,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return L(z,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return L(z,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return L(z,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}const sa=class ia extends Rn{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(L(z,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...ia.defaultOptions,...e};const i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),r=e.uvs||new Float32Array([0,0,1,0,1,1,0,1]),n=e.indices||new Uint32Array([0,1,2,0,2,3]),a=e.shrinkBuffersToFit,o=new Bt({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),h=new Bt({data:r,label:"attribute-mesh-uvs",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),c=new Bt({data:n,label:"index-mesh-buffer",shrinkToFit:a,usage:K.INDEX|K.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:h,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};sa.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let qc=sa;class ke extends nt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const{textures:i,autoUpdate:r,...n}=e,[a]=i;super({...n,texture:a instanceof G?a:a.texture}),this._textures=null,this._durations=null,this._autoUpdate=r??!0,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=i}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(_t.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(_t.shared.add(this.update,this,es.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,r=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const a=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(_t.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(_t.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Kc extends rs{constructor(t,e){const{text:i,resolution:r,style:n,anchor:a,width:o,height:h,roundPixels:c,...l}=t;super({...l}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new at({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=c??!1,o!==void 0&&(this.width=o),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t=t||{},(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,r=-e*this.anchor.x;let n=0;return t.x>=r&&t.x<=r+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function Zc(s,t){let e=s[0]??{};return(typeof e=="string"||s[1])&&(L(z,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:s[1]}),e}class Tt extends Kc{constructor(...t){const e=Zc(t,"Text");super(e,ct),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=ni.measureText(this._text,this._style),{width:r,height:n}=i;t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*n,t.maxY=t.minY+n}}const ra=class na extends qc{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(L(z,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...na.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;const e=this.verticesX*this.verticesY,i=[],r=[],n=[],a=this.verticesX-1,o=this.verticesY-1,h=this.width/a,c=this.height/o;for(let u=0;ue?1:this.width/e,r=this._topHeight+this._bottomHeight,n=this.height>r?1:this.height/r,a=Math.min(i,n);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};aa.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let Xt=aa;const ha=class la extends rs{constructor(t){var u,d,f,p;t instanceof G&&(t={texture:t});const{width:e,height:i,leftWidth:r,rightWidth:n,topHeight:a,bottomHeight:o,texture:h,roundPixels:c,...l}=t;super({label:"NineSliceSprite",...l}),this.renderPipeId="nineSliceSprite",this.batched=!0,this._didSpriteUpdate=!0,this._leftWidth=r??((u=h==null?void 0:h.defaultBorders)==null?void 0:u.left)??Xt.defaultOptions.leftWidth,this._topHeight=a??((d=h==null?void 0:h.defaultBorders)==null?void 0:d.top)??Xt.defaultOptions.topHeight,this._rightWidth=n??((f=h==null?void 0:h.defaultBorders)==null?void 0:f.right)??Xt.defaultOptions.rightWidth,this._bottomHeight=o??((p=h==null?void 0:h.defaultBorders)==null?void 0:p.bottom)??Xt.defaultOptions.bottomHeight,this.bounds.maxX=this._width=e??h.width??Xt.defaultOptions.width,this.bounds.maxY=this._height=i??h.height??Xt.defaultOptions.height,this.allowChildren=!1,this.texture=h??la.defaultOptions.texture,this.roundPixels=c??!1}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){typeof t=="object"&&(e=t.height??t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=e??t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=G.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null}};ha.defaultOptions={texture:G.EMPTY};let Fe=ha;rt.add(va,Sa);class w{}x(w,"app"),x(w,"GameMaster"),x(w,"Grid"),x(w,"WaveManager"),x(w,"TowerManager"),x(w,"AnimationManager"),x(w,"NotificationManager"),x(w,"GameScene"),x(w,"latestCommit"),x(w,"GridCellSize",64),x(w,"GridColumns",25),x(w,"GridRows",17);class Jc{constructor(){x(this,"currentScene");x(this,"GameObjects",[]);w.GameMaster=this}_CreateGuiObject(t){this.currentScene.gui.push(t),w.GameMaster.currentScene.stage.addChild(t.container)}_RemoveGuiObject(t){this.currentScene.gui.splice(this.currentScene.gui.indexOf(t),1),w.GameMaster.currentScene.stage.removeChild(t.container)}changeScene(t){this.currentScene&&this.currentScene.destroy(),this.GameObjects.forEach(e=>{e.destroy()}),this.currentScene=t,this.currentScene.init()}}const U=class U{static async Load(t){return this.text.text="Loading asset: "+t,await _e.load({src:t})}static async LoadAssets(){if(this.text){console.warn("Do not call GameAssets.LoadAssets() more than once.");return}console.log("Loading Texture Assets");const t=new Tt({text:"Loading textures. This might take a while.",style:new ct({fill:3355443,fontSize:50})});t.x=w.app.canvas.width/2,t.y=w.app.canvas.height/2,t.anchor.set(.5,.5),w.app.stage.addChild(t),this.text=new Tt({text:"",style:new ct({fill:3355443,fontSize:50})}),this.text.x=w.app.canvas.width/2,this.text.y=w.app.canvas.height/2+50,this.text.anchor.set(.5,.5),w.app.stage.addChild(this.text),await Promise.all([this.Load("/aclonica.woff2"),this.Load("/assets/gui/button_01.png").then(e=>this.Button01Texture=e),this.Load("/assets/gui/button_02.png").then(e=>this.Button02Texture=e),this.Load("/assets/gui/button_small.png").then(e=>this.ButtonSmallTexture=e),this.Load("/assets/gui/frame_01.png").then(e=>this.Frame01Texture=e),this.Load("/assets/gui/frame_02.png").then(e=>this.Frame02Texture=e),this.Load("/assets/gui/frame_03.png").then(e=>this.Frame03Texture=e),this.Load("/assets/gui/background_01.png").then(e=>this.FrameBackground=e),this.Load("/assets/gui/background_02.png").then(e=>this.FrameTowerTab=e),this.Load("/assets/gui/frame_violet.png").then(e=>this.VioletBackground=e),this.Load("/assets/gui/frame_red.png").then(e=>this.RedBackground=e),this.Load("/assets/gui/frame_green.png").then(e=>this.GreenBackground=e),this.Load("/assets/gui/heart.png").then(e=>this.HealthTexture=e),this.Load("/assets/gui/money.png").then(e=>this.GoldTexture=e),this.Load("/assets/gui/wave.png").then(e=>this.WaveTexture=e),this.Load("/assets/gui/icons/play.png").then(e=>this.PlayIconTexture=e),this.Load("/assets/gui/icons/pause.png").then(e=>this.PauseIconTexture=e),this.Load("/assets/gui/icons/exclamation.png").then(e=>this.ExclamationIconTexture=e),this.Load("/assets/gui/icons/home.png").then(e=>this.HomeIconTexture=e),this.Load("/assets/gui/icons/hammer.png").then(e=>this.HammerIconTexture=e),this.LoadMissions(),this.LoadTowers(),this.LoadCreeps()]),t.destroy(),this.text.destroy(),this.text=!0}static async LoadCreeps(){const e=await(await fetch("/assets/json/Creeps.json")).json();this.Creeps=e;for(let i=0;i{this.enabled&&this.onWheel(e)},this._container.onpointerdown=e=>{this.enabled&&this.onClick(e)})}destroy(){this._events.removeAllListeners(),this._container.parent&&this._container.parent.removeChild(this._container),this._container.destroy()}get container(){return this._container}get events(){return this._events}onClick(t){console.warn(`[${this.name} does not implement GuiObject.onClick()]`)}onWheel(t){console.warn(`[${this.name} does not implement GuiObject.onWheel()]`)}setEnabled(t){this.enabled=t}}var se=(s=>(s[s.Button01=0]="Button01",s[s.Button02=1]="Button02",s))(se||{});class Be extends Re{constructor(e,i,r,n=!0){super(!0);x(this,"caption");x(this,"bounds");x(this,"buttonTexture");x(this,"buttonSprite");x(this,"buttonText");x(this,"buttonIcon");r==0&&(this.buttonTexture=D.Button01Texture),r==1&&(this.buttonTexture=D.Button02Texture),this.caption=i,this.enabled=n,this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.container.width=this.bounds.width,this.container.height=this.bounds.height,this.buttonSprite=new Fe({texture:this.buttonTexture,leftWidth:100,topHeight:100,rightWidth:100,bottomHeight:100}),this.buttonSprite.x=0,this.buttonSprite.y=0,this.buttonSprite.width=this.bounds.width,this.buttonSprite.height=this.bounds.height,this.container.addChild(this.buttonSprite),this.buttonText=new Tt({text:this.caption,style:new ct({fill:16777215,fontSize:24})}),this.container.addChild(this.buttonText),this.buttonText.anchor.set(.5,.5),this.buttonText.x=this.bounds.width/2,this.buttonText.y=this.bounds.height/2,this.container.x=this.bounds.x,this.container.y=this.bounds.y}setCaption(e){this.caption=e,this.buttonText.text=e}CustomButtonLogic(){console.warn(this.name+" - Button.CustomButtonLogic() is not implemented.")}}class Ft{constructor(){x(this,"name",this.constructor.name);x(this,"_container",new st);x(this,"bb",new W);x(this,"_events",new ot)}destroy(){this._events.removeAllListeners(),this._container.parent&&this._container.parent.removeChild(this._container),this._container.destroy()}get container(){return this._container}get events(){return this._events}copyContainerToBB(){return this.bb.x=this.container.x,this.bb.y=this.container.y,this.bb.width=this.container.width,this.bb.height=this.container.height,this.bb}copyBBToContainer(){return this.container.x=this.bb.x,this.container.y=this.bb.y,this.container.width=this.bb.width,this.container.height=this.bb.height,this.container}copyPropertiesToObj(t){return t.x=this.bb.x,t.y=this.bb.y,t.width=this.bb.width,t.height=this.bb.height,t}}var ie=(s=>(s.Died="died",s.TakenDamage="takenDamage",s.Escaped="escaped",s.Moved="moved",s))(ie||{});class tu extends Ft{constructor(e,i,r){super();x(this,"id");x(this,"creepType");x(this,"sprite");x(this,"path");x(this,"stats");x(this,"pathIndex",0);x(this,"speed");x(this,"direction",1);x(this,"healthBarGraphics",new It);x(this,"healthBarWidth",50);x(this,"health");x(this,"maxHealth");x(this,"escaped",!1);x(this,"died",!1);x(this,"x");x(this,"y");x(this,"dead",!1);this.creepType=e,this.stats=structuredClone(D.Creeps[this.creepType].stats),this.sprite=new ke(D.Creeps[this.creepType].textures),this.sprite.scale.x*=-1,this.sprite.anchor.set(.5,.5),this.sprite.animationSpeed=.3,this.sprite.play(),this.id=r,this.container.x=-70,this.container.y=-50,this.sprite.width=w.GridCellSize,this.sprite.height=w.GridCellSize,this.bb.width=this.sprite.width,this.speed=this.stats.speed/60,this.health=this.stats.health,this.maxHealth=this.stats.health,this.path=i,this.x=i[0][1]*w.GridCellSize+w.GridCellSize/2,this.y=i[0][0]*w.GridCellSize+w.GridCellSize/2,w.GameScene.events.on("takenDamage",(n,a)=>{n==this.id&&(this.health-=a,this.UpdateHealthbar())}),w.Grid.container.addChild(this.container),this.container.addChild(this.healthBarGraphics),this.container.addChild(this.sprite),this.UpdateHealthbar()}UpdateHealthbar(){this.healthBarGraphics.clear();const e=this.health,i=this.maxHealth,r=e/i,n=this.healthBarWidth*r;this.healthBarGraphics.rect(-this.healthBarWidth/2+3,-32,this.healthBarWidth+4,14),this.healthBarGraphics.fill({color:0}),this.healthBarGraphics.rect(-this.healthBarWidth/2+5,-30,n,10),this.healthBarGraphics.fill({color:16711680})}update(e){if(this.dead)return;if(this.health<=0){w.GameScene.events.emit("died",this.maxHealth,this),this.destroy(),this.dead=!0;return}if(this.pathIndex+1==this.path.length){if(this.escaped)return;this.events.emit("escaped",this),this.escaped=!0;return}const i=this.path[this.pathIndex],r=this.path[this.pathIndex+1],n=r[1]*w.GridCellSize+w.GridCellSize/2,a=r[0]*w.GridCellSize+w.GridCellSize/2,o=r[1]-i[1],h=r[0]-i[0];o>0?this.direction!=1&&(this.direction=1,this.sprite.scale.x*=-1):o<0&&this.direction!=-1&&(this.direction=-1,this.sprite.scale.x*=-1);let c=this.speed*e*o,l=this.speed*e*h,u=!1;c>0&&this.x+c>n&&(c=n-this.x,u=!0),c<0&&this.x+c0&&this.y+l>a&&(l=a-this.y,u=!0),l<0&&this.y+l(s[s.Restricted=0]="Restricted",s[s.Buildable=1]="Buildable",s[s.Path=9]="Path",s))(St||{}),ca=(s=>(s.BasicTowerBehaviour="BasicTowerBehaviour",s))(ca||{});class eu{constructor(){x(this,"isPlacingTower",!1);x(this,"canPlaceTowers",!0);x(this,"selectedTower",null);x(this,"previewSprite",new nt({parent:w.GameMaster.currentScene.stage,zIndex:10,width:64,height:64,alpha:.8}));x(this,"towers",[]);w.TowerManager=this,w.GameScene.events.on(ua.CellMouseOver,t=>{this.isPlacingTower&&(t.checkIfCantPlace()?(t.rangePreview.clear(),t.showRangePreview(!0,this.selectedTower.stats.range),this.previewSprite.tint=16711680):(t.showRangePreview(!1,this.selectedTower.stats.range),this.previewSprite.tint=16777215),this.previewSprite.x=t.column*w.GridCellSize,this.previewSprite.y=t.row*w.GridCellSize,this.previewSprite.texture=this.selectedTower.texture)})}ResetChooseTower(){this.selectedTower=null,this.isPlacingTower=!1,w.Grid.toggleGrid("hide")}ToggleChoosingTowerLocation(t){this.canPlaceTowers&&(w.Grid.toggleGrid(),this.isPlacingTower?(this.previewSprite.texture=null,this.selectedTower=null):D.Towers.forEach(e=>{e.name==t&&(this.selectedTower=e,console.log(this.selectedTower))}),this.isPlacingTower=!this.isPlacingTower)}PlayerClickOnGrid(t,e){if(this.canPlaceTowers&&this.isPlacingTower){if(!this.selectedTower)throw w.NotificationManager.Notify("TowerManager.selectedTower is null when trying to place tower.","danger"),console.warn("TowerManager.selectedTower is null when trying to place tower.");this.PlaceTower(this.selectedTower,t,e,this.selectedTower.behaviour)}}GetTowerByRowAndCol(t,e){let i=null;return this.towers.forEach(r=>{r.row==t&&r.column==e&&(i=r)}),i}PlaceTower(t,e,i,r,n){const a=this.selectedTower.texture;if(!w.GameScene.MissionStats.hasEnoughGold(t.stats.cost)&&!n)return w.NotificationManager.Notify("Not enough gold.","warn");if(!this.GetTowerByRowAndCol(e,i)&&w.Grid.getCellByRowAndCol(e,i).type!=St.Path&&w.Grid.getCellByRowAndCol(e,i).type!=St.Restricted){w.GameScene.MissionStats.spendGold(t.stats.cost);let o=new nu(e,i,a,t,r);this.towers.push(o),this.ToggleChoosingTowerLocation("RESET"),this.selectedTower=null,this.previewSprite.x=-100,w.GameScene.events.emit(Ie.TowerPlacedEvent,t.name,e,i)}else w.NotificationManager.Notify("Can not place tower on path or other tower, choose another spot.","warn"),console.warn("Can not place tower on occupied spot or path. Try again.")}update(t){this.towers.forEach(e=>{e.update(t)})}}function su(s,t,e,i){const r=e-s,n=i-t;return Math.atan2(n,r)}class iu extends Ft{constructor(e,i,r,n,a){super();x(this,"deleteMe",!1);x(this,"sprite");x(this,"x");x(this,"y");x(this,"angle");x(this,"speed");x(this,"damage");x(this,"timeToLive",1);this.x=e,this.y=i,this.damage=a,this.sprite=new ke({textures:r,scale:.25,rotation:n}),this.sprite.anchor.set(.5,.5),this.sprite.play(),this.container.x=this.x,this.container.y=this.y,this.container.addChild(this.sprite),w.GameMaster.currentScene.stage.addChild(this.container),this.angle=n,this.speed=.9}destroy(){super.destroy(),this.deleteMe=!0}update(e){if(!this.deleteMe){if(this.x>2e3||this.x<0||this.y>2e3||this.y<0||this.timeToLive<=0)return this.destroy();w.Grid.creeps.forEach(i=>{if(!(this.timeToLive<=0)&&i.container&&this.checkCollision(i)){this.timeToLive--,this.onCollide(i);return}}),this.x+=Math.cos(this.angle)*this.speed*e,this.y+=Math.sin(this.angle)*this.speed*e,this.container.x=this.x,this.container.y=this.y}}onCollide(e){w.GameScene.events.emit(ie.TakenDamage,e.id,this.damage)}checkCollision(e){if(e==null)return;let i=this.copyContainerToBB(),r=e.copyContainerToBB();return i.getBounds().intersects(r.getBounds())}}function ru(s,t,e,i){return Math.sqrt((e-s)*(e-s)+(i-t)*(i-t))}var Ie=(s=>(s.TowerPlacedEvent="towerPlacedEvent",s.TowerSoldEvent="towerSoldEvent",s))(Ie||{});class nu extends Ft{constructor(e,i,r,n,a){super();x(this,"row");x(this,"column");x(this,"projectiles",[]);x(this,"behaviour");x(this,"definition");x(this,"sprite");x(this,"ticksUntilNextShot");x(this,"graphics",new It);x(this,"parent");x(this,"onParentCellEnter",e=>{w.TowerManager.isPlacingTower||this.parent.showRangePreview(!1,this.definition.stats.range)});x(this,"onParentCellLeave",e=>{this.graphics.clear()});this.row=e,this.column=i,this.behaviour=a,this.definition=n,this.ticksUntilNextShot=0,this.parent=w.Grid.getCellByRowAndCol(e,i),console.log(r),this.sprite=new nt({texture:r,height:w.GridCellSize,width:w.GridCellSize,zIndex:10}),this.container.addChild(this.sprite),this.parent.container.addChild(this.container),this.container.interactiveChildren=!0,this.parent.clickDetector.on("pointerenter",this.onParentCellEnter),this.parent.clickDetector.on("pointerleave",this.onParentCellLeave),w.GameMaster.currentScene.stage.addChild(this.graphics)}GetCreepsInRange(){return w.Grid.creeps.filter(i=>{const r=i.x,n=i.y,a=this.column*w.GridCellSize+w.GridCellSize/2,o=this.row*w.GridCellSize+w.GridCellSize/2,h=this.definition.stats.range*w.GridCellSize;return ru(a,o,r,n){i.deleteMe?(this.projectiles.splice(this.projectiles.indexOf(i),1),i=null):i.update(e)}),this.behaviour==ca.BasicTowerBehaviour){this.ticksUntilNextShot>0&&this.ticksUntilNextShot--;let i=this.GetCreepsInRange();if(i.length>0){let r=i[0];this.ticksUntilNextShot==0&&(this.ticksUntilNextShot=this.definition.stats.cooldown,this.Shoot(r))}}}destroy(){super.destroy(),this.parent.clickDetector.off("pointerenter",this.onParentCellEnter),this.parent.clickDetector.off("pointerleave",this.onParentCellLeave),this.graphics.destroy()}}var ua=(s=>(s.CellMouseOver="cellmouseover",s))(ua||{});class au extends Ft{constructor(e,i,r,n){super();x(this,"type");x(this,"row");x(this,"column");x(this,"isPath",!1);x(this,"g");x(this,"hasTowerPlaced",!1);x(this,"clickDetector");x(this,"rangePreview");this.type=e,this.row=i,this.column=r,this.isPath=n,this.bb.x=this.column*w.GridCellSize,this.bb.y=this.row*w.GridCellSize,this.bb.width=w.GridCellSize,this.bb.height=w.GridCellSize,w.Grid.container.addChild(this.container),this.container.x=this.bb.x,this.container.y=this.bb.y,this.clickDetector=new It({zIndex:99,interactive:!0}),this.rangePreview=new It({zIndex:10}),this.g=new It({zIndex:5}),this.clickDetector.rect(0,0,this.bb.width,this.bb.height),this.clickDetector.fill({color:16711680,alpha:0}),this.container.addChild(this.clickDetector),this.container.addChild(this.g),this.container.addChild(this.rangePreview),this.clickDetector.on("pointerup",a=>{w.Grid.onGridCellClicked(i,r)}),this.clickDetector.on("pointerenter",a=>{w.GameScene.events.emit("cellmouseover",this)}),this.clickDetector.on("pointerleave",a=>{this.rangePreview.clear()}),w.GameScene.events.on(Ie.TowerPlacedEvent,(a,o,h)=>{o==this.row&&h==this.column&&(this.hasTowerPlaced=!0,this.rangePreview.clear())}),w.GameScene.events.on(Ie.TowerSoldEvent,(a,o,h)=>{o==this.row&&h==this.column&&(this.hasTowerPlaced=!1)})}showRangePreview(e,i){let r=16777215;e&&(r=16711680),this.rangePreview.clear(),this.rangePreview.circle(w.GridCellSize/2,w.GridCellSize/2,i*w.GridCellSize),this.rangePreview.fill({color:r,alpha:.3})}checkIfCantPlace(){return this.hasTowerPlaced||this.isPath||this.type==St.Path||this.type==St.Restricted}gDraw(){this.g.rect(0,0,this.bb.width,this.bb.height),this.type==St.Restricted?this.g.fill({color:2236962,alpha:.5}):this.hasTowerPlaced?this.g.fill({color:16711680,alpha:.5}):this.type==St.Path?this.g.fill({color:2236962,alpha:.5}):this.type==St.Buildable&&this.g.stroke({color:65280,alpha:.9})}gClear(){this.g.clear()}update(){}}class ou extends Ft{constructor(e,i){super();x(this,"gameMap");x(this,"cells",[]);x(this,"creeps",[]);x(this,"gridShown",!1);this.gameMap=e,w.Grid=this,this.bb.x=0,this.bb.y=0,this.bb.width=w.GridCellSize*w.GridColumns,this.bb.height=w.GridCellSize*w.GridRows,w.GameMaster.currentScene.stage.addChild(this.container);let r=new nt(D.MissionBackgrounds[i]);this.container.addChild(r);for(let n=0;nl.some(u=>u[0]===a&&u[1]===n));h&&(o=St.Path);let c=new au(o,a,n,h);this.cells.push(c)}}toggleGrid(e){this.cells.forEach(i=>{if(e){e=="hide"?i.gClear():i.gDraw();return}this.gridShown?i.gClear():i.gDraw()}),e=="hide"?this.gridShown=!1:e=="show"?this.gridShown=!0:this.gridShown=!this.gridShown}addCreep(e){this.creeps.push(e),e.events.on(ie.Died,i=>{this.onCreepDiedOrEscaped(i)}),e.events.on(ie.Escaped,i=>{this.onCreepDiedOrEscaped(i)})}onCreepDiedOrEscaped(e){this.creeps.splice(this.creeps.indexOf(e),1),e.destroy()}update(e){this.creeps.forEach(i=>{i.dead?(this.creeps.splice(this.creeps.indexOf(i),1),i=null):i.update(e)})}getCellByRowAndCol(e,i){return this.cells.filter(r=>r.row==e&&r.column==i)[0]}onGridCellClicked(e,i){}}var Se=(s=>(s.CreepSpawned="creepSpawned",s.Finished="finished",s.NewWave="newwave",s))(Se||{});class hu extends Ft{constructor(e,i){super();x(this,"creeps",[]);x(this,"rounds");x(this,"paths");x(this,"ticks",0);x(this,"started",!1);x(this,"finished",!1);x(this,"internalCreepId",0);w.WaveManager=this,this.rounds=e,this.paths=i}start(e){this.started=!0,this.ticks=0,this.creeps=[],this.finished=!1;let i=0;this.rounds[e].waves.forEach(r=>{i+=r.firstCreepSpawnTick,r.creeps.forEach(n=>{const a=new tu(n,this.paths[0],this.internalCreepId);this.internalCreepId++;const o={creep:a,tickToSpawnAt:i,spawned:!1};console.log("CREAWTASEDASD"),i+=r.spawnIntervalTicks,this.creeps.push(o)})}),console.log(this.creeps)}end(){this.started=!1}update(e){this.started!=!1&&(this.ticks+=e,this.creeps.forEach(i=>{!i.spawned&&i.tickToSpawnAt<=this.ticks?(i.spawned=!0,this.events.emit("creepSpawned",i.creep),console.log("Wave manager creep spawned, ",i,this.ticks),!this.finished&&this.creeps.every(r=>r.spawned)&&(this.finished=!0,console.log("wave maanger finisehd"),this.events.emit("finished"))):i.spawned&&i.creep.update(e)}))}}class Ir extends Re{constructor(e,i,r,n,a,o,h,c){if(e>3||i>2||e<0||i<0)throw"Index/row out of bounds for TowerButton.";super(!0);x(this,"frameSprite");x(this,"background");x(this,"towerName");x(this,"iconSprite");x(this,"i",0);this.towerName=h,this.container.x=e*r+5,this.container.y=i*n+5,this.background=new nt({texture:o}),this.iconSprite=new nt({texture:c}),this.background.width=r,this.background.height=n,this.iconSprite.x=r/2,this.iconSprite.y=n/2,this.iconSprite.width=r/2,this.iconSprite.height=n/2,this.iconSprite.anchor.set(.5,.5),this.container.addChild(this.background),this.container.addChild(this.iconSprite),this.frameSprite=new Fe({texture:D.Frame02Texture,leftWidth:100,topHeight:100,rightWidth:100,bottomHeight:100,roundPixels:!0,height:n,width:r}),this.container.addChild(this.frameSprite),a.addChild(this.container),w.GameScene.events.on(Ie.TowerPlacedEvent,l=>{this.resetTint()}),this.container.onpointerenter=l=>{},this.container.onpointerleave=l=>{}}onClick(e){w.TowerManager.isPlacingTower&&w.TowerManager.selectedTower.name!=this.towerName&&(w.GameScene.sidebar.towerTab.resetTint(),w.TowerManager.ResetChooseTower()),this.frameSprite.tint==65280?this.frameSprite.tint=16777215:this.frameSprite.tint=65280,w.TowerManager.ToggleChoosingTowerLocation(this.towerName)}resetTint(){this.frameSprite.tint=16777215}}class lu extends Re{constructor(e){super(!1);x(this,"bounds");x(this,"towerTabSprite");x(this,"towerButtons",[]);this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.towerTabSprite=new Fe({texture:D.FrameTowerTab,leftWidth:500,topHeight:500,rightWidth:500,bottomHeight:500,roundPixels:!0}),this.towerTabSprite.width=this.bounds.width,this.towerTabSprite.height=this.bounds.height,this.container.addChild(this.towerTabSprite),this.towerButtons.push(new Ir(0,0,70,70,this.container,D.RedBackground,"Basic Tower",D.HammerIconTexture)),this.towerButtons.push(new Ir(0,1,70,70,this.container,D.GreenBackground,"Circle Tower",D.HomeIconTexture))}resetTint(){this.towerButtons.forEach(e=>e.resetTint())}}class cu extends Re{constructor(e){super(!1);x(this,"bounds");x(this,"gemTabSprite");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.gemTabSprite=new Fe({texture:D.FrameTowerTab,leftWidth:1e3,topHeight:1e3,rightWidth:1e3,bottomHeight:1e3}),this.gemTabSprite.x=0,this.gemTabSprite.y=0,this.gemTabSprite.width=this.bounds.width,this.gemTabSprite.height=this.bounds.height,this.container.addChild(this.gemTabSprite)}}class uu extends Re{constructor(e){super(!1);x(this,"towerTab");x(this,"bounds");x(this,"sidebarSprite");x(this,"gemTab");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.sidebarSprite=new Fe({texture:D.Frame01Texture,leftWidth:100,topHeight:100,rightWidth:100,bottomHeight:100}),this.sidebarSprite.x=40,this.sidebarSprite.y=-40,this.sidebarSprite.width=this.bounds.width+40,this.sidebarSprite.height=this.bounds.height+80,this.container.addChild(this.sidebarSprite);const i=new W(60,20,this.bounds.width-65,150);this.towerTab=new lu(i),this.container.addChild(this.towerTab.container);const r=new W(60,180,this.bounds.width-65,this.bounds.height-280);this.gemTab=new cu(r),this.container.addChild(this.gemTab.container)}}class vi{constructor(){x(this,"stage",new st);x(this,"gui",[]);x(this,"_events",new ot);w.app.stage.addChild(this.stage)}destroy(){this.stage.destroy(),this.gui.forEach(t=>{t.destroy()})}get events(){return this._events}init(){}}class du extends Ft{constructor(e,i){super();x(this,"hp",100);x(this,"gold",0);x(this,"goldText");x(this,"healthText");x(this,"waveText");this.hp=e,this.gold=i,this.container.x=0,this.container.y=20,w.GameMaster.currentScene.stage.addChild(this.container),this.healthText=new Tt({text:`${this.hp}`,style:new ct({fill:"red",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.goldText=new Tt({text:`${this.gold}`,style:new ct({fill:"gold",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.waveText=new Tt({text:`0/${w.GameScene.mission.rounds.length}`,style:new ct({fill:"dodgerblue",fontSize:36,fontWeight:"bold",dropShadow:!0})});const r=new nt(D.HealthTexture),n=new nt(D.GoldTexture),a=new nt(D.WaveTexture);this.healthText.x=200,this.healthText.y=-15,r.x=160,r.width=36,r.height=32,r.y=-10,this.goldText.x=200,this.goldText.y=20,n.x=150,n.width=56,n.height=56,n.y=15,this.waveText.x=200,this.waveText.y=55,a.x=155,a.width=46,a.height=32,a.y=65,this.container.addChild(this.healthText),this.container.addChild(this.goldText),this.container.addChild(this.waveText),this.container.addChild(r),this.container.addChild(n),this.container.addChild(a),w.GameScene.events.on(Se.NewWave,o=>{this.waveText.text=`${o}/${w.GameScene.mission.rounds.length}`})}getHP(){return this.hp}hasEnoughGold(e){return e<=this.gold}setHP(e){this.hp=e,this.healthText.text=this.hp}takeDamage(e){this.hp-=e,this.healthText.text=this.hp}setGold(e){this.gold=e,this.goldText.text=this.gold}earnGold(e){this.gold+=e,this.goldText.text=this.gold}spendGold(e){this.gold-=e,this.goldText.text=this.gold}update(){}}const Kt=class Kt{static init(){Kt.SidebarRect=new W(w.app.canvas.width-360,0,360,w.app.canvas.height),Kt.ChangeRoundButtonRect=new W(50,w.app.canvas.height-100,310,100)}};x(Kt,"SidebarRect"),x(Kt,"ChangeRoundButtonRect");let Ee=Kt;class da extends vi{constructor(e){super();x(this,"isGameOver",!1);x(this,"mission");x(this,"missionIndex");x(this,"MissionStats");x(this,"roundMode");x(this,"ticker");x(this,"changeRoundButton");x(this,"sidebar");x(this,"currentRound",0);x(this,"isWaveManagerFinished",!1);x(this,"playerWon",!1);x(this,"destroyTicker",!1);w.GameScene=this,D.Missions.forEach((i,r)=>{i.name==e&&(this.mission=i,this.missionIndex=r)})}init(){this.ticker=new _t,this.ticker.maxFPS=60,this.ticker.minFPS=30,this.ticker.add(()=>{this.update&&this.update(this.ticker.elapsedMS)}),this.ticker.start(),new ou(this.mission.gameMap,this.missionIndex),new eu,new hu(this.mission.rounds,this.mission.gameMap.paths),w.Grid.onGridCellClicked=(e,i)=>{w.TowerManager.isPlacingTower&&w.TowerManager.PlayerClickOnGrid(e,i)},w.WaveManager.events.on(Se.CreepSpawned,e=>{w.Grid.addCreep(e),e.events.on(ie.Escaped,()=>{this.onCreepEscaped(e)})}),w.WaveManager.events.on(Se.Finished,()=>{this.isWaveManagerFinished=!0}),this.events.on(ie.Died,(e,i)=>{this.MissionStats.earnGold(e)}),this.sidebar=new uu(Ee.SidebarRect),this.changeRoundButton=new Be(Ee.ChangeRoundButtonRect,"",se.Button01,!0),this.changeRoundButton.container.removeFromParent(),this.sidebar.container.addChild(this.changeRoundButton.container),this.changeRoundButton.CustomButtonLogic=()=>{this.changeRoundButton.buttonIcon=new nt({texture:D.PlayIconTexture,x:this.changeRoundButton.container.width/2,y:this.changeRoundButton.container.height/2,scale:.2}),this.changeRoundButton.buttonIcon.anchor.set(.5,.5),this.changeRoundButton.container.addChild(this.changeRoundButton.buttonIcon)},this.changeRoundButton.CustomButtonLogic(),this.changeRoundButton.onClick=()=>{if(this.playerWon)return this.ReturnToMain();if(this.roundMode==1)return w.NotificationManager.Notify("Wave is already in progress.","warn");if(this.isGameOver)return w.NotificationManager.Notify("No more waves.","danger");this.setRoundMode(1),this.changeRoundButton.buttonIcon.texture=D.ExclamationIconTexture,this.events.emit(Se.NewWave,`${this.currentRound+1}`)},this.MissionStats=new du(100,200)}update(e){if(this.isGameOver){this.destroyTicker&&(this.destroyTicker=!1,this.ticker.destroy());return}w.WaveManager.update(e),w.Grid.update(e),w.TowerManager.update(e),this.isWaveManagerFinished&&w.Grid.creeps.length==0&&(this.isWaveManagerFinished=!1,this.setRoundMode(0),this.changeRoundButton.buttonIcon.texture=D.PlayIconTexture,w.NotificationManager.Notify(`Round ${this.currentRound+1}/${this.mission.rounds.length} completed.`,"info"),this.currentRound==this.mission.rounds.length&&w.NotificationManager.Notify("Final round.","danger"),this.currentRound+1==this.mission.rounds.length?(w.NotificationManager.Notify("Mission victory!!","reward"),this.changeRoundButton.buttonIcon.texture=D.HomeIconTexture,this.playerWon=!0):this.currentRound++),this.MissionStats.getHP()<=0?(this.isGameOver=!0,this.ShowScoreScreen(!0)):this.playerWon&&(this.isGameOver=!0,this.ShowScoreScreen(!1))}ShowScoreScreen(e){console.log(e?"LOSE!":"WIN!")}onCreepEscaped(e){this.MissionStats.takeDamage(e.health)}setRoundMode(e){this.roundMode=e,this.roundMode==1?w.WaveManager.start(this.currentRound):w.WaveManager.end()}destroy(){super.destroy(),this.isGameOver=!0,this.destroyTicker=!0,w.GameScene=null}ReturnToMain(){this.destroy(),w.GameMaster.currentScene.stage.removeChildren(),w.GameMaster.changeScene(new fa)}onTowerPlaced(){}}class fa extends vi{init(){const t=new Be(new W(0,0,300,60),"Back to main",se.Button01);t.onClick=e=>{w.GameMaster.changeScene(new pa)},D.Missions.forEach((e,i)=>{const r=new Be(new W(w.app.canvas.width/2-150,w.app.canvas.height/5+i*80,300,60),e.name,se.Button01);r.onClick=n=>{w.GameMaster.changeScene(new da(e.name))}})}}class pa extends vi{init(){const t={caption:"New Game",rect:new W(w.app.canvas.width/2-150,w.app.canvas.height/5+240,300,60),texture:se.Button02},e={caption:"Settings",rect:new W(w.app.canvas.width/2-300/2,w.app.canvas.height/5+4*80,300,60),texture:se.Button02};let i=new Tt({x:w.app.canvas.width/2-300/2,y:w.app.canvas.height/5+1*80,text:"BASTION",style:{fill:16755200,fontFamily:"Aclonica",fontSize:100}});i.x=i.x-i.width/5,w.GameMaster.currentScene.stage.addChild(i);let r=new Tt({x:0,y:0,text:"Latest commit: "+w.latestCommit,style:{fill:0,fontSize:10,fontWeight:"bold"}});w.GameMaster.currentScene.stage.addChild(r);const n=new Be(t.rect,t.caption,t.texture,!0);n.onClick=o=>{w.GameMaster.currentScene.stage.removeChild(i),w.GameMaster.currentScene.stage.removeChild(r),w.GameMaster.changeScene(new fa)};let a=new Be(e.rect,e.caption,e.texture,!0);a.onClick=o=>{w.NotificationManager.Notify("Not finished.","info")}}}class fu{constructor(){x(this,"finished",!1);x(this,"calledBack",!1);x(this,"callbackFn")}Finish(){this.finished=!0}update(t){this.finished}}class pu extends fu{constructor(e,i,r,n){super();x(this,"fadeType");x(this,"fadeTime");x(this,"pixiObject");x(this,"ticks",0);this.fadeType=e,this.fadeTime=i,this.pixiObject=r,this.callbackFn=n,e=="in"?this.pixiObject.alpha=0:this.pixiObject.alpha=1}update(e){if(super.update(e),this.pixiObject==null)return this.Finish();this.ticks++,this.fadeType=="in"?this.pixiObject.alpha=this.ticks/this.fadeTime:this.pixiObject.alpha-=1/this.fadeTime,this.ticks>=this.fadeTime&&this.Finish()}}class gu{constructor(){x(this,"AnimationQueue",[])}Animate(t){this.AnimationQueue.push(t)}update(t){for(let e=this.AnimationQueue.length-1;e>=0;e--){const i=this.AnimationQueue[e];i.finished?(i.callbackFn(),this.AnimationQueue.splice(e,1)):i.update(t)}}}class mu{constructor(t,e,i,r,n){x(this,"textObj");x(this,"ticksToFadeAway");x(this,"animating",!1);x(this,"destroyed",!1);let a=16777215;e=="info"?a=2143228:e=="warn"?a=16570144:e=="danger"?a=16517642:e=="reward"&&(a=14047996),this.ticksToFadeAway=n,this.textObj=new Tt({text:t,style:new ct({fill:a,fontSize:36,fontWeight:"bold",dropShadow:!0,align:"center"}),x:i,y:r,zIndex:100}),this.textObj.anchor.set(.5,.5),w.NotificationManager.container.addChild(this.textObj)}destroy(){this.textObj.destroy(),this.destroyed=!0}}class xu extends Ft{constructor(){super();x(this,"notifications",[]);x(this,"ticks",0);this.bb.x=w.app.canvas.width/2,this.bb.y=40,this.copyBBToContainer(),this.container.zIndex=100,w.app.stage.addChild(this.container)}Notify(e,i){let r=0,n=this.notifications.length*32;this.notifications.push(new mu(e,i,r,n,this.ticks+180))}update(e){this.ticks++;for(let i=this.notifications.length-1;i>=0;i--){const r=this.notifications[i];if(r.destroyed){this.notifications.splice(i,1);continue}this.ticks>=r.ticksToFadeAway&&!r.animating&&(r.animating=!0,w.AnimationManager.Animate(new pu("out",240,r.textObj,()=>{r.destroy()})))}}}(async()=>{const s=new Tn;w.app=s,await s.init({width:1920,height:1080,resolution:1,autoDensity:!0,backgroundColor:16777215,sharedTicker:!0}),document.body.appendChild(s.canvas);function t(){const i=window.innerWidth,r=window.innerHeight,n=i/s.screen.width,a=r/s.screen.height,o=Math.min(n,a),h=Math.round(s.screen.width*o),c=Math.round(s.screen.height*o),l=(i-h)/2,u=(r-c)/2;s.canvas.style.width=`${h}px`,s.canvas.style.height=`${c}px`,s.canvas.style.marginLeft=`${l}px`,s.canvas.style.marginTop=`${u}px`,s.canvas.style.marginRight="0",s.canvas.style.marginBottom="0",s.canvas.style.display="block"}w.latestCommit=await fetch("/latest_commit").then(i=>i.text()),window.addEventListener("resize",t),t(),await D.LoadAssets(),Ee.init(),new Jc,w.AnimationManager=new gu,w.NotificationManager=new xu,globalThis.Engine=w,_t.shared.add(i=>{w.NotificationManager.update(i.elapsedMS),w.AnimationManager.update(i.elapsedMS)}),w.GameMaster.changeScene(new pa),new URLSearchParams(location.href).entries().next().value[1]=="game"&&w.GameMaster.changeScene(new da("Mission 1")),w.latestCommit!="DEVELOPMENT"&&(window.onbeforeunload=()=>"You are about to leave.")})();export{L as $,vn as A,K as B,st as C,j as D,P as E,Hr as F,as as G,bt as H,Hi as I,nt as J,Bo as K,Wo as L,O as M,J as N,W as O,it as P,ih as Q,Xs as R,Sh as S,Mt as T,es as U,$i as V,ho as W,ws as X,Z as Y,$r as Z,Sn as _,G as a,z as a0,hh as a1,Rn as a2,Xh as a3,qh as a4,tl as a5,sl as a6,il as a7,te as a8,ct as a9,Xl as aa,ni as ab,Un as ac,tr as ad,Xt as ae,qc as af,Ar as ag,Jl as ah,It as ai,V as aj,La as ak,ri as al,vr as am,Hn as an,_t as b,ot as c,Bt as d,rt as e,Ji as f,bh as g,Ze as h,ci as i,_n as j,tn as k,gn as l,wr as m,Bi as n,Yh as o,jh as p,Qh as q,ja as r,kn as s,el as t,ui as u,un as v,Q as w,Ga as x,nl as y,At as z}; +`;let Qt=null;class Jn{constructor(){Qt||(Qt=URL.createObjectURL(new Blob([zc],{type:"application/javascript"}))),this.worker=new Worker(Qt)}}Jn.revokeObjectURL=function(){Qt&&(URL.revokeObjectURL(Qt),Qt=null)};let kr=0,Ws;class Wc{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ai;e.addEventListener("message",i=>{e.terminate(),ai.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Ws===void 0&&(Ws=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((r,n)=>{this._queue.push({id:t,arguments:e,resolve:r,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[kr]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:kr++,id:i})}}const Br=new Wc,Oc=[".jpeg",".jpg",".png",".webp",".avif"],Uc=["image/jpeg","image/png","image/webp","image/avif"];async function Dc(s,t){var r;const e=await j.get().fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const i=await e.blob();return((r=t==null?void 0:t.data)==null?void 0:r.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const ta={name:"loadTextures",extension:{type:P.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return ae(s,Uc)||oe(s,Oc)},async load(s,t,e){var n;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Br.isImageBitmapSupported()?i=await Br.loadImageBitmap(s,t):i=await Dc(s,t):i=await new Promise(a=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=s,i.complete?a(i):i.onload=()=>{a(i)}});const r=new re({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((n=t.data)==null?void 0:n.resolution)||wi(s),...t.data});return vi(r,e,s)},unload(s){s.destroy(!0)}},ea=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Hc=ea.map(s=>`video/${s.substring(1)}`);function Nc(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=Vc(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function $c(s){return new Promise((t,e)=>{s.addEventListener("canplaythrough",i),s.addEventListener("error",r),s.load();function i(){n(),t()}function r(a){n(),e(a)}function n(){s.removeEventListener("canplaythrough",i),s.removeEventListener("error",r)}})}function Vc(s,t=globalThis.location){if(s.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}const Yc={name:"loadVideo",extension:{type:P.LoadParser,name:"loadVideo"},test(s){const t=ae(s,Hc),e=oe(s,ea);return t||e},async load(s,t,e){var h,c;const i={...Ke.defaultOptions,resolution:((h=t.data)==null?void 0:h.resolution)||wi(s),alphaMode:((c=t.data)==null?void 0:c.alphaMode)||await rn(),...t.data},r=document.createElement("video"),n={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(n).forEach(l=>{const u=n[l];u!==void 0&&r.setAttribute(l,u)}),i.muted===!0&&(r.muted=!0),Nc(r,s,i.crossorigin);const a=document.createElement("source");let o;if(s.startsWith("data:"))o=s.slice(5,s.indexOf(";"));else if(!s.startsWith("blob:")){const l=s.split("?")[0].slice(s.lastIndexOf(".")+1).toLowerCase();o=Ke.MIME_TYPES[l]||`video/${l}`}return a.src=s,o&&(a.type=o),new Promise(l=>{const u=async()=>{const d=new Ke({...i,resource:r});r.removeEventListener("canplay",u),t.data.preload&&await $c(r),l(vi(d,e,s))};r.addEventListener("canplay",u),r.appendChild(a)})},unload(s){s.destroy(!0)}},sa={extension:{type:P.ResolveParser,name:"resolveTexture"},test:ta.test,parse:s=>{var t;return{resolution:parseFloat(((t=ne.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:s.split(".").pop(),src:s}}},Xc={extension:{type:P.ResolveParser,priority:-2,name:"resolveJson"},test:s=>ne.RETINA_PREFIX.test(s)&&s.endsWith(".json"),parse:sa.parse};class jc{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ne,this.loader=new mc,this.cache=V,this._backgroundLoader=new oc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,a;if(this._initialized){Q("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(a=t.texturePreference)==null?void 0:a.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=ss(t),r=mt(t).map(o=>{if(typeof o!="string"){const h=this.resolver.getAlias(o);return h.some(c=>!this.resolver.hasKey(c))&&this.add(o),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return i?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const c=()=>{e==null||e(++o/h)},l=a.map(u=>{const d=r[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{n[u]=f})});return await Promise.all(l),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return V.get(t);const e={};for(let i=0;i{const o=r[a.src],h=[a.src];a.alias&&h.push(...a.alias),h.forEach(c=>{n[c]=o}),V.set(h,o)}),n}async unload(t){this._initialized||await this.init();const e=mt(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=mt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{V.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const we=new jc;nt.handleByList(P.LoadParser,we.loader.parsers).handleByList(P.ResolveParser,we.resolver.parsers).handleByList(P.CacheParser,we.cache.parsers).handleByList(P.DetectionParser,we.detections);nt.add(hc,cc,lc,gc,dc,fc,pc,_c,vc,Bc,Fc,ta,Yc,ac,nc,sa,Xc);const Ir={loader:P.LoadParser,resolver:P.ResolveParser,cache:P.CacheParser,detection:P.DetectionParser};nt.handle(P.Asset,s=>{const t=s.ref;Object.entries(Ir).filter(([e])=>!!t[e]).forEach(([e,i])=>nt.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(Ir).filter(e=>!!t[e]).forEach(e=>nt.remove(t[e]))});class It extends rs{constructor(t){t instanceof dt&&(t={context:t});const{context:e,roundPixels:i,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new dt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i??!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new It(this._context.clone()):(this._ownedContext=null,new It(this._context))}lineStyle(t,e,i){W(O,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),i&&(r.alpha=i),this.context.strokeStyle=r,this}beginFill(t,e){W(O,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const i={};return t&&(i.color=t),e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){W(O,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==dt.defaultStrokeStyle.width||t.color!==dt.defaultStrokeStyle.color||t.alpha!==dt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return W(O,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return W(O,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return W(O,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return W(O,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return W(O,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return W(O,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}const ia=class ra extends Gn{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(W(O,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...ra.defaultOptions,...e};const i=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),r=e.uvs||new Float32Array([0,0,1,0,1,1,0,1]),n=e.indices||new Uint32Array([0,1,2,0,2,3]),a=e.shrinkBuffersToFit,o=new Bt({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),h=new Bt({data:r,label:"attribute-mesh-uvs",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),c=new Bt({data:n,label:"index-mesh-buffer",shrinkToFit:a,usage:K.INDEX|K.COPY_DST});super({attributes:{aPosition:{buffer:o,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:h,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:e.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};ia.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let qc=ia;class Ie extends tt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const{textures:i,autoUpdate:r,...n}=e,[a]=i;super({...n,texture:a instanceof G?a:a.texture}),this._textures=null,this._durations=null,this._autoUpdate=r??!0,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=i}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(bt.shared.add(this.update,this,es.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,r=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const a=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(bt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(bt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Kc extends rs{constructor(t,e){const{text:i,resolution:r,style:n,anchor:a,width:o,height:h,roundPixels:c,...l}=t;super({...l}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new at({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=c??!1,o!==void 0&&(this.width=o),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t=t||{},(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,r=-e*this.anchor.x;let n=0;return t.x>=r&&t.x<=r+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function Zc(s,t){let e=s[0]??{};return(typeof e=="string"||s[1])&&(W(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:s[1]}),e}class ct extends Kc{constructor(...t){const e=Zc(t,"Text");super(e,ot),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=ni.measureText(this._text,this._style),{width:r,height:n}=i;t.minX=-e._x*r,t.maxX=t.minX+r,t.minY=-e._y*n,t.maxY=t.minY+n}}const na=class aa extends qc{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(W(O,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...aa.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;const e=this.verticesX*this.verticesY,i=[],r=[],n=[],a=this.verticesX-1,o=this.verticesY-1,h=this.width/a,c=this.height/o;for(let u=0;ue?1:this.width/e,r=this._topHeight+this._bottomHeight,n=this.height>r?1:this.height/r,a=Math.min(i,n);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};oa.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let Xt=oa;const la=class ca extends rs{constructor(t){var u,d,f,p;t instanceof G&&(t={texture:t});const{width:e,height:i,leftWidth:r,rightWidth:n,topHeight:a,bottomHeight:o,texture:h,roundPixels:c,...l}=t;super({label:"NineSliceSprite",...l}),this.renderPipeId="nineSliceSprite",this.batched=!0,this._didSpriteUpdate=!0,this._leftWidth=r??((u=h==null?void 0:h.defaultBorders)==null?void 0:u.left)??Xt.defaultOptions.leftWidth,this._topHeight=a??((d=h==null?void 0:h.defaultBorders)==null?void 0:d.top)??Xt.defaultOptions.topHeight,this._rightWidth=n??((f=h==null?void 0:h.defaultBorders)==null?void 0:f.right)??Xt.defaultOptions.rightWidth,this._bottomHeight=o??((p=h==null?void 0:h.defaultBorders)==null?void 0:p.bottom)??Xt.defaultOptions.bottomHeight,this.bounds.maxX=this._width=e??h.width??Xt.defaultOptions.width,this.bounds.maxY=this._height=i??h.height??Xt.defaultOptions.height,this.allowChildren=!1,this.texture=h??ca.defaultOptions.texture,this.roundPixels=c??!1}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){typeof t=="object"&&(e=t.height??t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=e??t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=G.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null}};la.defaultOptions={texture:G.EMPTY};let he=la;nt.add(va,Sa);class y{}x(y,"app"),x(y,"GameMaster"),x(y,"Grid"),x(y,"WaveManager"),x(y,"TowerManager"),x(y,"AnimationManager"),x(y,"NotificationManager"),x(y,"GameScene"),x(y,"latestCommit"),x(y,"GridCellSize",64),x(y,"GridColumns",25),x(y,"GridRows",17),x(y,"MouseX",0),x(y,"MouseY",0);class Jc{constructor(){x(this,"currentScene");x(this,"GameObjects",[]);y.GameMaster=this}_CreateGuiObject(t){this.currentScene.gui.push(t),y.GameMaster.currentScene.stage.addChild(t.container)}_RemoveGuiObject(t){this.currentScene.gui.splice(this.currentScene.gui.indexOf(t),1),y.GameMaster.currentScene.stage.removeChild(t.container)}changeScene(t){this.currentScene&&this.currentScene.destroy(),this.GameObjects.forEach(e=>{e.destroy()}),this.currentScene=t,this.currentScene.init()}}const L=class L{static async Load(t){return this.text.text="Loading asset: "+t,await we.load({src:t})}static async LoadAssets(){if(this.text){console.warn("Do not call GameAssets.LoadAssets() more than once.");return}console.log("Loading Texture Assets");const t=new ct({text:"Loading textures. This might take a while.",style:new ot({fill:3355443,fontSize:50})});t.x=y.app.canvas.width/2,t.y=y.app.canvas.height/2,t.anchor.set(.5,.5),y.app.stage.addChild(t),this.text=new ct({text:"",style:new ot({fill:3355443,fontSize:50})}),this.text.x=y.app.canvas.width/2,this.text.y=y.app.canvas.height/2+50,this.text.anchor.set(.5,.5),y.app.stage.addChild(this.text),await Promise.all([this.Load("/aclonica.woff2"),this.Load("/assets/gui/button_01.png").then(e=>this.Button01Texture=e),this.Load("/assets/gui/button_02.png").then(e=>this.Button02Texture=e),this.Load("/assets/gui/button_small.png").then(e=>this.ButtonSmallTexture=e),this.Load("/assets/gui/frame_01.png").then(e=>this.Frame01Texture=e),this.Load("/assets/gui/frame_02.png").then(e=>this.Frame02Texture=e),this.Load("/assets/gui/frame_03.png").then(e=>this.Frame03Texture=e),this.Load("/assets/gui/frame_04.png").then(e=>this.Frame04Texture=e),this.Load("/assets/gui/frame_inv.png").then(e=>this.FrameInventory=e),this.Load("/assets/gui/background_01.png").then(e=>this.FrameBackground=e),this.Load("/assets/gui/background_02.png").then(e=>this.FrameTowerTab=e),this.Load("/assets/gui/frame_violet.png").then(e=>this.VioletBackground=e),this.Load("/assets/gui/frame_red.png").then(e=>this.RedBackground=e),this.Load("/assets/gui/frame_green.png").then(e=>this.GreenBackground=e),this.Load("/assets/gui/frame_blue.png").then(e=>this.BlueBackground=e),this.Load("/assets/gui/heart.png").then(e=>this.HealthTexture=e),this.Load("/assets/gui/money.png").then(e=>this.GoldTexture=e),this.Load("/assets/gui/wave.png").then(e=>this.WaveTexture=e),this.Load("/assets/gui/sword_02.png").then(e=>this.SwordsTexture=e),this.Load("/assets/gui/title01.png").then(e=>this.TitleTexture=e),this.Load("/assets/gui/icons/play.png").then(e=>this.PlayIconTexture=e),this.Load("/assets/gui/icons/pause.png").then(e=>this.PauseIconTexture=e),this.Load("/assets/gui/icons/exclamation.png").then(e=>this.ExclamationIconTexture=e),this.Load("/assets/gui/icons/home.png").then(e=>this.HomeIconTexture=e),this.Load("/assets/gui/icons/hammer.png").then(e=>this.HammerIconTexture=e),this.LoadMissions(),this.LoadTowers(),this.LoadCreeps(),this.LoadGemIcons()]),t.destroy(),this.text.destroy(),this.text=!0}static async LoadGemIcons(){for(let t=0;t<7;t++)this.GemAmountIcons[t]=await this.Load(`/assets/gui/gem_amount_${t}.png`)}static async LoadCreeps(){const e=await(await fetch("/assets/json/Creeps.json")).json();this.Creeps=e;for(let i=0;i{this.enabled&&this.onWheel(e)},this._container.onpointerdown=e=>{this.enabled&&this.onClick(e)})}destroy(){this._events.removeAllListeners(),this._container.parent&&this._container.parent.removeChild(this._container),this._container.destroy()}get container(){return this._container}get events(){return this._events}onClick(t){console.warn(`[${this.name} does not implement GuiObject.onClick()]`)}onWheel(t){console.warn(`[${this.name} does not implement GuiObject.onWheel()]`)}setEnabled(t){this.enabled=t}}var se=(s=>(s[s.Button01=0]="Button01",s[s.Button02=1]="Button02",s))(se||{});class Ee extends le{constructor(e,i,r,n=!0){super(!0);x(this,"caption");x(this,"bounds");x(this,"buttonTexture");x(this,"buttonSprite");x(this,"buttonText");x(this,"buttonIcon");r==0&&(this.buttonTexture=z.Button01Texture),r==1&&(this.buttonTexture=z.Button02Texture),this.caption=i,this.enabled=n,this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.container.width=this.bounds.width,this.container.height=this.bounds.height,this.buttonSprite=new he({texture:this.buttonTexture,leftWidth:100,topHeight:100,rightWidth:100,bottomHeight:100}),this.buttonSprite.x=0,this.buttonSprite.y=0,this.buttonSprite.width=this.bounds.width,this.buttonSprite.height=this.bounds.height,this.container.addChild(this.buttonSprite),this.buttonText=new ct({text:this.caption,style:new ot({fill:16777215,fontSize:24})}),this.container.addChild(this.buttonText),this.buttonText.anchor.set(.5,.5),this.buttonText.x=this.bounds.width/2,this.buttonText.y=this.bounds.height/2,this.container.x=this.bounds.x,this.container.y=this.bounds.y}setCaption(e){this.caption=e,this.buttonText.text=e}CustomButtonLogic(){console.warn(this.name+" - Button.CustomButtonLogic() is not implemented.")}}class Ft{constructor(){x(this,"name",this.constructor.name);x(this,"_container",new it);x(this,"bb",new D);x(this,"_events",new ht)}destroy(){this._events.removeAllListeners(),this._container.parent&&this._container.parent.removeChild(this._container),this._container.destroy()}get container(){return this._container}get events(){return this._events}copyContainerToBB(){return this.bb.x=this.container.x,this.bb.y=this.container.y,this.bb.width=this.container.width,this.bb.height=this.container.height,this.bb}copyBBToContainer(){return this.container.x=this.bb.x,this.container.y=this.bb.y,this.container.width=this.bb.width,this.container.height=this.bb.height,this.container}copyPropertiesToObj(t){return t.x=this.bb.x,t.y=this.bb.y,t.width=this.bb.width,t.height=this.bb.height,t}}var ie=(s=>(s.Died="died",s.TakenDamage="takenDamage",s.Escaped="escaped",s.Moved="moved",s))(ie||{});class tu extends Ft{constructor(e,i,r){super();x(this,"id");x(this,"creepType");x(this,"sprite");x(this,"path");x(this,"stats");x(this,"pathIndex",0);x(this,"speed");x(this,"direction",1);x(this,"healthBarGraphics",new It);x(this,"healthBarWidth",50);x(this,"health");x(this,"maxHealth");x(this,"escaped",!1);x(this,"died",!1);x(this,"x");x(this,"y");x(this,"dead",!1);this.creepType=e,this.stats=structuredClone(z.Creeps[this.creepType].stats),this.sprite=new Ie(z.Creeps[this.creepType].textures),this.sprite.scale.x*=-1,this.sprite.anchor.set(.5,.5),this.sprite.animationSpeed=.3,this.sprite.play(),this.id=r,this.container.x=-70,this.container.y=-50,this.sprite.width=y.GridCellSize,this.sprite.height=y.GridCellSize,this.bb.width=this.sprite.width,this.speed=this.stats.speed/60,this.health=this.stats.health,this.maxHealth=this.stats.health,this.path=i,this.x=i[0][1]*y.GridCellSize+y.GridCellSize/2,this.y=i[0][0]*y.GridCellSize+y.GridCellSize/2,y.GameScene.events.on("takenDamage",(n,a)=>{n==this.id&&(this.health-=a,this.UpdateHealthbar())}),y.Grid.container.addChild(this.container),this.container.addChild(this.healthBarGraphics),this.container.addChild(this.sprite),this.UpdateHealthbar()}UpdateHealthbar(){this.healthBarGraphics.clear();const e=this.health,i=this.maxHealth,r=e/i,n=this.healthBarWidth*r;this.healthBarGraphics.rect(-this.healthBarWidth/2+3,-32,this.healthBarWidth+4,14),this.healthBarGraphics.fill({color:0}),this.healthBarGraphics.rect(-this.healthBarWidth/2+5,-30,n,10),this.healthBarGraphics.fill({color:16711680})}update(e){if(this.dead)return;if(this.health<=0){y.GameScene.events.emit("died",this.maxHealth,this),this.destroy(),this.dead=!0;return}if(this.pathIndex+1==this.path.length){if(this.escaped)return;this.events.emit("escaped",this),this.escaped=!0;return}const i=this.path[this.pathIndex],r=this.path[this.pathIndex+1],n=r[1]*y.GridCellSize+y.GridCellSize/2,a=r[0]*y.GridCellSize+y.GridCellSize/2,o=r[1]-i[1],h=r[0]-i[0];o>0?this.direction!=1&&(this.direction=1,this.sprite.scale.x*=-1):o<0&&this.direction!=-1&&(this.direction=-1,this.sprite.scale.x*=-1);let c=this.speed*e*o,l=this.speed*e*h,u=!1;c>0&&this.x+c>n&&(c=n-this.x,u=!0),c<0&&this.x+c0&&this.y+l>a&&(l=a-this.y,u=!0),l<0&&this.y+l(s[s.Restricted=0]="Restricted",s[s.Buildable=1]="Buildable",s[s.Path=9]="Path",s))(At||{}),ua=(s=>(s.BasicTowerBehaviour="BasicTowerBehaviour",s))(ua||{});class eu{constructor(){x(this,"isPlacingTower",!1);x(this,"canPlaceTowers",!0);x(this,"selectedTower",null);x(this,"previewSprite",new tt({parent:y.GameMaster.currentScene.stage,zIndex:10,width:64,height:64,alpha:.8}));x(this,"towers",[]);y.TowerManager=this,y.GameScene.events.on(oi.CellMouseOver,t=>{this.isPlacingTower&&(t.checkIfCantPlace()?(t.showRangePreview(!0,this.selectedTower.stats.range),this.previewSprite.tint=16711680):(t.showRangePreview(!1,this.selectedTower.stats.range),this.previewSprite.tint=16777215),this.previewSprite.x=t.column*y.GridCellSize,this.previewSprite.y=t.row*y.GridCellSize,this.previewSprite.texture=this.selectedTower.texture)}),y.GameScene.events.on(oi.CellMouseLeave,t=>{this.previewSprite.texture=null})}ResetChooseTower(){this.selectedTower=null,this.isPlacingTower=!1,y.Grid.toggleGrid("hide")}ToggleChoosingTowerLocation(t){this.canPlaceTowers&&(y.Grid.toggleGrid(),this.isPlacingTower?(this.previewSprite.texture=null,this.selectedTower=null):z.Towers.forEach(e=>{e.name==t&&(this.selectedTower=e,console.log(this.selectedTower))}),this.isPlacingTower=!this.isPlacingTower)}PlayerClickOnGrid(t,e){if(this.canPlaceTowers&&this.isPlacingTower){if(!this.selectedTower)throw y.NotificationManager.Notify("TowerManager.selectedTower is null when trying to place tower.","danger"),console.warn("TowerManager.selectedTower is null when trying to place tower.");this.PlaceTower(this.selectedTower,t,e,this.selectedTower.behaviour)}}GetTowerByRowAndCol(t,e){let i=null;return this.towers.forEach(r=>{r.row==t&&r.column==e&&(i=r)}),i}PlaceTower(t,e,i,r,n){const a=this.selectedTower.texture;if(!y.GameScene.MissionStats.hasEnoughGold(t.stats.cost)&&!n)return y.NotificationManager.Notify("Not enough gold.","warn");if(!this.GetTowerByRowAndCol(e,i)&&y.Grid.getCellByRowAndCol(e,i).type!=At.Path&&y.Grid.getCellByRowAndCol(e,i).type!=At.Restricted){y.GameScene.MissionStats.spendGold(t.stats.cost);let o=new nu(e,i,a,t,r);this.towers.push(o),this.ToggleChoosingTowerLocation("RESET"),this.selectedTower=null,this.previewSprite.x=-100,y.GameScene.events.emit(Fe.TowerPlacedEvent,t.name,e,i)}else y.NotificationManager.Notify("Can not place tower on path or other tower, choose another spot.","warn"),console.warn("Can not place tower on occupied spot or path. Try again.")}update(t){this.towers.forEach(e=>{e.update(t)})}}function su(s,t,e,i){const r=e-s,n=i-t;return Math.atan2(n,r)}class iu extends Ft{constructor(e,i,r,n,a){super();x(this,"deleteMe",!1);x(this,"sprite");x(this,"x");x(this,"y");x(this,"angle");x(this,"speed");x(this,"damage");x(this,"timeToLive",1);this.x=e,this.y=i,this.damage=a,this.sprite=new Ie({textures:r,scale:.25,rotation:n}),this.sprite.anchor.set(.5,.5),this.sprite.play(),this.container.x=this.x,this.container.y=this.y,this.container.addChild(this.sprite),y.GameMaster.currentScene.stage.addChild(this.container),this.angle=n,this.speed=.9}destroy(){super.destroy(),this.deleteMe=!0}update(e){if(!this.deleteMe){if(this.x>2e3||this.x<0||this.y>2e3||this.y<0||this.timeToLive<=0)return this.destroy();y.Grid.creeps.forEach(i=>{if(!(this.timeToLive<=0)&&i.container&&this.checkCollision(i)){this.timeToLive--,this.onCollide(i);return}}),this.x+=Math.cos(this.angle)*this.speed*e,this.y+=Math.sin(this.angle)*this.speed*e,this.container.x=this.x,this.container.y=this.y}}onCollide(e){y.GameScene.events.emit(ie.TakenDamage,e.id,this.damage)}checkCollision(e){if(e==null)return;let i=this.copyContainerToBB(),r=e.copyContainerToBB();return i.getBounds().intersects(r.getBounds())}}function ru(s,t,e,i){return Math.sqrt((e-s)*(e-s)+(i-t)*(i-t))}var Fe=(s=>(s.TowerPlacedEvent="towerPlacedEvent",s.TowerSoldEvent="towerSoldEvent",s))(Fe||{});class nu extends Ft{constructor(e,i,r,n,a){super();x(this,"row");x(this,"column");x(this,"projectiles",[]);x(this,"behaviour");x(this,"definition");x(this,"sprite");x(this,"ticksUntilNextShot");x(this,"graphics",new It);x(this,"parent");x(this,"onParentCellEnter",e=>{y.TowerManager.isPlacingTower||this.parent.showRangePreview(!1,this.definition.stats.range)});x(this,"onParentCellLeave",e=>{this.graphics.clear()});this.row=e,this.column=i,this.behaviour=a,this.definition=n,this.ticksUntilNextShot=0,this.parent=y.Grid.getCellByRowAndCol(e,i),console.log(r),this.sprite=new tt({texture:r,height:y.GridCellSize,width:y.GridCellSize,zIndex:10}),this.container.addChild(this.sprite),this.parent.container.addChild(this.container),this.container.interactiveChildren=!0,this.parent.clickDetector.on("pointerenter",this.onParentCellEnter),this.parent.clickDetector.on("pointerleave",this.onParentCellLeave),y.GameMaster.currentScene.stage.addChild(this.graphics)}GetCreepsInRange(){return y.Grid.creeps.filter(i=>{const r=i.x,n=i.y,a=this.column*y.GridCellSize+y.GridCellSize/2,o=this.row*y.GridCellSize+y.GridCellSize/2,h=this.definition.stats.range*y.GridCellSize;return ru(a,o,r,n){i.deleteMe?(this.projectiles.splice(this.projectiles.indexOf(i),1),i=null):i.update(e)}),this.behaviour==ua.BasicTowerBehaviour){this.ticksUntilNextShot>0&&this.ticksUntilNextShot--;let i=this.GetCreepsInRange();if(i.length>0){let r=i[0];this.ticksUntilNextShot==0&&(this.ticksUntilNextShot=this.definition.stats.cooldown,this.Shoot(r))}}}destroy(){super.destroy(),this.parent.clickDetector.off("pointerenter",this.onParentCellEnter),this.parent.clickDetector.off("pointerleave",this.onParentCellLeave),this.graphics.destroy()}}var oi=(s=>(s.CellMouseOver="cellmouseover",s.CellMouseLeave="cellmouseleave",s))(oi||{});class au extends Ft{constructor(e,i,r,n){super();x(this,"type");x(this,"row");x(this,"column");x(this,"isPath",!1);x(this,"g");x(this,"hasTowerPlaced",!1);x(this,"clickDetector");this.type=e,this.row=i,this.column=r,this.isPath=n,this.bb.x=this.column*y.GridCellSize,this.bb.y=this.row*y.GridCellSize,this.bb.width=y.GridCellSize,this.bb.height=y.GridCellSize,y.Grid.container.addChild(this.container),this.container.x=this.bb.x,this.container.y=this.bb.y,this.clickDetector=new It({zIndex:99,interactive:!0}),this.g=new It({zIndex:5}),this.clickDetector.rect(0,0,this.bb.width,this.bb.height),this.clickDetector.fill({color:16711680,alpha:0}),this.container.addChild(this.clickDetector),this.container.addChild(this.g),this.clickDetector.on("pointerup",a=>{y.TowerManager.isPlacingTower?y.Grid.onGridCellClicked(i,r):this.OpenSelectedTowerPanel()}),this.clickDetector.on("pointerenter",a=>{y.GameScene.events.emit("cellmouseover",this)}),this.clickDetector.on("pointerleave",a=>{y.GameScene.events.emit("cellmouseleave",this),y.Grid.rangePreview.clear()}),y.GameScene.events.on(Fe.TowerPlacedEvent,(a,o,h)=>{o==this.row&&h==this.column&&(this.hasTowerPlaced=!0,y.Grid.rangePreview.clear())}),y.GameScene.events.on(Fe.TowerSoldEvent,(a,o,h)=>{o==this.row&&h==this.column&&(this.hasTowerPlaced=!1)})}showRangePreview(e,i){let r=16777215;e&&(r=16711680),y.Grid.rangePreview.clear(),y.Grid.rangePreview.circle(this.column*y.GridCellSize+y.GridCellSize/2,this.row*y.GridCellSize+y.GridCellSize/2,i*y.GridCellSize),y.Grid.rangePreview.fill({color:r,alpha:.3})}OpenSelectedTowerPanel(){this.hasTowerPlaced}checkIfCantPlace(){return this.hasTowerPlaced||this.isPath||this.type==At.Path||this.type==At.Restricted}gDraw(){this.g.rect(0,0,this.bb.width,this.bb.height),this.type==At.Restricted?this.g.fill({color:2236962,alpha:.5}):this.hasTowerPlaced?this.g.fill({color:16711680,alpha:.5}):this.type==At.Path?this.g.fill({color:2236962,alpha:.5}):this.type==At.Buildable&&this.g.stroke({color:65280,alpha:.9})}gClear(){this.g.clear()}update(){}}class ou extends Ft{constructor(e,i){super();x(this,"gameMap");x(this,"cells",[]);x(this,"rangePreview");x(this,"creeps",[]);x(this,"gridShown",!1);this.gameMap=e,y.Grid=this,this.bb.x=0,this.bb.y=0,this.bb.width=y.GridCellSize*y.GridColumns,this.bb.height=y.GridCellSize*y.GridRows,y.GameMaster.currentScene.stage.addChild(this.container);let r=new tt(z.MissionBackgrounds[i]);this.container.addChild(r);for(let n=0;nl.some(u=>u[0]===a&&u[1]===n));h&&(o=At.Path);let c=new au(o,a,n,h);this.cells.push(c)}this.rangePreview=new It({zIndex:10}),this.container.addChild(this.rangePreview)}toggleGrid(e){this.cells.forEach(i=>{if(e){e=="hide"?i.gClear():i.gDraw();return}this.gridShown?i.gClear():i.gDraw()}),e=="hide"?this.gridShown=!1:e=="show"?this.gridShown=!0:this.gridShown=!this.gridShown}addCreep(e){this.creeps.push(e),e.events.on(ie.Died,i=>{this.onCreepDiedOrEscaped(i)}),e.events.on(ie.Escaped,i=>{this.onCreepDiedOrEscaped(i)})}onCreepDiedOrEscaped(e){this.creeps.splice(this.creeps.indexOf(e),1),e.destroy()}update(e){this.creeps.forEach(i=>{i.dead?(this.creeps.splice(this.creeps.indexOf(i),1),i=null):i.update(e)})}getCellByRowAndCol(e,i){return this.cells.filter(r=>r.row==e&&r.column==i)[0]}onGridCellClicked(e,i){}}var Ce=(s=>(s.CreepSpawned="creepSpawned",s.Finished="finished",s.NewWave="newwave",s))(Ce||{});class hu extends Ft{constructor(e,i){super();x(this,"creeps",[]);x(this,"rounds");x(this,"paths");x(this,"ticks",0);x(this,"started",!1);x(this,"finished",!1);x(this,"internalCreepId",0);y.WaveManager=this,this.rounds=e,this.paths=i}start(e){this.started=!0,this.ticks=0,this.creeps=[],this.finished=!1;let i=0;this.rounds[e].waves.forEach(r=>{i+=r.firstCreepSpawnTick,r.creeps.forEach(n=>{const a=new tu(n,this.paths[0],this.internalCreepId);this.internalCreepId++;const o={creep:a,tickToSpawnAt:i,spawned:!1};console.log("CREAWTASEDASD"),i+=r.spawnIntervalTicks,this.creeps.push(o)})}),console.log(this.creeps)}end(){this.started=!1}update(e){this.started!=!1&&(this.ticks+=e,this.creeps.forEach(i=>{!i.spawned&&i.tickToSpawnAt<=this.ticks?(i.spawned=!0,this.events.emit("creepSpawned",i.creep),console.log("Wave manager creep spawned, ",i,this.ticks),!this.finished&&this.creeps.every(r=>r.spawned)&&(this.finished=!0,console.log("wave maanger finisehd"),this.events.emit("finished"))):i.spawned&&i.creep.update(e)}))}}class Er extends le{constructor(e,i,r,n,a,o,h,c){if(e>3||i>2||e<0||i<0)throw"Index/row out of bounds for TowerButton.";super(!0);x(this,"frameSprite");x(this,"background");x(this,"towerName");x(this,"iconSprite");x(this,"i",0);this.towerName=h,this.container.x=e*r+5,this.container.y=i*n+5,this.background=new tt({texture:o}),this.iconSprite=new tt({texture:c}),this.background.width=r,this.background.height=n,this.iconSprite.x=r/2,this.iconSprite.y=n/2,this.iconSprite.width=r/2,this.iconSprite.height=n/2,this.iconSprite.anchor.set(.5,.5),this.container.addChild(this.background),this.container.addChild(this.iconSprite),this.frameSprite=new he({texture:z.Frame02Texture,leftWidth:100,topHeight:100,rightWidth:100,bottomHeight:100,roundPixels:!0,height:n,width:r}),this.container.addChild(this.frameSprite),a.addChild(this.container),y.GameScene.events.on(Fe.TowerPlacedEvent,l=>{this.resetTint()}),this.container.onmousemove=l=>{y.TowerManager.isPlacingTower||this.ShowTooltip()},this.container.onpointerleave=l=>{y.GameScene.tooltip.Hide()}}ShowTooltip(){let e;z.Towers.forEach(i=>{i.name==this.towerName&&(e=i)}),y.GameScene.tooltip.SetContent(this.towerName,e.stats.damage,e.stats.cost,e.stats.gemSlotsAmount),y.GameScene.tooltip.Show(y.MouseX,y.MouseY)}onClick(e){y.TowerManager.isPlacingTower&&y.TowerManager.selectedTower.name!=this.towerName&&(y.GameScene.sidebar.towerTab.resetTint(),y.TowerManager.ResetChooseTower()),y.GameScene.tooltip.Hide(),this.frameSprite.tint==65280?(this.frameSprite.tint=16777215,this.ShowTooltip()):this.frameSprite.tint=65280,y.TowerManager.ToggleChoosingTowerLocation(this.towerName)}resetTint(){this.frameSprite.tint=16777215}}class lu extends le{constructor(e){super(!1);x(this,"bounds");x(this,"towerTabSprite");x(this,"towerButtons",[]);this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.towerTabSprite=new he({texture:z.FrameTowerTab,leftWidth:500,topHeight:500,rightWidth:500,bottomHeight:500,roundPixels:!0}),this.towerTabSprite.width=this.bounds.width,this.towerTabSprite.height=this.bounds.height,this.container.addChild(this.towerTabSprite),this.towerButtons.push(new Er(0,0,70,70,this.container,z.RedBackground,"Basic Tower",z.Towers[0].texture)),this.towerButtons.push(new Er(3,1,70,70,this.container,z.GreenBackground,"Circle Tower",z.Towers[1].texture))}resetTint(){this.towerButtons.forEach(e=>e.resetTint())}}class cu extends le{constructor(e){super(!1);x(this,"bounds");x(this,"gemTabSprite");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.gemTabSprite=new he({texture:z.FrameTowerTab,leftWidth:1e3,topHeight:1e3,rightWidth:1e3,bottomHeight:1e3}),this.gemTabSprite.x=0,this.gemTabSprite.y=0,this.gemTabSprite.width=this.bounds.width,this.gemTabSprite.height=this.bounds.height,this.container.addChild(this.gemTabSprite)}}class uu extends le{constructor(e){super(!1);x(this,"towerTab");x(this,"bounds");x(this,"sidebarSprite");x(this,"gemTab");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.sidebarSprite=new he({texture:z.Frame01Texture,leftWidth:100,topHeight:100,rightWidth:100,bottomHeight:100}),this.sidebarSprite.x=40,this.sidebarSprite.y=-40,this.sidebarSprite.width=this.bounds.width+40,this.sidebarSprite.height=this.bounds.height+80,this.container.addChild(this.sidebarSprite);const i=new D(60,20,this.bounds.width-65,150);this.towerTab=new lu(i),this.container.addChild(this.towerTab.container);const r=new D(60,180,this.bounds.width-65,this.bounds.height-280);this.gemTab=new cu(r),this.container.addChild(this.gemTab.container)}}class Si{constructor(){x(this,"stage",new it);x(this,"gui",[]);x(this,"_events",new ht);y.app.stage.addChild(this.stage)}destroy(){this.stage.destroy(),this.gui.forEach(t=>{t.destroy()})}get events(){return this._events}init(){}}class du extends Ft{constructor(e,i){super();x(this,"hp",100);x(this,"gold",0);x(this,"goldText");x(this,"healthText");x(this,"waveText");this.hp=e,this.gold=i,this.container.x=0,this.container.y=20,y.GameMaster.currentScene.stage.addChild(this.container),this.healthText=new ct({text:`${this.hp}`,style:new ot({fill:"red",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.goldText=new ct({text:`${this.gold}`,style:new ot({fill:"gold",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.waveText=new ct({text:`0/${y.GameScene.mission.rounds.length}`,style:new ot({fill:"dodgerblue",fontSize:36,fontWeight:"bold",dropShadow:!0})});const r=new tt(z.HealthTexture),n=new tt(z.GoldTexture),a=new tt(z.WaveTexture);this.healthText.x=200,this.healthText.y=-15,r.x=160,r.width=36,r.height=32,r.y=-10,this.goldText.x=200,this.goldText.y=20,n.x=150,n.width=56,n.height=56,n.y=15,this.waveText.x=200,this.waveText.y=55,a.x=155,a.width=46,a.height=32,a.y=65,this.container.addChild(this.healthText),this.container.addChild(this.goldText),this.container.addChild(this.waveText),this.container.addChild(r),this.container.addChild(n),this.container.addChild(a),y.GameScene.events.on(Ce.NewWave,o=>{this.waveText.text=`${o}/${y.GameScene.mission.rounds.length}`})}getHP(){return this.hp}hasEnoughGold(e){return e<=this.gold}setHP(e){this.hp=e,this.healthText.text=this.hp}takeDamage(e){this.hp-=e,this.healthText.text=this.hp}setGold(e){this.gold=e,this.goldText.text=this.gold}earnGold(e){this.gold+=e,this.goldText.text=this.gold}spendGold(e){this.gold-=e,this.goldText.text=this.gold}update(){}}const Kt=class Kt{static init(){Kt.SidebarRect=new D(y.app.canvas.width-360,0,360,y.app.canvas.height),Kt.ChangeRoundButtonRect=new D(50,y.app.canvas.height-100,310,100)}};x(Kt,"SidebarRect"),x(Kt,"ChangeRoundButtonRect");let Re=Kt;class fu extends le{constructor(e){super(!1);x(this,"bounds");x(this,"tooltipSprite");x(this,"titleText");x(this,"costText");x(this,"damageText");x(this,"gemAmount");x(this,"gemAmountSprite");this.bounds=e,this.container.x=-500,this.container.y=-500,this.tooltipSprite=new he({texture:z.Frame04Texture,leftWidth:200,topHeight:200,rightWidth:200,bottomHeight:200}),this.tooltipSprite.width=this.bounds.width,this.tooltipSprite.height=this.bounds.height,this.titleText=new ct({x:this.tooltipSprite.width/2,y:-20,zIndex:5,style:new ot({fill:16777215,stroke:{color:0,width:2}})}),this.titleText.anchor.set(.5,0);let i=new tt({x:this.tooltipSprite.width/2,y:-20,width:250,height:40,texture:z.TitleTexture});i.anchor.set(.5,0);const r=new tt({texture:z.GoldTexture,x:10,y:20,width:56,height:50});this.costText=new ct({x:54,y:26,zIndex:5,text:"Something went wrong if you see this.",style:{fill:"gold",fontWeight:"bold",stroke:{color:0,width:5}}}),this.damageText=new ct({x:54,y:65,zIndex:5,text:"Something went wrong if you see this.",style:{fill:"red",fontWeight:"bold",stroke:{color:0,width:5}}});const n=new tt({texture:z.SwordsTexture,x:22,y:70,width:32,height:32});this.gemAmountSprite=new tt({texture:z.GemAmountIcons[0],x:22,y:110,width:32,height:32}),this.gemAmount=new ct({x:54,y:108,zIndex:5,text:"Something went wrong if you see this.",style:{fill:"white",fontWeight:"bold",stroke:{color:0,width:5}}}),this.container.addChild(this.tooltipSprite),this.container.addChild(i),this.container.addChild(r),this.container.addChild(n),this.container.addChild(this.gemAmountSprite),this.container.addChild(this.costText),this.container.addChild(this.titleText),this.container.addChild(this.damageText),this.container.addChild(this.gemAmount),y.GameMaster.currentScene.stage.addChild(this.container)}SetContent(e,i,r,n){this.titleText.text=e,this.gemAmount.text=`Has ${n} Gem slots.`,this.gemAmountSprite.texture=z.GemAmountIcons[n],this.costText.text=`Costs ${r} gold.`,this.damageText.text=`Deals ${i} base damage.`}Show(e,i){this.container.alpha=1,e+this.container.width>y.app.canvas.width?this.container.x=e-this.container.width:this.container.x=e,this.container.y=i}Hide(){this.container.alpha=0,this.container.x=-500,this.container.y=-500}}class da extends Si{constructor(e){super();x(this,"isGameOver",!1);x(this,"mission");x(this,"missionIndex");x(this,"MissionStats");x(this,"roundMode");x(this,"ticker");x(this,"changeRoundButton");x(this,"sidebar");x(this,"tooltip");x(this,"currentRound",0);x(this,"isWaveManagerFinished",!1);x(this,"playerWon",!1);x(this,"destroyTicker",!1);y.GameScene=this,z.Missions.forEach((i,r)=>{i.name==e&&(this.mission=i,this.missionIndex=r)})}init(){this.ticker=new bt,this.ticker.maxFPS=60,this.ticker.minFPS=30,this.ticker.add(()=>{this.update&&this.update(this.ticker.elapsedMS)}),this.ticker.start(),new ou(this.mission.gameMap,this.missionIndex),new eu,new hu(this.mission.rounds,this.mission.gameMap.paths),y.Grid.onGridCellClicked=(e,i)=>{y.TowerManager.isPlacingTower&&y.TowerManager.PlayerClickOnGrid(e,i)},y.WaveManager.events.on(Ce.CreepSpawned,e=>{y.Grid.addCreep(e),e.events.on(ie.Escaped,()=>{this.onCreepEscaped(e)})}),y.WaveManager.events.on(Ce.Finished,()=>{this.isWaveManagerFinished=!0}),this.events.on(ie.Died,(e,i)=>{this.MissionStats.earnGold(e)}),this.sidebar=new uu(Re.SidebarRect),this.tooltip=new fu(new D(0,0,350,160)),this.changeRoundButton=new Ee(Re.ChangeRoundButtonRect,"",se.Button01,!0),this.changeRoundButton.container.removeFromParent(),this.sidebar.container.addChild(this.changeRoundButton.container),this.changeRoundButton.CustomButtonLogic=()=>{this.changeRoundButton.buttonIcon=new tt({texture:z.PlayIconTexture,x:this.changeRoundButton.container.width/2,y:this.changeRoundButton.container.height/2,scale:.2}),this.changeRoundButton.buttonIcon.anchor.set(.5,.5),this.changeRoundButton.container.addChild(this.changeRoundButton.buttonIcon)},this.changeRoundButton.CustomButtonLogic(),this.changeRoundButton.onClick=()=>{if(this.playerWon)return this.ReturnToMain();if(this.roundMode==1)return y.NotificationManager.Notify("Wave is already in progress.","warn");if(this.isGameOver)return y.NotificationManager.Notify("No more waves.","danger");this.setRoundMode(1),this.changeRoundButton.buttonIcon.texture=z.ExclamationIconTexture,this.events.emit(Ce.NewWave,`${this.currentRound+1}`)},this.MissionStats=new du(100,200)}update(e){if(this.isGameOver){this.destroyTicker&&(this.destroyTicker=!1,this.ticker.destroy());return}y.WaveManager.update(e),y.Grid.update(e),y.TowerManager.update(e),this.isWaveManagerFinished&&y.Grid.creeps.length==0&&(this.isWaveManagerFinished=!1,this.setRoundMode(0),this.changeRoundButton.buttonIcon.texture=z.PlayIconTexture,y.NotificationManager.Notify(`Round ${this.currentRound+1}/${this.mission.rounds.length} completed.`,"info"),this.currentRound==this.mission.rounds.length&&y.NotificationManager.Notify("Final round.","danger"),this.currentRound+1==this.mission.rounds.length?(y.NotificationManager.Notify("Mission victory!!","reward"),this.changeRoundButton.buttonIcon.texture=z.HomeIconTexture,this.playerWon=!0):this.currentRound++),this.MissionStats.getHP()<=0?(this.isGameOver=!0,this.ShowScoreScreen(!0)):this.playerWon&&(this.isGameOver=!0,this.ShowScoreScreen(!1))}ShowScoreScreen(e){console.log(e?"LOSE!":"WIN!")}onCreepEscaped(e){this.MissionStats.takeDamage(e.health)}setRoundMode(e){this.roundMode=e,this.roundMode==1?y.WaveManager.start(this.currentRound):y.WaveManager.end()}destroy(){super.destroy(),this.isGameOver=!0,this.destroyTicker=!0,y.GameScene=null}ReturnToMain(){this.destroy(),y.GameMaster.currentScene.stage.removeChildren(),y.GameMaster.changeScene(new fa)}onTowerPlaced(){}}class fa extends Si{init(){const t=new Ee(new D(0,0,300,60),"Back to main",se.Button01);t.onClick=e=>{y.GameMaster.changeScene(new pa)},z.Missions.forEach((e,i)=>{const r=new Ee(new D(y.app.canvas.width/2-150,y.app.canvas.height/5+i*80,300,60),e.name,se.Button01);r.onClick=n=>{y.GameMaster.changeScene(new da(e.name))}})}}class pa extends Si{init(){const t={caption:"New Game",rect:new D(y.app.canvas.width/2-150,y.app.canvas.height/5+240,300,60),texture:se.Button02},e={caption:"Settings",rect:new D(y.app.canvas.width/2-300/2,y.app.canvas.height/5+4*80,300,60),texture:se.Button02};let i=new ct({x:y.app.canvas.width/2-300/2,y:y.app.canvas.height/5+1*80,text:"BASTION",style:{fill:16755200,fontFamily:"Aclonica",fontSize:100}});i.x=i.x-i.width/5,y.GameMaster.currentScene.stage.addChild(i);let r=new ct({x:0,y:0,text:"Latest commit: "+y.latestCommit,style:{fill:0,fontSize:10,fontWeight:"bold"}});y.GameMaster.currentScene.stage.addChild(r);const n=new Ee(t.rect,t.caption,t.texture,!0);n.onClick=o=>{y.GameMaster.currentScene.stage.removeChild(i),y.GameMaster.currentScene.stage.removeChild(r),y.GameMaster.changeScene(new fa)};let a=new Ee(e.rect,e.caption,e.texture,!0);a.onClick=o=>{y.NotificationManager.Notify("Not finished.","info")}}}class pu{constructor(){x(this,"finished",!1);x(this,"calledBack",!1);x(this,"callbackFn")}Finish(){this.finished=!0}update(t){this.finished}}class gu extends pu{constructor(e,i,r,n){super();x(this,"fadeType");x(this,"fadeTime");x(this,"pixiObject");x(this,"ticks",0);this.fadeType=e,this.fadeTime=i,this.pixiObject=r,this.callbackFn=n,e=="in"?this.pixiObject.alpha=0:this.pixiObject.alpha=1}update(e){if(super.update(e),this.pixiObject==null)return this.Finish();this.ticks++,this.fadeType=="in"?this.pixiObject.alpha=this.ticks/this.fadeTime:this.pixiObject.alpha-=1/this.fadeTime,this.ticks>=this.fadeTime&&this.Finish()}}class mu{constructor(){x(this,"AnimationQueue",[])}Animate(t){this.AnimationQueue.push(t)}update(t){for(let e=this.AnimationQueue.length-1;e>=0;e--){const i=this.AnimationQueue[e];i.finished?(i.callbackFn(),this.AnimationQueue.splice(e,1)):i.update(t)}}}class xu{constructor(t,e,i,r,n){x(this,"textObj");x(this,"ticksToFadeAway");x(this,"animating",!1);x(this,"destroyed",!1);let a=16777215;e=="info"?a=2143228:e=="warn"?a=16570144:e=="danger"?a=16517642:e=="reward"&&(a=14047996),this.ticksToFadeAway=n,this.textObj=new ct({text:t,style:new ot({fill:a,fontSize:36,fontWeight:"bold",dropShadow:!0,align:"center"}),x:i,y:r,zIndex:100}),this.textObj.anchor.set(.5,.5),y.NotificationManager.container.addChild(this.textObj)}destroy(){this.textObj.destroy(),this.destroyed=!0}}class yu extends Ft{constructor(){super();x(this,"notifications",[]);x(this,"ticks",0);this.bb.x=y.app.canvas.width/2,this.bb.y=40,this.copyBBToContainer(),this.container.zIndex=100,y.app.stage.addChild(this.container)}Notify(e,i){let r=0,n=this.notifications.length*32;this.notifications.push(new xu(e,i,r,n,this.ticks+180))}update(e){this.ticks++;for(let i=this.notifications.length-1;i>=0;i--){const r=this.notifications[i];if(r.destroyed){this.notifications.splice(i,1);continue}this.ticks>=r.ticksToFadeAway&&!r.animating&&(r.animating=!0,y.AnimationManager.Animate(new gu("out",240,r.textObj,()=>{r.destroy()})))}}}(async()=>{const s=new Mn;y.app=s,await s.init({width:1920,height:1080,resolution:1,autoDensity:!0,backgroundColor:16777215,sharedTicker:!0}),document.body.appendChild(s.canvas);function t(){const i=window.innerWidth,r=window.innerHeight,n=i/s.screen.width,a=r/s.screen.height,o=Math.min(n,a),h=Math.round(s.screen.width*o),c=Math.round(s.screen.height*o),l=(i-h)/2,u=(r-c)/2;s.canvas.style.width=`${h}px`,s.canvas.style.height=`${c}px`,s.canvas.style.marginLeft=`${l}px`,s.canvas.style.marginTop=`${u}px`,s.canvas.style.marginRight="0",s.canvas.style.marginBottom="0",s.canvas.style.display="block"}y.latestCommit=await fetch("/latest_commit").then(i=>i.text()),window.addEventListener("resize",t),t(),await z.LoadAssets(),Re.init(),new Jc,y.AnimationManager=new mu,y.NotificationManager=new yu,globalThis.Engine=y,bt.shared.add(i=>{y.NotificationManager.update(i.elapsedMS),y.AnimationManager.update(i.elapsedMS)}),s.canvas.addEventListener("pointermove",function(i){y.MouseX=(i.clientX-s.canvas.offsetLeft)/s.canvas.offsetWidth*1920,y.MouseY=(i.clientY-s.canvas.offsetTop)/s.canvas.offsetHeight*1080}),y.GameMaster.changeScene(new pa),new URLSearchParams(location.href).entries().next().value[1]=="game"&&y.GameMaster.changeScene(new da("Mission 1")),y.latestCommit!="DEVELOPMENT"&&(window.onbeforeunload=()=>"You are about to leave.")})();export{W as $,Sn as A,K as B,it as C,j as D,P as E,Nr as F,as as G,wt as H,Ni as I,tt as J,Bo as K,Oo as L,U as M,J as N,D as O,rt as P,ih as Q,Xs as R,Sh as S,Mt as T,es as U,Vi as V,ho as W,ws as X,Z as Y,Vr as Z,An as _,G as a,O as a0,hh as a1,Gn as a2,Xh as a3,qh as a4,tl as a5,sl as a6,il as a7,te as a8,ot as a9,Xl as aa,ni as ab,Dn as ac,er as ad,Xt as ae,qc as af,Cr as ag,Jl as ah,It as ai,V as aj,La as ak,ri as al,Sr as am,Nn as an,bt as b,ht as c,Bt as d,nt as e,tr as f,bh as g,Ze as h,ui as i,bn as j,en as k,mn as l,vr as m,Ii as n,Yh as o,jh as p,Qh as q,ja as r,Bn as s,el as t,di as u,dn as v,Q as w,Ga as x,nl as y,Ct as z}; diff --git a/assets/webworkerAll-C2VXGd2x.js b/assets/webworkerAll-BX7Du1kd.js similarity index 99% rename from assets/webworkerAll-C2VXGd2x.js rename to assets/webworkerAll-BX7Du1kd.js index 239579a..29daa5c 100644 --- a/assets/webworkerAll-C2VXGd2x.js +++ b/assets/webworkerAll-BX7Du1kd.js @@ -1,4 +1,4 @@ -import{E as h,U as Xe,b as se,a8 as L,M as R,a2 as Ne,l as D,h as me,w as O,a as k,P as Qe,R as q,H as xe,Y as G,a9 as Y,aa as Je,ab as P,z as b,ac as Ze,ad as _e,ae as et,u as be,o as Te,a3 as ye,t as Se,a6 as ve,af as we,s as tt,p as rt,q as st,a4 as at,a5 as nt,a7 as it,ag as ot,ah as dt,ai as lt,aj as j,ak as K,D as Be,m as A,O as ae,$ as ut,al as ct,am as ne,n as ie,e as S,an as ht}from"./index-C__ClTeD.js";import{T as w,S as Ce,c as X,a as ft,b as pt,B as Re}from"./colorToUniform-Bd32TehW.js";class Me{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;t=s,r=n}this.renderer.resize(t,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Me.extension=h.Application;class Pe{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Xe.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?se.shared:new se,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Pe.extension=h.Application;class Ue{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}Ue.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"filter"};const gt=new R;function mt(a,e){return e.clear(),ke(a,e),e.isValid||e.set(0,0,0,0),a.renderGroup?e.applyMatrix(a.renderGroup.localTransform):e.applyMatrix(a.parentRenderGroup.worldTransform),e}function ke(a,e){if(a.localDisplayStatus!==7||!a.measurable)return;const t=!!a.effects.length;let r=e;if((a.renderGroup||t)&&(r=L.get().clear()),a.boundsArea)e.addRect(a.boundsArea,a.worldTransform);else{if(a.renderPipeId){const n=a.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,a.groupTransform)}const s=a.children;for(let n=0;n"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new me({}),this.renderer=e}get activeBackTexture(){var e;return(e=this._activeFilterData)==null?void 0:e.backTexture}push(e){var f;const t=this.renderer,r=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}const n=s.bounds;e.renderables?xt(e.renderables,n):e.filterEffect.filterArea?(n.clear(),n.addRect(e.filterEffect.filterArea),n.applyMatrix(e.container.worldTransform)):mt(e.container,n);const i=t.renderTarget.renderTarget.colorTexture.source;let o=1/0,d=0,l=!0,u=!1,c=!1;for(let m=0;m0?this._filterStack[this._filterStackIndex-1].bounds:null,d=e.renderTarget.getRenderTarget(t.previousRenderSurface);n=this.getBackTexture(d,s,o)}t.backTexture=n;const i=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),e.globalUniforms.pop(),i.length===1)i[0].apply(this,r,t.previousRenderSurface,!1),w.returnTexture(r);else{let o=t.inputTexture,d=w.getOptimalTexture(s.width,s.height,o.source._resolution,!1),l=0;for(l=0;l0&&this._filterStack[g].skip;)--g;g>0&&(c=this._filterStack[g].inputTexture.source._resolution);const f=this._filterGlobalUniforms,m=f.uniforms,p=m.uOutputFrame,_=m.uInputSize,x=m.uInputPixel,B=m.uInputClamp,T=m.uGlobalFrame,C=m.uOutputTexture;if(u){let M=this._filterStackIndex;for(;M>0;){M--;const v=this._filterStack[this._filterStackIndex-1];if(!v.skip){d.x=v.bounds.minX,d.y=v.bounds.minY;break}}p[0]=o.minX-d.x,p[1]=o.minY-d.y}else p[0]=0,p[1]=0;p[2]=t.frame.width,p[3]=t.frame.height,_[0]=t.source.width,_[1]=t.source.height,_[2]=1/_[0],_[3]=1/_[1],x[0]=t.source.pixelWidth,x[1]=t.source.pixelHeight,x[2]=1/x[0],x[3]=1/x[1],B[0]=.5*x[2],B[1]=.5*x[3],B[2]=t.frame.width*_[2]-.5*x[2],B[3]=t.frame.height*_[3]-.5*x[3];const F=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=d.x*c,T[1]=d.y*c,T[2]=F.source.width*c,T[3]=F.source.height*c;const U=this.renderer.renderTarget.getRenderTarget(r);if(n.renderTarget.bind(r,!!s),r instanceof k?(C[0]=r.frame.width,C[1]=r.frame.height):(C[0]=U.width,C[1]=U.height),C[2]=U.isRoot?-1:1,f.update(),n.renderPipes.uniformBatch){const M=n.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(M,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:_t,shader:e,state:e._state,topology:"triangle-list"}),n.type===q.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new xe,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){const r=this._activeFilterData,s=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=t.worldTransform.copyTo(R.shared);return n.invert(),s.prepend(n),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}}Ge.extension={type:[h.WebGLSystem,h.WebGPUSystem],name:"filter"};function bt(a){const e=a._stroke,t=a._fill,s=[`div { ${[`color: ${G.shared.setValue(t.color).toHex()}`,`font-size: ${a.fontSize}px`,`font-family: ${a.fontFamily}`,`font-weight: ${a.fontWeight}`,`font-style: ${a.fontStyle}`,`font-variant: ${a.fontVariant}`,`letter-spacing: ${a.letterSpacing}px`,`text-align: ${a.align}`,`padding: ${a.padding}px`,`white-space: ${a.whiteSpace==="pre"&&a.wordWrap?"pre-wrap":a.whiteSpace}`,...a.lineHeight?[`line-height: ${a.lineHeight}px`]:[],...a.wordWrap?[`word-wrap: ${a.breakWords?"break-all":"break-word"}`,`max-width: ${a.wordWrapWidth}px`]:[],...e?[Ae(e)]:[],...a.dropShadow?[Fe(a.dropShadow)]:[],...a.cssOverrides].join(";")} }`];return Tt(a.tagStyles,s),s.join(" ")}function Fe(a){const e=G.shared.setValue(a.color).setAlpha(a.alpha).toHexa(),t=Math.round(Math.cos(a.angle)*a.distance),r=Math.round(Math.sin(a.angle)*a.distance),s=`${t}px ${r}px`;return a.blur>0?`text-shadow: ${s} ${a.blur}px ${e}`:`text-shadow: ${s} ${e}`}function Ae(a){return[`-webkit-text-stroke-width: ${a.width}px`,`-webkit-text-stroke-color: ${G.shared.setValue(a.color).toHex()}`,`text-stroke-width: ${a.width}px`,`text-stroke-color: ${G.shared.setValue(a.color).toHex()}`,"paint-order: stroke"].join(";")}const oe={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},de={fill:a=>`color: ${G.shared.setValue(a).toHex()}`,breakWords:a=>`word-wrap: ${a?"break-all":"break-word"}`,stroke:Ae,dropShadow:Fe};function Tt(a,e){for(const t in a){const r=a[t],s=[];for(const n in r)de[n]?s.push(de[n](r[n])):oe[n]&&s.push(oe[n].replace("{{VALUE}}",r[n]));e.push(`${t} { ${s.join(";")} }`)}}class N extends Y{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Je(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new N({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=bt(this)),this._cssStyle}addOverride(...e){const t=e.filter(r=>!this.cssOverrides.includes(r));t.length>0&&(this.cssOverrides.push(...t),this.update())}removeOverride(...e){const t=e.filter(r=>this.cssOverrides.includes(r));t.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!t.includes(r)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}const le="http://www.w3.org/2000/svg",ue="http://www.w3.org/1999/xhtml";class De{constructor(){this.svgRoot=document.createElementNS(le,"svg"),this.foreignObject=document.createElementNS(le,"foreignObject"),this.domElement=document.createElementNS(ue,"div"),this.styleElement=document.createElementNS(ue,"style"),this.image=new Image;const{foreignObject:e,svgRoot:t,styleElement:r,domElement:s}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(r),e.appendChild(s)}}let ce;function yt(a,e,t,r){r=r||ce||(ce=new De);const{domElement:s,styleElement:n,svgRoot:i}=r;s.innerHTML=`
${a}
`,s.setAttribute("style","transform-origin: top left; display: inline-block"),t&&(n.textContent=t),document.body.appendChild(i);const o=s.getBoundingClientRect();i.remove();const d=P.measureFont(e.fontStyle).descent,l=e.padding*2;return{width:o.width-l,height:o.height+d-l}}class ze{constructor(e,t){this.state=Ce.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){const t=e.context,r=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(e,t){const r=this.renderer.graphicsContext.updateGpuContext(e.context);e._didGraphicsUpdate&&(e._didGraphicsUpdate=!1,this._rebuild(e)),r.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){const t=this._graphicsBatchesHash[e.uid];if(t)for(let r=0;r{const o=b.get(Ze);return i.copyTo(o),o.renderable=e,o.roundPixels=s,o});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=n,n}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{b.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}}ze.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"graphics"};class Q{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),r=t.data;let s=r;const n=this.texture.textureMatrix;return n.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==n._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new me({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){const t=this._getMeshData(e),r=t.batched,s=e.batched;if(t.batched=s,r!==s)return!0;if(s){const n=e._geometry;if(n.indices.length!==t.indexSize||n.positions.length!==t.vertexSize)return t.indexSize=n.indices.length,t.vertexSize=n.positions.length,!0;const i=this._getBatchableMesh(e),o=e.texture;if(i.texture._source!==o._source&&i.texture._source!==o._source)return!i._batcher.checkAndUpdateTexture(i,o)}return!1}addRenderable(e,t){const r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){const n=this._getBatchableMesh(e);n.texture=e._texture,n.geometry=e._geometry,r.addToBatch(n,t)}else r.break(t),t.add(e)}updateRenderable(e){if(e.batched){const t=this._gpuBatchableMeshHash[e.uid];t.texture=e._texture,t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;const t=this._gpuBatchableMeshHash[e.uid];t&&(b.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=_e(e.groupBlendMode,e.texture._source);const t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),X(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){var t,r;return this._meshDataHash[e.uid]={batched:e.batched,indexSize:(t=e._geometry.indices)==null?void 0:t.length,vertexSize:(r=e._geometry.positions)==null?void 0:r.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){const t=b.get(Q);return t.renderable=e,t.texture=e._texture,t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(const e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&b.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}He.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"mesh"};class Oe{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=e._texture,r=this._getGpuSprite(e);return r.texture._source!==t._source?!r._batcher.checkAndUpdateTexture(r,t):!1}destroyRenderable(e){const t=this._gpuSpriteHash[e.uid];b.return(t.geometry),b.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.geometry.update(e),t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=b.get(Q);return t.geometry=b.get(et),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._didSpriteUpdate=!0,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(const e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}}Oe.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"nineSliceSprite"};const St={name:"tiling-bit",vertex:{header:` +import{E as h,U as Xe,b as se,a8 as L,M as R,a2 as Ne,l as D,h as me,w as O,a as k,P as Qe,R as q,H as xe,Y as G,a9 as Y,aa as Je,ab as P,z as b,ac as Ze,ad as _e,ae as et,u as be,o as Te,a3 as ye,t as Se,a6 as ve,af as we,s as tt,p as rt,q as st,a4 as at,a5 as nt,a7 as it,ag as ot,ah as dt,ai as lt,aj as j,ak as K,D as Be,m as A,O as ae,$ as ut,al as ct,am as ne,n as ie,e as S,an as ht}from"./index-D98sUruZ.js";import{T as w,S as Ce,c as X,a as ft,b as pt,B as Re}from"./colorToUniform-BUxjB9ZS.js";class Me{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let t,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;t=s,r=n}this.renderer.resize(t,r),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Me.extension=h.Application;class Pe{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(t){this._ticker&&this._ticker.remove(this.render,this),this._ticker=t,t&&t.add(this.render,this,Xe.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?se.shared:new se,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}Pe.extension=h.Application;class Ue{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}Ue.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"filter"};const gt=new R;function mt(a,e){return e.clear(),ke(a,e),e.isValid||e.set(0,0,0,0),a.renderGroup?e.applyMatrix(a.renderGroup.localTransform):e.applyMatrix(a.parentRenderGroup.worldTransform),e}function ke(a,e){if(a.localDisplayStatus!==7||!a.measurable)return;const t=!!a.effects.length;let r=e;if((a.renderGroup||t)&&(r=L.get().clear()),a.boundsArea)e.addRect(a.boundsArea,a.worldTransform);else{if(a.renderPipeId){const n=a.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,a.groupTransform)}const s=a.children;for(let n=0;n"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new me({}),this.renderer=e}get activeBackTexture(){var e;return(e=this._activeFilterData)==null?void 0:e.backTexture}push(e){var f;const t=this.renderer,r=e.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}const n=s.bounds;e.renderables?xt(e.renderables,n):e.filterEffect.filterArea?(n.clear(),n.addRect(e.filterEffect.filterArea),n.applyMatrix(e.container.worldTransform)):mt(e.container,n);const i=t.renderTarget.renderTarget.colorTexture.source;let o=1/0,d=0,l=!0,u=!1,c=!1;for(let m=0;m0?this._filterStack[this._filterStackIndex-1].bounds:null,d=e.renderTarget.getRenderTarget(t.previousRenderSurface);n=this.getBackTexture(d,s,o)}t.backTexture=n;const i=t.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),e.globalUniforms.pop(),i.length===1)i[0].apply(this,r,t.previousRenderSurface,!1),w.returnTexture(r);else{let o=t.inputTexture,d=w.getOptimalTexture(s.width,s.height,o.source._resolution,!1),l=0;for(l=0;l0&&this._filterStack[g].skip;)--g;g>0&&(c=this._filterStack[g].inputTexture.source._resolution);const f=this._filterGlobalUniforms,m=f.uniforms,p=m.uOutputFrame,_=m.uInputSize,x=m.uInputPixel,B=m.uInputClamp,T=m.uGlobalFrame,C=m.uOutputTexture;if(u){let M=this._filterStackIndex;for(;M>0;){M--;const v=this._filterStack[this._filterStackIndex-1];if(!v.skip){d.x=v.bounds.minX,d.y=v.bounds.minY;break}}p[0]=o.minX-d.x,p[1]=o.minY-d.y}else p[0]=0,p[1]=0;p[2]=t.frame.width,p[3]=t.frame.height,_[0]=t.source.width,_[1]=t.source.height,_[2]=1/_[0],_[3]=1/_[1],x[0]=t.source.pixelWidth,x[1]=t.source.pixelHeight,x[2]=1/x[0],x[3]=1/x[1],B[0]=.5*x[2],B[1]=.5*x[3],B[2]=t.frame.width*_[2]-.5*x[2],B[3]=t.frame.height*_[3]-.5*x[3];const F=this.renderer.renderTarget.rootRenderTarget.colorTexture;T[0]=d.x*c,T[1]=d.y*c,T[2]=F.source.width*c,T[3]=F.source.height*c;const U=this.renderer.renderTarget.getRenderTarget(r);if(n.renderTarget.bind(r,!!s),r instanceof k?(C[0]=r.frame.width,C[1]=r.frame.height):(C[0]=U.width,C[1]=U.height),C[2]=U.isRoot?-1:1,f.update(),n.renderPipes.uniformBatch){const M=n.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(M,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:_t,shader:e,state:e._state,topology:"triangle-list"}),n.type===q.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new xe,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(e,t){const r=this._activeFilterData,s=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=t.worldTransform.copyTo(R.shared);return n.invert(),s.prepend(n),s.scale(1/t.texture.frame.width,1/t.texture.frame.height),s.translate(t.anchor.x,t.anchor.y),s}}Ge.extension={type:[h.WebGLSystem,h.WebGPUSystem],name:"filter"};function bt(a){const e=a._stroke,t=a._fill,s=[`div { ${[`color: ${G.shared.setValue(t.color).toHex()}`,`font-size: ${a.fontSize}px`,`font-family: ${a.fontFamily}`,`font-weight: ${a.fontWeight}`,`font-style: ${a.fontStyle}`,`font-variant: ${a.fontVariant}`,`letter-spacing: ${a.letterSpacing}px`,`text-align: ${a.align}`,`padding: ${a.padding}px`,`white-space: ${a.whiteSpace==="pre"&&a.wordWrap?"pre-wrap":a.whiteSpace}`,...a.lineHeight?[`line-height: ${a.lineHeight}px`]:[],...a.wordWrap?[`word-wrap: ${a.breakWords?"break-all":"break-word"}`,`max-width: ${a.wordWrapWidth}px`]:[],...e?[Ae(e)]:[],...a.dropShadow?[Fe(a.dropShadow)]:[],...a.cssOverrides].join(";")} }`];return Tt(a.tagStyles,s),s.join(" ")}function Fe(a){const e=G.shared.setValue(a.color).setAlpha(a.alpha).toHexa(),t=Math.round(Math.cos(a.angle)*a.distance),r=Math.round(Math.sin(a.angle)*a.distance),s=`${t}px ${r}px`;return a.blur>0?`text-shadow: ${s} ${a.blur}px ${e}`:`text-shadow: ${s} ${e}`}function Ae(a){return[`-webkit-text-stroke-width: ${a.width}px`,`-webkit-text-stroke-color: ${G.shared.setValue(a.color).toHex()}`,`text-stroke-width: ${a.width}px`,`text-stroke-color: ${G.shared.setValue(a.color).toHex()}`,"paint-order: stroke"].join(";")}const oe={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},de={fill:a=>`color: ${G.shared.setValue(a).toHex()}`,breakWords:a=>`word-wrap: ${a?"break-all":"break-word"}`,stroke:Ae,dropShadow:Fe};function Tt(a,e){for(const t in a){const r=a[t],s=[];for(const n in r)de[n]?s.push(de[n](r[n])):oe[n]&&s.push(oe[n].replace("{{VALUE}}",r[n]));e.push(`${t} { ${s.join(";")} }`)}}class N extends Y{constructor(e={}){super(e),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=e.cssOverrides),this.tagStyles=e.tagStyles??{}}set cssOverrides(e){this._cssOverrides=e instanceof Array?e:[e],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Je(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new N({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...this.dropShadow}:null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=bt(this)),this._cssStyle}addOverride(...e){const t=e.filter(r=>!this.cssOverrides.includes(r));t.length>0&&(this.cssOverrides.push(...t),this.update())}removeOverride(...e){const t=e.filter(r=>this.cssOverrides.includes(r));t.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!t.includes(r)),this.update())}set fill(e){typeof e!="string"&&typeof e!="number"&&O("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=e}set stroke(e){e&&typeof e!="string"&&typeof e!="number"&&O("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=e}}const le="http://www.w3.org/2000/svg",ue="http://www.w3.org/1999/xhtml";class De{constructor(){this.svgRoot=document.createElementNS(le,"svg"),this.foreignObject=document.createElementNS(le,"foreignObject"),this.domElement=document.createElementNS(ue,"div"),this.styleElement=document.createElementNS(ue,"style"),this.image=new Image;const{foreignObject:e,svgRoot:t,styleElement:r,domElement:s}=this;e.setAttribute("width","10000"),e.setAttribute("height","10000"),e.style.overflow="hidden",t.appendChild(e),e.appendChild(r),e.appendChild(s)}}let ce;function yt(a,e,t,r){r=r||ce||(ce=new De);const{domElement:s,styleElement:n,svgRoot:i}=r;s.innerHTML=`
${a}
`,s.setAttribute("style","transform-origin: top left; display: inline-block"),t&&(n.textContent=t),document.body.appendChild(i);const o=s.getBoundingClientRect();i.remove();const d=P.measureFont(e.fontStyle).descent,l=e.padding*2;return{width:o.width-l,height:o.height+d-l}}class ze{constructor(e,t){this.state=Ce.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){const t=e.context,r=!!this._graphicsBatchesHash[e.uid],s=this.renderer.graphicsContext.updateGpuContext(t);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(e,t){const r=this.renderer.graphicsContext.updateGpuContext(e.context);e._didGraphicsUpdate&&(e._didGraphicsUpdate=!1,this._rebuild(e)),r.isBatchable?this._addToBatcher(e,t):(this.renderer.renderPipes.batch.break(t),t.add(e))}updateRenderable(e){const t=this._graphicsBatchesHash[e.uid];if(t)for(let r=0;r{const o=b.get(Ze);return i.copyTo(o),o.renderable=e,o.roundPixels=s,o});return this._graphicsBatchesHash[e.uid]===void 0&&e.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[e.uid]=n,n}_removeBatchForRenderable(e){this._graphicsBatchesHash[e].forEach(t=>{b.return(t)}),this._graphicsBatchesHash[e]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const e in this._graphicsBatchesHash)this._removeBatchForRenderable(e);this._graphicsBatchesHash=null}}ze.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"graphics"};class Q{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),r=t.data;let s=r;const n=this.texture.textureMatrix;return n.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==n._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new me({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=e,this._adaptor=t,this._adaptor.init()}validateRenderable(e){const t=this._getMeshData(e),r=t.batched,s=e.batched;if(t.batched=s,r!==s)return!0;if(s){const n=e._geometry;if(n.indices.length!==t.indexSize||n.positions.length!==t.vertexSize)return t.indexSize=n.indices.length,t.vertexSize=n.positions.length,!0;const i=this._getBatchableMesh(e),o=e.texture;if(i.texture._source!==o._source&&i.texture._source!==o._source)return!i._batcher.checkAndUpdateTexture(i,o)}return!1}addRenderable(e,t){const r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(e);if(s){const n=this._getBatchableMesh(e);n.texture=e._texture,n.geometry=e._geometry,r.addToBatch(n,t)}else r.break(t),t.add(e)}updateRenderable(e){if(e.batched){const t=this._gpuBatchableMeshHash[e.uid];t.texture=e._texture,t.geometry=e._geometry,t._batcher.updateElement(t)}}destroyRenderable(e){this._meshDataHash[e.uid]=null;const t=this._gpuBatchableMeshHash[e.uid];t&&(b.return(t),this._gpuBatchableMeshHash[e.uid]=null),e.off("destroyed",this._destroyRenderableBound)}execute(e){if(!e.isRenderable)return;e.state.blendMode=_e(e.groupBlendMode,e.texture._source);const t=this.localUniforms;t.uniforms.uTransformMatrix=e.groupTransform,t.uniforms.uRound=this.renderer._roundPixels|e._roundPixels,t.update(),X(e.groupColorAlpha,t.uniforms.uColor,0),this._adaptor.execute(this,e)}_getMeshData(e){return this._meshDataHash[e.uid]||this._initMeshData(e)}_initMeshData(e){var t,r;return this._meshDataHash[e.uid]={batched:e.batched,indexSize:(t=e._geometry.indices)==null?void 0:t.length,vertexSize:(r=e._geometry.positions)==null?void 0:r.length},e.on("destroyed",this._destroyRenderableBound),this._meshDataHash[e.uid]}_getBatchableMesh(e){return this._gpuBatchableMeshHash[e.uid]||this._initBatchableMesh(e)}_initBatchableMesh(e){const t=b.get(Q);return t.renderable=e,t.texture=e._texture,t.transform=e.groupTransform,t.roundPixels=this.renderer._roundPixels|e._roundPixels,this._gpuBatchableMeshHash[e.uid]=t,t}destroy(){for(const e in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[e]&&b.return(this._gpuBatchableMeshHash[e]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}He.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"mesh"};class Oe{constructor(e){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e._didSpriteUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._gpuSpriteHash[e.uid];e._didSpriteUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=e._texture,r=this._getGpuSprite(e);return r.texture._source!==t._source?!r._batcher.checkAndUpdateTexture(r,t):!1}destroyRenderable(e){const t=this._gpuSpriteHash[e.uid];b.return(t.geometry),b.return(t),this._gpuSpriteHash[e.uid]=null,e.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(e,t){e._didSpriteUpdate=!1,t.geometry.update(e),t.texture=e._texture}_getGpuSprite(e){return this._gpuSpriteHash[e.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=b.get(Q);return t.geometry=b.get(et),t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._didSpriteUpdate=!0,this._gpuSpriteHash[e.uid]=t,e.on("destroyed",this._destroyRenderableBound),t}destroy(){for(const e in this._gpuSpriteHash)this._gpuSpriteHash[e].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}}Oe.extension={type:[h.WebGLPipes,h.WebGPUPipes,h.CanvasPipes],name:"nineSliceSprite"};const St={name:"tiling-bit",vertex:{header:` struct TilingUniforms { uMapCoord:mat3x3, uClampFrame:vec4, diff --git a/index.html b/index.html index b6110dd..d7f15ff 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Bastion App - + diff --git a/latest_commit b/latest_commit index 972fb15..1f82b4f 100644 --- a/latest_commit +++ b/latest_commit @@ -1 +1 @@ -55214a6 +132554f