"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[248],{84:(e,t,r)=>{r.d(t,{$:()=>n});let n=[{type:"mat3x3<f32>",test:e=>void 0!==e.value.a,ubo:`
            var matrix = uv[name].toArray(true);
            data[offset] = matrix[0];
            data[offset + 1] = matrix[1];
            data[offset + 2] = matrix[2];
            data[offset + 4] = matrix[3];
            data[offset + 5] = matrix[4];
            data[offset + 6] = matrix[5];
            data[offset + 8] = matrix[6];
            data[offset + 9] = matrix[7];
            data[offset + 10] = matrix[8];
        `,uniform:`
            gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
        `},{type:"vec4<f32>",test:e=>"vec4<f32>"===e.type&&1===e.size&&void 0!==e.value.width,ubo:`
            v = uv[name];
            data[offset] = v.x;
            data[offset + 1] = v.y;
            data[offset + 2] = v.width;
            data[offset + 3] = v.height;
        `,uniform:`
            cv = ud[name].value;
            v = uv[name];
            if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
                cv[0] = v.x;
                cv[1] = v.y;
                cv[2] = v.width;
                cv[3] = v.height;
                gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
            }
        `},{type:"vec2<f32>",test:e=>"vec2<f32>"===e.type&&1===e.size&&void 0!==e.value.x,ubo:`
            v = uv[name];
            data[offset] = v.x;
            data[offset + 1] = v.y;
        `,uniform:`
            cv = ud[name].value;
            v = uv[name];
            if (cv[0] !== v.x || cv[1] !== v.y) {
                cv[0] = v.x;
                cv[1] = v.y;
                gl.uniform2f(ud[name].location, v.x, v.y);
            }
        `},{type:"vec4<f32>",test:e=>"vec4<f32>"===e.type&&1===e.size&&void 0!==e.value.red,ubo:`
            v = uv[name];
            data[offset] = v.red;
            data[offset + 1] = v.green;
            data[offset + 2] = v.blue;
            data[offset + 3] = v.alpha;
        `,uniform:`
            cv = ud[name].value;
            v = uv[name];
            if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
                cv[0] = v.red;
                cv[1] = v.green;
                cv[2] = v.blue;
                cv[3] = v.alpha;
                gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
            }
        `},{type:"vec3<f32>",test:e=>"vec3<f32>"===e.type&&1===e.size&&void 0!==e.value.red,ubo:`
            v = uv[name];
            data[offset] = v.red;
            data[offset + 1] = v.green;
            data[offset + 2] = v.blue;
        `,uniform:`
            cv = ud[name].value;
            v = uv[name];
            if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
                cv[0] = v.red;
                cv[1] = v.green;
                cv[2] = v.blue;
                gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
            }
        `}]},1020:(e,t,r)=>{r.d(t,{K:()=>n});class n{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){}}},1548:(e,t,r)=>{r.d(t,{g:()=>a});var n=r(863);let a=[];a[n.K.NONE]=void 0,a[n.K.DISABLED]={stencilWriteMask:0,stencilReadMask:0},a[n.K.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},a[n.K.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},a[n.K.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},a[n.K.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}}},3047:(e,t,r)=>{r.d(t,{Ls:()=>n,_Q:()=>a,mA:()=>i});let n={name:"local-uniform-bit",vertex:{header:`

            struct LocalUniforms {
                uTransformMatrix:mat3x3<f32>,
                uColor:vec4<f32>,
                uRound:f32,
            }

            @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
        `,main:`
            vColor *= localUniforms.uColor;
            modelMatrix *= localUniforms.uTransformMatrix;
        `,end:`
            if(localUniforms.uRound == 1)
            {
                vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
            }
        `}},a={...n,vertex:{...n.vertex,header:n.vertex.header.replace("group(1)","group(2)")}},i={name:"local-uniform-bit",vertex:{header:`

            uniform mat3 uTransformMatrix;
            uniform vec4 uColor;
            uniform float uRound;
        `,main:`
            vColor *= uColor;
            modelMatrix = uTransformMatrix;
        `,end:`
            if(uRound == 1.)
            {
                gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
            }
        `}}},3116:(e,t,r)=>{function n(e,t){return`
        for (let i = 0; i < ${e*t}; i++) {
            data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i];
        }
    `}r.d(t,{_:()=>i,g:()=>a});let a={f32:`
        data[offset] = v;`,i32:`
        dataInt32[offset] = v;`,"vec2<f32>":`
        data[offset] = v[0];
        data[offset + 1] = v[1];`,"vec3<f32>":`
        data[offset] = v[0];
        data[offset + 1] = v[1];
        data[offset + 2] = v[2];`,"vec4<f32>":`
        data[offset] = v[0];
        data[offset + 1] = v[1];
        data[offset + 2] = v[2];
        data[offset + 3] = v[3];`,"vec2<i32>":`
        dataInt32[offset] = v[0];
        dataInt32[offset + 1] = v[1];`,"vec3<i32>":`
        dataInt32[offset] = v[0];
        dataInt32[offset + 1] = v[1];
        dataInt32[offset + 2] = v[2];`,"vec4<i32>":`
        dataInt32[offset] = v[0];
        dataInt32[offset + 1] = v[1];
        dataInt32[offset + 2] = v[2];
        dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":`
        data[offset] = v[0];
        data[offset + 1] = v[1];
        data[offset + 4] = v[2];
        data[offset + 5] = v[3];`,"mat3x3<f32>":`
        data[offset] = v[0];
        data[offset + 1] = v[1];
        data[offset + 2] = v[2];
        data[offset + 4] = v[3];
        data[offset + 5] = v[4];
        data[offset + 6] = v[5];
        data[offset + 8] = v[6];
        data[offset + 9] = v[7];
        data[offset + 10] = v[8];`,"mat4x4<f32>":`
        for (let i = 0; i < 16; i++) {
            data[offset + i] = v[i];
        }`,"mat3x2<f32>":n(3,2),"mat4x2<f32>":n(4,2),"mat2x3<f32>":n(2,3),"mat4x3<f32>":n(4,3),"mat2x4<f32>":n(2,4),"mat3x4<f32>":n(3,4)},i={...a,"mat2x2<f32>":`
        data[offset] = v[0];
        data[offset + 1] = v[1];
        data[offset + 2] = v[2];
        data[offset + 3] = v[3];
    `}},3648:(e,t,r)=>{r.d(t,{V:()=>n});function n(e,t,r){let n=(e>>24&255)/255;t[r++]=(255&e)/255*n,t[r++]=(e>>8&255)/255*n,t[r++]=(e>>16&255)/255*n,t[r++]=n}},5078:(e,t,r)=>{r.d(t,{q:()=>i});var n=r(2198),a=r(4080);function i(e,t){for(let r in e.attributes){let a=e.attributes[r],i=t[r];i?(a.format??(a.format=i.format),a.offset??(a.offset=i.offset),a.instance??(a.instance=i.instance)):(0,n.R)(`Attribute ${r} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}!function(e){let{buffers:t,attributes:r}=e,n={},i={};for(let e in t){let r=t[e];n[r.uid]=0,i[r.uid]=0}for(let e in r){let t=r[e];n[t.buffer.uid]+=(0,a.m)(t.format).stride}for(let e in r){let t=r[e];t.stride??(t.stride=n[t.buffer.uid]),t.start??(t.start=i[t.buffer.uid]),i[t.buffer.uid]+=(0,a.m)(t.format).stride}}(e)}},5261:(e,t,r)=>{r.d(t,{O:()=>o});var n=r(8907),a=r(9537),i=r(18);let s=class e{constructor(t={}){if(this.uid=(0,n.L)("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...e.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,"number"==typeof t.colorTextures){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new a.v({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(e=>e.source)];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof i.g||t.depthStencilTexture instanceof a.v?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new a.v({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,r=this.resolution,n=!1){this.dirtyId++,this.colorTextures.forEach((a,i)=>{n&&0===i||a.source.resize(e,t,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};s.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let o=s},6191:(e,t,r)=>{r.d(t,{E:()=>a});var n=r(84);function a(e,t,r,a){let i=[`
        var v = null;
        var v2 = null;
        var t = 0;
        var index = 0;
        var name = null;
        var arrayOffset = null;
    `],s=0;for(let o=0;o<e.length;o++){let l=e[o],u=l.data.name,d=!1,h=0;for(let e=0;e<n.$.length;e++)if(n.$[e].test(l.data)){h=l.offset/4,i.push(`name = "${u}";`,`offset += ${h-s};`,n.$[e][t]||n.$[e].ubo),d=!0;break}if(!d)if(l.data.size>1)h=l.offset/4,i.push(r(l,h-s));else{let e=a[l.data.type];h=l.offset/4,i.push(`
                    v = uv.${u};
                    offset += ${h-s};
                    ${e};
                `)}s=h}return Function("uv","data","dataInt32","offset",i.join("\n"))}},6598:(e,t,r)=>{r.d(t,{c:()=>o});var n=r(7687),a=r(2840),i=r(18);let s=new Map;function o(e,t){if(!s.has(e)){let r=new i.g({source:new a.q({resource:e,...t})}),n=()=>{s.get(e)===r&&s.delete(e)};r.once("destroy",n),r.source.once("destroy",n),s.set(e,r)}return s.get(e)}n.L.register(s)},7387:(e,t,r)=>{r.d(t,{W:()=>s});var n=r(1949),a=r(8931),i=r(4764);class s{constructor(e){this._syncFunctionHash=Object.create(null),this._adaptor=e,this._systemCheck()}_systemCheck(){if(!(0,n.f)())throw Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(e){let t=this.getUniformGroupData(e);e.buffer||(e.buffer=new a.h({data:new Float32Array(t.layout.size/4),usage:i.S.UNIFORM|i.S.COPY_DST}))}getUniformGroupData(e){return this._syncFunctionHash[e._signature]||this._initUniformGroup(e)}_initUniformGroup(e){let t=e._signature,r=this._syncFunctionHash[t];if(!r){let n=Object.keys(e.uniformStructures).map(t=>e.uniformStructures[t]),a=this._adaptor.createUboElements(n),i=this._generateUboSync(a.uboElements);r=this._syncFunctionHash[t]={layout:a,syncFunction:i}}return this._syncFunctionHash[t]}_generateUboSync(e){return this._adaptor.generateUboSync(e)}syncUniformGroup(e,t,r){let n=this.getUniformGroupData(e);e.buffer||(e.buffer=new a.h({data:new Float32Array(n.layout.size/4),usage:i.S.UNIFORM|i.S.COPY_DST}));let s=null;return t||(t=e.buffer.data,s=e.buffer.dataInt32),r||(r=0),n.syncFunction(e.uniforms,t,s,r),!0}updateUniformGroup(e){if(e.isStatic&&!e._dirtyId)return!1;e._dirtyId=0;let t=this.syncUniformGroup(e);return e.buffer.update(),t}destroy(){this._syncFunctionHash=null}}},8847:(e,t,r)=>{r.d(t,{d:()=>i});var n=r(4154),a=r(8907);class i extends n.A{constructor({buffer:e,offset:t,size:r}){super(),this.uid=(0,a.L)("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=(0,a.L)("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=e,this.offset=0|t,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=(0,a.L)("resource"),this.emit("change",this)}destroy(e=!1){this.destroyed=!0,e&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}},9685:(e,t,r)=>{r.d(t,{R:()=>n,m:()=>a});let n={name:"texture-bit",vertex:{header:`

        struct TextureUniforms {
            uTextureMatrix:mat3x3<f32>,
        }

        @group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
        `,main:`
            uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
        `},fragment:{header:`
            @group(2) @binding(0) var uTexture: texture_2d<f32>;
            @group(2) @binding(1) var uSampler: sampler;


        `,main:`
            outColor = textureSample(uTexture, uSampler, vUV);
        `}},a={name:"texture-bit",vertex:{header:`
            uniform mat3 uTextureMatrix;
        `,main:`
            uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
        `},fragment:{header:`
        uniform sampler2D uTexture;


        `,main:`
            outColor = texture(uTexture, vUV);
        `}}},9783:(e,t,r)=>{r.d(t,{f:()=>eS,i:()=>eM});var n=r(2367);class a{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}a.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"customRender"};var i=r(6509),s=r(8701),o=r(1020);function l(e,t){let r=e.instructionSet,n=r.instructions;for(let e=0;e<r.instructionSize;e++){let r=n[e];t[r.renderPipeId].execute(r)}}let u=new i.u;class d{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(s.Z.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){let r=e._batchableRenderGroup??(e._batchableRenderGroup=s.Z.get(o.K));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.blendMode.pushBlendMode(e,e.root.groupBlendMode,t),this._renderer.renderPipes.batch.addToBatch(r,t),this._renderer.renderPipes.blendMode.popBlendMode(t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;let t=u.identity().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:0xffffffff,offset:{x:0,y:0}}),l(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),l(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}d.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"renderGroup"};var h=r(8075),c=r(3566),p=r(3916);function f(e,t){t||(t=0);for(let r=t;r<e.length;r++)if(e[r])e[r]=null;else break}var m=r(8826),v=r(895);let g=new m.mc,_=m.fR|m.ig|m.u;function x(e,t,r){if(r&m.ig){e.groupColor=(0,v.j)(e.localColor,t.groupColor);let r=e.localAlpha*t.groupAlpha;e.groupAlpha=r=r<0?0:r>1?1:r,e.groupColorAlpha=e.groupColor+(255*r<<24)}r&m.u&&(e.groupBlendMode="inherit"===e.localBlendMode?t.groupBlendMode:e.localBlendMode),r&m.fR&&(e.globalDisplayStatus=e.localDisplayStatus&t.globalDisplayStatus),e._updateFlags=0}let b=new i.u;class T{constructor(e){this._renderer=e}render({container:e,transform:t}){let r=e.parent,n=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;let a=this._renderer;t&&(b.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));let i=a.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),a.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),l(e.renderGroup,i),i.uniformBatch&&i.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(b),e.parent=r,e.renderGroup.renderGroupParent=n}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e._parentCacheAsTextureRenderGroup=t,e.isCachedAsTexture){if(!e.textureNeedsUpdate)return;t=e}for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){let t=e.root.getLocalBounds();t.ceil();let r=e.texture;e.texture&&h.W.returnTexture(e.texture,!0);let n=this._renderer,a=e.textureOptions.resolution||n.view.resolution,i=e.textureOptions.antialias??n.view.antialias,s=e.textureOptions.scaleMode??"linear",o=h.W.getOptimalTexture(t.width,t.height,a,i);o._source.style=new c.n({scaleMode:s}),e.texture=o,e._textureBounds||(e._textureBounds=new p.c),e._textureBounds.copyFrom(t),r!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(h.W.returnTexture(e.texture,!0),e.texture=null)}_updateRenderGroups(e){let t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?f(e.childrenRenderablesToUpdate.list,0):!function(e,t){let{list:r}=e.childrenRenderablesToUpdate,n=!1;for(let a=0;a<e.childrenRenderablesToUpdate.index;a++){let e=r[a];if(n=t[e.renderPipeId].validateRenderable(e))break}e.structureDidChange=n}(e,r),!function e(t,r=!1){var n=t;let a,i=n.root;if(n.renderGroupParent){let e=n.renderGroupParent;n.worldTransform.appendFrom(i.relativeGroupTransform,e.worldTransform),n.worldColor=(0,v.j)(i.groupColor,e.worldColor),a=i.groupAlpha*e.worldAlpha}else n.worldTransform.copyFrom(i.localTransform),n.worldColor=i.localColor,a=i.localAlpha;n.worldAlpha=a=a<0?0:a>1?1:a,n.worldColorAlpha=n.worldColor+(255*a<<24);let s=t.childrenToUpdate,o=t.updateTick++;for(let e in s){let r=Number(e),n=s[e],a=n.list,i=n.index;for(let e=0;e<i;e++){let n=a[e];n.parentRenderGroup===t&&n.relativeRenderGroupDepth===r&&function e(t,r,n){if(r===t.updateTick)return;t.updateTick=r,t.didChange=!1;let a=t.localTransform;t.updateLocalTransform();let i=t.parent;if(i&&!i.renderGroup?(n|=t._updateFlags,t.relativeGroupTransform.appendFrom(a,i.relativeGroupTransform),n&_&&x(t,i,n)):(n=t._updateFlags,t.relativeGroupTransform.copyFrom(a),n&_&&x(t,g,n)),!t.renderGroup){let a=t.children,i=a.length;for(let t=0;t<i;t++)e(a[t],r,n);let s=t.parentRenderGroup;t.renderPipeId&&!s.structureDidChange&&s.updateRenderable(t)}}(n,o,0)}f(a,i),n.index=0}if(r)for(let n=0;n<t.renderGroupChildren.length;n++)e(t.renderGroupChildren[n],r)}(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!e.isCachedAsTexture||e.textureNeedsUpdate)for(let t=0;t<e.renderGroupChildren.length;t++)this._updateRenderGroups(e.renderGroupChildren[t])}_updateRenderables(e){let{list:t,index:r}=e.childrenRenderablesToUpdate;for(let n=0;n<r;n++){let r=t[n];r.didViewUpdate&&e.updateRenderable(r)}f(t,r)}_buildInstructions(e,t){let r=e.root,n=e.instructionSet;n.reset();let a=t.renderPipes?t:t.batch.renderer,i=a.renderPipes;i.batch.buildStart(n),i.blendMode.buildStart(),i.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(n,a,null),i.batch.buildEnd(n),i.blendMode.buildEnd(n)}}T.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem,n.Ag.CanvasSystem],name:"renderGroup"};class y{constructor(e){this._renderer=e}addRenderable(e,t){let r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){let t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){let t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){let t=new o.K;return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,t}destroy(){this._renderer=null}}y.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"sprite"};var k=r(7939),C=r(6049),M=r(4739);let S=class e{constructor(e,t){this.state=C.U.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,this._adaptor.init?.(this)}static getBatcher(e){return new this._availableBatchers[e]}buildStart(e){let t=this._batchersByInstructionSet[e.uid];for(let r in!t&&((t=this._batchersByInstructionSet[e.uid]=Object.create(null)).default||(t.default=new M.J({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default,this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,r){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(r);let n=this._activeBatches[t.batcherName];n||(n=this._activeBatches[t.batcherName]=e.getBatcher(t.batcherName)).begin(),this._activeBatch=n}this._activeBatch.add(t)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);let t=this._activeBatches;for(let e in t){let r=t[e],n=r.geometry;n.indexBuffer.setDataWithSize(r.indexBuffer,r.indexSize,!0),n.buffers[0].setDataWithSize(r.attributeBuffer.float32View,r.attributeSize,!1)}}upload(e){let t=this._batchersByInstructionSet[e.uid];for(let e in t){let r=t[e],n=r.geometry;r.dirty&&(r.dirty=!1,n.buffers[0].update(4*r.attributeSize))}}execute(e){if("startBatch"===e.action){let t=e.batcher,r=t.geometry,n=t.shader;this._adaptor.start(this,r,n)}this._adaptor.execute(this,e)}destroy(){for(let e in this.state=null,this.renderer=null,this._adaptor=null,this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};S.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"batch"},S._availableBatchers=Object.create(null),n.XO.handleByMap(n.Ag.Batcher,S._availableBatchers),n.XO.add(M.J);var G=r(4555),w=r(4789),P=r(9283),A=r(5273),R=r(7606),B=r(8747),U="struct GlobalFilterUniforms {\n  uInputSize:vec4<f32>,\n  uInputPixel:vec4<f32>,\n  uInputClamp:vec4<f32>,\n  uOutputFrame:vec4<f32>,\n  uGlobalFrame:vec4<f32>,\n  uOutputTexture:vec4<f32>,\n};\n\nstruct MaskUniforms {\n  uFilterMatrix:mat3x3<f32>,\n  uMaskClamp:vec4<f32>,\n  uAlpha:f32,\n  uInverse:f32,\n};\n\n@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;\n@group(0) @binding(1) var uTexture: texture_2d<f32>;\n@group(0) @binding(2) var uSampler : sampler;\n\n@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;\n@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;\n\nstruct VSOutput {\n    @builtin(position) position: vec4<f32>,\n    @location(0) uv : vec2<f32>,\n    @location(1) filterUv : vec2<f32>,\n};\n\nfn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>\n{\n    var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;\n\n    position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;\n    position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;\n\n    return vec4(position, 0.0, 1.0);\n}\n\nfn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n    return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);\n}\n\nfn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>\n{\n  return  (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);\n}\n\nfn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>\n{\n  return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0)  ).xy;\n}\n\nfn getSize() -> vec2<f32>\n{\n  return gfu.uGlobalFrame.zw;\n}\n\n@vertex\nfn mainVertex(\n  @location(0) aPosition : vec2<f32>,\n) -> VSOutput {\n  return VSOutput(\n   filterVertexPosition(aPosition),\n   filterTextureCoord(aPosition),\n   getFilterCoord(aPosition)\n  );\n}\n\n@fragment\nfn mainFragment(\n  @location(0) uv: vec2<f32>,\n  @location(1) filterUv: vec2<f32>,\n  @builtin(position) position: vec4<f32>\n) -> @location(0) vec4<f32> {\n\n    var maskClamp = filterUniforms.uMaskClamp;\n    var uAlpha = filterUniforms.uAlpha;\n\n    var clip = step(3.5,\n      step(maskClamp.x, filterUv.x) +\n      step(maskClamp.y, filterUv.y) +\n      step(filterUv.x, maskClamp.z) +\n      step(filterUv.y, maskClamp.w));\n\n    var mask = textureSample(uMaskTexture, uSampler, filterUv);\n    var source = textureSample(uTexture, uSampler, uv);\n    var alphaMul = 1.0 - uAlpha * (1.0 - mask.a);\n\n    var a: f32 = alphaMul * mask.r * uAlpha * clip;\n\n    if (filterUniforms.uInverse == 1.0) {\n        a = 1.0 - a;\n    }\n\n    return source * a;\n}\n";class I extends B.d{constructor(e){const{sprite:t,...r}=e,n=new R.N(t.texture),a=new A.k({uFilterMatrix:{value:new i.u,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:+!!e.inverse,type:"f32"}});super({...r,gpuProgram:P.B.from({vertex:{source:U,entryPoint:"mainVertex"},fragment:{source:U,entryPoint:"mainFragment"}}),glProgram:w.M.from({vertex:"in vec2 aPosition;\n\nout vec2 vTextureCoord;\nout vec2 vMaskCoord;\n\n\nuniform vec4 uInputSize;\nuniform vec4 uOutputFrame;\nuniform vec4 uOutputTexture;\nuniform mat3 uFilterMatrix;\n\nvec4 filterVertexPosition(  vec2 aPosition )\n{\n    vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;\n       \n    position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;\n    position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;\n\n    return vec4(position, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord(  vec2 aPosition )\n{\n    return aPosition * (uOutputFrame.zw * uInputSize.zw);\n}\n\nvec2 getFilterCoord( vec2 aPosition )\n{\n    return  ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0)  ).xy;\n}   \n\nvoid main(void)\n{\n    gl_Position = filterVertexPosition(aPosition);\n    vTextureCoord = filterTextureCoord(aPosition);\n    vMaskCoord = getFilterCoord(aPosition);\n}\n",fragment:"in vec2 vMaskCoord;\nin vec2 vTextureCoord;\n\nuniform sampler2D uTexture;\nuniform sampler2D uMaskTexture;\n\nuniform float uAlpha;\nuniform vec4 uMaskClamp;\nuniform float uInverse;\n\nout vec4 finalColor;\n\nvoid main(void)\n{\n    float clip = step(3.5,\n        step(uMaskClamp.x, vMaskCoord.x) +\n        step(uMaskClamp.y, vMaskCoord.y) +\n        step(vMaskCoord.x, uMaskClamp.z) +\n        step(vMaskCoord.y, uMaskClamp.w));\n\n    // TODO look into why this is needed\n    float npmAlpha = uAlpha;\n    vec4 original = texture(uTexture, vTextureCoord);\n    vec4 masky = texture(uMaskTexture, vMaskCoord);\n    float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\n\n    float a = alphaMul * masky.r * npmAlpha * clip;\n\n    if (uInverse == 1.0) {\n        a = 1.0 - a;\n    }\n\n    finalColor = original * a;\n}\n",name:"mask-filter"}),clipToViewport:!1,resources:{filterUniforms:a,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=n}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=+!!e}get inverse(){return 1===this.resources.filterUniforms.uniforms.uInverse}apply(e,t,r,n){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,n)}}var O=r(1965),F=r(2556),D=r(18),E=r(9763);let z=new p.c;class W extends G.a{constructor(){super(),this.filters=[new I({sprite:new F.k(D.g.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}}class L{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){let n=this._renderer;if(n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.renderMaskToTexture){let t=e.mask;t.includeInBuild=!0,t.collectRenderables(r,n,null),t.includeInBuild=!1}n.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){let t=this._renderer,r=e.mask.renderMaskToTexture;if("pushMaskBegin"===e.action){let n=s.Z.get(W);if(n.inverse=e.inverse,r){e.mask.mask.measurable=!0;let r=(0,O.f)(e.mask.mask,!0,z);e.mask.mask.measurable=!1,r.ceil();let a=t.renderTarget.renderTarget.colorTexture.source,i=h.W.getOptimalTexture(r.width,r.height,a._resolution,a.antialias);t.renderTarget.push(i,!0),t.globalUniforms.push({offset:r,worldColor:0xffffffff});let s=n.sprite;s.texture=i,s.worldTransform.tx=r.minX,s.worldTransform.ty=r.minY,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer,filterTexture:i})}else n.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:n,maskedContainer:e.maskedContainer})}else if("pushMaskEnd"===e.action){let e=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===E.W.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:e.maskedContainer,filterEffect:e.filterEffect,canBundle:!1})}else if("popMaskEnd"===e.action){t.filter.pop();let e=this._activeMaskStage.pop();r&&h.W.returnTexture(e.filterTexture),s.Z.return(e.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}L.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"alphaMask"};class H{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);let n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;let a=this._colorStack[this._colorStackIndex];a!==this._currentColor&&(this._currentColor=a,r.add({renderPipeId:"colorMask",colorMask:a,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);let n=this._colorStack;this._colorStackIndex--;let a=n[this._colorStackIndex-1];a!==this._currentColor&&(this._currentColor=a,r.add({renderPipeId:"colorMask",colorMask:a,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}H.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"colorMask"};var V=r(9695),N=r(863);class j{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var n;let a=this._renderer;a.renderPipes.batch.break(r),a.renderPipes.blendMode.setBlendMode(e.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let i=e.mask;i.includeInBuild=!0,this._maskHash.has(e)||this._maskHash.set(e,{instructionsStart:0,instructionsLength:0});let s=this._maskHash.get(e);s.instructionsStart=r.instructionSize,i.collectRenderables(r,a,null),i.includeInBuild=!1,a.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});let o=r.instructionSize-s.instructionsStart-1;s.instructionsLength=o;let l=a.renderTarget.renderTarget.uid;(n=this._maskStackHash)[l]??(n[l]=0)}pop(e,t,r){let n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(e.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});let a=this._maskHash.get(e);for(let e=0;e<a.instructionsLength;e++)r.instructions[r.instructionSize++]=r.instructions[a.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;let r=this._renderer,n=r.renderTarget.renderTarget.uid,a=(t=this._maskStackHash)[n]??(t[n]=0);"pushMaskBegin"===e.action?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(N.K.RENDERING_MASK_ADD,a),a++,r.colorMask.setMask(0)):"pushMaskEnd"===e.action?(e.inverse?r.stencil.setStencilMode(N.K.INVERSE_MASK_ACTIVE,a):r.stencil.setStencilMode(N.K.MASK_ACTIVE,a),r.colorMask.setMask(15)):"popMaskBegin"===e.action?(r.colorMask.setMask(0),0!==a?r.stencil.setStencilMode(N.K.RENDERING_MASK_REMOVE,a):(r.renderTarget.clear(null,V.u.STENCIL),r.stencil.setStencilMode(N.K.DISABLED,a)),a--):"popMaskEnd"===e.action&&(e.inverse?r.stencil.setStencilMode(N.K.INVERSE_MASK_ACTIVE,a):r.stencil.setStencilMode(N.K.MASK_ACTIVE,a),r.colorMask.setMask(15)),this._maskStackHash[n]=a}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}j.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"stencilMask"};var K=r(5499),$=r(2198);let q=class e{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new K.Q(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...e.defaultOptions,...t},this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){K.Q.shared.setValue(e).alpha<1&&1===this._backgroundColor.alpha&&(0,$.R)("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};q.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem,n.Ag.CanvasSystem],name:"background",priority:0},q.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};var Y=r(3528);let Q={};n.XO.handle(n.Ag.BlendMode,e=>{if(!e.name)throw Error("BlendMode extension must have a name property");Q[e.name]=e.ref},e=>{delete Q[e.name]});class J{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();let t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){let n=e instanceof Y.m;if(this._activeBlendMode===t){this._isAdvanced&&e&&!n&&this._renderableList?.push(e);return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!Q[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);let r=this._activeBlendMode;if(!Q[r])return void(0,$.R)(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);let n=this._ensureFilterEffect(r),a=e instanceof Y.m,i={renderPipeId:"filter",action:"pushFilter",filterEffect:n,renderables:a?null:[e],container:a?e.root:null,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||((t=this._filterHash[e]=new G.a).filters=[new Q[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){for(let e in this._renderer=null,this._renderableList=null,this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}J.extension={type:[n.Ag.WebGLPipes,n.Ag.WebGPUPipes,n.Ag.CanvasPipes],name:"blendMode"};var X=r(5090);let Z={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},ee=class e{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof m.mc||e instanceof D.g?{target:e,...t}:{...t,...e}}async image(e){let t=X.e.get().createImage();return t.src=await this.base64(e),t}async base64(t){let{format:r,quality:n}=t=this._normalizeOptions(t,e.defaultImageOptions),a=this.canvas(t);if(void 0!==a.toBlob)return new Promise((e,t)=>{a.toBlob(r=>{if(!r)return void t(Error("ICanvas.toBlob failed!"));let n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsDataURL(r)},Z[r],n)});if(void 0!==a.toDataURL)return a.toDataURL(Z[r],n);if(void 0!==a.convertToBlob){let e=await a.convertToBlob({type:Z[r],quality:n});return new Promise((t,r)=>{let n=new FileReader;n.onload=()=>t(n.result),n.onerror=r,n.readAsDataURL(e)})}throw Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){let t=(e=this._normalizeOptions(e)).target,r=this._renderer;if(t instanceof D.g)return r.texture.generateCanvas(t);let n=r.textureGenerator.generateTexture(e),a=r.texture.generateCanvas(n);return n.destroy(!0),a}pixels(e){let t=(e=this._normalizeOptions(e)).target,r=this._renderer,n=t instanceof D.g?t:r.textureGenerator.generateTexture(e),a=r.texture.getPixels(n);return t instanceof m.mc&&n.destroy(!0),a}texture(e){return(e=this._normalizeOptions(e)).target instanceof D.g?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);let t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){let t=e.width??200;e=this._normalizeOptions(e);let r=this.canvas(e),n=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`),console.log("%c ",`font-size: 1px; padding: ${t}px 300px; background: url(${n}) no-repeat; background-size: contain;`)}destroy(){this._renderer=null}};ee.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"extract"},ee.defaultImageOptions={format:"png",quality:1};var et=r(7778),er=r(4217),en=r(8121);let ea=new et.M,ei=new p.c,es=[0,0,0,0];class eo{constructor(e){this._renderer=e}generateTexture(e){e instanceof m.mc&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});let t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,n=e.target,a=e.clearColor;a=a?Array.isArray(a)&&4===a.length?a:K.Q.shared.setValue(a).toArray():es;let s=e.frame?.copyTo(ea)||(0,er.n)(n,ei).rectangle;s.width=0|Math.max(s.width,1/t),s.height=0|Math.max(s.height,1/t);let o=en.Y.create({...e.textureSourceOptions,width:s.width,height:s.height,resolution:t,antialias:r}),l=i.u.shared.translate(-s.x,-s.y);return this._renderer.render({container:n,transform:l,target:o,clearColor:a}),o.source.updateMipmaps(),o}destroy(){this._renderer=null}}eo.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"textureGenerator"};var el=r(8713),eu=r(3648),ed=r(4548);class eh{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:n,offset:a}){let s,o=this._renderer.renderTarget.renderTarget,l=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new i.u,worldColor:0xffffffff,offset:new el.b},u={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||o.size,worldTransformMatrix:r||l.worldTransformMatrix,worldColor:n||l.worldColor,offset:a||l.offset,bindGroup:null},d=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(d);let h=d.uniforms;h.uProjectionMatrix=u.projectionMatrix,h.uResolution=u.resolution,h.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),h.uWorldTransformMatrix.tx-=u.offset.x,h.uWorldTransformMatrix.ty-=u.offset.y,(0,eu.V)(u.worldColor,h.uWorldColorAlpha,0),d.update(),this._renderer.renderPipes.uniformBatch?s=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(d,!1):(s=this._bindGroupPool.pop()||new ed.T,this._activeBindGroups.push(s),s.setResource(d,0)),u.bindGroup=s,this._currentGlobalUniformData=u}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===E.W.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new A.k({uProjectionMatrix:{value:new i.u,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new i.u,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}eh.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem,n.Ag.CanvasSystem],name:"globalUniforms"};var ec=r(5369);let ep=1;class ef{constructor(){this._tasks=[],this._offset=0}init(){ec.R.system.add(this._update,this)}repeat(e,t,r=!0){let n=ep++,a=0;return r&&(this._offset+=1e3,a=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:a,last:performance.now(),repeat:!0,id:n}),n}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e)return void this._tasks.splice(t,1)}_update(){let e=performance.now();for(let t=0;t<this._tasks.length;t++){let r=this._tasks[t];if(e-r.offset-r.last>=r.duration){let t=e-r.start;r.func(t),r.last=e}}}destroy(){ec.R.system.remove(this._update,this),this._tasks.length=0}}ef.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem,n.Ag.CanvasSystem],name:"scheduler",priority:0};var em=r(5283);let ev=!1;class eg{constructor(e){this._renderer=e}init(e){if(e.hello){let e=this._renderer.name;this._renderer.type===E.W.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`);var t=e;if(!ev){if(X.e.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let e=[`%c  %c  %c  %c  %c PixiJS %c v${em.xv} (${t}) http://www.pixijs.com/

`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${em.xv} - ${t} - http://www.pixijs.com/`);ev=!0}}}}eg.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem,n.Ag.CanvasSystem],name:"hello",priority:-2},eg.defaultOptions={hello:!1};let e_=0,ex=class e{constructor(e){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=e}init(t){t={...e.defaultOptions,...t},this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedHashes)e.context[e.hash]=function(e){let t=!1;for(let r in e)if(void 0==e[r]){t=!0;break}if(!t)return e;let r=Object.create(null);for(let t in e){let n=e[t];n&&(r[t]=n)}return r}(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)!function(e){let t=0;for(let r=0;r<e.length;r++)void 0==e[r]?t++:e[r-t]=e[r];e.length-=t}(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(e,t){this._managedHashes.push({context:e,hash:t})}addManagedArray(e,t){this._managedArrays.push({context:e,hash:t})}prerender({container:e}){this._now=performance.now(),e.renderGroup.gcTick=e_++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}addRenderable(e){this.enabled&&(-1===e._lastUsed&&(this._managedRenderables.push(e),e.once("destroyed",this._removeRenderable,this)),e._lastUsed=this._now)}run(){let e=this._now,t=this._managedRenderables,r=this._renderer.renderPipes,n=0;for(let a=0;a<t.length;a++){let i=t[a];if(null===i){n++;continue}let s=i.renderGroup??i.parentRenderGroup,o=s?.instructionSet?.gcTick??-1;(s?.gcTick??0)===o&&(i._lastUsed=e),e-i._lastUsed>this.maxUnusedTime?(i.destroyed||(s&&(s.structureDidChange=!0),r[i.renderPipeId].destroyRenderable(i)),i._lastUsed=-1,n++,i.off("destroyed",this._removeRenderable,this)):t[a-n]=i}t.length-=n}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(e){let t=this._managedRenderables.indexOf(e);t>=0&&(e.off("destroyed",this._removeRenderable,this),this._managedRenderables[t]=null)}_updateInstructionGCTick(e,t){for(let r of(e.instructionSet.gcTick=t,e.renderGroupChildren))this._updateInstructionGCTick(r,t)}};ex.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"renderableGC",priority:0},ex.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let eb=class e{constructor(e){this._renderer=e,this.count=0,this.checkCount=0}init(t){t={...e.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){!this._renderer.renderingToScreen||(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this._renderer.texture.managedTextures;for(let t=0;t<e.length;t++){let r=e[t];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};eb.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem],name:"textureGC"},eb.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};var eT=r(2530),ey=r(5261),ek=r(6598);let eC=class e{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(t){(t={...e.defaultOptions,...t}).view&&((0,eT.t6)(eT.lj,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new et.M(0,0,t.width,t.height),this.canvas=t.canvas||X.e.get().createCanvas(),this.antialias=!!t.antialias,this.texture=(0,ek.c)(this.canvas,t),this.renderTarget=new ey.O({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){("boolean"==typeof e?e:!!e?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};eC.extension={type:[n.Ag.WebGLSystem,n.Ag.WebGPUSystem,n.Ag.CanvasSystem],name:"view",priority:0},eC.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let eM=[q,eh,eg,eC,T,eb,eo,ee,k.d,ex,ef],eS=[J,S,y,d,L,j,H,a]},9823:(e,t,r)=>{r.d(t,{l:()=>c});var n=r(6509),a=r(7778),i=r(9695),s=r(4919),o=r(2840),l=r(9537),u=r(18),d=r(6598),h=r(5261);class c{constructor(e){this.rootViewPort=new a.M,this.viewport=new a.M,this.onRenderTargetChange=new s.C("onRenderTargetChange"),this.projectionMatrix=new n.u,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:n}){let a;this._renderTargetStack.length=0,this.push(e,t,r,n),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=(a=this.rootRenderTarget.colorTexture.source.resource,globalThis.HTMLCanvasElement&&a instanceof HTMLCanvasElement&&document.body.contains(a)),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(e,t=!0,r,n){var a,i,s;let o,l=this.getRenderTarget(e),d=this.renderTarget!==l;this.renderTarget=l,this.renderSurface=e;let h=this.getGpuRenderTarget(l);(l.pixelWidth!==h.width||l.pixelHeight!==h.height)&&(this.adaptor.resizeGpuRenderTarget(l),h.width=l.pixelWidth,h.height=l.pixelHeight);let c=l.colorTexture,p=this.viewport,f=c.pixelWidth,m=c.pixelHeight;if(!n&&e instanceof u.g&&(n=e.frame),n){let e=c._resolution;p.x=n.x*e+.5|0,p.y=n.y*e+.5|0,p.width=n.width*e+.5|0,p.height=n.height*e+.5|0}else p.x=0,p.y=0,p.width=f,p.height=m;return a=this.projectionMatrix,i=p.width/c.resolution,s=p.height/c.resolution,o=l.isRoot?-1:1,a.identity(),a.a=1/i*2,a.d=1/s*2*o,a.tx=-1-0*a.a,a.ty=-o-0*a.d,this.adaptor.startRenderPass(l,t,r,p),d&&this.onRenderTargetChange.emit(l),l}clear(e,t=i.u.ALL,r){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=i.u.ALL,r,n){let a=this.bind(e,t,r,n);return this._renderTargetStack.push({renderTarget:a,frame:n}),a}pop(){this._renderTargetStack.pop();let e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,n,a){r.x<0&&(n.width+=r.x,a.x-=r.x,r.x=0),r.y<0&&(n.height+=r.y,a.y-=r.y,r.y=0);let{pixelWidth:i,pixelHeight:s}=e;return n.width=Math.min(n.width,i-r.x),n.height=Math.min(n.height,s-r.y),this.adaptor.copyToTexture(e,t,r,n,a)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return o.q.test(e)&&(e=(0,d.c)(e).source),e instanceof h.O?t=e:e instanceof l.v&&(t=new h.O({colorTextures:[e]}),e.source instanceof o.q&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);let r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}}}]);