pixi.js 8.3.1-main.aa35365 → 8.3.2-dev.f463f0b
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/packages/advanced-blend-modes.js +2 -2
- package/dist/packages/advanced-blend-modes.min.js +2 -2
- package/dist/packages/math-extras.js +2 -2
- package/dist/packages/math-extras.min.js +2 -2
- package/dist/packages/unsafe-eval.js +2 -2
- package/dist/packages/unsafe-eval.min.js +2 -2
- package/dist/pixi.js +3 -3
- package/dist/pixi.min.js +3 -3
- package/dist/pixi.min.mjs +3 -3
- package/dist/pixi.mjs +3 -3
- package/dist/webworker.js +3 -3
- package/dist/webworker.min.js +3 -3
- package/dist/webworker.min.mjs +3 -3
- package/dist/webworker.mjs +3 -3
- package/lib/utils/sayHello.js +1 -1
- package/lib/utils/sayHello.mjs +1 -1
- package/package.json +1 -1
package/dist/pixi.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -39246,7 +39246,7 @@ ${e}`);
|
|
|
39246
39246
|
|
|
39247
39247
|
"use strict";
|
|
39248
39248
|
let saidHello = false;
|
|
39249
|
-
const VERSION = "8.3.
|
|
39249
|
+
const VERSION = "8.3.2";
|
|
39250
39250
|
function sayHello(type) {
|
|
39251
39251
|
if (saidHello) {
|
|
39252
39252
|
return;
|
package/dist/pixi.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -1965,7 +1965,7 @@ fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
|
|
|
1965
1965
|
`))}class vl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){const s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){var i;return((i=this._uniformGroupSyncHash[t._signature])==null?void 0:i[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return M_(t,e)}_getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const o in s)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}vl.extension={type:[x.WebGLSystem],name:"uniformGroup"};function WE(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
|
|
1966
1966
|
out vec4 finalColor;
|
|
1967
1967
|
${r}
|
|
1968
|
-
`,r}const YE={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function KE(r){return YE[r]}function O_(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof $.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const qE=0,ZE=1,QE=2,JE=3,tA=4,eA=5,C_=class Eu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[qE]=this.setBlend,this.map[ZE]=this.setOffset,this.map[QE]=this.setCullFace,this.map[JE]=this.setDepthTest,this.map[tA]=this.setFrontFace,this.map[eA]=this.setDepthMask,this.checks=[],this.defaultState=Ft.for2d()}contextChange(t){this.gl=t,this.blendModesMap=O_(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Eu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Eu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};C_.extension={type:[x.WebGLSystem],name:"state"};let G_=C_;class B_{constructor(t){this.target=el.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=z.UNSIGNED_BYTE,this.internalFormat=Cs.RGBA,this.format=Cs.RGBA,this.samplerType=0}}const I_={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},rA={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},F_={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight;const n=!!rA[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},xl={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,o=t.height,a=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,c=r.resourceHeight;u<a||c<l?((n!==a||o!==l)&&e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,u,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===l?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=l}},D_={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}xl.upload(r,t,e,i)}},Tl={linear:9729,nearest:9728},U_={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ds={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},k_={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Sl(r,t,e,i,s,n,o,a){const l=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const u=Ds[o?"clamp-to-edge":r.addressModeU],c=Ds[o?"clamp-to-edge":r.addressModeV],h=Ds[o?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,u),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Tl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const u=U_[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,u)}}else t[s](l,t.TEXTURE_MIN_FILTER,Tl[r.minFilter]);if(i&&r.maxAnisotropy>1){const u=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,k_[r.compare])}function $_(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var iA=Object.defineProperty,sA=Object.defineProperties,nA=Object.getOwnPropertyDescriptors,L_=Object.getOwnPropertySymbols,oA=Object.prototype.hasOwnProperty,aA=Object.prototype.propertyIsEnumerable,N_=(r,t,e)=>t in r?iA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ee=(r,t)=>{for(var e in t||(t={}))oA.call(t,e)&&N_(r,e,t[e]);if(L_)for(var e of L_(t))aA.call(t,e)&&N_(r,e,t[e]);return r},lA=(r,t)=>sA(r,nA(t));function H_(r,t){let e={},i=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),Ee(Ee(Ee(Ee(Ee(Ee(lA(Ee({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function X_(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function uA(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const s=255.001/i;r[e]=r[e]*s+.5,r[e+1]=r[e+1]*s+.5,r[e+2]=r[e+2]*s+.5}}}const cA=4;class El{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:xl,buffer:I_,video:D_,compressed:F_},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=H_(t,this._renderer.context.extensions),this._mapFormatToType=X_(t),this._mapFormatToFormat=$_(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(P.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||P.EMPTY.source;const s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){const e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);const o=this.getGlSource(e);s.bindTexture(o.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new B_(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Sl(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Sl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=$.get().createCanvas();n.width=i,n.height=s;const o=n.getContext("2d");if(o){const a=o.createImageData(i,s);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),o=new Uint8Array(cA*s*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),u=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,u.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}El.extension={type:[x.WebGLSystem],name:"texture"};class Al{init(){const t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Kt(),i=Ve({name:"graphics",bits:[Wi,Ki(e),ts,Ye]});this.shader=new At({glProgram:i,resources:{localUniforms:t,batchSamplers:qi(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{geometry:a,instructions:l}=o.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(a,s.glProgram);const u=l.instructions;for(let c=0;c<l.instructionSize;c++){const h=u[c];if(h.size){for(let p=0;p<h.textures.count;p++)n.texture.bind(h.textures.textures[p],p);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Al.extension={type:[x.WebGLPipesAdaptor],name:"graphics"};class Pl{init(){const t=Ve({name:"mesh",bits:[ts,Lg,Ye]});this._shader=new At({glProgram:t,resources:{uTexture:P.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,o=n.source;s.resources.uTexture=o,s.resources.uSampler=o.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Pl.extension={type:[x.WebGLPipesAdaptor],name:"mesh"};class wl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}wl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"};function Rl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){const n=i[s];t[n.renderPipeId].execute(n)}}class Ml{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),Rl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Ml.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"};function Us(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Ol(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Ol(r.renderGroupChildren[e],t);return t}function Cl(r,t,e){const i=r>>16&255,s=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,l=t&255,u=i+(o-i)*e,c=s+(a-s)*e,h=n+(l-n)*e;return(u<<16)+(c<<8)+h}const sr=16777215;function Gl(r,t){return r===sr||t===sr?r+t-sr:Cl(r,t,.5)}function hA(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===sr||o===sr?a=n+o-sr:a=Cl(n,o,.5),a+(s<<24)}const dA=new J,j_=Oe|dr|hi;function Bl(r,t=!1){z_(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),o=e[s],a=o.list,l=o.index;for(let u=0;u<l;u++){const c=a[u];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Il(c,i,0)}Us(a,l),o.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Bl(r.renderGroupChildren[s],t)}function z_(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Gl(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Il(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&j_&&V_(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&j_&&V_(r,dA,e)),!r.renderGroup){const n=r.children,o=n.length;for(let l=0;l<o;l++)Il(n[l],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function V_(r,t,e){if(e&dr){r.groupColor=Gl(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&hi&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Oe&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function W_(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;n<i;n++){const o=e[n];if(s=t[o.renderPipeId].validateRenderable(o),s)break}return r.structureDidChange=s,s}const pA=new G;class Fl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Ol(t.renderGroup,[]);let a=pA;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const l=n.renderPipes;for(let u=0;u<o.length;u++){const c=o[u];c.runOnRender(),c.instructionSet.renderPipes=l,c.structureDidChange?Us(c.childrenRenderablesToUpdate.list,0):W_(c,l),Bl(c),c.structureDidChange?(c.structureDidChange=!1,Ng(c,n)):fA(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Rl(t.renderGroup,l),l.uniformBatch&&l.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}}Fl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"};function fA(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let i=0;i<e;i++){const s=t[i];s.didViewUpdate&&r.updateRenderable(s)}Us(t,e)}class Dl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i.batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(Fi);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)H.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Dl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"};var mA=Object.defineProperty,Y_=Object.getOwnPropertySymbols,gA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,K_=(r,t,e)=>t in r?mA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,q_=(r,t)=>{for(var e in t||(t={}))gA.call(t,e)&&K_(r,e,t[e]);if(Y_)for(var e of Y_(t))_A.call(t,e)&&K_(r,e,t[e]);return r};const Ul=class Vy{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=q_(q_({},Vy.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ul.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0},Ul.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let Z_=Ul;const Zr={};U.handle(x.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Zr[r.name]=r.ref},r=>{delete Zr[r.name]});class kl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Zr[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Zr[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new ur,i.filters=[new Zr[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}kl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"};var bA=Object.defineProperty,Q_=Object.getOwnPropertySymbols,yA=Object.prototype.hasOwnProperty,vA=Object.prototype.propertyIsEnumerable,J_=(r,t,e)=>t in r?bA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$l=(r,t)=>{for(var e in t||(t={}))yA.call(t,e)&&J_(r,e,t[e]);if(Q_)for(var e of Q_(t))vA.call(t,e)&&J_(r,e,t[e]);return r};const Ll={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Nl=class Wy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof J||t instanceof P?$l({target:t},e):$l($l({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Wy.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,o)=>{s.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},Ll[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Ll[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:Ll[e],quality:i});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof P)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof P?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof J&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const o=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Nl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"},Nl.defaultImageOptions={format:"png",quality:1};let tb=Nl;class ks extends P{static create(t){return new ks({source:new et(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var xA=Object.defineProperty,TA=Object.defineProperties,SA=Object.getOwnPropertyDescriptors,eb=Object.getOwnPropertySymbols,EA=Object.prototype.hasOwnProperty,AA=Object.prototype.propertyIsEnumerable,rb=(r,t,e)=>t in r?xA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,PA=(r,t)=>{for(var e in t||(t={}))EA.call(t,e)&&rb(r,e,t[e]);if(eb)for(var e of eb(t))AA.call(t,e)&&rb(r,e,t[e]);return r},wA=(r,t)=>TA(r,SA(t));const RA=new W,MA=new ut,OA=[0,0,0,0];class Hl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof J&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:V.shared.setValue(o).toArray():o=OA;const a=((e=t.frame)==null?void 0:e.copyTo(RA))||ci(n,MA).rectangle;a.width=Math.max(a.width,1/i)|0,a.height=Math.max(a.height,1/i)|0;const l=ks.create(wA(PA({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:i,antialias:s})),u=G.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:u,target:l,clearColor:o}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}Hl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"};class Xl{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new G,worldColor:4294967295,offset:new Y},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:n||a.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const c=u.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Pr(l.worldColor,c.uWorldColorAlpha,0),u.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(h=this._bindGroupPool.pop()||new Ht,this._activeBindGroups.push(h),h.setResource(u,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===gt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new st({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Xl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"};let CA=1;class jl{constructor(){this._tasks=[]}init(){ct.system.add(this._update,this)}repeat(t,e){const i=CA++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const i=this._tasks[e];if(t-i.last>=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){ct.system.remove(this._update,this),this._tasks.length=0}}jl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0};let ib=!1;const zl="8.3.1";function sb(r){if(!ib){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${zl} (${r}) http://www.pixijs.com/
|
|
1968
|
+
`,r}const YE={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function KE(r){return YE[r]}function O_(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof $.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const qE=0,ZE=1,QE=2,JE=3,tA=4,eA=5,C_=class Eu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[qE]=this.setBlend,this.map[ZE]=this.setOffset,this.map[QE]=this.setCullFace,this.map[JE]=this.setDepthTest,this.map[tA]=this.setFrontFace,this.map[eA]=this.setDepthMask,this.checks=[],this.defaultState=Ft.for2d()}contextChange(t){this.gl=t,this.blendModesMap=O_(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Eu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Eu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};C_.extension={type:[x.WebGLSystem],name:"state"};let G_=C_;class B_{constructor(t){this.target=el.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=z.UNSIGNED_BYTE,this.internalFormat=Cs.RGBA,this.format=Cs.RGBA,this.samplerType=0}}const I_={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},rA={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},F_={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight;const n=!!rA[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,i,s,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,i,s,0,t.format,t.type,a),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},xl={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,o=t.height,a=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,c=r.resourceHeight;u<a||c<l?((n!==a||o!==l)&&e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,u,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===l?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=l}},D_={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}xl.upload(r,t,e,i)}},Tl={linear:9729,nearest:9728},U_={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Ds={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},k_={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Sl(r,t,e,i,s,n,o,a){const l=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const u=Ds[o?"clamp-to-edge":r.addressModeU],c=Ds[o?"clamp-to-edge":r.addressModeV],h=Ds[o?"clamp-to-edge":r.addressModeW];t[s](l,t.TEXTURE_WRAP_S,u),t[s](l,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](l,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[s](l,t.TEXTURE_MAG_FILTER,Tl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const u=U_[r.minFilter][r.mipmapFilter];t[s](l,t.TEXTURE_MIN_FILTER,u)}}else t[s](l,t.TEXTURE_MIN_FILTER,Tl[r.minFilter]);if(i&&r.maxAnisotropy>1){const u=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,k_[r.compare])}function $_(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var iA=Object.defineProperty,sA=Object.defineProperties,nA=Object.getOwnPropertyDescriptors,L_=Object.getOwnPropertySymbols,oA=Object.prototype.hasOwnProperty,aA=Object.prototype.propertyIsEnumerable,N_=(r,t,e)=>t in r?iA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ee=(r,t)=>{for(var e in t||(t={}))oA.call(t,e)&&N_(r,e,t[e]);if(L_)for(var e of L_(t))aA.call(t,e)&&N_(r,e,t[e]);return r},lA=(r,t)=>sA(r,nA(t));function H_(r,t){let e={},i=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),Ee(Ee(Ee(Ee(Ee(Ee(lA(Ee({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function X_(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function uA(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const s=255.001/i;r[e]=r[e]*s+.5,r[e+1]=r[e+1]*s+.5,r[e+2]=r[e+2]*s+.5}}}const cA=4;class El{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:xl,buffer:I_,video:D_,compressed:F_},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=H_(t,this._renderer.context.extensions),this._mapFormatToType=X_(t),this._mapFormatToFormat=$_(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(P.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||P.EMPTY.source;const s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){const e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);const o=this.getGlSource(e);s.bindTexture(o.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new B_(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Sl(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Sl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=$.get().createCanvas();n.width=i,n.height=s;const o=n.getContext("2d");if(o){const a=o.createImageData(i,s);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),o=new Uint8Array(cA*s*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),u=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,u.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}El.extension={type:[x.WebGLSystem],name:"texture"};class Al{init(){const t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Kt(),i=Ve({name:"graphics",bits:[Wi,Ki(e),ts,Ye]});this.shader=new At({glProgram:i,resources:{localUniforms:t,batchSamplers:qi(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{geometry:a,instructions:l}=o.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(a,s.glProgram);const u=l.instructions;for(let c=0;c<l.instructionSize;c++){const h=u[c];if(h.size){for(let p=0;p<h.textures.count;p++)n.texture.bind(h.textures.textures[p],p);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}Al.extension={type:[x.WebGLPipesAdaptor],name:"graphics"};class Pl{init(){const t=Ve({name:"mesh",bits:[ts,Lg,Ye]});this._shader=new At({glProgram:t,resources:{uTexture:P.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,o=n.source;s.resources.uTexture=o,s.resources.uSampler=o.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Pl.extension={type:[x.WebGLPipesAdaptor],name:"mesh"};class wl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}wl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"};function Rl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){const n=i[s];t[n.renderPipeId].execute(n)}}class Ml{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),Rl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Ml.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"};function Us(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Ol(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Ol(r.renderGroupChildren[e],t);return t}function Cl(r,t,e){const i=r>>16&255,s=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,l=t&255,u=i+(o-i)*e,c=s+(a-s)*e,h=n+(l-n)*e;return(u<<16)+(c<<8)+h}const sr=16777215;function Gl(r,t){return r===sr||t===sr?r+t-sr:Cl(r,t,.5)}function hA(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===sr||o===sr?a=n+o-sr:a=Cl(n,o,.5),a+(s<<24)}const dA=new J,j_=Oe|dr|hi;function Bl(r,t=!1){z_(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),o=e[s],a=o.list,l=o.index;for(let u=0;u<l;u++){const c=a[u];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Il(c,i,0)}Us(a,l),o.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Bl(r.renderGroupChildren[s],t)}function z_(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Gl(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Il(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&j_&&V_(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&j_&&V_(r,dA,e)),!r.renderGroup){const n=r.children,o=n.length;for(let l=0;l<o;l++)Il(n[l],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function V_(r,t,e){if(e&dr){r.groupColor=Gl(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&hi&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Oe&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function W_(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;n<i;n++){const o=e[n];if(s=t[o.renderPipeId].validateRenderable(o),s)break}return r.structureDidChange=s,s}const pA=new G;class Fl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Ol(t.renderGroup,[]);let a=pA;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const l=n.renderPipes;for(let u=0;u<o.length;u++){const c=o[u];c.runOnRender(),c.instructionSet.renderPipes=l,c.structureDidChange?Us(c.childrenRenderablesToUpdate.list,0):W_(c,l),Bl(c),c.structureDidChange?(c.structureDidChange=!1,Ng(c,n)):fA(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Rl(t.renderGroup,l),l.uniformBatch&&l.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}}Fl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"};function fA(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let i=0;i<e;i++){const s=t[i];s.didViewUpdate&&r.updateRenderable(s)}Us(t,e)}class Dl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i.batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(Fi);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)H.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Dl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"};var mA=Object.defineProperty,Y_=Object.getOwnPropertySymbols,gA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,K_=(r,t,e)=>t in r?mA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,q_=(r,t)=>{for(var e in t||(t={}))gA.call(t,e)&&K_(r,e,t[e]);if(Y_)for(var e of Y_(t))_A.call(t,e)&&K_(r,e,t[e]);return r};const Ul=class Vy{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=q_(q_({},Vy.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ul.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0},Ul.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let Z_=Ul;const Zr={};U.handle(x.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Zr[r.name]=r.ref},r=>{delete Zr[r.name]});class kl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Zr[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Zr[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new ur,i.filters=[new Zr[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}kl.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"};var bA=Object.defineProperty,Q_=Object.getOwnPropertySymbols,yA=Object.prototype.hasOwnProperty,vA=Object.prototype.propertyIsEnumerable,J_=(r,t,e)=>t in r?bA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$l=(r,t)=>{for(var e in t||(t={}))yA.call(t,e)&&J_(r,e,t[e]);if(Q_)for(var e of Q_(t))vA.call(t,e)&&J_(r,e,t[e]);return r};const Ll={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Nl=class Wy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof J||t instanceof P?$l({target:t},e):$l($l({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Wy.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,o)=>{s.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},Ll[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Ll[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:Ll[e],quality:i});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof P)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof P?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof J&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const o=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Nl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"},Nl.defaultImageOptions={format:"png",quality:1};let tb=Nl;class ks extends P{static create(t){return new ks({source:new et(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var xA=Object.defineProperty,TA=Object.defineProperties,SA=Object.getOwnPropertyDescriptors,eb=Object.getOwnPropertySymbols,EA=Object.prototype.hasOwnProperty,AA=Object.prototype.propertyIsEnumerable,rb=(r,t,e)=>t in r?xA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,PA=(r,t)=>{for(var e in t||(t={}))EA.call(t,e)&&rb(r,e,t[e]);if(eb)for(var e of eb(t))AA.call(t,e)&&rb(r,e,t[e]);return r},wA=(r,t)=>TA(r,SA(t));const RA=new W,MA=new ut,OA=[0,0,0,0];class Hl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof J&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:V.shared.setValue(o).toArray():o=OA;const a=((e=t.frame)==null?void 0:e.copyTo(RA))||ci(n,MA).rectangle;a.width=Math.max(a.width,1/i)|0,a.height=Math.max(a.height,1/i)|0;const l=ks.create(wA(PA({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:i,antialias:s})),u=G.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:u,target:l,clearColor:o}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}Hl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"};class Xl{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new G,worldColor:4294967295,offset:new Y},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:i||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:n||a.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const c=u.uniforms;c.uProjectionMatrix=l.projectionMatrix,c.uResolution=l.resolution,c.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),c.uWorldTransformMatrix.tx-=l.offset.x,c.uWorldTransformMatrix.ty-=l.offset.y,Pr(l.worldColor,c.uWorldColorAlpha,0),u.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(h=this._bindGroupPool.pop()||new Ht,this._activeBindGroups.push(h),h.setResource(u,0)),l.bindGroup=h,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===gt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new st({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Xl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"};let CA=1;class jl{constructor(){this._tasks=[]}init(){ct.system.add(this._update,this)}repeat(t,e){const i=CA++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const i=this._tasks[e];if(t-i.last>=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){ct.system.remove(this._update,this),this._tasks.length=0}}jl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0};let ib=!1;const zl="8.3.2";function sb(r){if(!ib){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${zl} (${r}) http://www.pixijs.com/
|
|
1969
1969
|
|
|
1970
1970
|
`,"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(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${zl} - ${r} - http://www.pixijs.com/`);ib=!0}}class $s{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===gt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),sb(e)}}}$s.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2},$s.defaultOptions={hello:!1};var GA=Object.defineProperty,nb=Object.getOwnPropertySymbols,BA=Object.prototype.hasOwnProperty,IA=Object.prototype.propertyIsEnumerable,ob=(r,t,e)=>t in r?GA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ab=(r,t)=>{for(var e in t||(t={}))BA.call(t,e)&&ob(r,e,t[e]);if(nb)for(var e of nb(t))IA.call(t,e)&&ob(r,e,t[e]);return r};const Vl=class Yy{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=ab(ab({},Yy.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){t._lastUsed=this._now,t._lastInstructionTick===-1&&this._managedRenderables.push(t),t._lastInstructionTick=e.tick}run(){var t,e,i;const s=performance.now(),n=this._managedRenderables,o=this._renderer.renderPipes;let a=0;for(let l=0;l<n.length;l++){const u=n[l],c=(t=u.renderGroup)!=null?t:u.parentRenderGroup,h=(i=(e=c==null?void 0:c.instructionSet)==null?void 0:e.tick)!=null?i:-1;u._lastInstructionTick!==h&&s-u._lastUsed>this.maxUnusedTime?(u.destroyed||o[u.renderPipeId].destroyRenderable(u),u._lastInstructionTick=-1,a++):n[l-a]=u}n.length=n.length-a}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}};Vl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC"},Vl.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let lb=Vl;var FA=Object.defineProperty,ub=Object.getOwnPropertySymbols,DA=Object.prototype.hasOwnProperty,UA=Object.prototype.propertyIsEnumerable,cb=(r,t,e)=>t in r?FA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hb=(r,t)=>{for(var e in t||(t={}))DA.call(t,e)&&cb(r,e,t[e]);if(ub)for(var e of ub(t))UA.call(t,e)&&cb(r,e,t[e]);return r};const Wl=class Ky{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=hb(hb({},Ky.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e: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(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Wl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"},Wl.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let db=Wl;var kA=Object.defineProperty,pb=Object.getOwnPropertySymbols,$A=Object.prototype.hasOwnProperty,LA=Object.prototype.propertyIsEnumerable,fb=(r,t,e)=>t in r?kA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mb=(r,t)=>{for(var e in t||(t={}))$A.call(t,e)&&fb(r,e,t[e]);if(pb)for(var e of pb(t))LA.call(t,e)&&fb(r,e,t[e]);return r};const Yl=class qy{get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=mb(mb({},qy.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new W(0,0,t.width,t.height),this.canvas=t.canvas||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=dl(this.canvas,t),this.renderTarget=new Gs({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.multiView=!!t.multiView,this.autoDensity&&(this.canvas.style.width=`${this.texture.width}px`,this.canvas.style.height=`${this.texture.height}px`),this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height,this.autoDensity&&(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${e}px`)}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Yl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0},Yl.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let gb=Yl;const Kl=[Z_,Xl,$s,gb,Fl,db,Hl,tb,pa,lb,jl],ql=[kl,Ya,Dl,Ml,Ka,Za,qa,wl],NA=[...Kl,hl,t_,Wg,Qa,El,fl,rl,vl,yl,nl,G_,ol,sl],HA=[...ql],XA=[Va,Pl,Al],_b=[],bb=[],yb=[];U.handleByNamedList(x.WebGLSystem,_b),U.handleByNamedList(x.WebGLPipes,bb),U.handleByNamedList(x.WebGLPipesAdaptor,yb),U.add(...NA,...HA,...XA);class vb extends Ur{constructor(){const t={name:"webgl",type:gt.WEBGL,systems:_b,renderPipes:bb,renderPipeAdaptors:yb};super(t)}}var jA={__proto__:null,WebGLRenderer:vb};class Zl{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var s;const n=this._gpu.device,o=e.layout[i],a=[],l=this._renderer;for(const h in o){const p=(s=t.resources[h])!=null?s:t.resources[o[h]];let f;if(p._resourceType==="uniformGroup"){const m=p;l.ubo.updateUniformGroup(m);const _=m.buffer;f={buffer:l.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(p._resourceType==="buffer"){const m=p;f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(p._resourceType==="bufferResource"){const m=p;f={buffer:l.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if(p._resourceType==="textureSampler"){const m=p;f=l.texture.getGpuSampler(m)}else if(p._resourceType==="textureSource"){const m=p;f=l.texture.getGpuSource(m).createView({})}a.push({binding:o[h],resource:f})}const u=l.shader.getProgramData(e).bindGroups[i],c=n.createBindGroup({layout:u,entries:a});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}Zl.extension={type:[x.WebGPUSystem],name:"bindGroup"};class Ql{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Si(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}Ql.extension={type:[x.WebGPUSystem],name:"buffer"};function zA(r,t){const e=r.descriptor.size,i=t.gpu.device,s=new xt({data:new Float32Array(24e5),usage:j.MAP_READ|j.COPY_DST}),n=t.buffer.createGPUBuffer(s),o=i.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),i.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class xb{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class Jl{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}Jl.extension={type:[x.WebGPUSystem],name:"colorMask"};class Ls{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}}Ls.extension={type:[x.WebGPUSystem],name:"device"},Ls.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var VA=Object.defineProperty,Tb=Object.getOwnPropertySymbols,WA=Object.prototype.hasOwnProperty,YA=Object.prototype.propertyIsEnumerable,Sb=(r,t,e)=>t in r?VA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Eb=(r,t)=>{for(var e in t||(t={}))WA.call(t,e)&&Sb(r,e,t[e]);if(Tb)for(var e of Tb(t))YA.call(t,e)&&Sb(r,e,t[e]);return r};class tu{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){const n=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){for(const i in e.attributeData)this._setVertexBuffer(e.attributeData[i].location,t.attributes[i].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){const s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){const{geometry:e,shader:i,state:s,topology:n,size:o,start:a,instanceCount:l,skipSync:u}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,n),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,u),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,l||e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),l||e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,i=Eb({},this._boundVertexBuffer),s=this._boundIndexBuffer,n=Eb({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in i)this._setVertexBuffer(a,i[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}tu.extension={type:[x.WebGPUSystem],name:"encoder",priority:1};class eu{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:nt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;const s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}eu.extension={type:[x.WebGPUSystem],name:"stencil"};const Qr={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Ab(r){const t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;i<t.length;i++){const s=t[i];let n=Qr[s.data.type].size;const o=Qr[s.data.type].align;if(!Qr[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(n=Math.max(n,o)*s.data.size),e=Math.ceil(e/o)*o,s.size=n,s.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function Pb(r,t){const{size:e,align:i}=Qr[r.data.type],s=(i-e)/4;return`
|
|
1971
1971
|
v = uv.${r.data.name};
|
package/dist/pixi.min.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -1965,7 +1965,7 @@ fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
|
|
|
1965
1965
|
`))}class bl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,s){const i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,s))}_getUniformSyncFunction(t,e){var s;return((s=this._uniformGroupSyncHash[t._signature])==null?void 0:s[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const s=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),s[e._key]=this._cache[i],s[e._key]}_generateUniformsSync(t,e){return G_(t,e)}_getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const o in i)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}bl.extension={type:[v.WebGLSystem],name:"uniformGroup"};function nA(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
|
|
1966
1966
|
out vec4 finalColor;
|
|
1967
1967
|
${r}
|
|
1968
|
-
`,r}const oA={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function aA(r){return oA[r]}function I_(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof L.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const lA=0,uA=1,hA=2,cA=3,dA=4,pA=5,B_=class Tu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[lA]=this.setBlend,this.map[uA]=this.setOffset,this.map[hA]=this.setCullFace,this.map[cA]=this.setDepthTest,this.map[dA]=this.setFrontFace,this.map[pA]=this.setDepthMask,this.checks=[],this.defaultState=It.for2d()}contextChange(t){this.gl=t,this.blendModesMap=I_(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Tu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Tu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};B_.extension={type:[v.WebGLSystem],name:"state"};let F_=B_;class D_{constructor(t){this.target=tl.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=j.UNSIGNED_BYTE,this.internalFormat=Ci.RGBA,this.format=Ci.RGBA,this.samplerType=0}}const U_={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},fA={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},k_={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let s=r.pixelWidth,i=r.pixelHeight;const n=!!fA[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,t.format,t.type,a),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},vl={id:"image",upload(r,t,e,s){const i=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i);const n=t.width,o=t.height,a=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,h=r.resourceHeight;u<a||h<l?((n!==a||o!==l)&&e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,null),s===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,u,h,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===l?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):s===2?e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=l}},$_={id:"video",upload(r,t,e,s){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}vl.upload(r,t,e,s)}},yl={linear:9729,nearest:9728},L_={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Di={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},N_={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Tl(r,t,e,s,i,n,o,a){const l=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const u=Di[o?"clamp-to-edge":r.addressModeU],h=Di[o?"clamp-to-edge":r.addressModeV],c=Di[o?"clamp-to-edge":r.addressModeW];t[i](l,t.TEXTURE_WRAP_S,u),t[i](l,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[i](l,t.TEXTURE_WRAP_R,c)}if((!a||r.magFilter!=="linear")&&t[i](l,t.TEXTURE_MAG_FILTER,yl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const u=L_[r.minFilter][r.mipmapFilter];t[i](l,t.TEXTURE_MIN_FILTER,u)}}else t[i](l,t.TEXTURE_MIN_FILTER,yl[r.minFilter]);if(s&&r.maxAnisotropy>1){const u=Math.min(r.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[i](l,s.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[i](l,t.TEXTURE_COMPARE_FUNC,N_[r.compare])}function X_(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var mA=Object.defineProperty,gA=Object.defineProperties,_A=Object.getOwnPropertyDescriptors,H_=Object.getOwnPropertySymbols,xA=Object.prototype.hasOwnProperty,bA=Object.prototype.propertyIsEnumerable,j_=(r,t,e)=>t in r?mA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pe=(r,t)=>{for(var e in t||(t={}))xA.call(t,e)&&j_(r,e,t[e]);if(H_)for(var e of H_(t))bA.call(t,e)&&j_(r,e,t[e]);return r},vA=(r,t)=>gA(r,_A(t));function z_(r,t){let e={},s=r.RGBA;return r instanceof L.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},s=r.RGBA8),Pe(Pe(Pe(Pe(Pe(Pe(vA(Pe({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:s,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function V_(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function yA(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const s=r[e+3];if(s!==0){const i=255.001/s;r[e]=r[e]*i+.5,r[e+1]=r[e+1]*i+.5,r[e+2]=r[e+2]*i+.5}}}const TA=4;class Sl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:vl,buffer:U_,video:$_,compressed:k_},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=z_(t,this._renderer.context.extensions),this._mapFormatToType=V_(t),this._mapFormatToFormat=X_(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(P.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const s=t.source;t?(this.bindSource(s,e),this._useSeparateSamplers&&this._bindSampler(s.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const s=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||P.EMPTY.source;const i=this.getGlSource(t);s.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){const s=this._gl;if(!t){this._boundSamplers[e]=null,s.bindSampler(e,null);return}const i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,s.bindSampler(e,i))}unbind(t){const e=t.source,s=this._boundTextures,i=this._gl;for(let n=0;n<s.length;n++)if(s[n]===e){this._activateLocation(n);const o=this.getGlSource(e);i.bindTexture(o.target,null),s[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,s=new D_(e.createTexture());if(s.type=this._mapFormatToType[t.format],s.internalFormat=this._mapFormatToInternalFormat[t.format],s.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=s,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),s}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const s=this._gl,i=this.getGlSource(t);s.bindTexture(s.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,Tl(t.style,s,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,s=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,s,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const s=this.getGlSource(t);this._gl.generateMipmap(s.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,s=this._gl.createSampler();return this._glSamplers[t._resourceId]=s,Tl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:s,height:i}=this.getPixels(t),n=L.get().createCanvas();n.width=s,n.height=i;const o=n.getContext("2d");if(o){const a=o.createImageData(s,i);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,s=t.frame,i=Math.max(Math.round(s.width*e),1),n=Math.max(Math.round(s.height*e),1),o=new Uint8Array(TA*i*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),u=a.renderTarget.getGpuRenderTarget(l),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,u.resolveTargetFramebuffer),h.readPixels(Math.round(s.x*e),Math.round(s.y*e),i,n,h.RGBA,h.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}Sl.extension={type:[v.WebGLSystem],name:"texture"};class El{init(){const t=new rt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Yt(),s=Xe({name:"graphics",bits:[Ws,Ks(e),ti,je]});this.shader=new Pt({glProgram:s,resources:{localUniforms:t,batchSamplers:qs(e)}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{geometry:a,instructions:l}=o.getContextRenderData(s);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a,i.glProgram);const u=l.instructions;for(let h=0;h<l.instructionSize;h++){const c=u[h];if(c.size){for(let d=0;d<c.textures.count;d++)n.texture.bind(c.textures.textures[d],d);n.geometry.draw("triangle-list",c.size,c.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}El.extension={type:[v.WebGLPipesAdaptor],name:"graphics"};class Al{init(){const t=Xe({name:"mesh",bits:[ti,Hg,je]});this._shader=new Pt({glProgram:t,resources:{uTexture:P.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new C}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(i){if(!i.glProgram)return}else{i=this._shader;const n=e.texture,o=n.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=s.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Al.extension={type:[v.WebGLPipesAdaptor],name:"mesh"};class Pl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}Pl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"};function wl(r,t){const e=r.instructionSet,s=e.instructions;for(let i=0;i<e.instructionSize;i++){const n=s[i];t[n.renderPipeId].execute(n)}}class Rl{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),wl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Rl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"};function Ui(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Ml(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Ml(r.renderGroupChildren[e],t);return t}function Ol(r,t,e){const s=r>>16&255,i=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,l=t&255,u=s+(o-s)*e,h=i+(a-i)*e,c=n+(l-n)*e;return(u<<16)+(h<<8)+c}const tr=16777215;function Cl(r,t){return r===tr||t===tr?r+t-tr:Ol(r,t,.5)}function SA(r,t,e){const s=(e>>24&255)/255,i=t*s*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===tr||o===tr?a=n+o-tr:a=Ol(n,o,.5),a+(i<<24)}const EA=new Q,W_=Me|mr|fs;function Gl(r,t=!1){Y_(r);const e=r.childrenToUpdate,s=r.updateTick++;for(const i in e){const n=Number(i),o=e[i],a=o.list,l=o.index;for(let u=0;u<l;u++){const h=a[u];h.parentRenderGroup===r&&h.relativeRenderGroupDepth===n&&Il(h,s,0)}Ui(a,l),o.index=0}if(t)for(let i=0;i<r.renderGroupChildren.length;i++)Gl(r.renderGroupChildren[i],t)}function Y_(r){const t=r.root;let e;if(r.renderGroupParent){const s=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,s.worldTransform),r.worldColor=Cl(t.groupColor,s.worldColor),e=t.groupAlpha*s.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Il(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const s=r.localTransform;r.updateLocalTransform();const i=r.parent;if(i&&!i.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(s,i.relativeGroupTransform),e&W_&&K_(r,i,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(s),e&W_&&K_(r,EA,e)),!r.renderGroup){const n=r.children,o=n.length;for(let l=0;l<o;l++)Il(n[l],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function K_(r,t,e){if(e&mr){r.groupColor=Cl(r.localColor,t.groupColor);let s=r.localAlpha*t.groupAlpha;s=s<0?0:s>1?1:s,r.groupAlpha=s,r.groupColorAlpha=r.groupColor+((s*255|0)<<24)}e&fs&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Me&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function q_(r,t){const{list:e,index:s}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<s;n++){const o=e[n];if(i=t[o.renderPipeId].validateRenderable(o),i)break}return r.structureDidChange=i,i}const AA=new C;class Bl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const s=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Ml(t.renderGroup,[]);let a=AA;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const l=n.renderPipes;for(let u=0;u<o.length;u++){const h=o[u];h.runOnRender(),h.instructionSet.renderPipes=l,h.structureDidChange?Ui(h.childrenRenderablesToUpdate.list,0):q_(h,l),Gl(h),h.structureDidChange?(h.structureDidChange=!1,jg(h,n)):PA(h),h.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(h.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),wl(t.renderGroup,l),l.uniformBatch&&l.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=s,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}}Bl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"};function PA(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let s=0;s<e;s++){const i=t[s];i.didViewUpdate&&r.updateRenderable(i)}Ui(t,e)}class Fl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,s=this._getGpuSprite(t);return s.texture._source!==e._source?!s.batcher.checkAndUpdateTexture(s,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];X.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=X.get(ks);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)X.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Fl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"};var wA=Object.defineProperty,Z_=Object.getOwnPropertySymbols,RA=Object.prototype.hasOwnProperty,MA=Object.prototype.propertyIsEnumerable,Q_=(r,t,e)=>t in r?wA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J_=(r,t)=>{for(var e in t||(t={}))RA.call(t,e)&&Q_(r,e,t[e]);if(Z_)for(var e of Z_(t))MA.call(t,e)&&Q_(r,e,t[e]);return r};const Dl=class zb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new z(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=J_(J_({},zb.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Dl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0},Dl.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let tx=Dl;const Jr={};D.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Jr[r.name]=r.ref},r=>{delete Jr[r.name]});class Ul{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,s){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(s),this._isAdvanced=!!Jr[e],this._isAdvanced&&(this._beginAdvancedBlendMode(s),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Jr[e])return;let s=this._filterHash[e];s||(s=this._filterHash[e]=new dr,s.filters=[new Jr[e]]);const i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:s,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Ul.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"};var OA=Object.defineProperty,ex=Object.getOwnPropertySymbols,CA=Object.prototype.hasOwnProperty,GA=Object.prototype.propertyIsEnumerable,rx=(r,t,e)=>t in r?OA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kl=(r,t)=>{for(var e in t||(t={}))CA.call(t,e)&&rx(r,e,t[e]);if(ex)for(var e of ex(t))GA.call(t,e)&&rx(r,e,t[e]);return r};const $l={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Ll=class Vb{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof Q||t instanceof P?kl({target:t},e):kl(kl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Vb.defaultImageOptions);const{format:e,quality:s}=t,i=this.canvas(t);if(i.toBlob!==void 0)return new Promise((n,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},$l[e],s)});if(i.toDataURL!==void 0)return i.toDataURL($l[e],s);if(i.convertToBlob!==void 0){const n=await i.convertToBlob({type:$l[e],quality:s});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer;if(e instanceof P)return s.texture.generateCanvas(e);const i=s.textureGenerator.generateTexture(t),n=s.texture.generateCanvas(i);return i.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer,i=e instanceof P?e:s.textureGenerator.generateTexture(t),n=s.texture.getPixels(i);return e instanceof Q&&i.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const s=this.canvas(t),i=document.createElement("a");i.download=(e=t.filename)!=null?e:"image.png",i.href=s.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){var e;const s=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);const o=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Ll.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"},Ll.defaultImageOptions={format:"png",quality:1};let sx=Ll;class Qi extends P{static create(t){return new Qi({source:new tt(t)})}resize(t,e,s){return this.source.resize(t,e,s),this}}var IA=Object.defineProperty,BA=Object.defineProperties,FA=Object.getOwnPropertyDescriptors,ix=Object.getOwnPropertySymbols,DA=Object.prototype.hasOwnProperty,UA=Object.prototype.propertyIsEnumerable,nx=(r,t,e)=>t in r?IA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kA=(r,t)=>{for(var e in t||(t={}))DA.call(t,e)&&nx(r,e,t[e]);if(ix)for(var e of ix(t))UA.call(t,e)&&nx(r,e,t[e]);return r},$A=(r,t)=>BA(r,FA(t));const LA=new V,NA=new ht,XA=[0,0,0,0];class Nl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof Q&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const s=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:z.shared.setValue(o).toArray():o=XA;const a=((e=t.frame)==null?void 0:e.copyTo(LA))||ps(n,NA).rectangle;a.width=Math.max(a.width,1/s)|0,a.height=Math.max(a.height,1/s)|0;const l=Qi.create($A(kA({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:s,antialias:i})),u=C.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:u,target:l,clearColor:o}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}Nl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"};class Xl{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:s,worldColor:i,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new C,worldColor:4294967295,offset:new W},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:s||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const h=u.uniforms;h.uProjectionMatrix=l.projectionMatrix,h.uResolution=l.resolution,h.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),h.uWorldTransformMatrix.tx-=l.offset.x,h.uWorldTransformMatrix.ty-=l.offset.y,Mr(l.worldColor,h.uWorldColorAlpha,0),u.update();let c;this._renderer.renderPipes.uniformBatch?c=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(c=this._bindGroupPool.pop()||new Nt,this._activeBindGroups.push(c),c.setResource(u,0)),l.bindGroup=c,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===mt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new rt({uProjectionMatrix:{value:new C,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new C,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Xl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"};let HA=1;class Hl{constructor(){this._tasks=[]}init(){lt.system.add(this._update,this)}repeat(t,e){const s=HA++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const s=this._tasks[e];if(t-s.last>=s.duration){const i=t-s.start;s.func(i),s.last=t}}}destroy(){lt.system.remove(this._update,this),this._tasks.length=0}}Hl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0};let ox=!1;const jl="8.3.1";function ax(r){if(!ox){if(L.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${jl} (${r}) http://www.pixijs.com/
|
|
1968
|
+
`,r}const oA={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function aA(r){return oA[r]}function I_(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof L.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const lA=0,uA=1,hA=2,cA=3,dA=4,pA=5,B_=class Tu{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[lA]=this.setBlend,this.map[uA]=this.setOffset,this.map[hA]=this.setCullFace,this.map[cA]=this.setDepthTest,this.map[dA]=this.setFrontFace,this.map[pA]=this.setDepthMask,this.checks=[],this.defaultState=It.for2d()}contextChange(t){this.gl=t,this.blendModesMap=I_(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Tu._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Tu._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};B_.extension={type:[v.WebGLSystem],name:"state"};let F_=B_;class D_{constructor(t){this.target=tl.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=j.UNSIGNED_BYTE,this.internalFormat=Ci.RGBA,this.format=Ci.RGBA,this.samplerType=0}}const U_={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},fA={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},k_={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let s=r.pixelWidth,i=r.pixelHeight;const n=!!fA[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,t.format,t.type,a),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},vl={id:"image",upload(r,t,e,s){const i=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i);const n=t.width,o=t.height,a=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,h=r.resourceHeight;u<a||h<l?((n!==a||o!==l)&&e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,null),s===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,u,h,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===l?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):s===2?e.texImage2D(t.target,0,t.internalFormat,a,l,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=l}},$_={id:"video",upload(r,t,e,s){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}vl.upload(r,t,e,s)}},yl={linear:9729,nearest:9728},L_={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Di={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},N_={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function Tl(r,t,e,s,i,n,o,a){const l=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const u=Di[o?"clamp-to-edge":r.addressModeU],h=Di[o?"clamp-to-edge":r.addressModeV],c=Di[o?"clamp-to-edge":r.addressModeW];t[i](l,t.TEXTURE_WRAP_S,u),t[i](l,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[i](l,t.TEXTURE_WRAP_R,c)}if((!a||r.magFilter!=="linear")&&t[i](l,t.TEXTURE_MAG_FILTER,yl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const u=L_[r.minFilter][r.mipmapFilter];t[i](l,t.TEXTURE_MIN_FILTER,u)}}else t[i](l,t.TEXTURE_MIN_FILTER,yl[r.minFilter]);if(s&&r.maxAnisotropy>1){const u=Math.min(r.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[i](l,s.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[i](l,t.TEXTURE_COMPARE_FUNC,N_[r.compare])}function X_(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var mA=Object.defineProperty,gA=Object.defineProperties,_A=Object.getOwnPropertyDescriptors,H_=Object.getOwnPropertySymbols,xA=Object.prototype.hasOwnProperty,bA=Object.prototype.propertyIsEnumerable,j_=(r,t,e)=>t in r?mA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pe=(r,t)=>{for(var e in t||(t={}))xA.call(t,e)&&j_(r,e,t[e]);if(H_)for(var e of H_(t))bA.call(t,e)&&j_(r,e,t[e]);return r},vA=(r,t)=>gA(r,_A(t));function z_(r,t){let e={},s=r.RGBA;return r instanceof L.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},s=r.RGBA8),Pe(Pe(Pe(Pe(Pe(Pe(vA(Pe({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:s,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function V_(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function yA(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const s=r[e+3];if(s!==0){const i=255.001/s;r[e]=r[e]*i+.5,r[e+1]=r[e+1]*i+.5,r[e+2]=r[e+2]*i+.5}}}const TA=4;class Sl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:vl,buffer:U_,video:$_,compressed:k_},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=z_(t,this._renderer.context.extensions),this._mapFormatToType=V_(t),this._mapFormatToFormat=X_(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(P.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const s=t.source;t?(this.bindSource(s,e),this._useSeparateSamplers&&this._bindSampler(s.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const s=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||P.EMPTY.source;const i=this.getGlSource(t);s.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){const s=this._gl;if(!t){this._boundSamplers[e]=null,s.bindSampler(e,null);return}const i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,s.bindSampler(e,i))}unbind(t){const e=t.source,s=this._boundTextures,i=this._gl;for(let n=0;n<s.length;n++)if(s[n]===e){this._activateLocation(n);const o=this.getGlSource(e);i.bindTexture(o.target,null),s[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,s=new D_(e.createTexture());if(s.type=this._mapFormatToType[t.format],s.internalFormat=this._mapFormatToInternalFormat[t.format],s.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=s,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),s}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const s=this._gl,i=this.getGlSource(t);s.bindTexture(s.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,Tl(t.style,s,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,s=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,s,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const s=this.getGlSource(t);this._gl.generateMipmap(s.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,s=this._gl.createSampler();return this._glSamplers[t._resourceId]=s,Tl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:s,height:i}=this.getPixels(t),n=L.get().createCanvas();n.width=s,n.height=i;const o=n.getContext("2d");if(o){const a=o.createImageData(s,i);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,s=t.frame,i=Math.max(Math.round(s.width*e),1),n=Math.max(Math.round(s.height*e),1),o=new Uint8Array(TA*i*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),u=a.renderTarget.getGpuRenderTarget(l),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,u.resolveTargetFramebuffer),h.readPixels(Math.round(s.x*e),Math.round(s.y*e),i,n,h.RGBA,h.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}Sl.extension={type:[v.WebGLSystem],name:"texture"};class El{init(){const t=new rt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new C,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Yt(),s=Xe({name:"graphics",bits:[Ws,Ks(e),ti,je]});this.shader=new Pt({glProgram:s,resources:{localUniforms:t,batchSamplers:qs(e)}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{geometry:a,instructions:l}=o.getContextRenderData(s);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a,i.glProgram);const u=l.instructions;for(let h=0;h<l.instructionSize;h++){const c=u[h];if(c.size){for(let d=0;d<c.textures.count;d++)n.texture.bind(c.textures.textures[d],d);n.geometry.draw("triangle-list",c.size,c.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}El.extension={type:[v.WebGLPipesAdaptor],name:"graphics"};class Al{init(){const t=Xe({name:"mesh",bits:[ti,Hg,je]});this._shader=new Pt({glProgram:t,resources:{uTexture:P.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new C}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(i){if(!i.glProgram)return}else{i=this._shader;const n=e.texture,o=n.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=s.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Al.extension={type:[v.WebGLPipesAdaptor],name:"mesh"};class Pl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}Pl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"};function wl(r,t){const e=r.instructionSet,s=e.instructions;for(let i=0;i<e.instructionSize;i++){const n=s[i];t[n.renderPipeId].execute(n)}}class Rl{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),wl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Rl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"};function Ui(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Ml(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Ml(r.renderGroupChildren[e],t);return t}function Ol(r,t,e){const s=r>>16&255,i=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,l=t&255,u=s+(o-s)*e,h=i+(a-i)*e,c=n+(l-n)*e;return(u<<16)+(h<<8)+c}const tr=16777215;function Cl(r,t){return r===tr||t===tr?r+t-tr:Ol(r,t,.5)}function SA(r,t,e){const s=(e>>24&255)/255,i=t*s*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===tr||o===tr?a=n+o-tr:a=Ol(n,o,.5),a+(i<<24)}const EA=new Q,W_=Me|mr|fs;function Gl(r,t=!1){Y_(r);const e=r.childrenToUpdate,s=r.updateTick++;for(const i in e){const n=Number(i),o=e[i],a=o.list,l=o.index;for(let u=0;u<l;u++){const h=a[u];h.parentRenderGroup===r&&h.relativeRenderGroupDepth===n&&Il(h,s,0)}Ui(a,l),o.index=0}if(t)for(let i=0;i<r.renderGroupChildren.length;i++)Gl(r.renderGroupChildren[i],t)}function Y_(r){const t=r.root;let e;if(r.renderGroupParent){const s=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,s.worldTransform),r.worldColor=Cl(t.groupColor,s.worldColor),e=t.groupAlpha*s.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Il(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const s=r.localTransform;r.updateLocalTransform();const i=r.parent;if(i&&!i.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(s,i.relativeGroupTransform),e&W_&&K_(r,i,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(s),e&W_&&K_(r,EA,e)),!r.renderGroup){const n=r.children,o=n.length;for(let l=0;l<o;l++)Il(n[l],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function K_(r,t,e){if(e&mr){r.groupColor=Cl(r.localColor,t.groupColor);let s=r.localAlpha*t.groupAlpha;s=s<0?0:s>1?1:s,r.groupAlpha=s,r.groupColorAlpha=r.groupColor+((s*255|0)<<24)}e&fs&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Me&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function q_(r,t){const{list:e,index:s}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<s;n++){const o=e[n];if(i=t[o.renderPipeId].validateRenderable(o),i)break}return r.structureDidChange=i,i}const AA=new C;class Bl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const s=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Ml(t.renderGroup,[]);let a=AA;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const l=n.renderPipes;for(let u=0;u<o.length;u++){const h=o[u];h.runOnRender(),h.instructionSet.renderPipes=l,h.structureDidChange?Ui(h.childrenRenderablesToUpdate.list,0):q_(h,l),Gl(h),h.structureDidChange?(h.structureDidChange=!1,jg(h,n)):PA(h),h.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(h.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),wl(t.renderGroup,l),l.uniformBatch&&l.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=s,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}}Bl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"};function PA(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let s=0;s<e;s++){const i=t[s];i.didViewUpdate&&r.updateRenderable(i)}Ui(t,e)}class Fl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,s=this._getGpuSprite(t);return s.texture._source!==e._source?!s.batcher.checkAndUpdateTexture(s,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];X.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=X.get(ks);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)X.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Fl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"};var wA=Object.defineProperty,Z_=Object.getOwnPropertySymbols,RA=Object.prototype.hasOwnProperty,MA=Object.prototype.propertyIsEnumerable,Q_=(r,t,e)=>t in r?wA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J_=(r,t)=>{for(var e in t||(t={}))RA.call(t,e)&&Q_(r,e,t[e]);if(Z_)for(var e of Z_(t))MA.call(t,e)&&Q_(r,e,t[e]);return r};const Dl=class zb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new z(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=J_(J_({},zb.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Dl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0},Dl.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let tx=Dl;const Jr={};D.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Jr[r.name]=r.ref},r=>{delete Jr[r.name]});class Ul{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,s){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(s),this._isAdvanced=!!Jr[e],this._isAdvanced&&(this._beginAdvancedBlendMode(s),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Jr[e])return;let s=this._filterHash[e];s||(s=this._filterHash[e]=new dr,s.filters=[new Jr[e]]);const i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:s,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Ul.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"};var OA=Object.defineProperty,ex=Object.getOwnPropertySymbols,CA=Object.prototype.hasOwnProperty,GA=Object.prototype.propertyIsEnumerable,rx=(r,t,e)=>t in r?OA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kl=(r,t)=>{for(var e in t||(t={}))CA.call(t,e)&&rx(r,e,t[e]);if(ex)for(var e of ex(t))GA.call(t,e)&&rx(r,e,t[e]);return r};const $l={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Ll=class Vb{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof Q||t instanceof P?kl({target:t},e):kl(kl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Vb.defaultImageOptions);const{format:e,quality:s}=t,i=this.canvas(t);if(i.toBlob!==void 0)return new Promise((n,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},$l[e],s)});if(i.toDataURL!==void 0)return i.toDataURL($l[e],s);if(i.convertToBlob!==void 0){const n=await i.convertToBlob({type:$l[e],quality:s});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer;if(e instanceof P)return s.texture.generateCanvas(e);const i=s.textureGenerator.generateTexture(t),n=s.texture.generateCanvas(i);return i.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer,i=e instanceof P?e:s.textureGenerator.generateTexture(t),n=s.texture.getPixels(i);return e instanceof Q&&i.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const s=this.canvas(t),i=document.createElement("a");i.download=(e=t.filename)!=null?e:"image.png",i.href=s.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){var e;const s=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);const o=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Ll.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"},Ll.defaultImageOptions={format:"png",quality:1};let sx=Ll;class Qi extends P{static create(t){return new Qi({source:new tt(t)})}resize(t,e,s){return this.source.resize(t,e,s),this}}var IA=Object.defineProperty,BA=Object.defineProperties,FA=Object.getOwnPropertyDescriptors,ix=Object.getOwnPropertySymbols,DA=Object.prototype.hasOwnProperty,UA=Object.prototype.propertyIsEnumerable,nx=(r,t,e)=>t in r?IA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kA=(r,t)=>{for(var e in t||(t={}))DA.call(t,e)&&nx(r,e,t[e]);if(ix)for(var e of ix(t))UA.call(t,e)&&nx(r,e,t[e]);return r},$A=(r,t)=>BA(r,FA(t));const LA=new V,NA=new ht,XA=[0,0,0,0];class Nl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof Q&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const s=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:z.shared.setValue(o).toArray():o=XA;const a=((e=t.frame)==null?void 0:e.copyTo(LA))||ps(n,NA).rectangle;a.width=Math.max(a.width,1/s)|0,a.height=Math.max(a.height,1/s)|0;const l=Qi.create($A(kA({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:s,antialias:i})),u=C.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:u,target:l,clearColor:o}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}Nl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"};class Xl{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:s,worldColor:i,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new C,worldColor:4294967295,offset:new W},l={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:s||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},u=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(u);const h=u.uniforms;h.uProjectionMatrix=l.projectionMatrix,h.uResolution=l.resolution,h.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix),h.uWorldTransformMatrix.tx-=l.offset.x,h.uWorldTransformMatrix.ty-=l.offset.y,Mr(l.worldColor,h.uWorldColorAlpha,0),u.update();let c;this._renderer.renderPipes.uniformBatch?c=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(u,!1):(c=this._bindGroupPool.pop()||new Nt,this._activeBindGroups.push(c),c.setResource(u,0)),l.bindGroup=c,this._currentGlobalUniformData=l}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===mt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new rt({uProjectionMatrix:{value:new C,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new C,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Xl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"};let HA=1;class Hl{constructor(){this._tasks=[]}init(){lt.system.add(this._update,this)}repeat(t,e){const s=HA++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const s=this._tasks[e];if(t-s.last>=s.duration){const i=t-s.start;s.func(i),s.last=t}}}destroy(){lt.system.remove(this._update,this),this._tasks.length=0}}Hl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0};let ox=!1;const jl="8.3.2";function ax(r){if(!ox){if(L.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${jl} (${r}) http://www.pixijs.com/
|
|
1969
1969
|
|
|
1970
1970
|
`,"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(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${jl} - ${r} - http://www.pixijs.com/`);ox=!0}}class ki{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===mt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),ax(e)}}}ki.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"hello",priority:-2},ki.defaultOptions={hello:!1};var jA=Object.defineProperty,lx=Object.getOwnPropertySymbols,zA=Object.prototype.hasOwnProperty,VA=Object.prototype.propertyIsEnumerable,ux=(r,t,e)=>t in r?jA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hx=(r,t)=>{for(var e in t||(t={}))zA.call(t,e)&&ux(r,e,t[e]);if(lx)for(var e of lx(t))VA.call(t,e)&&ux(r,e,t[e]);return r};const zl=class Wb{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=hx(hx({},Wb.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){t._lastUsed=this._now,t._lastInstructionTick===-1&&this._managedRenderables.push(t),t._lastInstructionTick=e.tick}run(){var t,e,s;const i=performance.now(),n=this._managedRenderables,o=this._renderer.renderPipes;let a=0;for(let l=0;l<n.length;l++){const u=n[l],h=(t=u.renderGroup)!=null?t:u.parentRenderGroup,c=(s=(e=h==null?void 0:h.instructionSet)==null?void 0:e.tick)!=null?s:-1;u._lastInstructionTick!==c&&i-u._lastUsed>this.maxUnusedTime?(u.destroyed||o[u.renderPipeId].destroyRenderable(u),u._lastInstructionTick=-1,a++):n[l-a]=u}n.length=n.length-a}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}};zl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"renderableGC"},zl.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let cx=zl;var WA=Object.defineProperty,dx=Object.getOwnPropertySymbols,YA=Object.prototype.hasOwnProperty,KA=Object.prototype.propertyIsEnumerable,px=(r,t,e)=>t in r?WA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fx=(r,t)=>{for(var e in t||(t={}))YA.call(t,e)&&px(r,e,t[e]);if(dx)for(var e of dx(t))KA.call(t,e)&&px(r,e,t[e]);return r};const Vl=class Yb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=fx(fx({},Yb.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e: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(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const s=t[e];s.autoGarbageCollect&&s.resource&&s._touched>-1&&this.count-s._touched>this.maxIdle&&(s._touched=-1,s.unload())}}destroy(){this._renderer=null}};Vl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGC"},Vl.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};let mx=Vl;var qA=Object.defineProperty,gx=Object.getOwnPropertySymbols,ZA=Object.prototype.hasOwnProperty,QA=Object.prototype.propertyIsEnumerable,_x=(r,t,e)=>t in r?qA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xx=(r,t)=>{for(var e in t||(t={}))ZA.call(t,e)&&_x(r,e,t[e]);if(gx)for(var e of gx(t))QA.call(t,e)&&_x(r,e,t[e]);return r};const Wl=class Kb{get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=xx(xx({},Kb.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||L.get().createCanvas(),this.antialias=!!t.antialias,this.texture=cl(this.canvas,t),this.renderTarget=new Gi({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.multiView=!!t.multiView,this.autoDensity&&(this.canvas.style.width=`${this.texture.width}px`,this.canvas.style.height=`${this.texture.height}px`),this.resolution=t.resolution}resize(t,e,s){this.texture.source.resize(t,e,s),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height,this.autoDensity&&(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${e}px`)}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Wl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"view",priority:0},Wl.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let bx=Wl;const Yl=[tx,Xl,ki,bx,Bl,mx,Nl,sx,pa,cx,Hl],Kl=[Ul,Wa,Fl,Rl,Ya,qa,Ka,Pl],JA=[...Yl,hl,s_,qg,Za,Sl,pl,el,bl,xl,il,F_,nl,sl],tP=[...Kl],eP=[za,Al,El],vx=[],yx=[],Tx=[];D.handleByNamedList(v.WebGLSystem,vx),D.handleByNamedList(v.WebGLPipes,yx),D.handleByNamedList(v.WebGLPipesAdaptor,Tx),D.add(...JA,...tP,...eP);class Sx extends Lr{constructor(){const t={name:"webgl",type:mt.WEBGL,systems:vx,renderPipes:yx,renderPipeAdaptors:Tx};super(t)}}var rP={__proto__:null,WebGLRenderer:Sx};class ql{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,s){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,s)}_createBindGroup(t,e,s){var i;const n=this._gpu.device,o=e.layout[s],a=[],l=this._renderer;for(const c in o){const d=(i=t.resources[c])!=null?i:t.resources[o[c]];let p;if(d._resourceType==="uniformGroup"){const f=d;l.ubo.updateUniformGroup(f);const g=f.buffer;p={buffer:l.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(d._resourceType==="buffer"){const f=d;p={buffer:l.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(d._resourceType==="bufferResource"){const f=d;p={buffer:l.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(d._resourceType==="textureSampler"){const f=d;p=l.texture.getGpuSampler(f)}else if(d._resourceType==="textureSource"){const f=d;p=l.texture.getGpuSource(f).createView({})}a.push({binding:o[c],resource:p})}const u=l.shader.getProgramData(e).bindGroups[s],h=n.createBindGroup({layout:u,entries:a});return this._hash[t._key]=h,h}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}ql.extension={type:[v.WebGPUSystem],name:"bindGroup"};class Zl{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),s=t.data;return t._updateID&&s&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,s.buffer,0,(t._updateSize||s.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Ps(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}Zl.extension={type:[v.WebGPUSystem],name:"buffer"};function sP(r,t){const e=r.descriptor.size,s=t.gpu.device,i=new yt({data:new Float32Array(24e5),usage:H.MAP_READ|H.COPY_DST}),n=t.buffer.createGPUBuffer(i),o=s.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),s.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class Ex{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let s=e+t*4;if(s=Math.ceil(s/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,s>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=s,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let s=0;s<t.length;s++)this.data[e/4+s]=t[s];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class Ql{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}Ql.extension={type:[v.WebGPUSystem],name:"colorMask"};class $i{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await L.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),s=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:s});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}}$i.extension={type:[v.WebGPUSystem],name:"device"},$i.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var iP=Object.defineProperty,Ax=Object.getOwnPropertySymbols,nP=Object.prototype.hasOwnProperty,oP=Object.prototype.propertyIsEnumerable,Px=(r,t,e)=>t in r?iP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wx=(r,t)=>{for(var e in t||(t={}))nP.call(t,e)&&Px(r,e,t[e]);if(Ax)for(var e of Ax(t))oP.call(t,e)&&Px(r,e,t[e]);return r};class Jl{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,s,i){const n=this._renderer.pipeline.getPipeline(t,e,s,i);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,s){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const i=this._renderer.bindGroup.getBindGroup(e,s,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){for(const s in e.attributeData)this._setVertexBuffer(e.attributeData[s].location,t.attributes[s].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const s in t.groups){const i=t.groups[s];e||this._syncBindGroup(i),this.setBindGroup(s,i,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const s=t.resources[e];s.isUniformGroup&&this._renderer.ubo.updateUniformGroup(s)}}draw(t){const{geometry:e,shader:s,state:i,topology:n,size:o,start:a,instanceCount:l,skipSync:u}=t;this.setPipelineFromGeometryProgramAndState(e,s.gpuProgram,i,n),this.setGeometry(e,s.gpuProgram),this._setShaderBindGroups(s,u),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,l||e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),l||e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,s=wx({},this._boundVertexBuffer),i=this._boundIndexBuffer,n=wx({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in s)this._setVertexBuffer(a,s[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}Jl.extension={type:[v.WebGPUSystem],name:"encoder",priority:1};class tu{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:it.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const s=this._renderTargetStencilState[this._activeRenderTarget.uid];s.stencilMode=t,s.stencilReference=e;const i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}tu.extension={type:[v.WebGPUSystem],name:"stencil"};const ts={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Rx(r){const t=r.map(s=>({data:s,offset:0,size:0}));let e=0;for(let s=0;s<t.length;s++){const i=t[s];let n=ts[i.data.type].size;const o=ts[i.data.type].align;if(!ts[i.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${i.data.type}`);i.data.size>1&&(n=Math.max(n,o)*i.data.size),e=Math.ceil(e/o)*o,i.size=n,i.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function Mx(r,t){const{size:e,align:s}=ts[r.data.type],i=(s-e)/4;return`
|
|
1971
1971
|
v = uv.${r.data.name};
|
package/dist/pixi.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -39243,7 +39243,7 @@ SchedulerSystem.extension = {
|
|
|
39243
39243
|
|
|
39244
39244
|
"use strict";
|
|
39245
39245
|
let saidHello = false;
|
|
39246
|
-
const VERSION = "8.3.
|
|
39246
|
+
const VERSION = "8.3.2";
|
|
39247
39247
|
function sayHello(type) {
|
|
39248
39248
|
if (saidHello) {
|
|
39249
39249
|
return;
|
package/dist/webworker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -41500,7 +41500,7 @@ ${e}`);
|
|
|
41500
41500
|
|
|
41501
41501
|
"use strict";
|
|
41502
41502
|
let saidHello = false;
|
|
41503
|
-
const VERSION = "8.3.
|
|
41503
|
+
const VERSION = "8.3.2";
|
|
41504
41504
|
function sayHello(type) {
|
|
41505
41505
|
if (saidHello) {
|
|
41506
41506
|
return;
|
package/dist/webworker.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -1969,7 +1969,7 @@ fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
|
|
|
1969
1969
|
`))}class fl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){const s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){var i;return((i=this._uniformGroupSyncHash[t._signature])==null?void 0:i[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return V0(t,e)}_getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const a in s)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}fl.extension={type:[v.WebGLSystem],name:"uniformGroup"};function F3(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
|
|
1970
1970
|
out vec4 finalColor;
|
|
1971
1971
|
${r}
|
|
1972
|
-
`,r}const I3={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function U3(r){return I3[r]}function W0(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof H.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const k3=0,L3=1,N3=2,$3=3,H3=4,X3=5,Y0=class bc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[k3]=this.setBlend,this.map[L3]=this.setOffset,this.map[N3]=this.setCullFace,this.map[$3]=this.setDepthTest,this.map[H3]=this.setFrontFace,this.map[X3]=this.setDepthMask,this.checks=[],this.defaultState=Ht.for2d()}contextChange(t){this.gl=t,this.blendModesMap=W0(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(bc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(bc._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Y0.extension={type:[v.WebGLSystem],name:"state"};let q0=Y0;class K0{constructor(t){this.target=Yu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=j.UNSIGNED_BYTE,this.internalFormat=gn.RGBA,this.format=gn.RGBA,this.samplerType=0}}const Z0={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},z3={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Q0={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight;const n=!!z3[r.format];for(let a=0;a<r.resource.length;a++){const o=r.resource[a];n?e.compressedTexImage2D(e.TEXTURE_2D,a,t.internalFormat,i,s,0,o):e.texImage2D(e.TEXTURE_2D,a,t.internalFormat,i,s,0,t.format,t.type,o),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},pl={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,a=t.height,o=r.pixelWidth,u=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<o||c<u?((n!==o||a!==u)&&e.texImage2D(t.target,0,t.internalFormat,o,u,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===o||a===u?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,o,u,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=o,t.height=u}},J0={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}pl.upload(r,t,e,i)}},ml={linear:9729,nearest:9728},t2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},vn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},e2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function gl(r,t,e,i,s,n,a,o){const u=n;if(!o||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=vn[a?"clamp-to-edge":r.addressModeU],c=vn[a?"clamp-to-edge":r.addressModeV],h=vn[a?"clamp-to-edge":r.addressModeW];t[s](u,t.TEXTURE_WRAP_S,l),t[s](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](u,t.TEXTURE_WRAP_R,h)}if((!o||r.magFilter!=="linear")&&t[s](u,t.TEXTURE_MAG_FILTER,ml[r.magFilter]),e){if(!o||r.mipmapFilter!=="linear"){const l=t2[r.minFilter][r.mipmapFilter];t[s](u,t.TEXTURE_MIN_FILTER,l)}}else t[s](u,t.TEXTURE_MIN_FILTER,ml[r.minFilter]);if(i&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](u,i.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[s](u,t.TEXTURE_COMPARE_FUNC,e2[r.compare])}function r2(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var j3=Object.defineProperty,V3=Object.defineProperties,W3=Object.getOwnPropertyDescriptors,i2=Object.getOwnPropertySymbols,Y3=Object.prototype.hasOwnProperty,q3=Object.prototype.propertyIsEnumerable,s2=(r,t,e)=>t in r?j3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ke=(r,t)=>{for(var e in t||(t={}))Y3.call(t,e)&&s2(r,e,t[e]);if(i2)for(var e of i2(t))q3.call(t,e)&&s2(r,e,t[e]);return r},K3=(r,t)=>V3(r,W3(t));function n2(r,t){let e={},i=r.RGBA;return r instanceof H.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),ke(ke(ke(ke(ke(ke(K3(ke({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function a2(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function Z3(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const s=255.001/i;r[e]=r[e]*s+.5,r[e+1]=r[e+1]*s+.5,r[e+2]=r[e+2]*s+.5}}}const Q3=4;class _l{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:pl,buffer:Z0,video:J0,compressed:Q0},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=n2(t,this._renderer.context.extensions),this._mapFormatToType=a2(t),this._mapFormatToFormat=r2(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(R.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||R.EMPTY.source;const s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){const e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);const a=this.getGlSource(e);s.bindTexture(a.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new K0(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,gl(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,gl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=H.get().createCanvas();n.width=i,n.height=s;const a=n.getContext("2d");if(a){const o=a.createImageData(i,s);o.data.set(e),a.putImageData(o,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),a=new Uint8Array(Q3*s*n),o=this._renderer,u=o.renderTarget.getRenderTarget(t),l=o.renderTarget.getGpuRenderTarget(u),c=o.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}_l.extension={type:[v.WebGLSystem],name:"texture"};class bl{init(){const t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ae(),i=dr({name:"graphics",bits:[Ds,Bs(e),ks,pr]});this.shader=new Bt({glProgram:i,resources:{localUniforms:t,batchSamplers:Gs(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,a=n.graphicsContext,{geometry:o,instructions:u}=a.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(o,s.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let f=0;f<h.textures.count;f++)n.texture.bind(h.textures.textures[f],f);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}bl.extension={type:[v.WebGLPipesAdaptor],name:"graphics"};class yl{init(){const t=dr({name:"mesh",bits:[ks,i0,pr]});this._shader=new Bt({glProgram:t,resources:{uTexture:R.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,a=n.source;s.resources.uTexture=a,s.resources.uSampler=a.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}yl.extension={type:[v.WebGLPipesAdaptor],name:"mesh"};class xl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}xl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"};function vl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){const n=i[s];t[n.renderPipeId].execute(n)}}class Tl{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),vl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Tl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"};function Tn(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Sl(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Sl(r.renderGroupChildren[e],t);return t}function Al(r,t,e){const i=r>>16&255,s=r>>8&255,n=r&255,a=t>>16&255,o=t>>8&255,u=t&255,l=i+(a-i)*e,c=s+(o-s)*e,h=n+(u-n)*e;return(l<<16)+(c<<8)+h}const Ar=16777215;function El(r,t){return r===Ar||t===Ar?r+t-Ar:Al(r,t,.5)}function J3(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),a=e&16777215;let o;return n===Ar||a===Ar?o=n+a-Ar:o=Al(n,a,.5),o+(s<<24)}const tw=new rt,o2=Je|Wr|es;function wl(r,t=!1){u2(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),a=e[s],o=a.list,u=a.index;for(let l=0;l<u;l++){const c=o[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Cl(c,i,0)}Tn(o,u),a.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)wl(r.renderGroupChildren[s],t)}function u2(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=El(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Cl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&o2&&l2(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&o2&&l2(r,tw,e)),!r.renderGroup){const n=r.children,a=n.length;for(let u=0;u<a;u++)Cl(n[u],t,e);const o=r.parentRenderGroup;r.renderPipeId&&!o.structureDidChange&&o.updateRenderable(r)}}function l2(r,t,e){if(e&Wr){r.groupColor=El(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&es&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Je&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function c2(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;n<i;n++){const a=e[n];if(s=t[a.renderPipeId].validateRenderable(a),s)break}return r.structureDidChange=s,s}const ew=new G;class Rl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,a=Sl(t.renderGroup,[]);let o=ew;e&&(o=o.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const u=n.renderPipes;for(let l=0;l<a.length;l++){const c=a[l];c.runOnRender(),c.instructionSet.renderPipes=u,c.structureDidChange?Tn(c.childrenRenderablesToUpdate.list,0):c2(c,u),wl(c),c.structureDidChange?(c.structureDidChange=!1,s0(c,n)):rw(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),vl(t.renderGroup,u),u.uniformBatch&&u.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(o),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}}Rl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"};function rw(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let i=0;i<e;i++){const s=t[i];s.didViewUpdate&&r.updateRenderable(s)}Tn(t,e)}class Pl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i.batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];X.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=X.get(ys);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)X.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Pl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"};var iw=Object.defineProperty,h2=Object.getOwnPropertySymbols,sw=Object.prototype.hasOwnProperty,nw=Object.prototype.propertyIsEnumerable,d2=(r,t,e)=>t in r?iw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,f2=(r,t)=>{for(var e in t||(t={}))sw.call(t,e)&&d2(r,e,t[e]);if(h2)for(var e of h2(t))nw.call(t,e)&&d2(r,e,t[e]);return r};const Ml=class Ty{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=f2(f2({},Ty.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ml.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0},Ml.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let p2=Ml;const Ci={};L.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ci[r.name]=r.ref},r=>{delete Ci[r.name]});class Dl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Ci[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Ci[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new zr,i.filters=[new Ci[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Dl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"};var aw=Object.defineProperty,m2=Object.getOwnPropertySymbols,ow=Object.prototype.hasOwnProperty,uw=Object.prototype.propertyIsEnumerable,g2=(r,t,e)=>t in r?aw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ol=(r,t)=>{for(var e in t||(t={}))ow.call(t,e)&&g2(r,e,t[e]);if(m2)for(var e of m2(t))uw.call(t,e)&&g2(r,e,t[e]);return r};const Bl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Gl=class Sy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof rt||t instanceof R?Ol({target:t},e):Ol(Ol({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Sy.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,a)=>{s.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=a,u.readAsDataURL(o)},Bl[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Bl[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:Bl[e],quality:i});return new Promise((a,o)=>{const u=new FileReader;u.onload=()=>a(u.result),u.onerror=o,u.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof R)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof R?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof rt&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof R?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const a=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",a)}destroy(){this._renderer=null}};Gl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"},Gl.defaultImageOptions={format:"png",quality:1};let _2=Gl;class Sn extends R{static create(t){return new Sn({source:new et(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var lw=Object.defineProperty,cw=Object.defineProperties,hw=Object.getOwnPropertyDescriptors,b2=Object.getOwnPropertySymbols,dw=Object.prototype.hasOwnProperty,fw=Object.prototype.propertyIsEnumerable,y2=(r,t,e)=>t in r?lw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pw=(r,t)=>{for(var e in t||(t={}))dw.call(t,e)&&y2(r,e,t[e]);if(b2)for(var e of b2(t))fw.call(t,e)&&y2(r,e,t[e]);return r},mw=(r,t)=>cw(r,hw(t));const gw=new W,_w=new ft,bw=[0,0,0,0];class Fl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof rt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let a=t.clearColor;a?a=Array.isArray(a)&&a.length===4?a:V.shared.setValue(a).toArray():a=bw;const o=((e=t.frame)==null?void 0:e.copyTo(gw))||ts(n,_w).rectangle;o.width=Math.max(o.width,1/i)|0,o.height=Math.max(o.height,1/i)|0;const u=Sn.create(mw(pw({},t.textureSourceOptions),{width:o.width,height:o.height,resolution:i,antialias:s})),l=G.shared.translate(-o.x,-o.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:a}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Fl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"};class Il{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:n}){const a=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:a,worldTransformMatrix:new G,worldColor:4294967295,offset:new nt},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||a.size,worldTransformMatrix:i||o.worldTransformMatrix,worldColor:s||o.worldColor,offset:n||o.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const c=l.uniforms;c.uProjectionMatrix=u.projectionMatrix,c.uResolution=u.resolution,c.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),c.uWorldTransformMatrix.tx-=u.offset.x,c.uWorldTransformMatrix.ty-=u.offset.y,ri(u.worldColor,c.uWorldColorAlpha,0),l.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Zt,this._activeBindGroups.push(h),h.setResource(l,0)),u.bindGroup=h,this._currentGlobalUniformData=u}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===St.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new ot({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Il.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"};let yw=1;class Ul{constructor(){this._tasks=[]}init(){gt.system.add(this._update,this)}repeat(t,e){const i=yw++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const i=this._tasks[e];if(t-i.last>=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){gt.system.remove(this._update,this),this._tasks.length=0}}Ul.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0};let x2=!1;const kl="8.3.1";function v2(r){if(!x2){if(H.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${kl} (${r}) http://www.pixijs.com/
|
|
1972
|
+
`,r}const I3={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function U3(r){return I3[r]}function W0(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof H.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const k3=0,L3=1,N3=2,$3=3,H3=4,X3=5,Y0=class bc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[k3]=this.setBlend,this.map[L3]=this.setOffset,this.map[N3]=this.setCullFace,this.map[$3]=this.setDepthTest,this.map[H3]=this.setFrontFace,this.map[X3]=this.setDepthMask,this.checks=[],this.defaultState=Ht.for2d()}contextChange(t){this.gl=t,this.blendModesMap=W0(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(bc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(bc._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Y0.extension={type:[v.WebGLSystem],name:"state"};let q0=Y0;class K0{constructor(t){this.target=Yu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=j.UNSIGNED_BYTE,this.internalFormat=gn.RGBA,this.format=gn.RGBA,this.samplerType=0}}const Z0={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},z3={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Q0={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight;const n=!!z3[r.format];for(let a=0;a<r.resource.length;a++){const o=r.resource[a];n?e.compressedTexImage2D(e.TEXTURE_2D,a,t.internalFormat,i,s,0,o):e.texImage2D(e.TEXTURE_2D,a,t.internalFormat,i,s,0,t.format,t.type,o),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},pl={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,a=t.height,o=r.pixelWidth,u=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<o||c<u?((n!==o||a!==u)&&e.texImage2D(t.target,0,t.internalFormat,o,u,0,t.format,t.type,null),i===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===o||a===u?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,o,u,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=o,t.height=u}},J0={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}pl.upload(r,t,e,i)}},ml={linear:9729,nearest:9728},t2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},vn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},e2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function gl(r,t,e,i,s,n,a,o){const u=n;if(!o||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=vn[a?"clamp-to-edge":r.addressModeU],c=vn[a?"clamp-to-edge":r.addressModeV],h=vn[a?"clamp-to-edge":r.addressModeW];t[s](u,t.TEXTURE_WRAP_S,l),t[s](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](u,t.TEXTURE_WRAP_R,h)}if((!o||r.magFilter!=="linear")&&t[s](u,t.TEXTURE_MAG_FILTER,ml[r.magFilter]),e){if(!o||r.mipmapFilter!=="linear"){const l=t2[r.minFilter][r.mipmapFilter];t[s](u,t.TEXTURE_MIN_FILTER,l)}}else t[s](u,t.TEXTURE_MIN_FILTER,ml[r.minFilter]);if(i&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](u,i.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[s](u,t.TEXTURE_COMPARE_FUNC,e2[r.compare])}function r2(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var j3=Object.defineProperty,V3=Object.defineProperties,W3=Object.getOwnPropertyDescriptors,i2=Object.getOwnPropertySymbols,Y3=Object.prototype.hasOwnProperty,q3=Object.prototype.propertyIsEnumerable,s2=(r,t,e)=>t in r?j3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ke=(r,t)=>{for(var e in t||(t={}))Y3.call(t,e)&&s2(r,e,t[e]);if(i2)for(var e of i2(t))q3.call(t,e)&&s2(r,e,t[e]);return r},K3=(r,t)=>V3(r,W3(t));function n2(r,t){let e={},i=r.RGBA;return r instanceof H.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),ke(ke(ke(ke(ke(ke(K3(ke({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function a2(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function Z3(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const s=255.001/i;r[e]=r[e]*s+.5,r[e+1]=r[e+1]*s+.5,r[e+2]=r[e+2]*s+.5}}}const Q3=4;class _l{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:pl,buffer:Z0,video:J0,compressed:Q0},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=n2(t,this._renderer.context.extensions),this._mapFormatToType=a2(t),this._mapFormatToFormat=r2(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(R.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||R.EMPTY.source;const s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){const e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);const a=this.getGlSource(e);s.bindTexture(a.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new K0(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,gl(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,gl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=H.get().createCanvas();n.width=i,n.height=s;const a=n.getContext("2d");if(a){const o=a.createImageData(i,s);o.data.set(e),a.putImageData(o,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),a=new Uint8Array(Q3*s*n),o=this._renderer,u=o.renderTarget.getRenderTarget(t),l=o.renderTarget.getGpuRenderTarget(u),c=o.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}_l.extension={type:[v.WebGLSystem],name:"texture"};class bl{init(){const t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ae(),i=dr({name:"graphics",bits:[Ds,Bs(e),ks,pr]});this.shader=new Bt({glProgram:i,resources:{localUniforms:t,batchSamplers:Gs(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,a=n.graphicsContext,{geometry:o,instructions:u}=a.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(o,s.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let f=0;f<h.textures.count;f++)n.texture.bind(h.textures.textures[f],f);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}bl.extension={type:[v.WebGLPipesAdaptor],name:"graphics"};class yl{init(){const t=dr({name:"mesh",bits:[ks,i0,pr]});this._shader=new Bt({glProgram:t,resources:{uTexture:R.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,a=n.source;s.resources.uTexture=a,s.resources.uSampler=a.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}yl.extension={type:[v.WebGLPipesAdaptor],name:"mesh"};class xl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}xl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"};function vl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){const n=i[s];t[n.renderPipeId].execute(n)}}class Tl{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),vl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Tl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"};function Tn(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Sl(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Sl(r.renderGroupChildren[e],t);return t}function Al(r,t,e){const i=r>>16&255,s=r>>8&255,n=r&255,a=t>>16&255,o=t>>8&255,u=t&255,l=i+(a-i)*e,c=s+(o-s)*e,h=n+(u-n)*e;return(l<<16)+(c<<8)+h}const Ar=16777215;function El(r,t){return r===Ar||t===Ar?r+t-Ar:Al(r,t,.5)}function J3(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),a=e&16777215;let o;return n===Ar||a===Ar?o=n+a-Ar:o=Al(n,a,.5),o+(s<<24)}const tw=new rt,o2=Je|Wr|es;function wl(r,t=!1){u2(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),a=e[s],o=a.list,u=a.index;for(let l=0;l<u;l++){const c=o[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Cl(c,i,0)}Tn(o,u),a.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)wl(r.renderGroupChildren[s],t)}function u2(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=El(t.groupColor,i.worldColor),e=t.groupAlpha*i.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Cl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&o2&&l2(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&o2&&l2(r,tw,e)),!r.renderGroup){const n=r.children,a=n.length;for(let u=0;u<a;u++)Cl(n[u],t,e);const o=r.parentRenderGroup;r.renderPipeId&&!o.structureDidChange&&o.updateRenderable(r)}}function l2(r,t,e){if(e&Wr){r.groupColor=El(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&es&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Je&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function c2(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;n<i;n++){const a=e[n];if(s=t[a.renderPipeId].validateRenderable(a),s)break}return r.structureDidChange=s,s}const ew=new G;class Rl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,a=Sl(t.renderGroup,[]);let o=ew;e&&(o=o.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const u=n.renderPipes;for(let l=0;l<a.length;l++){const c=a[l];c.runOnRender(),c.instructionSet.renderPipes=u,c.structureDidChange?Tn(c.childrenRenderablesToUpdate.list,0):c2(c,u),wl(c),c.structureDidChange?(c.structureDidChange=!1,s0(c,n)):rw(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),vl(t.renderGroup,u),u.uniformBatch&&u.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(o),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}}Rl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"};function rw(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let i=0;i<e;i++){const s=t[i];s.didViewUpdate&&r.updateRenderable(s)}Tn(t,e)}class Pl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i.batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];X.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=X.get(ys);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)X.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Pl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"};var iw=Object.defineProperty,h2=Object.getOwnPropertySymbols,sw=Object.prototype.hasOwnProperty,nw=Object.prototype.propertyIsEnumerable,d2=(r,t,e)=>t in r?iw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,f2=(r,t)=>{for(var e in t||(t={}))sw.call(t,e)&&d2(r,e,t[e]);if(h2)for(var e of h2(t))nw.call(t,e)&&d2(r,e,t[e]);return r};const Ml=class Ty{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=f2(f2({},Ty.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ml.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0},Ml.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let p2=Ml;const Ci={};L.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ci[r.name]=r.ref},r=>{delete Ci[r.name]});class Dl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Ci[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Ci[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new zr,i.filters=[new Ci[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Dl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"};var aw=Object.defineProperty,m2=Object.getOwnPropertySymbols,ow=Object.prototype.hasOwnProperty,uw=Object.prototype.propertyIsEnumerable,g2=(r,t,e)=>t in r?aw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ol=(r,t)=>{for(var e in t||(t={}))ow.call(t,e)&&g2(r,e,t[e]);if(m2)for(var e of m2(t))uw.call(t,e)&&g2(r,e,t[e]);return r};const Bl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Gl=class Sy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof rt||t instanceof R?Ol({target:t},e):Ol(Ol({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Sy.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,a)=>{s.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=a,u.readAsDataURL(o)},Bl[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Bl[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:Bl[e],quality:i});return new Promise((a,o)=>{const u=new FileReader;u.onload=()=>a(u.result),u.onerror=o,u.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof R)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof R?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof rt&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof R?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const a=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",a)}destroy(){this._renderer=null}};Gl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"},Gl.defaultImageOptions={format:"png",quality:1};let _2=Gl;class Sn extends R{static create(t){return new Sn({source:new et(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var lw=Object.defineProperty,cw=Object.defineProperties,hw=Object.getOwnPropertyDescriptors,b2=Object.getOwnPropertySymbols,dw=Object.prototype.hasOwnProperty,fw=Object.prototype.propertyIsEnumerable,y2=(r,t,e)=>t in r?lw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pw=(r,t)=>{for(var e in t||(t={}))dw.call(t,e)&&y2(r,e,t[e]);if(b2)for(var e of b2(t))fw.call(t,e)&&y2(r,e,t[e]);return r},mw=(r,t)=>cw(r,hw(t));const gw=new W,_w=new ft,bw=[0,0,0,0];class Fl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof rt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let a=t.clearColor;a?a=Array.isArray(a)&&a.length===4?a:V.shared.setValue(a).toArray():a=bw;const o=((e=t.frame)==null?void 0:e.copyTo(gw))||ts(n,_w).rectangle;o.width=Math.max(o.width,1/i)|0,o.height=Math.max(o.height,1/i)|0;const u=Sn.create(mw(pw({},t.textureSourceOptions),{width:o.width,height:o.height,resolution:i,antialias:s})),l=G.shared.translate(-o.x,-o.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:a}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Fl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"};class Il{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:i,worldColor:s,offset:n}){const a=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:a,worldTransformMatrix:new G,worldColor:4294967295,offset:new nt},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||a.size,worldTransformMatrix:i||o.worldTransformMatrix,worldColor:s||o.worldColor,offset:n||o.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const c=l.uniforms;c.uProjectionMatrix=u.projectionMatrix,c.uResolution=u.resolution,c.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),c.uWorldTransformMatrix.tx-=u.offset.x,c.uWorldTransformMatrix.ty-=u.offset.y,ri(u.worldColor,c.uWorldColorAlpha,0),l.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Zt,this._activeBindGroups.push(h),h.setResource(l,0)),u.bindGroup=h,this._currentGlobalUniformData=u}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===St.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new ot({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Il.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"};let yw=1;class Ul{constructor(){this._tasks=[]}init(){gt.system.add(this._update,this)}repeat(t,e){const i=yw++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const i=this._tasks[e];if(t-i.last>=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){gt.system.remove(this._update,this),this._tasks.length=0}}Ul.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0};let x2=!1;const kl="8.3.2";function v2(r){if(!x2){if(H.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${kl} (${r}) http://www.pixijs.com/
|
|
1973
1973
|
|
|
1974
1974
|
`,"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(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${kl} - ${r} - http://www.pixijs.com/`);x2=!0}}class An{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===St.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),v2(e)}}}An.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"hello",priority:-2},An.defaultOptions={hello:!1};var xw=Object.defineProperty,T2=Object.getOwnPropertySymbols,vw=Object.prototype.hasOwnProperty,Tw=Object.prototype.propertyIsEnumerable,S2=(r,t,e)=>t in r?xw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,A2=(r,t)=>{for(var e in t||(t={}))vw.call(t,e)&&S2(r,e,t[e]);if(T2)for(var e of T2(t))Tw.call(t,e)&&S2(r,e,t[e]);return r};const Ll=class Ay{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=A2(A2({},Ay.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){t._lastUsed=this._now,t._lastInstructionTick===-1&&this._managedRenderables.push(t),t._lastInstructionTick=e.tick}run(){var t,e,i;const s=performance.now(),n=this._managedRenderables,a=this._renderer.renderPipes;let o=0;for(let u=0;u<n.length;u++){const l=n[u],c=(t=l.renderGroup)!=null?t:l.parentRenderGroup,h=(i=(e=c==null?void 0:c.instructionSet)==null?void 0:e.tick)!=null?i:-1;l._lastInstructionTick!==h&&s-l._lastUsed>this.maxUnusedTime?(l.destroyed||a[l.renderPipeId].destroyRenderable(l),l._lastInstructionTick=-1,o++):n[u-o]=l}n.length=n.length-o}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}};Ll.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"renderableGC"},Ll.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let E2=Ll;var Sw=Object.defineProperty,w2=Object.getOwnPropertySymbols,Aw=Object.prototype.hasOwnProperty,Ew=Object.prototype.propertyIsEnumerable,C2=(r,t,e)=>t in r?Sw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,R2=(r,t)=>{for(var e in t||(t={}))Aw.call(t,e)&&C2(r,e,t[e]);if(w2)for(var e of w2(t))Ew.call(t,e)&&C2(r,e,t[e]);return r};const Nl=class Ey{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=R2(R2({},Ey.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e: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(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Nl.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGC"},Nl.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let P2=Nl;var ww=Object.defineProperty,M2=Object.getOwnPropertySymbols,Cw=Object.prototype.hasOwnProperty,Rw=Object.prototype.propertyIsEnumerable,D2=(r,t,e)=>t in r?ww(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,O2=(r,t)=>{for(var e in t||(t={}))Cw.call(t,e)&&D2(r,e,t[e]);if(M2)for(var e of M2(t))Rw.call(t,e)&&D2(r,e,t[e]);return r};const $l=class wy{get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=O2(O2({},wy.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new W(0,0,t.width,t.height),this.canvas=t.canvas||H.get().createCanvas(),this.antialias=!!t.antialias,this.texture=nl(this.canvas,t),this.renderTarget=new _n({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.multiView=!!t.multiView,this.autoDensity&&(this.canvas.style.width=`${this.texture.width}px`,this.canvas.style.height=`${this.texture.height}px`),this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height,this.autoDensity&&(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${e}px`)}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};$l.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"view",priority:0},$l.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let B2=$l;const Hl=[p2,Il,An,B2,Rl,P2,Fl,_2,au,E2,Ul],Xl=[Dl,$u,Pl,Tl,Hu,zu,Xu,xl],Pw=[...Hl,sl,_0,c0,ju,_l,ol,qu,fl,dl,Qu,q0,Ju,Zu],Mw=[...Xl],Dw=[Lu,yl,bl],G2=[],F2=[],I2=[];L.handleByNamedList(v.WebGLSystem,G2),L.handleByNamedList(v.WebGLPipes,F2),L.handleByNamedList(v.WebGLPipesAdaptor,I2),L.add(...Pw,...Mw,...Dw);class U2 extends fi{constructor(){const t={name:"webgl",type:St.WEBGL,systems:G2,renderPipes:F2,renderPipeAdaptors:I2};super(t)}}var Ow={__proto__:null,WebGLRenderer:U2};class zl{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var s;const n=this._gpu.device,a=e.layout[i],o=[],u=this._renderer;for(const h in a){const f=(s=t.resources[h])!=null?s:t.resources[a[h]];let p;if(f._resourceType==="uniformGroup"){const m=f;u.ubo.updateUniformGroup(m);const _=m.buffer;p={buffer:u.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(f._resourceType==="buffer"){const m=f;p={buffer:u.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(f._resourceType==="bufferResource"){const m=f;p={buffer:u.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if(f._resourceType==="textureSampler"){const m=f;p=u.texture.getGpuSampler(m)}else if(f._resourceType==="textureSource"){const m=f;p=u.texture.getGpuSource(m).createView({})}o.push({binding:a[h],resource:p})}const l=u.shader.getProgramData(e).bindGroups[i],c=n.createBindGroup({layout:l,entries:o});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}zl.extension={type:[v.WebGPUSystem],name:"bindGroup"};class jl{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(os(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}jl.extension={type:[v.WebGPUSystem],name:"buffer"};function Bw(r,t){const e=r.descriptor.size,i=t.gpu.device,s=new Pt({data:new Float32Array(24e5),usage:z.MAP_READ|z.COPY_DST}),n=t.buffer.createGPUBuffer(s),a=i.createCommandEncoder();a.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),i.queue.submit([a.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class k2{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class Vl{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}Vl.extension={type:[v.WebGPUSystem],name:"colorMask"};class En{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await H.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}}En.extension={type:[v.WebGPUSystem],name:"device"},En.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var Gw=Object.defineProperty,L2=Object.getOwnPropertySymbols,Fw=Object.prototype.hasOwnProperty,Iw=Object.prototype.propertyIsEnumerable,N2=(r,t,e)=>t in r?Gw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$2=(r,t)=>{for(var e in t||(t={}))Fw.call(t,e)&&N2(r,e,t[e]);if(L2)for(var e of L2(t))Iw.call(t,e)&&N2(r,e,t[e]);return r};class Wl{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){const n=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){for(const i in e.attributeData)this._setVertexBuffer(e.attributeData[i].location,t.attributes[i].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){const s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){const{geometry:e,shader:i,state:s,topology:n,size:a,start:o,instanceCount:u,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,n),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(a||e.indexBuffer.data.length,u||e.instanceCount,o||0):this.renderPassEncoder.draw(a||e.getSize(),u||e.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,i=$2({},this._boundVertexBuffer),s=this._boundIndexBuffer,n=$2({},this._boundBindGroup);this._clearCache();const a=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(a.x,a.y,a.width,a.height,0,1),this.setPipeline(e);for(const o in i)this._setVertexBuffer(o,i[o]);for(const o in n)this.setBindGroup(o,n[o],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}Wl.extension={type:[v.WebGPUSystem],name:"encoder",priority:1};class Yl{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:ut.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;const s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}Yl.extension={type:[v.WebGPUSystem],name:"stencil"};const Ri={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function H2(r){const t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;i<t.length;i++){const s=t[i];let n=Ri[s.data.type].size;const a=Ri[s.data.type].align;if(!Ri[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(n=Math.max(n,a)*s.data.size),e=Math.ceil(e/a)*a,s.size=n,s.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function X2(r,t){const{size:e,align:i}=Ri[r.data.type],s=(i-e)/4;return`
|
|
1975
1975
|
v = uv.${r.data.name};
|
package/dist/webworker.min.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -1969,7 +1969,7 @@ fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
|
|
|
1969
1969
|
`))}class dl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,s){const i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,s))}_getUniformSyncFunction(t,e){var s;return((s=this._uniformGroupSyncHash[t._signature])==null?void 0:s[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const s=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),s[e._key]=this._cache[i],s[e._key]}_generateUniformsSync(t,e){return q0(t,e)}_getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const o in i)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}dl.extension={type:[y.WebGLSystem],name:"uniformGroup"};function W3(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
|
|
1970
1970
|
out vec4 finalColor;
|
|
1971
1971
|
${r}
|
|
1972
|
-
`,r}const Y3={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function q3(r){return Y3[r]}function K0(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof $.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const K3=0,Z3=1,Q3=2,J3=3,tw=4,ew=5,Z0=class gc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[K3]=this.setBlend,this.map[Z3]=this.setOffset,this.map[Q3]=this.setCullFace,this.map[J3]=this.setDepthTest,this.map[tw]=this.setFrontFace,this.map[ew]=this.setDepthMask,this.checks=[],this.defaultState=Lt.for2d()}contextChange(t){this.gl=t,this.blendModesMap=K0(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(gc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(gc._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Z0.extension={type:[y.WebGLSystem],name:"state"};let Q0=Z0;class J0{constructor(t){this.target=Wu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=z.UNSIGNED_BYTE,this.internalFormat=mn.RGBA,this.format=mn.RGBA,this.samplerType=0}}const t2={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},rw={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},e2={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let s=r.pixelWidth,i=r.pixelHeight;const n=!!rw[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,t.format,t.type,a),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},pl={id:"image",upload(r,t,e,s){const i=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i);const n=t.width,o=t.height,a=r.pixelWidth,u=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<a||c<u?((n!==a||o!==u)&&e.texImage2D(t.target,0,t.internalFormat,a,u,0,t.format,t.type,null),s===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===u?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):s===2?e.texImage2D(t.target,0,t.internalFormat,a,u,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=u}},r2={id:"video",upload(r,t,e,s){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}pl.upload(r,t,e,s)}},fl={linear:9729,nearest:9728},s2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},yn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},i2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function ml(r,t,e,s,i,n,o,a){const u=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=yn[o?"clamp-to-edge":r.addressModeU],c=yn[o?"clamp-to-edge":r.addressModeV],h=yn[o?"clamp-to-edge":r.addressModeW];t[i](u,t.TEXTURE_WRAP_S,l),t[i](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[i](u,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[i](u,t.TEXTURE_MAG_FILTER,fl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const l=s2[r.minFilter][r.mipmapFilter];t[i](u,t.TEXTURE_MIN_FILTER,l)}}else t[i](u,t.TEXTURE_MIN_FILTER,fl[r.minFilter]);if(s&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[i](u,s.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[i](u,t.TEXTURE_COMPARE_FUNC,i2[r.compare])}function n2(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var sw=Object.defineProperty,iw=Object.defineProperties,nw=Object.getOwnPropertyDescriptors,o2=Object.getOwnPropertySymbols,ow=Object.prototype.hasOwnProperty,aw=Object.prototype.propertyIsEnumerable,a2=(r,t,e)=>t in r?sw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Le=(r,t)=>{for(var e in t||(t={}))ow.call(t,e)&&a2(r,e,t[e]);if(o2)for(var e of o2(t))aw.call(t,e)&&a2(r,e,t[e]);return r},uw=(r,t)=>iw(r,nw(t));function u2(r,t){let e={},s=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},s=r.RGBA8),Le(Le(Le(Le(Le(Le(uw(Le({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:s,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function l2(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function lw(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const s=r[e+3];if(s!==0){const i=255.001/s;r[e]=r[e]*i+.5,r[e+1]=r[e+1]*i+.5,r[e+2]=r[e+2]*i+.5}}}const cw=4;class gl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:pl,buffer:t2,video:r2,compressed:e2},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=u2(t,this._renderer.context.extensions),this._mapFormatToType=l2(t),this._mapFormatToFormat=n2(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(C.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const s=t.source;t?(this.bindSource(s,e),this._useSeparateSamplers&&this._bindSampler(s.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const s=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||C.EMPTY.source;const i=this.getGlSource(t);s.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){const s=this._gl;if(!t){this._boundSamplers[e]=null,s.bindSampler(e,null);return}const i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,s.bindSampler(e,i))}unbind(t){const e=t.source,s=this._boundTextures,i=this._gl;for(let n=0;n<s.length;n++)if(s[n]===e){this._activateLocation(n);const o=this.getGlSource(e);i.bindTexture(o.target,null),s[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,s=new J0(e.createTexture());if(s.type=this._mapFormatToType[t.format],s.internalFormat=this._mapFormatToInternalFormat[t.format],s.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=s,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),s}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const s=this._gl,i=this.getGlSource(t);s.bindTexture(s.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,ml(t.style,s,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,s=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,s,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const s=this.getGlSource(t);this._gl.generateMipmap(s.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,s=this._gl.createSampler();return this._glSamplers[t._resourceId]=s,ml(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:s,height:i}=this.getPixels(t),n=$.get().createCanvas();n.width=s,n.height=i;const o=n.getContext("2d");if(o){const a=o.createImageData(s,i);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,s=t.frame,i=Math.max(Math.round(s.width*e),1),n=Math.max(Math.round(s.height*e),1),o=new Uint8Array(cw*i*n),a=this._renderer,u=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(u),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(s.x*e),Math.round(s.y*e),i,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}gl.extension={type:[y.WebGLSystem],name:"texture"};class _l{init(){const t=new it({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ne(),s=cr({name:"graphics",bits:[Di,Oi(e),Ui,dr]});this.shader=new Bt({glProgram:s,resources:{localUniforms:t,batchSamplers:Bi(e)}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{geometry:a,instructions:u}=o.getContextRenderData(s);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a,i.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let d=0;d<h.textures.count;d++)n.texture.bind(h.textures.textures[d],d);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}_l.extension={type:[y.WebGLPipesAdaptor],name:"graphics"};class xl{init(){const t=cr({name:"mesh",bits:[Ui,o0,dr]});this._shader=new Bt({glProgram:t,resources:{uTexture:C.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(i){if(!i.glProgram)return}else{i=this._shader;const n=e.texture,o=n.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=s.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}xl.extension={type:[y.WebGLPipesAdaptor],name:"mesh"};class bl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}bl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"};function yl(r,t){const e=r.instructionSet,s=e.instructions;for(let i=0;i<e.instructionSize;i++){const n=s[i];t[n.renderPipeId].execute(n)}}class vl{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),yl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}vl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"};function vn(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Tl(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Tl(r.renderGroupChildren[e],t);return t}function Al(r,t,e){const s=r>>16&255,i=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,u=t&255,l=s+(o-s)*e,c=i+(a-i)*e,h=n+(u-n)*e;return(l<<16)+(c<<8)+h}const Tr=16777215;function Sl(r,t){return r===Tr||t===Tr?r+t-Tr:Al(r,t,.5)}function hw(r,t,e){const s=(e>>24&255)/255,i=t*s*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===Tr||o===Tr?a=n+o-Tr:a=Al(n,o,.5),a+(i<<24)}const dw=new rt,c2=Je|Kr|si;function El(r,t=!1){h2(r);const e=r.childrenToUpdate,s=r.updateTick++;for(const i in e){const n=Number(i),o=e[i],a=o.list,u=o.index;for(let l=0;l<u;l++){const c=a[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&wl(c,s,0)}vn(a,u),o.index=0}if(t)for(let i=0;i<r.renderGroupChildren.length;i++)El(r.renderGroupChildren[i],t)}function h2(r){const t=r.root;let e;if(r.renderGroupParent){const s=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,s.worldTransform),r.worldColor=Sl(t.groupColor,s.worldColor),e=t.groupAlpha*s.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function wl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const s=r.localTransform;r.updateLocalTransform();const i=r.parent;if(i&&!i.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(s,i.relativeGroupTransform),e&c2&&d2(r,i,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(s),e&c2&&d2(r,dw,e)),!r.renderGroup){const n=r.children,o=n.length;for(let u=0;u<o;u++)wl(n[u],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function d2(r,t,e){if(e&Kr){r.groupColor=Sl(r.localColor,t.groupColor);let s=r.localAlpha*t.groupAlpha;s=s<0?0:s>1?1:s,r.groupAlpha=s,r.groupColorAlpha=r.groupColor+((s*255|0)<<24)}e&si&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Je&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function p2(r,t){const{list:e,index:s}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<s;n++){const o=e[n];if(i=t[o.renderPipeId].validateRenderable(o),i)break}return r.structureDidChange=i,i}const pw=new B;class Cl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const s=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Tl(t.renderGroup,[]);let a=pw;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const u=n.renderPipes;for(let l=0;l<o.length;l++){const c=o[l];c.runOnRender(),c.instructionSet.renderPipes=u,c.structureDidChange?vn(c.childrenRenderablesToUpdate.list,0):p2(c,u),El(c),c.structureDidChange?(c.structureDidChange=!1,a0(c,n)):fw(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),yl(t.renderGroup,u),u.uniformBatch&&u.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=s,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}}Cl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"};function fw(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let s=0;s<e;s++){const i=t[s];i.didViewUpdate&&r.updateRenderable(i)}vn(t,e)}class Rl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,s=this._getGpuSprite(t);return s.texture._source!==e._source?!s.batcher.checkAndUpdateTexture(s,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(vi);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)H.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Rl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"};var mw=Object.defineProperty,f2=Object.getOwnPropertySymbols,gw=Object.prototype.hasOwnProperty,_w=Object.prototype.propertyIsEnumerable,m2=(r,t,e)=>t in r?mw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,g2=(r,t)=>{for(var e in t||(t={}))gw.call(t,e)&&m2(r,e,t[e]);if(f2)for(var e of f2(t))_w.call(t,e)&&m2(r,e,t[e]);return r};const Pl=class vb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new j(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=g2(g2({},vb.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Pl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0},Pl.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let _2=Pl;const Ps={};N.handle(y.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ps[r.name]=r.ref},r=>{delete Ps[r.name]});class Dl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,s){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(s),this._isAdvanced=!!Ps[e],this._isAdvanced&&(this._beginAdvancedBlendMode(s),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Ps[e])return;let s=this._filterHash[e];s||(s=this._filterHash[e]=new Wr,s.filters=[new Ps[e]]);const i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:s,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Dl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"};var xw=Object.defineProperty,x2=Object.getOwnPropertySymbols,bw=Object.prototype.hasOwnProperty,yw=Object.prototype.propertyIsEnumerable,b2=(r,t,e)=>t in r?xw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ml=(r,t)=>{for(var e in t||(t={}))bw.call(t,e)&&b2(r,e,t[e]);if(x2)for(var e of x2(t))yw.call(t,e)&&b2(r,e,t[e]);return r};const Ol={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Bl=class Tb{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof rt||t instanceof C?Ml({target:t},e):Ml(Ml({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Tb.defaultImageOptions);const{format:e,quality:s}=t,i=this.canvas(t);if(i.toBlob!==void 0)return new Promise((n,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=o,u.readAsDataURL(a)},Ol[e],s)});if(i.toDataURL!==void 0)return i.toDataURL(Ol[e],s);if(i.convertToBlob!==void 0){const n=await i.convertToBlob({type:Ol[e],quality:s});return new Promise((o,a)=>{const u=new FileReader;u.onload=()=>o(u.result),u.onerror=a,u.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer;if(e instanceof C)return s.texture.generateCanvas(e);const i=s.textureGenerator.generateTexture(t),n=s.texture.generateCanvas(i);return i.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer,i=e instanceof C?e:s.textureGenerator.generateTexture(t),n=s.texture.getPixels(i);return e instanceof rt&&i.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof C?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const s=this.canvas(t),i=document.createElement("a");i.download=(e=t.filename)!=null?e:"image.png",i.href=s.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){var e;const s=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);const o=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Bl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"},Bl.defaultImageOptions={format:"png",quality:1};let y2=Bl;class Un extends C{static create(t){return new Un({source:new tt(t)})}resize(t,e,s){return this.source.resize(t,e,s),this}}var vw=Object.defineProperty,Tw=Object.defineProperties,Aw=Object.getOwnPropertyDescriptors,v2=Object.getOwnPropertySymbols,Sw=Object.prototype.hasOwnProperty,Ew=Object.prototype.propertyIsEnumerable,T2=(r,t,e)=>t in r?vw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ww=(r,t)=>{for(var e in t||(t={}))Sw.call(t,e)&&T2(r,e,t[e]);if(v2)for(var e of v2(t))Ew.call(t,e)&&T2(r,e,t[e]);return r},Cw=(r,t)=>Tw(r,Aw(t));const Rw=new V,Pw=new pt,Dw=[0,0,0,0];class Gl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof rt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const s=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:j.shared.setValue(o).toArray():o=Dw;const a=((e=t.frame)==null?void 0:e.copyTo(Rw))||ri(n,Pw).rectangle;a.width=Math.max(a.width,1/s)|0,a.height=Math.max(a.height,1/s)|0;const u=Un.create(Cw(ww({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:s,antialias:i})),l=B.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:o}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Gl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"};class Il{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:s,worldColor:i,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new B,worldColor:4294967295,offset:new nt},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:s||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const c=l.uniforms;c.uProjectionMatrix=u.projectionMatrix,c.uResolution=u.resolution,c.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),c.uWorldTransformMatrix.tx-=u.offset.x,c.uWorldTransformMatrix.ty-=u.offset.y,ns(u.worldColor,c.uWorldColorAlpha,0),l.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Kt,this._activeBindGroups.push(h),h.setResource(l,0)),u.bindGroup=h,this._currentGlobalUniformData=u}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Tt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new it({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Il.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"};let Mw=1;class Fl{constructor(){this._tasks=[]}init(){mt.system.add(this._update,this)}repeat(t,e){const s=Mw++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const s=this._tasks[e];if(t-s.last>=s.duration){const i=t-s.start;s.func(i),s.last=t}}}destroy(){mt.system.remove(this._update,this),this._tasks.length=0}}Fl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0};let A2=!1;const Ul="8.3.1";function S2(r){if(!A2){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${Ul} (${r}) http://www.pixijs.com/
|
|
1972
|
+
`,r}const Y3={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function q3(r){return Y3[r]}function K0(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof $.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const K3=0,Z3=1,Q3=2,J3=3,tw=4,ew=5,Z0=class gc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[K3]=this.setBlend,this.map[Z3]=this.setOffset,this.map[Q3]=this.setCullFace,this.map[J3]=this.setDepthTest,this.map[tw]=this.setFrontFace,this.map[ew]=this.setDepthMask,this.checks=[],this.defaultState=Lt.for2d()}contextChange(t){this.gl=t,this.blendModesMap=K0(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(gc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(gc._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Z0.extension={type:[y.WebGLSystem],name:"state"};let Q0=Z0;class J0{constructor(t){this.target=Wu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=z.UNSIGNED_BYTE,this.internalFormat=mn.RGBA,this.format=mn.RGBA,this.samplerType=0}}const t2={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},rw={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},e2={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let s=r.pixelWidth,i=r.pixelHeight;const n=!!rw[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,t.format,t.type,a),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},pl={id:"image",upload(r,t,e,s){const i=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i);const n=t.width,o=t.height,a=r.pixelWidth,u=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<a||c<u?((n!==a||o!==u)&&e.texImage2D(t.target,0,t.internalFormat,a,u,0,t.format,t.type,null),s===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===u?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):s===2?e.texImage2D(t.target,0,t.internalFormat,a,u,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=u}},r2={id:"video",upload(r,t,e,s){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}pl.upload(r,t,e,s)}},fl={linear:9729,nearest:9728},s2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},yn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},i2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function ml(r,t,e,s,i,n,o,a){const u=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=yn[o?"clamp-to-edge":r.addressModeU],c=yn[o?"clamp-to-edge":r.addressModeV],h=yn[o?"clamp-to-edge":r.addressModeW];t[i](u,t.TEXTURE_WRAP_S,l),t[i](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[i](u,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[i](u,t.TEXTURE_MAG_FILTER,fl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const l=s2[r.minFilter][r.mipmapFilter];t[i](u,t.TEXTURE_MIN_FILTER,l)}}else t[i](u,t.TEXTURE_MIN_FILTER,fl[r.minFilter]);if(s&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[i](u,s.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[i](u,t.TEXTURE_COMPARE_FUNC,i2[r.compare])}function n2(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var sw=Object.defineProperty,iw=Object.defineProperties,nw=Object.getOwnPropertyDescriptors,o2=Object.getOwnPropertySymbols,ow=Object.prototype.hasOwnProperty,aw=Object.prototype.propertyIsEnumerable,a2=(r,t,e)=>t in r?sw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Le=(r,t)=>{for(var e in t||(t={}))ow.call(t,e)&&a2(r,e,t[e]);if(o2)for(var e of o2(t))aw.call(t,e)&&a2(r,e,t[e]);return r},uw=(r,t)=>iw(r,nw(t));function u2(r,t){let e={},s=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},s=r.RGBA8),Le(Le(Le(Le(Le(Le(uw(Le({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:s,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function l2(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function lw(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const s=r[e+3];if(s!==0){const i=255.001/s;r[e]=r[e]*i+.5,r[e+1]=r[e+1]*i+.5,r[e+2]=r[e+2]*i+.5}}}const cw=4;class gl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:pl,buffer:t2,video:r2,compressed:e2},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=u2(t,this._renderer.context.extensions),this._mapFormatToType=l2(t),this._mapFormatToFormat=n2(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(C.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const s=t.source;t?(this.bindSource(s,e),this._useSeparateSamplers&&this._bindSampler(s.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const s=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||C.EMPTY.source;const i=this.getGlSource(t);s.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){const s=this._gl;if(!t){this._boundSamplers[e]=null,s.bindSampler(e,null);return}const i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,s.bindSampler(e,i))}unbind(t){const e=t.source,s=this._boundTextures,i=this._gl;for(let n=0;n<s.length;n++)if(s[n]===e){this._activateLocation(n);const o=this.getGlSource(e);i.bindTexture(o.target,null),s[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,s=new J0(e.createTexture());if(s.type=this._mapFormatToType[t.format],s.internalFormat=this._mapFormatToInternalFormat[t.format],s.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=s,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),s}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const s=this._gl,i=this.getGlSource(t);s.bindTexture(s.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,ml(t.style,s,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,s=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,s,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const s=this.getGlSource(t);this._gl.generateMipmap(s.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,s=this._gl.createSampler();return this._glSamplers[t._resourceId]=s,ml(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:s,height:i}=this.getPixels(t),n=$.get().createCanvas();n.width=s,n.height=i;const o=n.getContext("2d");if(o){const a=o.createImageData(s,i);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,s=t.frame,i=Math.max(Math.round(s.width*e),1),n=Math.max(Math.round(s.height*e),1),o=new Uint8Array(cw*i*n),a=this._renderer,u=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(u),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(s.x*e),Math.round(s.y*e),i,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}gl.extension={type:[y.WebGLSystem],name:"texture"};class _l{init(){const t=new it({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ne(),s=cr({name:"graphics",bits:[Di,Oi(e),Ui,dr]});this.shader=new Bt({glProgram:s,resources:{localUniforms:t,batchSamplers:Bi(e)}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{geometry:a,instructions:u}=o.getContextRenderData(s);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a,i.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let d=0;d<h.textures.count;d++)n.texture.bind(h.textures.textures[d],d);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}_l.extension={type:[y.WebGLPipesAdaptor],name:"graphics"};class xl{init(){const t=cr({name:"mesh",bits:[Ui,o0,dr]});this._shader=new Bt({glProgram:t,resources:{uTexture:C.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(i){if(!i.glProgram)return}else{i=this._shader;const n=e.texture,o=n.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=s.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}xl.extension={type:[y.WebGLPipesAdaptor],name:"mesh"};class bl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}bl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"};function yl(r,t){const e=r.instructionSet,s=e.instructions;for(let i=0;i<e.instructionSize;i++){const n=s[i];t[n.renderPipeId].execute(n)}}class vl{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),yl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}vl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"};function vn(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Tl(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Tl(r.renderGroupChildren[e],t);return t}function Al(r,t,e){const s=r>>16&255,i=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,u=t&255,l=s+(o-s)*e,c=i+(a-i)*e,h=n+(u-n)*e;return(l<<16)+(c<<8)+h}const Tr=16777215;function Sl(r,t){return r===Tr||t===Tr?r+t-Tr:Al(r,t,.5)}function hw(r,t,e){const s=(e>>24&255)/255,i=t*s*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===Tr||o===Tr?a=n+o-Tr:a=Al(n,o,.5),a+(i<<24)}const dw=new rt,c2=Je|Kr|si;function El(r,t=!1){h2(r);const e=r.childrenToUpdate,s=r.updateTick++;for(const i in e){const n=Number(i),o=e[i],a=o.list,u=o.index;for(let l=0;l<u;l++){const c=a[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&wl(c,s,0)}vn(a,u),o.index=0}if(t)for(let i=0;i<r.renderGroupChildren.length;i++)El(r.renderGroupChildren[i],t)}function h2(r){const t=r.root;let e;if(r.renderGroupParent){const s=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,s.worldTransform),r.worldColor=Sl(t.groupColor,s.worldColor),e=t.groupAlpha*s.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function wl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const s=r.localTransform;r.updateLocalTransform();const i=r.parent;if(i&&!i.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(s,i.relativeGroupTransform),e&c2&&d2(r,i,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(s),e&c2&&d2(r,dw,e)),!r.renderGroup){const n=r.children,o=n.length;for(let u=0;u<o;u++)wl(n[u],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function d2(r,t,e){if(e&Kr){r.groupColor=Sl(r.localColor,t.groupColor);let s=r.localAlpha*t.groupAlpha;s=s<0?0:s>1?1:s,r.groupAlpha=s,r.groupColorAlpha=r.groupColor+((s*255|0)<<24)}e&si&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Je&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function p2(r,t){const{list:e,index:s}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<s;n++){const o=e[n];if(i=t[o.renderPipeId].validateRenderable(o),i)break}return r.structureDidChange=i,i}const pw=new B;class Cl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const s=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Tl(t.renderGroup,[]);let a=pw;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const u=n.renderPipes;for(let l=0;l<o.length;l++){const c=o[l];c.runOnRender(),c.instructionSet.renderPipes=u,c.structureDidChange?vn(c.childrenRenderablesToUpdate.list,0):p2(c,u),El(c),c.structureDidChange?(c.structureDidChange=!1,a0(c,n)):fw(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),yl(t.renderGroup,u),u.uniformBatch&&u.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=s,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}}Cl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"};function fw(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let s=0;s<e;s++){const i=t[s];i.didViewUpdate&&r.updateRenderable(i)}vn(t,e)}class Rl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e.batcher.updateElement(e)}validateRenderable(t){const e=t._texture,s=this._getGpuSprite(t);return s.texture._source!==e._source?!s.batcher.checkAndUpdateTexture(s,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(vi);return e.renderable=t,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)H.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Rl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"};var mw=Object.defineProperty,f2=Object.getOwnPropertySymbols,gw=Object.prototype.hasOwnProperty,_w=Object.prototype.propertyIsEnumerable,m2=(r,t,e)=>t in r?mw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,g2=(r,t)=>{for(var e in t||(t={}))gw.call(t,e)&&m2(r,e,t[e]);if(f2)for(var e of f2(t))_w.call(t,e)&&m2(r,e,t[e]);return r};const Pl=class vb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new j(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=g2(g2({},vb.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(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Pl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0},Pl.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let _2=Pl;const Ps={};N.handle(y.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ps[r.name]=r.ref},r=>{delete Ps[r.name]});class Dl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,s){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(s),this._isAdvanced=!!Ps[e],this._isAdvanced&&(this._beginAdvancedBlendMode(s),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Ps[e])return;let s=this._filterHash[e];s||(s=this._filterHash[e]=new Wr,s.filters=[new Ps[e]]);const i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:s,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Dl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"};var xw=Object.defineProperty,x2=Object.getOwnPropertySymbols,bw=Object.prototype.hasOwnProperty,yw=Object.prototype.propertyIsEnumerable,b2=(r,t,e)=>t in r?xw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ml=(r,t)=>{for(var e in t||(t={}))bw.call(t,e)&&b2(r,e,t[e]);if(x2)for(var e of x2(t))yw.call(t,e)&&b2(r,e,t[e]);return r};const Ol={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Bl=class Tb{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof rt||t instanceof C?Ml({target:t},e):Ml(Ml({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Tb.defaultImageOptions);const{format:e,quality:s}=t,i=this.canvas(t);if(i.toBlob!==void 0)return new Promise((n,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=o,u.readAsDataURL(a)},Ol[e],s)});if(i.toDataURL!==void 0)return i.toDataURL(Ol[e],s);if(i.convertToBlob!==void 0){const n=await i.convertToBlob({type:Ol[e],quality:s});return new Promise((o,a)=>{const u=new FileReader;u.onload=()=>o(u.result),u.onerror=a,u.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer;if(e instanceof C)return s.texture.generateCanvas(e);const i=s.textureGenerator.generateTexture(t),n=s.texture.generateCanvas(i);return i.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer,i=e instanceof C?e:s.textureGenerator.generateTexture(t),n=s.texture.getPixels(i);return e instanceof rt&&i.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof C?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const s=this.canvas(t),i=document.createElement("a");i.download=(e=t.filename)!=null?e:"image.png",i.href=s.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){var e;const s=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);const o=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Bl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"},Bl.defaultImageOptions={format:"png",quality:1};let y2=Bl;class Un extends C{static create(t){return new Un({source:new tt(t)})}resize(t,e,s){return this.source.resize(t,e,s),this}}var vw=Object.defineProperty,Tw=Object.defineProperties,Aw=Object.getOwnPropertyDescriptors,v2=Object.getOwnPropertySymbols,Sw=Object.prototype.hasOwnProperty,Ew=Object.prototype.propertyIsEnumerable,T2=(r,t,e)=>t in r?vw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ww=(r,t)=>{for(var e in t||(t={}))Sw.call(t,e)&&T2(r,e,t[e]);if(v2)for(var e of v2(t))Ew.call(t,e)&&T2(r,e,t[e]);return r},Cw=(r,t)=>Tw(r,Aw(t));const Rw=new V,Pw=new pt,Dw=[0,0,0,0];class Gl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof rt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const s=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:j.shared.setValue(o).toArray():o=Dw;const a=((e=t.frame)==null?void 0:e.copyTo(Rw))||ri(n,Pw).rectangle;a.width=Math.max(a.width,1/s)|0,a.height=Math.max(a.height,1/s)|0;const u=Un.create(Cw(ww({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:s,antialias:i})),l=B.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:o}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Gl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"};class Il{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:s,worldColor:i,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new B,worldColor:4294967295,offset:new nt},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:s||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const c=l.uniforms;c.uProjectionMatrix=u.projectionMatrix,c.uResolution=u.resolution,c.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),c.uWorldTransformMatrix.tx-=u.offset.x,c.uWorldTransformMatrix.ty-=u.offset.y,ns(u.worldColor,c.uWorldColorAlpha,0),l.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Kt,this._activeBindGroups.push(h),h.setResource(l,0)),u.bindGroup=h,this._currentGlobalUniformData=u}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Tt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new it({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Il.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"};let Mw=1;class Fl{constructor(){this._tasks=[]}init(){mt.system.add(this._update,this)}repeat(t,e){const s=Mw++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const s=this._tasks[e];if(t-s.last>=s.duration){const i=t-s.start;s.func(i),s.last=t}}}destroy(){mt.system.remove(this._update,this),this._tasks.length=0}}Fl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0};let A2=!1;const Ul="8.3.2";function S2(r){if(!A2){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${Ul} (${r}) http://www.pixijs.com/
|
|
1973
1973
|
|
|
1974
1974
|
`,"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(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Ul} - ${r} - http://www.pixijs.com/`);A2=!0}}class Tn{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Tt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),S2(e)}}}Tn.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"hello",priority:-2},Tn.defaultOptions={hello:!1};var Ow=Object.defineProperty,E2=Object.getOwnPropertySymbols,Bw=Object.prototype.hasOwnProperty,Gw=Object.prototype.propertyIsEnumerable,w2=(r,t,e)=>t in r?Ow(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,C2=(r,t)=>{for(var e in t||(t={}))Bw.call(t,e)&&w2(r,e,t[e]);if(E2)for(var e of E2(t))Gw.call(t,e)&&w2(r,e,t[e]);return r};const kl=class Ab{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=C2(C2({},Ab.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){t._lastUsed=this._now,t._lastInstructionTick===-1&&this._managedRenderables.push(t),t._lastInstructionTick=e.tick}run(){var t,e,s;const i=performance.now(),n=this._managedRenderables,o=this._renderer.renderPipes;let a=0;for(let u=0;u<n.length;u++){const l=n[u],c=(t=l.renderGroup)!=null?t:l.parentRenderGroup,h=(s=(e=c==null?void 0:c.instructionSet)==null?void 0:e.tick)!=null?s:-1;l._lastInstructionTick!==h&&i-l._lastUsed>this.maxUnusedTime?(l.destroyed||o[l.renderPipeId].destroyRenderable(l),l._lastInstructionTick=-1,a++):n[u-a]=l}n.length=n.length-a}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}};kl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"renderableGC"},kl.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let R2=kl;var Iw=Object.defineProperty,P2=Object.getOwnPropertySymbols,Fw=Object.prototype.hasOwnProperty,Uw=Object.prototype.propertyIsEnumerable,D2=(r,t,e)=>t in r?Iw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,M2=(r,t)=>{for(var e in t||(t={}))Fw.call(t,e)&&D2(r,e,t[e]);if(P2)for(var e of P2(t))Uw.call(t,e)&&D2(r,e,t[e]);return r};const Nl=class Sb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=M2(M2({},Sb.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e: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(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const s=t[e];s.autoGarbageCollect&&s.resource&&s._touched>-1&&this.count-s._touched>this.maxIdle&&(s._touched=-1,s.unload())}}destroy(){this._renderer=null}};Nl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGC"},Nl.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};let O2=Nl;var kw=Object.defineProperty,B2=Object.getOwnPropertySymbols,Nw=Object.prototype.hasOwnProperty,Lw=Object.prototype.propertyIsEnumerable,G2=(r,t,e)=>t in r?kw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,I2=(r,t)=>{for(var e in t||(t={}))Nw.call(t,e)&&G2(r,e,t[e]);if(B2)for(var e of B2(t))Lw.call(t,e)&&G2(r,e,t[e]);return r};const Ll=class Eb{get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=I2(I2({},Eb.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=il(this.canvas,t),this.renderTarget=new gn({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.multiView=!!t.multiView,this.autoDensity&&(this.canvas.style.width=`${this.texture.width}px`,this.canvas.style.height=`${this.texture.height}px`),this.resolution=t.resolution}resize(t,e,s){this.texture.source.resize(t,e,s),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height,this.autoDensity&&(this.canvas.style.width=`${t}px`,this.canvas.style.height=`${e}px`)}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Ll.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"view",priority:0},Ll.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let F2=Ll;const $l=[_2,Il,Tn,F2,Cl,O2,Gl,y2,ou,R2,Fl],Hl=[Dl,Lu,Rl,vl,$u,Xu,Hu,bl],$w=[...$l,sl,y0,p0,zu,gl,ol,Yu,dl,hl,Zu,Q0,Qu,Ku],Hw=[...Hl],Xw=[ku,xl,_l],U2=[],k2=[],N2=[];N.handleByNamedList(y.WebGLSystem,U2),N.handleByNamedList(y.WebGLPipes,k2),N.handleByNamedList(y.WebGLPipesAdaptor,N2),N.add(...$w,...Hw,...Xw);class L2 extends gs{constructor(){const t={name:"webgl",type:Tt.WEBGL,systems:U2,renderPipes:k2,renderPipeAdaptors:N2};super(t)}}var zw={__proto__:null,WebGLRenderer:L2};class Xl{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,s){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,s)}_createBindGroup(t,e,s){var i;const n=this._gpu.device,o=e.layout[s],a=[],u=this._renderer;for(const h in o){const d=(i=t.resources[h])!=null?i:t.resources[o[h]];let p;if(d._resourceType==="uniformGroup"){const f=d;u.ubo.updateUniformGroup(f);const g=f.buffer;p={buffer:u.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(d._resourceType==="buffer"){const f=d;p={buffer:u.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(d._resourceType==="bufferResource"){const f=d;p={buffer:u.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(d._resourceType==="textureSampler"){const f=d;p=u.texture.getGpuSampler(f)}else if(d._resourceType==="textureSource"){const f=d;p=u.texture.getGpuSource(f).createView({})}a.push({binding:o[h],resource:p})}const l=u.shader.getProgramData(e).bindGroups[s],c=n.createBindGroup({layout:l,entries:a});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}Xl.extension={type:[y.WebGPUSystem],name:"bindGroup"};class zl{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),s=t.data;return t._updateID&&s&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,s.buffer,0,(t._updateSize||s.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(li(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}zl.extension={type:[y.WebGPUSystem],name:"buffer"};function jw(r,t){const e=r.descriptor.size,s=t.gpu.device,i=new Rt({data:new Float32Array(24e5),usage:X.MAP_READ|X.COPY_DST}),n=t.buffer.createGPUBuffer(i),o=s.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),s.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class $2{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let s=e+t*4;if(s=Math.ceil(s/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,s>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=s,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let s=0;s<t.length;s++)this.data[e/4+s]=t[s];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class jl{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}jl.extension={type:[y.WebGPUSystem],name:"colorMask"};class An{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),s=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:s});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}}An.extension={type:[y.WebGPUSystem],name:"device"},An.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var Vw=Object.defineProperty,H2=Object.getOwnPropertySymbols,Ww=Object.prototype.hasOwnProperty,Yw=Object.prototype.propertyIsEnumerable,X2=(r,t,e)=>t in r?Vw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,z2=(r,t)=>{for(var e in t||(t={}))Ww.call(t,e)&&X2(r,e,t[e]);if(H2)for(var e of H2(t))Yw.call(t,e)&&X2(r,e,t[e]);return r};class Vl{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,s,i){const n=this._renderer.pipeline.getPipeline(t,e,s,i);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,s){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const i=this._renderer.bindGroup.getBindGroup(e,s,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){for(const s in e.attributeData)this._setVertexBuffer(e.attributeData[s].location,t.attributes[s].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const s in t.groups){const i=t.groups[s];e||this._syncBindGroup(i),this.setBindGroup(s,i,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const s=t.resources[e];s.isUniformGroup&&this._renderer.ubo.updateUniformGroup(s)}}draw(t){const{geometry:e,shader:s,state:i,topology:n,size:o,start:a,instanceCount:u,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,s.gpuProgram,i,n),this.setGeometry(e,s.gpuProgram),this._setShaderBindGroups(s,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,u||e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),u||e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,s=z2({},this._boundVertexBuffer),i=this._boundIndexBuffer,n=z2({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in s)this._setVertexBuffer(a,s[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}Vl.extension={type:[y.WebGPUSystem],name:"encoder",priority:1};class Wl{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:at.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const s=this._renderTargetStencilState[this._activeRenderTarget.uid];s.stencilMode=t,s.stencilReference=e;const i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}Wl.extension={type:[y.WebGPUSystem],name:"stencil"};const Ds={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function j2(r){const t=r.map(s=>({data:s,offset:0,size:0}));let e=0;for(let s=0;s<t.length;s++){const i=t[s];let n=Ds[i.data.type].size;const o=Ds[i.data.type].align;if(!Ds[i.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${i.data.type}`);i.data.size>1&&(n=Math.max(n,o)*i.data.size),e=Math.ceil(e/o)*o,i.size=n,i.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function V2(r,t){const{size:e,align:s}=Ds[r.data.type],i=(s-e)/4;return`
|
|
1975
1975
|
v = uv.${r.data.name};
|
package/dist/webworker.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* PixiJS - v8.3.
|
|
3
|
-
* Compiled
|
|
2
|
+
* PixiJS - v8.3.2
|
|
3
|
+
* Compiled Mon, 12 Aug 2024 08:36:29 UTC
|
|
4
4
|
*
|
|
5
5
|
* PixiJS is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -41497,7 +41497,7 @@ SchedulerSystem.extension = {
|
|
|
41497
41497
|
|
|
41498
41498
|
"use strict";
|
|
41499
41499
|
let saidHello = false;
|
|
41500
|
-
const VERSION = "8.3.
|
|
41500
|
+
const VERSION = "8.3.2";
|
|
41501
41501
|
function sayHello(type) {
|
|
41502
41502
|
if (saidHello) {
|
|
41503
41503
|
return;
|
package/lib/utils/sayHello.js
CHANGED
package/lib/utils/sayHello.mjs
CHANGED