route-graphics 0.0.10 → 0.0.11

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.
@@ -1086,11 +1086,11 @@ fn mainFragment(
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${r}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var BA=x(()=>{Mc();Ae();nm();RA()});var Za,IA=x(()=>{C();BA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let 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,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=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)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return MA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[y.WebGLSystem],name:"uniformGroup"}});function FA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof z.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var GA=x(()=>{Rt()});var tI,eI,rI,iI,sI,oI,UA,kA,OA=x(()=>{C();mr();GA();tI=0,eI=1,rI=2,iI=3,sI=4,oI=5,UA=class Cm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[tI]=this.setBlend,this.map[eI]=this.setOffset,this.map[rI]=this.setCullFace,this.map[iI]=this.setDepthTest,this.map[sI]=this.setFrontFace,this.map[oI]=this.setDepthMask,this.checks=[],this.defaultState=$t.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=FA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;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(Cm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Cm._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._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),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){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,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}};UA.extension={type:[y.WebGLSystem],name:"state"};kA=UA});var $c,LA=x(()=>{_m();$c=class{constructor(t){this.target=xm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=ft.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var DA,NA=x(()=>{"use strict";DA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var nI,HA,VA=x(()=>{"use strict";nI={"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},HA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!nI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Pm=x(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var WA,zA=x(()=>{Pm();WA={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Rm,$A,jc,XA,jA=x(()=>{"use strict";Rm={linear:9729,nearest:9728},$A={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},XA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Mm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Rm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=$A[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Rm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,XA[i.compare])}var YA=x(()=>{jA()});function qA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var KA=x(()=>{"use strict"});function ZA(i,t){let e={},r=i.RGBA;return i instanceof z.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.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}:{}}}var QA=x(()=>{Rt()});function JA(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var tw=x(()=>{"use strict"});var aI,Qa,ew=x(()=>{Rt();C();vt();LA();NA();VA();Pm();zA();YA();KA();QA();tw();aI=4,Qa=class{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:Xc,buffer:DA,video:WA,compressed:HA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=ZA(t,this._renderer.context.extensions),this._mapFormatToType=JA(t),this._mapFormatToFormat=qA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,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),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Mm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,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);let r=this.getGlSource(t);this._gl.generateMipmap(r.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){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Mm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!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){let{pixels:e,width:r,height:s}=this.getPixels(t),o=z.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(aI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[y.WebGLSystem],name:"texture"}});var ow={};lx(ow,{WebGLRenderer:()=>Bm});var hI,lI,cI,rw,iw,sw,Bm,nw=x(()=>{C();UE();kE();OE();sa();im();Mr();NE();WE();jE();KE();ZE();QE();JE();oA();hA();wA();IA();OA();ew();hI=[...Cc,Ya,qE,VE,Wa,Qa,qa,za,Za,Ka,Xa,kA,ja,$a],lI=[...Pc],cI=[Ha,Na,Da],rw=[],iw=[],sw=[];F.handleByNamedList(y.WebGLSystem,rw);F.handleByNamedList(y.WebGLPipes,iw);F.handleByNamedList(y.WebGLPipesAdaptor,sw);F.add(...hI,...lI,...cI);Bm=class extends Ei{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:rw,renderPipes:iw,renderPipeAdaptors:sw};super(t)}}});var l1=K((Fnt,Xm)=>{"use strict";var hF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function lF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function h1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new lF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function ou(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)hF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return h1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return h1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return ou(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&ou(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:ou(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&ou(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof Xm<"u"&&(Xm.exports=be)});var c1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=n-a,v=Math.floor,T=String.fromCharCode,w;function S(H){throw new RangeError(b[H])}function A(H,U){for(var tt=H.length,yt=[];tt--;)yt[tt]=U(H[tt]);return yt}function M(H,U){var tt=H.split("@"),yt="";tt.length>1&&(yt=tt[0]+"@",H=tt[1]),H=H.replace(g,".");var mt=H.split("."),Ot=A(mt,U).join(".");return yt+Ot}function P(H){for(var U=[],tt=0,yt=H.length,mt,Ot;tt<yt;)mt=H.charCodeAt(tt++),mt>=55296&&mt<=56319&&tt<yt?(Ot=H.charCodeAt(tt++),(Ot&64512)==56320?U.push(((mt&1023)<<10)+(Ot&1023)+65536):(U.push(mt),tt--)):U.push(mt);return U}function R(H){return A(H,function(U){var tt="";return U>65535&&(U-=65536,tt+=T(U>>>10&1023|55296),U=56320|U&1023),tt+=T(U),tt}).join("")}function I(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:n}function k(H,U){return H+22+75*(H<26)-((U!=0)<<5)}function j(H,U,tt){var yt=0;for(H=tt?v(H/c):H>>1,H+=v(H/U);H>_*h>>1;yt+=n)H=v(H/_);return v(yt+(_+1)*H/(H+l))}function N(H){var U=[],tt=H.length,yt,mt=0,Ot=d,Lt=u,Yt,re,ge,Tt,ct,gt,Ft,qt,Kt;for(Yt=H.lastIndexOf(f),Yt<0&&(Yt=0),re=0;re<Yt;++re)H.charCodeAt(re)>=128&&S("not-basic"),U.push(H.charCodeAt(re));for(ge=Yt>0?Yt+1:0;ge<tt;){for(Tt=mt,ct=1,gt=n;ge>=tt&&S("invalid-input"),Ft=I(H.charCodeAt(ge++)),(Ft>=n||Ft>v((o-mt)/ct))&&S("overflow"),mt+=Ft*ct,qt=gt<=Lt?a:gt>=Lt+h?h:gt-Lt,!(Ft<qt);gt+=n)Kt=n-qt,ct>v(o/Kt)&&S("overflow"),ct*=Kt;yt=U.length+1,Lt=j(mt-Tt,yt,Tt==0),v(mt/yt)>o-Ot&&S("overflow"),Ot+=v(mt/yt),mt%=yt,U.splice(mt++,0,Ot)}return R(U)}function ot(H){var U,tt,yt,mt,Ot,Lt,Yt,re,ge,Tt,ct,gt=[],Ft,qt,Kt,Me;for(H=P(H),Ft=H.length,U=d,tt=0,Ot=u,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct<128&&gt.push(T(ct));for(yt=mt=gt.length,mt&&gt.push(f);yt<Ft;){for(Yt=o,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct>=U&&ct<Yt&&(Yt=ct);for(qt=yt+1,Yt-U>v((o-tt)/qt)&&S("overflow"),tt+=(Yt-U)*qt,U=Yt,Lt=0;Lt<Ft;++Lt)if(ct=H[Lt],ct<U&&++tt>o&&S("overflow"),ct==U){for(re=tt,ge=n;Tt=ge<=Ot?a:ge>=Ot+h?h:ge-Ot,!(re<Tt);ge+=n)Me=re-Tt,Kt=n-Tt,gt.push(T(k(Tt+Me%Kt,0))),re=v(Me/Kt);gt.push(T(k(re,0))),Ot=j(tt,qt,yt==mt),tt=0,++yt}++tt,++U}return gt.join("")}function L(H){return M(H,function(U){return p.test(U)?N(U.slice(4).toLowerCase()):U})}function $(H){return M(H,function(U){return m.test(U)?"xn--"+ot(U):U})}if(s={version:"1.4.1",ucs2:{decode:P,encode:R},decode:N,encode:ot,toASCII:$,toUnicode:L},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(w in s)s.hasOwnProperty(w)&&(t[w]=s[w]);else i.punycode=s})(Mo)});var rs=K((Gnt,u1)=>{"use strict";u1.exports=TypeError});var d1=K(()=>{});var lh=K((Ont,I1)=>{var rg=typeof Map=="function"&&Map.prototype,jm=Object.getOwnPropertyDescriptor&&rg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,au=rg&&jm&&typeof jm.get=="function"?jm.get:null,f1=rg&&Map.prototype.forEach,ig=typeof Set=="function"&&Set.prototype,Ym=Object.getOwnPropertyDescriptor&&ig?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,hu=ig&&Ym&&typeof Ym.get=="function"?Ym.get:null,p1=ig&&Set.prototype.forEach,cF=typeof WeakMap=="function"&&WeakMap.prototype,nh=cF?WeakMap.prototype.has:null,uF=typeof WeakSet=="function"&&WeakSet.prototype,ah=uF?WeakSet.prototype.has:null,dF=typeof WeakRef=="function"&&WeakRef.prototype,m1=dF?WeakRef.prototype.deref:null,fF=Boolean.prototype.valueOf,pF=Object.prototype.toString,mF=Function.prototype.toString,gF=String.prototype.match,sg=String.prototype.slice,Pi=String.prototype.replace,xF=String.prototype.toUpperCase,g1=String.prototype.toLowerCase,A1=RegExp.prototype.test,x1=Array.prototype.concat,Ur=Array.prototype.join,_F=Array.prototype.slice,_1=Math.floor,Zm=typeof BigInt=="function"?BigInt.prototype.valueOf:null,qm=Object.getOwnPropertySymbols,Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,w1=Object.prototype.propertyIsEnumerable,y1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function b1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||A1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-_1(-i):_1(i);if(r!==i){var s=String(r),o=sg.call(t,s.length+1);return Pi.call(s,e,"$&_")+"."+Pi.call(Pi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pi.call(t,e,"$&_")}var Jm=d1(),v1=Jm.custom,T1=R1(v1)?v1:null,C1={__proto__:null,double:'"',single:"'"},yF={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};I1.exports=function i(t,e,r,s){var o=e||{};if(ri(o,"quoteStyle")&&!ri(C1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ri(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ri(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ri(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ri(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return B1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?b1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?b1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return tg(t)?"[Array]":"[Object]";var u=OF(o,r);if(typeof s>"u")s=[];else if(M1(s,t)>=0)return"[Circular]";function d(j,N,ot){if(N&&(s=_F.call(s),s.push(N)),ot){var L={depth:o.depth};return ri(o,"quoteStyle")&&(L.quoteStyle=o.quoteStyle),i(j,L,r+1,s)}return i(j,o,r+1,s)}if(typeof t=="function"&&!S1(t)){var f=PF(t),p=nu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ur.call(p,", ")+" }":"")}if(R1(t)){var m=Io?Pi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Qm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(GF(t)){for(var g="<"+g1.call(String(t.nodeName)),b=t.attributes||[],_=0;_<b.length;_++)g+=" "+b[_].name+"="+P1(bF(b[_].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+g1.call(String(t.nodeName))+">",g}if(tg(t)){if(t.length===0)return"[]";var v=nu(t,d);return u&&!kF(v)?"["+eg(v,u)+"]":"[ "+Ur.call(v,", ")+" ]"}if(TF(t)){var T=nu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!w1.call(t,"cause")?"{ ["+String(t)+"] "+Ur.call(x1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ur.call(T,", ")+" }"}if(typeof t=="object"&&n){if(T1&&typeof t[T1]=="function"&&Jm)return Jm(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(RF(t)){var w=[];return f1&&f1.call(t,function(j,N){w.push(d(N,t,!0)+" => "+d(j,t))}),E1("Map",au.call(t),w,u)}if(IF(t)){var S=[];return p1&&p1.call(t,function(j){S.push(d(j,t))}),E1("Set",hu.call(t),S,u)}if(MF(t))return Km("WeakMap");if(FF(t))return Km("WeakSet");if(BF(t))return Km("WeakRef");if(EF(t))return oh(d(Number(t)));if(wF(t))return oh(d(Zm.call(t)));if(AF(t))return oh(fF.call(t));if(SF(t))return oh(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!vF(t)&&!S1(t)){var A=nu(t,d),M=y1?y1(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",R=!M&&hh&&Object(t)===t&&hh in t?sg.call(Ri(t),8,-1):P?"Object":"",I=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",k=I+(R||P?"["+Ur.call(x1.call([],R||[],P||[]),": ")+"] ":"");return A.length===0?k+"{}":u?k+"{"+eg(A,u)+"}":k+"{ "+Ur.call(A,", ")+" }"}return String(t)};function P1(i,t,e){var r=e.quoteStyle||t,s=C1[r];return s+i+s}function bF(i){return Pi.call(String(i),/"/g,"&quot;")}function is(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function tg(i){return Ri(i)==="[object Array]"&&is(i)}function vF(i){return Ri(i)==="[object Date]"&&is(i)}function S1(i){return Ri(i)==="[object RegExp]"&&is(i)}function TF(i){return Ri(i)==="[object Error]"&&is(i)}function SF(i){return Ri(i)==="[object String]"&&is(i)}function EF(i){return Ri(i)==="[object Number]"&&is(i)}function AF(i){return Ri(i)==="[object Boolean]"&&is(i)}function R1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Qm)return!1;try{return Qm.call(i),!0}catch{}return!1}function wF(i){if(!i||typeof i!="object"||!Zm)return!1;try{return Zm.call(i),!0}catch{}return!1}var CF=Object.prototype.hasOwnProperty||function(i){return i in this};function ri(i,t){return CF.call(i,t)}function Ri(i){return pF.call(i)}function PF(i){if(i.name)return i.name;var t=gF.call(mF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function M1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function RF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{hu.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function MF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function BF(i){if(!m1||!i||typeof i!="object")return!1;try{return m1.call(i),!0}catch{}return!1}function IF(i){if(!hu||!i||typeof i!="object")return!1;try{hu.call(i);try{au.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function FF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function GF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function B1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return B1(sg.call(i,0,t.maxStringLength),t)+r}var s=yF[t.quoteStyle||"single"];s.lastIndex=0;var o=Pi.call(Pi.call(i,s,"\\$1"),/[\x00-\x1f]/g,UF);return P1(o,"single",t)}function UF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+xF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function Km(i){return i+" { ? }"}function E1(i,t,e,r){var s=r?eg(e,r):Ur.call(e,", ");return i+" ("+t+") {"+s+"}"}function kF(i){for(var t=0;t<i.length;t++)if(M1(i[t],`
1090
- `)>=0)return!1;return!0}function OF(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=Ur.call(Array(i.indent+1)," ");else return null;return{base:e,prev:Ur.call(Array(t+1),e)}}function eg(i,t){if(i.length===0)return"";var e=`
1089
+ `))}var BA=x(()=>{Mc();Ae();nm();RA()});var Za,IA=x(()=>{C();BA();Za=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let 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,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=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)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return MA(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Za.extension={type:[y.WebGLSystem],name:"uniformGroup"}});function FA(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof z.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var GA=x(()=>{Rt()});var tI,eI,rI,iI,sI,oI,UA,kA,OA=x(()=>{C();mr();GA();tI=0,eI=1,rI=2,iI=3,sI=4,oI=5,UA=class Cm{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[tI]=this.setBlend,this.map[eI]=this.setOffset,this.map[rI]=this.setCullFace,this.map[iI]=this.setDepthTest,this.map[sI]=this.setFrontFace,this.map[oI]=this.setDepthMask,this.checks=[],this.defaultState=$t.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=FA(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;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(Cm._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Cm._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._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),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){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,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}};UA.extension={type:[y.WebGLSystem],name:"state"};kA=UA});var $c,LA=x(()=>{_m();$c=class{constructor(t){this.target=xm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=ft.UNSIGNED_BYTE,this.internalFormat=Lc.RGBA,this.format=Lc.RGBA,this.samplerType=0}}});var DA,NA=x(()=>{"use strict";DA={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var nI,HA,VA=x(()=>{"use strict";nI={"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},HA={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!nI[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Xc,Pm=x(()=>{"use strict";Xc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var WA,zA=x(()=>{Pm();WA={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Xc.upload(i,t,e,r)}}});var Rm,$A,jc,XA,jA=x(()=>{"use strict";Rm={linear:9729,nearest:9728},$A={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},jc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},XA={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Mm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=jc[n?"clamp-to-edge":i.addressModeU],c=jc[n?"clamp-to-edge":i.addressModeV],u=jc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,Rm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=$A[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,Rm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,XA[i.compare])}var YA=x(()=>{jA()});function qA(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var KA=x(()=>{"use strict"});function ZA(i,t){let e={},r=i.RGBA;return i instanceof z.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.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}:{}}}var QA=x(()=>{Rt()});function JA(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var tw=x(()=>{"use strict"});var aI,Qa,ew=x(()=>{Rt();C();vt();LA();NA();VA();Pm();zA();YA();KA();QA();tw();aI=4,Qa=class{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:Xc,buffer:DA,video:WA,compressed:HA},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=ZA(t,this._renderer.context.extensions),this._mapFormatToType=JA(t),this._mapFormatToFormat=qA(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=E.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new $c(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,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),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Mm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,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);let r=this.getGlSource(t);this._gl.generateMipmap(r.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){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Mm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!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){let{pixels:e,width:r,height:s}=this.getPixels(t),o=z.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(aI*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(E.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Qa.extension={type:[y.WebGLSystem],name:"texture"}});var ow={};lx(ow,{WebGLRenderer:()=>Bm});var hI,lI,cI,rw,iw,sw,Bm,nw=x(()=>{C();UE();kE();OE();sa();im();Mr();NE();WE();jE();KE();ZE();QE();JE();oA();hA();wA();IA();OA();ew();hI=[...Cc,Ya,qE,VE,Wa,Qa,qa,za,Za,Ka,Xa,kA,ja,$a],lI=[...Pc],cI=[Ha,Na,Da],rw=[],iw=[],sw=[];F.handleByNamedList(y.WebGLSystem,rw);F.handleByNamedList(y.WebGLPipes,iw);F.handleByNamedList(y.WebGLPipesAdaptor,sw);F.add(...hI,...lI,...cI);Bm=class extends Ei{constructor(){let t={name:"webgl",type:Qt.WEBGL,systems:rw,renderPipes:iw,renderPipeAdaptors:sw};super(t)}}});var l1=K((Int,$m)=>{"use strict";var aF=Object.prototype.hasOwnProperty,Re="~";function sh(){}Object.create&&(sh.prototype=Object.create(null),new sh().__proto__||(Re=!1));function hF(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function h1(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new hF(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function ou(i,t){--i._eventsCount===0?i._events=new sh:delete i._events[t]}function be(){this._events=new sh,this._eventsCount=0}be.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)aF.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};be.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};be.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};be.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};be.prototype.on=function(t,e,r){return h1(this,t,e,r,!1)};be.prototype.once=function(t,e,r){return h1(this,t,e,r,!0)};be.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return ou(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&ou(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:ou(this,o)}return this};be.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&ou(this,e)):(this._events=new sh,this._eventsCount=0),this};be.prototype.off=be.prototype.removeListener;be.prototype.addListener=be.prototype.on;be.prefixed=Re;be.EventEmitter=be;typeof $m<"u"&&($m.exports=be)});var c1=K((Mo,Bo)=>{(function(i){var t=typeof Mo=="object"&&Mo&&!Mo.nodeType&&Mo,e=typeof Bo=="object"&&Bo&&!Bo.nodeType&&Bo,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=n-a,v=Math.floor,T=String.fromCharCode,w;function S(H){throw new RangeError(b[H])}function A(H,U){for(var tt=H.length,yt=[];tt--;)yt[tt]=U(H[tt]);return yt}function M(H,U){var tt=H.split("@"),yt="";tt.length>1&&(yt=tt[0]+"@",H=tt[1]),H=H.replace(g,".");var mt=H.split("."),Ot=A(mt,U).join(".");return yt+Ot}function P(H){for(var U=[],tt=0,yt=H.length,mt,Ot;tt<yt;)mt=H.charCodeAt(tt++),mt>=55296&&mt<=56319&&tt<yt?(Ot=H.charCodeAt(tt++),(Ot&64512)==56320?U.push(((mt&1023)<<10)+(Ot&1023)+65536):(U.push(mt),tt--)):U.push(mt);return U}function R(H){return A(H,function(U){var tt="";return U>65535&&(U-=65536,tt+=T(U>>>10&1023|55296),U=56320|U&1023),tt+=T(U),tt}).join("")}function I(H){return H-48<10?H-22:H-65<26?H-65:H-97<26?H-97:n}function k(H,U){return H+22+75*(H<26)-((U!=0)<<5)}function j(H,U,tt){var yt=0;for(H=tt?v(H/c):H>>1,H+=v(H/U);H>_*h>>1;yt+=n)H=v(H/_);return v(yt+(_+1)*H/(H+l))}function N(H){var U=[],tt=H.length,yt,mt=0,Ot=d,Lt=u,Yt,re,ge,Tt,ct,gt,Ft,qt,Kt;for(Yt=H.lastIndexOf(f),Yt<0&&(Yt=0),re=0;re<Yt;++re)H.charCodeAt(re)>=128&&S("not-basic"),U.push(H.charCodeAt(re));for(ge=Yt>0?Yt+1:0;ge<tt;){for(Tt=mt,ct=1,gt=n;ge>=tt&&S("invalid-input"),Ft=I(H.charCodeAt(ge++)),(Ft>=n||Ft>v((o-mt)/ct))&&S("overflow"),mt+=Ft*ct,qt=gt<=Lt?a:gt>=Lt+h?h:gt-Lt,!(Ft<qt);gt+=n)Kt=n-qt,ct>v(o/Kt)&&S("overflow"),ct*=Kt;yt=U.length+1,Lt=j(mt-Tt,yt,Tt==0),v(mt/yt)>o-Ot&&S("overflow"),Ot+=v(mt/yt),mt%=yt,U.splice(mt++,0,Ot)}return R(U)}function ot(H){var U,tt,yt,mt,Ot,Lt,Yt,re,ge,Tt,ct,gt=[],Ft,qt,Kt,Me;for(H=P(H),Ft=H.length,U=d,tt=0,Ot=u,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct<128&&gt.push(T(ct));for(yt=mt=gt.length,mt&&gt.push(f);yt<Ft;){for(Yt=o,Lt=0;Lt<Ft;++Lt)ct=H[Lt],ct>=U&&ct<Yt&&(Yt=ct);for(qt=yt+1,Yt-U>v((o-tt)/qt)&&S("overflow"),tt+=(Yt-U)*qt,U=Yt,Lt=0;Lt<Ft;++Lt)if(ct=H[Lt],ct<U&&++tt>o&&S("overflow"),ct==U){for(re=tt,ge=n;Tt=ge<=Ot?a:ge>=Ot+h?h:ge-Ot,!(re<Tt);ge+=n)Me=re-Tt,Kt=n-Tt,gt.push(T(k(Tt+Me%Kt,0))),re=v(Me/Kt);gt.push(T(k(re,0))),Ot=j(tt,qt,yt==mt),tt=0,++yt}++tt,++U}return gt.join("")}function L(H){return M(H,function(U){return p.test(U)?N(U.slice(4).toLowerCase()):U})}function $(H){return M(H,function(U){return m.test(U)?"xn--"+ot(U):U})}if(s={version:"1.4.1",ucs2:{decode:P,encode:R},decode:N,encode:ot,toASCII:$,toUnicode:L},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Bo.exports==t)e.exports=s;else for(w in s)s.hasOwnProperty(w)&&(t[w]=s[w]);else i.punycode=s})(Mo)});var rs=K((Fnt,u1)=>{"use strict";u1.exports=TypeError});var d1=K(()=>{});var lh=K((knt,I1)=>{var eg=typeof Map=="function"&&Map.prototype,Xm=Object.getOwnPropertyDescriptor&&eg?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,au=eg&&Xm&&typeof Xm.get=="function"?Xm.get:null,f1=eg&&Map.prototype.forEach,rg=typeof Set=="function"&&Set.prototype,jm=Object.getOwnPropertyDescriptor&&rg?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,hu=rg&&jm&&typeof jm.get=="function"?jm.get:null,p1=rg&&Set.prototype.forEach,lF=typeof WeakMap=="function"&&WeakMap.prototype,nh=lF?WeakMap.prototype.has:null,cF=typeof WeakSet=="function"&&WeakSet.prototype,ah=cF?WeakSet.prototype.has:null,uF=typeof WeakRef=="function"&&WeakRef.prototype,m1=uF?WeakRef.prototype.deref:null,dF=Boolean.prototype.valueOf,fF=Object.prototype.toString,pF=Function.prototype.toString,mF=String.prototype.match,ig=String.prototype.slice,Pi=String.prototype.replace,gF=String.prototype.toUpperCase,g1=String.prototype.toLowerCase,A1=RegExp.prototype.test,x1=Array.prototype.concat,Ur=Array.prototype.join,xF=Array.prototype.slice,_1=Math.floor,Km=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ym=Object.getOwnPropertySymbols,Zm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Io=typeof Symbol=="function"&&typeof Symbol.iterator=="object",hh=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Io||!0)?Symbol.toStringTag:null,w1=Object.prototype.propertyIsEnumerable,y1=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function b1(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||A1.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-_1(-i):_1(i);if(r!==i){var s=String(r),o=ig.call(t,s.length+1);return Pi.call(s,e,"$&_")+"."+Pi.call(Pi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Pi.call(t,e,"$&_")}var Qm=d1(),v1=Qm.custom,T1=R1(v1)?v1:null,C1={__proto__:null,double:'"',single:"'"},_F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};I1.exports=function i(t,e,r,s){var o=e||{};if(ri(o,"quoteStyle")&&!ri(C1,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ri(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ri(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ri(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ri(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return B1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?b1(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?b1(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return Jm(t)?"[Array]":"[Object]";var u=kF(o,r);if(typeof s>"u")s=[];else if(M1(s,t)>=0)return"[Circular]";function d(j,N,ot){if(N&&(s=xF.call(s),s.push(N)),ot){var L={depth:o.depth};return ri(o,"quoteStyle")&&(L.quoteStyle=o.quoteStyle),i(j,L,r+1,s)}return i(j,o,r+1,s)}if(typeof t=="function"&&!S1(t)){var f=CF(t),p=nu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ur.call(p,", ")+" }":"")}if(R1(t)){var m=Io?Pi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Zm.call(t);return typeof t=="object"&&!Io?oh(m):m}if(FF(t)){for(var g="<"+g1.call(String(t.nodeName)),b=t.attributes||[],_=0;_<b.length;_++)g+=" "+b[_].name+"="+P1(yF(b[_].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+g1.call(String(t.nodeName))+">",g}if(Jm(t)){if(t.length===0)return"[]";var v=nu(t,d);return u&&!UF(v)?"["+tg(v,u)+"]":"[ "+Ur.call(v,", ")+" ]"}if(vF(t)){var T=nu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!w1.call(t,"cause")?"{ ["+String(t)+"] "+Ur.call(x1.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ur.call(T,", ")+" }"}if(typeof t=="object"&&n){if(T1&&typeof t[T1]=="function"&&Qm)return Qm(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(PF(t)){var w=[];return f1&&f1.call(t,function(j,N){w.push(d(N,t,!0)+" => "+d(j,t))}),E1("Map",au.call(t),w,u)}if(BF(t)){var S=[];return p1&&p1.call(t,function(j){S.push(d(j,t))}),E1("Set",hu.call(t),S,u)}if(RF(t))return qm("WeakMap");if(IF(t))return qm("WeakSet");if(MF(t))return qm("WeakRef");if(SF(t))return oh(d(Number(t)));if(AF(t))return oh(d(Km.call(t)));if(EF(t))return oh(dF.call(t));if(TF(t))return oh(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!bF(t)&&!S1(t)){var A=nu(t,d),M=y1?y1(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",R=!M&&hh&&Object(t)===t&&hh in t?ig.call(Ri(t),8,-1):P?"Object":"",I=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",k=I+(R||P?"["+Ur.call(x1.call([],R||[],P||[]),": ")+"] ":"");return A.length===0?k+"{}":u?k+"{"+tg(A,u)+"}":k+"{ "+Ur.call(A,", ")+" }"}return String(t)};function P1(i,t,e){var r=e.quoteStyle||t,s=C1[r];return s+i+s}function yF(i){return Pi.call(String(i),/"/g,"&quot;")}function is(i){return!hh||!(typeof i=="object"&&(hh in i||typeof i[hh]<"u"))}function Jm(i){return Ri(i)==="[object Array]"&&is(i)}function bF(i){return Ri(i)==="[object Date]"&&is(i)}function S1(i){return Ri(i)==="[object RegExp]"&&is(i)}function vF(i){return Ri(i)==="[object Error]"&&is(i)}function TF(i){return Ri(i)==="[object String]"&&is(i)}function SF(i){return Ri(i)==="[object Number]"&&is(i)}function EF(i){return Ri(i)==="[object Boolean]"&&is(i)}function R1(i){if(Io)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Zm)return!1;try{return Zm.call(i),!0}catch{}return!1}function AF(i){if(!i||typeof i!="object"||!Km)return!1;try{return Km.call(i),!0}catch{}return!1}var wF=Object.prototype.hasOwnProperty||function(i){return i in this};function ri(i,t){return wF.call(i,t)}function Ri(i){return fF.call(i)}function CF(i){if(i.name)return i.name;var t=mF.call(pF.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function M1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function PF(i){if(!au||!i||typeof i!="object")return!1;try{au.call(i);try{hu.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function RF(i){if(!nh||!i||typeof i!="object")return!1;try{nh.call(i,nh);try{ah.call(i,ah)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function MF(i){if(!m1||!i||typeof i!="object")return!1;try{return m1.call(i),!0}catch{}return!1}function BF(i){if(!hu||!i||typeof i!="object")return!1;try{hu.call(i);try{au.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function IF(i){if(!ah||!i||typeof i!="object")return!1;try{ah.call(i,ah);try{nh.call(i,nh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function FF(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function B1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return B1(ig.call(i,0,t.maxStringLength),t)+r}var s=_F[t.quoteStyle||"single"];s.lastIndex=0;var o=Pi.call(Pi.call(i,s,"\\$1"),/[\x00-\x1f]/g,GF);return P1(o,"single",t)}function GF(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+gF.call(t.toString(16))}function oh(i){return"Object("+i+")"}function qm(i){return i+" { ? }"}function E1(i,t,e,r){var s=r?tg(e,r):Ur.call(e,", ");return i+" ("+t+") {"+s+"}"}function UF(i){for(var t=0;t<i.length;t++)if(M1(i[t],`
1090
+ `)>=0)return!1;return!0}function kF(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=Ur.call(Array(i.indent+1)," ");else return null;return{base:e,prev:Ur.call(Array(t+1),e)}}function tg(i,t){if(i.length===0)return"";var e=`
1091
1091
  `+t.prev+t.base;return e+Ur.call(i,","+e)+`
1092
- `+t.prev}function nu(i,t){var e=tg(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ri(i,s)?t(i[s],i):""}var o=typeof qm=="function"?qm(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ri(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(A1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof qm=="function")for(var l=0;l<o.length;l++)w1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var G1=K((Lnt,F1)=>{"use strict";var LF=lh(),DF=rs(),lu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},NF=function(i,t){if(i){var e=lu(i,t);return e&&e.value}},HF=function(i,t,e){var r=lu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},VF=function(i,t){return i?!!lu(i,t):!1},WF=function(i,t){if(i)return lu(i,t,!0)};F1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new DF("Side channel does not contain "+LF(r))},delete:function(r){var s=t&&t.next,o=WF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return NF(t,r)},has:function(r){return VF(t,r)},set:function(r,s){t||(t={next:void 0}),HF(t,r,s)}};return e}});var og=K((Dnt,U1)=>{"use strict";U1.exports=Object});var O1=K((Nnt,k1)=>{"use strict";k1.exports=Error});var D1=K((Hnt,L1)=>{"use strict";L1.exports=EvalError});var H1=K((Vnt,N1)=>{"use strict";N1.exports=RangeError});var W1=K((Wnt,V1)=>{"use strict";V1.exports=ReferenceError});var $1=K((znt,z1)=>{"use strict";z1.exports=SyntaxError});var j1=K(($nt,X1)=>{"use strict";X1.exports=URIError});var q1=K((Xnt,Y1)=>{"use strict";Y1.exports=Math.abs});var Z1=K((jnt,K1)=>{"use strict";K1.exports=Math.floor});var J1=K((Ynt,Q1)=>{"use strict";Q1.exports=Math.max});var eC=K((qnt,tC)=>{"use strict";tC.exports=Math.min});var iC=K((Knt,rC)=>{"use strict";rC.exports=Math.pow});var oC=K((Znt,sC)=>{"use strict";sC.exports=Math.round});var aC=K((Qnt,nC)=>{"use strict";nC.exports=Number.isNaN||function(t){return t!==t}});var lC=K((Jnt,hC)=>{"use strict";var zF=aC();hC.exports=function(t){return zF(t)||t===0?t:t<0?-1:1}});var uC=K((tat,cC)=>{"use strict";cC.exports=Object.getOwnPropertyDescriptor});var ng=K((eat,dC)=>{"use strict";var cu=uC();if(cu)try{cu([],"length")}catch{cu=null}dC.exports=cu});var pC=K((rat,fC)=>{"use strict";var uu=Object.defineProperty||!1;if(uu)try{uu({},"a",{value:1})}catch{uu=!1}fC.exports=uu});var gC=K((iat,mC)=>{"use strict";mC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var yC=K((sat,_C)=>{"use strict";var xC=typeof Symbol<"u"&&Symbol,$F=gC();_C.exports=function(){return typeof xC!="function"||typeof Symbol!="function"||typeof xC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:$F()}});var ag=K((oat,bC)=>{"use strict";bC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var hg=K((nat,vC)=>{"use strict";var XF=og();vC.exports=XF.getPrototypeOf||null});var EC=K((aat,SC)=>{"use strict";var jF="Function.prototype.bind called on incompatible ",YF=Object.prototype.toString,qF=Math.max,KF="[object Function]",TC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},ZF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},QF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};SC.exports=function(t){var e=this;if(typeof e!="function"||YF.apply(e)!==KF)throw new TypeError(jF+e);for(var r=ZF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,TC(r,arguments));return Object(c)===c?c:this}return e.apply(t,TC(r,arguments))},n=qF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+QF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((hat,AC)=>{"use strict";var JF=EC();AC.exports=Function.prototype.bind||JF});var du=K((lat,wC)=>{"use strict";wC.exports=Function.prototype.call});var lg=K((cat,CC)=>{"use strict";CC.exports=Function.prototype.apply});var RC=K((uat,PC)=>{"use strict";PC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var BC=K((dat,MC)=>{"use strict";var tG=ch(),eG=lg(),rG=du(),iG=RC();MC.exports=iG||tG.call(rG,eG)});var cg=K((fat,IC)=>{"use strict";var sG=ch(),oG=rs(),nG=du(),aG=BC();IC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new oG("a function is required");return aG(sG,nG,t)}});var LC=K((pat,OC)=>{"use strict";var hG=cg(),FC=ng(),UC;try{UC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var ug=!!UC&&FC&&FC(Object.prototype,"__proto__"),kC=Object,GC=kC.getPrototypeOf;OC.exports=ug&&typeof ug.get=="function"?hG([ug.get]):typeof GC=="function"?function(t){return GC(t==null?t:kC(t))}:!1});var WC=K((mat,VC)=>{"use strict";var DC=ag(),NC=hg(),HC=LC();VC.exports=DC?function(t){return DC(t)}:NC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return NC(t)}:HC?function(t){return HC(t)}:null});var $C=K((gat,zC)=>{"use strict";var lG=Function.prototype.call,cG=Object.prototype.hasOwnProperty,uG=ch();zC.exports=uG.call(lG,cG)});var mu=K((xat,ZC)=>{"use strict";var lt,dG=og(),fG=O1(),pG=D1(),mG=H1(),gG=W1(),ko=$1(),Uo=rs(),xG=j1(),_G=q1(),yG=Z1(),bG=J1(),vG=eC(),TG=iC(),SG=oC(),EG=lC(),qC=Function,dg=function(i){try{return qC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=ng(),AG=pC(),fg=function(){throw new Uo},wG=uh?function(){try{return arguments.callee,fg}catch{try{return uh(arguments,"callee").get}catch{return fg}}}():fg,Fo=yC()(),de=WC(),CG=hg(),PG=ag(),KC=lg(),dh=du(),Go={},RG=typeof Uint8Array>"u"||!de?lt:de(Uint8Array),ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?lt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?lt:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&de?de([][Symbol.iterator]()):lt,"%AsyncFromSyncIteratorPrototype%":lt,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?lt:Atomics,"%BigInt%":typeof BigInt>"u"?lt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?lt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?lt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?lt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":fG,"%eval%":eval,"%EvalError%":pG,"%Float16Array%":typeof Float16Array>"u"?lt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?lt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?lt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?lt:FinalizationRegistry,"%Function%":qC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?lt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?lt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?lt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&de?de(de([][Symbol.iterator]())):lt,"%JSON%":typeof JSON=="object"?JSON:lt,"%Map%":typeof Map>"u"?lt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!de?lt:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":dG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?lt:Promise,"%Proxy%":typeof Proxy>"u"?lt:Proxy,"%RangeError%":mG,"%ReferenceError%":gG,"%Reflect%":typeof Reflect>"u"?lt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?lt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!de?lt:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?lt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&de?de(""[Symbol.iterator]()):lt,"%Symbol%":Fo?Symbol:lt,"%SyntaxError%":ko,"%ThrowTypeError%":wG,"%TypedArray%":RG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?lt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?lt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?lt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?lt:Uint32Array,"%URIError%":xG,"%WeakMap%":typeof WeakMap>"u"?lt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?lt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?lt:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":KC,"%Object.defineProperty%":AG,"%Object.getPrototypeOf%":CG,"%Math.abs%":_G,"%Math.floor%":yG,"%Math.max%":bG,"%Math.min%":vG,"%Math.pow%":TG,"%Math.round%":SG,"%Math.sign%":EG,"%Reflect.getPrototypeOf%":PG};if(de)try{null.error}catch(i){XC=de(de(i)),ss["%Error.prototype%"]=XC}var XC,MG=function i(t){var e;if(t==="%AsyncFunction%")e=dg("async function () {}");else if(t==="%GeneratorFunction%")e=dg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=dg("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&de&&(e=de(s.prototype))}return ss[t]=e,e},jC={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fh=ch(),fu=$C(),BG=fh.call(dh,Array.prototype.concat),IG=fh.call(KC,Array.prototype.splice),YC=fh.call(dh,String.prototype.replace),pu=fh.call(dh,String.prototype.slice),FG=fh.call(dh,RegExp.prototype.exec),GG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,UG=/\\(\\)?/g,kG=function(t){var e=pu(t,0,1),r=pu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return YC(t,GG,function(o,n,a,h){s[s.length]=a?YC(h,UG,"$1"):n||o}),s},OG=function(t,e){var r=t,s;if(fu(jC,r)&&(s=jC[r],r="%"+s[0]+"%"),fu(ss,r)){var o=ss[r];if(o===Go&&(o=MG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};ZC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(FG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=kG(t),s=r.length>0?r[0]:"",o=OG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],IG(r,BG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=pu(d,0,1),p=pu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",fu(ss,n))a=ss[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=fu(a,d),a=a[d];u&&!h&&(ss[n]=a)}}return a}});var pg=K((_at,tP)=>{"use strict";var QC=mu(),JC=cg(),LG=JC([QC("%String.prototype.indexOf%")]);tP.exports=function(t,e){var r=QC(t,!!e);return typeof r=="function"&&LG(t,".prototype.")>-1?JC([r]):r}});var mg=K((yat,rP)=>{"use strict";var DG=mu(),ph=pg(),NG=lh(),HG=rs(),eP=DG("%Map%",!0),VG=ph("Map.prototype.get",!0),WG=ph("Map.prototype.set",!0),zG=ph("Map.prototype.has",!0),$G=ph("Map.prototype.delete",!0),XG=ph("Map.prototype.size",!0);rP.exports=!!eP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new HG("Side channel does not contain "+NG(r))},delete:function(r){if(t){var s=$G(t,r);return XG(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return VG(t,r)},has:function(r){return t?zG(t,r):!1},set:function(r,s){t||(t=new eP),WG(t,r,s)}};return e}});var sP=K((bat,iP)=>{"use strict";var jG=mu(),xu=pg(),YG=lh(),gu=mg(),qG=rs(),Oo=jG("%WeakMap%",!0),KG=xu("WeakMap.prototype.get",!0),ZG=xu("WeakMap.prototype.set",!0),QG=xu("WeakMap.prototype.has",!0),JG=xu("WeakMap.prototype.delete",!0);iP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new qG("Side channel does not contain "+YG(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return JG(t,s)}else if(gu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?KG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?QG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),ZG(t,s,o)):gu&&(e||(e=gu()),e.set(s,o))}};return r}:gu});var nP=K((vat,oP)=>{"use strict";var t2=rs(),e2=lh(),r2=G1(),i2=mg(),s2=sP(),o2=s2||i2||r2;oP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new t2("Side channel does not contain "+e2(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=o2()),t.set(r,s)}};return e}});var _u=K((Tat,aP)=>{"use strict";var n2=String.prototype.replace,a2=/%20/g,gg={RFC1738:"RFC1738",RFC3986:"RFC3986"};aP.exports={default:gg.RFC3986,formatters:{RFC1738:function(i){return n2.call(i,a2,"+")},RFC3986:function(i){return String(i)}},RFC1738:gg.RFC1738,RFC3986:gg.RFC3986}});var yg=K((Sat,lP)=>{"use strict";var h2=_u(),xg=Object.prototype.hasOwnProperty,os=Array.isArray,kr=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),l2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(os(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},hP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},c2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(os(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!xg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return os(t)&&!os(e)&&(s=hP(t,r)),os(t)&&os(e)?(e.forEach(function(o,n){if(xg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return xg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},u2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},d2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},_g=1024,f2=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=_g){for(var l=n.length>=_g?n.slice(h,h+_g):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===h2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=kr[d];continue}if(d<2048){c[c.length]=kr[192|d>>6]+kr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=kr[224|d>>12]+kr[128|d>>6&63]+kr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=kr[240|d>>18]+kr[128|d>>12&63]+kr[128|d>>6&63]+kr[128|d&63]}a+=c.join("")}return a},p2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return l2(e),t},m2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},g2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},x2=function(t,e){return[].concat(t,e)},_2=function(t,e){if(os(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};lP.exports={arrayToObject:hP,assign:u2,combine:x2,compact:p2,decode:d2,encode:f2,isBuffer:g2,isRegExp:m2,maybeMap:_2,merge:c2}});var mP=K((Eat,pP)=>{"use strict";var uP=nP(),yu=yg(),mh=_u(),y2=Object.prototype.hasOwnProperty,dP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Or=Array.isArray,b2=Array.prototype.push,fP=function(i,t){b2.apply(i,Or(t)?t:[t])},v2=Date.prototype.toISOString,cP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:yu.encode,encodeValuesOnly:!1,filter:void 0,format:cP,formatter:mh.formatters[cP],indices:!1,serializeDate:function(t){return v2.call(t)},skipNulls:!1,strictNullHandling:!1},T2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},bg={},S2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,g,b,_){for(var v=t,T=_,w=0,S=!1;(T=T.get(bg))!==void 0&&!S;){var A=T.get(t);if(w+=1,typeof A<"u"){if(A===w)throw new RangeError("Cyclic object value");S=!0}typeof T.get(bg)>"u"&&(w=0)}if(typeof c=="function"?v=c(e,v):v instanceof Date?v=f(v):r==="comma"&&Or(v)&&(v=yu.maybeMap(v,function(tt){return tt instanceof Date?f(tt):tt})),v===null){if(n)return l&&!g?l(e,oe.encoder,b,"key",p):e;v=""}if(T2(v)||yu.isBuffer(v)){if(l){var M=g?e:l(e,oe.encoder,b,"key",p);return[m(M)+"="+m(l(v,oe.encoder,b,"value",p))]}return[m(e)+"="+m(String(v))]}var P=[];if(typeof v>"u")return P;var R;if(r==="comma"&&Or(v))g&&l&&(v=yu.maybeMap(v,l)),R=[{value:v.length>0?v.join(",")||null:void 0}];else if(Or(c))R=c;else{var I=Object.keys(v);R=u?I.sort(u):I}var k=h?String(e).replace(/\./g,"%2E"):String(e),j=s&&Or(v)&&v.length===1?k+"[]":k;if(o&&Or(v)&&v.length===0)return j+"[]";for(var N=0;N<R.length;++N){var ot=R[N],L=typeof ot=="object"&&ot&&typeof ot.value<"u"?ot.value:v[ot];if(!(a&&L===null)){var $=d&&h?String(ot).replace(/\./g,"%2E"):String(ot),H=Or(v)?typeof r=="function"?r(j,$):j:j+(d?"."+$:"["+$+"]");_.set(t,w);var U=uP();U.set(bg,_),fP(P,i(L,H,r,s,o,n,a,h,r==="comma"&&g&&Or(v)?null:l,c,u,d,f,p,m,g,b,U))}}return P},E2=function(t){if(!t)return oe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||oe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=mh.default;if(typeof t.format<"u"){if(!y2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Or(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in dP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};pP.exports=function(i,t){var e=i,r=E2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Or(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=dP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=uP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||fP(n,S2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var yP=K((Aat,_P)=>{"use strict";var ns=yg(),vg=Object.prototype.hasOwnProperty,gP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},A2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},xP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},w2="utf8=%26%2310003%3B",C2="utf8=%E2%9C%93",P2=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===C2?l="utf-8":n[h]===w2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=ns.maybeMap(xP(c.slice(d+1),e,gP(r[f])?r[f].length:0),function(g){return e.decoder(g,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=A2(String(p))),c.indexOf("[]=")>-1&&(p=gP(p)?[p]:p);var m=vg.call(r,f);m&&e.duplicates==="combine"?r[f]=ns.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},R2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:xP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ns.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},M2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&vg.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&vg.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return R2(c,e,r,s)}},B2=function(t){if(!t)return zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||ns.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};_P.exports=function(i,t){var e=B2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?P2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=M2(a,r[a],e,typeof i=="string");s=ns.merge(s,h,e)}return e.allowSparse===!0?s:ns.compact(s)}});var vP=K((wat,bP)=>{"use strict";var I2=mP(),F2=yP(),G2=_u();bP.exports={formats:G2,parse:F2,stringify:I2}});var AP=K(Do=>{"use strict";var U2=c1();function hr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var k2=/^([a-z0-9.+-]+:)/i,O2=/:[0-9]*$/,L2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,D2=["<",">",'"',"`"," ","\r",`
1093
- `," "],N2=["{","}","|","\\","^","`"].concat(D2),Tg=["'"].concat(N2),TP=["%","/","?",";","#"].concat(Tg),SP=["/","?","#"],H2=255,EP=/^[+a-z0-9A-Z_-]{0,63}$/,V2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,W2={javascript:!0,"javascript:":!0},Sg={javascript:!0,"javascript:":!0},Lo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Eg=vP();function gh(i,t,e){if(i&&typeof i=="object"&&i instanceof hr)return i;var r=new hr;return r.parse(i,t,e),r}hr.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=L2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Eg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=k2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&Sg[l])&&(a=a.substr(2),this.slashes=!0)}if(!Sg[l]&&(u||l&&!Lo[l])){for(var d=-1,f=0;f<SP.length;f++){var p=a.indexOf(SP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<TP.length;f++){var p=a.indexOf(TP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!b)for(var _=this.hostname.split(/\./),f=0,v=_.length;f<v;f++){var T=_[f];if(T&&!T.match(EP)){for(var w="",S=0,A=T.length;S<A;S++)T.charCodeAt(S)>127?w+="x":w+=T[S];if(!w.match(EP)){var M=_.slice(0,f),P=_.slice(f+1),R=T.match(V2);R&&(M.push(R[1]),P.unshift(R[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>H2?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=U2.toASCII(this.hostname));var I=this.port?":"+this.port:"",k=this.hostname||"";this.host=k+I,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!W2[c])for(var f=0,v=Tg.length;f<v;f++){var j=Tg[f];if(a.indexOf(j)!==-1){var N=encodeURIComponent(j);N===j&&(N=escape(j)),a=a.split(j).join(N)}}var ot=a.indexOf("#");ot!==-1&&(this.hash=a.substr(ot),a=a.slice(0,ot));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=Eg.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Lo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var I=this.pathname||"",$=this.search||"";this.path=I+$}return this.href=this.format(),this};function z2(i){return typeof i=="string"&&(i=gh(i)),i instanceof hr?i.format():hr.prototype.format.call(i)}hr.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Eg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Lo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function $2(i,t){return gh(i,!1,!0).resolve(t)}hr.prototype.resolve=function(i){return this.resolveObject(gh(i,!1,!0)).format()};function X2(i,t){return i?gh(i,!1,!0).resolveObject(t):t}hr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new hr;t.parse(i,!1,!0),i=t}for(var e=new hr,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Lo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Lo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!Sg[i.protocol]){for(var v=(i.pathname||"").split("/");v.length&&!(i.host=v.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),v[0]!==""&&v.unshift(""),v.length<2&&v.unshift(""),e.pathname=v.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,b=g,_=e.pathname&&e.pathname.split("/")||[],v=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Lo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(v[0]===""?v[0]=i.host:v.unshift(i.host)),i.host=null),g=g&&(v[0]===""||_[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,_=v;else if(v.length)_||(_=[]),_.pop(),_=_.concat(v),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=_.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=_.slice(-1)[0],A=(e.host||i.host||_.length>1)&&(S==="."||S==="..")||S==="",M=0,P=_.length;P>=0;P--)S=_[P],S==="."?_.splice(P,1):S===".."?(_.splice(P,1),M++):M&&(_.splice(P,1),M--);if(!g&&!b)for(;M--;M)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),A&&_.join("/").substr(-1)!=="/"&&_.push("");var R=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){e.hostname=R?"":_.length?_.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!R&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};hr.prototype.parseHost=function(){var i=this.host,t=O2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Do.parse=gh;Do.resolve=$2;Do.resolveObject=X2;Do.format=z2;Do.Url=hr});var TR=()=>{let i=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))i.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};i.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of i.entries())n[a]=h;return n},clear:()=>i.clear(),size:()=>i.size,has:n=>i.has(n)}};C();var OT={extension:{type:y.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(kT(),MB))}};C();var DT={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(LT(),BB))}};C();C();Cl();bl();C();Rt();sa();var vc;function jT(i){return vc!==void 0||(vc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ei.defaultOptions.failIfMajorPerformanceCaveat};try{if(!z.get().getWebGLRenderingContext())return!1;let r=z.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),vc}Rt();var Tc;async function YT(i={}){return Tc!==void 0||(Tc=await(async()=>{let t=z.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Tc}sa();var aw=["webgl","webgpu","canvas"];async function hw(i){let t=[];i.preference?(t.push(i.preference),aw.forEach(o=>{o!==i.preference&&t.push(o)})):t=aw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await YT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(GE(),FE));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&jT(i.failIfMajorPerformanceCaveat??Ei.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(nw(),ow));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}dr();zp();Dt();var lw=class Im{constructor(...t){this.stage=new St,t[0]!==void 0&&W(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await hw(t),Im._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return W(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Im._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};lw._plugins=[];var Ja=lw;F.handleByList(y.Application,Ja._plugins);F.add(pa);C();Yr();zd();Rt();C();Wi();he();vt();bp();Ap();var th=class extends so{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new it(n.x+a.x,n.y+a.y,n.width,n.height),c=new E({source:h,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Kn.install(t)}static uninstall(t){Kn.uninstall(t)}};var Yc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),b=g[0],_=g[1].replace(/"/gm,""),v=parseFloat(_),T=isNaN(v)?_:v;p[b]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};Rt();var Fm={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Gm={test(i){return typeof i=="string"&&i.includes("<font>")?Fm.test(z.get().parseXML(i)):!1},parse(i){return Fm.parse(z.get().parseXML(i))}};var uI=[".xml",".fnt"],cw={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof th,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},uw={extension:{type:y.LoadParser,priority:le.Normal},name:"loadBitmapFont",test(i){return uI.includes(ie.extname(i).toLowerCase())},async testParse(i){return Yc.test(i)||Gm.test(i)},async parse(i,t,e){let r=Yc.test(i)?Yc.parse(i):Gm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ie.join(ie.dirname(s),d);f=En(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new th({data:r,textures:l},s)},async load(i,t){return await(await z.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};At();var qc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};gi();C();vt();var dw={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};C();async function Kc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var fw={extension:{type:y.DetectionParser,priority:1},test:async()=>Kc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};C();var pw=["png","jpg","jpeg"],mw={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...pw],remove:async i=>i.filter(t=>!pw.includes(t))};C();var dI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function yo(i){return dI?!1:document.createElement("video").canPlayType(i)!==""}var gw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};C();var xw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};C();var _w={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};C();var yw={extension:{type:y.DetectionParser,priority:0},test:async()=>Kc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};At();Wi();Sn();yl();var Zc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=zi(t),n=Ee(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
1092
+ `+t.prev}function nu(i,t){var e=Jm(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ri(i,s)?t(i[s],i):""}var o=typeof Ym=="function"?Ym(i):[],n;if(Io){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ri(i,h)&&(e&&String(Number(h))===h&&h<i.length||Io&&n["$"+h]instanceof Symbol||(A1.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Ym=="function")for(var l=0;l<o.length;l++)w1.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var G1=K((Ont,F1)=>{"use strict";var OF=lh(),LF=rs(),lu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},DF=function(i,t){if(i){var e=lu(i,t);return e&&e.value}},NF=function(i,t,e){var r=lu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},HF=function(i,t){return i?!!lu(i,t):!1},VF=function(i,t){if(i)return lu(i,t,!0)};F1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new LF("Side channel does not contain "+OF(r))},delete:function(r){var s=t&&t.next,o=VF(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return DF(t,r)},has:function(r){return HF(t,r)},set:function(r,s){t||(t={next:void 0}),NF(t,r,s)}};return e}});var sg=K((Lnt,U1)=>{"use strict";U1.exports=Object});var O1=K((Dnt,k1)=>{"use strict";k1.exports=Error});var D1=K((Nnt,L1)=>{"use strict";L1.exports=EvalError});var H1=K((Hnt,N1)=>{"use strict";N1.exports=RangeError});var W1=K((Vnt,V1)=>{"use strict";V1.exports=ReferenceError});var $1=K((Wnt,z1)=>{"use strict";z1.exports=SyntaxError});var j1=K((znt,X1)=>{"use strict";X1.exports=URIError});var q1=K(($nt,Y1)=>{"use strict";Y1.exports=Math.abs});var Z1=K((Xnt,K1)=>{"use strict";K1.exports=Math.floor});var J1=K((jnt,Q1)=>{"use strict";Q1.exports=Math.max});var eC=K((Ynt,tC)=>{"use strict";tC.exports=Math.min});var iC=K((qnt,rC)=>{"use strict";rC.exports=Math.pow});var oC=K((Knt,sC)=>{"use strict";sC.exports=Math.round});var aC=K((Znt,nC)=>{"use strict";nC.exports=Number.isNaN||function(t){return t!==t}});var lC=K((Qnt,hC)=>{"use strict";var WF=aC();hC.exports=function(t){return WF(t)||t===0?t:t<0?-1:1}});var uC=K((Jnt,cC)=>{"use strict";cC.exports=Object.getOwnPropertyDescriptor});var og=K((tat,dC)=>{"use strict";var cu=uC();if(cu)try{cu([],"length")}catch{cu=null}dC.exports=cu});var pC=K((eat,fC)=>{"use strict";var uu=Object.defineProperty||!1;if(uu)try{uu({},"a",{value:1})}catch{uu=!1}fC.exports=uu});var gC=K((rat,mC)=>{"use strict";mC.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var yC=K((iat,_C)=>{"use strict";var xC=typeof Symbol<"u"&&Symbol,zF=gC();_C.exports=function(){return typeof xC!="function"||typeof Symbol!="function"||typeof xC("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:zF()}});var ng=K((sat,bC)=>{"use strict";bC.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var ag=K((oat,vC)=>{"use strict";var $F=sg();vC.exports=$F.getPrototypeOf||null});var EC=K((nat,SC)=>{"use strict";var XF="Function.prototype.bind called on incompatible ",jF=Object.prototype.toString,YF=Math.max,qF="[object Function]",TC=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},KF=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},ZF=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};SC.exports=function(t){var e=this;if(typeof e!="function"||jF.apply(e)!==qF)throw new TypeError(XF+e);for(var r=KF(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,TC(r,arguments));return Object(c)===c?c:this}return e.apply(t,TC(r,arguments))},n=YF(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+ZF(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var ch=K((aat,AC)=>{"use strict";var QF=EC();AC.exports=Function.prototype.bind||QF});var du=K((hat,wC)=>{"use strict";wC.exports=Function.prototype.call});var hg=K((lat,CC)=>{"use strict";CC.exports=Function.prototype.apply});var RC=K((cat,PC)=>{"use strict";PC.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var BC=K((uat,MC)=>{"use strict";var JF=ch(),tG=hg(),eG=du(),rG=RC();MC.exports=rG||JF.call(eG,tG)});var lg=K((dat,IC)=>{"use strict";var iG=ch(),sG=rs(),oG=du(),nG=BC();IC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new sG("a function is required");return nG(iG,oG,t)}});var LC=K((fat,OC)=>{"use strict";var aG=lg(),FC=og(),UC;try{UC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var cg=!!UC&&FC&&FC(Object.prototype,"__proto__"),kC=Object,GC=kC.getPrototypeOf;OC.exports=cg&&typeof cg.get=="function"?aG([cg.get]):typeof GC=="function"?function(t){return GC(t==null?t:kC(t))}:!1});var WC=K((pat,VC)=>{"use strict";var DC=ng(),NC=ag(),HC=LC();VC.exports=DC?function(t){return DC(t)}:NC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return NC(t)}:HC?function(t){return HC(t)}:null});var $C=K((mat,zC)=>{"use strict";var hG=Function.prototype.call,lG=Object.prototype.hasOwnProperty,cG=ch();zC.exports=cG.call(hG,lG)});var mu=K((gat,ZC)=>{"use strict";var lt,uG=sg(),dG=O1(),fG=D1(),pG=H1(),mG=W1(),ko=$1(),Uo=rs(),gG=j1(),xG=q1(),_G=Z1(),yG=J1(),bG=eC(),vG=iC(),TG=oC(),SG=lC(),qC=Function,ug=function(i){try{return qC('"use strict"; return ('+i+").constructor;")()}catch{}},uh=og(),EG=pC(),dg=function(){throw new Uo},AG=uh?function(){try{return arguments.callee,dg}catch{try{return uh(arguments,"callee").get}catch{return dg}}}():dg,Fo=yC()(),de=WC(),wG=ag(),CG=ng(),KC=hg(),dh=du(),Go={},PG=typeof Uint8Array>"u"||!de?lt:de(Uint8Array),ss={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?lt:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?lt:ArrayBuffer,"%ArrayIteratorPrototype%":Fo&&de?de([][Symbol.iterator]()):lt,"%AsyncFromSyncIteratorPrototype%":lt,"%AsyncFunction%":Go,"%AsyncGenerator%":Go,"%AsyncGeneratorFunction%":Go,"%AsyncIteratorPrototype%":Go,"%Atomics%":typeof Atomics>"u"?lt:Atomics,"%BigInt%":typeof BigInt>"u"?lt:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?lt:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?lt:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?lt:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":dG,"%eval%":eval,"%EvalError%":fG,"%Float16Array%":typeof Float16Array>"u"?lt:Float16Array,"%Float32Array%":typeof Float32Array>"u"?lt:Float32Array,"%Float64Array%":typeof Float64Array>"u"?lt:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?lt:FinalizationRegistry,"%Function%":qC,"%GeneratorFunction%":Go,"%Int8Array%":typeof Int8Array>"u"?lt:Int8Array,"%Int16Array%":typeof Int16Array>"u"?lt:Int16Array,"%Int32Array%":typeof Int32Array>"u"?lt:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Fo&&de?de(de([][Symbol.iterator]())):lt,"%JSON%":typeof JSON=="object"?JSON:lt,"%Map%":typeof Map>"u"?lt:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Fo||!de?lt:de(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":uG,"%Object.getOwnPropertyDescriptor%":uh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?lt:Promise,"%Proxy%":typeof Proxy>"u"?lt:Proxy,"%RangeError%":pG,"%ReferenceError%":mG,"%Reflect%":typeof Reflect>"u"?lt:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?lt:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Fo||!de?lt:de(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?lt:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Fo&&de?de(""[Symbol.iterator]()):lt,"%Symbol%":Fo?Symbol:lt,"%SyntaxError%":ko,"%ThrowTypeError%":AG,"%TypedArray%":PG,"%TypeError%":Uo,"%Uint8Array%":typeof Uint8Array>"u"?lt:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?lt:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?lt:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?lt:Uint32Array,"%URIError%":gG,"%WeakMap%":typeof WeakMap>"u"?lt:WeakMap,"%WeakRef%":typeof WeakRef>"u"?lt:WeakRef,"%WeakSet%":typeof WeakSet>"u"?lt:WeakSet,"%Function.prototype.call%":dh,"%Function.prototype.apply%":KC,"%Object.defineProperty%":EG,"%Object.getPrototypeOf%":wG,"%Math.abs%":xG,"%Math.floor%":_G,"%Math.max%":yG,"%Math.min%":bG,"%Math.pow%":vG,"%Math.round%":TG,"%Math.sign%":SG,"%Reflect.getPrototypeOf%":CG};if(de)try{null.error}catch(i){XC=de(de(i)),ss["%Error.prototype%"]=XC}var XC,RG=function i(t){var e;if(t==="%AsyncFunction%")e=ug("async function () {}");else if(t==="%GeneratorFunction%")e=ug("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ug("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&de&&(e=de(s.prototype))}return ss[t]=e,e},jC={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},fh=ch(),fu=$C(),MG=fh.call(dh,Array.prototype.concat),BG=fh.call(KC,Array.prototype.splice),YC=fh.call(dh,String.prototype.replace),pu=fh.call(dh,String.prototype.slice),IG=fh.call(dh,RegExp.prototype.exec),FG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,GG=/\\(\\)?/g,UG=function(t){var e=pu(t,0,1),r=pu(t,-1);if(e==="%"&&r!=="%")throw new ko("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new ko("invalid intrinsic syntax, expected opening `%`");var s=[];return YC(t,FG,function(o,n,a,h){s[s.length]=a?YC(h,GG,"$1"):n||o}),s},kG=function(t,e){var r=t,s;if(fu(jC,r)&&(s=jC[r],r="%"+s[0]+"%"),fu(ss,r)){var o=ss[r];if(o===Go&&(o=RG(r)),typeof o>"u"&&!e)throw new Uo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new ko("intrinsic "+t+" does not exist!")};ZC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Uo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Uo('"allowMissing" argument must be a boolean');if(IG(/^%?[^%]*%?$/,t)===null)throw new ko("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=UG(t),s=r.length>0?r[0]:"",o=kG("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],BG(r,MG([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=pu(d,0,1),p=pu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new ko("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",fu(ss,n))a=ss[n];else if(a!=null){if(!(d in a)){if(!e)throw new Uo("base intrinsic for "+t+" exists, but the property is not available.");return}if(uh&&c+1>=r.length){var m=uh(a,d);u=!!m,u&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else u=fu(a,d),a=a[d];u&&!h&&(ss[n]=a)}}return a}});var fg=K((xat,tP)=>{"use strict";var QC=mu(),JC=lg(),OG=JC([QC("%String.prototype.indexOf%")]);tP.exports=function(t,e){var r=QC(t,!!e);return typeof r=="function"&&OG(t,".prototype.")>-1?JC([r]):r}});var pg=K((_at,rP)=>{"use strict";var LG=mu(),ph=fg(),DG=lh(),NG=rs(),eP=LG("%Map%",!0),HG=ph("Map.prototype.get",!0),VG=ph("Map.prototype.set",!0),WG=ph("Map.prototype.has",!0),zG=ph("Map.prototype.delete",!0),$G=ph("Map.prototype.size",!0);rP.exports=!!eP&&function(){var t,e={assert:function(r){if(!e.has(r))throw new NG("Side channel does not contain "+DG(r))},delete:function(r){if(t){var s=zG(t,r);return $G(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return HG(t,r)},has:function(r){return t?WG(t,r):!1},set:function(r,s){t||(t=new eP),VG(t,r,s)}};return e}});var sP=K((yat,iP)=>{"use strict";var XG=mu(),xu=fg(),jG=lh(),gu=pg(),YG=rs(),Oo=XG("%WeakMap%",!0),qG=xu("WeakMap.prototype.get",!0),KG=xu("WeakMap.prototype.set",!0),ZG=xu("WeakMap.prototype.has",!0),QG=xu("WeakMap.prototype.delete",!0);iP.exports=Oo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new YG("Side channel does not contain "+jG(s))},delete:function(s){if(Oo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return QG(t,s)}else if(gu&&e)return e.delete(s);return!1},get:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?qG(t,s):e&&e.get(s)},has:function(s){return Oo&&s&&(typeof s=="object"||typeof s=="function")&&t?ZG(t,s):!!e&&e.has(s)},set:function(s,o){Oo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Oo),KG(t,s,o)):gu&&(e||(e=gu()),e.set(s,o))}};return r}:gu});var nP=K((bat,oP)=>{"use strict";var JG=rs(),t2=lh(),e2=G1(),r2=pg(),i2=sP(),s2=i2||r2||e2;oP.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new JG("Side channel does not contain "+t2(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=s2()),t.set(r,s)}};return e}});var _u=K((vat,aP)=>{"use strict";var o2=String.prototype.replace,n2=/%20/g,mg={RFC1738:"RFC1738",RFC3986:"RFC3986"};aP.exports={default:mg.RFC3986,formatters:{RFC1738:function(i){return o2.call(i,n2,"+")},RFC3986:function(i){return String(i)}},RFC1738:mg.RFC1738,RFC3986:mg.RFC3986}});var _g=K((Tat,lP)=>{"use strict";var a2=_u(),gg=Object.prototype.hasOwnProperty,os=Array.isArray,kr=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),h2=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(os(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},hP=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},l2=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(os(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!gg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return os(t)&&!os(e)&&(s=hP(t,r)),os(t)&&os(e)?(e.forEach(function(o,n){if(gg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return gg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},c2=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},u2=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},xg=1024,d2=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=xg){for(var l=n.length>=xg?n.slice(h,h+xg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===a2.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=kr[d];continue}if(d<2048){c[c.length]=kr[192|d>>6]+kr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=kr[224|d>>12]+kr[128|d>>6&63]+kr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=kr[240|d>>18]+kr[128|d>>12&63]+kr[128|d>>6&63]+kr[128|d&63]}a+=c.join("")}return a},f2=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return h2(e),t},p2=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},m2=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},g2=function(t,e){return[].concat(t,e)},x2=function(t,e){if(os(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};lP.exports={arrayToObject:hP,assign:c2,combine:g2,compact:f2,decode:u2,encode:d2,isBuffer:m2,isRegExp:p2,maybeMap:x2,merge:l2}});var mP=K((Sat,pP)=>{"use strict";var uP=nP(),yu=_g(),mh=_u(),_2=Object.prototype.hasOwnProperty,dP={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Or=Array.isArray,y2=Array.prototype.push,fP=function(i,t){y2.apply(i,Or(t)?t:[t])},b2=Date.prototype.toISOString,cP=mh.default,oe={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:yu.encode,encodeValuesOnly:!1,filter:void 0,format:cP,formatter:mh.formatters[cP],indices:!1,serializeDate:function(t){return b2.call(t)},skipNulls:!1,strictNullHandling:!1},v2=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},yg={},T2=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,m,g,b,_){for(var v=t,T=_,w=0,S=!1;(T=T.get(yg))!==void 0&&!S;){var A=T.get(t);if(w+=1,typeof A<"u"){if(A===w)throw new RangeError("Cyclic object value");S=!0}typeof T.get(yg)>"u"&&(w=0)}if(typeof c=="function"?v=c(e,v):v instanceof Date?v=f(v):r==="comma"&&Or(v)&&(v=yu.maybeMap(v,function(tt){return tt instanceof Date?f(tt):tt})),v===null){if(n)return l&&!g?l(e,oe.encoder,b,"key",p):e;v=""}if(v2(v)||yu.isBuffer(v)){if(l){var M=g?e:l(e,oe.encoder,b,"key",p);return[m(M)+"="+m(l(v,oe.encoder,b,"value",p))]}return[m(e)+"="+m(String(v))]}var P=[];if(typeof v>"u")return P;var R;if(r==="comma"&&Or(v))g&&l&&(v=yu.maybeMap(v,l)),R=[{value:v.length>0?v.join(",")||null:void 0}];else if(Or(c))R=c;else{var I=Object.keys(v);R=u?I.sort(u):I}var k=h?String(e).replace(/\./g,"%2E"):String(e),j=s&&Or(v)&&v.length===1?k+"[]":k;if(o&&Or(v)&&v.length===0)return j+"[]";for(var N=0;N<R.length;++N){var ot=R[N],L=typeof ot=="object"&&ot&&typeof ot.value<"u"?ot.value:v[ot];if(!(a&&L===null)){var $=d&&h?String(ot).replace(/\./g,"%2E"):String(ot),H=Or(v)?typeof r=="function"?r(j,$):j:j+(d?"."+$:"["+$+"]");_.set(t,w);var U=uP();U.set(yg,_),fP(P,i(L,H,r,s,o,n,a,h,r==="comma"&&g&&Or(v)?null:l,c,u,d,f,p,m,g,b,U))}}return P},S2=function(t){if(!t)return oe;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||oe.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=mh.default;if(typeof t.format<"u"){if(!_2.call(mh.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=mh.formatters[r],o=oe.filter;(typeof t.filter=="function"||Or(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in dP?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=oe.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:oe.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:oe.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:oe.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:oe.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?oe.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:oe.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:oe.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:oe.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:oe.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:oe.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:oe.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:oe.strictNullHandling}};pP.exports=function(i,t){var e=i,r=S2(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Or(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=dP[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=uP(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||fP(n,T2(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var yP=K((Eat,_P)=>{"use strict";var ns=_g(),bg=Object.prototype.hasOwnProperty,gP=Array.isArray,zt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:ns.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},E2=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},xP=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},A2="utf8=%26%2310003%3B",w2="utf8=%E2%9C%93",C2=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===w2?l="utf-8":n[h]===A2&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,zt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),zt.decoder,l,"key"),p=ns.maybeMap(xP(c.slice(d+1),e,gP(r[f])?r[f].length:0),function(g){return e.decoder(g,zt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=E2(String(p))),c.indexOf("[]=")>-1&&(p=gP(p)?[p]:p);var m=bg.call(r,f);m&&e.duplicates==="combine"?r[f]=ns.combine(r[f],p):(!m||e.duplicates==="last")&&(r[f]=p)}return r},P2=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:xP(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:ns.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},R2=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&bg.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&bg.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return P2(c,e,r,s)}},M2=function(t){if(!t)return zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?zt.charset:t.charset,r=typeof t.duplicates>"u"?zt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:zt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:zt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:zt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:zt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:zt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:zt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:zt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:zt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:zt.decoder,delimiter:typeof t.delimiter=="string"||ns.isRegExp(t.delimiter)?t.delimiter:zt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:zt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:zt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:zt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:zt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:zt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:zt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};_P.exports=function(i,t){var e=M2(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?C2(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=R2(a,r[a],e,typeof i=="string");s=ns.merge(s,h,e)}return e.allowSparse===!0?s:ns.compact(s)}});var vP=K((Aat,bP)=>{"use strict";var B2=mP(),I2=yP(),F2=_u();bP.exports={formats:F2,parse:I2,stringify:B2}});var AP=K(Do=>{"use strict";var G2=c1();function hr(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var U2=/^([a-z0-9.+-]+:)/i,k2=/:[0-9]*$/,O2=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,L2=["<",">",'"',"`"," ","\r",`
1093
+ `," "],D2=["{","}","|","\\","^","`"].concat(L2),vg=["'"].concat(D2),TP=["%","/","?",";","#"].concat(vg),SP=["/","?","#"],N2=255,EP=/^[+a-z0-9A-Z_-]{0,63}$/,H2=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,V2={javascript:!0,"javascript:":!0},Tg={javascript:!0,"javascript:":!0},Lo={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Sg=vP();function gh(i,t,e){if(i&&typeof i=="object"&&i instanceof hr)return i;var r=new hr;return r.parse(i,t,e),r}hr.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=O2.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=Sg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=U2.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&Tg[l])&&(a=a.substr(2),this.slashes=!0)}if(!Tg[l]&&(u||l&&!Lo[l])){for(var d=-1,f=0;f<SP.length;f++){var p=a.indexOf(SP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var m,g;d===-1?g=a.lastIndexOf("@"):g=a.lastIndexOf("@",d),g!==-1&&(m=a.slice(0,g),a=a.slice(g+1),this.auth=decodeURIComponent(m)),d=-1;for(var f=0;f<TP.length;f++){var p=a.indexOf(TP[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var b=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!b)for(var _=this.hostname.split(/\./),f=0,v=_.length;f<v;f++){var T=_[f];if(T&&!T.match(EP)){for(var w="",S=0,A=T.length;S<A;S++)T.charCodeAt(S)>127?w+="x":w+=T[S];if(!w.match(EP)){var M=_.slice(0,f),P=_.slice(f+1),R=T.match(H2);R&&(M.push(R[1]),P.unshift(R[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>N2?this.hostname="":this.hostname=this.hostname.toLowerCase(),b||(this.hostname=G2.toASCII(this.hostname));var I=this.port?":"+this.port:"",k=this.hostname||"";this.host=k+I,this.href+=this.host,b&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!V2[c])for(var f=0,v=vg.length;f<v;f++){var j=vg[f];if(a.indexOf(j)!==-1){var N=encodeURIComponent(j);N===j&&(N=escape(j)),a=a.split(j).join(N)}}var ot=a.indexOf("#");ot!==-1&&(this.hash=a.substr(ot),a=a.slice(0,ot));var L=a.indexOf("?");if(L!==-1?(this.search=a.substr(L),this.query=a.substr(L+1),t&&(this.query=Sg.parse(this.query)),a=a.slice(0,L)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Lo[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var I=this.pathname||"",$=this.search||"";this.path=I+$}return this.href=this.format(),this};function W2(i){return typeof i=="string"&&(i=gh(i)),i instanceof hr?i.format():hr.prototype.format.call(i)}hr.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Sg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Lo[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function z2(i,t){return gh(i,!1,!0).resolve(t)}hr.prototype.resolve=function(i){return this.resolveObject(gh(i,!1,!0)).format()};function $2(i,t){return i?gh(i,!1,!0).resolveObject(t):t}hr.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new hr;t.parse(i,!1,!0),i=t}for(var e=new hr,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Lo[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Lo[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!Tg[i.protocol]){for(var v=(i.pathname||"").split("/");v.length&&!(i.host=v.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),v[0]!==""&&v.unshift(""),v.length<2&&v.unshift(""),e.pathname=v.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",m=i.host||i.pathname&&i.pathname.charAt(0)==="/",g=m||p||e.host&&i.pathname,b=g,_=e.pathname&&e.pathname.split("/")||[],v=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Lo[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(v[0]===""?v[0]=i.host:v.unshift(i.host)),i.host=null),g=g&&(v[0]===""||_[0]==="")),m)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,_=v;else if(v.length)_||(_=[]),_.pop(),_=_.concat(v),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=_.shift(),e.hostname=e.host;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var S=_.slice(-1)[0],A=(e.host||i.host||_.length>1)&&(S==="."||S==="..")||S==="",M=0,P=_.length;P>=0;P--)S=_[P],S==="."?_.splice(P,1):S===".."?(_.splice(P,1),M++):M&&(_.splice(P,1),M--);if(!g&&!b)for(;M--;M)_.unshift("..");g&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),A&&_.join("/").substr(-1)!=="/"&&_.push("");var R=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){e.hostname=R?"":_.length?_.shift():"",e.host=e.hostname;var w=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;w&&(e.auth=w.shift(),e.hostname=w.shift(),e.host=e.hostname)}return g=g||e.host&&_.length,g&&!R&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};hr.prototype.parseHost=function(){var i=this.host,t=k2.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Do.parse=gh;Do.resolve=z2;Do.resolveObject=$2;Do.format=W2;Do.Url=hr});var TR=()=>{let i=new Map;return{load:async n=>{let a=[];for(let[h,l]of Object.entries(n))i.has(h)||a.push([h,l]);a.length>0&&await Promise.all(a.map(async([h,l])=>{let d={buffer:await(await fetch(l.url)).arrayBuffer(),type:l.type};i.set(h,d)}))},getBufferMap:()=>{let n={};for(let[a,h]of i.entries())n[a]=h;return n},clear:()=>i.clear(),size:()=>i.size,has:n=>i.has(n)}};C();var OT={extension:{type:y.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(kT(),MB))}};C();var DT={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(LT(),BB))}};C();C();Cl();bl();C();Rt();sa();var vc;function jT(i){return vc!==void 0||(vc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ei.defaultOptions.failIfMajorPerformanceCaveat};try{if(!z.get().getWebGLRenderingContext())return!1;let r=z.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),vc}Rt();var Tc;async function YT(i={}){return Tc!==void 0||(Tc=await(async()=>{let t=z.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Tc}sa();var aw=["webgl","webgpu","canvas"];async function hw(i){let t=[];i.preference?(t.push(i.preference),aw.forEach(o=>{o!==i.preference&&t.push(o)})):t=aw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await YT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(GE(),FE));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&jT(i.failIfMajorPerformanceCaveat??Ei.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(nw(),ow));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}dr();zp();Dt();var lw=class Im{constructor(...t){this.stage=new St,t[0]!==void 0&&W(Q,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await hw(t),Im._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return W(Q,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Im._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};lw._plugins=[];var Ja=lw;F.handleByList(y.Application,Ja._plugins);F.add(pa);C();Yr();zd();Rt();C();Wi();he();vt();bp();Ap();var th=class extends so{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new it(n.x+a.x,n.y+a.y,n.width,n.height),c=new E({source:h,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Kn.install(t)}static uninstall(t){Kn.uninstall(t)}};var Yc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let m in f){let g=f[m].split("="),b=g[0],_=g[1].replace(/"/gm,""),v=parseFloat(_),T=isNaN(v)?_:v;p[b]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};Rt();var Fm={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Gm={test(i){return typeof i=="string"&&i.includes("<font>")?Fm.test(z.get().parseXML(i)):!1},parse(i){return Fm.parse(z.get().parseXML(i))}};var uI=[".xml",".fnt"],cw={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof th,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},uw={extension:{type:y.LoadParser,priority:le.Normal},name:"loadBitmapFont",test(i){return uI.includes(ie.extname(i).toLowerCase())},async testParse(i){return Yc.test(i)||Gm.test(i)},async parse(i,t,e){let r=Yc.test(i)?Yc.parse(i):Gm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=ie.join(ie.dirname(s),d);f=En(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new th({data:r,textures:l},s)},async load(i,t){return await(await z.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};At();var qc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};gi();C();vt();var dw={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof E),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};C();async function Kc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var fw={extension:{type:y.DetectionParser,priority:1},test:async()=>Kc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};C();var pw=["png","jpg","jpeg"],mw={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...pw],remove:async i=>i.filter(t=>!pw.includes(t))};C();var dI="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function yo(i){return dI?!1:document.createElement("video").canPlayType(i)!==""}var gw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};C();var xw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};C();var _w={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};C();var yw={extension:{type:y.DetectionParser,priority:0},test:async()=>Kc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};At();Wi();Sn();yl();var Zc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||O(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return O(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=zi(t),n=Ee(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=ie.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
1094
1094
  ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t,s=>({alias:[s],src:s})).map(async s=>{let o=ie.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&O(`[Assets] loadParser name conflict "${e.name}"`):O("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};Rt();C();function ir(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}Wi();function sr(i,t){let e=i.split("?")[0],r=ie.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}Yr();var fI=".json",pI="application/json",bw={extension:{type:y.LoadParser,priority:le.Low},name:"loadJson",test(i){return ir(i,pI)||sr(i,fI)},async load(i){return await(await z.get().fetch(i)).json()}};Rt();C();Yr();var mI=".txt",gI="text/plain",vw={name:"loadTxt",extension:{type:y.LoadParser,priority:le.Low,name:"loadTxt"},test(i){return ir(i,gI)||sr(i,mI)},async load(i){return await(await z.get().fetch(i)).text()}};Rt();C();At();Wi();gi();Yr();var xI=["normal","bold","100","200","300","400","500","600","700","800","900"],_I=[".ttf",".otf",".woff",".woff2"],yI=["font/ttf","font/otf","font/woff","font/woff2"],bI=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function vI(i){let t=ie.extname(i),s=ie.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(bI)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var TI=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function SI(i){return TI.test(i)?i:encodeURI(i)}var Tw={extension:{type:y.LoadParser,priority:le.Low},name:"loadWebFont",test(i){return ir(i,yI)||sr(i,_I)},async load(i,t){let e=z.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??vI(i),o=t.data?.weights?.filter(a=>xI.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${SI(i)})`,{...n,weight:h});await l.load(),e.add(l),r.push(l)}return xt.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return O("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{xt.remove(`${t.family}-and-url`),z.get().getFontFaceSet().delete(t)})}};Rt();C();Gs();nc();Is();function bo(i,t=1){let e=We.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}Yr();vt();At();gi();function vo(i,t,e){i.label=e,i._sourceOrigin=e;let r=new E({source:i,label:e}),s=()=>{delete t.promiseCache[e],xt.has(e)&&xt.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(O("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(O("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var EI=".svg",AI="image/svg+xml",Sw={extension:{type:y.LoadParser,priority:le.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ir(i,AI)||sr(i,EI)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?CI(i):wI(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function wI(i,t,e,r){let o=await(await z.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||bo(i),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},m=new Ge({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return vo(m,e,i)}async function CI(i){let e=await(await z.get().fetch(i)).text(),r=new we;return r.svg(e),r}Rt();C();Gs();var PI=`(function () {
1095
1095
  'use strict';
1096
1096
 
@@ -1141,14 +1141,14 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Ee(t
1141
1141
  };
1142
1142
 
1143
1143
  })();
1144
- `,Eo=null,eh=class{constructor(){Eo||(Eo=URL.createObjectURL(new Blob([RI],{type:"application/javascript"}))),this.worker=new Worker(Eo)}};eh.revokeObjectURL=function(){Eo&&(URL.revokeObjectURL(Eo),Eo=null)};var Ew=0,Um,km=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new So;e.addEventListener("message",r=>{e.terminate(),So.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Um===void 0&&(Um=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Um&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[Ew]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ew++,id:r})}},Om=new km;Yr();var MI=[".jpeg",".jpg",".png",".webp",".avif"],BI=["image/jpeg","image/png","image/webp","image/avif"];async function II(i,t){let e=await z.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:y.LoadParser,priority:le.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,BI)||sr(i,MI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Om.isImageBitmapSupported()?r=await Om.loadImageBitmap(i,t):r=await II(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Ge({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||bo(i),...t.data});return vo(s,e,i)},unload(i){i.destroy(!0)}};C();Zd();Kd();var Aw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],FI=Aw.map(i=>`video/${i.substring(1)}`);function GI(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=kI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function UI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function kI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var ww={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(i){let t=ir(i,FI),e=sr(i,Aw);return t||e},async load(i,t,e){let r={...Us.defaultOptions,resolution:t.data?.resolution||bo(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),GI(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Us.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Us({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await UI(s),h(vo(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Is();C();Is();var Jc={extension:{type:y.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(We.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Cw={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:i=>We.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Is();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new We,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=zi(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;F.handleByList(y.LoadParser,or.loader.parsers).handleByList(y.ResolveParser,or.resolver.parsers).handleByList(y.CacheParser,or.cache.parsers).handleByList(y.DetectionParser,or.detections);F.add(dw,mw,fw,yw,gw,xw,_w,bw,vw,Tw,Sw,Qc,ww,uw,cw,Jc,Cw);var Pw={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};F.handle(y.Asset,i=>{let t=i.ref;Object.entries(Pw).filter(([e])=>!!t[e]).forEach(([e,r])=>F.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Pw).filter(e=>!!t[e]).forEach(e=>F.remove(t[e]))});Jh();Dt();_l();var eu=class extends mi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new pe({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Rw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(W(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();Ji();var _r=class extends eu{constructor(...t){let e=Rw(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=Xt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Yr();vt();tf();dr();xp();Tl();Yn();Ji();_e();var OI=Gi(Vl(),1);F.add(OT,DT);var LI=({JSONObject:i,parserPlugins:t=[]})=>i.map(r=>{let s=t.find(o=>o.type===r.type);return s?s.parse({state:r,parserPlugins:t}):i}),Lm=LI;var DI=new(window.AudioContext||window.webkitAudioContext),Dm={},NI=async(i,t)=>{if(!Dm[i]&&t.byteLength!==0)try{let e=await DI.decodeAudioData(t);Dm[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},HI=i=>Dm[i],Ao={load:NI,getAsset:HI};var ze=({type:i,add:t,update:e,delete:r,parse:s})=>({type:i,add:t,update:e,delete:r,parse:s});var Nm=({type:i,animate:t})=>({type:i,animate:t});var Hm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Mw={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Vm={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ru={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider"};var wo={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0};var Le=(i,t,e={})=>{let r={...wo,...e,...t};i.style=r};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.targetId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Bw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new _r({label:e.id}),l=()=>{h.text=e.content,Le(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click;if(u){let{cursor:f,soundSrc:p,actionPayload:m}=u;h.eventMode="static";let g=()=>{m&&s&&s("hover",{_event:{id:h.label},...m}),f&&(h.cursor=f),p&&i.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),u?.textStyle&&Le(h,u.textStyle,e.textStyle)},b=()=>{h.cursor="auto",Le(h,e.textStyle)};h.on("pointerover",g),h.on("pointerout",b)}if(d){let{soundSrc:f,actionPayload:p}=d;h.eventMode="static";let m=()=>{d?.textStyle&&Le(h,d.textStyle,e.textStyle)},g=()=>{Le(h,e.textStyle),p&&s&&s("click",{_event:{id:h.label},...p}),f&&i.audioStage.add({id:`click-${Date.now()}`,url:f,loop:!1})},b=()=>{Le(h,e.textStyle)};h.on("pointerdown",m),h.on("pointerup",g),h.on("pointerupoutside",b)}t.addChild(h),r&&r.length>0&&(a=!1,await _t(e.id,o,{app:i,element:h,animations:r,signal:n}),a=!0),n.removeEventListener("abort",c)};var Iw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Le(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&s&&s("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.textStyle&&Le(h,d.textStyle,r.textStyle)},_=()=>{h.cursor="auto",Le(h,r.textStyle)};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{f?.textStyle&&Le(h,f.textStyle,r.textStyle)},b=()=>{Le(h,r.textStyle),m&&s&&s("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{Le(h,r.textStyle)};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Fw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Gw=({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var nr=i=>{if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ru).includes(i.type))throw new Error("Input Error: Type must be one of "+Object.values(ru).join(", "));if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type===ru.CONTAINER&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=Gw({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY}),a={id:i.id,type:i.type,width:Math.round(t),height:Math.round(e),x:Math.round(r),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:i.alpha??1};return i.hover&&(a.hover=i.hover),i.click&&(a.click=i.click),a};var Uw=({state:i})=>{let t={...wo,...i.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),i.width&&(t.wordWrapWidth=i.width,t.wordWrap=!0);let{width:e,height:r}=Xt.measureText(i.content??"",new Mt(t)),s=Math.round(e),o=Math.round(r);return{...nr({...i,width:s,height:o}),content:i.content??"",textStyle:{...t}}};var VI=ze({type:"text",add:Bw,update:Iw,delete:Fw,parse:Uw});var kw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:g,alpha:b}=e,_=new xr;_.label=a;let v=!0,T=()=>{_.clear(),_.rect(0,0,Math.round(c),Math.round(u)).fill(d),_.x=Math.round(h),_.y=Math.round(l),_.alpha=b,f&&_.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},w=async()=>{v||T()};n.addEventListener("abort",w),T();let S=e?.hover,A=e?.click;if(S){let{cursor:M,soundSrc:P,actionPayload:R}=S;_.eventMode="static";let I=()=>{R&&o&&o("hover",{_event:{id:_.label},...R}),M&&(_.cursor=M),P&&i.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},k=()=>{_.cursor="auto"};_.on("pointerover",I),_.on("pointerout",k)}if(A){let{soundSrc:M,actionPayload:P}=A;_.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:_.label},...P}),M&&i.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};_.on("pointerup",R)}t.addChild(_),r&&r.length>0&&(v=!1,await _t(a,s,{app:i,element:_,animations:r,signal:n})),v=!0,n.removeEventListener("abort",w)};var Ow=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},_=()=>{h.cursor="auto"};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})};h.on("pointerup",g)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Dw=({state:i})=>{let t=nr(i),e=t;return i.border&&(e={...t,border:{alpha:i.border?.alpha??1,color:i.border?.color??"black",width:i.border?.width??0}}),{...e,cursor:i.cursor??"",fill:i.fill??"white",pointerDown:i.pointerDown??"",pointerMove:i.pointerMove??"",pointerUp:i.pointerUp??"",rotation:i.rotation??0}};var WI=ze({type:"rect",add:kw,update:Ow,delete:Lw,parse:Dw});var Nw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?E.from(f):E.EMPTY,g=new se(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},_=async()=>{a||b()};n.addEventListener("abort",_),b();let v=e?.hover,T=e?.click;if(v){let{cursor:w,soundSrc:S,actionPayload:A}=v;g.eventMode="static";let M=()=>{if(A&&s&&s("hover",{_event:{id:g.label},...A}),w&&(g.cursor=w),S&&i.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;g.texture=R}},P=()=>{g.cursor="auto",g.texture=m};g.on("pointerover",M),g.on("pointerout",P)}if(T){let{soundSrc:w,actionPayload:S}=T;g.eventMode="static";let A=()=>{if(T?.src){let R=T.src?E.from(T.src):E.EMPTY;g.texture=R}},M=()=>{g.texture=m,S&&s&&s("click",{_event:{id:g.label},...S}),w&&i.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1})},P=()=>{g.texture=m};g.on("pointerdown",A),g.on("pointerup",M),g.on("pointerupoutside",P)}t.addChild(g),r&&r.length>0&&(a=!1,await _t(h,o,{app:i,element:g,animations:r,signal:n}),a=!0),n.removeEventListener("abort",_)};var Hw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let p=r.src?E.from(r.src):E.EMPTY;h.texture=p}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{if(g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.src){let v=d.src?E.from(d.src):E.EMPTY;h.texture=v}},_=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{if(f?.src){let v=f.src?E.from(f.src):E.EMPTY;h.texture=v}},b=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Vw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.children.find(a=>a.label===e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Ww=({state:i})=>({...nr(i),src:i.src??i.url??"",alpha:i.alpha??1,cursor:i.cursor??""});var zI=ze({type:"sprite",add:Nw,update:Hw,delete:Vw,parse:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:_,step:v,initialValue:T,originX:w,originY:S,hover:A,change:M}=e,P=new St;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,I=m?E.from(m):E.EMPTY,k=new se(I);k.label=`${h}-bar`,k.eventMode="static";let j=p?E.from(p):E.EMPTY,N=new se(j);N.label=`${h}-thumb`,N.eventMode="static";let ot=T??b,L=_-b,$=Tt=>{let ct=(Tt-b)/L;g==="horizontal"?(N.x=ct*(k.width-N.width),N.y=(k.height-N.height)/2):(N.x=(k.width-N.width)/2,N.y=ct*(k.height-N.height))},H=()=>{k.width=u,k.height=d;let Tt=g==="horizontal"?d-R*2:u-R*2,ct=p?E.from(p):E.EMPTY,gt=ct.width,Ft=ct.height,qt=Tt/gt,Kt=Tt/Ft,Me=Math.min(qt,Kt);N.width=gt*Me,N.height=Ft*Me,$(ot)},U=async()=>{a||H()};n.addEventListener("abort",U),H();let tt=j,yt=I,mt=!1,Ot=Tt=>{let ct;if(g==="horizontal"){let Ft=Tt.x-N.width/2;ct=Math.max(0,Math.min(1,Ft/(k.width-N.width)))}else{let Ft=Tt.y-N.height/2;ct=Math.max(0,Math.min(1,Ft/(k.height-N.height)))}let gt=b+ct*L;return v>0&&(gt=Math.round((gt-b)/v)*v+b,gt=Math.max(b,Math.min(_,gt))),gt},Lt=Tt=>{let ct=P.toLocal(Tt.global),gt=Ot(ct);gt!==ot&&(ot=gt,$(ot),M?.actionPayload&&o&&o("change",{_event:{id:h,value:ot},...M.actionPayload}))},Yt=Tt=>{mt=!0,Lt(Tt)},re=Tt=>{mt&&Lt(Tt)},ge=()=>{mt&&(mt=!1)};if(P.on("pointerdown",Yt),P.on("globalpointermove",re),P.on("pointerup",ge),P.on("pointerupoutside",ge),A){let{cursor:Tt,soundSrc:ct,thumbSrc:gt,barSrc:Ft}=A,qt=()=>{Tt&&(k.cursor=Tt,N.cursor=Tt),ct&&i.audioStage.add({id:`hover-${Date.now()}`,url:ct,loop:!1}),gt&&(N.texture=E.from(gt)),Ft&&(k.texture=E.from(Ft))},Kt=()=>{mt||(k.cursor="auto",N.cursor="auto",N.texture=tt,k.texture=yt)};P.on("pointerover",qt),P.on("pointerout",Kt),P.on("pointerupoutside",Kt)}P.addChild(k),P.addChild(N),t.addChild(P),r&&r.length>0&&(a=!1,await _t(h,s,{app:i,element:P,animations:r,signal:n}),a=!0),n.removeEventListener("abort",U)};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,g=p.height||16,b=f/m,_=f/g,v=Math.min(b,_);if(u.width=m*v,u.height=g*v,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,w=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=w*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=w*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:_}=r,v=_??p,T=m-p;h.eventMode="static";let w=N=>{let ot=(N-p)/T;b==="horizontal"?(u.x=ot*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=ot*(c.height-u.height))},S=N=>{let ot;if(b==="horizontal"){let $=N.x-u.width/2;ot=Math.max(0,Math.min(1,$/(c.width-u.width)))}else{let $=N.y-u.height/2;ot=Math.max(0,Math.min(1,$/(c.height-u.height)))}let L=p+ot*T;return g>0&&(L=Math.round((L-p)/g)*g+p,L=Math.max(p,Math.min(m,L))),L},A=u.texture,M=c.texture,P=!1,R=N=>{let ot=h.toLocal(N.global),L=S(ot);L!==v&&(v=L,w(v),f?.actionPayload&&s&&s("change",{_event:{id,value:v},...f.actionPayload}))},I=N=>{P=!0,R(N)},k=N=>{P&&R(N)},j=()=>{P&&(P=!1)};if(h.on("pointerdown",I),h.on("globalpointermove",k),h.on("pointerup",j),h.on("pointerupoutside",j),d){let{cursor:N,soundSrc:ot,thumbSrc:L,barSrc:$}=d,H=()=>{N&&(h.cursor=N,u.cursor=N),ot&&i.audioStage.add({id:`hover-${Date.now()}`,url:ot,loop:!1}),L&&(u.texture=E.from(L)),$&&(c.texture=E.from($))},U=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=A,c.texture=M)};h.on("pointerover",H),h.on("pointerout",U),h.on("pointerupoutside",U)}}}};h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy({children:!0})},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var jw=({state:i})=>{let t=nr(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.change&&{change:i.change}}};var $I=ze({type:"slider",add:zw,update:$w,delete:Xw,parse:jw});var Yw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new St;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let _ of u){let v=n.find(T=>T.type===_.type);if(!v)throw new Error(`No plugin found for child element type: ${_.type}`);await v.add({app:i,parent:p,element:_,animations:r,eventHandler:s,animationPlugins:o,animateElements:_t,elementPlugins:n,signal:a})}d&&XI({container:p,element:e}),r&&r.length>0&&(m=!1,await _t(h,o,{app:i,element:p,animations:r,signal:a})),m=!0,a.removeEventListener("abort",b)},XI=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new St;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new xr().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var qw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=qw(e,r,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),jI(t,r)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},jI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var Kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&await rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await _t(e.id,n,{app:i,element:l,animations:o,signal:h})),c=!0,await u(),h.removeEventListener("abort",d))};var Zw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&(t.removeChild(n),n.destroy({children:!0,texture:!0,baseTexture:!0}))},l=async()=>{a||h()};o.addEventListener("abort",l),s&&s.length>0&&(a=!1,await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Qw=({state:i,parserPlugins:t=[]})=>{let e=i.direction,r=!!i.scroll,s=i.gap||0,o=structuredClone(i.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let _=0;_<o.length;_++){let v=_<o.length-1?s:0,T=o[_];_>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let w=t.find(S=>S.type===T.type);w&&(T=w.parse({state:T,parserPlugins:t})),e==="horizontal"?(i.width&&T.width+m>i.width&&!r?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+v,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"&&(i.height&&T.height+g>i.height&&!r?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+v,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)),n.push(T)}return{...nr({...i,width:i.width?i.width:a,height:i.height?i.height:h}),children:n,direction:e,gap:s,scroll:r,rotation:i.rotation??0}};var YI=ze({type:"container",add:Yw,update:Kw,delete:Zw,parse:Qw});function Co(i,t){let e=i.text.substring(0,t),s=Xt.measureText(e,i.style).width;return i.x+s}var qI=async(i,t)=>new Promise((e,r)=>{if(t?.aborted)return r(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},i),o=()=>{clearTimeout(s),r(t.reason)};t?.addEventListener("abort",o,{once:!0})}),Po=qI;var Jw=async({parent:i,element:t,signal:e})=>{let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r)),l=new St;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){if(e?.aborted)return;let p=d.lineParts[f],m=new Mt(p.textStyle),g=new _r({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),b=null;if(p.furigana){let T=new Mt(p.furigana.textStyle);b=new _r({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(b)}l.addChild(g);let _=p.text,v=p.furigana?.text||"";if(n||e?.aborted)g.text=_,c.x=Co(g,_.length-1)+o,b&&(b.text=v);else{let T=v.length;for(let w=0;w<_.length;w++){if(e?.aborted)return;g.text=_.substring(0,w+1),c.x=Co(g,w)+o;let S=Math.round((w+1)/_.length*T);if(b&&(b.text=v.substring(0,S)),w<_.length-1)try{await Po(a,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(u<t.content.length-1)try{await Po(h,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new _r({text:"",style:g,x:m.x,y:m.y}),_=null;if(m.furigana){let w=new Mt(m.furigana.textStyle);_=new _r({text:"",style:w,x:m.furigana.x,y:m.furigana.y}),c.addChild(_)}c.addChild(b);let v=m.text,T=m.furigana?.text||"";if(a||r?.aborted)b.text=v,u.x=Co(b,v.length-1)+n,_&&(_.text=T);else{let w=T.length;for(let S=0;S<v.length;S++){b.text=v.substring(0,S+1),u.x=Co(b,S)+n;let A=Math.round((S+1)/v.length*w);if(_&&(_.text=T.substring(0,A)),S<v.length-1)try{await Po(h,r)}catch(M){if(M.name==="AbortError")return;throw M}}}}if(d<e.content.length-1)try{await Po(l,r)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=!0,o=()=>{r&&!r.destroyed&&r.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var KI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=t-s,f={...u.textStyle,wordWrapWidth:d},p=Xt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=Xt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let v=Xt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-v.height+o+2,w={text:u.furigana.text,textStyle:u.furigana.textStyle,x:s+(p.lineWidths[0]-v.width)/2,y:T};b.furigana=w}r.push(b),n=Math.max(n,g.height),s+=p.lineWidths[0],a=Math.max(a,s);let _=p.lines.slice(1).join(" ");_&&_.length>0?u.text=_:h.shift()}r.length>0&&e.push({lineParts:r,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},r1=({state:i})=>{let t={...wo,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=KI(e,r),a=i.width||o,l=nr({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var ZI=ze({type:"text-revealing",add:Jw,update:t1,delete:e1,parse:r1});var QI={linear:i=>i},JI=(i,t,e,r)=>i+(t-i)*QI[r](e),tF=(i,t,e)=>{typeof t=="string"&&(t=Vm[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},eF=(i,t,e)=>{typeof t=="string"&&(t=Vm[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},rF=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},iF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return JI(s,a,h,o)}}return i[i.length-1].value},sF=i=>Math.max.apply(null,i),i1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,g])=>{if(!Mw[m])throw new Error(`${m} is not a supported property for transition.`);return{...g,property:m}}),h=a.map(m=>m.keyframes.reduce((g,b)=>g+b.duration||0,0)),l=sF(h),c={};a.forEach(m=>{c[m.property]=tF(t,m.property)});let u=a.map(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue}]:g=[{value:c[m.property]}],g=g.concat(m.keyframes);let b=rF(g);return{property:m.property,timeline:b}}),d=0,f=m=>{u.forEach(({property:g,timeline:b})=>{let _=iF(b,m);t&&!t.destroyed&&eF(t,g,_)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.ticker.add(p)});var oF=Nm({type:"tween",animate:i1});var s1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var o1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var n1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var nF=Hm({type:"sound",add:s1,update:o1,delete:n1});var a1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Wm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=a1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var $e=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))($e||{}),zm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(zm||{}),iu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(iu||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),G=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(G||{}),ei=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ei||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),D=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(D||{}),ar=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ar||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),yr=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(yr||{}),Xe=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Xe||{}),Ci=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ci||{}),su=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(su||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),De=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(De||{});var $m={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:$m,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Gd();var aF=fi.default??fi,br=aF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var hs=Gi(l1(),1),Q2=Gi(Vl(),1);var Ag=Gi(AP(),1);var wP={};function ht(i,t,e=3){if(wP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1144
+ `,Eo=null,eh=class{constructor(){Eo||(Eo=URL.createObjectURL(new Blob([RI],{type:"application/javascript"}))),this.worker=new Worker(Eo)}};eh.revokeObjectURL=function(){Eo&&(URL.revokeObjectURL(Eo),Eo=null)};var Ew=0,Um,km=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new So;e.addEventListener("message",r=>{e.terminate(),So.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Um===void 0&&(Um=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Um&&(this._createdWorkers++,t=new eh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[Ew]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Ew++,id:r})}},Om=new km;Yr();var MI=[".jpeg",".jpg",".png",".webp",".avif"],BI=["image/jpeg","image/png","image/webp","image/avif"];async function II(i,t){let e=await z.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var Qc={name:"loadTextures",extension:{type:y.LoadParser,priority:le.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ir(i,BI)||sr(i,MI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Om.isImageBitmapSupported()?r=await Om.loadImageBitmap(i,t):r=await II(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Ge({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||bo(i),...t.data});return vo(s,e,i)},unload(i){i.destroy(!0)}};C();Zd();Kd();var Aw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],FI=Aw.map(i=>`video/${i.substring(1)}`);function GI(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=kI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function UI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function kI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var ww={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(i){let t=ir(i,FI),e=sr(i,Aw);return t||e},async load(i,t,e){let r={...Us.defaultOptions,resolution:t.data?.resolution||bo(i),alphaMode:t.data?.alphaMode||await Al(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),GI(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Us.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Us({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await UI(s),h(vo(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};C();Is();C();Is();var Jc={extension:{type:y.ResolveParser,name:"resolveTexture"},test:Qc.test,parse:i=>({resolution:parseFloat(We.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Cw={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:i=>We.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Jc.parse};Is();Sn();yl();var tu=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new We,this.loader=new Zc,this.cache=xt,this._backgroundLoader=new qc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=zi(t),s=Ee(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return xt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=xt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),xt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ee(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ee(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{xt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},or=new tu;F.handleByList(y.LoadParser,or.loader.parsers).handleByList(y.ResolveParser,or.resolver.parsers).handleByList(y.CacheParser,or.cache.parsers).handleByList(y.DetectionParser,or.detections);F.add(dw,mw,fw,yw,gw,xw,_w,bw,vw,Tw,Sw,Qc,ww,uw,cw,Jc,Cw);var Pw={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};F.handle(y.Asset,i=>{let t=i.ref;Object.entries(Pw).filter(([e])=>!!t[e]).forEach(([e,r])=>F.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Pw).filter(e=>!!t[e]).forEach(e=>F.remove(t[e]))});Jh();Dt();_l();var eu=class extends mi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new pe({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Rw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(W(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Yn();Ji();var _r=class extends eu{constructor(...t){let e=Rw(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=Xt.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};Yr();vt();tf();dr();xp();Tl();Yn();Ji();_e();var OI=Gi(Vl(),1);F.add(OT,DT);var LI=new(window.AudioContext||window.webkitAudioContext),Lm={},DI=async(i,t)=>{if(!Lm[i]&&t.byteLength!==0)try{let e=await LI.decodeAudioData(t);Lm[i]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${i}:`,e)}},NI=i=>Lm[i],Ao={load:DI,getAsset:NI};var ze=({type:i,add:t,update:e,delete:r,parse:s})=>({type:i,add:t,update:e,delete:r,parse:s});var Dm=({type:i,animate:t})=>({type:i,animate:t});var Nm=({type:i,add:t,update:e,delete:r})=>({type:i,add:t,update:e,delete:r});var Mw={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},Hm={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var ru={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider"};var wo={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0};var Le=(i,t,e={})=>{let r={...wo,...e,...t};i.style=r};async function _t(i,t,{app:e,element:r,animations:s,signal:o}){let n=[];for(let a of s)if(a.targetId===i){let h=t.find(l=>l.type===a.type);if(!h)throw new Error(`No animation plugin found for type: ${a.type}`);n.push(h.animate({app:e,element:r,animation:a,signal:o}))}return Promise.all(n)}var Bw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new _r({label:e.id}),l=()=>{h.text=e.content,Le(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click;if(u){let{cursor:f,soundSrc:p,actionPayload:m}=u;h.eventMode="static";let g=()=>{m&&s&&s("hover",{_event:{id:h.label},...m}),f&&(h.cursor=f),p&&i.audioStage.add({id:`hover-${Date.now()}`,url:p,loop:!1}),u?.textStyle&&Le(h,u.textStyle,e.textStyle)},b=()=>{h.cursor="auto",Le(h,e.textStyle)};h.on("pointerover",g),h.on("pointerout",b)}if(d){let{soundSrc:f,actionPayload:p}=d;h.eventMode="static";let m=()=>{d?.textStyle&&Le(h,d.textStyle,e.textStyle)},g=()=>{Le(h,e.textStyle),p&&s&&s("click",{_event:{id:h.label},...p}),f&&i.audioStage.add({id:`click-${Date.now()}`,url:f,loop:!1})},b=()=>{Le(h,e.textStyle)};h.on("pointerdown",m),h.on("pointerup",g),h.on("pointerupoutside",b)}t.addChild(h),r&&r.length>0&&(a=!1,await _t(e.id,o,{app:i,element:h,animations:r,signal:n}),a=!0),n.removeEventListener("abort",c)};var Iw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.text=r.content,Le(h,r.textStyle),h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&s&&s("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.textStyle&&Le(h,d.textStyle,r.textStyle)},_=()=>{h.cursor="auto",Le(h,r.textStyle)};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{f?.textStyle&&Le(h,f.textStyle,r.textStyle)},b=()=>{Le(h,r.textStyle),m&&s&&s("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{Le(h,r.textStyle)};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await _t(r.id,n,{app:i,element:h,animations:o,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Fw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Gw=({positionX:i=0,positionY:t=0,width:e,height:r,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof r!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:r*o},a=i-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var nr=i=>{if(typeof i.width!="number"||typeof i.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(ru).includes(i.type))throw new Error("Input Error: Type must be one of "+Object.values(ru).join(", "));if(!i.id)throw new Error("Input Error: Id is missing");let t=i.scaleX?i.scaleX*i.width:i.width,e=i.scaleY?i.scaleY*i.height:i.height;i.type===ru.CONTAINER&&(t=i.width,e=i.height);let{x:r,y:s,originX:o,originY:n}=Gw({positionX:i.x,positionY:i.y,width:t,height:e,anchorX:i.anchorX,anchorY:i.anchorY}),a={id:i.id,type:i.type,width:Math.round(t),height:Math.round(e),x:Math.round(r),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:i.alpha??1};return i.hover&&(a.hover=i.hover),i.click&&(a.click=i.click),a};var Uw=({state:i})=>{let t={...wo,...i.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),i.width&&(t.wordWrapWidth=i.width,t.wordWrap=!0);let{width:e,height:r}=Xt.measureText(i.content??"",new Mt(t)),s=Math.round(e),o=Math.round(r);return{...nr({...i,width:s,height:o}),content:i.content??"",textStyle:{...t}}};var HI=ze({type:"text",add:Bw,update:Iw,delete:Fw,parse:Uw});var kw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,originX:p,originY:m,rotation:g,alpha:b}=e,_=new xr;_.label=a;let v=!0,T=()=>{_.clear(),_.rect(0,0,Math.round(c),Math.round(u)).fill(d),_.x=Math.round(h),_.y=Math.round(l),_.alpha=b,f&&_.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},w=async()=>{v||T()};n.addEventListener("abort",w),T();let S=e?.hover,A=e?.click;if(S){let{cursor:M,soundSrc:P,actionPayload:R}=S;_.eventMode="static";let I=()=>{R&&o&&o("hover",{_event:{id:_.label},...R}),M&&(_.cursor=M),P&&i.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},k=()=>{_.cursor="auto"};_.on("pointerover",I),_.on("pointerout",k)}if(A){let{soundSrc:M,actionPayload:P}=A;_.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:_.label},...P}),M&&i.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};_.on("pointerup",R)}t.addChild(_),r&&r.length>0&&(v=!1,await _t(a,s,{app:i,element:_,animations:r,signal:n})),v=!0,n.removeEventListener("abort",w)};var Ow=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.clear(),h.rect(0,0,Math.round(r.width),Math.round(r.height)).fill(r.fill),h.x=Math.round(r.x),h.y=Math.round(r.y),h.alpha=r.alpha,r.border&&h.stroke({color:r.border.color,alpha:r.border.alpha,width:Math.round(r.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1})},_=()=>{h.cursor="auto"};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})};h.on("pointerup",g)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Lw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Dw=({state:i})=>{let t=nr(i),e=t;return i.border&&(e={...t,border:{alpha:i.border?.alpha??1,color:i.border?.color??"black",width:i.border?.width??0}}),{...e,cursor:i.cursor??"",fill:i.fill??"white",pointerDown:i.pointerDown??"",pointerMove:i.pointerMove??"",pointerUp:i.pointerUp??"",rotation:i.rotation??0}};var VI=ze({type:"rect",add:kw,update:Ow,delete:Lw,parse:Dw});var Nw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?E.from(f):E.EMPTY,g=new se(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},_=async()=>{a||b()};n.addEventListener("abort",_),b();let v=e?.hover,T=e?.click;if(v){let{cursor:w,soundSrc:S,actionPayload:A}=v;g.eventMode="static";let M=()=>{if(A&&s&&s("hover",{_event:{id:g.label},...A}),w&&(g.cursor=w),S&&i.audioStage.add({id:`hover-${Date.now()}`,url:S,loop:!1}),v?.src){let R=v.src?E.from(v.src):E.EMPTY;g.texture=R}},P=()=>{g.cursor="auto",g.texture=m};g.on("pointerover",M),g.on("pointerout",P)}if(T){let{soundSrc:w,actionPayload:S}=T;g.eventMode="static";let A=()=>{if(T?.src){let R=T.src?E.from(T.src):E.EMPTY;g.texture=R}},M=()=>{g.texture=m,S&&s&&s("click",{_event:{id:g.label},...S}),w&&i.audioStage.add({id:`click-${Date.now()}`,url:w,loop:!1})},P=()=>{g.texture=m};g.on("pointerdown",A),g.on("pointerup",M),g.on("pointerupoutside",P)}t.addChild(g),r&&r.length>0&&(a=!1,await _t(h,o,{app:i,element:g,animations:r,signal:n}),a=!0),n.removeEventListener("abort",_)};var Hw=async({app:i,parent:t,prevElement:e,nextElement:r,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){if(e.src!==r.src){let p=r.src?E.from(r.src):E.EMPTY;h.texture=p}h.x=Math.round(r.x),h.y=Math.round(r.y),h.width=Math.round(r.width),h.height=Math.round(r.height),h.alpha=r.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup");let d=r?.hover,f=r?.click;if(d){let{cursor:p,soundSrc:m,actionPayload:g}=d;h.eventMode="static";let b=()=>{if(g&&n&&n("hover",{_event:{id:h.label},...g}),p&&(h.cursor=p),m&&i.audioStage.add({id:`hover-${Date.now()}`,url:m,loop:!1}),d?.src){let v=d.src?E.from(d.src):E.EMPTY;h.texture=v}},_=()=>{h.cursor="auto",h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerover",b),h.on("pointerout",_)}if(f){let{soundSrc:p,actionPayload:m}=f;h.eventMode="static";let g=()=>{if(f?.src){let v=f.src?E.from(f.src):E.EMPTY;h.texture=v}},b=()=>{h.texture=r.src?E.from(r.src):E.EMPTY,m&&n&&n("click",{_event:{id:h.label},...m}),p&&i.audioStage.add({id:`click-${Date.now()}`,url:p,loop:!1})},_=()=>{h.texture=r.src?E.from(r.src):E.EMPTY};h.on("pointerdown",g),h.on("pointerup",b),h.on("pointerupoutside",_)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await _t(e.id,o,{app:i,element:h,animations:s,signal:a}),l=!0),c(),a.removeEventListener("abort",u))};var Vw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{let n=t.children.find(a=>a.label===e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy()},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Ww=({state:i})=>({...nr(i),src:i.src??i.url??"",alpha:i.alpha??1,cursor:i.cursor??""});var WI=ze({type:"sprite",add:Nw,update:Hw,delete:Vw,parse:Ww});var zw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:_,step:v,initialValue:T,originX:w,originY:S,hover:A,change:M}=e,P=new St;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,I=m?E.from(m):E.EMPTY,k=new se(I);k.label=`${h}-bar`,k.eventMode="static";let j=p?E.from(p):E.EMPTY,N=new se(j);N.label=`${h}-thumb`,N.eventMode="static";let ot=T??b,L=_-b,$=Tt=>{let ct=(Tt-b)/L;g==="horizontal"?(N.x=ct*(k.width-N.width),N.y=(k.height-N.height)/2):(N.x=(k.width-N.width)/2,N.y=ct*(k.height-N.height))},H=()=>{k.width=u,k.height=d;let Tt=g==="horizontal"?d-R*2:u-R*2,ct=p?E.from(p):E.EMPTY,gt=ct.width,Ft=ct.height,qt=Tt/gt,Kt=Tt/Ft,Me=Math.min(qt,Kt);N.width=gt*Me,N.height=Ft*Me,$(ot)},U=async()=>{a||H()};n.addEventListener("abort",U),H();let tt=j,yt=I,mt=!1,Ot=Tt=>{let ct;if(g==="horizontal"){let Ft=Tt.x-N.width/2;ct=Math.max(0,Math.min(1,Ft/(k.width-N.width)))}else{let Ft=Tt.y-N.height/2;ct=Math.max(0,Math.min(1,Ft/(k.height-N.height)))}let gt=b+ct*L;return v>0&&(gt=Math.round((gt-b)/v)*v+b,gt=Math.max(b,Math.min(_,gt))),gt},Lt=Tt=>{let ct=P.toLocal(Tt.global),gt=Ot(ct);gt!==ot&&(ot=gt,$(ot),M?.actionPayload&&o&&o("change",{_event:{id:h,value:ot},...M.actionPayload}))},Yt=Tt=>{mt=!0,Lt(Tt)},re=Tt=>{mt&&Lt(Tt)},ge=()=>{mt&&(mt=!1)};if(P.on("pointerdown",Yt),P.on("globalpointermove",re),P.on("pointerup",ge),P.on("pointerupoutside",ge),A){let{cursor:Tt,soundSrc:ct,thumbSrc:gt,barSrc:Ft}=A,qt=()=>{Tt&&(k.cursor=Tt,N.cursor=Tt),ct&&i.audioStage.add({id:`hover-${Date.now()}`,url:ct,loop:!1}),gt&&(N.texture=E.from(gt)),Ft&&(k.texture=E.from(Ft))},Kt=()=>{mt||(k.cursor="auto",N.cursor="auto",N.texture=tt,k.texture=yt)};P.on("pointerover",qt),P.on("pointerout",Kt),P.on("pointerupoutside",Kt)}P.addChild(k),P.addChild(N),t.addChild(P),r&&r.length>0&&(a=!1,await _t(h,s,{app:i,element:P,animations:r,signal:n}),a=!0),n.removeEventListener("abort",U)};var $w=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(r)){h.x=r.x,h.y=r.y,h.alpha=r.alpha,h.label=r.id,h.pivot.set(r.originX,r.originY);let c=h.getChildByLabel(`${r.id}-bar`),u=h.getChildByLabel(`${r.id}-thumb`);if(c&&u){c.width=r.width,c.height=r.height;let d=0,f=r.direction==="horizontal"?r.height-d*2:r.width-d*2,p=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY,m=p.width||16,g=p.height||16,b=f/m,_=f/g,v=Math.min(b,_);if(u.width=m*v,u.height=g*v,e.barSrc!==r.barSrc){let S=r.barSrc?E.from(r.barSrc):E.EMPTY;c.texture=S}if(e.thumbSrc!==r.thumbSrc){let S=r.thumbSrc?E.from(r.thumbSrc):E.EMPTY;u.texture=S}let T=r.max-r.min,w=(r.initialValue-r.min)/T;r.direction==="horizontal"?(u.x=w*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=w*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:_}=r,v=_??p,T=m-p;h.eventMode="static";let w=N=>{let ot=(N-p)/T;b==="horizontal"?(u.x=ot*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=ot*(c.height-u.height))},S=N=>{let ot;if(b==="horizontal"){let $=N.x-u.width/2;ot=Math.max(0,Math.min(1,$/(c.width-u.width)))}else{let $=N.y-u.height/2;ot=Math.max(0,Math.min(1,$/(c.height-u.height)))}let L=p+ot*T;return g>0&&(L=Math.round((L-p)/g)*g+p,L=Math.max(p,Math.min(m,L))),L},A=u.texture,M=c.texture,P=!1,R=N=>{let ot=h.toLocal(N.global),L=S(ot);L!==v&&(v=L,w(v),f?.actionPayload&&s&&s("change",{_event:{id,value:v},...f.actionPayload}))},I=N=>{P=!0,R(N)},k=N=>{P&&R(N)},j=()=>{P&&(P=!1)};if(h.on("pointerdown",I),h.on("globalpointermove",k),h.on("pointerup",j),h.on("pointerupoutside",j),d){let{cursor:N,soundSrc:ot,thumbSrc:L,barSrc:$}=d,H=()=>{N&&(h.cursor=N,u.cursor=N),ot&&i.audioStage.add({id:`hover-${Date.now()}`,url:ot,loop:!1}),L&&(u.texture=E.from(L)),$&&(c.texture=E.from($))},U=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=A,c.texture=M)};h.on("pointerover",H),h.on("pointerout",U),h.on("pointerupoutside",U)}}}};h&&(o&&o.length>0&&await _t(e.id,n,{app:i,element:h,animations:o,signal:a}),l())};var Xw=async({app:i,parent:t,element:e,animations:r,animationPlugins:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&n.destroy({children:!0})},l=async()=>{a||h()};o.addEventListener("abort",l),r&&r.length>0&&(a=!1,await _t(e.id,s,{app:i,element:n,animations:r,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var jw=({state:i})=>{let t=nr(i),e=i.min??0,r=i.max??100;if(r<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:i.direction??"horizontal",thumbSrc:i.thumbSrc??"",barSrc:i.barSrc??"",alpha:i.alpha??1,min:e,max:r,step:i.step??1,initialValue:i.initialValue??0,...i.hover&&{hover:i.hover},...i.change&&{change:i.change}}};var zI=ze({type:"slider",add:zw,update:$w,delete:Xw,parse:jw});var Yw=async({app:i,parent:t,element:e,animations:r,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new St;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let _ of u){let v=n.find(T=>T.type===_.type);if(!v)throw new Error(`No plugin found for child element type: ${_.type}`);await v.add({app:i,parent:p,element:_,animations:r,eventHandler:s,animationPlugins:o,animateElements:_t,elementPlugins:n,signal:a})}d&&$I({container:p,element:e}),r&&r.length>0&&(m=!1,await _t(h,o,{app:i,element:p,animations:r,signal:a})),m=!0,a.removeEventListener("abort",b)},$I=({container:i,element:t})=>{let e=0,r=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),r=Math.max(n.height+n.y,r)});let s=t.scroll&&t.height&&r>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new St;[...i.children].forEach(f=>{n.addChild(f)}),i.addChild(n);let h=new xr().rect(0,0,t.width||e,t.height||r).fill({color:16711680,alpha:0});i.addChild(h),n.mask=h,i.eventMode="static";let l=0,c=0,u=-(r-(t.height||r)),d=-(e-(t.width||e));i.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}};var qw=(i,t,e=[])=>{let r=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of i)r.add(l.id),s.set(l.id,l);for(let l of t)r.add(l.id),o.set(l.id,l);for(let l of r){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var rh=async({app:i,parent:t,prevASTTree:e,nextASTTree:r,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=qw(e,r,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:i,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:i,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:i,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),XI(t,r)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},XI=(i,t)=>{i.children.sort((e,r)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===r.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1})};var Kw=async({app:i,parent:t,prevElement:e,nextElement:r,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(r)&&(l.x=Math.round(r.x),l.y=Math.round(r.y),l.label=r.id,l.alpha=r.alpha,JSON.stringify(e.children)!==JSON.stringify(r.children)&&await rh({app:i,parent:l,nextASTTree:r.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await _t(e.id,n,{app:i,element:l,animations:o,signal:h})),c=!0,await u(),h.removeEventListener("abort",d))};var Zw=async({app:i,parent:t,element:e,animationPlugins:r,animations:s,signal:o})=>{let n=t.getChildByLabel(e.id);if(n){let a=!0,h=()=>{n&&!n.destroyed&&(t.removeChild(n),n.destroy({children:!0,texture:!0,baseTexture:!0}))},l=async()=>{a||h()};o.addEventListener("abort",l),s&&s.length>0&&(a=!1,await _t(e.id,r,{app:i,element:n,animations:s,signal:o}),a=!0),h(),o.removeEventListener("abort",l)}};var Qw=({state:i,parserPlugins:t=[]})=>{let e=i.direction,r=!!i.scroll,s=i.gap||0,o=structuredClone(i.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let _=0;_<o.length;_++){let v=_<o.length-1?s:0,T=o[_];_>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let w=t.find(S=>S.type===T.type);w&&(T=w.parse({state:T,parserPlugins:t})),e==="horizontal"?(i.width&&T.width+m>i.width&&!r?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+v,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"&&(i.height&&T.height+g>i.height&&!r?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+v,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)),n.push(T)}return{...nr({...i,width:i.width?i.width:a,height:i.height?i.height:h}),children:n,direction:e,gap:s,scroll:r,rotation:i.rotation??0}};var jI=ze({type:"container",add:Yw,update:Kw,delete:Zw,parse:Qw});function Co(i,t){let e=i.text.substring(0,t),s=Xt.measureText(e,i.style).width;return i.x+s}var YI=async(i,t)=>new Promise((e,r)=>{if(t?.aborted)return r(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},i),o=()=>{clearTimeout(s),r(t.reason)};t?.addEventListener("abort",o,{once:!0})}),Po=YI;var Jw=async({parent:i,element:t,signal:e})=>{let r=t.speed??50,s=t.revealEffect??"typewriter",o=t?.indicator?.offset??12,n=s==="none",a=n?0:Math.max(1,Math.floor(1e3/r)),h=n?0:Math.max(1,Math.floor(4e3/r)),l=new St;l.label=t.id;let c=new se(E.EMPTY);if(t?.indicator?.revealing?.src){let u=t.indicator.revealing.src?E.from(t.indicator.revealing.src):E.EMPTY;c=new se(u),c.width=t.indicator.revealing.width??u.width,c.height=t.indicator.revealing.height??u.height}l.addChild(c),t.x!==void 0&&(l.x=Math.round(t.x)),t.y!==void 0&&(l.y=Math.round(t.y)),t.alpha!==void 0&&(l.alpha=t.alpha),i.addChild(l);for(let u=0;u<t.content.length;u++){let d=t.content[u];c.x=o,c.y=d.y+(d.lineMaxHeight-c.height);for(let f=0;f<d.lineParts.length;f++){if(e?.aborted)return;let p=d.lineParts[f],m=new Mt(p.textStyle),g=new _r({text:"",style:m,x:Math.round(p.x),y:Math.round(p.y)}),b=null;if(p.furigana){let T=new Mt(p.furigana.textStyle);b=new _r({text:"",style:T,x:Math.round(p.furigana.x),y:Math.round(p.furigana.y)}),l.addChild(b)}l.addChild(g);let _=p.text,v=p.furigana?.text||"";if(n||e?.aborted)g.text=_,c.x=Co(g,_.length-1)+o,b&&(b.text=v);else{let T=v.length;for(let w=0;w<_.length;w++){if(e?.aborted)return;g.text=_.substring(0,w+1),c.x=Co(g,w)+o;let S=Math.round((w+1)/_.length*T);if(b&&(b.text=v.substring(0,S)),w<_.length-1)try{await Po(a,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(u<t.content.length-1)try{await Po(h,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let u=t.indicator.complete.src?E.from(t.indicator.complete.src):E.EMPTY;c.texture=u,c.width=t.indicator.complete.width??u.width,c.height=t.indicator.complete.height??u.height}};var t1=async i=>{let{parent:t,nextElement:e,signal:r}=i,s=e.speed??50,o=e.revealEffect??"typewriter",n=e?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=t.children.find(u=>u.label===e.id);if(c){c.removeChildren();let u=new se(E.EMPTY);if(e?.indicator?.revealing?.src){let d=e.indicator.revealing.src?E.from(e.indicator.revealing.src):E.EMPTY;u=new se(d),u.width=e.indicator.revealing.width??d.width,u.height=e.indicator.revealing.height??d.height}c.addChild(u),e.x!==void 0&&(c.x=e.x),e.y!==void 0&&(c.y=e.y),e.alpha!==void 0&&(c.alpha=e.alpha);for(let d=0;d<e.content.length;d++){let f=e.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(r?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new _r({text:"",style:g,x:m.x,y:m.y}),_=null;if(m.furigana){let w=new Mt(m.furigana.textStyle);_=new _r({text:"",style:w,x:m.furigana.x,y:m.furigana.y}),c.addChild(_)}c.addChild(b);let v=m.text,T=m.furigana?.text||"";if(a||r?.aborted)b.text=v,u.x=Co(b,v.length-1)+n,_&&(_.text=T);else{let w=T.length;for(let S=0;S<v.length;S++){b.text=v.substring(0,S+1),u.x=Co(b,S)+n;let A=Math.round((S+1)/v.length*w);if(_&&(_.text=T.substring(0,A)),S<v.length-1)try{await Po(h,r)}catch(M){if(M.name==="AbortError")return;throw M}}}}if(d<e.content.length-1)try{await Po(l,r)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let d=e.indicator.complete.src?E.from(e.indicator.complete.src):E.EMPTY;u.texture=d,u.width=e.indicator.complete.width??d.width,u.height=e.indicator.complete.height??d.height}}};var e1=async({parent:i,element:t,signal:e})=>{if(e?.aborted)return;let r=i.getChildByLabel(t.id);if(r){let s=!0,o=()=>{r&&!r.destroyed&&r.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var qI=(i,t)=>{let e=[],r=[],s=0,o=0,n=0,a=0,h=[...i],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=t-s,f={...u.textStyle,wordWrapWidth:d},p=Xt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&r.length>0){e.push({lineParts:[...r],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,r=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=Xt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let v=Xt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-v.height+o+2,w={text:u.furigana.text,textStyle:u.furigana.textStyle,x:s+(p.lineWidths[0]-v.width)/2,y:T};b.furigana=w}r.push(b),n=Math.max(n,g.height),s+=p.lineWidths[0],a=Math.max(a,s);let _=p.lines.slice(1).join(" ");_&&_.length>0?u.text=_:h.shift()}r.length>0&&e.push({lineParts:r,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},r1=({state:i})=>{let t={...wo,wordWrap:!0},e=(i.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),i.width&&(u.wordWrapWidth=i.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),i.width&&(f.wordWrapWidth=i.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),r=i.width||500,{chunks:s,width:o,height:n}=qI(e,r),a=i.width||o,l=nr({...i,width:a,height:n});if(l.alpha=i.alpha??1,i.indicator){let c=i.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...i.textStyle||{}},speed:i.speed??50,revealEffect:i.revealEffect??"typewriter",...i.width!==void 0&&{width:i.width}}};var KI=ze({type:"text-revealing",add:Jw,update:t1,delete:e1,parse:r1});var ZI={linear:i=>i},QI=(i,t,e,r)=>i+(t-i)*ZI[r](e),JI=(i,t,e)=>{typeof t=="string"&&(t=Hm[t]);let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r},tF=(i,t,e)=>{typeof t=="string"&&(t=Hm[t]);let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i},eF=i=>{let t=[],e=0,r;return i.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(r=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?r=r+s:r=s,t.push({time:e,value:r,easing:n}))}),t},rF=(i,t)=>{if(i.length===0)return 0;if(t<=i[0].time)return i[0].value;if(t>=i[i.length-1].time)return i[i.length-1].value;for(let e=0;e<i.length-1;e++){let{time:r,value:s,easing:o}=i[e],{time:n,value:a}=i[e+1];if(t>=r&&t<=n){let h=(t-r)/(n-r);return QI(s,a,h,o)}}return i[i.length-1].value},iF=i=>Math.max.apply(null,i),i1=async({app:i,element:t,animation:e,signal:r})=>new Promise((s,o)=>{if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}let{properties:n}=e,a=Object.entries(n).map(([m,g])=>{if(!Mw[m])throw new Error(`${m} is not a supported property for transition.`);return{...g,property:m}}),h=a.map(m=>m.keyframes.reduce((g,b)=>g+b.duration||0,0)),l=iF(h),c={};a.forEach(m=>{c[m.property]=JI(t,m.property)});let u=a.map(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue}]:g=[{value:c[m.property]}],g=g.concat(m.keyframes);let b=eF(g);return{property:m.property,timeline:b}}),d=0,f=m=>{u.forEach(({property:g,timeline:b})=>{let _=rF(b,m);t&&!t.destroyed&&tF(t,g,_)})};r&&r.addEventListener("abort",()=>{i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"))});let p=m=>{if(d+=m.deltaMS,d>=l){i.ticker.remove(p),s();return}f(d)};if(r?.aborted){i.ticker.remove(p),o(new DOMException("Operation aborted","AbortError"));return}i.ticker.add(p)});var sF=Dm({type:"tween",animate:i1});var s1=({app:i,element:t,signal:e})=>{if(e?.aborted)return;let r={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||i.audioStage.add(r)},t.delay):i.audioStage.add(r)};var o1=({app:i,prevElement:t,nextElement:e,signal:r})=>{if(!r?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=i.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var n1=({app:i,element:t,signal:e})=>{e?.aborted||i.audioStage.remove(t.id)};var oF=Nm({type:"sound",add:s1,update:o1,delete:n1});var a1=(i=[],t=[])=>{let e=new Set,r=new Map,s=new Map,o=[],n=[],a=[];for(let h of i)e.add(h.id),r.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=r.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vm=async({app:i,prevAudioTree:t,nextAudioTree:e,audioPlugins:r,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=a1(t,e),h=[];for(let l of n){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:i,element:l,signal:s}))}for(let l of o){let c=r.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:i,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=r.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:i,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var $e=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))($e||{}),Wm=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Wm||{}),iu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(iu||{}),Z=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Z||{}),Ro=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ro||{}),G=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(G||{}),ei=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(ei||{}),rt=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(rt||{}),D=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(D||{}),ar=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(ar||{}),ih=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(ih||{}),yr=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(yr||{}),Xe=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(Xe||{}),Ci=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ci||{}),su=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(su||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),Jt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(Jt||{});var Ct=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(Ct||{}),De=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(De||{});var zm={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var Y={ADAPTER:zm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Gd();var nF=fi.default??fi,br=nF(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var hs=Gi(l1(),1),Z2=Gi(Vl(),1);var Eg=Gi(AP(),1);var wP={};function ht(i,t,e=3){if(wP[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1145
1145
  Deprecated since v${i}`):(r=r.split(`
1146
1146
  `).splice(e).join(`
1147
1147
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
1148
1148
  Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
1149
- Deprecated since v${i}`),console.warn(r))),wP[t]=!0}var wg;function Cg(){return typeof wg>"u"&&(wg=function(){let i={stencil:!0,failIfMajorPerformanceCaveat:Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Y.ADAPTER.getWebGLRenderingContext())return!1;let t=Y.ADAPTER.createCanvas(),e=t.getContext("webgl",i)||t.getContext("experimental-webgl",i),r=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,r}catch{return!1}}()),wg}nd();ad();Zh([Qh]);var No=class bu{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof bu)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=bu.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,r,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=bu.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ne(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}};No.shared=new No,No.temp=new No,No.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var vr=No;function j2(){let i=[],t=[];for(let r=0;r<32;r++)i[r]=r,t[r]=r;i[Z.NORMAL_NPM]=Z.NORMAL,i[Z.ADD_NPM]=Z.ADD,i[Z.SCREEN_NPM]=Z.SCREEN,t[Z.NORMAL]=Z.NORMAL_NPM,t[Z.ADD]=Z.ADD_NPM,t[Z.SCREEN]=Z.SCREEN_NPM;let e=[];return e.push(t),e.push(i),e}var Pg=j2();function Ho(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function as(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function vu(i){return!(i&i-1)&&!!i}function Tu(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Rg(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var Y2=0;function ii(){return++Y2}var CP=class{constructor(i,t,e,r){this.left=i,this.top=t,this.right=e,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};CP.EMPTY=new CP(0,0,0,0);var Su={},je=Object.create(null),Lr=Object.create(null);function Mg(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Eu(i,t=1){let e=Y.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}var V=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(V||{}),Bg=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},RP=(i,t)=>Bg(i).priority??t,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Bg).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Bg).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>RP(o,e)-RP(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})}};var xh=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var J2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1150
- `);function tU(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
1151
- else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Au(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=J2.replace(/%forloop%/gi,tU(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Ig=0,Fg=1,Gg=2,Ug=3,kg=4,Og=5,Dr=class i{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ig)}set blend(t){!!(this.data&1<<Ig)!==t&&(this.data^=1<<Ig)}get offsets(){return!!(this.data&1<<Fg)}set offsets(t){!!(this.data&1<<Fg)!==t&&(this.data^=1<<Fg)}get culling(){return!!(this.data&1<<Gg)}set culling(t){!!(this.data&1<<Gg)!==t&&(this.data^=1<<Gg)}get depthTest(){return!!(this.data&1<<Ug)}set depthTest(t){!!(this.data&1<<Ug)!==t&&(this.data^=1<<Ug)}get depthMask(){return!!(this.data&1<<Og)}set depthMask(t){!!(this.data&1<<Og)!==t&&(this.data^=1<<Og)}get clockwiseFrontFace(){return!!(this.data&1<<kg)}set clockwiseFrontFace(t){!!(this.data&1<<kg)!==t&&(this.data^=1<<kg)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};Dr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var _h=[];function Vo(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=_h.length-1;r>=0;--r){let s=_h[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(jt.prototype,{dispatch:{value:jt.prototype.emit},run:{value:jt.prototype.emit}});var Ye=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new jt("setRealSize"),this.onUpdate=new jt("update"),this.onError=new jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var ls=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var eU={scaleMode:ar.NEAREST,alphaMode:Xe.NPM},Lg=class Wo extends hs.default{constructor(t=null,e=null){super(),e=Object.assign({},Wo.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Ye)&&(t=Vo(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=ii(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=vu(this.realWidth)&&vu(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Lr[this.cacheId],delete je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Wo.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=Lr[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Wo(t,e),n.cacheId=o,Wo.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new ls(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=G.RGBA,a=rt.FLOAT):t instanceof Int32Array?(n=G.RGBA_INTEGER,a=rt.INT):t instanceof Uint32Array?(n=G.RGBA_INTEGER,a=rt.UNSIGNED_INT):t instanceof Int16Array?(n=G.RGBA_INTEGER,a=rt.SHORT):t instanceof Uint16Array?(n=G.RGBA_INTEGER,a=rt.UNSIGNED_SHORT):t instanceof Int8Array?(n=G.RGBA,a=rt.BYTE):(n=G.RGBA,a=rt.UNSIGNED_BYTE),o.internal=!0,new Wo(o,Object.assign({},eU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Lr[e]&&Lr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Lr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Lr[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Lr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Lr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Lg.defaultOptions={mipmap:yr.POW2,anisotropicLevel:0,scaleMode:ar.LINEAR,wrapMode:ih.CLAMP,alphaMode:Xe.UNPACK,target:ei.TEXTURE_2D,format:G.RGBA,type:rt.UNSIGNED_BYTE},Lg._globalBatch=0;var ut=Lg;var yh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ro.TRIANGLES,this.start=0,this.size=0,this.data=null}};var rU=0,te=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=rU++,this.disposeRunner=new jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?De.ELEMENT_ARRAY_BUFFER:De.ARRAY_BUFFER}get index(){return this.type===De.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var zo=class i{constructor(t,e=0,r=!1,s=rt.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var iU={Float32Array,Uint32Array,Int32Array,Uint8Array};function MP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=Ho(c);s[u]||(s[u]=new iU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var BP={5126:4,5123:2,5121:1},sU=0,oU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},si=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=sU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof te||(e instanceof Array&&(e=new Float32Array(e)),e=new te(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new zo(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof te||(t instanceof Array&&(t=new Uint16Array(t)),t=new te(t)),t.type=De.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],r=new te,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*BP[o.type]/4),o.buffer=0}for(r.data=MP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new te(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new zo(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new oU[Ho(n.buffers[a].data)](s[a]),e.buffers[a]=new te(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(h+=d.size*BP[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var bh=class extends si{constructor(t=!1){super(),this._buffer=new te(null,t,!1),this._indexBuffer=new te(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,rt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,rt.FLOAT).addAttribute("aColor",this._buffer,4,!0,rt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,rt.FLOAT).addIndex(this._indexBuffer)}};var Dg=Math.PI*2,nU=180/Math.PI,aU=Math.PI/180,lr=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(lr||{});var ee=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};ee.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var wu=[new ee,new ee,new ee,new ee],pt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=lr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=wu[0].set(t.left,t.top),h=wu[1].set(t.left,t.bottom),l=wu[2].set(t.right,t.top),c=wu[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),v=u*(l.x-a.x),T=_*r+v*o,w=_*s+v*o,S=_*r+v*n,A=_*s+v*n;return!(Math.max(T,w,S,A)<=_*a.x+v*a.y||Math.min(T,w,S,A)>=_*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Cu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=lr.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Cu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Pu=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=lr.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new pt(this.x-this.width,this.y-this.height,this.width,this.height)}};Pu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Ru=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=lr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Ru.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Mu=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=lr.RREC}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Mu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Bt=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new ee;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ee;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Dg-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};Bt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var cs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],us=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ds=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ng=[],IP=[],Bu=Math.sign;function hU(){for(let i=0;i<16;i++){let t=[];Ng.push(t);for(let e=0;e<16;e++){let r=Bu(cs[i]*cs[e]+ds[i]*us[e]),s=Bu(us[i]*cs[e]+fs[i]*us[e]),o=Bu(cs[i]*ds[e]+ds[i]*fs[e]),n=Bu(us[i]*ds[e]+fs[i]*fs[e]);for(let a=0;a<16;a++)if(cs[a]===r&&us[a]===s&&ds[a]===o&&fs[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new Bt;t.set(cs[i],us[i],ds[i],fs[i],0,0),IP.push(t)}}hU();var Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>cs[i],uY:i=>us[i],vX:i=>ds[i],vY:i=>fs[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Ng[i][t],sub:(i,t)=>Ng[i][Gt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:t>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=IP[Gt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var oi=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};oi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Hg=class{constructor(){this.worldTransform=new Bt,this.localTransform=new Bt,this.position=new oi(this.onChange,this,0,0),this.scale=new oi(this.onChange,this,1,1),this.pivot=new oi(this.onChange,this,0,0),this.skew=new oi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Hg.IDENTITY=new Hg;var Iu=Hg;Iu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var FP=`varying vec2 vTextureCoord;
1149
+ Deprecated since v${i}`),console.warn(r))),wP[t]=!0}var Ag;function wg(){return typeof Ag>"u"&&(Ag=function(){let i={stencil:!0,failIfMajorPerformanceCaveat:Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Y.ADAPTER.getWebGLRenderingContext())return!1;let t=Y.ADAPTER.createCanvas(),e=t.getContext("webgl",i)||t.getContext("experimental-webgl",i),r=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,r}catch{return!1}}()),Ag}nd();ad();Zh([Qh]);var No=class bu{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof bu)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=bu.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,r,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=bu.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=Ne(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}};No.shared=new No,No.temp=new No,No.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var vr=No;function X2(){let i=[],t=[];for(let r=0;r<32;r++)i[r]=r,t[r]=r;i[Z.NORMAL_NPM]=Z.NORMAL,i[Z.ADD_NPM]=Z.ADD,i[Z.SCREEN_NPM]=Z.SCREEN,t[Z.NORMAL]=Z.NORMAL_NPM,t[Z.ADD]=Z.ADD_NPM,t[Z.SCREEN]=Z.SCREEN_NPM;let e=[];return e.push(t),e.push(i),e}var Cg=X2();function Ho(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function as(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function vu(i){return!(i&i-1)&&!!i}function Tu(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Pg(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var j2=0;function ii(){return++j2}var CP=class{constructor(i,t,e,r){this.left=i,this.top=t,this.right=e,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};CP.EMPTY=new CP(0,0,0,0);var Su={},je=Object.create(null),Lr=Object.create(null);function Rg(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Eu(i,t=1){let e=Y.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}var V=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(V||{}),Mg=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},RP=(i,t)=>Mg(i).priority??t,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Mg).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Mg).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>RP(o,e)-RP(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})}};var xh=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var Q2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1150
+ `);function J2(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
1151
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Au(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=Q2.replace(/%forloop%/gi,J2(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Bg=0,Ig=1,Fg=2,Gg=3,Ug=4,kg=5,Dr=class i{constructor(){this.data=0,this.blendMode=Z.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Bg)}set blend(t){!!(this.data&1<<Bg)!==t&&(this.data^=1<<Bg)}get offsets(){return!!(this.data&1<<Ig)}set offsets(t){!!(this.data&1<<Ig)!==t&&(this.data^=1<<Ig)}get culling(){return!!(this.data&1<<Fg)}set culling(t){!!(this.data&1<<Fg)!==t&&(this.data^=1<<Fg)}get depthTest(){return!!(this.data&1<<Gg)}set depthTest(t){!!(this.data&1<<Gg)!==t&&(this.data^=1<<Gg)}get depthMask(){return!!(this.data&1<<kg)}set depthMask(t){!!(this.data&1<<kg)!==t&&(this.data^=1<<kg)}get clockwiseFrontFace(){return!!(this.data&1<<Ug)}set clockwiseFrontFace(t){!!(this.data&1<<Ug)!==t&&(this.data^=1<<Ug)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==Z.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};Dr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var _h=[];function Vo(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=_h.length-1;r>=0;--r){let s=_h[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var jt=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(jt.prototype,{dispatch:{value:jt.prototype.emit},run:{value:jt.prototype.emit}});var Ye=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new jt("setRealSize"),this.onUpdate=new jt("update"),this.onError=new jt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var ls=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var tU={scaleMode:ar.NEAREST,alphaMode:Xe.NPM},Og=class Wo extends hs.default{constructor(t=null,e=null){super(),e=Object.assign({},Wo.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Ye)&&(t=Vo(t,p),t.internal=!0),this.resolution=f||Y.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=ii(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=vu(this.realWidth)&&vu(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Lr[this.cacheId],delete je[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Wo.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=Lr[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Wo(t,e),n.cacheId=o,Wo.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new ls(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=G.RGBA,a=rt.FLOAT):t instanceof Int32Array?(n=G.RGBA_INTEGER,a=rt.INT):t instanceof Uint32Array?(n=G.RGBA_INTEGER,a=rt.UNSIGNED_INT):t instanceof Int16Array?(n=G.RGBA_INTEGER,a=rt.SHORT):t instanceof Uint16Array?(n=G.RGBA_INTEGER,a=rt.UNSIGNED_SHORT):t instanceof Int8Array?(n=G.RGBA,a=rt.BYTE):(n=G.RGBA,a=rt.UNSIGNED_BYTE),o.internal=!0,new Wo(o,Object.assign({},tU,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Lr[e]&&Lr[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Lr[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Lr[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Lr[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Lr[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Og.defaultOptions={mipmap:yr.POW2,anisotropicLevel:0,scaleMode:ar.LINEAR,wrapMode:ih.CLAMP,alphaMode:Xe.UNPACK,target:ei.TEXTURE_2D,format:G.RGBA,type:rt.UNSIGNED_BYTE},Og._globalBatch=0;var ut=Og;var yh=class{constructor(){this.texArray=null,this.blend=0,this.type=Ro.TRIANGLES,this.start=0,this.size=0,this.data=null}};var eU=0,te=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=eU++,this.disposeRunner=new jt("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?De.ELEMENT_ARRAY_BUFFER:De.ARRAY_BUFFER}get index(){return this.type===De.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var zo=class i{constructor(t,e=0,r=!1,s=rt.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var rU={Float32Array,Uint32Array,Int32Array,Uint8Array};function MP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=Ho(c);s[u]||(s[u]=new rU[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var BP={5126:4,5123:2,5121:1},iU=0,sU={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},si=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=iU++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new jt("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof te||(e instanceof Array&&(e=new Float32Array(e)),e=new te(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new zo(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof te||(t instanceof Array&&(t=new Uint16Array(t)),t=new te(t)),t.type=De.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],r=new te,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*BP[o.type]/4),o.buffer=0}for(r.data=MP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new te(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new zo(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new sU[Ho(n.buffers[a].data)](s[a]),e.buffers[a]=new te(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=De.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(h+=d.size*BP[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var bh=class extends si{constructor(t=!1){super(),this._buffer=new te(null,t,!1),this._indexBuffer=new te(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,rt.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,rt.FLOAT).addAttribute("aColor",this._buffer,4,!0,rt.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,rt.FLOAT).addIndex(this._indexBuffer)}};var Lg=Math.PI*2,oU=180/Math.PI,nU=Math.PI/180,lr=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(lr||{});var ee=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};ee.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var wu=[new ee,new ee,new ee,new ee],pt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=lr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=wu[0].set(t.left,t.top),h=wu[1].set(t.left,t.bottom),l=wu[2].set(t.right,t.top),c=wu[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,m=d*s+f*o,g=d*r+f*n,b=d*s+f*n;if(Math.max(p,m,g,b)<=d*a.x+f*a.y||Math.min(p,m,g,b)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),v=u*(l.x-a.x),T=_*r+v*o,w=_*s+v*o,S=_*r+v*n,A=_*s+v*n;return!(Math.max(T,w,S,A)<=_*a.x+v*a.y||Math.min(T,w,S,A)>=_*c.x+v*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Cu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=lr.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};Cu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Pu=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=lr.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new pt(this.x-this.width,this.y-this.height,this.width,this.height)}};Pu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Ru=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=lr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Ru.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Mu=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=lr.RREC}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Mu.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Bt=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new ee;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new ee;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Lg-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};Bt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var cs=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],us=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ds=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fs=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Dg=[],IP=[],Bu=Math.sign;function aU(){for(let i=0;i<16;i++){let t=[];Dg.push(t);for(let e=0;e<16;e++){let r=Bu(cs[i]*cs[e]+ds[i]*us[e]),s=Bu(us[i]*cs[e]+fs[i]*us[e]),o=Bu(cs[i]*ds[e]+ds[i]*fs[e]),n=Bu(us[i]*ds[e]+fs[i]*fs[e]);for(let a=0;a<16;a++)if(cs[a]===r&&us[a]===s&&ds[a]===o&&fs[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new Bt;t.set(cs[i],us[i],ds[i],fs[i],0,0),IP.push(t)}}aU();var Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>cs[i],uY:i=>us[i],vX:i=>ds[i],vY:i=>fs[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Dg[i][t],sub:(i,t)=>Dg[i][Gt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Gt.S:Gt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:t>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=IP[Gt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var oi=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};oi.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Ng=class{constructor(){this.worldTransform=new Bt,this.localTransform=new Bt,this.position=new oi(this.onChange,this,0,0),this.scale=new oi(this.onChange,this,1,1),this.pivot=new oi(this.onChange,this,0,0),this.skew=new oi(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Ng.IDENTITY=new Ng;var Iu=Ng;Iu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var FP=`varying vec2 vTextureCoord;
1152
1152
 
1153
1153
  uniform sampler2D uSampler;
1154
1154
 
@@ -1165,7 +1165,7 @@ void main(void){
1165
1165
  gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1166
1166
  vTextureCoord = aTextureCoord;
1167
1167
  }
1168
- `;function Fu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}function Vg(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function vh(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Vg(2*t);case"bvec3":return Vg(3*t);case"bvec4":return Vg(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Nr=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
1168
+ `;function Fu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}function Hg(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function vh(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Hg(2*t);case"bvec3":return Hg(3*t);case"bvec4":return Hg(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Nr=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
1169
1169
  if(uv["${i}"] !== ud["${i}"].value)
1170
1170
  {
1171
1171
  ud["${i}"].value = uv["${i}"]
@@ -1285,7 +1285,7 @@ void main(void){
1285
1285
  cv[3] = v[3];
1286
1286
 
1287
1287
  gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
1288
- }`}];var lU={float:`
1288
+ }`}];var hU={float:`
1289
1289
  if (cv !== v)
1290
1290
  {
1291
1291
  cu.value = v;
@@ -1421,7 +1421,7 @@ void main(void){
1421
1421
  cu.value = v;
1422
1422
 
1423
1423
  gl.uniform1i(location, v);
1424
- }`},cU={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Wg(i,t){let e=[`
1424
+ }`},lU={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Vg(i,t){let e=[`
1425
1425
  var v = null;
1426
1426
  var cv = null;
1427
1427
  var cu = null;
@@ -1431,18 +1431,18 @@ void main(void){
1431
1431
  renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
1432
1432
  `):e.push(`
1433
1433
  renderer.shader.syncUniformGroup(uv.${r}, syncData);
1434
- `));continue}let o=i.uniforms[r],n=!1;for(let a=0;a<Nr.length;a++)if(Nr[a].test(s,o)){e.push(Nr[a].code(r,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?lU:cU)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1434
+ `));continue}let o=i.uniforms[r],n=!1;for(let a=0;a<Nr.length;a++)if(Nr[a].test(s,o)){e.push(Nr[a].code(r,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?hU:lU)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1435
1435
  cu = ud["${r}"];
1436
1436
  cv = cu.value;
1437
1437
  v = uv["${r}"];
1438
1438
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1439
- `))}var UP={},Gu=UP;function Uu(){if(Gu===UP||Gu?.isContextLost()){let i=Y.ADAPTER.createCanvas(),t;Y.PREFER_ENV>=$e.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Gu=t}return Gu}var ku;function zg(){if(!ku){ku=Pe.MEDIUM;let i=Uu();if(i&&i.getShaderPrecisionFormat){let t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(ku=t.precision?Pe.HIGH:Pe.MEDIUM)}}return ku}function kP(i,t){let e=i.getShaderSource(t).split(`
1439
+ `))}var UP={},Gu=UP;function Uu(){if(Gu===UP||Gu?.isContextLost()){let i=Y.ADAPTER.createCanvas(),t;Y.PREFER_ENV>=$e.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Gu=t}return Gu}var ku;function Wg(){if(!ku){ku=Pe.MEDIUM;let i=Uu();if(i&&i.getShaderPrecisionFormat){let t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(ku=t.precision?Pe.HIGH:Pe.MEDIUM)}}return ku}function kP(i,t){let e=i.getShaderSource(t).split(`
1440
1440
  `).map((l,c)=>`${c}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
1441
1441
  `),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=e.join(`
1442
- `);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function $g(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||kP(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||kP(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var uU={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 Th(i){return uU[i]}var Ou=null,OP={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Sh(i,t){if(!Ou){let e=Object.keys(OP);Ou={};for(let r=0;r<e.length;++r){let s=e[r];Ou[i[s]]=OP[s]}}return Ou[t]}function Lu(i,t,e){if(i.substring(0,9)!=="precision"){let r=t;return t===Pe.HIGH&&e!==Pe.HIGH&&(r=Pe.MEDIUM),`precision ${r} float;
1443
- ${i}`}else if(e!==Pe.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Eh;function Du(){if(typeof Eh=="boolean")return Eh;try{Eh=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Eh=!1}return Eh}var dU=0,Nu={},Xg=class $o{constructor(t,e,r="pixi-shader",s={}){this.extra={},this.id=dU++,this.vertexSrc=t||$o.defaultVertexSrc,this.fragmentSrc=e||$o.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(r=r.replace(/\s+/g,"-"),Nu[r]?(Nu[r]++,r+=`-${Nu[r]}`):Nu[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}
1442
+ `);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function zg(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||kP(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||kP(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var cU={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 Th(i){return cU[i]}var Ou=null,OP={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Sh(i,t){if(!Ou){let e=Object.keys(OP);Ou={};for(let r=0;r<e.length;++r){let s=e[r];Ou[i[s]]=OP[s]}}return Ou[t]}function Lu(i,t,e){if(i.substring(0,9)!=="precision"){let r=t;return t===Pe.HIGH&&e!==Pe.HIGH&&(r=Pe.MEDIUM),`precision ${r} float;
1443
+ ${i}`}else if(e!==Pe.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Eh;function Du(){if(typeof Eh=="boolean")return Eh;try{Eh=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Eh=!1}return Eh}var uU=0,Nu={},$g=class $o{constructor(t,e,r="pixi-shader",s={}){this.extra={},this.id=uU++,this.vertexSrc=t||$o.defaultVertexSrc,this.fragmentSrc=e||$o.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(r=r.replace(/\s+/g,"-"),Nu[r]?(Nu[r]++,r+=`-${Nu[r]}`):Nu[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}
1444
1444
  ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}
1445
- ${this.fragmentSrc}`,this.vertexSrc=Lu(this.vertexSrc,$o.defaultVertexPrecision,Pe.HIGH),this.fragmentSrc=Lu(this.fragmentSrc,$o.defaultFragmentPrecision,zg())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return GP}static get defaultFragmentSrc(){return FP}static from(t,e,r){let s=t+e,o=Su[s];return o||(Su[s]=o=new $o(t,e,r)),o}};Xg.defaultVertexPrecision=Pe.HIGH,Xg.defaultFragmentPrecision=br.apple.device?Pe.HIGH:Pe.MEDIUM;var cr=Xg;var fU=0,qe=class i{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=fU++,this.static=!!e,this.ubo=!!r,t instanceof te?(this.buffer=t,this.buffer.type=De.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new te(new Float32Array(1)),this.buffer.type=De.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,r){if(!this.ubo)this.uniforms[t]=new i(e,r);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,r){return new i(t,e,r)}static uboFrom(t,e){return new i(t,e??!0,!0)}};var ps=class i{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof qe?this.uniformGroup=e:this.uniformGroup=new qe(e):this.uniformGroup=new qe({}),this.disposeRunner=new jt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let r in e.uniforms){let s=e.uniforms[r];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,r){let s=cr.from(t,e);return new i(s,r)}};var Ah=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let r=new Int32Array(t);for(let o=0;o<t;o++)r[o]=o;this.defaultGroupCache[t]=qe.from({uSamplers:r},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new cr(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Bt,default:this.defaultGroupCache[t]};return new ps(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1445
+ ${this.fragmentSrc}`,this.vertexSrc=Lu(this.vertexSrc,$o.defaultVertexPrecision,Pe.HIGH),this.fragmentSrc=Lu(this.fragmentSrc,$o.defaultFragmentPrecision,Wg())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return GP}static get defaultFragmentSrc(){return FP}static from(t,e,r){let s=t+e,o=Su[s];return o||(Su[s]=o=new $o(t,e,r)),o}};$g.defaultVertexPrecision=Pe.HIGH,$g.defaultFragmentPrecision=br.apple.device?Pe.HIGH:Pe.MEDIUM;var cr=$g;var dU=0,qe=class i{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=dU++,this.static=!!e,this.ubo=!!r,t instanceof te?(this.buffer=t,this.buffer.type=De.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new te(new Float32Array(1)),this.buffer.type=De.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,r){if(!this.ubo)this.uniforms[t]=new i(e,r);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,r){return new i(t,e,r)}static uboFrom(t,e){return new i(t,e??!0,!0)}};var ps=class i{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof qe?this.uniformGroup=e:this.uniformGroup=new qe(e):this.uniformGroup=new qe({}),this.disposeRunner=new jt("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let r in e.uniforms){let s=e.uniforms[r];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,r){let s=cr.from(t,e);return new i(s,r)}};var Ah=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let r=new Int32Array(t);for(let o=0;o<t;o++)r[o]=o;this.defaultGroupCache[t]=qe.from({uSamplers:r},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new cr(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Bt,default:this.defaultGroupCache[t]};return new ps(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1446
1446
  `,e+=`
1447
1447
  `;for(let r=0;r<t;r++)r>0&&(e+=`
1448
1448
  else `),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+=`
@@ -1481,7 +1481,7 @@ void main(void){
1481
1481
  vTextureId = aTextureId;
1482
1482
  vColor = aColor * tint;
1483
1483
  }
1484
- `;var Ch=class Tr extends ms{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=bh,this.vertexSize=6,this.state=Dr.for2d(),this.size=Tr.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??DP(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??LP(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ht("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return HP}static get defaultFragmentTemplate(){return NP}setShaderGenerator({vertex:t=Tr.defaultVertexSrc,fragment:e=Tr.defaultFragmentTemplate}={}){this.shaderGenerator=new Ah(t,e)}contextChange(){let t=this.renderer.gl;Y.PREFER_ENV===$e.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Tr.defaultMaxTextures),this.maxTextures=Au(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:e}=Tr,r=this.size/4,s=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new yh);for(;e.length<s;)e.push(new wh);for(let o=0;o<this.maxTextures;o++)this._tempBoundTextures[o]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,r=Tr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++ut._globalBatch,h=0,l=r[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u<this._bufferSize;++u){let d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,u),c=u,l=r[++h],++a),d._batchEnabled=a,d.touched=n,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<o.length;u++)o[u]=null;ut._globalBatch=a}buildDrawCalls(t,e,r){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,h=Tr._drawCallPool,l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<r;++f){let p=s[f],m=p._texture.baseTexture,g=Pg[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,o,n,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=g}e<r&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:r}=this;Tr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:r}=this.renderer,s=Tr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:h,size:l,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,r.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Tr.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=as(Math.ceil(t/8)),r=Tu(e),s=e*8;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new xh(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=as(Math.ceil(t/12)),r=Tu(e),s=e*12;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._iBuffers[r];return o||(this._iBuffers[r]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,r,s,o){let{uint32View:n,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=vr.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=l[m],a[s++]=l[m+1],n[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)r[o++]=h+c[m]}};Ch.defaultBatchSize=4096,Ch.extension={name:"batch",type:V.RendererPlugin},Ch._drawCallPool=[],Ch._textureArrayPool=[];var ni=Ch;q.add(ni);var VP=`varying vec2 vTextureCoord;
1484
+ `;var Ch=class Tr extends ms{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=bh,this.vertexSize=6,this.state=Dr.for2d(),this.size=Tr.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??DP(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??LP(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ht("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return HP}static get defaultFragmentTemplate(){return NP}setShaderGenerator({vertex:t=Tr.defaultVertexSrc,fragment:e=Tr.defaultFragmentTemplate}={}){this.shaderGenerator=new Ah(t,e)}contextChange(){let t=this.renderer.gl;Y.PREFER_ENV===$e.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),Tr.defaultMaxTextures),this.maxTextures=Au(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:e}=Tr,r=this.size/4,s=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new yh);for(;e.length<s;)e.push(new wh);for(let o=0;o<this.maxTextures;o++)this._tempBoundTextures[o]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,r=Tr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++ut._globalBatch,h=0,l=r[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u<this._bufferSize;++u){let d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,u),c=u,l=r[++h],++a),d._batchEnabled=a,d.touched=n,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<o.length;u++)o[u]=null;ut._globalBatch=a}buildDrawCalls(t,e,r){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,h=Tr._drawCallPool,l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<r;++f){let p=s[f],m=p._texture.baseTexture,g=Cg[m.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==g&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,o,n,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=g}e<r&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:r}=this;Tr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:r}=this.renderer,s=Tr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:h,size:l,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,r.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),Tr.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=as(Math.ceil(t/8)),r=Tu(e),s=e*8;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new xh(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=as(Math.ceil(t/12)),r=Tu(e),s=e*12;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._iBuffers[r];return o||(this._iBuffers[r]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,r,s,o){let{uint32View:n,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=vr.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let m=0;m<u.length;m+=2)a[s++]=u[m],a[s++]=u[m+1],a[s++]=l[m],a[s++]=l[m+1],n[s++]=p,a[s++]=d;for(let m=0;m<c.length;m++)r[o++]=h+c[m]}};Ch.defaultBatchSize=4096,Ch.extension={name:"batch",type:V.RendererPlugin},Ch._drawCallPool=[],Ch._textureArrayPool=[];var ni=Ch;q.add(ni);var VP=`varying vec2 vTextureCoord;
1485
1485
 
1486
1486
  uniform sampler2D uSampler;
1487
1487
 
@@ -1514,7 +1514,7 @@ void main(void)
1514
1514
  gl_Position = filterVertexPosition();
1515
1515
  vTextureCoord = filterTextureCoord();
1516
1516
  }
1517
- `;var jg=class Ph extends ps{constructor(t,e,r){let s=cr.from(t||Ph.defaultVertexSrc,e||Ph.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Ph.defaultResolution,this.multisample=Ph.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Dr}apply(t,e,r,s,o){t.applyFilter(this,e,r,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return WP}static get defaultFragmentSrc(){return VP}};jg.defaultResolution=1,jg.defaultMultisample=Ct.NONE;var Hr=jg;var ai=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new vr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};ai.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ai.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"};q.add(ai);var Xo=class{constructor(t){this.renderer=t,this.emptyRenderer=new ms(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Xo.extension={type:V.RendererSystem,name:"batch"};q.add(Xo);var zP=0,hi=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(Y.PREFER_ENV>=$e.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};hi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},hi.extension={type:V.RendererSystem,name:"context"};q.add(hi);var Mi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new jt("disposeFramebuffer"),this.multisample=Ct.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:ar.NEAREST,resolution:1,mipmap:yr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:ar.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:yr.OFF,format:G.DEPTH_COMPONENT,type:rt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var gs=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ct.NONE),super(null,t),this.mipmap=yr.OFF,this.valid=!0,this._clear=new vr([0,0,0,0]),this.framebuffer=new Mi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var ne=class extends Ye{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Mg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var xs=class extends ne{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;ne.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Y.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,r)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{r(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var _s=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Gt.add(r,Gt.NW),this.x0=h+n*Gt.uX(r),this.y0=l+a*Gt.uY(r),r=Gt.add(r,2),this.x1=h+n*Gt.uX(r),this.y1=l+a*Gt.uY(r),r=Gt.add(r,2),this.x2=h+n*Gt.uX(r),this.y2=l+a*Gt.uY(r),r=Gt.add(r,2),this.x3=h+n*Gt.uX(r),this.y3=l+a*Gt.uY(r)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};_s.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var $P=new _s;function Hu(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Rh=class i extends hs.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=$P,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ee(n.x,n.y):new ee(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&je[e.url]&&i.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,i.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===$P&&(this._uvs=new _s),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ii()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=je[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=Eu(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:Eu(e)},s)),{resource:n}=o;n instanceof xs&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),je[e]&&je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=je[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete je[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)je[t.textureCacheIds[e]]===t&&delete je[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return i._EMPTY||(i._EMPTY=new i(new ut),Hu(i._EMPTY),Hu(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._WHITE){let t=Y.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),i._WHITE=new i(ut.from(t)),Hu(i._WHITE),Hu(i._WHITE.baseTexture)}return i._WHITE}};var ys=class i extends Rh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,r=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new i(new gs(t))}};var jo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=Ct.NONE){let s=new gs(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new ys(s)}getOptimalTexture(t,e,r=1,s=Ct.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=as(t),e=as(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};jo.SCREEN_KEY=-1;var Mh=class extends si{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Bh=class extends si{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new te(this.vertices),this.uvBuffer=new te(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Ih=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ct.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Vu=[new ee,new ee,new ee,new ee],Yg=new Bt,Yo=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new jo,this.statePool=[],this.quad=new Mh,this.quadUv=new Bh,this.tempRect=new pt,this.activeState={},this.globalUniforms=new qe({outputFrame:new pt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Ih,n=r.renderTexture,a,h;if(n.current){let g=n.current;a=g.resolution,h=g.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){let b=e[g];l=Math.min(l,b.resolution||a),c=Math.min(c,b.multisample??h),u=this.useMaxPadding?Math.max(u,b.padding):u+b.padding,d=d&&b.autoFit,f=f||(b.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB(Yg.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Ci.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Ci.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Ci.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ci.CLEAR){let{renderTexture:r,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ci.CLEAR||e===Ci.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ro.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ro.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.y),a=e.worldTransform.copyTo(Bt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,s=Ct.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let r=Vu[0],s=Vu[1],o=Vu[2],n=Vu[3];r.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?Yg.copyFrom(o):Yg.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Yo.extension={type:V.RendererSystem,name:"filter"};q.add(Yo);var Fh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ct.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var pU=new pt,qo=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Mi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,s,o=iu.COLOR|iu.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Fh(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,r=Ct.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=Ct.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Mi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=pU,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}};qo.extension={type:V.RendererSystem,name:"framebuffer"};q.add(qo);var qg={5126:4,5123:2,5121:1},Ko=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let r=this.renderer.context.extensions.vertexArrayObject;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:r}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*qg[d[m].type];for(let m in d){let g=d[m],b=g.size;g.stride===void 0&&(f[g.buffer]===b*qg[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=b*qg[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let g=u[m];n.bind(g),r&&g._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(De.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Ko.extension={type:V.RendererSystem,name:"geometry"};q.add(Ko);var XP=new Bt,Gh=class{constructor(t,e){this._texture=t,this.mapCoord=new Bt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&(XP.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(XP));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var jP=`varying vec2 vMaskCoord;
1517
+ `;var Xg=class Ph extends ps{constructor(t,e,r){let s=cr.from(t||Ph.defaultVertexSrc,e||Ph.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Ph.defaultResolution,this.multisample=Ph.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Dr}apply(t,e,r,s,o){t.applyFilter(this,e,r,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return WP}static get defaultFragmentSrc(){return VP}};Xg.defaultResolution=1,Xg.defaultMultisample=Ct.NONE;var Hr=Xg;var ai=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new vr(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};ai.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},ai.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"background"};q.add(ai);var Xo=class{constructor(t){this.renderer=t,this.emptyRenderer=new ms(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Xo.extension={type:V.RendererSystem,name:"batch"};q.add(Xo);var zP=0,hi=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=zP++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(Y.PREFER_ENV>=$e.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};hi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},hi.extension={type:V.RendererSystem,name:"context"};q.add(hi);var Mi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new jt("disposeFramebuffer"),this.multisample=Ct.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:ar.NEAREST,resolution:1,mipmap:yr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:ar.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:yr.OFF,format:G.DEPTH_COMPONENT,type:rt.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var gs=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=Ct.NONE),super(null,t),this.mipmap=yr.OFF,this.valid=!0,this._clear=new vr([0,0,0,0]),this.framebuffer=new Mi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var ne=class extends Ye{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=Rg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Xe.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var xs=class extends ne{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;ne.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??Y.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,r)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{r(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var _s=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Gt.add(r,Gt.NW),this.x0=h+n*Gt.uX(r),this.y0=l+a*Gt.uY(r),r=Gt.add(r,2),this.x1=h+n*Gt.uX(r),this.y1=l+a*Gt.uY(r),r=Gt.add(r,2),this.x2=h+n*Gt.uX(r),this.y2=l+a*Gt.uY(r),r=Gt.add(r,2),this.x3=h+n*Gt.uX(r),this.y3=l+a*Gt.uY(r)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};_s.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var $P=new _s;function Hu(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Rh=class i extends hs.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=$P,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new ee(n.x,n.y):new ee(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&je[e.url]&&i.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,i.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===$P&&(this._uvs=new _s),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=Y.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ii()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ii()}`}o=t._pixiId}let n=je[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=Eu(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:Eu(e)},s)),{resource:n}=o;n instanceof xs&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),je[e]&&je[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),je[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=je[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete je[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)je[t.textureCacheIds[e]]===t&&delete je[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return i._EMPTY||(i._EMPTY=new i(new ut),Hu(i._EMPTY),Hu(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._WHITE){let t=Y.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),i._WHITE=new i(ut.from(t)),Hu(i._WHITE),Hu(i._WHITE.baseTexture)}return i._WHITE}};var ys=class i extends Rh{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,r=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new i(new gs(t))}};var jo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=Ct.NONE){let s=new gs(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new ys(s)}getOptimalTexture(t,e,r=1,s=Ct.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=as(t),e=as(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};jo.SCREEN_KEY=-1;var Mh=class extends si{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var Bh=class extends si{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new te(this.vertices),this.uvBuffer=new te(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Ih=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=Ct.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var Vu=[new ee,new ee,new ee,new ee],jg=new Bt,Yo=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new jo,this.statePool=[],this.quad=new Mh,this.quadUv=new Bh,this.tempRect=new pt,this.activeState={},this.globalUniforms=new qe({outputFrame:new pt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Ih,n=r.renderTexture,a,h;if(n.current){let g=n.current;a=g.resolution,h=g.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let g=1;g<e.length;g++){let b=e[g];l=Math.min(l,b.resolution||a),c=Math.min(c,b.multisample??h),u=this.useMaxPadding?Math.max(u,b.padding):u+b.padding,d=d&&b.autoFit,f=f||(b.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB(jg.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=o.sourceFrame.width,m.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,m),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Ci.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Ci.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Ci.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ci.CLEAR){let{renderTexture:r,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ci.CLEAR||e===Ci.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ro.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ro.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.y),a=e.worldTransform.copyTo(Bt.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,s=Ct.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||Ct.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let r=Vu[0],s=Vu[1],o=Vu[2],n=Vu[3];r.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?jg.copyFrom(o):jg.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};Yo.extension={type:V.RendererSystem,name:"filter"};q.add(Yo);var Fh=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=Ct.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var fU=new pt,qo=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Mi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,s,o=iu.COLOR|iu.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Fh(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,r=Ct.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=Ct.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Mi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=fU,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}};qo.extension={type:V.RendererSystem,name:"framebuffer"};q.add(qo);var Yg={5126:4,5123:2,5121:1},Ko=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let r=this.renderer.context.extensions.vertexArrayObject;Y.PREFER_ENV===$e.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:r}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let m in u)f[m]=0,p[m]=0;for(let m in d)!d[m].size&&a.attributeData[m]?d[m].size=a.attributeData[m].size:d[m].size||console.warn(`PIXI Geometry attribute '${m}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[m].buffer]+=d[m].size*Yg[d[m].type];for(let m in d){let g=d[m],b=g.size;g.stride===void 0&&(f[g.buffer]===b*Yg[g.type]?g.stride=0:g.stride=f[g.buffer]),g.start===void 0&&(g.start=p[g.buffer],p[g.buffer]+=b*Yg[g.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let m=0;m<u.length;m++){let g=u[m];n.bind(g),r&&g._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(De.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Ko.extension={type:V.RendererSystem,name:"geometry"};q.add(Ko);var XP=new Bt,Gh=class{constructor(t,e){this._texture=t,this.mapCoord=new Bt,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&(XP.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(XP));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var jP=`varying vec2 vMaskCoord;
1518
1518
  varying vec2 vTextureCoord;
1519
1519
 
1520
1520
  uniform sampler2D uSampler;
@@ -1555,7 +1555,7 @@ void main(void)
1555
1555
  vTextureCoord = aTextureCoord;
1556
1556
  vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
1557
1557
  }
1558
- `;var Uh=class extends Hr{constructor(t,e,r){let s=null;typeof t!="string"&&e===void 0&&r===void 0&&(s=t,t=void 0,e=void 0,r=void 0),super(t||YP,e||jP,r),this.maskSprite=s,this.maskMatrix=new Bt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Gh(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,r,s))}};var kh=class{constructor(t=null){this.type=Jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Hr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Jt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var Zo=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let r=e;if(!r.isMaskData){let o=this.maskDataPool.pop()||new kh;o.pooled=!0,o.maskObject=e,r=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(s),r._colorMask=s?s._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==Jt.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case Jt.SCISSOR:this.renderer.scissor.push(r);break;case Jt.STENCIL:this.renderer.stencil.push(r);break;case Jt.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case Jt.COLOR:this.pushColorMask(r);break;default:break}r.type===Jt.SPRITE&&this.maskStack.push(r)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Jt.SCISSOR:this.renderer.scissor.pop(e);break;case Jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Jt.SPRITE:this.popSpriteMask(e);break;case Jt.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let r=this.maskStack[this.maskStack.length-1];r.type===Jt.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=Jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Jt.SCISSOR:t.type=Jt.STENCIL:t.type=Jt.COLOR}pushSpriteMask(t){let{maskObject:e}=t,r=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Uh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,s),r.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}popColorMask(t){let e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}};Zo.extension={type:V.RendererSystem,name:"mask"};q.add(Zo);var Qo=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==r&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var qP=new Bt,KP=[],ZP=class Wu extends Qo{constructor(t){super(t),this.glConst=Y.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:r}=t,{renderer:s}=this,o=s.renderTexture,n=r.getBounds(!0,KP.pop()??new pt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:r,c:s,d:o}=t;return(Math.abs(r)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Wu.isMatrixRotated(e.worldTransform)||Wu.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,s,o){Wu.isMatrixRotated(o)||(o=o?qP.copyFrom(o):qP.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&KP.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};ZP.extension={type:V.RendererSystem,name:"scissor"};var Kg=ZP;q.add(Kg);var Jo=class extends Qo{constructor(t){super(t),this.glConst=Y.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:r}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,r.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(r._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};Jo.extension={type:V.RendererSystem,name:"stencil"};q.add(Jo);var tn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};tn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_plugin"};q.add(tn);var en=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Bt,this.transform=null}update(t,e,r,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,r,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};en.extension={type:V.RendererSystem,name:"projection"};q.add(en);var mU=new Iu,QP=new pt,rn=class{constructor(t){this.renderer=t,this._tempMatrix=new Bt}generateTexture(t,e){let{region:r,...s}=e||{},o=r?.copyTo(QP)||t.getLocalBounds(QP,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=ys.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let h=t.transform;return t.transform=mU,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}};rn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"textureGenerator"};q.add(rn);var bs=new pt,Oh=new pt,sn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(bs.width=t.frame.width,bs.height=t.frame.height,e=bs),r||(Oh.x=t.frame.x,Oh.y=t.frame.y,Oh.width=e.width,Oh.height=e.height,r=Oh),n=o.framebuffer):(a=s.resolution,e||(bs.width=s._view.screen.width,bs.height=s._view.screen.height,e=bs),r||(r=bs,r.width=e.width,r.height=e.height));let h=this.viewportFrame;h.x=r.x*a,h.y=r.y*a,h.width=r.width*a,h.height=r.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(n,h),this.renderer.projection.update(r,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){let r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=vr.shared.setValue(t||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};sn.extension={type:V.RendererSystem,name:"renderTexture"};q.add(sn);var Lh=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function JP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){let o=t.getActiveAttrib(i,s);if(o.name.startsWith("gl_"))continue;let n=Sh(t,o.type),a={type:n,name:o.name,size:Th(n),location:t.getAttribLocation(i,o.name)};e[o.name]=a}return e}function tR(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=Sh(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:vh(h,o.size)}}return e}function Zg(i,t){let e=Fu(i,i.VERTEX_SHADER,t.vertexSrc),r=Fu(i,i.FRAGMENT_SHADER,t.fragmentSrc),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||$g(i,s,e,r),t.attributeData=JP(s,i),t.uniformData=tR(s,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((h,l)=>h>l?1:-1);for(let h=0;h<a.length;h++)t.attributeData[a[h]].location=h,i.bindAttribLocation(s,h,a[h]);i.linkProgram(s)}i.deleteShader(e),i.deleteShader(r);let n={};for(let a in t.uniformData){let h=t.uniformData[a];n[a]={location:i.getUniformLocation(s,a),value:vh(h.type,h.size)}}return new Lh(s,n)}function gU(i,t,e,r,s){e.buffer.update(s)}var xU={float:`
1558
+ `;var Uh=class extends Hr{constructor(t,e,r){let s=null;typeof t!="string"&&e===void 0&&r===void 0&&(s=t,t=void 0,e=void 0,r=void 0),super(t||YP,e||jP,r),this.maskSprite=s,this.maskMatrix=new Bt}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Gh(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,r,s))}};var kh=class{constructor(t=null){this.type=Jt.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Hr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=Jt.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var Zo=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let r=e;if(!r.isMaskData){let o=this.maskDataPool.pop()||new kh;o.pooled=!0,o.maskObject=e,r=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(s),r._colorMask=s?s._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==Jt.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case Jt.SCISSOR:this.renderer.scissor.push(r);break;case Jt.STENCIL:this.renderer.stencil.push(r);break;case Jt.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case Jt.COLOR:this.pushColorMask(r);break;default:break}r.type===Jt.SPRITE&&this.maskStack.push(r)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case Jt.SCISSOR:this.renderer.scissor.pop(e);break;case Jt.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case Jt.SPRITE:this.popSpriteMask(e);break;case Jt.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let r=this.maskStack[this.maskStack.length-1];r.type===Jt.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=Jt.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=Jt.SCISSOR:t.type=Jt.STENCIL:t.type=Jt.COLOR}pushSpriteMask(t){let{maskObject:e}=t,r=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Uh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,s),r.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}popColorMask(t){let e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}};Zo.extension={type:V.RendererSystem,name:"mask"};q.add(Zo);var Qo=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==r&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var qP=new Bt,KP=[],ZP=class Wu extends Qo{constructor(t){super(t),this.glConst=Y.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:r}=t,{renderer:s}=this,o=s.renderTexture,n=r.getBounds(!0,KP.pop()??new pt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:r,c:s,d:o}=t;return(Math.abs(r)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Wu.isMatrixRotated(e.worldTransform)||Wu.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,s,o){Wu.isMatrixRotated(o)||(o=o?qP.copyFrom(o):qP.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&KP.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};ZP.extension={type:V.RendererSystem,name:"scissor"};var qg=ZP;q.add(qg);var Jo=class extends Qo{constructor(t){super(t),this.glConst=Y.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:r}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,r.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(r._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};Jo.extension={type:V.RendererSystem,name:"stencil"};q.add(Jo);var tn=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};tn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_plugin"};q.add(tn);var en=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Bt,this.transform=null}update(t,e,r,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,r,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};en.extension={type:V.RendererSystem,name:"projection"};q.add(en);var pU=new Iu,QP=new pt,rn=class{constructor(t){this.renderer=t,this._tempMatrix=new Bt}generateTexture(t,e){let{region:r,...s}=e||{},o=r?.copyTo(QP)||t.getLocalBounds(QP,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=ys.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let h=t.transform;return t.transform=pU,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}};rn.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"textureGenerator"};q.add(rn);var bs=new pt,Oh=new pt,sn=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(bs.width=t.frame.width,bs.height=t.frame.height,e=bs),r||(Oh.x=t.frame.x,Oh.y=t.frame.y,Oh.width=e.width,Oh.height=e.height,r=Oh),n=o.framebuffer):(a=s.resolution,e||(bs.width=s._view.screen.width,bs.height=s._view.screen.height,e=bs),r||(r=bs,r.width=e.width,r.height=e.height));let h=this.viewportFrame;h.x=r.x*a,h.y=r.y*a,h.width=r.width*a,h.height=r.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(n,h),this.renderer.projection.update(r,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){let r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=vr.shared.setValue(t||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};sn.extension={type:V.RendererSystem,name:"renderTexture"};q.add(sn);var Lh=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function JP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){let o=t.getActiveAttrib(i,s);if(o.name.startsWith("gl_"))continue;let n=Sh(t,o.type),a={type:n,name:o.name,size:Th(n),location:t.getAttribLocation(i,o.name)};e[o.name]=a}return e}function tR(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=Sh(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:vh(h,o.size)}}return e}function Kg(i,t){let e=Fu(i,i.VERTEX_SHADER,t.vertexSrc),r=Fu(i,i.FRAGMENT_SHADER,t.fragmentSrc),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||zg(i,s,e,r),t.attributeData=JP(s,i),t.uniformData=tR(s,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((h,l)=>h>l?1:-1);for(let h=0;h<a.length;h++)t.attributeData[a[h]].location=h,i.bindAttribLocation(s,h,a[h]);i.linkProgram(s)}i.deleteShader(e),i.deleteShader(r);let n={};for(let a in t.uniformData){let h=t.uniformData[a];n[a]={location:i.getUniformLocation(s,a),value:vh(h.type,h.size)}}return new Lh(s,n)}function mU(i,t,e,r,s){e.buffer.update(s)}var gU={float:`
1559
1559
  data[offset] = v;
1560
1560
  `,vec2:`
1561
1561
  data[offset] = v[0];
@@ -1593,7 +1593,7 @@ void main(void)
1593
1593
  {
1594
1594
  data[offset + i] = v[i];
1595
1595
  }
1596
- `},eR={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function rR(i){let t=i.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=eR[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,r%e!==0&&r<16){let a=r%e%16;r+=a,s+=a}r+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,r=e):(n.offset=s,r+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function iR(i,t){let e=[];for(let r in i)t[r]&&e.push(t[r]);return e.sort((r,s)=>r.index-s.index),e}function Qg(i,t){if(!i.autoManage)return{size:0,syncFunc:gU};let e=iR(i.uniforms,t),{uboElements:r,size:s}=rR(e),o=[`
1596
+ `},eR={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function rR(i){let t=i.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=eR[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,r%e!==0&&r<16){let a=r%e%16;r+=a,s+=a}r+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,r=e):(n.offset=s,r+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function iR(i,t){let e=[];for(let r in i)t[r]&&e.push(t[r]);return e.sort((r,s)=>r.index-s.index),e}function Zg(i,t){if(!i.autoManage)return{size:0,syncFunc:mU};let e=iR(i.uniforms,t),{uboElements:r,size:s}=rR(e),o=[`
1597
1597
  var v = null;
1598
1598
  var v2 = null;
1599
1599
  var cv = null;
@@ -1617,7 +1617,7 @@ void main(void)
1617
1617
  offset += ${p};
1618
1618
  }
1619
1619
 
1620
- `)}else{let u=xU[a.data.type];o.push(`
1620
+ `)}else{let u=gU[a.data.type];o.push(`
1621
1621
  cv = ud.${l}.value;
1622
1622
  v = uv.${l};
1623
1623
  offset = ${a.offset/4};
@@ -1625,7 +1625,7 @@ void main(void)
1625
1625
  `)}}return o.push(`
1626
1626
  renderer.buffer.update(buffer);
1627
1627
  `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
1628
- `))}}var _U=0,zu={textureCount:0,uboCount:0},Bi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=_U++}systemCheck(){if(!Du())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(zu.textureCount=0,zu.uboCount=0,this.syncUniformGroup(t.uniformGroup,zu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Wg(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,zu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Qg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Zg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Bi.extension={type:V.RendererSystem,name:"shader"};q.add(Bi);var li=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};li.defaultOptions={hello:!1},li.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(li);function sR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var yU=0,bU=1,vU=2,TU=3,SU=4,EU=5,oR=class Jg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[yU]=this.setBlend,this.map[bU]=this.setOffset,this.map[vU]=this.setCullFace,this.map[TU]=this.setDepthTest,this.map[SU]=this.setFrontFace,this.map[EU]=this.setDepthMask,this.checks=[],this.defaultState=new Dr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=sR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;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(Jg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Jg.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(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.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=-1,this.setBlendMode(0)}updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};oR.extension={type:V.RendererSystem,name:"state"};var tx=oR;q.add(tx);var on=class extends hs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new jt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class $u{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=$u.defaultMaxIdle,this.checkCountMax=$u.defaultCheckCountMax,this.mode=$u.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==su.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=su.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Vr=Dh;q.add(Vr);var vs=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=rt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}};function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.R8]:D.FLOAT,[i.R8_SNORM]:D.FLOAT,[i.RG8]:D.FLOAT,[i.RG8_SNORM]:D.FLOAT,[i.RGB8]:D.FLOAT,[i.RGB8_SNORM]:D.FLOAT,[i.RGB565]:D.FLOAT,[i.RGBA4]:D.FLOAT,[i.RGB5_A1]:D.FLOAT,[i.RGBA8]:D.FLOAT,[i.RGBA8_SNORM]:D.FLOAT,[i.RGB10_A2]:D.FLOAT,[i.RGB10_A2UI]:D.FLOAT,[i.SRGB8]:D.FLOAT,[i.SRGB8_ALPHA8]:D.FLOAT,[i.R16F]:D.FLOAT,[i.RG16F]:D.FLOAT,[i.RGB16F]:D.FLOAT,[i.RGBA16F]:D.FLOAT,[i.R32F]:D.FLOAT,[i.RG32F]:D.FLOAT,[i.RGB32F]:D.FLOAT,[i.RGBA32F]:D.FLOAT,[i.R11F_G11F_B10F]:D.FLOAT,[i.RGB9_E5]:D.FLOAT,[i.R8I]:D.INT,[i.R8UI]:D.UINT,[i.R16I]:D.INT,[i.R16UI]:D.UINT,[i.R32I]:D.INT,[i.R32UI]:D.UINT,[i.RG8I]:D.INT,[i.RG8UI]:D.UINT,[i.RG16I]:D.INT,[i.RG16UI]:D.UINT,[i.RG32I]:D.INT,[i.RG32UI]:D.UINT,[i.RGB8I]:D.INT,[i.RGB8UI]:D.UINT,[i.RGB16I]:D.INT,[i.RGB16UI]:D.UINT,[i.RGB32I]:D.INT,[i.RGB32UI]:D.UINT,[i.RGBA8I]:D.INT,[i.RGBA8UI]:D.UINT,[i.RGBA16I]:D.INT,[i.RGBA16UI]:D.UINT,[i.RGBA32I]:D.INT,[i.RGBA32UI]:D.UINT,[i.DEPTH_COMPONENT16]:D.FLOAT,[i.DEPTH_COMPONENT24]:D.FLOAT,[i.DEPTH_COMPONENT32F]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT,[i.DEPTH24_STENCIL8]:D.FLOAT,[i.DEPTH32F_STENCIL8]:D.FLOAT}:t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT},t}function aR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA8,[G.RGB]:i.RGB8,[G.RG]:i.RG8,[G.RED]:i.R8,[G.RGBA_INTEGER]:i.RGBA8UI,[G.RGB_INTEGER]:i.RGB8UI,[G.RG_INTEGER]:i.RG8UI,[G.RED_INTEGER]:i.R8UI,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[G.RGBA]:i.RGBA8_SNORM,[G.RGB]:i.RGB8_SNORM,[G.RG]:i.RG8_SNORM,[G.RED]:i.R8_SNORM,[G.RGBA_INTEGER]:i.RGBA8I,[G.RGB_INTEGER]:i.RGB8I,[G.RG_INTEGER]:i.RG8I,[G.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:i.RGBA16UI,[G.RGB_INTEGER]:i.RGB16UI,[G.RG_INTEGER]:i.RG16UI,[G.RED_INTEGER]:i.R16UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[G.RGBA_INTEGER]:i.RGBA16I,[G.RGB_INTEGER]:i.RGB16I,[G.RG_INTEGER]:i.RG16I,[G.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:i.RGBA32UI,[G.RGB_INTEGER]:i.RGB32UI,[G.RG_INTEGER]:i.RG32UI,[G.RED_INTEGER]:i.R32UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[G.RGBA_INTEGER]:i.RGBA32I,[G.RGB_INTEGER]:i.RGB32I,[G.RG_INTEGER]:i.RG32I,[G.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[G.RGBA]:i.RGBA32F,[G.RGB]:i.RGB32F,[G.RG]:i.RG32F,[G.RED]:i.R32F,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[G.RGBA]:i.RGBA16F,[G.RGB]:i.RGB16F,[G.RG]:i.RG16F,[G.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:i.RGB10_A2,[G.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA,[G.RGB]:i.RGB,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=aR(t),this.samplerTypes=nR(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new vs(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new vs(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==D.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new vs(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??D.FLOAT,this.webGLVersion===2&&t.type===rt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==D.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&Rg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===yr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==yr.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ar.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ci=class{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};ci.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ci);Y.PREFER_ENV=$e.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...hi.defaultOptions,...ai.defaultOptions,...ci.defaultOptions,...li.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Hr.defaultResolution},set(i){Hr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Hr.defaultMultisample},set(i){Hr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ni.defaultMaxTextures},set(i){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ni.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ni.defaultBatchSize},set(i){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ni.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ni.canUploadSameBuffer},set(i){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ni.canUploadSameBuffer=i}},GC_MODE:{get(){return Vr.defaultMode},set(i){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Vr.defaultMode=i}},GC_MAX_IDLE:{get(){return Vr.defaultMaxIdle},set(i){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Vr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Vr.defaultCheckCountMax},set(i){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Vr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return cr.defaultVertexPrecision},set(i){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),cr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return cr.defaultFragmentPrecision},set(i){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),cr.defaultFragmentPrecision=i}}});var Ts=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ts||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var hR=class Ke{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new hn(null,null,1/0),this.deltaMS=1/Ke.targetFPMS,this.elapsedMS=1/Ke.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ke.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ke.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ke._shared){let t=Ke._shared=new Ke;t.autoStart=!0,t._protected=!0}return Ke._shared}static get system(){if(!Ke._system){let t=Ke._system=new Ke;t.autoStart=!0,t._protected=!0}return Ke._system}};hR.targetFPMS=.06;var ur=hR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return ur.targetFPMS},set(i){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ur.targetFPMS=i}}});var Nh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ts.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ur.shared:new ur,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var AU=[];q.handleByList(V.Renderer,AU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var Xu=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new Xu(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var ju=class ex extends on{constructor(t){super(),this.type=zm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new qe({projectionMatrix:new Bt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:ex.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=ex.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:Cg()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ju.extension={type:V.Renderer,priority:1},ju.__plugins={},ju.__systems={};var Yu=ju;q.handleByMap(V.RendererPlugin,Yu.__plugins);q.handleByMap(V.RendererSystem,Yu.__systems);q.add(Yu);var Ii=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof Ye?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Ii{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ei.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var lR=class Xh extends Ii{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ei.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};lR.SIDES=6;var rx=lR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var ix=class qu extends ne{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},qu.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${ii()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=qu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&qu.SVG_XML.test(t)}};ix.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,ix.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var sx=ix;var Ku=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var ox=class nx extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||nx.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=ur.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ur.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||nx.TYPES.includes(e)}};ox.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],ox.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var ax=ox;_h.push(jh,xs,$h,ax,Ku,sx,ls,rx,zh);var wU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},CU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function cR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?wU:CU)[c.type].call(null,h,d.location,d.value,u)}}function PU(){Object.assign(Bi.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;cR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}PU();var Yh=new(window.AudioContext||window.webkitAudioContext),RU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Ao.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},uR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=RU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var dR=({type:i,parse:t})=>({type:i,parse:t});var MU=i=>i.split("/").pop(),BU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:MU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),IU=()=>{let i,t=uR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audios:[],parsers:[]},o,n=!1,a,h=d=>d?d.startsWith("audio/")?"audio":d.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(d)?"font":"texture":"texture",l=(d,f,p)=>{d.renderer.events.cursorStyles||(d.renderer.events.cursorStyles={}),d.renderer.events.cursorStyles.default||(d.renderer.events.cursorStyles.default="default"),d.renderer.events.cursorStyles.hover||(d.renderer.events.cursorStyles.hover="pointer");let m=f?.cursorStyles,g=p?.cursorStyles;JSON.stringify(m)!==JSON.stringify(g)&&(g?(g.default&&(d.renderer.events.cursorStyles.default=g.default,d.canvas.style.cursor=g.default),g.hover&&(d.renderer.events.cursorStyles.hover=g.hover)):m&&(d.renderer.events.cursorStyles.default="default",d.renderer.events.cursorStyles.hover="pointer"))},c=async(d,f,p,m)=>{l(d,e.global,p.global),o&&n&&o.abort(),o=new AbortController;let g=o.signal;for(;n;)await new Promise(b=>setTimeout(b,0));n=!0,await rh({app:d,parent:f,prevASTTree:e.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:g}),await Wm({app:d,prevAudioTree:e.audio,nextAudioTree:p.audio,audioPlugins:s.audios,signal:g}),n=!1,e=p},u={rendererName:"pixi",get canvas(){return i.canvas},get ticker(){return i.ticker},findElementByLabel:d=>{if(i.stage.children&&i.stage.children.length>0)for(let f of i.stage.children){let p=findElementByLabel(f,d);if(p)return p}return null},extractBase64:async d=>{await i.renderer.extract.base64(d)},assignStageEvent:(d,f)=>{i.stage.eventMode="static",i.stage.on(d,f)},init:async d=>{let{eventHandler:f,plugins:p,width:m,height:g,backgroundColor:b}=d,_=[];p?.elements?.forEach(T=>{T?.parse&&_.push(dR({type:T.type,parse:T.parse}))}),s={animations:p.animations??[],elements:p.elements??[],audios:p.audios??[],parsers:_},r=f,i=new Ja,i.audioStage=t,await i.init({width:m,height:g,backgroundColor:b,preference:"webgl"});let v=new xr;return v.rect(0,0,m,g),v.fill(b||0),i.stage.addChild(v),i.stage.width=m,i.stage.height=g,i.ticker.add(i.audioStage.tick),u},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async d=>{if(!d)throw new Error("assetBufferMap is required");let f={audio:{},font:{},texture:{}};for(let[m,g]of Object.entries(d)){let b=h(g.type);f[b][m]=g}await Promise.all(Object.entries(f.audio).map(([m,g])=>Ao.load(m,g.buffer))),await Promise.all(Object.entries(f.font).map(async([m,g])=>{let b=new Blob([g.buffer],{type:g.type}),_=URL.createObjectURL(b),v=new FontFace(m,`url(${_})`);try{await v.load(),document.fonts.add(v)}catch(T){console.error(`Failed to load font ${m}:`,T)}finally{URL.revokeObjectURL(_)}})),a?Object.assign(a.bufferMap,f.texture):(a=BU(f.texture),or.loader.parsers.length=0,or.reset(),F.add({name:"advanced-buffer-loader",extension:y.Asset,priority:le.High,loader:a}),typeof or.registerPlugin=="function"&&or.registerPlugin(a));let p=Object.keys(f.texture);return Promise.all(p.map(m=>or.load(m)))},loadAudioAssets:async d=>Promise.all(d.map(async f=>{let m=await(await fetch(f)).arrayBuffer();return Ao.load(f,m)})),updatedBackgroundColor:d=>{i.renderer.background.color=d},getStageElementBounds:()=>{let d={},f=p=>{if(!(!p||p.length===0))for(let m of p)d[m.label]={x:m.groupTransform.tx,y:m.groupTransform.ty,width:m.width,height:m.height},f(m.children)};return f(i.stage.children),d},render:d=>{let f=Lm({JSONObject:d.elements,parserPlugins:s.parsers}),p={...d,elements:f};c(i,i.stage,p,r)}};return u},fR=IU;var mbt=fR;export{Ja as Application,or as Assets,Ao as AudioAsset,YI as containerPlugin,Nm as createAnimationPlugin,TR as createAssetBufferManager,Hm as createAudioPlugin,ze as createElementPlugin,mbt as default,Lm as parseElements,WI as rectPlugin,Wm as renderAudio,rh as renderElements,$I as sliderPlugin,nF as soundPlugin,zI as spritePlugin,VI as textPlugin,ZI as textRevealingPlugin,oF as tweenPlugin};
1628
+ `))}}var xU=0,zu={textureCount:0,uboCount:0},Bi=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=xU++}systemCheck(){if(!Du())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(zu.textureCount=0,zu.uboCount=0,this.syncUniformGroup(t.uniformGroup,zu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Vg(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,zu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Zg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Kg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Bi.extension={type:V.RendererSystem,name:"shader"};q.add(Bi);var li=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};li.defaultOptions={hello:!1},li.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"startup"};q.add(li);function sR(i,t=[]){return t[Z.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD]=[i.ONE,i.ONE],t[Z.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.NONE]=[0,0],t[Z.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[Z.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[Z.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[Z.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[Z.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[Z.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[Z.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[Z.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[Z.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[Z.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var _U=0,yU=1,bU=2,vU=3,TU=4,SU=5,oR=class Qg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Z.NONE,this._blendEq=!1,this.map=[],this.map[_U]=this.setBlend,this.map[yU]=this.setOffset,this.map[bU]=this.setCullFace,this.map[vU]=this.setDepthTest,this.map[TU]=this.setFrontFace,this.map[SU]=this.setDepthMask,this.checks=[],this.defaultState=new Dr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=sR(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;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(Qg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(Qg.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(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.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=-1,this.setBlendMode(0)}updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};oR.extension={type:V.RendererSystem,name:"state"};var Jg=oR;q.add(Jg);var on=class extends hs.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new jt(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Dh=class $u{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=$u.defaultMaxIdle,this.checkCountMax=$u.defaultCheckCountMax,this.mode=$u.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==su.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Dh.defaultMode=su.AUTO,Dh.defaultMaxIdle=60*60,Dh.defaultCheckCountMax=60*10,Dh.extension={type:V.RendererSystem,name:"textureGC"};var Vr=Dh;q.add(Vr);var vs=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=rt.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.samplerType=0}};function nR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.R8]:D.FLOAT,[i.R8_SNORM]:D.FLOAT,[i.RG8]:D.FLOAT,[i.RG8_SNORM]:D.FLOAT,[i.RGB8]:D.FLOAT,[i.RGB8_SNORM]:D.FLOAT,[i.RGB565]:D.FLOAT,[i.RGBA4]:D.FLOAT,[i.RGB5_A1]:D.FLOAT,[i.RGBA8]:D.FLOAT,[i.RGBA8_SNORM]:D.FLOAT,[i.RGB10_A2]:D.FLOAT,[i.RGB10_A2UI]:D.FLOAT,[i.SRGB8]:D.FLOAT,[i.SRGB8_ALPHA8]:D.FLOAT,[i.R16F]:D.FLOAT,[i.RG16F]:D.FLOAT,[i.RGB16F]:D.FLOAT,[i.RGBA16F]:D.FLOAT,[i.R32F]:D.FLOAT,[i.RG32F]:D.FLOAT,[i.RGB32F]:D.FLOAT,[i.RGBA32F]:D.FLOAT,[i.R11F_G11F_B10F]:D.FLOAT,[i.RGB9_E5]:D.FLOAT,[i.R8I]:D.INT,[i.R8UI]:D.UINT,[i.R16I]:D.INT,[i.R16UI]:D.UINT,[i.R32I]:D.INT,[i.R32UI]:D.UINT,[i.RG8I]:D.INT,[i.RG8UI]:D.UINT,[i.RG16I]:D.INT,[i.RG16UI]:D.UINT,[i.RG32I]:D.INT,[i.RG32UI]:D.UINT,[i.RGB8I]:D.INT,[i.RGB8UI]:D.UINT,[i.RGB16I]:D.INT,[i.RGB16UI]:D.UINT,[i.RGB32I]:D.INT,[i.RGB32UI]:D.UINT,[i.RGBA8I]:D.INT,[i.RGBA8UI]:D.UINT,[i.RGBA16I]:D.INT,[i.RGBA16UI]:D.UINT,[i.RGBA32I]:D.INT,[i.RGBA32UI]:D.UINT,[i.DEPTH_COMPONENT16]:D.FLOAT,[i.DEPTH_COMPONENT24]:D.FLOAT,[i.DEPTH_COMPONENT32F]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT,[i.DEPTH24_STENCIL8]:D.FLOAT,[i.DEPTH32F_STENCIL8]:D.FLOAT}:t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT},t}function aR(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[rt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA8,[G.RGB]:i.RGB8,[G.RG]:i.RG8,[G.RED]:i.R8,[G.RGBA_INTEGER]:i.RGBA8UI,[G.RGB_INTEGER]:i.RGB8UI,[G.RG_INTEGER]:i.RG8UI,[G.RED_INTEGER]:i.R8UI,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.BYTE]:{[G.RGBA]:i.RGBA8_SNORM,[G.RGB]:i.RGB8_SNORM,[G.RG]:i.RG8_SNORM,[G.RED]:i.R8_SNORM,[G.RGBA_INTEGER]:i.RGBA8I,[G.RGB_INTEGER]:i.RGB8I,[G.RG_INTEGER]:i.RG8I,[G.RED_INTEGER]:i.R8I},[rt.UNSIGNED_SHORT]:{[G.RGBA_INTEGER]:i.RGBA16UI,[G.RGB_INTEGER]:i.RGB16UI,[G.RG_INTEGER]:i.RG16UI,[G.RED_INTEGER]:i.R16UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[rt.SHORT]:{[G.RGBA_INTEGER]:i.RGBA16I,[G.RGB_INTEGER]:i.RGB16I,[G.RG_INTEGER]:i.RG16I,[G.RED_INTEGER]:i.R16I},[rt.UNSIGNED_INT]:{[G.RGBA_INTEGER]:i.RGBA32UI,[G.RGB_INTEGER]:i.RGB32UI,[G.RG_INTEGER]:i.RG32UI,[G.RED_INTEGER]:i.R32UI,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[rt.INT]:{[G.RGBA_INTEGER]:i.RGBA32I,[G.RGB_INTEGER]:i.RGB32I,[G.RG_INTEGER]:i.RG32I,[G.RED_INTEGER]:i.R32I},[rt.FLOAT]:{[G.RGBA]:i.RGBA32F,[G.RGB]:i.RGB32F,[G.RG]:i.RG32F,[G.RED]:i.R32F,[G.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[rt.HALF_FLOAT]:{[G.RGBA]:i.RGBA16F,[G.RGB]:i.RGB16F,[G.RG]:i.RG16F,[G.RED]:i.R16F},[rt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB565},[rt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA4},[rt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGB5_A1},[rt.UNSIGNED_INT_2_10_10_10_REV]:{[G.RGBA]:i.RGB10_A2,[G.RGBA_INTEGER]:i.RGB10_A2UI},[rt.UNSIGNED_INT_10F_11F_11F_REV]:{[G.RGB]:i.R11F_G11F_B10F},[rt.UNSIGNED_INT_5_9_9_9_REV]:{[G.RGB]:i.RGB9_E5},[rt.UNSIGNED_INT_24_8]:{[G.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[rt.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[G.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[rt.UNSIGNED_BYTE]:{[G.RGBA]:i.RGBA,[G.RGB]:i.RGB,[G.ALPHA]:i.ALPHA,[G.LUMINANCE]:i.LUMINANCE,[G.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[rt.UNSIGNED_SHORT_5_6_5]:{[G.RGB]:i.RGB},[rt.UNSIGNED_SHORT_4_4_4_4]:{[G.RGBA]:i.RGBA},[rt.UNSIGNED_SHORT_5_5_5_1]:{[G.RGBA]:i.RGBA}},t}var nn=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=aR(t),this.samplerTypes=nR(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new vs(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new vs(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==D.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new vs(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??D.FLOAT,this.webGLVersion===2&&t.type===rt.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==D.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&Pg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===yr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=ih.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==yr.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===ar.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===ar.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};nn.extension={type:V.RendererSystem,name:"texture"};q.add(nn);var an=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};an.extension={type:V.RendererSystem,name:"transformFeedback"};q.add(an);var ci=class{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||Y.ADAPTER.createCanvas(),this.resolution=t.resolution||Y.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};ci.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},ci.extension={type:[V.RendererSystem,V.CanvasRendererSystem],name:"_view"};q.add(ci);Y.PREFER_ENV=$e.WEBGL2;Y.STRICT_TEXTURE_CACHE=!1;Y.RENDER_OPTIONS={...hi.defaultOptions,...ai.defaultOptions,...ci.defaultOptions,...li.defaultOptions};Object.defineProperties(Y,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Hr.defaultResolution},set(i){Hr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Hr.defaultMultisample},set(i){Hr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ni.defaultMaxTextures},set(i){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),ni.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ni.defaultBatchSize},set(i){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),ni.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ni.canUploadSameBuffer},set(i){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),ni.canUploadSameBuffer=i}},GC_MODE:{get(){return Vr.defaultMode},set(i){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Vr.defaultMode=i}},GC_MAX_IDLE:{get(){return Vr.defaultMaxIdle},set(i){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Vr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Vr.defaultCheckCountMax},set(i){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Vr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return cr.defaultVertexPrecision},set(i){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),cr.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return cr.defaultFragmentPrecision},set(i){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),cr.defaultFragmentPrecision=i}}});var Ts=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ts||{});var hn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var hR=class Ke{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new hn(null,null,1/0),this.deltaMS=1/Ke.targetFPMS,this.elapsedMS=1/Ke.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r))}addOnce(t,e,r=Ts.NORMAL){return this._addListener(new hn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ke.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ke.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ke._shared){let t=Ke._shared=new Ke;t.autoStart=!0,t._protected=!0}return Ke._shared}static get system(){if(!Ke._system){let t=Ke._system=new Ke;t.autoStart=!0,t._protected=!0}return Ke._system}};hR.targetFPMS=.06;var ur=hR;Object.defineProperties(Y,{TARGET_FPMS:{get(){return ur.targetFPMS},set(i){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),ur.targetFPMS=i}}});var Nh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Ts.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ur.shared:new ur,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Nh.extension=V.Application;q.add(Nh);var EU=[];q.handleByList(V.Renderer,EU);var Hh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=Ct.HIGH?this.multisample=Ct.HIGH:e>=Ct.MEDIUM?this.multisample=Ct.MEDIUM:e>=Ct.LOW?this.multisample=Ct.LOW:this.multisample=Ct.NONE}destroy(){}};Hh.extension={type:V.RendererSystem,name:"_multisample"};q.add(Hh);var Xu=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Vh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new Xu(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Vh.extension={type:V.RendererSystem,name:"buffer"};q.add(Vh);var Wh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Wh.extension={type:V.RendererSystem,name:"objectRenderer"};q.add(Wh);var ju=class tx extends on{constructor(t){super(),this.type=Wm.WEBGL,t=Object.assign({},Y.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new qe({projectionMatrix:new Bt},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:tx.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=tx.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:wg()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};ju.extension={type:V.Renderer,priority:1},ju.__plugins={},ju.__systems={};var Yu=ju;q.handleByMap(V.RendererPlugin,Yu.__plugins);q.handleByMap(V.RendererSystem,Yu.__systems);q.add(Yu);var Ii=class extends Ye{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof Ye?this.addResourceAt(t[r],r):this.addResourceAt(Vo(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var zh=class extends Ii{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=ei.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var $h=class extends ne{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var lR=class Xh extends Ii{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Xh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Xh.SIDES;a++)this.items[a].target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=ei.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=ei.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Xh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Xh.SIDES}};lR.SIDES=6;var ex=lR;var jh=class i extends ne{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await Y.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Xe.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??Y.ADAPTER.createCanvas(0,0),i._EMPTY}};var rx=class qu extends ne{constructor(t,e){e=e||{},super(Y.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},qu.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;ne.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${ii()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=qu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&qu.SVG_XML.test(t)}};rx.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,rx.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ix=rx;var Ku=class extends ne{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var sx=class ox extends ne{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];ne.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||ox.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=ur.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ur.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ur.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||ox.TYPES.includes(e)}};sx.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],sx.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var nx=sx;_h.push(jh,xs,$h,nx,Ku,ix,ls,ex,zh);var AU={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},wU={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function cR(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?AU:wU)[c.type].call(null,h,d.location,d.value,u)}}function CU(){Object.assign(Bi.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;cR(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}CU();var Yh=new(window.AudioContext||window.webkitAudioContext),PU=(i,t)=>{let e,r=Yh.createGain();r.gain.value=t.volume??1,r.connect(Yh.destination);let s={id:i,url:t.url,loop:t.loop||!1,volume:t.volume??1};return{play:()=>{let m=Ao.getAsset(s.url);if(!m){console.warn("AudioPlayer.play: Asset not found",s.url);return}e=Yh.createBufferSource(),e.buffer=m,e.loop=s.loop,r.gain.setValueAtTime(s.volume,Yh.currentTime),e.connect(r),e.start(0)},stop:()=>{e&&(e.stop(),e.disconnect(),r.disconnect(),r.connect(Yh.destination))},update:m=>{s={...s,...m}},getId:()=>s.id,getUrl:()=>s.url,getLoop:()=>s.loop,getVolume:()=>s.volume,setUrl:m=>{s.url=m},setLoop:m=>{s.loop=m},setVolume:m=>{s.volume=m,r.gain.value=m},id:s.id,url:s.url,loop:s.loop,volume:s.volume,gainNode:r}},uR=()=>{let i=[],t=[];return{add:a=>{t.push(a)},remove:a=>{t=t.filter(h=>h.id!==a)},getById:a=>t.find(h=>h.id===a),tick:()=>{for(let h of t){let l=i.find(c=>c.id===h.id);if(!l){let c=PU(h.id,{url:h.url,loop:h.loop,volume:h.volume??1});i.push(c),c.play();return}(l.url!==h.url||l.loop!==h.loop)&&(l.stop(),l.setUrl(h.url),l.setLoop(h.loop??!1),l.play()),l.getVolume()!==(h.volume??1)&&l.setVolume(h.volume??1)}let a=[];for(let h of i)t.find(l=>l.id===h.id)||(h.stop(),a.push(h.id));i=i.filter(h=>!a.includes(h.id))},destroy:()=>{for(let a of i)a.stop();i=[],t=[]}}};var RU=({JSONObject:i,parserPlugins:t=[]})=>i.map(r=>{let s=t.find(o=>o.type===r.type);return s?s.parse({state:r,parserPlugins:t}):i}),ax=RU;var dR=({type:i,parse:t})=>({type:i,parse:t});var MU=i=>i.split("/").pop(),BU=i=>({name:"advancedBufferLoader",priority:2,bufferMap:i,load:async t=>{let e=t.startsWith("file:")?t:MU(t),r=i[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}},test:async t=>!0,testParse:async t=>!0,parse:async t=>{if(t instanceof E)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new E.from(r)},unload:async t=>t.destroy(!0)}),IU=()=>{let i,t=uR(),e={elements:[],animations:[],audio:[]},r,s={animations:[],elements:[],audios:[],parsers:[]},o,n=!1,a,h=d=>d?d.startsWith("audio/")?"audio":d.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(d)?"font":"texture":"texture",l=(d,f,p)=>{d.renderer.events.cursorStyles||(d.renderer.events.cursorStyles={}),d.renderer.events.cursorStyles.default||(d.renderer.events.cursorStyles.default="default"),d.renderer.events.cursorStyles.hover||(d.renderer.events.cursorStyles.hover="pointer");let m=f?.cursorStyles,g=p?.cursorStyles;JSON.stringify(m)!==JSON.stringify(g)&&(g?(g.default&&(d.renderer.events.cursorStyles.default=g.default,d.canvas.style.cursor=g.default),g.hover&&(d.renderer.events.cursorStyles.hover=g.hover)):m&&(d.renderer.events.cursorStyles.default="default",d.renderer.events.cursorStyles.hover="pointer"))},c=async(d,f,p,m)=>{l(d,e.global,p.global),o&&n&&o.abort(),o=new AbortController;let g=o.signal;for(;n;)await new Promise(b=>setTimeout(b,0));n=!0,await rh({app:d,parent:f,prevASTTree:e.elements,nextASTTree:p.elements,animations:p.animations,elementPlugins:s.elements,animationPlugins:s.animations,eventHandler:m,signal:g}),await Vm({app:d,prevAudioTree:e.audio,nextAudioTree:p.audio,audioPlugins:s.audios,signal:g}),n=!1,e=p},u={rendererName:"pixi",get canvas(){return i.canvas},get ticker(){return i.ticker},findElementByLabel:d=>{if(i.stage.children&&i.stage.children.length>0)for(let f of i.stage.children){let p=findElementByLabel(f,d);if(p)return p}return null},extractBase64:async d=>{await i.renderer.extract.base64(d)},assignStageEvent:(d,f)=>{i.stage.eventMode="static",i.stage.on(d,f)},init:async d=>{let{eventHandler:f,plugins:p,width:m,height:g,backgroundColor:b}=d,_=[];p?.elements?.forEach(T=>{T?.parse&&_.push(dR({type:T.type,parse:T.parse}))}),s={animations:p.animations??[],elements:p.elements??[],audios:p.audios??[],parsers:_},r=f,i=new Ja,i.audioStage=t,await i.init({width:m,height:g,backgroundColor:b,preference:"webgl"});let v=new xr;return v.rect(0,0,m,g),v.fill(b||0),i.stage.addChild(v),i.stage.width=m,i.stage.height=g,i.ticker.add(i.audioStage.tick),u},destroy:()=>{i.audioStage.destroy(),i.destroy()},loadAssets:async d=>{if(!d)throw new Error("assetBufferMap is required");let f={audio:{},font:{},texture:{}};for(let[m,g]of Object.entries(d)){let b=h(g.type);f[b][m]=g}await Promise.all(Object.entries(f.audio).map(([m,g])=>Ao.load(m,g.buffer))),await Promise.all(Object.entries(f.font).map(async([m,g])=>{let b=new Blob([g.buffer],{type:g.type}),_=URL.createObjectURL(b),v=new FontFace(m,`url(${_})`);try{await v.load(),document.fonts.add(v)}catch(T){console.error(`Failed to load font ${m}:`,T)}finally{URL.revokeObjectURL(_)}})),a?Object.assign(a.bufferMap,f.texture):(a=BU(f.texture),or.loader.parsers.length=0,or.reset(),F.add({name:"advanced-buffer-loader",extension:y.Asset,priority:le.High,loader:a}),typeof or.registerPlugin=="function"&&or.registerPlugin(a));let p=Object.keys(f.texture);return Promise.all(p.map(m=>or.load(m)))},loadAudioAssets:async d=>Promise.all(d.map(async f=>{let m=await(await fetch(f)).arrayBuffer();return Ao.load(f,m)})),updatedBackgroundColor:d=>{i.renderer.background.color=d},render:d=>{let f=ax({JSONObject:d.elements,parserPlugins:s.parsers}),p={...d,elements:f};c(i,i.stage,p,r)},parse:d=>{let f=ax({JSONObject:d.elements,parserPlugins:s.parsers});return{...d,elements:f}}};return u},fR=IU;var pbt=fR;export{Ja as Application,or as Assets,Ao as AudioAsset,jI as containerPlugin,Dm as createAnimationPlugin,TR as createAssetBufferManager,Nm as createAudioPlugin,ze as createElementPlugin,pbt as default,VI as rectPlugin,Vm as renderAudio,rh as renderElements,zI as sliderPlugin,oF as soundPlugin,WI as spritePlugin,HI as textPlugin,KI as textRevealingPlugin,sF as tweenPlugin};
1629
1629
  /*! Bundled license information:
1630
1630
 
1631
1631
  punycode/punycode.js: