diff --git a/assets/SharedSystems-BZvPvoHn.js b/assets/SharedSystems-BCwg_xS7.js similarity index 99% rename from assets/SharedSystems-BZvPvoHn.js rename to assets/SharedSystems-BCwg_xS7.js index 178ea20..e9258f8 100644 --- a/assets/SharedSystems-BZvPvoHn.js +++ b/assets/SharedSystems-BCwg_xS7.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-DCiuXFKt.js";import{S as fe,T as J,B as tt,c as rt}from"./colorToUniform-D10pSRDt.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-B1SCbk2d.js";import{S as fe,T as J,B as tt,c as rt}from"./colorToUniform-CKxzcxfm.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-D23UtjUh.js b/assets/WebGLRenderer-CgvwxZyT.js similarity index 99% rename from assets/WebGLRenderer-D23UtjUh.js rename to assets/WebGLRenderer-CgvwxZyT.js index b688f8c..9defd16 100644 --- a/assets/WebGLRenderer-D23UtjUh.js +++ b/assets/WebGLRenderer-CgvwxZyT.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-DCiuXFKt.js";import{S as O,b as Q}from"./colorToUniform-D10pSRDt.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-BZvPvoHn.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-B1SCbk2d.js";import{S as O,b as Q}from"./colorToUniform-CKxzcxfm.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-BCwg_xS7.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-Nv8CN4Mg.js b/assets/WebGPURenderer-DpCsLNL1.js similarity index 99% rename from assets/WebGPURenderer-Nv8CN4Mg.js rename to assets/WebGPURenderer-DpCsLNL1.js index f1502f9..639ef8b 100644 --- a/assets/WebGPURenderer-Nv8CN4Mg.js +++ b/assets/WebGPURenderer-DpCsLNL1.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-DCiuXFKt.js";import{S as F,l as fe,a as ge}from"./colorToUniform-D10pSRDt.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-BZvPvoHn.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-B1SCbk2d.js";import{S as F,l as fe,a as ge}from"./colorToUniform-CKxzcxfm.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-BCwg_xS7.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-B_T68w5P.js b/assets/browserAll-DRg_dn_g.js similarity index 99% rename from assets/browserAll-B_T68w5P.js rename to assets/browserAll-DRg_dn_g.js index 6a6294f..b6ed9d8 100644 --- a/assets/browserAll-B_T68w5P.js +++ b/assets/browserAll-DRg_dn_g.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-DCiuXFKt.js";import"./webworkerAll-N0VuFc6l.js";import"./colorToUniform-D10pSRDt.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-B1SCbk2d.js";import"./webworkerAll-Bqlno1eH.js";import"./colorToUniform-CKxzcxfm.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-D10pSRDt.js b/assets/colorToUniform-CKxzcxfm.js similarity index 98% rename from assets/colorToUniform-D10pSRDt.js rename to assets/colorToUniform-CKxzcxfm.js index b0a379e..c5b8163 100644 --- a/assets/colorToUniform-D10pSRDt.js +++ b/assets/colorToUniform-CKxzcxfm.js @@ -1,4 +1,4 @@ -import{T as _,a as M,n as g}from"./index-DCiuXFKt.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/index-DCiuXFKt.js b/assets/index-B1SCbk2d.js similarity index 89% rename from assets/index-DCiuXFKt.js rename to assets/index-B1SCbk2d.js index de842e6..01205b1 100644 --- a/assets/index-DCiuXFKt.js +++ b/assets/index-B1SCbk2d.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-B_T68w5P.js","assets/webworkerAll-N0VuFc6l.js","assets/colorToUniform-D10pSRDt.js","assets/WebGPURenderer-Nv8CN4Mg.js","assets/SharedSystems-BZvPvoHn.js","assets/WebGLRenderer-D23UtjUh.js"])))=>i.map(i=>d[i]); -var xa=Object.defineProperty;var ya=(s,t,e)=>t in s?xa(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var b=(s,t,e)=>ya(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 _a="modulepreload",ba=function(s){return"/"+s},Pi={},Qe=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=ba(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":_a,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},ze=(s,t)=>Os(s).priority??t,rt={_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)=>ze(a.value,e)-ze(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)=>ze(n,e)-ze(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}},wa={extension:{type:P.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Qe(()=>import("./browserAll-B_T68w5P.js"),__vite__mapDeps([0,1,2]))}},va={extension:{type:P.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Qe(()=>import("./webworkerAll-N0VuFc6l.js"),__vite__mapDeps([1,2]))}};class nt{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new nt(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 ai(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ir={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);dzt[s],uY:s=>Ot[s],vX:s=>Wt[s],vY:s=>Ut[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Ws[s][t],sub:(s,t)=>Ws[s][N.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?N.S:N.N:Math.abs(t)*2<=Math.abs(s)?s>0?N.E:N.W:t>0?s>0?N.SE:N.SW:s>0?N.NE:N.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=Fr[N.inv(t)];r.tx=e,r.ty=i,s.append(r)}},We=[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=We[0].set(t.left,t.top),h=We[1].set(t.left,t.bottom),c=We[2].set(t.right,t.top),l=We[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,x=d*r+f*a;if(Math.max(p,m,g,x)<=d*o.x+f*o.y||Math.min(p,m,g,x)>=d*l.x+f*l.y)return!1;const y=u*(o.y-c.y),_=u*(c.x-o.x),v=y*i+_*n,C=y*r+_*n,I=y*i+_*a,M=y*r+_*a;return!(Math.max(v,C,I,M)<=y*o.x+_*o.y||Math.min(v,C,I,M)>=y*l.x+_*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 ds={default:-1};function J(s="default"){return ds[s]===void 0&&(ds[s]=-1),++ds[s]}const ki={},z="8.0.0",Ba="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-DRg_dn_g.js","assets/webworkerAll-Bqlno1eH.js","assets/colorToUniform-CKxzcxfm.js","assets/WebGPURenderer-DpCsLNL1.js","assets/SharedSystems-BCwg_xS7.js","assets/WebGLRenderer-CgvwxZyT.js"])))=>i.map(i=>d[i]); +var xa=Object.defineProperty;var ya=(s,t,e)=>t in s?xa(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var b=(s,t,e)=>ya(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 _a="modulepreload",ba=function(s){return"/"+s},Pi={},Qe=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=ba(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":_a,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},ze=(s,t)=>Os(s).priority??t,rt={_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)=>ze(a.value,e)-ze(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)=>ze(n,e)-ze(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})}},wa={extension:{type:P.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Qe(()=>import("./browserAll-DRg_dn_g.js"),__vite__mapDeps([0,1,2]))}},va={extension:{type:P.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Qe(()=>import("./webworkerAll-Bqlno1eH.js"),__vite__mapDeps([1,2]))}};class nt{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new nt(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 ai(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ir={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);dzt[s],uY:s=>Ot[s],vX:s=>Wt[s],vY:s=>Ut[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Ws[s][t],sub:(s,t)=>Ws[s][N.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?N.S:N.N:Math.abs(t)*2<=Math.abs(s)?s>0?N.E:N.W:t>0?s>0?N.SE:N.SW:s>0?N.NE:N.NW,matrixAppendRotationInv:(s,t,e=0,i=0)=>{const r=Fr[N.inv(t)];r.tx=e,r.ty=i,s.append(r)}},We=[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=We[0].set(t.left,t.top),h=We[1].set(t.left,t.bottom),c=We[2].set(t.right,t.top),l=We[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,x=d*r+f*a;if(Math.max(p,m,g,x)<=d*o.x+f*o.y||Math.min(p,m,g,x)>=d*l.x+f*l.y)return!1;const y=u*(o.y-c.y),_=u*(c.x-o.x),v=y*i+_*n,C=y*r+_*n,I=y*i+_*a,M=y*r+_*a;return!(Math.max(v,C,I,M)<=y*o.x+_*o.y||Math.min(v,C,I,M)>=y*l.x+_*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 ds={default:-1};function J(s="default"){return ds[s]===void 0&&(ds[s]=-1),++ds[s]}const ki={},z="8.0.0",Ba="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} 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} @@ -22,7 +22,7 @@ Deprecated since v${s}`),console.warn(i))),ki[t]=!0}const Rr=()=>{};function Bi( `}function So(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 Ao(s,t){return t?`#version 300 es ${s}`:s}const Co={},To={};function Mo(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?Co:To;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`} -${s}`}function Po(s,t){return t?s.replace("#version 300 es",""):s}const As={stripVersion:Po,ensurePrecision:So,addProgramDefines:vo,setProgramName:Mo,insertVersion:Ao},Cs=Object.create(null),cn=class Vs{constructor(t){t={...Vs.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:wo()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(As).forEach(a=>{const o=i[a];r=As[a](r,o,!0),n=As[a](n,o,!1)}),this.fragment=r,this.vertex=n,this._key=li(`${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 Cs[e]||(Cs[e]=new Vs(t)),Cs[e]}};cn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let un=cn;const Xi={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 ko(s){return Xi[s]??Xi.float32}const Bo={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=Bo[o[3]]??"float32";e[o[2]]={location:parseInt(o[1],10),format:h,stride:ko(h).stride,offset:0,instance:!1,start:0}}}}return e}function Ts(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,x)=>{const[y,_]=x.split(":");return g[y.trim()]=_.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 Io({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 Ms=Object.create(null);class ns{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=Ts(e.source);this.structsAndGroups=c}else{const c=Ts(i.source),l=Ts(e.source);this.structsAndGroups=Ro(c,l)}this.layout=r??Fo(this.structsAndGroups),this.gpuLayout=n??Io(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=li(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 Ms[e]||(Ms[e]=new ns(t)),Ms[e]}}const dn=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],Go=dn.reduce((s,t)=>(s[t]=!0,s),{});function Lo(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,!Go[n.type])throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${dn.join(", ")}`);n.value??(n.value=Lo(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=li(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 Ke{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 Ys=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.BOTH=3]="BOTH",s))(Ys||{});class ci extends at{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|=Ys.WEBGPU),i&&(a|=Ys.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 Ke,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 Ke,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 Ke,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=ns.from(e)),i&&(a=un.from(i)),new ci({gpuProgram:n,glProgram:a,...r})}}const js=[];rt.handleByNamedList(P.Environment,js);async function zo(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===Ks(s,t,e,i)>0)for(n=t;n=t;n-=i)a=qi(n,s[n],s[n+1],a);return a&&os(a,a.next)&&(Te(a),a=a.next),a}function Ht(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(os(e,e.next)||$(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&&Xo(s,i,r,n);for(var o=s,h,c;s.prev!==s.next;){if(h=s.prev,c=s.next,n?Uo(s,i,r,n):Wo(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=Do(Ht(s),t,e),Ae(s,t,e,i,r,n,2)):a===2&&No(s,t,e,i,r,n):Ae(Ht(s),t,e,i,r,n,1);break}}}}function Wo(s){var t=s.prev,e=s,i=s.next;if($(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)&&$(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Uo(s,t,e,i){var r=s.prev,n=s,a=s.next;if($(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,x=Xs(f,p,t,e,i),y=Xs(m,g,t,e,i),_=s.prevZ,v=s.nextZ;_&&_.z>=x&&v&&v.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&qt(o,l,h,u,c,d,_.x,_.y)&&$(_.prev,_,_.next)>=0||(_=_.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)&&$(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&qt(o,l,h,u,c,d,_.x,_.y)&&$(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=y;){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)&&$(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Do(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!os(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 Ht(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&&Zo(a,o)){var h=yn(a,o);a=Ht(a,a.next),h=Ht(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 Ho(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 $(s.prev,s,t.prev)<0&&$(t.next,s,s.next)<0}function Xo(s,t,e,i){var r=s;do r.z===0&&(r.z=Xs(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,qo(r)}function qo(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 Xs(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 Ko(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 Zo(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!Qo(s,t)&&(Ce(s,t)&&Ce(t,s)&&Jo(s,t)&&($(s.prev,s,t.prev)||$(s,t.prev,t))||os(s,t)&&$(s.prev,s,s.next)>0&&$(t.prev,t,t.next)>0)}function $(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function os(s,t){return s.x===t.x&&s.y===t.y}function xn(s,t,e,i){var r=He($(s,t,e)),n=He($(s,t,i)),a=He($(e,i,s)),o=He($(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 He(s){return s>0?1:s<0?-1:0}function Qo(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 $(s.prev,s,s.next)<0?$(s,t,s.next)>=0&&$(s,s.prev,t)>=0:$(s,t,s.prev)<0||$(s,s.next,t)<0}function Jo(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 qs(s.i,s.x,s.y),i=new qs(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 qs(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 qs(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}as.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,a=Math.abs(Ks(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 th=ui.exports;const eh=ai(th);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 sh{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 sh(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.")}};bn.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let vn=bn,$e;function rh(s){return $e!==void 0||($e=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??vn.defaultOptions.failIfMajorPerformanceCaveat};try{if(!X.get().getWebGLRenderingContext())return!1;let r=X.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}})()),$e}let Ve;async function nh(s={}){return Ve!==void 0||(Ve=await(async()=>{const t=X.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),Ve}const Ki=["webgl","webgpu","canvas"];async function ah(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-Nv8CN4Mg.js");return{WebGPURenderer:h}},__vite__mapDeps([3,2,4]));e=o,i={...s,...s.webgpu};break}else if(a==="webgl"&&rh(s.failIfMajorPerformanceCaveat??vn.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:o}=await Qe(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-D23UtjUh.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 oh{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,Sn)}destroy(){this._renderer=null}}oh.extension={type:[P.WebGLSystem,P.WebGPUSystem],name:"initHook",priority:-10};const Cn=class Zs{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 ah(t),Zs._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=Zs._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 at{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 Qs{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=Qs.defaultTextureSize,{gradientStops:e}=this,i=X.get().createCanvas();i.width=t,i.height=t;const r=i.getContext("2d"),n=r.createLinearGradient(0,0,Qs.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 hs{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 hh=ch,Ps={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},lh=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function ch(s){var t=[];return s.replace(lh,function(e,i,r){var n=i.toLowerCase();for(r=dh(r),n=="m"&&r.length>2&&(t.push([i].concat(r.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(r.length==Ps[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 di{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new di(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 fi{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 fi(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 gh(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 Ye=(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 pi{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 pi(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&&Ye(t,e,p-h,m-h,h,c)||tm-h&&Ye(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 mh=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +${s}`}function Po(s,t){return t?s.replace("#version 300 es",""):s}const As={stripVersion:Po,ensurePrecision:So,addProgramDefines:vo,setProgramName:Mo,insertVersion:Ao},Cs=Object.create(null),cn=class Vs{constructor(t){t={...Vs.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:wo()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(As).forEach(a=>{const o=i[a];r=As[a](r,o,!0),n=As[a](n,o,!1)}),this.fragment=r,this.vertex=n,this._key=li(`${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 Cs[e]||(Cs[e]=new Vs(t)),Cs[e]}};cn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let un=cn;const Xi={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 ko(s){return Xi[s]??Xi.float32}const Bo={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=Bo[o[3]]??"float32";e[o[2]]={location:parseInt(o[1],10),format:h,stride:ko(h).stride,offset:0,instance:!1,start:0}}}}return e}function Ts(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,x)=>{const[y,_]=x.split(":");return g[y.trim()]=_.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 Io({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 Ms=Object.create(null);class ns{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=Ts(e.source);this.structsAndGroups=c}else{const c=Ts(i.source),l=Ts(e.source);this.structsAndGroups=Ro(c,l)}this.layout=r??Fo(this.structsAndGroups),this.gpuLayout=n??Io(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=li(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 Ms[e]||(Ms[e]=new ns(t)),Ms[e]}}const dn=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],Go=dn.reduce((s,t)=>(s[t]=!0,s),{});function Lo(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,!Go[n.type])throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${dn.join(", ")}`);n.value??(n.value=Lo(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=li(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 Ke{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 Ys=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.BOTH=3]="BOTH",s))(Ys||{});class ci extends at{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|=Ys.WEBGPU),i&&(a|=Ys.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 Ke,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 Ke,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 Ke,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=ns.from(e)),i&&(a=un.from(i)),new ci({gpuProgram:n,glProgram:a,...r})}}const js=[];rt.handleByNamedList(P.Environment,js);async function zo(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===Ks(s,t,e,i)>0)for(n=t;n=t;n-=i)a=qi(n,s[n],s[n+1],a);return a&&os(a,a.next)&&(Te(a),a=a.next),a}function Ht(s,t){if(!s)return s;t||(t=s);var e=s,i;do if(i=!1,!e.steiner&&(os(e,e.next)||$(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&&Xo(s,i,r,n);for(var o=s,h,c;s.prev!==s.next;){if(h=s.prev,c=s.next,n?Uo(s,i,r,n):Wo(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=Do(Ht(s),t,e),Ae(s,t,e,i,r,n,2)):a===2&&No(s,t,e,i,r,n):Ae(Ht(s),t,e,i,r,n,1);break}}}}function Wo(s){var t=s.prev,e=s,i=s.next;if($(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)&&$(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Uo(s,t,e,i){var r=s.prev,n=s,a=s.next;if($(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,x=Xs(f,p,t,e,i),y=Xs(m,g,t,e,i),_=s.prevZ,v=s.nextZ;_&&_.z>=x&&v&&v.z<=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&qt(o,l,h,u,c,d,_.x,_.y)&&$(_.prev,_,_.next)>=0||(_=_.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)&&$(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=x;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==r&&_!==a&&qt(o,l,h,u,c,d,_.x,_.y)&&$(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=y;){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)&&$(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Do(s,t,e){var i=s;do{var r=i.prev,n=i.next.next;!os(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 Ht(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&&Zo(a,o)){var h=yn(a,o);a=Ht(a,a.next),h=Ht(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 Ho(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 $(s.prev,s,t.prev)<0&&$(t.next,s,s.next)<0}function Xo(s,t,e,i){var r=s;do r.z===0&&(r.z=Xs(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,qo(r)}function qo(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 Xs(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 Ko(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 Zo(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!Qo(s,t)&&(Ce(s,t)&&Ce(t,s)&&Jo(s,t)&&($(s.prev,s,t.prev)||$(s,t.prev,t))||os(s,t)&&$(s.prev,s,s.next)>0&&$(t.prev,t,t.next)>0)}function $(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function os(s,t){return s.x===t.x&&s.y===t.y}function xn(s,t,e,i){var r=He($(s,t,e)),n=He($(s,t,i)),a=He($(e,i,s)),o=He($(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 He(s){return s>0?1:s<0?-1:0}function Qo(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 $(s.prev,s,s.next)<0?$(s,t,s.next)>=0&&$(s,s.prev,t)>=0:$(s,t,s.prev)<0||$(s,s.next,t)<0}function Jo(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 qs(s.i,s.x,s.y),i=new qs(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 qs(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 qs(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}as.deviation=function(s,t,e,i){var r=t&&t.length,n=r?t[0]*e:s.length,a=Math.abs(Ks(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 th=ui.exports;const eh=ai(th);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 sh{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 sh(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.")}};bn.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let vn=bn,$e;function rh(s){return $e!==void 0||($e=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??vn.defaultOptions.failIfMajorPerformanceCaveat};try{if(!X.get().getWebGLRenderingContext())return!1;let r=X.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}})()),$e}let Ve;async function nh(s={}){return Ve!==void 0||(Ve=await(async()=>{const t=X.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),Ve}const Ki=["webgl","webgpu","canvas"];async function ah(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-DpCsLNL1.js");return{WebGPURenderer:h}},__vite__mapDeps([3,2,4]));e=o,i={...s,...s.webgpu};break}else if(a==="webgl"&&rh(s.failIfMajorPerformanceCaveat??vn.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:o}=await Qe(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-CgvwxZyT.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 oh{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,Sn)}destroy(){this._renderer=null}}oh.extension={type:[P.WebGLSystem,P.WebGPUSystem],name:"initHook",priority:-10};const Cn=class Zs{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 ah(t),Zs._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=Zs._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 at{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 Qs{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=Qs.defaultTextureSize,{gradientStops:e}=this,i=X.get().createCanvas();i.width=t,i.height=t;const r=i.getContext("2d"),n=r.createLinearGradient(0,0,Qs.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 hs{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 hh=ch,Ps={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},lh=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function ch(s){var t=[];return s.replace(lh,function(e,i,r){var n=i.toLowerCase();for(r=dh(r),n=="m"&&r.length>2&&(t.push([i].concat(r.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(r.length==Ps[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 di{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new di(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 fi{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 fi(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 gh(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 Ye=(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 pi{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 pi(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&&Ye(t,e,p-h,m-h,h,c)||tm-h&&Ye(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 mh=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function xh(s){let t="";for(let e=0;e0&&(t+=` else `),e>>=0;return Bn[e]||bh(s,t,e)}let ks=0;function bh(s,t,e){const i={};let r=0;ks||(ks=kn());for(let a=0;a0){const a=new Uint8Array(s,e*8,n);new Uint8Array(t,e*8,n).set(a)}}const wh={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var vh=(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))(vh||{});function tr(s,t){return t.alphaMode==="no-premultiply-alpha"&&wh[s]||s}class Sh{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t0?En[--Js]:new Ah}function sr(s){En[Js++]=s}let pe=0;const In=class Ze{constructor(t={}){this.uid=J("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Ze.defaultOptions.maxTextures=Ze.defaultOptions.maxTextures??kn(),t={...Ze.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||_)&&(this._finishBatch(i,u,l-u,r,a,t,d),d="renderBatch",u=l,a=y,i=er(),r=i.textures,r.clear(),++pe),m._textureId=x._textureBindLocation=r.count,r.ids[x.uid]=r.count,r.textures[r.count++]=x,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 kt extends at{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 Ph=new Float32Array(1),kh=new Uint32Array(1);class Bh extends Rn{constructor(){const e=new kt({data:Ph,label:"attribute-batch-buffer",usage:K.VERTEX|K.COPY_DST,shrinkToFit:!1}),i=new kt({data:kh,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(` `);let a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",` @@ -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([Lc],{type:"application/javascript"}))),this.worker=new Worker(Qt)}}Qn.revokeObjectURL=function(){Qt&&(URL.revokeObjectURL(Qt),Qt=null)};let Pr=0,zs;class zc{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 ni;e.addEventListener("message",i=>{e.terminate(),ni.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(){zs===void 0&&(zs=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 zc,Oc=[".jpeg",".jpg",".png",".webp",".avif"],Wc=["image/jpeg","image/png","image/webp","image/avif"];async function Uc(s,t){var r;const e=await X.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:Bt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return ae(s,Wc)||oe(s,Oc)},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 Uc(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)||_i(s),...t.data});return bi(r,e,s)},unload(s){s.destroy(!0)}},ta=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Dc=ta.map(s=>`video/${s.substring(1)}`);function Nc(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=$c(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function Hc(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 $c(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 Vc={name:"loadVideo",extension:{type:P.LoadParser,name:"loadVideo"},test(s){const t=ae(s,Dc),e=oe(s,ta);return t||e},async load(s,t,e){var h,c;const i={...qe.defaultOptions,resolution:((h=t.data)==null?void 0:h.resolution)||_i(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=qe.MIME_TYPES[l]||`video/${l}`}return a.src=s,o&&(a.type=o),new Promise(l=>{const u=async()=>{const d=new qe({...i,resource:r});r.removeEventListener("canplay",u),t.data.preload&&await Hc(r),l(bi(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}}},Yc={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 gc,this.cache=H,this._backgroundLoader=new ac(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=es(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 H.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}),H.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=>{H.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(oc,lc,hc,pc,uc,dc,fc,yc,wc,kc,Ic,Jn,Vc,nc,rc,ea,Yc);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 $t extends is{constructor(t){t instanceof ct&&(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 ct,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 $t(this._context.clone()):(this._ownedContext=null,new $t(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!==ct.defaultStrokeStyle.width||t.color!==ct.defaultStrokeStyle.color||t.alpha!==ct.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 kt({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),h=new kt({data:r,label:"attribute-mesh-uvs",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),c=new kt({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 Xc=sa;class ke extends dt{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,ts.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 qc extends is{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 nt({_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 Kc(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 Ct extends qc{constructor(...t){const e=Kc(t,"Text");super(e,lt),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=ri.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 Xc{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 jt=aa;const ha=class la extends is{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)??jt.defaultOptions.leftWidth,this._topHeight=a??((d=h==null?void 0:h.defaultBorders)==null?void 0:d.top)??jt.defaultOptions.topHeight,this._rightWidth=n??((f=h==null?void 0:h.defaultBorders)==null?void 0:f.right)??jt.defaultOptions.rightWidth,this._bottomHeight=o??((p=h==null?void 0:h.defaultBorders)==null?void 0:p.bottom)??jt.defaultOptions.bottomHeight,this.bounds.maxX=this._width=e??h.width??jt.defaultOptions.width,this.bounds.maxY=this._height=i??h.height??jt.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 Ie=ha;rt.add(wa,va);class w{}b(w,"app"),b(w,"GameMaster"),b(w,"Grid"),b(w,"WaveManager"),b(w,"TowerManager"),b(w,"AnimationManager"),b(w,"NotificationManager"),b(w,"GameScene"),b(w,"latestCommit"),b(w,"GridCellSize",64),b(w,"GridColumns",25),b(w,"GridRows",17);class Qc{constructor(){b(this,"currentScene");b(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 j=class j{static async Load(t){return this.text.text="Loading asset: "+t,console.log("LOADING "+t),await _e.load({src:t})}static async LoadAssets(){if(this.text)throw"Do not call GameAssets.LoadAssets() more than once.";console.log("Loading Texture Assets");const t=new Ct({text:"Loading textures. This might take a while.",style:new lt({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 Ct({text:"",style:new lt({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 this.Load("/aclonica.woff2"),this.Button01Texture=await this.Load("/assets/gui/button_01.png"),this.Button02Texture=await this.Load("/assets/gui/button_02.png"),this.Frame01Texture=await this.Load("/assets/gui/frame_01.png"),this.Frame02Texture=await this.Load("/assets/gui/frame_02.png"),this.Frame03Texture=await this.Load("/assets/gui/frame_03.png"),this.FrameBackground=await this.Load("/assets/gui/background_01.png"),this.FrameTowerTab=await this.Load("/assets/gui/background_02.png"),this.VioletBackground=await this.Load("/assets/gui/frame_violet.png"),this.RedBackground=await this.Load("/assets/gui/frame_red.png"),this.GreenBackground=await this.Load("/assets/gui/frame_green.png"),this.HealthTexture=await this.Load("/assets/gui/heart.png"),this.GoldTexture=await this.Load("/assets/gui/money.png"),this.WaveTexture=await this.Load("/assets/gui/wave.png"),await this.LoadMissions(),await this.LoadTowers(),await 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{let r=this.TowerSprites.length-1;r==-1&&(r=0),this.TowerSprites[r]=await this.Load(`/assets/towers/${i.sprite}.png`)})}static async LoadMission(t){const i=await(await fetch(t)).json();return await this.LoadBackground(i.mapImage.url),i}static async LoadBackground(t){let e=this.MissionBackgrounds.length-1;e==-1&&(e=0),this.MissionBackgrounds[e]=await this.Load(t)}};b(j,"Frame01Texture"),b(j,"Frame02Texture"),b(j,"Frame03Texture"),b(j,"FrameBackground"),b(j,"FrameTowerTab"),b(j,"VioletBackground"),b(j,"RedBackground"),b(j,"GreenBackground"),b(j,"Button01Texture"),b(j,"Button02Texture"),b(j,"HealthTexture"),b(j,"GoldTexture"),b(j,"WaveTexture"),b(j,"Missions"),b(j,"MissionBackgrounds",[]),b(j,"TowerSprites",[]),b(j,"Towers"),b(j,"Creeps"),b(j,"text");let V=j;class Fe{constructor(t){b(this,"name",this.constructor.name);b(this,"_container",new st);b(this,"_events",new at);b(this,"enabled",!0);w.GameMaster._CreateGuiObject(this),t&&(this._container.interactive=!0,this._container.onwheel=e=>{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 Fe{constructor(e,i,r,n=!0){super(!0);b(this,"caption");b(this,"bounds");b(this,"buttonTexture");b(this,"buttonSprite");b(this,"buttonText");r==0&&(this.buttonTexture=V.Button01Texture),r==1&&(this.buttonTexture=V.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 Ie({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 lt({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}}class Et{constructor(){b(this,"name",this.constructor.name);b(this,"_container",new st);b(this,"bb",new W);b(this,"_events",new at)}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 Jc extends Et{constructor(e,i,r){super();b(this,"id");b(this,"creepType");b(this,"sprite");b(this,"path");b(this,"stats");b(this,"pathIndex",0);b(this,"speed");b(this,"direction",1);b(this,"healthBarGraphics",new $t);b(this,"healthBarWidth",50);b(this,"health");b(this,"maxHealth");b(this,"escaped",!1);b(this,"died",!1);b(this,"x");b(this,"y");b(this,"dead",!1);this.creepType=e,this.stats=structuredClone(V.Creeps[this.creepType].stats),this.sprite=new ke(V.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))(Nt||{});class tu extends Et{constructor(e,i,r,n){super();b(this,"type");b(this,"row");b(this,"column");b(this,"isPath",!1);b(this,"g");b(this,"clickDetector");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 $t({zIndex:99,interactive:!0}),this.clickDetector.rect(0,0,this.bb.width,this.bb.height),this.clickDetector.fill({color:16711680,alpha:0}),this.container.addChild(this.clickDetector),this.clickDetector.onpointerdown=a=>{w.Grid.onGridCellClicked(i,r)}}gDraw(){switch(this.g=new $t({zIndex:5}),this.g.rect(0,0,this.bb.width,this.bb.height),this.type){case Nt.Restricted:this.g.fill({color:2236962,alpha:.5});break;case Nt.Path:this.g.fill({color:2236962,alpha:.5});break;case Nt.Buildable:this.g.stroke({color:65280,alpha:.9});break}this.container.addChild(this.g)}gClear(){this.g!=null&&(this.container.removeChild(this.g),this.g.destroy())}update(){}}class eu extends Et{constructor(e,i){super();b(this,"gameMap");b(this,"cells",[]);b(this,"creeps",[]);b(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 dt(V.MissionBackgrounds[i]);this.container.addChild(r);for(let n=0;nl.some(u=>u[0]===a&&u[1]===n));h&&(o=Nt.Path);let c=new tu(o,a,n,h);this.cells.push(c)}}toggleGrid(){this.cells.forEach(e=>{this.gridShown?e.gClear():e.gDraw()}),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 su extends Et{constructor(e,i){super();b(this,"creeps",[]);b(this,"rounds");b(this,"paths");b(this,"ticks",0);b(this,"started",!1);b(this,"finished",!1);b(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 Jc(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)}))}}var ca=(s=>(s.BasicTowerBehaviour="BasicTowerBehaviour",s))(ca||{});class iu{constructor(){b(this,"isPlacingTower",!1);b(this,"canPlaceTowers",!0);b(this,"selectedTower",null);b(this,"towers",[]);w.TowerManager=this}ToggleChoosingTowerLocation(t){this.canPlaceTowers&&(w.Grid.toggleGrid(),this.isPlacingTower?this.selectedTower=null:V.Towers.forEach(e=>{e.name==t&&(this.selectedTower=e)}),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){let a=0;V.Towers.forEach((h,c)=>{h.sprite==t.sprite&&(a=c)});const o=V.TowerSprites[a];if(!w.GameScene.MissionStats.hasEnoughGold(t.stats.cost)&&!n)return console.warn("Does not have enough gold.");if(!this.GetTowerByRowAndCol(e,i)&&w.Grid.getCellByRowAndCol(e,i).type!=Nt.Path&&w.Grid.getCellByRowAndCol(e,i).type!=Nt.Restricted){w.GameScene.MissionStats.spendGold(t.stats.cost);let h=new ou(e,i,o,t,r);this.towers.push(h),this.ToggleChoosingTowerLocation("RESET"),this.selectedTower=null,w.GameScene.events.emit(wi.TowerPlacedEvent,t.name)}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 ru(s,t,e,i){const r=e-s,n=i-t;return Math.atan2(n,r)}class nu extends Et{constructor(e,i,r,n,a){super();b(this,"deleteMe",!1);b(this,"sprite");b(this,"x");b(this,"y");b(this,"angle");b(this,"speed");b(this,"damage");b(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),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 au(s,t,e,i){return Math.sqrt((e-s)*(e-s)+(i-t)*(i-t))}var wi=(s=>(s.TowerPlacedEvent="towerPlacedEvent",s))(wi||{});class ou extends Et{constructor(e,i,r,n,a){super();b(this,"row");b(this,"column");b(this,"projectiles",[]);b(this,"behaviour");b(this,"definition");b(this,"sprite");b(this,"ticksUntilNextShot");b(this,"graphics",new $t);this.row=e,this.column=i,this.behaviour=a,this.definition=n,this.ticksUntilNextShot=0;let o=w.Grid.getCellByRowAndCol(e,i);this.sprite=new dt({texture:r,height:w.GridCellSize,width:w.GridCellSize,zIndex:10}),this.container.addChild(this.sprite),o.container.addChild(this.container),o.clickDetector.onmouseenter=h=>{this.showRangeDisplay()},o.clickDetector.onmouseleave=h=>{this.graphics.clear()},w.GameMaster.currentScene.stage.addChild(this.graphics),this.showRangeDisplay()}showRangeDisplay(){this.graphics.circle(this.column*w.GridCellSize+w.GridCellSize/2,this.row*w.GridCellSize+w.GridCellSize/2,this.definition.stats.range*w.GridCellSize),this.graphics.fill({color:16711680,alpha:.5})}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 au(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))}}}}class Er extends Fe{constructor(e,i,r,n,a,o,h){if(e>3||i>2||e<0||i<0)throw"Index/row out of bounds for TowerButton.";super(!0);b(this,"frameSprite");b(this,"background");b(this,"towerName");b(this,"i",0);this.towerName=h,this.container.x=e*r+5,this.container.y=i*n+5,this.background=new dt({texture:o}),this.background.width=r,this.background.height=n,this.container.addChild(this.background),this.frameSprite=new Ie({texture:V.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(wi.TowerPlacedEvent,c=>{this.frameSprite.tint=16777215}),this.container.onmouseenter=c=>{},this.container.onmouseleave=c=>{}}onClick(e){this.frameSprite.tint==65280?this.frameSprite.tint=16777215:this.frameSprite.tint=65280,w.TowerManager.ToggleChoosingTowerLocation(this.towerName)}}class hu extends Fe{constructor(e){super(!1);b(this,"bounds");b(this,"towerTabSprite");b(this,"towerList",[]);this.bounds=e,V.Towers.forEach(i=>{let r={name:i.name,description:i.description,cost:i.stats.cost};this.towerList.push(r)}),this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.towerTabSprite=new Ie({texture:V.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),new Er(0,0,70,70,this.container,V.RedBackground,"Basic Tower"),new Er(0,1,70,70,this.container,V.GreenBackground,"Basic Tower")}}class lu extends Fe{constructor(e){super(!1);b(this,"bounds");b(this,"gemTabSprite");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.gemTabSprite=new Ie({texture:V.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 cu extends Fe{constructor(e){super(!1);b(this,"bounds");b(this,"sidebarSprite");b(this,"towerTab");b(this,"gemTab");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.sidebarSprite=new Ie({texture:V.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 hu(i),this.container.addChild(this.towerTab.container);const r=new W(60,180,this.bounds.width-65,this.bounds.height-280);this.gemTab=new lu(r),this.container.addChild(this.gemTab.container)}}class vi{constructor(){b(this,"stage",new st);b(this,"gui",[]);b(this,"_events",new at);w.app.stage.addChild(this.stage)}destroy(){this.stage.destroy(),this.gui.forEach(t=>{t.destroy()})}get events(){return this._events}init(){}}class uu extends Et{constructor(e,i){super();b(this,"hp",100);b(this,"gold",0);b(this,"goldText");b(this,"healthText");b(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 Ct({text:`${this.hp}`,style:new lt({fill:"red",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.goldText=new Ct({text:`${this.gold}`,style:new lt({fill:"gold",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.waveText=new Ct({text:`0/${w.GameScene.mission.rounds.length}`,style:new lt({fill:"dodgerblue",fontSize:36,fontWeight:"bold",dropShadow:!0})});const r=new dt(V.HealthTexture),n=new dt(V.GoldTexture),a=new dt(V.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)}};b(Kt,"SidebarRect"),b(Kt,"ChangeRoundButtonRect");let Ee=Kt;class ua extends vi{constructor(e){super();b(this,"isGameOver",!1);b(this,"mission");b(this,"missionIndex");b(this,"MissionStats");b(this,"roundMode");b(this,"ticker");b(this,"changeRoundButton");b(this,"sidebar");b(this,"currentRound",0);b(this,"isWaveManagerFinished",!1);b(this,"playerWon",!1);b(this,"destroyTicker",!1);w.GameScene=this,V.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 eu(this.mission.gameMap,this.missionIndex),new iu,new su(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 cu(Ee.SidebarRect),this.changeRoundButton=new Be(Ee.ChangeRoundButtonRect,"Start",se.Button01,!0),this.changeRoundButton.container.removeFromParent(),this.sidebar.container.addChild(this.changeRoundButton.container),this.changeRoundButton.onClick=()=>{if(this.playerWon)return this.ReturnToMain();if(this.isGameOver)return w.NotificationManager.Notify("No more waves.","warn");this.changeRoundButton.setEnabled(!1),this.changeRoundButton.setCaption("WAVE IN PROGRESS"),this.setRoundMode(1),this.events.emit(Se.NewWave,`${this.currentRound+1}`)},this.MissionStats=new uu(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.changeRoundButton.setEnabled(!0),this.changeRoundButton.setCaption("Start"),this.setRoundMode(0),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.setCaption("Return to menu"),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 da)}onTowerPlaced(){}}class da 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 fa)},V.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 ua(e.name))}})}}class fa 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 Ct({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 Ct({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 da)};let a=new Be(e.rect,e.caption,e.texture,!0);a.onClick=o=>{w.NotificationManager.Notify("Not finished.","info")}}}class du{constructor(){b(this,"finished",!1);b(this,"calledBack",!1);b(this,"callbackFn")}Finish(){this.finished=!0}update(t){this.finished}}class fu extends du{constructor(e,i,r,n){super();b(this,"fadeType");b(this,"fadeTime");b(this,"pixiObject");b(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 pu{constructor(){b(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 gu{constructor(t,e,i,r,n){b(this,"textObj");b(this,"ticksToFadeAway");b(this,"animating",!1);b(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 lt({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 mu extends Et{constructor(){super();b(this,"notifications",[]);b(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 gu(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 fu("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 V.LoadAssets(),Ee.init(),new Qc,w.AnimationManager=new pu,w.NotificationManager=new mu,globalThis.Engine=w,_t.shared.add(i=>{w.NotificationManager.update(i.elapsedMS),w.AnimationManager.update(i.elapsedMS)}),w.GameMaster.changeScene(new fa),new URLSearchParams(location.href).entries().next().value[1]=="game"&&w.GameMaster.changeScene(new ua("Mission 1")),w.latestCommit!="DEVELOPMENT"&&(window.onbeforeunload=()=>"You are about to leave.")})();export{L as $,vn as A,K as B,st as C,X as D,P as E,Nr as F,ns as G,bt as H,Ni as I,dt as J,ko as K,Oo as L,O as M,J as N,W as O,it as P,sh as Q,Ys as R,vh as S,Tt as T,ts as U,$i as V,oo as W,bs as X,Z as Y,$r as Z,Sn as _,G as a,z as a0,oh as a1,Rn as a2,Yh as a3,Xh as a4,Jh as a5,el as a6,sl as a7,te as a8,lt as a9,Yl as aa,ri as ab,Un as ac,tr as ad,jt as ae,Xc as af,Ar as ag,Ql as ah,$t as ai,H as aj,Ga as ak,ii as al,vr as am,Nn as an,_t as b,at as c,kt as d,rt as e,Ji as f,_h as g,Ke as h,li as i,_n as j,tn as k,gn as l,wr as m,Bi as n,Vh as o,jh as p,Zh as q,ja as r,kn as s,tl as t,ci as u,un as v,Q as w,Ra as x,rl as y,St as z}; +`;let Qt=null;class Qn{constructor(){Qt||(Qt=URL.createObjectURL(new Blob([Lc],{type:"application/javascript"}))),this.worker=new Worker(Qt)}}Qn.revokeObjectURL=function(){Qt&&(URL.revokeObjectURL(Qt),Qt=null)};let Pr=0,zs;class zc{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 ni;e.addEventListener("message",i=>{e.terminate(),ni.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(){zs===void 0&&(zs=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 zc,Oc=[".jpeg",".jpg",".png",".webp",".avif"],Wc=["image/jpeg","image/png","image/webp","image/avif"];async function Uc(s,t){var r;const e=await X.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:Bt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return ae(s,Wc)||oe(s,Oc)},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 Uc(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)||_i(s),...t.data});return bi(r,e,s)},unload(s){s.destroy(!0)}},ta=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Dc=ta.map(s=>`video/${s.substring(1)}`);function Nc(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=$c(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function Hc(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 $c(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 Vc={name:"loadVideo",extension:{type:P.LoadParser,name:"loadVideo"},test(s){const t=ae(s,Dc),e=oe(s,ta);return t||e},async load(s,t,e){var h,c;const i={...qe.defaultOptions,resolution:((h=t.data)==null?void 0:h.resolution)||_i(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=qe.MIME_TYPES[l]||`video/${l}`}return a.src=s,o&&(a.type=o),new Promise(l=>{const u=async()=>{const d=new qe({...i,resource:r});r.removeEventListener("canplay",u),t.data.preload&&await Hc(r),l(bi(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}}},Yc={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 gc,this.cache=H,this._backgroundLoader=new ac(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=es(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 H.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}),H.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=>{H.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(oc,lc,hc,pc,uc,dc,fc,yc,wc,kc,Ic,Jn,Vc,nc,rc,ea,Yc);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 $t extends is{constructor(t){t instanceof ct&&(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 ct,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 $t(this._context.clone()):(this._ownedContext=null,new $t(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!==ct.defaultStrokeStyle.width||t.color!==ct.defaultStrokeStyle.color||t.alpha!==ct.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 kt({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),h=new kt({data:r,label:"attribute-mesh-uvs",shrinkToFit:a,usage:K.VERTEX|K.COPY_DST}),c=new kt({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 Xc=sa;class ke extends dt{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,ts.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 qc extends is{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 nt({_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 Kc(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 Ct extends qc{constructor(...t){const e=Kc(t,"Text");super(e,lt),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=ri.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 Xc{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 jt=aa;const ha=class la extends is{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)??jt.defaultOptions.leftWidth,this._topHeight=a??((d=h==null?void 0:h.defaultBorders)==null?void 0:d.top)??jt.defaultOptions.topHeight,this._rightWidth=n??((f=h==null?void 0:h.defaultBorders)==null?void 0:f.right)??jt.defaultOptions.rightWidth,this._bottomHeight=o??((p=h==null?void 0:h.defaultBorders)==null?void 0:p.bottom)??jt.defaultOptions.bottomHeight,this.bounds.maxX=this._width=e??h.width??jt.defaultOptions.width,this.bounds.maxY=this._height=i??h.height??jt.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 Ie=ha;rt.add(wa,va);class w{}b(w,"app"),b(w,"GameMaster"),b(w,"Grid"),b(w,"WaveManager"),b(w,"TowerManager"),b(w,"AnimationManager"),b(w,"NotificationManager"),b(w,"GameScene"),b(w,"latestCommit"),b(w,"GridCellSize",64),b(w,"GridColumns",25),b(w,"GridRows",17);class Qc{constructor(){b(this,"currentScene");b(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 j=class j{static async Load(t){return this.text.text="Loading asset: "+t,console.log("LOADING "+t),await _e.load({src:t})}static async LoadAssets(){if(this.text)throw"Do not call GameAssets.LoadAssets() more than once.";console.log("Loading Texture Assets");const t=new Ct({text:"Loading textures. This might take a while.",style:new lt({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 Ct({text:"",style:new lt({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/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.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{let r=this.TowerSprites.length-1;r==-1&&(r=0),this.TowerSprites[r]=await this.Load(`/assets/towers/${i.sprite}.png`)})}static async LoadMission(t){const i=await(await fetch(t)).json();return await this.LoadBackground(i.mapImage.url),i}static async LoadBackground(t){let e=this.MissionBackgrounds.length-1;e==-1&&(e=0),this.MissionBackgrounds[e]=await this.Load(t)}};b(j,"Frame01Texture"),b(j,"Frame02Texture"),b(j,"Frame03Texture"),b(j,"FrameBackground"),b(j,"FrameTowerTab"),b(j,"VioletBackground"),b(j,"RedBackground"),b(j,"GreenBackground"),b(j,"Button01Texture"),b(j,"Button02Texture"),b(j,"HealthTexture"),b(j,"GoldTexture"),b(j,"WaveTexture"),b(j,"Missions"),b(j,"MissionBackgrounds",[]),b(j,"TowerSprites",[]),b(j,"Towers"),b(j,"Creeps"),b(j,"text");let V=j;class Fe{constructor(t){b(this,"name",this.constructor.name);b(this,"_container",new st);b(this,"_events",new at);b(this,"enabled",!0);w.GameMaster._CreateGuiObject(this),t&&(this._container.interactive=!0,this._container.onwheel=e=>{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 Fe{constructor(e,i,r,n=!0){super(!0);b(this,"caption");b(this,"bounds");b(this,"buttonTexture");b(this,"buttonSprite");b(this,"buttonText");r==0&&(this.buttonTexture=V.Button01Texture),r==1&&(this.buttonTexture=V.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 Ie({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 lt({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}}class Et{constructor(){b(this,"name",this.constructor.name);b(this,"_container",new st);b(this,"bb",new W);b(this,"_events",new at)}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 Jc extends Et{constructor(e,i,r){super();b(this,"id");b(this,"creepType");b(this,"sprite");b(this,"path");b(this,"stats");b(this,"pathIndex",0);b(this,"speed");b(this,"direction",1);b(this,"healthBarGraphics",new $t);b(this,"healthBarWidth",50);b(this,"health");b(this,"maxHealth");b(this,"escaped",!1);b(this,"died",!1);b(this,"x");b(this,"y");b(this,"dead",!1);this.creepType=e,this.stats=structuredClone(V.Creeps[this.creepType].stats),this.sprite=new ke(V.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))(Nt||{});class tu extends Et{constructor(e,i,r,n){super();b(this,"type");b(this,"row");b(this,"column");b(this,"isPath",!1);b(this,"g");b(this,"clickDetector");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 $t({zIndex:99,interactive:!0}),this.clickDetector.rect(0,0,this.bb.width,this.bb.height),this.clickDetector.fill({color:16711680,alpha:0}),this.container.addChild(this.clickDetector),this.clickDetector.onpointerdown=a=>{w.Grid.onGridCellClicked(i,r)}}gDraw(){switch(this.g=new $t({zIndex:5}),this.g.rect(0,0,this.bb.width,this.bb.height),this.type){case Nt.Restricted:this.g.fill({color:2236962,alpha:.5});break;case Nt.Path:this.g.fill({color:2236962,alpha:.5});break;case Nt.Buildable:this.g.stroke({color:65280,alpha:.9});break}this.container.addChild(this.g)}gClear(){this.g!=null&&(this.container.removeChild(this.g),this.g.destroy())}update(){}}class eu extends Et{constructor(e,i){super();b(this,"gameMap");b(this,"cells",[]);b(this,"creeps",[]);b(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 dt(V.MissionBackgrounds[i]);this.container.addChild(r);for(let n=0;nl.some(u=>u[0]===a&&u[1]===n));h&&(o=Nt.Path);let c=new tu(o,a,n,h);this.cells.push(c)}}toggleGrid(){this.cells.forEach(e=>{this.gridShown?e.gClear():e.gDraw()}),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 su extends Et{constructor(e,i){super();b(this,"creeps",[]);b(this,"rounds");b(this,"paths");b(this,"ticks",0);b(this,"started",!1);b(this,"finished",!1);b(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 Jc(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)}))}}var ca=(s=>(s.BasicTowerBehaviour="BasicTowerBehaviour",s))(ca||{});class iu{constructor(){b(this,"isPlacingTower",!1);b(this,"canPlaceTowers",!0);b(this,"selectedTower",null);b(this,"towers",[]);w.TowerManager=this}ToggleChoosingTowerLocation(t){this.canPlaceTowers&&(w.Grid.toggleGrid(),this.isPlacingTower?this.selectedTower=null:V.Towers.forEach(e=>{e.name==t&&(this.selectedTower=e)}),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){let a=0;V.Towers.forEach((h,c)=>{h.sprite==t.sprite&&(a=c)});const o=V.TowerSprites[a];if(!w.GameScene.MissionStats.hasEnoughGold(t.stats.cost)&&!n)return console.warn("Does not have enough gold.");if(!this.GetTowerByRowAndCol(e,i)&&w.Grid.getCellByRowAndCol(e,i).type!=Nt.Path&&w.Grid.getCellByRowAndCol(e,i).type!=Nt.Restricted){w.GameScene.MissionStats.spendGold(t.stats.cost);let h=new ou(e,i,o,t,r);this.towers.push(h),this.ToggleChoosingTowerLocation("RESET"),this.selectedTower=null,w.GameScene.events.emit(wi.TowerPlacedEvent,t.name)}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 ru(s,t,e,i){const r=e-s,n=i-t;return Math.atan2(n,r)}class nu extends Et{constructor(e,i,r,n,a){super();b(this,"deleteMe",!1);b(this,"sprite");b(this,"x");b(this,"y");b(this,"angle");b(this,"speed");b(this,"damage");b(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),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 au(s,t,e,i){return Math.sqrt((e-s)*(e-s)+(i-t)*(i-t))}var wi=(s=>(s.TowerPlacedEvent="towerPlacedEvent",s))(wi||{});class ou extends Et{constructor(e,i,r,n,a){super();b(this,"row");b(this,"column");b(this,"projectiles",[]);b(this,"behaviour");b(this,"definition");b(this,"sprite");b(this,"ticksUntilNextShot");b(this,"graphics",new $t);this.row=e,this.column=i,this.behaviour=a,this.definition=n,this.ticksUntilNextShot=0;let o=w.Grid.getCellByRowAndCol(e,i);this.sprite=new dt({texture:r,height:w.GridCellSize,width:w.GridCellSize,zIndex:10}),this.container.addChild(this.sprite),o.container.addChild(this.container),o.clickDetector.onmouseenter=h=>{this.showRangeDisplay()},o.clickDetector.onmouseleave=h=>{this.graphics.clear()},w.GameMaster.currentScene.stage.addChild(this.graphics),this.showRangeDisplay()}showRangeDisplay(){this.graphics.circle(this.column*w.GridCellSize+w.GridCellSize/2,this.row*w.GridCellSize+w.GridCellSize/2,this.definition.stats.range*w.GridCellSize),this.graphics.fill({color:16711680,alpha:.5})}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 au(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))}}}}class Er extends Fe{constructor(e,i,r,n,a,o,h){if(e>3||i>2||e<0||i<0)throw"Index/row out of bounds for TowerButton.";super(!0);b(this,"frameSprite");b(this,"background");b(this,"towerName");b(this,"i",0);this.towerName=h,this.container.x=e*r+5,this.container.y=i*n+5,this.background=new dt({texture:o}),this.background.width=r,this.background.height=n,this.container.addChild(this.background),this.frameSprite=new Ie({texture:V.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(wi.TowerPlacedEvent,c=>{this.frameSprite.tint=16777215}),this.container.onmouseenter=c=>{},this.container.onmouseleave=c=>{}}onClick(e){this.frameSprite.tint==65280?this.frameSprite.tint=16777215:this.frameSprite.tint=65280,w.TowerManager.ToggleChoosingTowerLocation(this.towerName)}}class hu extends Fe{constructor(e){super(!1);b(this,"bounds");b(this,"towerTabSprite");b(this,"towerList",[]);this.bounds=e,V.Towers.forEach(i=>{let r={name:i.name,description:i.description,cost:i.stats.cost};this.towerList.push(r)}),this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.towerTabSprite=new Ie({texture:V.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),new Er(0,0,70,70,this.container,V.RedBackground,"Basic Tower"),new Er(0,1,70,70,this.container,V.GreenBackground,"Basic Tower")}}class lu extends Fe{constructor(e){super(!1);b(this,"bounds");b(this,"gemTabSprite");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.gemTabSprite=new Ie({texture:V.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 cu extends Fe{constructor(e){super(!1);b(this,"bounds");b(this,"sidebarSprite");b(this,"towerTab");b(this,"gemTab");this.bounds=e,this.container.x=this.bounds.x,this.container.y=this.bounds.y,this.sidebarSprite=new Ie({texture:V.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 hu(i),this.container.addChild(this.towerTab.container);const r=new W(60,180,this.bounds.width-65,this.bounds.height-280);this.gemTab=new lu(r),this.container.addChild(this.gemTab.container)}}class vi{constructor(){b(this,"stage",new st);b(this,"gui",[]);b(this,"_events",new at);w.app.stage.addChild(this.stage)}destroy(){this.stage.destroy(),this.gui.forEach(t=>{t.destroy()})}get events(){return this._events}init(){}}class uu extends Et{constructor(e,i){super();b(this,"hp",100);b(this,"gold",0);b(this,"goldText");b(this,"healthText");b(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 Ct({text:`${this.hp}`,style:new lt({fill:"red",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.goldText=new Ct({text:`${this.gold}`,style:new lt({fill:"gold",fontSize:36,fontWeight:"bold",dropShadow:!0})}),this.waveText=new Ct({text:`0/${w.GameScene.mission.rounds.length}`,style:new lt({fill:"dodgerblue",fontSize:36,fontWeight:"bold",dropShadow:!0})});const r=new dt(V.HealthTexture),n=new dt(V.GoldTexture),a=new dt(V.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)}};b(Kt,"SidebarRect"),b(Kt,"ChangeRoundButtonRect");let Ee=Kt;class ua extends vi{constructor(e){super();b(this,"isGameOver",!1);b(this,"mission");b(this,"missionIndex");b(this,"MissionStats");b(this,"roundMode");b(this,"ticker");b(this,"changeRoundButton");b(this,"sidebar");b(this,"currentRound",0);b(this,"isWaveManagerFinished",!1);b(this,"playerWon",!1);b(this,"destroyTicker",!1);w.GameScene=this,V.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 eu(this.mission.gameMap,this.missionIndex),new iu,new su(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 cu(Ee.SidebarRect),this.changeRoundButton=new Be(Ee.ChangeRoundButtonRect,"Start",se.Button01,!0),this.changeRoundButton.container.removeFromParent(),this.sidebar.container.addChild(this.changeRoundButton.container),this.changeRoundButton.onClick=()=>{if(this.playerWon)return this.ReturnToMain();if(this.isGameOver)return w.NotificationManager.Notify("No more waves.","warn");this.changeRoundButton.setEnabled(!1),this.changeRoundButton.setCaption("WAVE IN PROGRESS"),this.setRoundMode(1),this.events.emit(Se.NewWave,`${this.currentRound+1}`)},this.MissionStats=new uu(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.changeRoundButton.setEnabled(!0),this.changeRoundButton.setCaption("Start"),this.setRoundMode(0),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.setCaption("Return to menu"),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 da)}onTowerPlaced(){}}class da 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 fa)},V.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 ua(e.name))}})}}class fa 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 Ct({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 Ct({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 da)};let a=new Be(e.rect,e.caption,e.texture,!0);a.onClick=o=>{w.NotificationManager.Notify("Not finished.","info")}}}class du{constructor(){b(this,"finished",!1);b(this,"calledBack",!1);b(this,"callbackFn")}Finish(){this.finished=!0}update(t){this.finished}}class fu extends du{constructor(e,i,r,n){super();b(this,"fadeType");b(this,"fadeTime");b(this,"pixiObject");b(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 pu{constructor(){b(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 gu{constructor(t,e,i,r,n){b(this,"textObj");b(this,"ticksToFadeAway");b(this,"animating",!1);b(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 lt({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 mu extends Et{constructor(){super();b(this,"notifications",[]);b(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 gu(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 fu("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 V.LoadAssets(),Ee.init(),new Qc,w.AnimationManager=new pu,w.NotificationManager=new mu,globalThis.Engine=w,_t.shared.add(i=>{w.NotificationManager.update(i.elapsedMS),w.AnimationManager.update(i.elapsedMS)}),w.GameMaster.changeScene(new fa),new URLSearchParams(location.href).entries().next().value[1]=="game"&&w.GameMaster.changeScene(new ua("Mission 1")),w.latestCommit!="DEVELOPMENT"&&(window.onbeforeunload=()=>"You are about to leave.")})();export{L as $,vn as A,K as B,st as C,X as D,P as E,Nr as F,ns as G,bt as H,Ni as I,dt as J,ko as K,Oo as L,O as M,J as N,W as O,it as P,sh as Q,Ys as R,vh as S,Tt as T,ts as U,$i as V,oo as W,bs as X,Z as Y,$r as Z,Sn as _,G as a,z as a0,oh as a1,Rn as a2,Yh as a3,Xh as a4,Jh as a5,el as a6,sl as a7,te as a8,lt as a9,Yl as aa,ri as ab,Un as ac,tr as ad,jt as ae,Xc as af,Ar as ag,Ql as ah,$t as ai,H as aj,Ga as ak,ii as al,vr as am,Nn as an,_t as b,at as c,kt as d,rt as e,Ji as f,_h as g,Ke as h,li as i,_n as j,tn as k,gn as l,wr as m,Bi as n,Vh as o,jh as p,Zh as q,ja as r,kn as s,tl as t,ci as u,un as v,Q as w,Ra as x,rl as y,St as z}; diff --git a/assets/webworkerAll-N0VuFc6l.js b/assets/webworkerAll-Bqlno1eH.js similarity index 99% rename from assets/webworkerAll-N0VuFc6l.js rename to assets/webworkerAll-Bqlno1eH.js index 35f58b4..0fbbe53 100644 --- a/assets/webworkerAll-N0VuFc6l.js +++ b/assets/webworkerAll-Bqlno1eH.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-DCiuXFKt.js";import{T as w,S as Ce,c as X,a as ft,b as pt,B as Re}from"./colorToUniform-D10pSRDt.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-B1SCbk2d.js";import{T as w,S as Ce,c as X,a as ft,b as pt,B as Re}from"./colorToUniform-CKxzcxfm.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 0b8b846..12e00e4 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Bastion App - + diff --git a/latest_commit b/latest_commit index 93339ee..fbb1d38 100644 --- a/latest_commit +++ b/latest_commit @@ -1 +1 @@ -bba1f12 +f3fdb9f