@drincs/pixi-vn 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/CanvasManager.cjs +1 -1
- package/dist/canvas/CanvasManager.js +1 -1
- package/dist/canvas/CanvasManagerStatic.cjs +1 -1
- package/dist/canvas/CanvasManagerStatic.js +1 -1
- package/dist/canvas/components/Container.cjs +1 -1
- package/dist/canvas/components/Container.js +1 -1
- package/dist/canvas/components/ImageContainer.cjs +1 -1
- package/dist/canvas/components/ImageContainer.js +1 -1
- package/dist/canvas/components/ImageSprite.cjs +1 -1
- package/dist/canvas/components/ImageSprite.js +1 -1
- package/dist/canvas/components/Sprite.cjs +1 -1
- package/dist/canvas/components/Sprite.js +1 -1
- package/dist/canvas/components/Text.cjs +1 -1
- package/dist/canvas/components/Text.js +1 -1
- package/dist/canvas/components/VideoSprite.cjs +1 -1
- package/dist/canvas/components/VideoSprite.js +1 -1
- package/dist/canvas/decorators/canvas-element-decorator.cjs +1 -1
- package/dist/canvas/decorators/canvas-element-decorator.js +1 -1
- package/dist/canvas/decorators/event-decorator.cjs +1 -1
- package/dist/canvas/decorators/event-decorator.d.cts +1 -3
- package/dist/canvas/decorators/event-decorator.d.ts +1 -3
- package/dist/canvas/decorators/event-decorator.js +1 -1
- package/dist/canvas/functions/canvas-effect.cjs +1 -1
- package/dist/canvas/functions/canvas-effect.js +1 -1
- package/dist/canvas/functions/canvas-import-utility.cjs +1 -1
- package/dist/canvas/functions/canvas-import-utility.js +1 -1
- package/dist/canvas/functions/canvas-property-utility.cjs +1 -1
- package/dist/canvas/functions/canvas-property-utility.js +1 -1
- package/dist/canvas/functions/canvas-transition.cjs +1 -1
- package/dist/canvas/functions/canvas-transition.js +1 -1
- package/dist/canvas/functions/image-container-utility.cjs +1 -1
- package/dist/canvas/functions/image-container-utility.js +1 -1
- package/dist/canvas/functions/image-utility.cjs +1 -1
- package/dist/canvas/functions/image-utility.js +1 -1
- package/dist/canvas/functions/ticker-utility.cjs +1 -1
- package/dist/canvas/functions/ticker-utility.js +1 -1
- package/dist/canvas/functions/video-utility.cjs +1 -1
- package/dist/canvas/functions/video-utility.js +1 -1
- package/dist/canvas/index.cjs +1 -1
- package/dist/canvas/index.js +1 -1
- package/dist/canvas/tickers/classes/TickerBase.cjs +1 -1
- package/dist/canvas/tickers/classes/TickerBase.js +1 -1
- package/dist/canvas/tickers/components/FadeAlphaTicker.cjs +1 -1
- package/dist/canvas/tickers/components/FadeAlphaTicker.js +1 -1
- package/dist/canvas/tickers/components/MoveTicker.cjs +1 -1
- package/dist/canvas/tickers/components/MoveTicker.js +1 -1
- package/dist/canvas/tickers/components/RotateTicker.cjs +1 -1
- package/dist/canvas/tickers/components/RotateTicker.js +1 -1
- package/dist/canvas/tickers/components/ZoomTicker.cjs +1 -1
- package/dist/canvas/tickers/components/ZoomTicker.js +1 -1
- package/dist/canvas/tickers/decorators/ticker-decorator.cjs +1 -1
- package/dist/canvas/tickers/decorators/ticker-decorator.d.cts +1 -3
- package/dist/canvas/tickers/decorators/ticker-decorator.d.ts +1 -3
- package/dist/canvas/tickers/decorators/ticker-decorator.js +1 -1
- package/dist/canvas/tickers/index.cjs +1 -1
- package/dist/canvas/tickers/index.js +1 -1
- package/dist/character/decorators/character-decorator.cjs +1 -1
- package/dist/character/decorators/character-decorator.d.cts +1 -3
- package/dist/character/decorators/character-decorator.d.ts +1 -3
- package/dist/character/decorators/character-decorator.js +1 -1
- package/dist/character/index.cjs +1 -1
- package/dist/character/index.js +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/history/HistoryManager.cjs +1 -1
- package/dist/history/HistoryManager.d.cts +1 -1
- package/dist/history/HistoryManager.d.ts +1 -1
- package/dist/history/HistoryManager.js +1 -1
- package/dist/history/HistoryManagerStatic.d.cts +1 -1
- package/dist/history/HistoryManagerStatic.d.ts +1 -1
- package/dist/history/index.cjs +1 -1
- package/dist/history/index.d.cts +1 -1
- package/dist/history/index.d.ts +1 -1
- package/dist/history/index.js +1 -1
- package/dist/history/interfaces/HistoryGameState.d.cts +1 -1
- package/dist/history/interfaces/HistoryGameState.d.ts +1 -1
- package/dist/history/interfaces/HistoryManagerInterface.d.cts +1 -1
- package/dist/history/interfaces/HistoryManagerInterface.d.ts +1 -1
- package/dist/{index-Bo5b5ojv.d.cts → index-A4Zf-9mB.d.cts} +4 -4
- package/dist/{index-b75SF7z8.d.ts → index-DwELdyJt.d.ts} +4 -4
- package/dist/index.cjs +101 -101
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +101 -101
- package/dist/interfaces/GameState.d.cts +1 -1
- package/dist/interfaces/GameState.d.ts +1 -1
- package/dist/interfaces/index.d.cts +1 -1
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/narration/NarrationManager.cjs +32 -32
- package/dist/narration/NarrationManager.d.cts +7 -7
- package/dist/narration/NarrationManager.d.ts +7 -7
- package/dist/narration/NarrationManager.js +32 -32
- package/dist/narration/NarrationManagerStatic.cjs +51 -51
- package/dist/narration/NarrationManagerStatic.d.cts +1 -1
- package/dist/narration/NarrationManagerStatic.d.ts +1 -1
- package/dist/narration/NarrationManagerStatic.js +51 -51
- package/dist/narration/classes/ChoiceMenuOption.cjs +1 -1
- package/dist/narration/classes/ChoiceMenuOption.js +1 -1
- package/dist/narration/classes/CloseLabel.cjs +1 -1
- package/dist/narration/classes/CloseLabel.d.cts +1 -1
- package/dist/narration/classes/CloseLabel.d.ts +1 -1
- package/dist/narration/classes/CloseLabel.js +1 -1
- package/dist/narration/classes/Label.cjs +1 -1
- package/dist/narration/classes/Label.js +1 -1
- package/dist/narration/classes/LabelAbstract.cjs +1 -1
- package/dist/narration/classes/LabelAbstract.d.cts +2 -6
- package/dist/narration/classes/LabelAbstract.d.ts +2 -6
- package/dist/narration/classes/LabelAbstract.js +1 -1
- package/dist/narration/decorators/label-decorator.cjs +1 -1
- package/dist/narration/decorators/label-decorator.d.cts +17 -28
- package/dist/narration/decorators/label-decorator.d.ts +17 -28
- package/dist/narration/decorators/label-decorator.js +1 -1
- package/dist/narration/decorators/newLabel.cjs +1 -0
- package/dist/narration/decorators/newLabel.d.cts +18 -0
- package/dist/narration/decorators/newLabel.d.ts +18 -0
- package/dist/narration/decorators/newLabel.js +1 -0
- package/dist/narration/index.cjs +49 -49
- package/dist/narration/index.d.cts +3 -2
- package/dist/narration/index.d.ts +3 -2
- package/dist/narration/index.js +49 -49
- package/dist/narration/interfaces/HistoryStep.d.cts +1 -1
- package/dist/narration/interfaces/HistoryStep.d.ts +1 -1
- package/dist/narration/interfaces/NarrationGameState.d.cts +1 -1
- package/dist/narration/interfaces/NarrationGameState.d.ts +1 -1
- package/dist/narration/interfaces/NarrationManagerInterface.d.cts +7 -7
- package/dist/narration/interfaces/NarrationManagerInterface.d.ts +7 -7
- package/dist/narration/types/ChoiceMenuOptionsType.d.cts +1 -1
- package/dist/narration/types/ChoiceMenuOptionsType.d.ts +1 -1
- package/dist/pixi-devtools/additionalPositionsProperties.cjs +1 -1
- package/dist/pixi-devtools/additionalPositionsProperties.js +1 -1
- package/dist/sound/SoundManager.cjs +48 -48
- package/dist/sound/SoundManager.js +48 -48
- package/dist/sound/index.cjs +48 -48
- package/dist/sound/index.js +48 -48
- package/package.json +1 -1
|
@@ -566,4 +566,4 @@ fn mainFragment(
|
|
|
566
566
|
|
|
567
567
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
568
568
|
|
|
569
|
-
`}};});var xh,gh,go,um=p(()=>{Q();Ms();nm();Rs();si();ge();mt();lm();go=class extends Qt{constructor(){xh??(xh=nr({name:"tiling-sprite-shader",bits:[Ti,am,hr]})),gh??(gh=ar({name:"tiling-sprite-shader",bits:[om,hm,lr]}));let t=new St({uMapCoord:{value:new C,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new C,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:gh,gpuProgram:xh,resources:{localUniforms:new St({uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}});}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(i.a*h/t,i.b*h/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var _o,cm=p(()=>{xo();_o=class extends Sr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function dm(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height;}var fm=p(()=>{});function pm(r,t,e,i){let s=0,o=r.length/(t),n=i.a,a=i.b,h=i.c,l=i.d,u=i.tx,c=i.ty;for(e*=t;s<o;){let f=r[e],d=r[e+1];r[e]=n*f+h*d+u,r[e+1]=a*f+l*d+c,e+=t,s++;}}var mm=p(()=>{});function xm(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=C.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),pm(t,2,0,a);}var gm=p(()=>{Q();mm();});var yo,Si,_m=p(()=>{R();ti();Ws();ii();hi();Vs();xo();um();cm();fm();gm();yo=new _o,Si=class{constructor(t){this._state=Ue.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e);}else i.break(e),s.shader||(s.shader=new go),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,i.uColor,0),this._state.blendMode=oe(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yo,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Sr({indices:yo.indices,positions:yo.positions.slice(),uvs:yo.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),xm(t,i.uvs),dm(t,i.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=true;return this._renderer.type===Zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};Si.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var _h=p(()=>{R();_m();G.add(Si);});var ym,vm,Tm=p(()=>{st();xo();ym=class bm extends Sr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(F(L,"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={...bm.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;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;i.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,g=d*this.verticesX+f+1,x=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,g,x,g,_,x);}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};ym.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};vm=ym;});var Sm,Pm,Cm=p(()=>{Tm();Sm=class wm extends vm{constructor(t={}){t={...wm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=i>f?1:i/f,m=Math.min(c,d),g=h*e,x=l*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*m-x,t[17]=t[19]=t[21]=t[23]=i-a*m-x,t[25]=t[27]=t[29]=t[31]=i-x,this.getBuffer("aPosition").update();}updateUvs(){let 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;let 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();}};Sm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Pm=Sm;});var wi,Mm=p(()=>{R();It();Vs();Cm();wi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(ye);return e.geometry=z.get(Pm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};wi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var yh=p(()=>{R();Mm();G.add(wi);});var Pi,Am=p(()=>{R();Pi=class{constructor(t){this._renderer=t;}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Pi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function Em(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Bm=p(()=>{});var d_,Ci,km=p(()=>{R();Q();Ht();Jr();ri();ge();mt();Xe();ii();zt();Bm();_t();d_=new qt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ci=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Gt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Em(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<i.length;d++){let m=i[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=B.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,false),yt.returnTexture(i);else {let a=e.inputTexture,h=yt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=yt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,u=n.previousRenderSurface===i,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,g=m.uOutputFrame,x=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,b=m.uGlobalFrame,v=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}g[0]=a.minX-h.x,g[1]=a.minY-h.y;}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*x[2]-.5*_[2],y[3]=e.frame.height*x[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*c,b[1]=h.y*c,b[2]=P.source.width*c,b[3]=P.source.height*c;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(v[0]=i.frame.width,v[1]=i.frame.height):(v[0]=S.width,v[1]=S.height),v[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:d_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Zt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new et,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(C.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ci.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var bh=p(()=>{R();Am();km();G.add(Ci);G.add(Pi);});var f_={};var Rm=p(()=>{fu();yn();vu();Su();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});var p_={};var Im=p(()=>{yn();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});R();var Fm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Rm(),f_));}};R();var Gm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Im(),p_));}};R();R();ps();hs();Li();st();ns();var bo=class extends de{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...u}=t;super({...u}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new ft({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),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){t||(t={}),this._style?.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 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);}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Dm(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(F(L,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}no();yr();var He=class extends bo{constructor(...t){let e=Dm(t,"Text");super(e,Mt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Ut.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};Mn();Wt();On();je();Fn();Wr();At();as();Gi(ma());G.add(Fm,Gm);var te={};sx(te,{DistortionFilter:()=>vo,EqualizerFilter:()=>Lt,Filter:()=>lt,MonoFilter:()=>To,ReverbFilter:()=>So,StereoFilter:()=>wo,StreamFilter:()=>Po,TelephoneFilter:()=>Co});var Um;function Lm(r){return Um=r,r}function X(){return Um}var lt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var vo=class extends lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let i=X().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:j.F32,type:"lowshelf",gain:r},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:i},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(u=c.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);at.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(j.F32,r);}get f32(){return this.getGain(j.F32)}set f64(r){this.setGain(j.F64,r);}get f64(){return this.getGain(j.F64)}set f125(r){this.setGain(j.F125,r);}get f125(){return this.getGain(j.F125)}set f250(r){this.setGain(j.F250,r);}get f250(){return this.getGain(j.F250)}set f500(r){this.setGain(j.F500,r);}get f500(){return this.getGain(j.F500)}set f1k(r){this.setGain(j.F1K,r);}get f1k(){return this.getGain(j.F1K)}set f2k(r){this.setGain(j.F2K,r);}get f2k(){return this.getGain(j.F2K)}set f4k(r){this.setGain(j.F4K,r);}get f4k(){return this.getGain(j.F4K)}set f8k(r){this.setGain(j.F8K,r);}get f8k(){return this.getGain(j.F8K)}set f16k(r){this.setGain(j.F16K,r);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(r=>{at.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=j;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var To=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var So=class extends lt{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(X().useLegacy)return;let{audioContext:t}=X().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var wo=class extends lt{constructor(t=0){let e,i,s;if(!X().useLegacy){let{audioContext:o}=X().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Po=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Co=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var Mi=class extends ${constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var x_=0,vh=class extends ${constructor(r){super(),this.id=x_++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-vh.PADDING),this._end=Math.min(this._end+vh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ht.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ht.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ht.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=vh;Mo.PADDING=.1;var Ai=class extends ${init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var Ei=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var ze=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Th=["audio/mpeg","audio/ogg"],We={};function Om(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;ze.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(We,i);}Om();var __=0,Bi=class extends ${constructor(t){super(),this.id=__++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*i),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ht.shared.remove(this._updateListener,this),t&&ht.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Hm=class extends Ve{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Hm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,at.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Ao=Hm;Ao.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Ao(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Bi(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await rt.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var wr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=X().useLegacy?new Ai:new Ne;return new wr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:Ct.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,i)=>ze.indexOf(e.ext)-ze.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return X().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new Ei(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(wr._pool.length>0){let r=wr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),wr._pool.indexOf(r)<0&&wr._pool.push(r);}},ve=wr;ve._pool=[];var Pr=class r extends Ve{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new $,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var Eo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Mi,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Pr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let i=this._getOptions(e),s=ve.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var zm=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=Ct.basename(t,Ct.extname(t))),e},Wm={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...ze.filter(t=>We[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:Ze.High},test(r){let t=Ct.extname(r).slice(1);return !!We[t]||Th.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>ve.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return X().add(zm(t),e),e},async unload(r,t){X().remove(zm(t));}}};G.add(Wm);Lm(new Eo);({DistortionFilter:te.DistortionFilter,EqualizerFilter:te.EqualizerFilter,MonoFilter:te.MonoFilter,ReverbFilter:te.ReverbFilter,StereoFilter:te.StereoFilter,StreamFilter:te.StreamFilter,TelephoneFilter:te.TelephoneFilter});var Cr="Container";var Vm="Sprite",Mr="Text";var ct;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(ct||={});var Sh={};function Bo(r,t){t||(t=r.name),Sh[t]&&ct.warn(`CanvasElement ${t} already registered`),r.prototype.pixivnId=t,Sh[t]=r;}function Nm(r){try{let t=Sh[r];if(!t){ct.error(`CanvasElement ${r} not found, did you forget to register it with the canvasComponentDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var $m={};function Ym(r){try{let t=$m[r];if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function ko(r){try{let t=$m[r];if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function wh(r,t){let e=r.source.label;return {url:e,alias:t===e?void 0:t}}function Xm(r,t){if(!(r instanceof Object))return r;ct.warn(`Text.style.${t} is a FillGradient or FillPattern, this is not supported yet.`,r);}function jm(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:Xm(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:Xm(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}function T_(r){return "memory"in r?r.memory:r instanceof He?Ph(r):r instanceof pe?S_(r):ki(r)}function ki(r,t){let e=Cr,i=t?.childrenExport||false;r.hasOwnProperty("pixivnId")&&(e=r.pixivnId);let s=[];return i&&r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).forEach(o=>{s.push(T_(o));}),{pixivnId:e,elements:s,width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function S_(r){let t=ki(r),e=t.pixivnId??Vm,i={};"onEvents"in r&&(i=r.onEvents);let s;return "textureAlias"in r?s=wh(r.texture,r.textureAlias):s=wh(r.texture),{...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function Ph(r){let t=ki(r),e=t.pixivnId??Mr,i={};return "onEvents"in r&&(i=r.onEvents),{...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:jm(r.style),roundPixels:r.roundPixels,onEvents:i}}async function Km(r){let t=w_(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function w_(r){try{let t=Nm(r);return t?new t:void 0}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var Ro=class extends Pt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Cr;}pixivnId=Cr;get memory(){return ki(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ch(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await Km(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Ro,Cr);async function Ch(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var Fo=class extends He{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Mr;}pixivnId=Mr;get memory(){return Ph(this)}set memory(t){}async setMemory(t){return this.memory=t,await P_(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Fo,Mr);async function P_(r,t){if(await Ch(r,t),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"text"in t&&t.text!==void 0&&(r.text=t.text),"resolution"in t&&t.resolution!==void 0&&(r.resolution=t.resolution),"style"in t&&t.style!==void 0&&(r.style=t.style),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let e in t.onEvents){let i=t.onEvents[e],s=Ym(i);s&&r.onEvent(e,s);}}exports.default=Fo;exports.setMemoryText=P_;
|
|
569
|
+
`}};});var xh,gh,go,um=p(()=>{Q();Ms();nm();Rs();si();ge();mt();lm();go=class extends Qt{constructor(){xh??(xh=nr({name:"tiling-sprite-shader",bits:[Ti,am,hr]})),gh??(gh=ar({name:"tiling-sprite-shader",bits:[om,hm,lr]}));let t=new St({uMapCoord:{value:new C,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new C,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:gh,gpuProgram:xh,resources:{localUniforms:new St({uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}});}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(i.a*h/t,i.b*h/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var _o,cm=p(()=>{xo();_o=class extends Sr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function dm(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height;}var fm=p(()=>{});function pm(r,t,e,i){let s=0,o=r.length/(t),n=i.a,a=i.b,h=i.c,l=i.d,u=i.tx,c=i.ty;for(e*=t;s<o;){let f=r[e],d=r[e+1];r[e]=n*f+h*d+u,r[e+1]=a*f+l*d+c,e+=t,s++;}}var mm=p(()=>{});function xm(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=C.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),pm(t,2,0,a);}var gm=p(()=>{Q();mm();});var yo,Si,_m=p(()=>{R();ti();Ws();ii();hi();Vs();xo();um();cm();fm();gm();yo=new _o,Si=class{constructor(t){this._state=Ue.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e);}else i.break(e),s.shader||(s.shader=new go),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,i.uColor,0),this._state.blendMode=oe(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yo,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Sr({indices:yo.indices,positions:yo.positions.slice(),uvs:yo.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),xm(t,i.uvs),dm(t,i.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=true;return this._renderer.type===Zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};Si.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var _h=p(()=>{R();_m();G.add(Si);});var ym,vm,Tm=p(()=>{st();xo();ym=class bm extends Sr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(F(L,"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={...bm.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;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;i.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,g=d*this.verticesX+f+1,x=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,g,x,g,_,x);}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};ym.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};vm=ym;});var Sm,Pm,Cm=p(()=>{Tm();Sm=class wm extends vm{constructor(t={}){t={...wm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=i>f?1:i/f,m=Math.min(c,d),g=h*e,x=l*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*m-x,t[17]=t[19]=t[21]=t[23]=i-a*m-x,t[25]=t[27]=t[29]=t[31]=i-x,this.getBuffer("aPosition").update();}updateUvs(){let 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;let 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();}};Sm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Pm=Sm;});var wi,Mm=p(()=>{R();It();Vs();Cm();wi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(ye);return e.geometry=z.get(Pm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};wi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var yh=p(()=>{R();Mm();G.add(wi);});var Pi,Am=p(()=>{R();Pi=class{constructor(t){this._renderer=t;}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Pi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function Em(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Bm=p(()=>{});var d_,Ci,km=p(()=>{R();Q();Ht();Jr();ri();ge();mt();Xe();ii();zt();Bm();_t();d_=new qt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ci=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Gt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Em(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<i.length;d++){let m=i[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=B.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,false),yt.returnTexture(i);else {let a=e.inputTexture,h=yt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=yt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,u=n.previousRenderSurface===i,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,g=m.uOutputFrame,x=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,b=m.uGlobalFrame,v=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}g[0]=a.minX-h.x,g[1]=a.minY-h.y;}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*x[2]-.5*_[2],y[3]=e.frame.height*x[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*c,b[1]=h.y*c,b[2]=P.source.width*c,b[3]=P.source.height*c;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(v[0]=i.frame.width,v[1]=i.frame.height):(v[0]=S.width,v[1]=S.height),v[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:d_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Zt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new et,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(C.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ci.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var bh=p(()=>{R();Am();km();G.add(Ci);G.add(Pi);});var f_={};var Rm=p(()=>{fu();yn();vu();Su();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});var p_={};var Im=p(()=>{yn();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});R();var Fm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Rm(),f_));}};R();var Gm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Im(),p_));}};R();R();ps();hs();Li();st();ns();var bo=class extends de{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...u}=t;super({...u}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new ft({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),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){t||(t={}),this._style?.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 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);}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Dm(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(F(L,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}no();yr();var He=class extends bo{constructor(...t){let e=Dm(t,"Text");super(e,Mt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Ut.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};Mn();Wt();On();je();Fn();Wr();At();as();Gi(ma());G.add(Fm,Gm);var te={};sx(te,{DistortionFilter:()=>vo,EqualizerFilter:()=>Lt,Filter:()=>lt,MonoFilter:()=>To,ReverbFilter:()=>So,StereoFilter:()=>wo,StreamFilter:()=>Po,TelephoneFilter:()=>Co});var Um;function Lm(r){return Um=r,r}function X(){return Um}var lt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var vo=class extends lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let i=X().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:j.F32,type:"lowshelf",gain:r},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:i},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(u=c.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);at.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(j.F32,r);}get f32(){return this.getGain(j.F32)}set f64(r){this.setGain(j.F64,r);}get f64(){return this.getGain(j.F64)}set f125(r){this.setGain(j.F125,r);}get f125(){return this.getGain(j.F125)}set f250(r){this.setGain(j.F250,r);}get f250(){return this.getGain(j.F250)}set f500(r){this.setGain(j.F500,r);}get f500(){return this.getGain(j.F500)}set f1k(r){this.setGain(j.F1K,r);}get f1k(){return this.getGain(j.F1K)}set f2k(r){this.setGain(j.F2K,r);}get f2k(){return this.getGain(j.F2K)}set f4k(r){this.setGain(j.F4K,r);}get f4k(){return this.getGain(j.F4K)}set f8k(r){this.setGain(j.F8K,r);}get f8k(){return this.getGain(j.F8K)}set f16k(r){this.setGain(j.F16K,r);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(r=>{at.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=j;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var To=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var So=class extends lt{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(X().useLegacy)return;let{audioContext:t}=X().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var wo=class extends lt{constructor(t=0){let e,i,s;if(!X().useLegacy){let{audioContext:o}=X().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Po=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Co=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var Mi=class extends ${constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var x_=0,vh=class extends ${constructor(r){super(),this.id=x_++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-vh.PADDING),this._end=Math.min(this._end+vh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ht.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ht.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ht.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=vh;Mo.PADDING=.1;var Ai=class extends ${init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var Ei=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var ze=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Th=["audio/mpeg","audio/ogg"],We={};function Om(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;ze.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(We,i);}Om();var __=0,Bi=class extends ${constructor(t){super(),this.id=__++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*i),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ht.shared.remove(this._updateListener,this),t&&ht.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Hm=class extends Ve{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Hm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,at.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Ao=Hm;Ao.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Ao(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Bi(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await rt.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var wr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=X().useLegacy?new Ai:new Ne;return new wr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:Ct.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,i)=>ze.indexOf(e.ext)-ze.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return X().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new Ei(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(wr._pool.length>0){let r=wr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),wr._pool.indexOf(r)<0&&wr._pool.push(r);}},ve=wr;ve._pool=[];var Pr=class r extends Ve{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new $,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var Eo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Mi,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Pr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let i=this._getOptions(e),s=ve.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var zm=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=Ct.basename(t,Ct.extname(t))),e},Wm={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...ze.filter(t=>We[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:Ze.High},test(r){let t=Ct.extname(r).slice(1);return !!We[t]||Th.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>ve.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return X().add(zm(t),e),e},async unload(r,t){X().remove(zm(t));}}};G.add(Wm);Lm(new Eo);({DistortionFilter:te.DistortionFilter,EqualizerFilter:te.EqualizerFilter,MonoFilter:te.MonoFilter,ReverbFilter:te.ReverbFilter,StereoFilter:te.StereoFilter,StreamFilter:te.StreamFilter,TelephoneFilter:te.TelephoneFilter});var Cr="Container";var Vm="Sprite",Mr="Text";var ct;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(ct||={});var Sh=new Map;function Bo(r,t){t||(t=r.name),Sh.get(t)&&ct.warn(`CanvasElement ${t} already registered`),r.prototype.pixivnId=t,Sh.set(t,r);}function Nm(r){try{let t=Sh.get(r);if(!t){ct.error(`CanvasElement ${r} not found, did you forget to register it with the canvasComponentDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var $m=new Map;function Ym(r){try{let t=$m.get(r);if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function ko(r){try{let t=$m.get(r);if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function wh(r,t){let e=r.source.label;return {url:e,alias:t===e?void 0:t}}function Xm(r,t){if(!(r instanceof Object))return r;ct.warn(`Text.style.${t} is a FillGradient or FillPattern, this is not supported yet.`,r);}function jm(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:Xm(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:Xm(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}function T_(r){return "memory"in r?r.memory:r instanceof He?Ph(r):r instanceof pe?S_(r):ki(r)}function ki(r,t){let e=Cr,i=t?.childrenExport||false;r.hasOwnProperty("pixivnId")&&(e=r.pixivnId);let s=[];return i&&r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).forEach(o=>{s.push(T_(o));}),{pixivnId:e,elements:s,width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function S_(r){let t=ki(r),e=t.pixivnId??Vm,i={};"onEvents"in r&&(i=r.onEvents);let s;return "textureAlias"in r?s=wh(r.texture,r.textureAlias):s=wh(r.texture),{...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function Ph(r){let t=ki(r),e=t.pixivnId??Mr,i={};return "onEvents"in r&&(i=r.onEvents),{...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:jm(r.style),roundPixels:r.roundPixels,onEvents:i}}async function Km(r){let t=w_(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function w_(r){try{let t=Nm(r);return t?new t:void 0}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var Ro=class extends Pt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Cr;}pixivnId=Cr;get memory(){return ki(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ch(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await Km(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Ro,Cr);async function Ch(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var Fo=class extends He{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Mr;}pixivnId=Mr;get memory(){return Ph(this)}set memory(t){}async setMemory(t){return this.memory=t,await P_(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Fo,Mr);async function P_(r,t){if(await Ch(r,t),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"text"in t&&t.text!==void 0&&(r.text=t.text),"resolution"in t&&t.resolution!==void 0&&(r.resolution=t.resolution),"style"in t&&t.style!==void 0&&(r.style=t.style),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let e in t.onEvents){let i=t.onEvents[e],s=Ym(i);s&&r.onEvent(e,s);}}exports.default=Fo;exports.setMemoryText=P_;
|
|
@@ -566,4 +566,4 @@ fn mainFragment(
|
|
|
566
566
|
|
|
567
567
|
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
568
568
|
|
|
569
|
-
`}};});var xh,gh,go,um=p(()=>{Q();Ms();nm();Rs();si();ge();mt();lm();go=class extends Qt{constructor(){xh??(xh=nr({name:"tiling-sprite-shader",bits:[Ti,am,hr]})),gh??(gh=ar({name:"tiling-sprite-shader",bits:[om,hm,lr]}));let t=new St({uMapCoord:{value:new C,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new C,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:gh,gpuProgram:xh,resources:{localUniforms:new St({uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}});}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(i.a*h/t,i.b*h/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var _o,cm=p(()=>{xo();_o=class extends Sr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function dm(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height;}var fm=p(()=>{});function pm(r,t,e,i){let s=0,o=r.length/(t),n=i.a,a=i.b,h=i.c,l=i.d,u=i.tx,c=i.ty;for(e*=t;s<o;){let f=r[e],d=r[e+1];r[e]=n*f+h*d+u,r[e+1]=a*f+l*d+c,e+=t,s++;}}var mm=p(()=>{});function xm(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=C.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),pm(t,2,0,a);}var gm=p(()=>{Q();mm();});var yo,Si,_m=p(()=>{R();ti();Ws();ii();hi();Vs();xo();um();cm();fm();gm();yo=new _o,Si=class{constructor(t){this._state=Ue.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e);}else i.break(e),s.shader||(s.shader=new go),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,i.uColor,0),this._state.blendMode=oe(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yo,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Sr({indices:yo.indices,positions:yo.positions.slice(),uvs:yo.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),xm(t,i.uvs),dm(t,i.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=true;return this._renderer.type===Zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};Si.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var _h=p(()=>{R();_m();G.add(Si);});var ym,vm,Tm=p(()=>{st();xo();ym=class bm extends Sr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(F(L,"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={...bm.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;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;i.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,g=d*this.verticesX+f+1,x=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,g,x,g,_,x);}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};ym.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};vm=ym;});var Sm,Pm,Cm=p(()=>{Tm();Sm=class wm extends vm{constructor(t={}){t={...wm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=i>f?1:i/f,m=Math.min(c,d),g=h*e,x=l*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*m-x,t[17]=t[19]=t[21]=t[23]=i-a*m-x,t[25]=t[27]=t[29]=t[31]=i-x,this.getBuffer("aPosition").update();}updateUvs(){let 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;let 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();}};Sm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Pm=Sm;});var wi,Mm=p(()=>{R();It();Vs();Cm();wi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(ye);return e.geometry=z.get(Pm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};wi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var yh=p(()=>{R();Mm();G.add(wi);});var Pi,Am=p(()=>{R();Pi=class{constructor(t){this._renderer=t;}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Pi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function Em(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Bm=p(()=>{});var d_,Ci,km=p(()=>{R();Q();Ht();Jr();ri();ge();mt();Xe();ii();zt();Bm();_t();d_=new qt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ci=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Gt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Em(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<i.length;d++){let m=i[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=B.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,false),yt.returnTexture(i);else {let a=e.inputTexture,h=yt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=yt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,u=n.previousRenderSurface===i,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,g=m.uOutputFrame,x=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,b=m.uGlobalFrame,v=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}g[0]=a.minX-h.x,g[1]=a.minY-h.y;}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*x[2]-.5*_[2],y[3]=e.frame.height*x[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*c,b[1]=h.y*c,b[2]=P.source.width*c,b[3]=P.source.height*c;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(v[0]=i.frame.width,v[1]=i.frame.height):(v[0]=S.width,v[1]=S.height),v[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:d_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Zt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new et,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(C.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ci.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var bh=p(()=>{R();Am();km();G.add(Ci);G.add(Pi);});var f_={};var Rm=p(()=>{fu();yn();vu();Su();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});var p_={};var Im=p(()=>{yn();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});R();var Fm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Rm(),f_));}};R();var Gm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Im(),p_));}};R();R();ps();hs();Li();st();ns();var bo=class extends de{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...u}=t;super({...u}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new ft({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),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){t||(t={}),this._style?.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 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);}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Dm(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(F(L,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}no();yr();var He=class extends bo{constructor(...t){let e=Dm(t,"Text");super(e,Mt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Ut.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};Mn();Wt();On();je();Fn();Wr();At();as();Gi(ma());G.add(Fm,Gm);var te={};sx(te,{DistortionFilter:()=>vo,EqualizerFilter:()=>Lt,Filter:()=>lt,MonoFilter:()=>To,ReverbFilter:()=>So,StereoFilter:()=>wo,StreamFilter:()=>Po,TelephoneFilter:()=>Co});var Um;function Lm(r){return Um=r,r}function X(){return Um}var lt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var vo=class extends lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let i=X().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:j.F32,type:"lowshelf",gain:r},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:i},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(u=c.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);at.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(j.F32,r);}get f32(){return this.getGain(j.F32)}set f64(r){this.setGain(j.F64,r);}get f64(){return this.getGain(j.F64)}set f125(r){this.setGain(j.F125,r);}get f125(){return this.getGain(j.F125)}set f250(r){this.setGain(j.F250,r);}get f250(){return this.getGain(j.F250)}set f500(r){this.setGain(j.F500,r);}get f500(){return this.getGain(j.F500)}set f1k(r){this.setGain(j.F1K,r);}get f1k(){return this.getGain(j.F1K)}set f2k(r){this.setGain(j.F2K,r);}get f2k(){return this.getGain(j.F2K)}set f4k(r){this.setGain(j.F4K,r);}get f4k(){return this.getGain(j.F4K)}set f8k(r){this.setGain(j.F8K,r);}get f8k(){return this.getGain(j.F8K)}set f16k(r){this.setGain(j.F16K,r);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(r=>{at.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=j;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var To=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var So=class extends lt{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(X().useLegacy)return;let{audioContext:t}=X().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var wo=class extends lt{constructor(t=0){let e,i,s;if(!X().useLegacy){let{audioContext:o}=X().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Po=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Co=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var Mi=class extends ${constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var x_=0,vh=class extends ${constructor(r){super(),this.id=x_++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-vh.PADDING),this._end=Math.min(this._end+vh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ht.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ht.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ht.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=vh;Mo.PADDING=.1;var Ai=class extends ${init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var Ei=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var ze=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Th=["audio/mpeg","audio/ogg"],We={};function Om(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;ze.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(We,i);}Om();var __=0,Bi=class extends ${constructor(t){super(),this.id=__++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*i),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ht.shared.remove(this._updateListener,this),t&&ht.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Hm=class extends Ve{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Hm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,at.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Ao=Hm;Ao.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Ao(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Bi(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await rt.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var wr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=X().useLegacy?new Ai:new Ne;return new wr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:Ct.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,i)=>ze.indexOf(e.ext)-ze.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return X().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new Ei(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(wr._pool.length>0){let r=wr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),wr._pool.indexOf(r)<0&&wr._pool.push(r);}},ve=wr;ve._pool=[];var Pr=class r extends Ve{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new $,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var Eo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Mi,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Pr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let i=this._getOptions(e),s=ve.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var zm=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=Ct.basename(t,Ct.extname(t))),e},Wm={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...ze.filter(t=>We[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:Ze.High},test(r){let t=Ct.extname(r).slice(1);return !!We[t]||Th.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>ve.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return X().add(zm(t),e),e},async unload(r,t){X().remove(zm(t));}}};G.add(Wm);Lm(new Eo);({DistortionFilter:te.DistortionFilter,EqualizerFilter:te.EqualizerFilter,MonoFilter:te.MonoFilter,ReverbFilter:te.ReverbFilter,StereoFilter:te.StereoFilter,StreamFilter:te.StreamFilter,TelephoneFilter:te.TelephoneFilter});var Cr="Container";var Vm="Sprite",Mr="Text";var ct;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(ct||={});var Sh={};function Bo(r,t){t||(t=r.name),Sh[t]&&ct.warn(`CanvasElement ${t} already registered`),r.prototype.pixivnId=t,Sh[t]=r;}function Nm(r){try{let t=Sh[r];if(!t){ct.error(`CanvasElement ${r} not found, did you forget to register it with the canvasComponentDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var $m={};function Ym(r){try{let t=$m[r];if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function ko(r){try{let t=$m[r];if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function wh(r,t){let e=r.source.label;return {url:e,alias:t===e?void 0:t}}function Xm(r,t){if(!(r instanceof Object))return r;ct.warn(`Text.style.${t} is a FillGradient or FillPattern, this is not supported yet.`,r);}function jm(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:Xm(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:Xm(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}function T_(r){return "memory"in r?r.memory:r instanceof He?Ph(r):r instanceof pe?S_(r):ki(r)}function ki(r,t){let e=Cr,i=t?.childrenExport||false;r.hasOwnProperty("pixivnId")&&(e=r.pixivnId);let s=[];return i&&r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).forEach(o=>{s.push(T_(o));}),{pixivnId:e,elements:s,width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function S_(r){let t=ki(r),e=t.pixivnId??Vm,i={};"onEvents"in r&&(i=r.onEvents);let s;return "textureAlias"in r?s=wh(r.texture,r.textureAlias):s=wh(r.texture),{...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function Ph(r){let t=ki(r),e=t.pixivnId??Mr,i={};return "onEvents"in r&&(i=r.onEvents),{...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:jm(r.style),roundPixels:r.roundPixels,onEvents:i}}async function Km(r){let t=w_(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function w_(r){try{let t=Nm(r);return t?new t:void 0}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var Ro=class extends Pt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Cr;}pixivnId=Cr;get memory(){return ki(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ch(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await Km(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Ro,Cr);async function Ch(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var Fo=class extends He{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Mr;}pixivnId=Mr;get memory(){return Ph(this)}set memory(t){}async setMemory(t){return this.memory=t,await P_(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Fo,Mr);async function P_(r,t){if(await Ch(r,t),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"text"in t&&t.text!==void 0&&(r.text=t.text),"resolution"in t&&t.resolution!==void 0&&(r.resolution=t.resolution),"style"in t&&t.style!==void 0&&(r.style=t.style),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let e in t.onEvents){let i=t.onEvents[e],s=Ym(i);s&&r.onEvent(e,s);}}export{Fo as default,P_ as setMemoryText};
|
|
569
|
+
`}};});var xh,gh,go,um=p(()=>{Q();Ms();nm();Rs();si();ge();mt();lm();go=class extends Qt{constructor(){xh??(xh=nr({name:"tiling-sprite-shader",bits:[Ti,am,hr]})),gh??(gh=ar({name:"tiling-sprite-shader",bits:[om,hm,lr]}));let t=new St({uMapCoord:{value:new C,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new C,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:gh,gpuProgram:xh,resources:{localUniforms:new St({uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:B.EMPTY.source,uSampler:B.EMPTY.source.style}});}updateUniforms(t,e,i,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,u=n.textureMatrix,c=a.uniforms.uTextureTransform;c.set(i.a*h/t,i.b*h/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),c.invert(),a.uniforms.uMapCoord=u.mapCoord,a.uniforms.uClampFrame=u.uClampFrame,a.uniforms.uClampOffset=u.uClampOffset,a.uniforms.uTextureTransform=c,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style);}};});var _o,cm=p(()=>{xo();_o=class extends Sr{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])});}};});function dm(r,t){let e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height;}var fm=p(()=>{});function pm(r,t,e,i){let s=0,o=r.length/(t),n=i.a,a=i.b,h=i.c,l=i.d,u=i.tx,c=i.ty;for(e*=t;s<o;){let f=r[e],d=r[e+1];r[e]=n*f+h*d+u,r[e+1]=a*f+l*d+c,e+=t,s++;}}var mm=p(()=>{});function xm(r,t){let e=r.texture,i=e.frame.width,s=e.frame.height,o=0,n=0;r.applyAnchorToTexture&&(o=r.anchor.x,n=r.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=C.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/i,r.height/s),pm(t,2,0,a);}var gm=p(()=>{Q();mm();});var yo,Si,_m=p(()=>{R();ti();Ws();ii();hi();Vs();xo();um();cm();fm();gm();yo=new _o,Si=class{constructor(t){this._state=Ue.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash");}validateRenderable(t){let e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===i){let{batchableMesh:o}=e;return !o._batcher.checkAndUpdateTexture(o,t.texture)}return i!==s}addRenderable(t,e){let i=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new ye);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(a,e);}else i.break(e),s.shader||(s.shader=new go),this.updateRenderable(t),e.add(t);}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,_e(t.groupColorAlpha,i.uColor,0),this._state.blendMode=oe(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:yo,shader:e,state:this._state});}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s);}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture);}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Sr({indices:yo.indices,positions:yo.positions.slice(),uvs:yo.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:true,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),xm(t,i.uvs),dm(t,i.positions);}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null;}_updateCanBatch(t){let e=this._getTilingSpriteData(t),i=t.texture,s=true;return this._renderer.type===Zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}};Si.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"tilingSprite"};});var _h=p(()=>{R();_m();G.add(Si);});var ym,vm,Tm=p(()=>{st();xo();ym=class bm extends Sr{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(F(L,"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={...bm.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;let e=this.verticesX*this.verticesY,i=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let c=0;c<e;c++){let f=c%this.verticesX,d=c/this.verticesX|0;i.push(f*h,d*l),s.push(f/n,d/a);}let u=n*a;for(let c=0;c<u;c++){let f=c%n,d=c/n|0,m=d*this.verticesX+f,g=d*this.verticesX+f+1,x=(d+1)*this.verticesX+f,_=(d+1)*this.verticesX+f+1;o.push(m,g,x,g,_,x);}this.buffers[0].data=new Float32Array(i),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update();}};ym.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};vm=ym;});var Sm,Pm,Cm=p(()=>{Tm();Sm=class wm extends vm{constructor(t={}){t={...wm.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t);}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions();}updatePositions(){let t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,u=s+o,c=e>u?1:e/u,f=n+a,d=i>f?1:i/f,m=Math.min(c,d),g=h*e,x=l*i;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*m-x,t[17]=t[19]=t[21]=t[23]=i-a*m-x,t[25]=t[27]=t[29]=t[31]=i-x,this.getBuffer("aPosition").update();}updateUvs(){let 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;let 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();}};Sm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};Pm=Sm;});var wi,Mm=p(()=>{R();It();Vs();Cm();wi=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash");}addRenderable(t,e){let i=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e);}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e);}validateRenderable(t){let e=this._getGpuSprite(t);return !e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];z.return(e.geometry),z.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound);}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture);}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=z.get(ye);return e.geometry=z.get(Pm),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null;}};wi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"nineSliceSprite"};});var yh=p(()=>{R();Mm();G.add(wi);});var Pi,Am=p(()=>{R();Pi=class{constructor(t){this._renderer=t;}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:false,action:"pushFilter",container:e,filterEffect:t});}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:false});}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop();}destroy(){this._renderer=null;}};Pi.extension={type:[T.WebGLPipes,T.WebGPUPipes,T.CanvasPipes],name:"filter"};});function Em(r,t){t.clear();let e=t.matrix;for(let i=0;i<r.length;i++){let s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds));}return t.matrix=e,t}var Bm=p(()=>{});var d_,Ci,km=p(()=>{R();Q();Ht();Jr();ri();ge();mt();Xe();ii();zt();Bm();_t();d_=new qt({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Ci=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new St({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Gt({}),this.renderer=t;}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,i=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,i.length===0){s.skip=true;return}let o=s.bounds;if(t.renderables?Em(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(true,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m);}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=true,u=false,c=false,f=true;for(let d=0;d<i.length;d++){let m=i[d];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),h+=m.padding,m.antialias==="off"?l=false:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(f=false),!!!(m.compatibleRenderers&e.type)){c=false;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??true)){O("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),c=false;break}c=m.enabled||c,u||(u=m.blendRequired);}if(!c){s.skip=true;return}if(f){let d=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,d.width/m,0,d.height/m);}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=true;return}s.skip=false,s.bounds=o,s.blendRequired=u,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=yt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,true),e.globalUniforms.push({offset:o});}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let i=e.inputTexture,s=e.bounds,o=B.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a);}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,i,e.previousRenderSurface,false),yt.returnTexture(i);else {let a=e.inputTexture,h=yt.getOptimalTexture(s.width,s.height,a.source._resolution,false),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,true);let c=a;a=h,h=c;}n[l].apply(this,a,e.previousRenderSurface,false),yt.returnTexture(a),yt.returnTexture(h);}e.blendRequired&&yt.returnTexture(o);}getBackTexture(t,e,i){let s=t.colorTexture.source._resolution,o=yt.getOptimalTexture(e.width,e.height,s,false),n=e.minX,a=e.minY;i&&(n-=i.minX,a-=i.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,i,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=V.shared,u=n.previousRenderSurface===i,c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._filterStackIndex-1;for(;f>0&&this._filterStack[f].skip;)--f;f>0&&(c=this._filterStack[f].inputTexture.source._resolution);let d=this._filterGlobalUniforms,m=d.uniforms,g=m.uOutputFrame,x=m.uInputSize,_=m.uInputPixel,y=m.uInputClamp,b=m.uGlobalFrame,v=m.uOutputTexture;if(u){let w=this._filterStackIndex;for(;w>0;){w--;let E=this._filterStack[this._filterStackIndex-1];if(!E.skip){h.x=E.bounds.minX,h.y=E.bounds.minY;break}}g[0]=a.minX-h.x,g[1]=a.minY-h.y;}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],_[0]=e.source.pixelWidth,_[1]=e.source.pixelHeight,_[2]=1/_[0],_[3]=1/_[1],y[0]=.5*_[2],y[1]=.5*_[3],y[2]=e.frame.width*x[2]-.5*_[2],y[3]=e.frame.height*x[3]-.5*_[3];let P=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*c,b[1]=h.y*c,b[2]=P.source.width*c,b[3]=P.source.height*c;let S=this.renderer.renderTarget.getRenderTarget(i);if(o.renderTarget.bind(i,!!s),i instanceof B?(v[0]=i.frame.width,v[1]=i.frame.height):(v[0]=S.width,v[1]=S.height),v[2]=S.isRoot?-1:1,d.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(w,0);}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:d_,shader:t,state:t._state,topology:"triangle-list"}),o.type===Zt.WEBGL&&o.renderTarget.finishRenderPass();}_getFilterData(){return {skip:false,inputTexture:null,bounds:new et,container:null,filterEffect:null,blendRequired:false,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),o=e.worldTransform.copyTo(C.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Ci.extension={type:[T.WebGLSystem,T.WebGPUSystem],name:"filter"};});var bh=p(()=>{R();Am();km();G.add(Ci);G.add(Pi);});var f_={};var Rm=p(()=>{fu();yn();vu();Su();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});var p_={};var Im=p(()=>{yn();hs();ps();Aa();Ea();Fa();oh();dh();mh();_h();yh();bh();});R();var Fm={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>true,load:async()=>{await Promise.resolve().then(()=>(Rm(),f_));}};R();var Gm={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(Im(),p_));}};R();R();ps();hs();Li();st();ns();var bo=class extends de{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...u}=t;super({...u}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new ft({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),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){t||(t={}),this._style?.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 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);}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Dm(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(F(L,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}no();yr();var He=class extends bo{constructor(...t){let e=Dm(t,"Text");super(e,Mt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Ut.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};Mn();Wt();On();je();Fn();Wr();At();as();Gi(ma());G.add(Fm,Gm);var te={};sx(te,{DistortionFilter:()=>vo,EqualizerFilter:()=>Lt,Filter:()=>lt,MonoFilter:()=>To,ReverbFilter:()=>So,StereoFilter:()=>wo,StreamFilter:()=>Po,TelephoneFilter:()=>Co});var Um;function Lm(r){return Um=r,r}function X(){return Um}var lt=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var vo=class extends lt{constructor(t=0){let e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,X().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var at=class{static setParamValue(t,e){if(t.setValueAtTime){let i=X().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var j=class extends lt{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let u=[],c=[{f:j.F32,type:"lowshelf",gain:r},{f:j.F64,type:"peaking",gain:t},{f:j.F125,type:"peaking",gain:e},{f:j.F250,type:"peaking",gain:i},{f:j.F500,type:"peaking",gain:s},{f:j.F1K,type:"peaking",gain:o},{f:j.F2K,type:"peaking",gain:n},{f:j.F4K,type:"peaking",gain:a},{f:j.F8K,type:"peaking",gain:h},{f:j.F16K,type:"highshelf",gain:l}];X().useLegacy||(u=c.map(f=>{let d=X().context.audioContext.createBiquadFilter();return d.type=f.type,at.setParamValue(d.Q,1),d.frequency.value=f.f,at.setParamValue(d.gain,f.gain),d})),super(u[0],u[u.length-1]),this.bands=u,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);at.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(j.F32,r);}get f32(){return this.getGain(j.F32)}set f64(r){this.setGain(j.F64,r);}get f64(){return this.getGain(j.F64)}set f125(r){this.setGain(j.F125,r);}get f125(){return this.getGain(j.F125)}set f250(r){this.setGain(j.F250,r);}get f250(){return this.getGain(j.F250)}set f500(r){this.setGain(j.F500,r);}get f500(){return this.getGain(j.F500)}set f1k(r){this.setGain(j.F1K,r);}get f1k(){return this.getGain(j.F1K)}set f2k(r){this.setGain(j.F2K,r);}get f2k(){return this.getGain(j.F2K)}set f4k(r){this.setGain(j.F4K,r);}get f4k(){return this.getGain(j.F4K)}set f8k(r){this.setGain(j.F8K,r);}get f8k(){return this.getGain(j.F8K)}set f16k(r){this.setGain(j.F16K,r);}get f16k(){return this.getGain(j.F16K)}reset(){this.bands.forEach(r=>{at.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},Lt=j;Lt.F32=32;Lt.F64=64;Lt.F125=125;Lt.F250=250;Lt.F500=500;Lt.F1K=1e3;Lt.F2K=2e3;Lt.F4K=4e3;Lt.F8K=8e3;Lt.F16K=16e3;var To=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var So=class extends lt{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(X().useLegacy)return;let{audioContext:t}=X().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var wo=class extends lt{constructor(t=0){let e,i,s;if(!X().useLegacy){let{audioContext:o}=X().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?at.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Po=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Co=class extends lt{constructor(){let t,e;if(!X().useLegacy){let{audioContext:i}=X().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",at.setParamValue(s.frequency,2e3),o.type="lowpass",at.setParamValue(o.frequency,2e3),n.type="highpass",at.setParamValue(n.frequency,500),a.type="highpass",at.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var Mi=class extends ${constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var x_=0,vh=class extends ${constructor(r){super(),this.id=x_++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-vh.PADDING),this._end=Math.min(this._end+vh.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),ht.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){ht.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){ht.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=vh;Mo.PADDING=.1;var Ai=class extends ${init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var Ei=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var ze=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Th=["audio/mpeg","audio/ogg"],We={};function Om(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;ze.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(We,i);}Om();var __=0,Bi=class extends ${constructor(t){super(),this.id=__++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);at.setParamValue(this._gain.gain,o*s*i),at.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:u}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=u,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let c=this._source.buffer.duration;this._duration=c,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){ht.shared.remove(this._updateListener,this),t&&ht.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Ve=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Hm=class extends Ve{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Hm.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,at.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Ao=Hm;Ao.BUFFER_SIZE=0;var Ne=class{init(t){this.parent=t,this._nodes=new Ao(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new Bi(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await rt.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var wr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=X().useLegacy?new Ai:new Ne;return new wr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:Ct.extname(e).slice(1)})).filter(({ext:e})=>We[e]).sort((e,i)=>ze.indexOf(e.ext)-ze.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return X().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new Ei(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(wr._pool.length>0){let r=wr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),wr._pool.indexOf(r)<0&&wr._pool.push(r);}},ve=wr;ve._pool=[];var Pr=class r extends Ve{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new $,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var Eo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new Pr),this._htmlAudioContext=new Mi,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return Pr.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof ve)return this._sounds[t]=e,e;let i=this._getOptions(e),s=ve.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var zm=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=Ct.basename(t,Ct.extname(t))),e},Wm={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...ze.filter(t=>We[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:Ze.High},test(r){let t=Ct.extname(r).slice(1);return !!We[t]||Th.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>ve.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return X().add(zm(t),e),e},async unload(r,t){X().remove(zm(t));}}};G.add(Wm);Lm(new Eo);({DistortionFilter:te.DistortionFilter,EqualizerFilter:te.EqualizerFilter,MonoFilter:te.MonoFilter,ReverbFilter:te.ReverbFilter,StereoFilter:te.StereoFilter,StreamFilter:te.StreamFilter,TelephoneFilter:te.TelephoneFilter});var Cr="Container";var Vm="Sprite",Mr="Text";var ct;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(ct||={});var Sh=new Map;function Bo(r,t){t||(t=r.name),Sh.get(t)&&ct.warn(`CanvasElement ${t} already registered`),r.prototype.pixivnId=t,Sh.set(t,r);}function Nm(r){try{let t=Sh.get(r);if(!t){ct.error(`CanvasElement ${r} not found, did you forget to register it with the canvasComponentDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var $m=new Map;function Ym(r){try{let t=$m.get(r);if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t,t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function ko(r){try{let t=$m.get(r);if(!t){ct.error(`Event ${r} not found, did you forget to register it with the eventDecorator?`);return}return new t}catch(t){ct.error(`Error while getting Event ${r}`,t);return}}function wh(r,t){let e=r.source.label;return {url:e,alias:t===e?void 0:t}}function Xm(r,t){if(!(r instanceof Object))return r;ct.warn(`Text.style.${t} is a FillGradient or FillPattern, this is not supported yet.`,r);}function jm(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:Xm(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:Xm(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}function T_(r){return "memory"in r?r.memory:r instanceof He?Ph(r):r instanceof pe?S_(r):ki(r)}function ki(r,t){let e=Cr,i=t?.childrenExport||false;r.hasOwnProperty("pixivnId")&&(e=r.pixivnId);let s=[];return i&&r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).forEach(o=>{s.push(T_(o));}),{pixivnId:e,elements:s,width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function S_(r){let t=ki(r),e=t.pixivnId??Vm,i={};"onEvents"in r&&(i=r.onEvents);let s;return "textureAlias"in r?s=wh(r.texture,r.textureAlias):s=wh(r.texture),{...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function Ph(r){let t=ki(r),e=t.pixivnId??Mr,i={};return "onEvents"in r&&(i=r.onEvents),{...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:jm(r.style),roundPixels:r.roundPixels,onEvents:i}}async function Km(r){let t=w_(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function w_(r){try{let t=Nm(r);return t?new t:void 0}catch(t){ct.error(`Error while getting CanvasElement ${r}`,t);return}}var Ro=class extends Pt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Cr;}pixivnId=Cr;get memory(){return ki(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ch(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await Km(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Ro,Cr);async function Ch(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var Fo=class extends He{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Mr;}pixivnId=Mr;get memory(){return Ph(this)}set memory(t){}async setMemory(t){return this.memory=t,await P_(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ko(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):ct.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Bo(Fo,Mr);async function P_(r,t){if(await Ch(r,t),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"text"in t&&t.text!==void 0&&(r.text=t.text),"resolution"in t&&t.resolution!==void 0&&(r.resolution=t.resolution),"style"in t&&t.style!==void 0&&(r.style=t.style),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let e in t.onEvents){let i=t.onEvents[e],s=Ym(i);s&&r.onEvent(e,s);}}export{Fo as default,P_ as setMemoryText};
|