PageSourceSearch

https://twopeas.ai/_next/static/chunks/4274.cf0447eb0b745565.js

js twopeas.ai collected 2026-10-05 15:11:28 UTC 225,744 bytes, 622 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4274],{333:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"setAttributesFromProps",{enumerable:!0,get:function(){return a}});let i={acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv",noModule:"noModule"},r=["onLoad","onReady","dangerouslySetInnerHTML","children","onError","strategy","stylesheets"];function s(t){return["async","defer","noModule"].includes(t)}function a(t,e){for(let[a,n]of Object.entries(e)){if(!e.hasOwnProperty(a)||r.includes(a)||void 0===n)continue;let o=i[a]||a.toLowerCase();"SCRIPT"===t.tagName&&s(o)?t[o]=!!n:t.setAttribute(o,String(n)),(!1===n||"SCRIPT"===t.tagName&&s(o)&&(!n||"false"===n))&&(t.setAttribute(o,""),t.removeAttribute(o))}}("function"==typeof e.default||"object"==typeof e.default&&null!==e.default)&&void 0===e.default.__esModule&&(Object.defineProperty(e.default,"__esModule",{value:!0}),Object.assign(e.default,e),t.exports=e.default)},1493:(t,e,i)=>{let r,s;i.r(e),i.d(e,{ALPHA_MODES:()=>a.Gk,AbstractMultiResource:()=>a.CI,AccessibilityManager:()=>j,AlphaFilter:()=>p,AnimatedSprite:()=>iS,Application:()=>Y,ArrayResource:()=>a.aV,Assets:()=>tF,AssetsClass:()=>tO,Attribute:()=>a.nW,BLEND_MODES:()=>a.B9,BUFFER_BITS:()=>a.wn,BUFFER_TYPE:()=>a.yw,BackgroundSystem:()=>a.sN,BaseImageResource:()=>a.jH,BasePrepare:()=>iv,BaseRenderTexture:()=>a.LE,BaseTexture:()=>a.t5,BatchDrawCall:()=>a.hq,BatchGeometry:()=>a.JH,BatchRenderer:()=>a.ch,BatchShaderGenerator:()=>a.LQ,BatchSystem:()=>a.A6,BatchTextureArray:()=>a.cc,BitmapFont:()=>i$,BitmapFontData:()=>iU,BitmapText:()=>i1,BlobResource:()=>t0,BlurFilter:()=>y,BlurFilterPass:()=>_,Bounds:()=>n.cz,BrowserAdapter:()=>a.OF,Buffer:()=>a.hp,BufferResource:()=>a.dZ,BufferSystem:()=>a.yn,CLEAR_MODES:()=>a.fr,COLOR_MASK_BITS:()=>a.Eq,Cache:()=>tt,CanvasResource:()=>a.Bu,Circle:()=>a.jl,Color:()=>a.Q1,ColorMatrixFilter:()=>x,CompressedTextureResource:()=>t1,Container:()=>n.mc,ContextSystem:()=>a.bD,CountLimiter:()=>ih,CubeResource:()=>a.WQ,DEG_TO_RAD:()=>a.Td,DRAW_MODES:()=>a._4,DisplacementFilter:()=>E,DisplayObject:()=>n.q9,ENV:()=>a.Km,Ellipse:()=>a.Pp,EventBoundary:()=>N,EventSystem:()=>H,ExtensionType:()=>a.Ag,Extract:()=>eu,FORMATS:()=>a.hR,FORMATS_TO_COMPONENTS:()=>ee,FXAAFilter:()=>w,FederatedDisplayObject:()=>z,FederatedEvent:()=>I,FederatedMouseEvent:()=>B,FederatedPointerEvent:()=>L,FederatedWheelEvent:()=>O,FillStyle:()=>eL,Filter:()=>a.dJ,FilterState:()=>a.OO,FilterSystem:()=>a.u9,Framebuffer:()=>a.GW,FramebufferSystem:()=>a.nj,GC_MODES:()=>a.OS,GLFramebuffer:()=>a.pq,GLProgram:()=>a._H,GLTexture:()=>a.Ru,GRAPHICS_CURVES:()=>ev,GenerateTextureSystem:()=>a.yI,Geometry:()=>a.V2,GeometrySystem:()=>a.kb,Graphics:()=>eN,GraphicsData:()=>eC,GraphicsGeometry:()=>eB,HTMLText:()=>i9,HTMLTextStyle:()=>i5,IGLUniformData:()=>a.n1,INSTALLED:()=>a.Ln,INTERNAL_FORMATS:()=>tQ,INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:()=>tK,ImageBitmapResource:()=>a.di,ImageResource:()=>a.Gj,LINE_CAP:()=>e_,LINE_JOIN:()=>em,LineStyle:()=>eO,LoaderParserPriority:()=>tr,MASK_TYPES:()=>a.vg,MIPMAP_MODES:()=>a.E8,MSAA_QUALITY:()=>a.he,MaskData:()=>a.XN,MaskSystem:()=>a.iW,Matrix:()=>a.uq,Mesh:()=>eX,MeshBatchUvs:()=>eW,MeshGeometry:()=>ej,MeshMaterial:()=>e$,MultisampleSystem:()=>a.DT,NineSlicePlane:()=>eZ,NoiseFilter:()=>M,ObjectRenderer:()=>a.Pt,ObjectRendererSystem:()=>a.IH,ObservablePoint:()=>a.oA,PI_2:()=>a.TO,PRECISION:()=>a.Pk,ParticleContainer:()=>e1,ParticleRenderer:()=>e5,PlaneGeometry:()=>eq,PluginSystem:()=>a.$o,Point:()=>a.bR,Polygon:()=>a.tS,Prepare:()=>iE,Program:()=>a.BP,ProjectionSystem:()=>a.hk,Quad:()=>a.kO,QuadUv:()=>a.X1,RAD_TO_DEG:()=>a.bO,RENDERER_TYPE:()=>a.h3,Rectangle:()=>a.M_,RenderTexture:()=>a.Y7,RenderTexturePool:()=>a.O1,RenderTextureSystem:()=>a.Bw,Renderer:()=>a.A4,ResizePlugin:()=>$,Resource:()=>a.FW,RopeGeometry:()=>eQ,RoundedRectangle:()=>a.TE,Runner:()=>a.by,SAMPLER_TYPES:()=>a.XZ,SCALE_MODES:()=>a.M6,SHAPES:()=>a.HY,SVGResource:()=>a.$f,ScissorSystem:()=>a.s9,Shader:()=>a.Mt,ShaderSystem:()=>a.$P,SimpleMesh:()=>eJ,SimplePlane:()=>eK,SimpleRope:()=>e0,Sprite:()=>h,SpriteMaskFilter:()=>a.ah,Spritesheet:()=>iF,StartupSystem:()=>a.fE,State:()=>a.Uw,StateSystem:()=>a.D8,StencilSystem:()=>a.iH,SystemManager:()=>a.zi,TARGETS:()=>a.dW,TEXT_GRADIENT:()=>e8,TYPES:()=>a.QE,TYPES_TO_BYTES_PER_COMPONENT:()=>et,TYPES_TO_BYTES_PER_PIXEL:()=>ei,TemporaryDisplayObject:()=>n.dC,Text:()=>il,TextFormat:()=>iW,TextMetrics:()=>e7,TextStyle:()=>ii,Texture:()=>a.gP,TextureGCSystem:()=>a.lB,TextureMatrix:()=>a.NW,TextureSystem:()=>a.vB,TextureUvs:()=>a.OE,Ticker:()=>a.Rv,TickerPlugin:()=>a.y,TilingSprite:()=>iP,TilingSpriteRenderer:()=>iL,TimeLimiter:()=>iA,Transform:()=>a.dL,TransformFeedback:()=>a.wF,TransformFeedbackSystem:()=>a.vT,UPDATE_PRIORITY:()=>a.dQ,UniformGroup:()=>a.k2,VERSION:()=>a.xv,VideoResource:()=>a.A5,ViewSystem:()=>a.vr,ViewableBuffer:()=>a.u3,WRAP_MODES:()=>a.uR,XMLFormat:()=>iH,XMLStringFormat:()=>iG,accessibleTarget:()=>X,autoDetectFormat:()=>iX,autoDetectRenderer:()=>a.q5,autoDetectResource:()=>a.Nc,cacheTextureArray:()=>tk,checkDataUrl:()=>ts,checkExtension:()=>K,checkMaxIfStatementsInShader:()=>a.uC,convertToList:()=>Z,copySearchParams:()=>tq,createStringVariations:()=>
1tB,createTexture:()=>tA,createUBOElements:()=>a._J,curves:()=>ey,defaultFilterVertex:()=>a.Eo,defaultVertex:()=>a.MT,detectAvif:()=>tU,detectCompressedTextures:()=>tJ,detectDefaults:()=>tG,detectMp4:()=>tV,detectOgv:()=>tY,detectWebm:()=>tj,detectWebp:()=>tW,extensions:()=>a.XO,filters:()=>C,generateProgram:()=>a.CF,generateUniformBufferSync:()=>a.He,getFontFamilyName:()=>td,getTestContext:()=>a.WD,getUBOData:()=>a.RO,graphicsUtils:()=>eU,groupD8:()=>a.ER,isMobile:()=>a.Fr,isSingleItem:()=>te,loadBitmapFont:()=>i3,loadDDS:()=>es,loadImageBitmap:()=>tP,loadJson:()=>ta,loadKTX:()=>ea,loadSVG:()=>tC,loadTextures:()=>tM,loadTxt:()=>tn,loadVideo:()=>tI,loadWebFont:()=>tp,parseDDS:()=>t9,parseKTX:()=>er,resolveCompressedTextureUrl:()=>eo,resolveTextureUrl:()=>t$,settings:()=>a.W0,spritesheetAsset:()=>iN,uniformParsers:()=>a.$Z,unsafeEvalSupported:()=>a.ff,utils:()=>a.Wp});var a=i(533),n=i(3298);let o=new a.bR,l=new Uint16Array([0,1,2,0,2,3]);class h extends n.mc{constructor(t){super(),this._anchor=new a.oA(this._onAnchorUpdate,this,t?t.defaultAnchor.x:0,t?t.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new a.Q1(0xffffff),this._tintRGB=null,this.tint=0xffffff,this.blendMode=a.B9.NORMAL,this._cachedTint=0xffffff,this.uvs=null,this.texture=t||a.gP.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=l,this.pluginName="batch",this.isSprite=!0,this._roundPixels=a.W0.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=0xffffff,this._width&&(this.scale.x=a.Wp.sign(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=a.Wp.sign(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){let t=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===t._updateID)return;this._textureID!==t._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=t._updateID;let e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,n=e.d,o=e.tx,l=e.ty,h=this.vertexData,u=t.trim,d=t.orig,c=this._anchor,p=0,f=0,g=0,m=0;if(u?(p=(f=u.x-c._x*d.width)+u.width,g=(m=u.y-c._y*d.height)+u.height):(p=(f=-c._x*d.width)+d.width,g=(m=-c._y*d.height)+d.height),h[0]=i*f+s*m+o,h[1]=n*m+r*f+l,h[2]=i*p+s*m+o,h[3]=n*m+r*p+l,h[4]=i*p+s*g+o,h[5]=n*g+r*p+l,h[6]=i*f+s*g+o,h[7]=n*g+r*f+l,this._roundPixels){let t=a.W0.RESOLUTION;for(let e=0;e<h.length;++e)h[e]=Math.round(h[e]*t)/t}}calculateTrimmedVertices(){if(this.vertexTrimmedData){if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return}else this.vertexTrimmedData=new Float32Array(8);this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;let t=this._texture,e=this.vertexTrimmedData,i=t.orig,r=this._anchor,s=this.transform.worldTransform,n=s.a,o=s.b,l=s.c,h=s.d,u=s.tx,d=s.ty,c=-r._x*i.width,p=c+i.width,f=-r._y*i.height,g=f+i.height;if(e[0]=n*c+l*f+u,e[1]=h*f+o*c+d,e[2]=n*p+l*f+u,e[3]=h*f+o*p+d,e[4]=n*p+l*g+u,e[5]=h*g+o*p+d,e[6]=n*c+l*g+u,e[7]=h*g+o*c+d,this._roundPixels){let t=a.W0.RESOLUTION;for(let i=0;i<e.length;++i)e[i]=Math.round(e[i]*t)/t}}_render(t){this.calculateVertices(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this)}_calculateBounds(){let t=this._texture.trim,e=this._texture.orig;t&&(t.width!==e.width||t.height!==e.height)?(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData)):(this.calculateVertices(),this._bounds.addQuad(this.vertexData))}getLocalBounds(t){return 0===this.children.length?(this._localBounds||(this._localBounds=new n.cz),this._localBounds.minX=-(this._texture.orig.width*this._anchor._x),this._localBounds.minY=-(this._texture.orig.height*this._anchor._y),this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new a.M_),t=this._localBoundsRect),this._localBounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,o);let e=this._texture.orig.width,i=this._texture.orig.height,r=-e*this.anchor.x,s=0;return o.x>=r&&o.x<r+e&&(s=-i*this.anchor.y,o.y>=s&&o.y<s+i)}destroy(t){if(super.destroy(t),this._texture.off("update",this._onTextureUpdate,this),this._anchor=null,"boolean"==typeof t?t:t?.texture){let e="boolean"==typeof t?t:t?.baseTexture;this._texture.destroy(!!e)}this._texture=null}static from(t,e){return new h(t instanceof a.gP?t:a.gP.from(t,e))}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){let e=a.Wp.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){let e=a.Wp.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get anchor(){return this._anchor}
1set anchor(t){this._anchor.copyFrom(t)}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||a.gP.EMPTY,this._cachedTint=0xffffff,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))}}let u=new a.uq;n.q9.prototype._cacheAsBitmap=!1,n.q9.prototype._cacheData=null,n.q9.prototype._cacheAsBitmapResolution=null,n.q9.prototype._cacheAsBitmapMultisample=null;class d{constructor(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null}}Object.defineProperties(n.q9.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(t){let e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new d),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),n.q9.prototype._renderCached=function(t){this.visible&&!(this.worldAlpha<=0)&&this.renderable&&(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},n.q9.prototype._initCachedDisplayObject=function(t){if(this._cacheData?.sprite)return;let e=this.alpha;this.alpha=1,t.batch.flush();let i=this.getLocalBounds(new a.M_,!0);if(this.filters?.length){let t=this.filters[0].padding;i.pad(t)}let r=this.cacheAsBitmapResolution||t.resolution;i.ceil(r),i.width=Math.max(i.width,1/r),i.height=Math.max(i.height,1/r);let s=t.renderTexture.current,n=t.renderTexture.sourceFrame.clone(),o=t.renderTexture.destinationFrame.clone(),l=t.projection.transform,d=a.Y7.create({width:i.width,height:i.height,resolution:r,multisample:this.cacheAsBitmapMultisample??t.multisample}),c=`cacheAsBitmap_${a.Wp.uid()}`;this._cacheData.textureCacheId=c,a.t5.addToCache(d.baseTexture,c),a.gP.addToCache(d,c);let p=this.transform.localTransform.copyTo(u).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:d,clear:!0,transform:p,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=l,t.renderTexture.bind(s,n,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=e;let f=new h(d);f.transform.worldTransform=this.transform.worldTransform,f.anchor.x=-(i.x/i.width),f.anchor.y=-(i.y/i.height),f.alpha=e,f._bounds=this._bounds,this._cacheData.sprite=f,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=f.containsPoint.bind(f)},n.q9.prototype._renderCachedCanvas=function(t){this.visible&&!(this.worldAlpha<=0)&&this.renderable&&(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},n.q9.prototype._initCachedDisplayObjectCanvas=function(t){if(this._cacheData?.sprite)return;let e=this.getLocalBounds(new a.M_,!0),i=this.alpha;this.alpha=1;let r=t.canvasContext.activeContext,s=t._projTransform,n=this.cacheAsBitmapResolution||t.resolution;e.ceil(n),e.width=Math.max(e.width,1/n),e.height=Math.max(e.height,1/n);let o=a.Y7.create({width:e.width,height:e.height,resolution:n}),l=`cacheAsBitmap_${a.Wp.uid()}`;this._cacheData.textureCacheId=l,a.t5.addToCache(o.baseTexture,l),a.gP.addToCache(o,l),this.transform.localTransform.copyTo(u),u.invert(),u.tx-=e.x,u.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:o,clear:!0,transform:u,skipUpdateTransform:!1}),t.canvasContext.activeContext=r,t._projTransform=s,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=i;let d=new h(o);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(e.x/e.width),d.anch
1or.y=-(e.y/e.height),d.alpha=i,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=d.containsPoint.bind(d)},n.q9.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},n.q9.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},n.q9.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,a.t5.removeFromCache(this._cacheData.textureCacheId),a.gP.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},n.q9.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},n.q9.prototype.name=null,n.mc.prototype.getChildByName=function(t,e){for(let e=0,i=this.children.length;e<i;e++)if(this.children[e].name===t)return this.children[e];if(e)for(let e=0,i=this.children.length;e<i;e++){let i=this.children[e];if(!i.getChildByName)continue;let r=i.getChildByName(t,!0);if(r)return r}return null},n.q9.prototype.getGlobalPosition=function(t=new a.bR,e=!1){return this.parent?this.parent.toGlobal(this.position,t,e):(t.x=this.position.x,t.y=this.position.y),t};var c=`varying vec2 vTextureCoord;
2
3uniform sampler2D uSampler;
4uniform float uAlpha;
5
6void main(void)
7{
8   gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
9}
10`;class p extends a.dJ{constructor(t=1){super(a.MT,c,{uAlpha:1}),this.alpha=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}let f={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},g=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{","    gl_FragColor = vec4(0.0);","    %blur%","}"].join(`
11`),m=`
12    attribute vec2 aVertexPosition;
13
14    uniform mat3 projectionMatrix;
15
16    uniform float strength;
17
18    varying vec2 vBlurTexCoords[%size%];
19
20    uniform vec4 inputSize;
21    uniform vec4 outputFrame;
22
23    vec4 filterVertexPosition( void )
24    {
25        vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
26
27        return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
28    }
29
30    vec2 filterTextureCoord( void )
31    {
32        return aVertexPosition * (outputFrame.zw * inputSize.zw);
33    }
34
35    void main(void)
36    {
37        gl_Position = filterVertexPosition();
38
39        vec2 textureCoord = filterTextureCoord();
40        %blur%
41    }`;class _ extends a.dJ{constructor(t,e=8,i=4,r=a.dJ.defaultResolution,s=5){super(function(t,e){let i=Math.ceil(t/2),r=m,s="",a;a=e?"vBlurTexCoords[%index%] =  textureCoord + vec2(%sampleIndex% * strength, 0.0);":"vBlurTexCoords[%index%] =  textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let e=0;e<t;e++){let t=a.replace("%index%",e.toString());s+=t=t.replace("%sampleIndex%",`${e-(i-1)}.0`),s+=`
42`}return(r=r.replace("%blur%",s)).replace("%size%",t.toString())}(s,t),function(t){let e,i=f[t],r=i.length,s=g,a="";for(let s=0;s<t;s++){let n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;".replace("%index%",s.toString());e=s,s>=r&&(e=t-s-1),a+=n=n.replace("%value%",i[e].toString()),a+=`
43`}return(s=s.replace("%blur%",a)).replace("%size%",t.toString())}(s)),this.horizontal=t,this.resolution=r,this._quality=0,this.quality=i,this.blur=e}apply(t,e,i,r){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/e.width):this.uniforms.strength=1/i.height*(i.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,i,r);else{let s=t.getFilterTexture(),n=t.renderer,o=e,l=s;this.state.blend=!1,t.applyFilter(this,o,l,a.fr.CLEAR);for(let e=1;e<this.passes-1;e++){t.bindAndClear(o,a.fr.BLIT),this.uniforms.uSampler=l;let e=l;l=o,o=e,n.shader.bind(this),n.geometry.draw(5)}this.state.blend=!0,t.applyFilter(this,l,i,r),t.returnFilterTexture(s)}}get blur(){return this.strength}set blur(t){this.padding=1+2*Math.abs(t),this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}}class y extends a.dJ{constructor(t=8,e=4,i=a.dJ.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new _(!0,t,e,i,r),this.blurYFilter=new _(!1,t,e,i,r),this.resolution=i,this.qual
43ity=e,this.blur=t,this.repeatEdgePixels=!1}apply(t,e,i,r){let s=Math.abs(this.blurXFilter.strength),n=Math.abs(this.blurYFilter.strength);if(s&&n){let s=t.getFilterTexture();this.blurXFilter.apply(t,e,s,a.fr.CLEAR),this.blurYFilter.apply(t,s,i,r),t.returnFilterTexture(s)}else n?this.blurYFilter.apply(t,e,i,r):this.blurXFilter.apply(t,e,i,r)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))}get blur(){return this.blurXFilter.blur}set blur(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get blurX(){return this.blurXFilter.blur}set blurX(t){this.blurXFilter.blur=t,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(t){this.blurYFilter.blur=t,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(t){this.blurYFilter.blendMode=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}var v=`varying vec2 vTextureCoord;
44uniform sampler2D uSampler;
45uniform float m[20];
46uniform float uAlpha;
47
48void main(void)
49{
50    vec4 c = texture2D(uSampler, vTextureCoord);
51
52    if (uAlpha == 0.0) {
53        gl_FragColor = c;
54        return;
55    }
56
57    // Un-premultiply alpha before applying the color matrix. See issue #3539.
58    if (c.a > 0.0) {
59      c.rgb /= c.a;
60    }
61
62    vec4 result;
63
64    result.r = (m[0] * c.r);
65        result.r += (m[1] * c.g);
66        result.r += (m[2] * c.b);
67        result.r += (m[3] * c.a);
68        result.r += m[4];
69
70    result.g = (m[5] * c.r);
71        result.g += (m[6] * c.g);
72        result.g += (m[7] * c.b);
73        result.g += (m[8] * c.a);
74        result.g += m[9];
75
76    result.b = (m[10] * c.r);
77       result.b += (m[11] * c.g);
78       result.b += (m[12] * c.b);
79       result.b += (m[13] * c.a);
80       result.b += m[14];
81
82    result.a = (m[15] * c.r);
83       result.a += (m[16] * c.g);
84       result.a += (m[17] * c.b);
85       result.a += (m[18] * c.a);
86       result.a += m[19];
87
88    vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
89
90    // Premultiply alpha again.
91    rgb *= result.a;
92
93    gl_FragColor = vec4(rgb, result.a);
94}
95`;class x extends a.dJ{constructor(){super(a.Eo,v,{m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1}),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.uniforms.m,t),i=this._colorMatrix(i)),this.uniforms.m=i}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){let e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){this._loadMatrix([t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0],e)}tint(t,e){let[i,r,s]=a.Q1.shared.setValue(t).toArray();this._loadMatrix([i,0,0,0,0,0,r,0,0,0,0,0,s,0,0,0,0,0,1,0],e)}greyscale(t,e){this._loadMatrix([t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0],e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){let i=Math.cos(t=(t||0)/180*Math.PI),r=Math.sin(t),s=1/3,a=(0,Math.sqrt)(1/3);this._loadMatrix([i+(1-i)*s,s*(1-i)-a*r,s*(1-i)+a*r,0,0,s*(1-i)+a*r,i+s*(1-i),s*(1-i)-a*r,0,0,s*(1-i)-a*r,s*(1-i)+a*r,i+s*(1-i),0,0,0,0,0,1,0],e)}contrast(t,e){let i=(t||0)+1,r=-.5*(i-1);this._loadMatrix([i,0,0,0,r,0,i,0,0,r,0,0,i,0,r,0,0,0,1,0],e)}saturate(t=0,e){let i=2*t/3+1,r=-((i-1)*.5);this._loadMatrix([i,r,r,0,0,r,i,r,0,0,r,r,i,0,0,0,0,0,1,0],e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.091555084827
9555585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,i,r,s){t=t||.2,e=e||.15,i=i||0xffe580,r=r||3375104;let n=a.Q1.shared,[o,l,h]=n.setValue(i).toArray(),[u,d,c]=n.setValue(r).toArray(),p=[.3,.59,.11,0,0,o,l,h,t,0,u,d,c,e,0,o-u,l-d,h-c,0,0];this._loadMatrix(p,s)}night(t,e){let i=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){this._loadMatrix([11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0],e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}x.prototype.grayscale=x.prototype.greyscale;var b=`varying vec2 vFilterCoord;
96varying vec2 vTextureCoord;
97
98uniform vec2 scale;
99uniform mat2 rotation;
100uniform sampler2D uSampler;
101uniform sampler2D mapSampler;
102
103uniform highp vec4 inputSize;
104uniform vec4 inputClamp;
105
106void main(void)
107{
108  vec4 map =  texture2D(mapSampler, vFilterCoord);
109
110  map -= 0.5;
111  map.xy = scale * inputSize.zw * (rotation * map.xy);
112
113  gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
114}
115`,T=`attribute vec2 aVertexPosition;
116
117uniform mat3 projectionMatrix;
118uniform mat3 filterMatrix;
119
120varying vec2 vTextureCoord;
121varying vec2 vFilterCoord;
122
123uniform vec4 inputSize;
124uniform vec4 outputFrame;
125
126vec4 filterVertexPosition( void )
127{
128    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
129
130    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
131}
132
133vec2 filterTextureCoord( void )
134{
135    return aVertexPosition * (outputFrame.zw * inputSize.zw);
136}
137
138void main(void)
139{
140	gl_Position = filterVertexPosition();
141	vTextureCoord = filterTextureCoord();
142	vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0)  ).xy;
143}
144`;class E extends a.dJ{constructor(t,e){let i=new a.uq;t.renderable=!1,super(T,b,{mapSampler:t._texture,filterMatrix:i,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=i,null==e&&(e=20),this.scale=new a.bR(e,e)}apply(t,e,i,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;let s=this.maskSprite.worldTransform,a=Math.sqrt(s.a*s.a+s.b*s.b),n=Math.sqrt(s.c*s.c+s.d*s.d);0!==a&&0!==n&&(this.uniforms.rotation[0]=s.a/a,this.uniforms.rotation[1]=s.b/a,this.uniforms.rotation[2]=s.c/n,this.uniforms.rotation[3]=s.d/n),t.applyFilter(this,e,i,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var A=`varying vec2 v_rgbNW;
145varying vec2 v_rgbNE;
146varying vec2 v_rgbSW;
147varying vec2 v_rgbSE;
148varying vec2 v_rgbM;
149
150varying vec2 vFragCoord;
151uniform sampler2D uSampler;
152uniform highp vec4 inputSize;
153
154
155/**
156 Basic FXAA implementation based on the code on geeks3d.com with the
157 modification that the texture2DLod stuff was removed since it's
158 unsupported by WebGL.
159
160 --
161
162 From:
163 https://github.com/mitsuhiko/webgl-meincraft
164
165 Copyright (c) 2011 by Armin Ronacher.
166
167 Some rights reserved.
168
169 Redistribution and use in source and binary forms, with or without
170 modification, are permitted provided that the following conditions are
171 met:
172
173 * Redistributions of source code must retain the above copyright
174 notice, this list of conditions and the following disclaimer.
175
176 * Redistributions in binary form must reproduce the above
177 copyright notice, this list of conditions and the following
178 disclaimer in the documentation and/or other materials provided
179 with the distribution.
180
181 * The names of the contributors may not be used to endorse or
182 promote products derived from this software without specific
183 prior written permission.
184
185 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
186 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
187 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
188 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
189 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
190 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
191 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
192 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
193 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
194 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
195 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
196 */
197
198#ifndef FXAA_REDUCE_MIN
199#define FXAA_REDUCE_MIN   (1.0/ 128.0)
200#endif
201#ifndef FXAA_REDUCE_MUL
202#define FXAA_REDUCE_MUL   (1.0 / 8.0)
203#endif
204#ifndef FXAA_SPAN_MAX
205#define FXAA_SPAN_MAX     8.0
206#endif
207
208//optimized version for mobile, where dependent
209//texture reads can be a bottleneck
210vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
211          vec2 v_rgbNW, vec2 v_rgbNE,
212          vec2 v_rgbSW, vec2 v_rgbSE,
213          vec2 v_rgbM) {
214    vec4 color;
215    vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
216    vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
217    vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
218    vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
219    vec4 texColor = texture2D(tex, v_rgbM);
220    vec3 rgbM  = texColor.xyz;
221    vec3 luma = vec3(0.299, 0.587, 0.114);
222    float lumaNW = dot(rgbNW, luma);
223    float lumaNE = dot(rgbNE, luma);
224    float lumaSW = dot(rgbSW, luma);
225    float lumaSE = dot(rgbSE, luma);
226    float lumaM  = dot(rgbM,  luma);
227    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
228    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
229
230    mediump vec2 dir;
231    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
232    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));
233
234    float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
235                          (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
236
237    float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
238    dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
239              max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
240                  dir * rcpDirMin)) * inverseVP;
241
242    vec3 rgbA = 0.5 * (
243                       texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
244                       texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
245    vec3 rgbB = rgbA * 0.5 + 0.25 * (
246                                     texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
247                                     texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
248
249    float lumaB = dot(rgbB, luma);
250    if ((lumaB < lumaMin) || (lumaB > lumaMax))
251        color = vec4(rgbA, texColor.a);
252    else
253        color = vec4(rgbB, texColor.a);
254    return color;
255}
256
257void main() {
258
259      vec4 color;
260
261      color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
262
263      gl_FragColor = color;
264}
265`,S=`
266attribute vec2 aVertexPosition;
267
268uniform mat3 projectionMatrix;
269
270varying vec2 v_rgbNW;
271varying vec2 v_rgbNE;
272varying vec2 v_rgbSW;
273varying vec2 v_rgbSE;
274varying vec2 v_rgbM;
275
276varying vec2 vFragCoord;
277
278uniform vec4 inputSize;
279uniform vec4 outputFrame;
280
281vec4 filterVertexPosition( void )
282{
283    vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
284
285    return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
286}
287
288void texcoords(vec2 fragCoord, vec2 inverseVP,
289               out vec2 v_rgbNW, out vec2 v_rgbNE,
290               out vec2 v_rgbSW, out vec2 v_rgbSE,
291               out vec2 v_rgbM) {
292    v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
293    v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
294    v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
295    v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
296    v_rgbM = vec2(fragCoord * inverseVP);
297}
298
299void main(void) {
300
301   gl_Position = filterVertexPosition();
302
303   vFragCoord = aVertexPosition * outputFrame.zw;
304
305   texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
306}
307`;class w extends a.dJ{constructor(){super(S,A)}}var P=`precision highp float;
308
309varying vec2 vTextureCoord;
310varying vec4 vColor;
311
312uniform float uNoise;
313uniform float uSeed;
314uniform sampler2D uSampler;
315
316float rand(vec2 co)
317{
318    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
319}
320
321void main()
322{
323    vec4 color = texture2D(uSampler, vTextureCoord);
324    float randomValue = rand(gl_FragCoord.xy * uSeed);
325    float diff = (randomValue - 0.5) * uNoise;
326
327    // Un-premultiply alpha before applying the color matrix. See issue #3539.
328    if (color.a > 0.0) {
329        color.rgb /= color.a;
330    }
331
332    color.r += diff;
333    color.g += diff;
334    color.b += diff;
335
336    // Premultiply alpha again.
337    color.rgb *= color.a;
338
339    gl_FragColor = color;
340}
341`;class M extends a.dJ{constructor(t=.5,e=Math.random()){super(a.Eo,P,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}let C={AlphaFilter:p,BlurFilter:y,BlurFilterPass:_,ColorMatrixFilter:x,DisplacementFilter:E,FXAAFilter:w,NoiseFilter:M};
341Object.entries(C).forEach(([t,e])=>{Object.defineProperty(C,t,{get:()=>(a.Wp.deprecation("7.1.0",`filters.${t} has moved to ${t}`),e)})});class D{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(a.Rv.system.add(this.tickerUpdate,this,a.dQ.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(a.Rv.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,this._deltaTime<this.interactionFrequency||(this._deltaTime=0,this.update())}}let R=new D;class I{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=I.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new a.bR,this.page=new a.bR,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,i){throw Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,i,r,s){throw Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}class B extends I{constructor(){super(...arguments),this.client=new a.bR,this.movement=new a.bR,this.offset=new a.bR,this.global=new a.bR,this.screen=new a.bR}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,i){return t.worldTransform.applyInverse(i||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,i,r,s,a,n,o,l,h,u,d,c,p,f){throw Error("Method not implemented.")}}class L extends B{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}getPredictedEvents(){throw Error("getPredictedEvents is not supported!")}}class O extends B{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}O.DOM_DELTA_PIXEL=0,O.DOM_DELTA_LINE=1,O.DOM_DELTA_PAGE=2;let F=new a.bR,k=new a.bR;class N{constructor(t){this.dispatch=new a.Wp.EventEmitter,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((t,e)=>t.priority-e.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.prop
341agate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;let e=this.mappingTable[t.type];if(e)for(let i=0,r=e.length;i<r;i++)e[i].fn(t);else console.warn(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){R.pauseUpdate=!0;let i=this[this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive"](this.rootTarget,this.rootTarget.eventMode,F.set(t,e),this.hitTestFn,this.hitPruneFn);return i&&i[0]}propagate(t,e){if(!t.target)return;let i=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let r=0,s=i.length-1;r<s;r++)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let r=i.length-2;r>=0;r--)if(t.currentTarget=i[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(0===i.length)return;t.eventPhase=t.BUBBLING_PHASE;let r=Array.isArray(e)?e:[e];for(let e=i.length-1;e>=0;e--)r.forEach(r=>{t.currentTarget=i[e],this.notifyTarget(t,r)})}propagationPath(t){let e=[t];for(let i=0;i<2048&&t!==this.rootTarget;i++){if(!t.parent)throw Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,r,s,a=!1){let n=!1;if(this._interactivePrune(t))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(R.pauseUpdate=!1),t.interactiveChildren&&t.children){let o=t.children;for(let l=o.length-1;l>=0;l--){let h=o[l],u=this.hitTestMoveRecursive(h,this._isInteractive(e)?e:h.eventMode,i,r,s,a||s(t,i));if(u){if(u.length>0&&!u[u.length-1].parent)continue;let e=t.isInteractive();(u.length>0||e)&&(e&&this._allInteractiveElements.push(t),u.push(t)),0===this._hitElements.length&&(this._hitElements=u),n=!0}}}let o=this._isInteractive(e),l=t.isInteractive();return o&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:n?this._hitElements:o&&!s(t,i)&&r(t,i)?l?[t]:[]:null}hitTestRecursive(t,e,i,r,s){if(this._interactivePrune(t)||s(t,i))return null;if(("dynamic"===t.eventMode||"dynamic"===e)&&(R.pauseUpdate=!1),t.interactiveChildren&&t.children){let a=t.children;for(let n=a.length-1;n>=0;n--){let o=a[n],l=this.hitTestRecursive(o,this._isInteractive(e)?e:o.eventMode,i,r,s
341);if(l){if(l.length>0&&!l[l.length-1].parent)continue;let e=t.isInteractive();return(l.length>0||e)&&l.push(t),l}}}let a=this._isInteractive(e),n=t.isInteractive();return a&&r(t,i)?n?[t]:[]:null}_isInteractive(t){return"static"===t||"dynamic"===t}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||"none"===t.eventMode||"passive"===t.eventMode&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,k),!t.hitArea.contains(k.x,k.y)))return!0;if(t._mask){let i=t._mask.isMaskData?t._mask.maskObject:t._mask;if(i&&!i.containsPoint?.(e))return!0}return!1}hitTestFn(t,e){return"passive"!==t.eventMode&&(!!t.hitArea||!!t.containsPoint&&t.containsPoint(e))}notifyTarget(t,e){e=e??t.type;let i=`on${e}`;t.currentTarget[i]?.(t);let r=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,r),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof L))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)this.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){let t=2===e.button;this.dispatchEvent(e,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof L))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let i="mouse"===e.pointerType||"pen"===e.pointerType,r=this.trackingData(t.pointerId),s=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&s!==e.target){let r="mousemove"===t.type?"mouseout":"pointerout",a=this.createPointerEvent(t,r,s);if(this.dispatchEvent(a,"pointerout"),i&&this.dispatchEvent(a,"mouseout"),!e.composedPath().includes(s)){let r=this.createPointerEvent(t,"pointerleave",s);for(r.eventPhase=r.AT_TARGET;r.target&&!e.composedPath().includes(r.target);)r.currentTarget=r.target,this.notifyTarget(r),i&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;this.freeEvent(r)}this.freeEvent(a)}if(s!==e.target){let r="mousemove"===t.type?"mouseover":"pointerover",a=this.clonePointerEvent(e,r);this.dispatchEvent(a,"pointerover"),i&&this.dispatchEvent(a,"mouseover");let n=s?.parent;for(;n&&n!==this.rootTarget.parent&&n!==e.target;)n=n.parent;if(!n||n===this.rootTarget.parent){let t=this.clonePointerEvent(e,"pointerenter");for(t.eventPhase=t.AT_TARGET;t.target&&t.target!==s&&t.target!==this.rootTarget.parent;)t.currentTarget=t.target,this.notifyTarget(t),i&&this.notifyTarget(t,"mouseenter"),t.target=t.target.parent;this.freeEvent(t)}this.freeEvent(a)}let a=[],n=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(e,"pointermove"),n&&a.push("globalpointermove"),"touch"===e.pointerType&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),n&&a.push("globaltouchmove")),i&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),n&&a.push("globalmousemove"),this.cursor=e.target?.cursor),a.length>0&&this.all(e,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof L))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");let e=this.trackingData(t.pointerId),i=this.createPointerEvent(t),r="mouse"===i.pointerType||"pen"===i.pointerType;this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover"),"mouse"===i.pointerType&&(this.cursor=i.target?.cursor);let s=this.clonePointerEvent(i,"pointerenter");for(s.eventPhase=s.AT_TARGET;s.target&&s.target!==this.rootTarget.parent;)s.currentTarget=s.target,this.notifyTarget(s),r&&this.notifyTarget(s,"mouseenter"),s.target=s.target.parent;e.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(s)}mapPointerOut(t){if(!(t instanceof L))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");let e=this.trackingData(t.pointerId);if(e.overTargets){let i="mouse"===t.pointerType||"pen"===t.pointerType,r=this.findMountedTarget(e.overTargets),s=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(s),i&&this.dispatchEvent(s,"mouseout");let a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),i&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(s),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof L))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");let e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),"touch"===i.pointerType)this.dispatchEvent(i,"touchend");else if("mouse"===i.pointerType||"pen"===i.pointerType){let t=2===i.button;this.dispatchEvent(i,t?"rightup":"mouseup")}let r=this.trackingData(t.pointerId),s=this.findMountedTarget(r.pressTargetsByButton[t.button]),a=s;if(s&&!i.composedPath().includes(s)){let e=s;for(;e&&!i.composedPath().includes(e);){if(i.currentTarget=e,this.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType)this.notifyTarget(i,"touchendoutside");else if("mouse"===i.pointerType||"pen"===i.pointerType){let t=2===i.button;this.notifyTarget(i,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],a=e}if(a){let s=this.clonePointerEvent(i,"click");s.target=a,s.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:s.target,timeStamp:e});let n=r.clicksByButton[t.button];if(n.target===s.target&&e-n.timeStamp<200?++n.clickCount:n.clickCount=1,n.target=s.target,n.timeStamp=e,s.detail=n.clickCount,"mouse"===s.pointerType){let t=2===s.button;this.dispatchEvent(s,t?"rightclick":"click")}else"touch"===s.pointerType&&this.dispatchEvent(s,"tap");this.dispatchEvent(s,"pointertap"),this.freeEvent(s)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof L))return void console.warn("EventBoundary cannot map a non-pointer event as a pointer event");let e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(i){let s=i;for(;s;)r.currentTarget=s,this.notifyTarget(r,"pointerupoutside"),"touch"===r.pointerType?this.notifyTarget(r,"touchendoutside"):("mouse"===r.pointerType||"pen"===r.pointerType)&&this.notifyTarget(r,2===r.button?"rightupoutside":"mouseupoutside"),s=s.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof O))return void console.warn("EventBoundary cannot map a non-wheel event as a wheel event");let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i<t.length&&t[i].parent===e;i++)e=t[i];return e}createPointerEvent(t,e,i){let r=this.allocateEvent(L);return this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.nativeEvent=t.nativeEvent,r.originalEvent=t,r.target=i??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],"string"==typeof e&&(r.type=e),r}createWheelEvent(t){let e=this.allocateEvent(O);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let i=this.allocateEvent(L);return i.nativeEvent=t.nativeEvent,i.originalEvent=t.originalEvent,this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.target=t.target,i.path=t.composedPath().slice(),i.type=e??i.type,i}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof L&&e instanceof L&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.t
341iltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof B&&e instanceof B&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}notifyListeners(t,e){let i=t.currentTarget._events[e];if(i&&t.currentTarget.isInteractive())if("fn"in i)i.once&&t.currentTarget.removeListener(e,i.fn,void 0,!0),i.fn.call(i.context,t);else for(let r=0,s=i.length;r<s&&!t.propagationImmediatelyStopped;r++)i[r].once&&t.currentTarget.removeListener(e,i[r].fn,void 0,!0),i[r].fn.call(i[r].context,t)}}let U={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},W=class t{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new N(null),R.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new L(null),this.rootWheelEvent=new O(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...t.defaultEventFeatures},{set:(t,e,i)=>("globalMove"===e&&(this.rootBoundary.enableGlobalMoveEvents=i),t[e]=i,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){let{view:i,resolution:r}=this.renderer;this.setTargetElement(i),this.resolution=r,t._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;let i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t<i;t++){let i=e[t],r=this.bootstrapEvent(this.rootPointerEvent,i);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,R.pointerMoved();let e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){let i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let i=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let t=0,e=r.length;t<e;t++){let e=this.bootstrapEvent(this.rootPointerEvent,r[t]);e.type+=i,this.rootBoundary.mapEvent(e)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t<i;t++){let i=this.bootstrapEvent(this.rootPointerEvent,e[t]);this.rootBoundary.mapEvent(i)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this.removeEvents(),this.domElement=t,R.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;R.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,!0),this.domElement.addEventListener("pointerdown",this.onPointerDown,!0),this.domElement.addEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this.onPointerOverOut,!0),globalThis.addEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,!0),this.domElement.addEventListener("mousedown",this.onPointerDown,!0),this.domElement.addEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this.onPointerOverOut,!0),globalThis.addEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this.onPointerDown,!0),this.domElement.addEventListener("touchend",this.onPointerUp,!0),this.domElement.addEventListener("touchmove",this.onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;R.removeTickerListener();let t=this.domElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this.onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this.onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this.onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this.onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,!0),this.domElement.removeEventListener("mousedown",this.onPointerDown,!0),this.domElement.removeEventListener("mouseout",this.onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this.onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this.onPointerDown,!0),this.domElement.removeEventListener("touchend",this.onPointerUp,!0),this.domElement.removeEventListener("touchmove",this.onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(t,e,i){let r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},s=1/this.resolution;t.x=(e-r.left)*(this.domElement.width/r.width)*s,t.y=(i-r.top)*(this.domElement.height/r.height)*s}normalizeToPointerData(t){let e=[];
341if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let i=0,r=t.changedTouches.length;i<r;i++){let r=t.changedTouches[i];typeof r.button>"u"&&(r.button=0),typeof r.buttons>"u"&&(r.buttons=1),typeof r.isPrimary>"u"&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),typeof r.width>"u"&&(r.width=r.radiusX||1),typeof r.height>"u"&&(r.height=r.radiusY||1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="touch"),typeof r.pointerId>"u"&&(r.pointerId=r.identifier||0),typeof r.pressure>"u"&&(r.pressure=r.force||.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),typeof r.layerX>"u"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>"u"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=t.type,e.push(r)}else(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent)))&&(typeof t.isPrimary>"u"&&(t.isPrimary=!0),typeof t.width>"u"&&(t.width=1),typeof t.height>"u"&&(t.height=1),typeof t.tiltX>"u"&&(t.tiltX=0),typeof t.tiltY>"u"&&(t.tiltY=0),typeof t.pointerType>"u"&&(t.pointerType="mouse"),typeof t.pointerId>"u"&&(t.pointerId=1),typeof t.pressure>"u"&&(t.pressure=.5),typeof t.twist>"u"&&(t.twist=0),typeof t.tangentialPressure>"u"&&(t.tangentialPressure=0),t.isNormalized=!0),e.push(t);return e}normalizeWheelEvent(t){let e=this.rootWheelEvent;return this.transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=U[t.type]||t.type),t}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};W.extension={name:"events",type:[a.Ag.RendererSystem,a.Ag.CanvasRendererSystem]},W.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let H=W;function G(t){return"dynamic"===t||"static"===t}a.XO.add(H);let z={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??G(H.defaultEventMode)},set interactive(value){a.Wp.deprecation("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=value,this.eventMode=value?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??H.defaultEventMode},set eventMode(value){this._internalInteractive=G(value),this._internalEventMode=value},isInteractive(){return"static"===this.eventMode||"dynamic"===this.eventMode},interactiveChildren:!0,hitArea:null,addEventListener(t,e,i){let r="boolean"==typeof i&&i||"object"==typeof i&&i.capture,s="object"==typeof i?i.signal:void 0,a="object"==typeof i&&!0===i.once,n="function"==typeof e?void 0:e;t=r?`${t}capture`:t;let o="function"==typeof e?e:e.handleEvent,l=this;s&&s.addEventListener("abort",()=>{l.off(t,o,n)}),a?l.once(t,o,n):l.on(t,o,n)},removeEventListener(t,e,i){let r="boolean"==typeof i&&i||"object"==typeof i&&i.capture,s="function"==typeof e?void 0:e;t=r?`${t}capture`:t,e="function"==typeof e?e:e.handleEvent,this.off(t,e,s)},dispatchEvent(t){if(!(t instanceof I))throw Error("DisplayObject cannot propagate events outside of the Federated Events API");return t.defaultPrevented=!1,t.path=null,t.target=this,t.manager.dispatchEvent(t),!t.defaultPrevented}};n.q9.mixin(z);let X={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};n.q9.mixin(X);
341class j{constructor(t){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(a.Wp.isMobile.tablet||a.Wp.isMobile.phone)&&this.createTouchHook();let e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.position="absolute",e.style.top="0px",e.style.left="0px",e.style.zIndex="2",this.div=e,this.renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){let t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex="2",t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);let e=t.children;if(e)for(let t=0;t<e.length;t++)this.updateAccessibleObjects(e[t])}update(){let t=performance.now();if(a.Wp.isMobile.android.device&&t<this.androidUpdateCount||(this.androidUpdateCount=t+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);let{x:e,y:i,width:r,height:s}=this.renderer.view.getBoundingClientRect(),{width:n,height:o,resolution:l}=this.renderer,h=r/n*l,u=s/o*l,d=this.div;d.style.left=`${e}px`,d.style.top=`${i}px`,d.style.width=`${n}px`,d.style.height=`${o}px`;for(let t=0;t<this.children.length;t++){let e=this.children[t];if(e.renderId!==this.renderId)e._accessibleActive=!1,a.Wp.removeItems(this.children,t,1),this.div.removeChild(e._accessibleDiv),this.pool.push(e._accessibleDiv),e._accessibleDiv=null,t--;else{d=e._accessibleDiv;let t=e.hitArea,i=e.worldTransform;e.hitArea?(d.style.left=`${(i.tx+t.x*i.a)*h}px`,d.style.top=`${(i.ty+t.y*i.d)*u}px`,d.style.width=`${t.width*i.a*h}px`,d.style.height=`${t.height*i.d*u}px`):(t=e.getBounds(),this.capHitArea(t),d.style.left=`${t.x*h}px`,d.style.top=`${t.y*u}px`,d.style.width=`${t.width*h}px`,d.style.height=`${t.height*u}px`,d.title!==e.accessibleTitle&&null!==e.accessibleTitle&&(d.title=e.accessibleTitle),d.getAttribute("aria-label")!==e.accessibleHint&&null!==e.accessibleHint&&d.setAttribute("aria-label",e.accessibleHint)),(e.accessibleTitle!==d.title||e.tabIndex!==d.tabIndex)&&(d.title=e.accessibleTitle,d.tabIndex=e.tabIndex,this.debug&&this.updateDebugHTML(d))}}this.renderId++}updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:i}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}addChild(t){let e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex="2",e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){let{displayObject:i}=t.target,r=this.renderer.events.rootBoundary,s=Object.assign(new I(r),{target:i});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(t=>r.dispatchEvent(s,t))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this.activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}j.extension={name:"accessibility",type:[a.Ag.RendererPlugin,a.Ag.CanvasRendererPlugin]},a.XO.add(j);let V=class t{constructor(e){this.stage=new n.mc,e=Object.assign({forceCanvas:!1},e),this.renderer=(0,a.q5)(e),t._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(e,i){let r=t._plugins.slice(0);r.reverse(),r.forEach(t=>{t.destroy.call(this)}),this.stage.destroy(i),this.stage=null,this.renderer.destroy(e),this.renderer=null}};V._plugins=[];let Y=V;a.XO.handleByList(a.Ag.Application,Y._plugins);class ${static init(t){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{let t,e;if(this._resizeTo){if(this.cancelResize(),this._resizeTo===globalThis.window)t=globalThis.innerWidth,e=globalThis.innerHeight;else{let{clientWidth:i,clientHeight:r}=this._resizeTo;t=i,e=r}this.renderer.resize(t,e),this.render()}},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}$.extension=a.Ag.Application,a.XO.add($);let q={loader:a.Ag.LoadParser,resolver:a.Ag.ResolveParser,cache:a.Ag.CacheParser,detection:a.Ag.DetectionParser};a.XO.handle(a.Ag.Asset,t=>{let e=t.ref;Object.entries(q).filter(([t])=>
341!!e[t]).forEach(([t,i])=>a.XO.add(Object.assign(e[t],{extension:e[t].extension??i})))},t=>{let e=t.ref;Object.keys(q).filter(t=>!!e[t]).forEach(t=>a.XO.remove(e[t]))});class Q{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(t=>{this._assetList.push(t)}),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 i=0;i<e;i++)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())}}function K(t,e){let i=t.split("?")[0],r=a.Wp.path.extname(i).toLowerCase();return Array.isArray(e)?e.includes(r):r===e}let Z=(t,e,i=!1)=>(Array.isArray(t)||(t=[t]),e?t.map(t=>"string"==typeof t||i?e(t):t):t);class J{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){let e=this._cache.get(t);return e||console.warn(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let i,r=Z(t);for(let t=0;t<this.parsers.length;t++){let s=this.parsers[t];if(s.test(e)){i=s.getCacheableAssets(r,e);break}}i||(i={},r.forEach(t=>{i[t]=e}));let s=Object.keys(i),n={cacheKeys:s,keys:r};r.forEach(t=>{this._cacheMap.set(t,n)}),s.forEach(t=>{let r=i?i[t]:e;this._cache.has(t)&&this._cache.get(t)!==r&&console.warn("[Cache] already has key:",t),this._cache.set(t,i[t])}),e instanceof a.gP&&r.forEach(t=>{e.baseTexture!==a.gP.EMPTY.baseTexture&&a.t5.addToCache(e.baseTexture,t),a.gP.addToCache(e,t)})}remove(t){if(!this._cacheMap.has(t))return void console.warn(`[Assets] Asset id ${t} was not found in the Cache`);let e=this._cacheMap.get(t);e.cacheKeys.forEach(t=>{this._cache.delete(t)}),e.keys.forEach(t=>{this._cacheMap.delete(t)})}get parsers(){return this._parsers}}let tt=new J,te=t=>!Array.isArray(t);class ti{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let i={promise:null,parser:null};return i.promise=(async()=>{let r=null,s=null;if(e.loadParser&&((s=this._parserHash[e.loadParser])||console.warn(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!s){for(let i=0;i<this.parsers.length;i++){let r=this.parsers[i];if(r.load&&r.test?.(t,e,this)){s=r;break}}if(!s)return console.warn(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await s.load(t,e,this),i.parser=s;for(let t=0;t<this.parsers.length;t++){let s=this.parsers[t];s.parse&&s.parse&&await s.testParse?.(r,e,this)&&(r=await s.parse(r,e,this)||r,i.parser=s)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0,r={},s=te(t),n=Z(t,t=>({alias:[t],src:t})),o=n.length,l=n.map(async t=>{let s=a.Wp.path.toAbsolute(t.src);if(!r[t.src])try{this.promiseCache[s]||(this.promiseCache[s]=this._getLoadPromiseAndParser(s,t)),r[t.src]=await this.promiseCache[s].promise,e&&e(++i/o)}catch(e){throw delete this.promiseCache[s],delete r[t.src],Error(`[Loader.load] Failed to load ${s}.
342${e}`)}});return await Promise.all(l),s?r[n[0].src]:r}async unload(t){let e=Z(t,t=>({alias:[t],src:t})).map(async t=>{let e=a.Wp.path.toAbsolute(t.src),i=this.promiseCache[e];if(i){let r=await i.promise;delete this.promiseCache[e],i.parser?.unload?.(r,t,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name]&&console.warn(`[Assets] loadParser name conflict "${e.name}"`),{...t,[e.name]:e}),{})}}var tr=(t=>(t[t.Low=0]="Low",t[t.Normal=1]="Normal",t[t.High=2]="High",t))(tr||{});function ts(t,e){if(Array.isArray(e)){for(let i of e)if(t.startsWith(`data:${i}`))return!0;return!1}return t.startsWith(`data:${e}`)}let ta={extension:{type:a.Ag.LoadParser,priority:tr.Low},name:"loadJson",test:t=>ts(t,"application/json")||K(t,".json"),load:async t=>await (await a.W0.ADAPTER.fetch(t)).json()};a.XO.add(ta);let tn={name:"loadTxt",extension:{type:a.Ag.LoadParser,priority:tr.Low},test:t=>ts(t,"text/plain")||K(t,".txt"),load:async t=>await (await a.W0.ADAPTER.fetch(t)).text()};a.XO.add(tn);let to=["normal","bold","100","200","300","400","500","600","700","800","900"],tl=[".ttf",".otf",".woff",".woff2"],th=["font/ttf","font/otf","font/woff","font/woff2"],tu=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function td(t){let e=a.Wp.path.extname(t),i=a.Wp.path.basename(t,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)),r=i.length>0;for(let t of i)if(!t.match(tu)){r=!1;break}let s=i.join(" ");return r||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}let tc=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/,tp={extension:{type:a.Ag.LoadParser,priority:tr.Low},name:"loadWebFont",test:t=>ts(t,th)||K(t,tl),async load(t,e){let i=a.W0.ADAPTER.getFontFaceSet();if(i){let r=[],s=e.data?.family??td(t),a=e.data?.weights?.filter(t=>to.includes(t))??["normal"],n=e.data??{};for(let e=0;e<a.length;e++){let o=a[e],l=new FontFace(s,`url(${tc.test(t)?t:encodeURI(t)})`,{...n,weight:o});await l.load(),i.add(l),r.push(l)}return 1===r.length?r[0]:r}return console.warn("[loadWebFont] FontFace API is not supported. Skipping loading font"),null}
342,unload(t){(Array.isArray(t)?t:[t]).forEach(t=>a.W0.ADAPTER.getFontFaceSet().delete(t))}};a.XO.add(tp);let tf=`(function() {
343  "use strict";
344  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
345  async function checkImageBitmap() {
346    try {
347      if (typeof createImageBitmap != "function")
348        return !1;
349      const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
350      return imageBitmap.width === 1 && imageBitmap.height === 1;
351    } catch {
352      return !1;
353    }
354  }
355  checkImageBitmap().then((result) => {
356    self.postMessage(result);
357  });
358})();
359`,tg=null;class tm{constructor(){tg||(tg=URL.createObjectURL(new Blob([tf],{type:"application/javascript"}))),this.worker=new Worker(tg)}}tm.revokeObjectURL=function(){tg&&(URL.revokeObjectURL(tg),tg=null)};let t_=`(function() {
360  "use strict";
361  async function loadImageBitmap(url) {
362    const response = await fetch(url);
363    if (!response.ok)
364      throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
365    const imageBlob = await response.blob();
366    return await createImageBitmap(imageBlob);
367  }
368  self.onmessage = async (event) => {
369    try {
370      const imageBitmap = await loadImageBitmap(event.data.data[0]);
371      self.postMessage({
372        data: imageBitmap,
373        uuid: event.data.uuid,
374        id: event.data.id
375      }, [imageBitmap]);
376    } catch (e) {
377      self.postMessage({
378        error: e,
379        uuid: event.data.uuid,
380        id: event.data.id
381      });
382    }
383  };
384})();
385`,ty=null;class tv{constructor(){ty||(ty=URL.createObjectURL(new Blob([t_],{type:"application/javascript"}))),this.worker=new Worker(ty)}}tv.revokeObjectURL=function(){ty&&(URL.revokeObjectURL(ty),ty=null)};let tx=0,tb;class tT{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return void 0!==this._isImageBitmapSupported||(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new tm;e.addEventListener("message",i=>{e.terminate(),tm.revokeObjectURL(),t(i.data)})})),this._isImageBitmapSupported}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){void 0===tb&&(tb=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers<tb&&(this._createdWorkers++,(t=new tv().worker).addEventListener("message",t=>{this.complete(t.data),this.returnWorker(t.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){void 0!==t.error?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 i=new Promise((i,r)=>{this.queue.push({id:t,arguments:e,resolve:i,reject:r})});return this.next(),i}next(){if(!this.queue.length)return;let t=this.getWorker();if(!t)return;let e=this.queue.pop(),i=e.id;this.resolveHash[tx]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:tx++,id:i})}}let tE=new tT;function tA(t,e,i){t.resource.internal=!0;let r=new a.gP(t),s=()=>{delete e.promiseCache[i],tt.has(i)&&tt.remove(i)};return r.baseTexture.once("destroyed",()=>{i in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),s())}),r.once("destroyed",()=>{t.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}let tS=[".jpeg",".jpg",".png",".webp",".avif"],tw=["image/jpeg","image/png","image/webp","image/avif"];async function tP(t){let e=await a.W0.ADAPTER.fetch(t);if(!e.ok)throw Error(`[loadImageBitmap] Failed to fetch ${t}: ${e.status} ${e.statusText}`);let i=await e.blob();return await createImageBitmap(i)}let tM={name:"loadTextures",extension:{type:a.Ag.LoadParser,priority:tr.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test:t=>ts(t,tw)||K(t,tS),async load(t,e,i){let r,s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;r=s?this.config.preferWorkers&&await tE.isImageBitmapSupported()?await tE.loadImageBitmap(t):await tP(t):await new Promise((e,i)=>{let r=new Image;r.crossOrigin=this.config.crossOrigin,r.src=t,r.complete?e(r):(r.onload=()=>e(r),r.onerror=t=>i(t))});let n={...e.data};n.resolution??(n.resolution=a.Wp.getResolutionOfUrl(t)),s&&n.resourceOptions?.ownsImageBitmap===void 0&&(n.resourceOptions={...n.resourceOptions},n.resourceOptions.ownsImageBitmap=!0);let o=new a.t5(r,n);return o.resource.src=t,tA(o,i,t)},unload(t){t.destroy(!0)}};a.XO.add(tM);let tC={extension:{type:a.Ag.LoadParser,priority:tr.High},name:"loadSVG",test:t=>ts(t,"image/svg+xml")||K(t,".svg"),testParse:async t=>a.$f.test(t),async parse(t,e,i){let r=new a.$f(t,e?.data?.resourceOptions);await r.load();let s=new a.t5(r,{resolution:a.Wp.getResolutionOfUrl(t),...e?.data});return s.resource.src=e.src,tA(s,i,e.src)},load:async(t,e)=>(await a.W0.ADAPTER.fetch(t)).text(),unload:tM.unload};a.XO.add(tC);let tD=[".mp4",".m4v",".webm",".ogv"],tR=["video/mp4","video/webm","video/ogg"],tI={name:"loadVideo",extension:{type:a.Ag.LoadParser,priority:tr.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test:t=>ts(t,tR)||K(t,tD),async load(t,e,i){let r,s=await (await a.W0.ADAPTER.fetch(t)).blob(),n=URL.createObjectURL(s);try{let s={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...e?.data?.resourceOptions,autoLoad:!0},o=new a.A5(n,s);await o.load();let l=new a.t5(o,{alphaMode:await a.Wp.detectVideoAlphaMode(),resolution:a.Wp.getResolutionOfUrl(t),...e?.data});l.resource.src=t,(r=tA(l,i,t)).baseTexture.once("destroyed",()=>{URL.revokeObjectURL(n)})}catch(t){throw URL.revokeObjectURL(n),t}return r},unload(t){t.destroy(!0)}};function tB(t){let e=t.match(/\{(.*?)\}/g),i=[];if(e){let r=[];e.forEach(t=>{let e=t.substring(1,t.length-1).split(",");r.push(e)}),function t(e,i,r,s,a){let n=i[r];for(let o=0;o<n.length;o++){let l=n[o];r<i.length-1?t(e.replace(s[r],l),i,r+1,s,a):a.push(e.replace(s[r],l))}}(t,r,0,e,i)}else i.push(t);return i}a.XO.add(tI);class tL{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar")))throw Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){"string"==typeof t?this._defaultSearchParams=t:this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join("&")}getAlias(t){let{alias:e,name:i,src:r,srcs:s}=t;return Z(e||i||r||s,t=>"string"==typeof t?t:Array.isArray(t)?t.map(t=>t?.src??t?.srcs??t):t?.src||t?.srcs?t.src??t.srcs:t,!0)}addManifest(t){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEac
385h(t=>{this.addBundle(t.name,t.assets)})}addBundle(t,e){let i=[];Array.isArray(e)?e.forEach(e=>{let r,s=e.src??e.srcs,a=e.alias??e.name;if("string"==typeof a){let e=this._createBundleAssetId(t,a);i.push(e),r=[a,e]}else{let e=a.map(e=>this._createBundleAssetId(t,e));i.push(...e),r=[...a,...e]}this.add({...e,alias:r,src:s})}):Object.keys(e).forEach(r=>{let s=[r,this._createBundleAssetId(t,r)];if("string"==typeof e[r])this.add({alias:s,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:s,src:e[r]});else{let t=e[r],i=t.src??t.srcs;this.add({...t,alias:s,src:Array.isArray(i)?i:[i]})}i.push(...s)}),this._bundles[t]=i}add(t,e,i,r,s){let n,o=[];"string"==typeof t||Array.isArray(t)&&"string"==typeof t[0]?(a.Wp.deprecation("7.2.0",`Assets.add now uses an object instead of individual parameters.
386Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:t,src:e,data:i,format:r,loadParser:s})):Array.isArray(t)?o.push(...t):o.push(t),n=t=>{this.hasKey(t)&&console.warn(`[Resolver] already has key: ${t} overwriting`)},Z(o).forEach(t=>{let{src:e,srcs:i}=t,{data:r,format:s,loadParser:a}=t,o=Z(e||i).map(t=>"string"==typeof t?tB(t):Array.isArray(t)?t:[t]),l=this.getAlias(t);Array.isArray(l)?l.forEach(n):n(l);let h=[];o.forEach(t=>{t.forEach(t=>{let e={};if("object"!=typeof t){e.src=t;for(let i=0;i<this._parsers.length;i++){let r=this._parsers[i];if(r.test(t)){e=r.parse(t);break}}}else r=t.data??r,s=t.format??s,a=t.loadParser??a,e={...e,...t};if(!l)throw Error(`[Resolver] alias is undefined for this asset: ${e.src}`);e=this.buildResolvedAsset(e,{aliases:l,data:r,format:s,loadParser:a}),h.push(e)})}),l.forEach(t=>{this._assetMap[t]=h})})}resolveBundle(t){let e=te(t);t=Z(t);let i={};return t.forEach(t=>{let e=this._bundles[t];if(e){let r=this.resolve(e),s={};for(let e in r){let i=r[e];s[this._extractAssetIdFromBundle(t,e)]=i}i[t]=s}}),e?i[t[0]]:i}resolveUrl(t){let e=this.resolve(t);if("string"!=typeof t){let t={};for(let i in e)t[i]=e[i].src;return t}return e.src}resolve(t){let e=te(t);t=Z(t);let i={};return t.forEach(t=>{if(!this._resolverHash[t])if(this._assetMap[t]){let e=this._assetMap[t],i=e[0],r=this._getPreferredOrder(e);r?.priority.forEach(t=>{r.params[t].forEach(i=>{let r=e.filter(e=>!!e[t]&&e[t]===i);r.length&&(e=r)})}),this._resolverHash[t]=e[0]??i}else this._resolverHash[t]=this.buildResolvedAsset({alias:[t],src:t},{});i[t]=this._resolverHash[t]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let e=t[0],i=this._preferredOrder.find(t=>t.params.format.includes(e.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){let{aliases:i,data:r,loadParser:s,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=a.Wp.path.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=i??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...r||{},...t.data},t.loadParser=s??t.loadParser,t.format=n??t.format??a.Wp.path.extname(t.src).slice(1),t.srcs=t.src,t.name=t.alias,t}}class tO{constructor(){this._detections=[],this._initialized=!1,this.resolver=new tL,this.loader=new ti,this.cache=tt,this._backgroundLoader=new Q(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized)return void console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");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 e=t.manifest;"string"==typeof e&&(e=await this.load(e)),this.resolver.addManifest(e)}let e=t.texturePreference?.resolution??1,i=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:i,resolution:"number"==typeof e?[e]:e}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,i,r,s){this.resolver.add(t,e,i,r,s)}async load(t,e){this._initialized||await this.init();let i=te(t),r=Z(t).map(t=>{if("string"!=typeof t){let e=this.resolver.getAlias(t);return e.some(t=>!this.resolver.hasKey(t))&&this.add(t),Array.isArray(e)?e[0]:e}return this.resolver.hasKey(t)||this.add({alias:t,src:t}),t}),s=this.resolver.resolve(r),a=await this._mapLoadToResolve(s,e);return i?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;"string"==typeof t&&(i=!0,t=[t]);let r=this.resolver.resolveBundle(t),s={},a=Object.keys(r),n=0,o=0,l=()=>{e?.(++n/o)},h=a.map(t=>{let e=r[t];return o+=Object.keys(e).length,this._mapLoadToResolve(e,l).then(e=>{s[t]=e})});return await Promise.all(h),i?s[t[0]]:s}
386async backgroundLoad(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),"string"==typeof t&&(t=[t]),Object.values(this.resolver.resolveBundle(t)).forEach(t=>{this._backgroundLoader.add(Object.values(t))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return tt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=tt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=Object.values(t),r=Object.keys(t);this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let a={};return i.forEach((t,e)=>{let i=s[t.src],n=[t.src];t.alias&&n.push(...t.alias),a[r[e]]=i,tt.set(n,i)}),a}async unload(t){this._initialized||await this.init();let e=Z(t).map(t=>"string"!=typeof t?t.src:t),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Z(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(t=>this._unloadFromResolved(e[t]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(t=>{tt.remove(t.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];for(let i of(t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]),t.detections))t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((t,i)=>e.indexOf(t)===i)}get detections(){return this._detections}get preferWorkers(){return tM.config.preferWorkers}set preferWorkers(t){a.Wp.deprecation("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(e=>e in t).forEach(i=>{e.config[i]=t[i]})})}}let tF=new tO;a.XO.handleByList(a.Ag.LoadParser,tF.loader.parsers).handleByList(a.Ag.ResolveParser,tF.resolver.parsers).handleByList(a.Ag.CacheParser,tF.cache.parsers).handleByList(a.Ag.DetectionParser,tF.detections);let tk={extension:a.Ag.CacheParser,test:t=>Array.isArray(t)&&t.every(t=>t instanceof a.gP),getCacheableAssets:(t,e)=>{let i={};return t.forEach(t=>{e.forEach((e,r)=>{i[t+(0===r?"":r+1)]=e})}),i}};async function tN(t){if("Image"in globalThis)return new Promise(e=>{let i=new Image;i.onload=()=>{e(!0)},i.onerror=()=>{e(!1)},i.src=t});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let e=await (await fetch(t)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}a.XO.add(tk);let tU={extension:{type:a.Ag.DetectionParser,priority:1},test:async()=>tN("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async t=>[...t,"avif"],remove:async t=>t.filter(t=>"avif"!==t)};a.XO.add(tU);let tW={extension:{type:a.Ag.DetectionParser,priority:0},test:async()=>tN("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async t=>[...t,"webp"],remove:async t=>t.filter(t=>"webp"!==t)};a.XO.add(tW);let tH=["png","jpg","jpeg"],tG={extension:{type:a.Ag.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async t=>[...t,...tH],remove:async t=>t.filter(t=>!tH.includes(t))};a.XO.add(tG);let tz="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function tX(t){return!tz&&""!==document.createElement("video").canPlayType(t)}let tj={extension:{type:a.Ag.DetectionParser,priority:0},test:async()=>tX("video/webm"),add:async t=>[...t,"webm"],remove:async t=>t.filter(t=>"webm"!==t)};a.XO.add(tj);let tV={extension:{type:a.Ag.DetectionParser,priority:0},test:async()=>tX("video/mp4"),add:async t=>[...t,"mp4","m4v"],remove:async t=>t.filter(t=>"mp4"!==t&&"m4v"!==t)};a.XO.add(tV);let tY={extension:{type:a.Ag.DetectionParser,priority:0},test:async()=>tX("video/ogg"),add:async t=>[...t,"ogv"],remove:async t=>t.filter(t=>"ogv"!==t)};a.XO.add(tY);let t$={extension:a.Ag.ResolveParser,test:tM.test,parse:t=>({resolution:parseFloat(a.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:a.Wp.path.extname(t).slice(1),src:t})};a.XO.add(t$);let tq=(t,e)=>{let i=e.split("?")[1];return i&&(t+=`?${i}`),t};var tQ=(t=>(t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_
386EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",t[t.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",t[t.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",t[t.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",t))(tQ||{});let tK={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};function tZ(){s={bptc:r.getExtension("EXT_texture_compression_bptc"),astc:r.getExtension("WEBGL_compressed_texture_astc"),etc:r.getExtension("WEBGL_compressed_texture_etc"),s3tc:r.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:r.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:r.getExtension("WEBGL_compressed_texture_etc1"),atc:r.getExtension("WEBGL_compressed_texture_atc")}}let tJ={extension:{type:a.Ag.DetectionParser,priority:2},test:async()=>{let t=a.W0.ADAPTER.createCanvas().getContext("webgl");return t?(r=t,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async t=>{s||tZ();let e=[];for(let t in s)s[t]&&e.push(t);return[...e,...t]},remove:async t=>(s||tZ(),t.filter(t=>!(t in s)))};a.XO.add(tJ);class t0 extends a.dZ{constructor(t,e={width:1,height:1,autoLoad:!0}){let i,r;"string"==typeof t?(i=t,r=new Uint8Array):(i=null,r=t),super(r,e),this.origin=i,this.buffer=r?new a.u3(r):null,this._load=null,this.loaded=!1,null!==this.origin&&!1!==e.autoLoad&&this.load(),null===this.origin&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load||(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new a.u3(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this))),this._load}}class t1 extends t0{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=t1._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||t1._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,i){let r=t.gl;if(!t.context.extensions[this._extension])throw Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let t=0,e=this.levels;t<e;t++){let{levelID:e,levelWidth:i,levelHeight:s,levelBuffer:a}=this._levelBuffers[t];r.compressedTexImage2D(r.TEXTURE_2D,e,this.format,i,s,0,a)}return!0}onBlobLoaded(){this._levelBuffers=t1._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(t){if(t>=33776&&t<=33779)return"s3tc";if(t>=35916&&t<=35919)return"s3tc_sRGB";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(36196===t)return"etc1";
386if(35986===t||35987===t||34798===t)return"atc";if(t>=36492&&t<=36495)return"bptc";if(37808===t)return"astc";throw Error(`Invalid (compressed) texture format given: ${t}`)}static _createLevelBuffers(t,e,i,r,s,a,n){let o=Array(i),l=t.byteOffset,h=a,u=n,d=h+r-1&~(r-1),c=u+s-1&~(s-1),p=d*c*tK[e];for(let a=0;a<i;a++)o[a]={levelID:a,levelWidth:i>1?h:d,levelHeight:i>1?u:c,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,p=(d=(h=h>>1||1)+r-1&~(r-1))*(c=u+s-1&~(s-1))*tK[e];return o}}let t2={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},t3={FOURCC:2},t4={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},t5={0x31545844:tQ.COMPRESSED_RGBA_S3TC_DXT1_EXT,0x33545844:tQ.COMPRESSED_RGBA_S3TC_DXT3_EXT,0x35545844:tQ.COMPRESSED_RGBA_S3TC_DXT5_EXT},t8={70:tQ.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:tQ.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:tQ.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:tQ.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:tQ.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:tQ.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:tQ.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:tQ.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:tQ.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:tQ.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:tQ.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:tQ.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:tQ.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function t9(t){let e=new Uint32Array(t);if(0x20534444!==e[0])throw Error("Invalid DDS file magic word");let i=new Uint32Array(t,0,124/Uint32Array.BYTES_PER_ELEMENT),r=i[t2.HEIGHT],s=i[t2.WIDTH],a=i[t2.MIPMAP_COUNT],n=new Uint32Array(t,t2.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,32/Uint32Array.BYTES_PER_ELEMENT),o=n[1];if(4&o){let i=n[t3.FOURCC];if(0x30315844!==i){let e=t5[i];return[new t1(new Uint8Array(t,128),{format:e,width:s,height:r,levels:a})]}let o=new Uint32Array(e.buffer,128,20/Uint32Array.BYTES_PER_ELEMENT),l=o[t4.DXGI_FORMAT],h=o[t4.RESOURCE_DIMENSION],u=o[t4.MISC_FLAG],d=o[t4.ARRAY_SIZE],c=t8[l];if(void 0===c)throw Error(`DDSParser cannot parse texture data with DXGI format ${l}`);if(4===u)throw Error("DDSParser does not support cubemap textures");if(6===h)throw Error("DDSParser does not supported 3D texture data");let p=[];if(1===d)p.push(new Uint8Array(t,148));else{let e=tK[c],i=0,n=s,o=r;for(let t=0;t<a;t++)i+=Math.max(1,n+3&-4)*Math.max(1,o+3&-4)*e,n>>>=1,o>>>=1;let l=148;for(let e=0;e<d;e++)p.push(new Uint8Array(t,l,i)),l+=i}return p.map(t=>new t1(t,{format:c,width:s,height:r,levels:a}))}throw 64&o?Error("DDSParser does not support uncompressed texture data."):512&o?Error("DDSParser does not supported YUV uncompressed texture data."):131072&o?Error("DDSParser does not support single-channel (lumninance) texture data!"):2&o?Error("DDSParser does not support single-channel (alpha) texture data!"):Error("DDSParser failed to load a texture file due to an unknown reason!")}let t6=[171,75,84,88,32,49,49,187,13,10,26,10],t7={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},et={[a.QE.UNSIGNED_BYTE]:1,[a.QE.UNSIGNED_SHORT]:2,[a.QE.INT]:4,[a.QE.UNSIGNED_INT]:4,[a.QE.FLOAT]:4,[a.QE.HALF_FLOAT]:8},ee={[a.hR.RGBA]:4,[a.hR.RGB]:3,[a.hR.RG]:2,[a.hR.RED]:1,[a.hR.LUMINANCE]:1,[a.hR.LUMINANCE_ALPHA]:2,[a.hR.ALPHA]:1},ei={[a.QE.UNSIGNED_SHORT_4_4_4_4]:2,[a.QE.UNSIGNED_SHORT_5_5_5_1]:2,[a.QE.UNSIGNED_SHORT_5_6_5]:2};function er(t,e,i=!1){let r,s=new DataView(e);if(!function(t,e){for(let i=0;i<t6.length;i++)if(e.getUint8(i)!==t6[i])return console.error(`${t} is not a valid *.ktx file!`),!1;return!0}(t,s))return null;let n=0x4030201===s.getUint32(t7.ENDIANNESS,!0),o=s.getUint32(t7.GL_TYPE,n),l=s.getUint32(t7.GL_FORMAT,n),h=s.getUint32(t7.GL_INTERNAL_FORMAT,n),u=s.getUint32(t7.PIXEL_WIDTH,n),d=s.getUint32(t7.PIXEL_HEIGHT,n)||1,c=s.getUint32(t7.PIXEL_DEPTH,n)||1,p=s.getUint32(t7.NUMBER_OF_ARRAY_ELEMENTS,n)||1,f=s.getUint32(t7.NUMBER_OF_FACES,n),g=s.getUint32(t7.NUMBER_OF_MIPMAP_LEVELS,n),m=s.getUint32(t7.BYTES_OF_KEY_VALUE_DATA,n);if(0===d||1!==c)throw Error("Only 2D textures are supported");if(1!==f)throw Error("CubeTextures are not supported by KTXLoader yet!");if(1!==p)throw Error("WebGL does not support array textures");let _=u+3&-4,y=d+3&-4,v=Array(p),x=u*d;if(0===o&&(x=_*y),void 0===(r=0!==o?et[o]?et[o]*ee[l]:ei[o]:tK[h]))throw Error("Unable to resolve the pixel format stored in the *.ktx file!");
386let b=i?function(t,e,i){let r=new Map,s=0;for(;s<e;){let a=t.getUint32(64+s,i),n=64+s+4,o=3-(a+3)%4;if(0===a||a>e-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l<a&&0!==t.getUint8(n+l);l++);if(-1===l){console.error("KTXLoader: Failed to find null byte terminating kvData key");break}let h=new TextDecoder().decode(new Uint8Array(t.buffer,n,l)),u=new DataView(t.buffer,n+l+1,a-l-1);r.set(h,u),s+=4+a+o}return r}(s,m,n):null,T=x*r,E=u,A=d,S=_,w=y,P=64+m;for(let t=0;t<g;t++){let i=s.getUint32(P,n),a=P+4;for(let i=0;i<p;i++){let r=v[i];r||(r=v[i]=Array(g)),r[t]={levelID:t,levelWidth:g>1||0!==o?E:S,levelHeight:g>1||0!==o?A:w,levelBuffer:new Uint8Array(e,a,T)},a+=T}P+=i+4,P=P%4!=0?P+4-P%4:P,A=A>>1||1,T=(S=(E=E>>1||1)+4-1&-4)*(w=A+4-1&-4)*r}return 0!==o?{uncompressed:v.map(t=>{let e=t[0].levelBuffer,i=!1;return o===a.QE.FLOAT?e=new Float32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4):o===a.QE.UNSIGNED_INT?(i=!0,e=new Uint32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)):o===a.QE.INT&&(i=!0,e=new Int32Array(t[0].levelBuffer.buffer,t[0].levelBuffer.byteOffset,t[0].levelBuffer.byteLength/4)),{resource:new a.dZ(e,{width:t[0].levelWidth,height:t[0].levelHeight}),type:o,format:i?function(t){switch(t){case a.hR.RGBA:return a.hR.RGBA_INTEGER;case a.hR.RGB:return a.hR.RGB_INTEGER;case a.hR.RG:return a.hR.RG_INTEGER;case a.hR.RED:return a.hR.RED_INTEGER;default:return t}}(l):l}}),kvData:b}:{compressed:v.map(t=>new t1(null,{format:h,width:u,height:d,levels:g,levelBuffers:t})),kvData:b}}let es={extension:{type:a.Ag.LoadParser,priority:tr.High},name:"loadDDS",test:t=>K(t,".dds"),async load(t,e,i){let r=t9(await (await a.W0.ADAPTER.fetch(t)).arrayBuffer()).map(r=>tA(new a.t5(r,{mipmap:a.E8.OFF,alphaMode:a.Gk.NO_PREMULTIPLIED_ALPHA,resolution:a.Wp.getResolutionOfUrl(t),...e.data}),i,t));return 1===r.length?r[0]:r},unload(t){Array.isArray(t)?t.forEach(t=>t.destroy(!0)):t.destroy(!0)}};a.XO.add(es);let ea={extension:{type:a.Ag.LoadParser,priority:tr.High},name:"loadKTX",test:t=>K(t,".ktx"),async load(t,e,i){let r=await (await a.W0.ADAPTER.fetch(t)).arrayBuffer(),{compressed:s,uncompressed:n,kvData:o}=er(t,r),l=s??n,h={mipmap:a.E8.OFF,alphaMode:a.Gk.NO_PREMULTIPLIED_ALPHA,resolution:a.Wp.getResolutionOfUrl(t),...e.data},u=l.map(e=>{l===n&&Object.assign(h,{type:e.type,format:e.format});let r=e.resource??e,s=new a.t5(r,h);return s.ktxKeyValueData=o,tA(s,i,t)});return 1===u.length?u[0]:u},unload(t){Array.isArray(t)?t.forEach(t=>t.destroy(!0)):t.destroy(!0)}};a.XO.add(ea);let en=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],eo={extension:a.Ag.ResolveParser,test:t=>["basis","ktx","dds"].includes(a.Wp.path.extname(t).slice(1)),parse:t=>{let e=t.split("."),i=e.pop();if(["ktx","dds"].includes(i)){let i=e.pop();if(en.includes(i))return{resolution:parseFloat(a.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:i,src:t}}return{resolution:parseFloat(a.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:i,src:t}}};a.XO.add(eo);let el=new a.M_,eh=class t{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}async image(t,e,i,r){let s=new Image;return s.src=await this.base64(t,e,i,r),s}async base64(t,e,i,r){let s=this.canvas(t,r);if(void 0!==s.toBlob)return new Promise((t,r)=>{s.toBlob(e=>{if(!e)return void r(Error("ICanvas.toBlob failed!"));let i=new FileReader;i.onload=()=>t(i.result),i.onerror=r,i.readAsDataURL(e)},e,i)});if(void 0!==s.toDataURL)return s.toDataURL(e,i);if(void 0!==s.convertToBlob){let t=await s.convertToBlob({type:e,quality:i});return new Promise((e,i)=>{let r=new FileReader;r.onload=()=>
386e(r.result),r.onerror=i,r.readAsDataURL(t)})}throw Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,i){let{pixels:r,width:s,height:n,flipY:o,premultipliedAlpha:l}=this._rawPixels(e,i);o&&t._flipY(r,s,n),l&&t._unpremultiplyAlpha(r);let h=new a.Wp.CanvasRenderTarget(s,n,1),u=new ImageData(new Uint8ClampedArray(r.buffer),s,n);return h.context.putImageData(u,0,0),h.canvas}pixels(e,i){let{pixels:r,width:s,height:a,flipY:n,premultipliedAlpha:o}=this._rawPixels(e,i);return n&&t._flipY(r,s,a),o&&t._unpremultiplyAlpha(r),r}_rawPixels(t,e){let i=this.renderer;if(!i)throw Error("The Extract has already been destroyed");let r,s=!1,n=!1,o,l=!1;t&&(t instanceof a.Y7?o=t:(o=i.generateTexture(t,{region:e,resolution:i.resolution,multisample:i.multisample}),l=!0,e&&(el.width=e.width,el.height=e.height,e=el)));let h=i.gl;if(o){if(r=o.baseTexture.resolution,e=e??o.frame,s=!1,n=o.baseTexture.alphaMode>0&&o.baseTexture.format===a.hR.RGBA,!l){i.renderTexture.bind(o);let t=o.framebuffer.glFramebuffers[i.CONTEXT_UID];t.blitFramebuffer&&i.framebuffer.bind(t.blitFramebuffer)}}else r=i.resolution,e||((e=el).width=i.width/r,e.height=i.height/r),s=!0,n=this._rendererPremultipliedAlpha,i.renderTexture.bind();let u=Math.max(Math.round(e.width*r),1),d=Math.max(Math.round(e.height*r),1),c=new Uint8Array(4*u*d);return h.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,d,h.RGBA,h.UNSIGNED_BYTE,c),l&&o?.destroy(!0),{pixels:c,width:u,height:d,flipY:s,premultipliedAlpha:n}}destroy(){this.renderer=null}static _flipY(t,e,i){let r=e<<2,s=i>>1,a=new Uint8Array(r);for(let e=0;e<s;e++){let s=e*r,n=(i-e-1)*r;a.set(t.subarray(s,s+r)),t.copyWithin(s,n,n+r),t.set(a,n)}}static _unpremultiplyAlpha(t){t instanceof Uint8ClampedArray&&(t=new Uint8Array(t.buffer));let e=t.length;for(let i=0;i<e;i+=4){let e=t[i+3];if(0!==e){let r=255.001/e;t[i]=t[i]*r+.5,t[i+1]=t[i+1]*r+.5,t[i+2]=t[i+2]*r+.5}}}};eh.extension={name:"extract",type:a.Ag.RendererSystem};let eu=eh;a.XO.add(eu);let ed={build(t){let e,i,r,s,n,o,l=t.points;if(t.type===a.HY.CIRC){let a=t.shape;e=a.x,i=a.y,n=o=a.radius,r=s=0}else if(t.type===a.HY.ELIP){let a=t.shape;e=a.x,i=a.y,n=a.width,o=a.height,r=s=0}else{let a=t.shape,l=a.width/2,h=a.height/2;e=a.x+l,i=a.y+h,n=o=Math.max(0,Math.min(a.radius,Math.min(l,h))),r=l-n,s=h-o}if(!(n>=0&&o>=0&&r>=0&&s>=0)){l.length=0;return}let h=Math.ceil(2.3*Math.sqrt(n+o)),u=8*h+4*!!r+4*!!s;if(l.length=u,0===u)return;if(0===h){l.length=8,l[0]=l[6]=e+r,l[1]=l[3]=i+s,l[2]=l[4]=e-r,l[5]=l[7]=i-s;return}
386let d=0,c=4*h+2*!!r+2,p=c,f=u;{let t=r+n,a=s,o=e+t,h=e-t,u=i+a;if(l[d++]=o,l[d++]=u,l[--c]=u,l[--c]=h,s){let t=i-a;l[p++]=h,l[p++]=t,l[--f]=t,l[--f]=o}}for(let t=1;t<h;t++){let a=Math.PI/2*(t/h),u=r+Math.cos(a)*n,g=s+Math.sin(a)*o,m=e+u,_=e-u,y=i+g,v=i-g;l[d++]=m,l[d++]=y,l[--c]=y,l[--c]=_,l[p++]=_,l[p++]=v,l[--f]=v,l[--f]=m}{let t=r,a=s+o,n=e+t,h=e-t,u=i+a,c=i-a;l[d++]=n,l[d++]=u,l[--f]=c,l[--f]=n,r&&(l[d++]=h,l[d++]=u,l[--f]=c,l[--f]=h)}},triangulate(t,e){let i,r,s=t.points,n=e.points,o=e.indices;if(0===s.length)return;let l=n.length/2,h=l;if(t.type!==a.HY.RREC){let e=t.shape;i=e.x,r=e.y}else{let e=t.shape;i=e.x+e.width/2,r=e.y+e.height/2}let u=t.matrix;n.push(t.matrix?u.a*i+u.c*r+u.tx:i,t.matrix?u.b*i+u.d*r+u.ty:r),l++,n.push(s[0],s[1]);for(let t=2;t<s.length;t+=2)n.push(s[t],s[t+1]),o.push(l++,h,l);o.push(h+1,h,l)}};function ec(t,e=!1){let i=t.length;if(i<6)return;let r=0;for(let e=0,s=t[i-2],a=t[i-1];e<i;e+=2){let i=t[e],n=t[e+1];r+=(i-s)*(n+a),s=i,a=n}if(!e&&r>0||e&&r<=0){let e=i/2;for(let r=e+e%2;r<i;r+=2){let e=i-r-2,s=i-r-1,a=r,n=r+1;[t[e],t[a]]=[t[a],t[e]],[t[s],t[n]]=[t[n],t[s]]}}}let ep={build(t){t.points=t.shape.points.slice()},triangulate(t,e){let i=t.points,r=t.holes,s=e.points,n=e.indices;if(i.length>=6){ec(i,!1);let t=[];for(let e=0;e<r.length;e++){let s=r[e];ec(s.points,!0),t.push(i.length/2),i=i.concat(s.points)}
386let e=a.Wp.earcut(i,t,2);if(!e)return;let o=s.length/2;for(let t=0;t<e.length;t+=3)n.push(e[t]+o),n.push(e[t+1]+o),n.push(e[t+2]+o);for(let t=0;t<i.length;t++)s.push(i[t])}}},ef={build(t){let e=t.shape,i=e.x,r=e.y,s=e.width,a=e.height,n=t.points;n.length=0,s>=0&&a>=0&&n.push(i,r,i+s,r,i+s,r+a,i,r+a)},triangulate(t,e){let i=t.points,r=e.points;if(0===i.length)return;let s=r.length/2;r.push(i[0],i[1],i[2],i[3],i[6],i[7],i[4],i[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},eg={build(t){ed.build(t)},triangulate(t,e){ed.triangulate(t,e)}};var em=(t=>(t.MITER="miter",t.BEVEL="bevel",t.ROUND="round",t))(em||{}),e_=(t=>(t.BUTT="butt",t.ROUND="round",t.SQUARE="square",t))(e_||{});let ey={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(t,e=20){if(!this.adaptive||!t||isNaN(t))return e;let i=Math.ceil(t/this.maxLength);return i<this.minSegments?i=this.minSegments:i>this.maxSegments&&(i=this.maxSegments),i}},ev=ey;class ex{static curveTo(t,e,i,r,s,a){let n=a[a.length-2],o=a[a.length-1]-e,l=n-t,h=r-e,u=i-t,d=Math.abs(o*u-l*h);if(d<1e-8||0===s)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;let c=o*o+l*l,p=h*h+u*u,f=o*h+l*u,g=s*Math.sqrt(c)/d,m=s*Math.sqrt(p)/d,_=g*f/c,y=m*f/p,v=g*u+m*l,x=g*h+m*o,b=Math.atan2(o*(m+_)-x,l*(m+_)-v),T=Math.atan2(h*(g+y)-x,u*(g+y)-v);return{cx:v+t,cy:x+e,radius:s,startAngle:b,endAngle:T,anticlockwise:l*h>u*o}}static arc(t,e,i,r,s,n,o,l,h){let u=o-n,d=ey._segmentsCount(Math.abs(u)*s,40*Math.ceil(Math.abs(u)/a.TO)),c=u/(2*d),p=2*c,f=Math.cos(c),g=Math.sin(c),m=d-1,_=m%1/m;for(let t=0;t<=m;++t){let e=c+n+p*(t+_*t),a=Math.cos(e),o=-Math.sin(e);h.push((f*a+g*o)*s+i,(-(f*o)+g*a)*s+r)}}}class eb{static curveLength(t,e,i,r,s,a,n,o){let l=0,h=0,u=0,d=0,c=0,p=0,f=0,g=0,m=0,_=0,y=0,v=t,x=e;for(let b=1;b<=10;++b)d=(u=(h=b/10)*h)*h,g=(f=(p=(c=1-h)*c)*c)*t+3*p*h*i+3*c*u*s+d*n,m=f*e+3*p*h*r+3*c*u*a+d*o,_=v-g,y=x-m,v=g,x=m,l+=Math.sqrt(_*_+y*y);return l}static curveTo(t,e,i,r,s,a,n){let o=n[n.length-2],l=n[n.length-1];n.length-=2;let h=ey._segmentsCount(eb.curveLength(o,l,t,e,i,r,s,a)),u=0,d=0,c=0,p=0,f=0;n.push(o,l);for(let g=1,m=0;g<=h;++g)c=(d=(u=1-(m=g/h))*u)*u,f=(p=m*m)*m,n.push(c*o+3*d*m*t+3*u*p*i+f*s,c*l+3*d*m*e+3*u*p*r+f*a)}}function eT(t,e,i,r,s,a,n,o){let l,h;n?(l=r,h=-i):(l=-r,h=i);let u=t-i*s+l,d=e-r*s+h,c=t+i*a+l,p=e+r*a+h;return o.push(u,d,c,p),2}function eE(t,e,i,r,s,a,n,o){let l=i-t,h=r-e,u=Math.atan2(l,h),d=Math.atan2(s-t,a-e);o&&u<d?u+=2*Math.PI:!o&&u>d&&(d+=2*Math.PI);let c=u,p=d-u,f=Math.sqrt(l*l+h*h),g=(15*Math.abs(p)*Math.sqrt(f)/Math.PI|0)+1,m=p/g;if(c+=m,o){n.push(t,e,i,r);for(let i=1,r=c;i<g;i++,r+=m)n.push(t,e,t+Math.sin(r)*f,e+Math.cos(r)*f);n.push(t,e,s,a)}else{n.push(i,r,t,e);for(let i=1,r=c;i<g;i++,r+=m)n.push(t+Math.sin(r)*f,e+Math.cos(r)*f,t,e);n.push(s,a,t,e)}return 2*g}function eA(t,e){t.lineStyle.native?function(t,e){let i=0,r=t.shape,s=t.points||r.points,n=r.type!==a.HY.POLY||r.closeStroke;if(0===s.length)return;let o=e.points,l=e.indices,h=s.length/2,u=o.length/2,d=u;for(o.push(s[0],s[1]),i=1;i<h;i++)o.push(s[2*i],s[2*i+1]),l.push(d,d+1),d++;n&&l.push(d,u)}(t,e):function(t,e){let i=t.shape,r=t.points||i.points.slice(),s=e.closePointEps;if(0===r.length)return;let n=t.lineStyle,o=new a.bR(r[0],r[1]),l=new a.bR(r[r.length-2],r[r.length-1]),h=i.type!==a.HY.POLY||i.closeStroke,u=Math.abs(o.x-l.x)<s&&Math.abs(o.y-l.y)<s;if(h){r=r.slice(),u&&(r.pop(),r.pop(),l.set(r[r.length-2],r[r.length-1]));let t=(o.x+l.x)*.5,e=(l.y+o.y)*.5;r.unshift(t,e),r.push(t,e)}let d=e.points,c=r.length/2,p=r.length,f=d.length/2,g=n.width/2,m=g*g,_=n.miterLimit*n.miterLimit,y=r[0],v=r[1],x=r[2],b=r[3],T=0,E=0,A=-(v-b),S=y-x,w=0,P=0,M=Math.sqrt(A*A+S*S);A/=M,S/=M,A*=g,S*=g;let C=n.alignment,D=(1-C)*2,R=2*C;h||(n.cap===e_.ROUND?p+=eE(y-A*(D-R)*.5,v-S*(D-R)*.5,y-A*D,v-S*D,y+A*R,v+S*R,d,!0)+2:n.cap===e_.SQUARE&&(p+=eT(y,v,A,S,D,R,!0,d))),d.push(y-A*D,v-S*D,y+A*R,v+S*R);for(let t=1;t<c-1;++t){y=r[(t-1)*2],v=r[(t-1)*2+1],x=r[2*t],b=r[2*t+1],T=r[(t+1)*2],E=r[(t+1)*2+1],M=Math.sqrt((A=-(v-b))*A+(S=y-x)*S),A/=M,S/=M,A*=g,S*=g,M=Math.sqrt((w=-(b-E))*w+(P=x-T)*P),w/=M,P/=M,w*=g,P*=g;let e=x-y,i=v-b,s=x-T,a=E-b,o=e*s+i*a,l=i*s-a*e,h=l<0;if(Math.abs(l)<.001*Math.abs(o)){d.push(x-A*D,b-S*D,x+A*R,b+S*R),o>=0&&(n.join===em.ROUND?p+=eE(x,b,x-A*D,b-S*D,x-w*D,b-P*D,d,!1)+4:p+=2,d.push(x-w*R,b-P*R,x+w*D,b+P*D));continue}let u=(-A+y)*(-S+b)-(-A+x)*(-S+v),c=(-w+T)*(-P+b)-(-w+x)*(-P+E),f=(e*c-s*u)/l,C=(a*u-i*c)/l,I=(f-x)*(f-x)+(C-b)*(C-b),B=x+(f-x)*D,L=b+(C-b)*D,O=x-(f-x)*R,F=b-(C-b)*R,k=h?D:R,N=I<=Math.min(e*e+i*i,s*s+a*a)+k*k*m,U=n.join;if(U===em.MITER&&I/m>_&&(U=em.BEVEL),N)switch(U){case em.MITER:d.push(B,L,O,F);break;case em.BEVEL:h?d.push(B,L,x+A*R,b+S*R,B,L,x+w*R,b+P*R):d.push(x-A*D,b-S*D,O,F,x-w*D,b-P*D,O,F),p+=2;break;case em.ROUND:h?(d.push(B,L,x+A*R,b+S*R),p+=eE(x,b,x+A*R,b+S*R,x+w*R,b+P*R,d,!0)+4,d.push(B,L,x+w*R,b+P*R)):(d.push(x-A*D,b-S*D,O,F),p+=eE(x,b,x-A*D,b-S*D,x-w*D,b-P*D,d,!1)+4,d.push(x-w*D,b-P*D,O,F))}else{switch(d.push(x-A*D,b-S*D,x+A*R,b+S*R),U){case em.MITER:h?d.push(O,F,O,F):d.push(B,L,B,L),p+=2;break;case em.ROUND:h?p+=eE(x,b,x+A*R,b+S*R,x+w*R,b+P*R,d,!0)+2:p+=eE(x,b,x-A*D,b-S*D,x-w*D,b-P*D,d,!1)+2}d.push(x-w*D,b-P*D,x+w*R,b+P*R),p+=2}}y=r[(c-2)*2],v=r[(c-2)*2+1],x=r[(c-1)*2],M=Math.sqrt((A=-(v-(b=r[(c-1)*2+1])))*A+(S=y-x)*S),A/=M,S/=M,A*=g,S*=g,d.push(x-A*D,b-S*D,x+A*R,b+S*R),h||(n.cap===e_.ROUND?p+=eE(x-A*(D-R)*.5,b-S*(D-R)*.5,x-A*D,b-S*D,x+A*R,b+S*R,d,!1)+2:n.cap===e_.SQUARE&&(p+=eT(x,b,A,S,D,R,!1,d)));let I=e.indices,B=ey.epsilon*ey.epsilon;for(let t=f;t<p+f-2;++t)y=d[2*t],v=d[2*t+1],x=d[(t+1)*2],b=d[(t+1)*2+1],T=d[(t+2)*2],Math.abs(y*(b-(E=d[(t+2)*2+1]))+x*(E-v)+T*(v-b))<B||I.push(t,t+1,t+2)}(t,e)}class eS{static curveLength(t,e,i,r,s,a){let n=t-2*i+s,o=e-2*r+a,l=2*i-2*t,h=2*r-2*e,u=4*(n*n+o*o),d=4*(n*l+o*h),c=l*l+h*h,p=2*Math.sqrt(u+d+c),f=Math.sqrt(u),g=2*u*f,m=2*Math.sqrt(c),_=d/f;
386return(g*p+f*d*(p-m)+(4*c*u-d*d)*Math.log((2*f+_+p)/(_+m)))/(4*g)}static curveTo(t,e,i,r,s){let a=s[s.length-2],n=s[s.length-1],o=ey._segmentsCount(eS.curveLength(a,n,t,e,i,r)),l=0,h=0;for(let u=1;u<=o;++u){let d=u/o;l=a+(t-a)*d,h=n+(e-n)*d,s.push(l+(t+(i-t)*d-l)*d,h+(e+(r-e)*d-h)*d)}}}let ew={[a.HY.POLY]:ep,[a.HY.CIRC]:ed,[a.HY.ELIP]:ed,[a.HY.RECT]:ef,[a.HY.RREC]:eg},eP=[],eM=[];class eC{constructor(t,e=null,i=null,r=null){this.points=[],this.holes=[],this.shape=t,this.lineStyle=i,this.fillStyle=e,this.matrix=r,this.type=t.type}clone(){return new eC(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}}class eD{constructor(){this.reset()}begin(t,e,i){this.reset(),this.style=t,this.start=e,this.attribStart=i}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}let eR=new a.bR,eI=class t extends a.JH{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new n.cz,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),eM.push(this.drawCalls[t]);this.drawCalls.length=0;for(let t=0;t<this.batches.length;t++){let e=this.batches[t];e.reset(),eP.push(e)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,i=null,r=null){let s=new eC(t,e,i,r);return this.graphicsData.push(s),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;let i=new eC(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return i.lineStyle=r.lineStyle,r.holes.push(i),this.dirty++,this}destroy(){super.destroy();for(let t=0;t<this.graphicsData.length;++t)this.graphicsData[t].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(t){let e=this.graphicsData;for(let i=0;i<e.length;++i){let r=e[i];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(t,eR):eR.copyFrom(t),r.shape.contains(eR.x,eR.y))){let t=!1;if(r.holes){for(let e=0;e<r.holes.length;e++)if(r.holes[e].shape.contains(eR.x,eR.y)){t=!0;break}}if(!t)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;let t=this.uvs,e=this.graphicsData,i=null,r=null;this.batches.length>0&&(r=(i=this.batches[this.batches.length-1]).style);for(let s=this.shapeIndex;s<e.length;s++){this.shapeIndex++;let n=e[s],o=n.fillStyle,l=n.lineStyle;ew[n.type].build(n),n.matrix&&this.transformPoints(n.points,n.matrix),(o.visible||l.visible)&&this.processHoles(n.holes);for(let e=0;e<2;e++){let s=0===e?o:l;if(!s.visible)continue;let h=s.texture.baseTexture,u=this.indices.length,d=this.points.length/2;h.wrapMode=a.uR.REPEAT,0===e?this.processFill(n):this.processLine(n);let c=this.points.length/2-d;0!==c&&(i&&!this._compareStyles(r,s)&&(i.end(u,d),i=null),i||((i=eP.pop()||new eD).begin(s,u,d),this.batches.push(i),r=s),this.addUvs(this.points,t,s.texture,d,c,s.matrix))}}let s=this.indices.length,n=this.points.length/2;if(i&&i.end(s,n),0===this.batches.length){this.batchable=!0;return}let o=n>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t<e;t++){let e=this.graphicsData[t],i=e.fillStyle,r=e.lineStyle;if(i&&!i.texture.baseTexture.valid||r&&!r.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);let t=this.batches;for(let e=0,i=t.length;e<i;e++){let i=t[e];for(let t=0;t<i.size;t++){let e=i.start+t;this.indicesUint16[e]=this.indicesUint16[e]-i.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;let e=this.batches;for(let t=0;t<e.length;t++)if(e[t].style.native)return!1;return this.points.length<2*t.BATCHABLE_SIZE}buildDrawCalls(){let t=++a.t5._globalBatch;for(let t=0;t<this.drawCalls.length;t++)this.drawCalls[t].texArray.clear(),eM.push(this.drawCalls[t]);this.drawCalls.length=0;let e=this.colors,i=this.textureIds,r=eM.pop();r||((r=new a.hq).texArray=new a.cc),r.texArray.count=0,r.start=0,r.size=0,r.type=a._4.TRIANGLES;let s=0,n=null,o=0,l=!1,h=a._4.TRIANGLES,u=0;this.drawCalls.push(r);for(let d=0;d<this.batches.length;d++){let c=this.batches[d],p=c.style,f=p.texture.baseTexture;!!p.native!==l&&(h=(l=!!p.native)?a._4.LINES:a._4.TRIANGLES,n=null,s=8,t++),n!==f&&(n=f,f._batchEnabled!==t&&(8===s&&(t++,s=0,r.size>
3860&&((r=eM.pop())||((r=new a.hq).texArray=new a.cc),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=h),f.touched=1,f._batchEnabled=t,f._batchLocation=s,f.wrapMode=a.uR.REPEAT,r.texArray.elements[r.texArray.count++]=f,s++)),r.size+=c.size,u+=c.size,o=f._batchLocation,this.addColors(e,p.color,p.alpha,c.attribSize,c.attribStart),this.addTextureIds(i,o,c.attribSize,c.attribStart)}a.t5._globalBatch=t,this.packAttributes()}packAttributes(){let t=this.points,e=this.uvs,i=this.colors,r=this.textureIds,s=new ArrayBuffer(3*t.length*4),a=new Float32Array(s),n=new Uint32Array(s),o=0;for(let s=0;s<t.length/2;s++)a[o++]=t[2*s],a[o++]=t[2*s+1],a[o++]=e[2*s],a[o++]=e[2*s+1],n[o++]=i[s],a[o++]=r[s];this._buffer.update(s),this._indexBuffer.update(this.indicesUint16)}processFill(t){t.holes.length?ep.triangulate(t,this):ew[t.type].triangulate(t,this)}processLine(t){eA(t,this);for(let e=0;e<t.holes.length;e++)eA(t.holes[e],this)}processHoles(t){for(let e=0;e<t.length;e++){let i=t[e];ew[i.type].build(i),i.matrix&&this.transformPoints(i.points,i.matrix)}}calculateBounds(){let t=this._bounds;t.clear(),t.addVertexData(this.points,0,this.points.length),t.pad(this.boundsPadding,this.boundsPadding)}transformPoints(t,e){for(let i=0;i<t.length/2;i++){let r=t[2*i],s=t[2*i+1];t[2*i]=e.a*r+e.c*s+e.tx,t[2*i+1]=e.b*r+e.d*s+e.ty}}addColors(t,e,i,r,s=0){let n=a.Q1.shared.setValue(e).toLittleEndianNumber(),o=a.Q1.shared.setValue(n).toPremultiplied(i);t.length=Math.max(t.length,s+r);for(let e=0;e<r;e++)t[s+e]=o}addTextureIds(t,e,i,r=0){t.length=Math.max(t.length,r+i);for(let s=0;s<i;s++)t[r+s]=e}addUvs(t,e,i,r,s,a=null){let n=0,o=e.length,l=i.frame;for(;n<s;){let i=t[(r+n)*2],s=t[(r+n)*2+1];if(a){let t=a.a*i+a.c*s+a.tx;s=a.b*i+a.d*s+a.ty,i=t}n++,e.push(i/l.width,s/l.height)}let h=i.baseTexture;(l.width<h.width||l.height<h.height)&&this.adjustUvs(e,i,o,s)}adjustUvs(t,e,i,r){let s=e.baseTexture,a=i+2*r,n=e.frame,o=n.width/s.width,l=n.height/s.height,h=n.x/n.width,u=n.y/n.height,d=Math.floor(t[i]+1e-6),c=Math.floor(t[i+1]+1e-6);for(let e=i+2;
386e<a;e+=2)d=Math.min(d,Math.floor(t[e]+1e-6)),c=Math.min(c,Math.floor(t[e+1]+1e-6));h-=d,u-=c;for(let e=i;e<a;e+=2)t[e]=(t[e]+h)*o,t[e+1]=(t[e+1]+u)*l}};eI.BATCHABLE_SIZE=100;let eB=eI;class eL{constructor(){this.color=0xffffff,this.alpha=1,this.texture=a.gP.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){let t=new eL;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=0xffffff,this.alpha=1,this.texture=a.gP.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}}class eO extends eL{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=e_.BUTT,this.join=em.MITER,this.miterLimit=10}clone(){let t=new eO;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=e_.BUTT,this.join=em.MITER,this.miterLimit=10}}let eF={},ek=class t extends n.mc{constructor(t=null){super(),this.shader=null,this.pluginName="batch",this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new eL,this._lineStyle=new eO,this._matrix=null,this._holeMode=!1,this.state=a.Uw.for2d(),this._geometry=t||new eB,this._geometry.refCount++,this._transformID=-1,this._tintColor=new a.Q1(0xffffff),this.blendMode=a.B9.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new t(this._geometry)}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(t=null,e=0,i,r=.5,s=!1){return"number"==typeof t&&(t={width:t,color:e,alpha:i,alignment:r,native:s}),this.lineTextureStyle(t)}lineTextureStyle(t){t=Object.assign({width:0,texture:a.gP.WHITE,color:0xffffff*!!t?.texture,matrix:null,alignment:.5,native:!1,cap:e_.BUTT,join:em.MITER,miterLimit:10},t),this.normalizeColor(t),this.currentPath&&this.startPoly();let e=t.width>0&&t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:e},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){let t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new a.tS,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new a.tS,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);let i=this.currentPath.points,r=i[i.length-2],s=i[i.length-1];return(r!==t||s!==e)&&i.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,i,r){this._initCurve();let s=this.currentPath.points;return 0===s.length&&this.moveTo(0,0),eS.curveTo(t,e,i,r,s),this}bezierCurveTo(t,e,i,r,s,a){return this._initCurve(),eb.curveTo(t,e,i,r,s,a,this.currentPath.points),this}arcTo(t,e,i,r,s){this._initCurve(t,e);let a=this.currentPath.points,n=ex.curveTo(t,e,i,r,s,a);if(n){let{cx:t,cy:e,radius:i,startAngle:r,endAngle:s,anticlockwise:a}=n;this.arc(t,e,i,r,s,a)}return this}arc(t,e,i,r,s,n=!1){if(r===s||(!n&&s<=r?s+=a.TO:n&&r<=s&&(r+=a.TO),s-r==0))return this;let o=t+Math.cos(r)*i,l=e+Math.sin(r)*i,h=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){let t=Math.abs(u[u.length-2]-o),e=Math.abs(u[u.length-1]-l);t<h&&e<h||u.push(o,l)}else this.moveTo(o,l),u=this.currentPath.points;return ex.arc(o,l,t,e,i,r,s,n,u),this}beginFill(t=0,e){return this.beginTextureFill({texture:a.gP.WHITE,color:t,alpha:e})}normalizeColor(t){let e=a.Q1.shared.setValue(t.color??0);t.color=e.toNumber(),t.alpha??(t.alpha=e.alpha)}beginTextureFill(t){t=Object.assign({texture:a.gP.WHITE,color:0xffffff,matrix:null},t),this.normalizeColor(t),this.currentPath&&this.startPoly();let e=t.alpha>0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,i,r){return this.drawShape(new a.M_(t,e,i,r))}drawRoundedRect(t,e,i,r,s){return this.drawShape(new a.TE(t,e,i,r,s))}drawCircle(t,e,i){return this.drawShape(new a.jl(t,e,i))}drawEllipse(t,e,i,r){return this.drawShape(new a.Pp(t,e,i,r))}drawPolygon(...t){let e,i=!0,r=t[0];r.points?(i=r.closeStroke,e=r.points):e=Array.isArray(t[0])?t[0]:t;let s=new a.tS(e);return s.closeStroke=i,this.drawShape(s),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}
386isFastRect(){let t=this._geometry.graphicsData;return 1===t.length&&t[0].shape.type===a.HY.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();let e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){let t=this._geometry,e=this.blendMode,i=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=i,this.vertexData=new Float32Array(t.points);for(let r=0;r<i;r++){let i=t.batches[r],s=i.style.color,n=new Float32Array(this.vertexData.buffer,4*i.attribStart*2,2*i.attribSize),o=new Float32Array(t.uvsFloat32.buffer,4*i.attribStart*2,2*i.attribSize),l={vertexData:n,blendMode:e,indices:new Uint16Array(t.indicesUint16.buffer,2*i.start,i.size),uvs:o,_batchRGB:a.Q1.shared.setValue(s).toRgbArray(),_tintRGB:s,_texture:i.style.texture,alpha:i.style.alpha,worldAlpha:1};this.batches[r]=l}}_renderBatched(t){if(this.batches.length){t.batch.setObjectRenderer(t.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let e=0,i=this.batches.length;e<i;e++){let i=this.batches[e];i.worldAlpha=this.worldAlpha*i.alpha,t.plugins[this.pluginName].render(i)}}}_renderDirect(t){let e=this._resolveDirectShader(t),i=this._geometry,r=this.worldAlpha,s=e.uniforms,n=i.drawCalls;s.translationMatrix=this.transform.worldTransform,a.Q1.shared.setValue(this._tintColor).premultiply(r).toArray(s.tint),t.shader.bind(e),t.geometry.bind(i,e),t.state.set(this.state);for(let e=0,r=n.length;e<r;e++)this._renderDrawCallDirect(t,i.drawCalls[e])}_renderDrawCallDirect(t,e){let{texArray:i,type:r,size:s,start:a}=e,n=i.count;for(let e=0;e<n;e++)t.texture.bind(i.elements[e],e);t.geometry.draw(r,s,a)}_resolveDirectShader(t){let e=this.shader,i=this.pluginName;if(!e){if(!eF[i]){let{maxTextures:e}=t.plugins[i],r=new Int32Array(e);for(let t=0;t<e;t++)r[t]=t;let s={tint:new Float32Array([1,1,1,1]),translationMatrix:new a.uq,default:a.k2.from({uSamplers:r},!0)},n=t.plugins[i]._shader.program;eF[i]=new a.Mt(n,s)}e=eF[i]}return e}_calculateBounds(){this.finishPoly();let t=this._geometry;if(!t.graphicsData.length)return;let{minX:e,minY:i,maxX:r,maxY:s}=t.bounds;this._bounds.addFrame(this.transform,e,i,r,s)}containsPoint(e){return this.worldTransform.applyInverse(e,t._TEMP_POINT),this._geometry.containsPoint(t._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let t=0;t<this.batches.length;t++){let e=this.batches[t];e._tintRGB=a.Q1.shared.setValue(this._tintColor).multiply(e._batchRGB).toLittleEndianNumber()}}}calculateVertices(){let t=this.transform._worldID;if(this._transformID===t)return;this._transformID=t;let e=this.transform.worldTransform,i=e.a,r=e.b,s=e.c,a=e.d,n=e.tx,o=e.ty,l=this._geometry.points,h=this.vertexData,u=0;for(let t=0;t<l.length;t+=2){let e=l[t],d=l[t+1];h[u++]=i*e+s*d+n,h[u++]=a*d+r*e+o}}closePath(){let t=this.currentPath;return t&&(t.closeStroke=!0,this.finishPoly()),this}setMatrix(t){return this._matrix=t,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(t){this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,
386super.destroy(t)}};ek.curves=ey,ek._TEMP_POINT=new a.bR;let eN=ek,eU={buildPoly:ep,buildCircle:ed,buildRectangle:ef,buildRoundedRectangle:eg,buildLine:eA,ArcUtils:ex,BezierUtils:eb,QuadraticUtils:eS,BatchPart:eD,FILL_COMMANDS:ew,BATCH_POOL:eP,DRAW_CALL_POOL:eM};class eW{constructor(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(t){if(!t&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;let e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}}let eH=new a.bR,eG=new a.tS,ez=class t extends n.mc{constructor(t,e,i,r=a._4.TRIANGLES){super(),this.geometry=t,this.shader=e,this.state=i||a.Uw.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=a.W0.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(t){this.shader=t}get material(){return this.shader}set blendMode(t){this.state.blendMode=t}get blendMode(){return this.state.blendMode}set roundPixels(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t}get roundPixels(){return this._roundPixels}get tint(){return"tint"in this.shader?this.shader.tint:null}set tint(t){this.shader.tint=t}get tintValue(){return this.shader.tintValue}get texture(){return"texture"in this.shader?this.shader.texture:null}set texture(t){this.shader.texture=t}_render(e){let i=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===a._4.TRIANGLES&&i.length<2*t.BATCHABLE_SIZE?this._renderToBatch(e):this._renderDefault(e)}_renderDefault(t){let e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(t){let e=this.geometry,i=this.shader;i.uvMatrix&&(i.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=i._tintRGB,this._texture=i.texture;let r=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[r]),t.plugins[r].render(this)}calculateVertices(){let t=this.geometry.buffers[0],e=t.data,i=t._updateID;if(i===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));let r=this.transform.worldTransform,s=r.a,n=r.b,o=r.c,l=r.d,h=r.tx,u=r.ty,d=this.vertexData;for(let t=0;t<d.length/2;t++){let i=e[2*t],r=e[2*t+1];d[2*t]=s*i+o*r+h,d[2*t+1]=n*i+l*r+u}if(this._roundPixels){let t=a.W0.RESOLUTION;for(let e=0;e<d.length;++e)d[e]=Math.round(d[e]*t)/t}this.vertexDirty=i}calculateUvs(){let t=this.geometry.buffers[1],e=this.shader;e.uvMatrix.isSimple?this.uvs=t.data:(this.batchUvs||(this.batchUvs=new eW(t,e.uvMatrix)),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(t){if(!this.getBounds().contains(t.x,t.y))return!1;this.worldTransform.applyInverse(t,eH);let e=this.geometry.getBuffer("aVertexPosition").data,i=eG.points,r=this.geometry.getIndex().data,s=r.length,a=4===this.drawMode?3:1;for(let t=0;t+2<s;t+=a){let s=2*r[t],a=2*r[t+1],n=2*r[t+2];if(i[0]=e[s],i[1]=e[s+1],i[2]=e[a],i[3]=e[a+1],i[4]=e[n],i[5]=e[n+1],eG.contains(eH.x,eH.y))return!0}return!1}destroy(t){super.destroy(t),this._cachedTexture&&(this._cachedTexture.destroy(),this._cachedTexture=null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};ez.BATCHABLE_SIZE=100;let eX=ez;class ej extends a.V2{constructor(t,e,i){super();let r=new a.hp(t),s=new a.hp(e,!0),n=new a.hp(i,!0,!0);this.addAttribute("aVertexPosition",r,2,!1,a.QE.FLOAT).addAttribute("aTextureCoord",s,2,!1,a.QE.FLOAT).addIndex(n),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}}var eV=`varying vec2 vTextureCoord;
387uniform vec4 uColor;
388
389uniform sampler2D uSampler;
390
391void main(void)
392{
393    gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
394}
395`,eY=`attribute vec2 aVertexPosition;
396attribute vec2 aTextureCoord;
397
398uniform mat3 projectionMatrix;
399uniform mat3 translationMatrix;
400uniform mat3 uTextureMatrix;
401
402varying vec2 vTextureCoord;
403
404void main(void)
405{
406    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
406)).xy, 0.0, 1.0);
407
408    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
409}
410`;class e$ extends a.Mt{constructor(t,e){let i={uSampler:t,alpha:1,uTextureMatrix:a.uq.IDENTITY,uColor:new Float32Array([1,1,1,1])};(e=Object.assign({tint:0xffffff,alpha:1,pluginName:"batch"},e)).uniforms&&Object.assign(i,e.uniforms),super(e.program||a.BP.from(eY,eV),i),this._colorDirty=!1,this.uvMatrix=new a.NW(t),this.batchable=void 0===e.program,this.pluginName=e.pluginName,this._tintColor=new a.Q1(e.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=e.alpha}get texture(){return this.uniforms.uSampler}set texture(t){this.uniforms.uSampler!==t&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!t.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=t,this.uvMatrix.texture=t)}set alpha(t){t!==this._alpha&&(this._alpha=t,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(t){t!==this.tint&&(this._tintColor.setValue(t),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;let t=this.texture.baseTexture.alphaMode;a.Q1.shared.setValue(this._tintColor).premultiply(this._alpha,t).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}}class eq extends ej{constructor(t=100,e=100,i=10,r=10){super(),this.segWidth=i,this.segHeight=r,this.width=t,this.height=e,this.build()}build(){let t=this.segWidth*this.segHeight,e=[],i=[],r=[],s=this.segWidth-1,a=this.segHeight-1,n=this.width/s,o=this.height/a;for(let r=0;r<t;r++){let t=r%this.segWidth,l=r/this.segWidth|0;e.push(t*n,l*o),i.push(t/s,l/a)}let l=s*a;for(let t=0;t<l;t++){let e=t%s,i=t/s|0,a=i*this.segWidth+e,n=i*this.segWidth+e+1,o=(i+1)*this.segWidth+e,l=(i+1)*this.segWidth+e+1;r.push(a,n,o,n,l,o)}this.buffers[0].data=new Float32Array(e),this.buffers[1].data=new Float32Array(i),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}}class eQ extends ej{constructor(t=200,e,i=0){super(new Float32Array(4*e.length),new Float32Array(4*e.length),new Uint16Array((e.length-1)*6)),this.points=e,this._width=t,this.textureScale=i,this.build()}get width(){return this._width}build(){let t=this.points;if(!t)return;let e=this.getBuffer("aVertexPosition"),i=this.getBuffer("aTextureCoord"),r=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),r.data=new Uint16Array((t.length-1)*6));let s=i.data,a=r.data;s[0]=0,s[1]=0,s[2]=0,s[3]=1;let n=0,o=t[0],l=this._width*this.textureScale,h=t.length;for(let e=0;e<h;e++){let i=4*e;if(this.textureScale>0){let i=o.x-t[e].x,r=o.y-t[e].y,s=Math.sqrt(i*i+r*r);o=t[e],n+=s/l}else n=e/(h-1);s[i]=n,s[i+1]=0,s[i+2]=n,s[i+3]=1}let u=0;for(let t=0;t<h-1;t++){let e=2*t;a[u++]=e,a[u++]=e+1,a[u++]=e+2,a[u++]=e+2,a[u++]=e+1,a[u++]=e+3}i.update(),r.update(),this.updateVertices()}updateVertices(){let t=this.points;if(t.length<1)return;let e=t[0],i,r=0,s=0,a=this.buffers[0].data,n=t.length,o=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<n;l++){let h=t[l],u=4*l;s=-((i=l<t.length-1?t[l+1]:h).x-e.x),r=i.y-e.y;let d=(1-l/(n-1))*10;d>1&&(d=1);let c=Math.sqrt(r*r+s*s);c<1e-6?(r=0,s=0):(r/=c,s/=c,r*=o,s*=o),a[u]=h.x+r,a[u+1]=h.y+s,a[u+2]=h.x-r,a[u+3]=h.y-s,e=h}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class eK extends eX{constructor(t,e,i){super(new eq(t.width,t.height,e,i),new e$(a.gP.WHITE)),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;let t=this.geometry,{width:e,height:i}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==i)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}class eZ extends eK{constructor(t,e,i,r,s){super(a.gP.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWi
410dth=e??t.defaultBorders?.left??10,this._rightWidth=r??t.defaultBorders?.right??10,this._topHeight=i??t.defaultBorders?.top??10,this._bottomHeight=s??t.defaultBorders?.bottom??10,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){let t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){let t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){let t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,i=this._topHeight+this._bottomHeight;return Math.min(e,this._height>i?1:this._height/i)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){let t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;let i=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=i*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-i*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class eJ extends eX{constructor(t=a.gP.EMPTY,e,i,r,s){let n=new ej(e,i,r);n.getBuffer("aVertexPosition").static=!1,super(n,new e$(t),null,s),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class e0 extends eX{constructor(t,e,i=0){let r=new eQ(t.height,e,i),s=new e$(t);i>0&&(t.baseTexture.wrapMode=a.uR.REPEAT),super(r,s),this.autoUpdate=!0}_render(t){let e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class e1 extends n.mc{constructor(t=1500,e,i=16384,r=!1){super(),i>16384&&(i=16384),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=i,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=a.B9.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new a.Q1(0),this.tintRgb=new Float32Array(3),this.tint=0xffffff}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){let e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.length<e;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[e]=++this._updateID}dispose(){if(this._buffers){for(let t=0;t<this._buffers.length;++t)this._buffers[t].destroy();this._buffers=null}}destroy(t){super.destroy(t),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}}class e2{constructor(t,e,i){this.geometry=new a.V2,this.indexBuffer=null,this.size=i,this.dynamicProperties=[],this.staticProperties=[];for(let i=0;i<t.length;++i){let r=t[i];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||a.QE.FLOAT,offset:r.offset},e[i]?this.dynamicProperties.push(r):this.staticProperties.push(r)}
410this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){let t=this.geometry,e=0;this.indexBuffer=new a.hp(a.Wp.createIndicesForQuads(this.size),!0,!0),t.addIndex(this.indexBuffer),this.dynamicStride=0;for(let t=0;t<this.dynamicProperties.length;++t){let i=this.dynamicProperties[t];i.offset=e,e+=i.size,this.dynamicStride+=i.size}let i=new ArrayBuffer(this.size*this.dynamicStride*16);this.dynamicData=new Float32Array(i),this.dynamicDataUint32=new Uint32Array(i),this.dynamicBuffer=new a.hp(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let t=0;t<this.staticProperties.length;++t){let e=this.staticProperties[t];e.offset=r,r+=e.size,this.staticStride+=e.size}let s=new ArrayBuffer(this.size*this.staticStride*16);this.staticData=new Float32Array(s),this.staticDataUint32=new Uint32Array(s),this.staticBuffer=new a.hp(this.staticData,!0,!1);for(let e=0;e<this.dynamicProperties.length;++e){let i=this.dynamicProperties[e];t.addAttribute(i.attributeName,this.dynamicBuffer,0,i.type===a.QE.UNSIGNED_BYTE,i.type,4*this.dynamicStride,4*i.offset)}for(let e=0;e<this.staticProperties.length;++e){let i=this.staticProperties[e];t.addAttribute(i.attributeName,this.staticBuffer,0,i.type===a.QE.UNSIGNED_BYTE,i.type,4*this.staticStride,4*i.offset)}}uploadDynamic(t,e,i){for(let r=0;r<this.dynamicProperties.length;r++){let s=this.dynamicProperties[r];s.uploadFunction(t,e,i,s.type===a.QE.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,s.offset)}this.dynamicBuffer._updateID++}uploadStatic(t,e,i){for(let r=0;r<this.staticProperties.length;r++){let s=this.staticProperties[r];s.uploadFunction(t,e,i,s.type===a.QE.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,s.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}}var e3=`varying vec2 vTextureCoord;
411varying vec4 vColor;
412
413uniform sampler2D uSampler;
414
415void main(void){
416    vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
417    gl_FragColor = color;
418}`,e4=`attribute vec2 aVertexPosition;
419attribute vec2 aTextureCoord;
420attribute vec4 aColor;
421
422attribute vec2 aPositionCoord;
423attribute float aRotation;
424
425uniform mat3 translationMatrix;
426uniform vec4 uColor;
427
428varying vec2 vTextureCoord;
429varying vec4 vColor;
430
431void main(void){
432    float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
433    float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
434
435    vec2 v = vec2(x, y);
436    v = v + aPositionCoord;
437
438    gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
439
440    vTextureCoord = aTextureCoord;
441    vColor = aColor * uColor;
442}
443`;class e5 extends a.Pt{constructor(t){super(t),this.shader=null,this.properties=null,this.tempMatrix=new a.uq,this.properties=[{attributeName:"aVertexPosition",size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:"aPositionCoord",size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:"aRotation",size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:"aTextureCoord",size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:"aColor",size:1,type:a.QE.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=a.Mt.from(e4,e3,{}),this.state=a.Uw.for2d()}render(t){let e=t.children,i=t._maxSize,r=t._batchSize,s=this.renderer,n=e.length;if(0===n)return;n>i&&!t.autoResize&&(n=i);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));let l=e[0]._texture.baseTexture,h=l.alphaMode>0;this.state.blendMode=a.Wp.correctBlendMode(t.blendMode,h),s.state.set(this.state);let u=s.gl,d=t.worldTransform.copyTo(this.tempMatrix);d.prepend(s.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=d.toArray(!0),this.shader.uniforms.uColor=a.Q1.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,h).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=l,this.renderer.shader.bind(this.shader);let c=!1;for(let i=0,a=0;i<n;i+=r,a+=1){let l=n-i;l>r&&(l=r),a>=o.length&&o.push(this._generateOneMoreBuffer(t));let h=o[a];h.uploadDynamic(e,i,l);let d=t._bufferUpdateIDs[a]||0;(c=c||h._updateID<d)&&(h._updateID=t._updateID,h.uploadStatic(e,i,l)),s.geometry.bind(h.geometry),u.drawElements(u.TRIANGLES,6*l,u.UNSIGNED_SHORT,0)}}generateBuffers(t){let e=[],i=t._maxSize,r=t._batchSize,s=t._properties;for(let t=0;t<i;t+=r)e.push(new e2(this.properties,s,r));return e}_generateOneMoreBuffer(t){let e=t._batchSize,i=t._properties;return new e2(this.properties,i,e)}uploadVertices(t,e,i,r,s,a){let n=0,o=0,l=0,h=0;for(let u=0;u<i;++u){let i=t[e+u],d=i._texture,c=i.scale.x,p=i.scale.y,f=d.trim,g=d.orig;f?(n=(o=f.x-i.anchor.x*g.width)+f.width,l=(h=f.y-i.anchor.y*g.height)+f.height):(n=g.width*(1-i.anchor.x),o=-(g.width*i.anch
443or.x),l=g.height*(1-i.anchor.y),h=-(g.height*i.anchor.y)),r[a]=o*c,r[a+1]=h*p,r[a+s]=n*c,r[a+s+1]=h*p,r[a+2*s]=n*c,r[a+2*s+1]=l*p,r[a+3*s]=o*c,r[a+3*s+1]=l*p,a+=4*s}}uploadPosition(t,e,i,r,s,a){for(let n=0;n<i;n++){let i=t[e+n].position;r[a]=i.x,r[a+1]=i.y,r[a+s]=i.x,r[a+s+1]=i.y,r[a+2*s]=i.x,r[a+2*s+1]=i.y,r[a+3*s]=i.x,r[a+3*s+1]=i.y,a+=4*s}}uploadRotation(t,e,i,r,s,a){for(let n=0;n<i;n++){let i=t[e+n].rotation;r[a]=i,r[a+s]=i,r[a+2*s]=i,r[a+3*s]=i,a+=4*s}}uploadUvs(t,e,i,r,s,a){for(let n=0;n<i;++n){let i=t[e+n]._texture._uvs;i?(r[a]=i.x0,r[a+1]=i.y0,r[a+s]=i.x1,r[a+s+1]=i.y1,r[a+2*s]=i.x2,r[a+2*s+1]=i.y2,r[a+3*s]=i.x3,r[a+3*s+1]=i.y3):(r[a]=0,r[a+1]=0,r[a+s]=0,r[a+s+1]=0,r[a+2*s]=0,r[a+2*s+1]=0,r[a+3*s]=0,r[a+3*s+1]=0),a+=4*s}}uploadTint(t,e,i,r,s,n){for(let o=0;o<i;++o){let i=t[e+o],l=a.Q1.shared.setValue(i._tintRGB).toPremultiplied(i.alpha,i.texture.baseTexture.alphaMode>0);r[n]=l,r[n+s]=l,r[n+2*s]=l,r[n+3*s]=l,n+=4*s}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}e5.extension={name:"particle",type:a.Ag.RendererPlugin},a.XO.add(e5);var e8=(t=>(t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",t))(e8||{});let e9={willReadFrequently:!0},e6=class t{static get experimentalLetterSpacingSupported(){let e=t._experimentalLetterSpacingSupported;if(void 0!==e){let i=a.W0.ADAPTER.getCanvasRenderingContext2D().prototype;e=t._experimentalLetterSpacingSupported="letterSpacing"in i||"textLetterSpacing"in i}return e}constructor(t,e,i,r,s,a,n,o,l){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=s,this.lineWidths=a,this.lineHeight=n,this.maxLineWidth=o,this.fontProperties=l}static measureText(e,i,r,s=t._canvas){r=r??i.wordWrap;let a=i.toFontString(),n=t.measureFont(a);0===n.fontSize&&(n.fontSize=i.fontSize,n.ascent=i.fontSize);let o=s.getContext("2d",e9);o.font=a;let l=(r?t.wordWrap(e,i,s):e).split(/(?:\r\n|\r|\n)/),h=Array(l.length),u=0;for(let e=0;e<l.length;e++){let r=t._measureText(l[e],i.letterSpacing,o);h[e]=r,u=Math.max(u,r)}let d=u+i.strokeThickness;i.dropShadow&&(d+=i.dropShadowDistance);let c=i.lineHeight||n.fontSize+i.strokeThickness,p=Math.max(c,n.fontSize+2*i.strokeThickness)+i.leading+(l.length-1)*(c+i.leading);return i.dropShadow&&(p+=i.dropShadowDistance),new t(e,i,d,p,l,h,c+i.leading,u,n)}static _measureText(e,i,r){let s=!1;t.experimentalLetterSpacingSupported&&(t.experimentalLetterSpacing?(r.letterSpacing=`${i}px`,r.textLetterSpacing=`${i}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let a=r.measureText(e).width;return a>0&&(s?a-=i:a+=(t.graphemeSegmenter(e).length-1)*i),a}static wordWrap(e,i,r=t._canvas){let s=r.getContext("2d",e9),a=0,n="",o="",l=Object.create(null),{letterSpacing:h,whiteSpace:u}=i,d=t.collapseSpaces(u),c=t.collapseNewlines(u),p=!d,f=i.wordWrapWidth+h,g=t.tokenize(e);for(let e=0;e<g.length;e++){let r=g[e];if(t.isNewline(r)){if(!c){o+=t.addLine(n),p=!d,n="",a=0;continue}r=" "}if(d){let e=t.isBreakingSpace(r),i=t.isBreakingSpace(n[n.length-1]);if(e&&i)continue}let u=t.getFromCache(r,h,l,s);if(u>f)if(""!==n&&(o+=t.addLine(n),n="",a=0),t.canBreakWords(r,i.breakWords)){let e=t.wordWrapSplit(r);for(let u=0;u<e.length;u++){let d=e[u],c=d,g=1;for(;e[u+g];){let s=e[u+g];if(t.canBreakChars(c,s,r,u,i.breakWords))break;d+=s,c=s,g++}u+=g-1;let m=t.getFromCache(d,h,l,s);m+a>f&&(o+=t.addLine(n),p=!1,n="",a=0),n+=d,a+=m}}else{n.length>0&&(o+=t.addLine(n),n="",a=0);let i=e===g.length-1;o+=t.addLine(r,!i),p=!1,n="",a=0}else u+a>f&&(p=!1,o+=t.addLine(n),n="",a=0),(n.length>0||!t.isBreakingSpace(r)||p)&&(n+=r,a+=u)}return o+t.addLine(n,!1)}static addLine(e,i=!0){return e=t.trimRight(e),e=i?`${e}
444`:e}static getFromCache(e,i,r,s){let a=r[e];return"number"!=typeof a&&(a=t._measureText(e,i,s)+i,r[e]=a),a}static collapseSpaces(t){return"normal"===t||"pre-line"===t}static collapseNewlines(t){return"normal"===t}static trimRight(e){if("string"!=typeof e)return"";for(let i=e.length-1;i>=0;i--){let r=e[i];if(!t.isBreakingSpace(r))break;e=e.slice(0,-1)}return e}static isNewline(e){return"string"==typeof e&&t._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,i){return"string"==typeof e&&t._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){let i=[],r="";if("string"!=typeof e)return i;for(let s=0;s<e.length;s++){let a=e[s],n=e[s+1];if(t.isBreakingSpace(a,n)||t.isNewline(a)){""!==r&&(i.push(r),r=""),i.push(a);continue}r+=a}return""!==r&&i.push(r),i}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,s){return!0}static wordWrapSplit(e){return t.graphemeSegmenter(e)}static measureFont(e){if(t._fonts[e])return t._fonts[e];let i={ascent:0,descent:0,fontSize:0},r=t._canvas,s=t._context;s.font=e;let a=t.METRICS_STRING+t.BASELINE_SYMBOL,n=Math.ceil(s.measureText(a).width),o=Math.ceil(s.measureText(t.BASELINE_SYMBOL).width),l=Math.ceil(t.HEIGHT_MULTIPLIER*o);if(o=o*t.BASELINE_MULTIPLIER|0,0===n||0===l)return t._fonts[e]=i,i;
444r.width=n,r.height=l,s.fillStyle="#f00",s.fillRect(0,0,n,l),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(a,0,o);let h=s.getImageData(0,0,n,l).data,u=h.length,d=4*n,c=0,p=0,f=!1;for(c=0;c<o;++c){for(let t=0;t<d;t+=4)if(255!==h[p+t]){f=!0;break}if(f)break;p+=d}for(i.ascent=o-c,p=u-d,f=!1,c=l;c>o;--c){for(let t=0;t<d;t+=4)if(255!==h[p+t]){f=!0;break}if(f)break;p-=d}return i.descent=c-o,i.fontSize=i.ascent+i.descent,t._fonts[e]=i,i}static clearMetrics(e=""){e?delete t._fonts[e]:t._fonts={}}static get _canvas(){if(!t.__canvas){let e;try{let i=new OffscreenCanvas(0,0);if(i.getContext("2d",e9)?.measureText)return t.__canvas=i,i;e=a.W0.ADAPTER.createCanvas()}catch{e=a.W0.ADAPTER.createCanvas()}e.width=e.height=10,t.__canvas=e}return t.__canvas}static get _context(){return t.__context||(t.__context=t._canvas.getContext("2d",e9)),t.__context}};e6.METRICS_STRING="|\xc9q\xc5",e6.BASELINE_SYMBOL="M",e6.BASELINE_MULTIPLIER=1.4,e6.HEIGHT_MULTIPLIER=2,e6.graphemeSegmenter=(()=>{if("function"==typeof Intl?.Segmenter){let t=new Intl.Segmenter;return e=>[...t.segment(e)].map(t=>t.segment)}return t=>[...t]})(),e6.experimentalLetterSpacing=!1,e6._fonts={},e6._newlines=[10,13],e6._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let e7=e6,it=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ie=class t{constructor(t){this.styleID=0,this.reset(),is(this,t,t)}clone(){let e={};return is(e,this,t.defaultStyle),new t(e)}reset(){is(this,t.defaultStyle,t.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){let e=ir(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){let e=ir(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(t[i]!==e[i])return!1;return!0})(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){let e=ir(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){let t="number"==typeof this.fontSize?`${this.fontSize}px`:this.fontSize,e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let t=e.length-1;t>=0;t--){let i=e[t].trim();/([\"\'])[^\'\"]+\1/.test(i)||it.includes(i)||(i=`"${i}"`),e[t]=i}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};ie.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:e8.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ii=ie;function ir(t){let e=a.Q1.shared,i=t=>{let i=e.setValue(t);return 1===i.alpha?i.toHex():i.toRgbaString()};return Array.isArray(t)?t.map(i):i(t)}
444function is(t,e,i){for(let r in i)Array.isArray(e[r])?t[r]=e[r].slice():t[r]=e[r]}let ia={texture:!0,children:!1,baseTexture:!0},io=class t extends h{constructor(e,i,r){let s=!1;r||(r=a.W0.ADAPTER.createCanvas(),s=!0),r.width=3,r.height=3;let n=a.gP.from(r);n.orig=new a.M_,n.trim=new a.M_,super(n),this._ownCanvas=s,this.canvas=r,this.context=r.getContext("2d",{willReadFrequently:!0}),this._resolution=t.defaultResolution??a.W0.RESOLUTION,this._autoResolution=t.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font="",this.text=e,this.style=i,this.localStyleID=-1}static get experimentalLetterSpacing(){return e7.experimentalLetterSpacing}static set experimentalLetterSpacing(t){a.Wp.deprecation("7.1.0","Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing"),e7.experimentalLetterSpacing=t}updateText(t){let e,i,r=this._style;if(this.localStyleID!==r.styleID&&(this.dirty=!0,this.localStyleID=r.styleID),!this.dirty&&t)return;this._font=this._style.toFontString();let s=this.context,n=e7.measureText(this._text||" ",this._style,this._style.wordWrap,this.canvas),o=n.width,l=n.height,h=n.lines,u=n.lineHeight,d=n.lineWidths,c=n.maxLineWidth,p=n.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,o)+2*r.padding)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,l)+2*r.padding)*this._resolution),s.scale(this._resolution,this._resolution),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.font=this._font,s.lineWidth=r.strokeThickness,s.textBaseline=r.textBaseline,s.lineJoin=r.lineJoin,s.miterLimit=r.miterLimit;let f=r.dropShadow?2:1;for(let t=0;t<f;++t){let o=r.dropShadow&&0===t,f=o?Math.ceil(Math.max(1,l)+2*r.padding):0,g=f*this._resolution;if(o){s.fillStyle="black",s.strokeStyle="black";let t=r.dropShadowColor,e=r.dropShadowBlur*this._resolution,i=r.dropShadowDistance*this._resolution;s.shadowColor=a.Q1.shared.setValue(t).setAlpha(r.dropShadowAlpha).toRgbaString(),s.shadowBlur=e,s.shadowOffsetX=Math.cos(r.dropShadowAngle)*i,s.shadowOffsetY=Math.sin(r.dropShadowAngle)*i+g}else s.fillStyle=this._generateFillStyle(r,h,n),s.strokeStyle=r.stroke,s.shadowColor="black",s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0;let m=(u-p.fontSize)/2;u-p.fontSize<0&&(m=0);for(let t=0;t<h.length;t++)e=r.strokeThickness/2,i=r.strokeThickness/2+t*u+p.ascent+m,"right"===r.align?e+=c-d[t]:"center"===r.align&&(e+=(c-d[t])/2),r.stroke&&r.strokeThickness&&this.drawLetterSpacing(h[t],e+r.padding,i+r.padding-f,!0),r.fill&&this.drawLetterSpacing(h[t],e+r.padding,i+r.padding-f)}this.updateTexture()}drawLetterSpacing(t,e,i,r=!1){let s=this._style.letterSpacing,a=!1;if(e7.experimentalLetterSpacingSupported&&(e7.experimentalLetterSpacing?(this.context.letterSpacing=`${s}px`,this.context.textLetterSpacing=`${s}px`,a=!0):(this.context.letterSpacing="0px",this.context.textLetterSpacing="0px")),0===s||a)return void(r?this.context.strokeText(t,e,i):this.context.fillText(t,e,i));let n=e,o=e7.graphemeSegmenter(t),l=this.context.measureText(t).width,h=0;for(let t=0;t<o.length;++t){let e=o[t];r?this.context.strokeText(e,n,i):this.context.fillText(e,n,i);let a="";for(let e=t+1;e<o.length;++e)a+=o[e];n+=l-(h=this.context.measureText(a).width)+s,l=h}}updateTexture(){let t=this.canvas;if(this._style.trim){let e=a.Wp.trimCanvas(t);e.data&&(t.width=e.width,t.height=e.height,this.context.putImageData(e.data,0,0))}let e=this._texture,i=this._style,r=i.trim?0:i.padding,s=e.baseTexture;e.trim.width=e._frame.width=t.width/this._resolution,e.trim.height=e._frame.height=t.height/this._resolution,e.trim.x=-r,e.trim.y=-r,e.orig.width=e._frame.width-2*r,e.orig.height=e._frame.height-2*r,this._onTextureUpdate(),s.setRealSize(t.width,t.height,this._resolution),e.updateUvs(),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(t,e){return this.updateText(!0),-1===this._textureID&&(t=!1),super.getBounds(t,e)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds.call(this,t)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(t,e,i){let r,s=t.fill;if(!Array.isArray(s))return s;if(1===s.length)return s[0];let a=t.dropShadow?t.dropShadowDistance:0,n=t.padding||0,o=this.canvas.width/this._resolution-a-2*n,l=this.canvas.height/this._resolution-a-2*n,h=s.slice(),u=t.fillGradientStops.slice();if(!u.length){let t=h.length+1;for(let e=1;e<t;++e)u.push(e/t)}if(h.unshift(s[0]),u.unshift(0),h.push(s[s.length-1]),u.push(1),t.fillGradientType===e8.LINEAR_VERTICAL){r=this.context.createLinearGradient(o/2,n,o/2,l+n);let s=i.fontProperties.fontSize+t.strokeThickness;for(let t=0;t<e.length;t++){let a=i.lineHeight*(t-1)+s,n=i.lineHeight*t,o=n;t>0&&a>n&&(o=(n+a)/2);let d=n+s,c=i.lineHeight*(t+1),p=d;t+1<e.length&&c<d&&(p=(d+c)/2);let f=(p-o)/l;for(let t=0;t<h.length;t++){let e=0,i=Math.min(1,Math.max(0,o/l+("number"==typeof u[t]?u[t]:t/h.length)*f));i=Number(i.toFixed(5)),r.addColorStop(i,h[t])}}}else{r=this.context.createLinearGradient(n,l/2,o+n,l/2);let t=h.length+1,e=1;for(let i=0;i<h.length;i++){let s;s="number"==typeof u[i]?u[i]:e/t,r.addColorStop(s,h[i]),e++}}return r}destroy(t){"boolean"==typeof t&&(t={children:t}),t=Object.assign({},ia,t),super.destroy(t),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this.updateText(!0);let e=a.Wp.sign(this.scale.x)||1;this.scale.x=e*t/this._texture.orig.width,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this.updateText(!0);let e=a.Wp.sign(this.scale.y)||1;this.scale.y=e*t/this._texture.orig.height,this._height=t}get style(){return this._style}set style(t){(t=t||{})instanceof ii?this._style=t:this._style=new ii(t),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}};io.defaultAutoResolution=!0;let il=io;class ih{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function iu(t,e){let i=!1;if(t?._textures?.length){for(let r=0;r<t._textures.length;r++)if(t._textures[r]instanceof a.gP){let s=t._textures[r].baseTexture;e.includes(s)||(e.push(s),i=!0)}}return i}function id(t,e){if(t.baseTexture instanceof a.t5){let i=t.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function ic(t,e){if(t._texture&&t._texture instanceof a.gP){let i=t._texture.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function ip(t,e){return e instanceof il&&(e.updateText(!0),!0)}function ig(t,e){if(e instanceof ii){let t=e.toFontString();return e7.measureFont(t),!0}return!1}function im(t,e){if(t instanceof il){e.includes(t.style)||e.push(t.style),e.includes(t)||e.push(t);let i=t._texture.baseTexture;return e.includes(i)||e.push(i),!0}return!1}function i_(t,e){return t instanceof ii&&(e.includes(t)||e.push(t),!0)}let iy=class t{constructor(e){this.limiter=new ih(t.uploadsPerFrame),this.renderer=e,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(im),this.registerFindHook(i_),this.registerFindHook(iu),this.registerFindHook(id),this.registerFindHook(ic),this.registerUploadHook(ip),this.registerUploadHook(ig)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,a.Rv.system.addOnce(this.tick,this,a.dQ.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){let t=this.queue[0],e=!1;if(t&&!t._destroyed){for(let i=0,r=this.uploadHooks.length;i<r;i++)if(this.uploadHooks[i](this.uploadHookHelper,t)){this.queue.shift(),e=!0;break}}e||this.queue.shift()}if(this.queue.length)a.Rv.system.addOnce(this.tick,this,a.dQ.UTILITY);else{this.ticking=!1;let t=this.completes.slice(0);this.completes.length=0;for(let e=0,i=t.length;e<i;e++)t[e]()}}registerFindHook(t){return t&&this.addHooks.push(t),this}registerUploadHook(t){return t&&this.uploadHooks.push(t),this}add(t){for(let e=0,i=this.addHooks.length;e<i&&!this.addHooks[e](t,this.queue);e++);if(t instanceof n.mc)for(let e=t.children.length-1;e>=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&a.Rv.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};iy.uploadsPerFrame=4;let iv=iy;function ix(t,e){return e instanceof a.t5&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function ib(t,e){if(!(e instanceof eN))return!1;let{geometry:i}=e;e.finishPoly(),i.updateBatches();let{batches:r}=i;for(let e=0;e<r.length;e++){let{texture:i}=r[e].style;i&&ix(t,i.baseTexture)}return i.batchable||t.geometry.bind(i,e._resolveDirectShader(t)),!0}function iT(t,e){return t instanceof eN&&(e.push(t),!0)}Object.defineProperties(a.W0,{UPLOADS_PER_FRAME:{get:()=>iv.uploadsPerFrame,set(t){a.Wp.deprecation("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),iv.uploadsPerFrame=t}}});class iE extends iv{constructor(t){super(t),this.uploadHookHelper=this.renderer,this.registerFindHook(iT),this.registerUploadHook(ix),this.registerUploadHook(ib)}}iE.extension={name:"prepare",type:a.Ag.RendererSystem},a.XO.add(iE);class iA{constructor(t){this.maxMilliseconds=t,this.frameStart=0}beginFrame(){this.frameStart=Date.now()}allowedToUpload(){return Date.now()-this.frameStart<this.maxMilliseconds}}class iS extends h{constructor(t,e=!0){super(t[0]instanceof a.gP?t[0]:t[0].texture),this._textures=null,this._durations=null,this._autoUpdate=e,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=t}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(a.Rv.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(a.Rv.shared.add(this.update,this,a.dQ.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=this.animationSpeed*t,i=this.currentFrame;if(null!==this._durations){let i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];let r=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*r,this._currentTime+=r;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&this.onLoop(),this.updateTexture())}updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=0xffffff,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(a.gP.from(t[i]));return new iS(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(a.gP.from(t[i]));return new iS(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof a.gP)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(a.Rv.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(a.Rv.shared.add(this.update,this),this._isConnectedToTicker=!0))}}let iw=new a.bR;class iP extends h{constructor(t,e=100,i=100){super(t),this.tileTransform=new a.dL,this._width=e,this._height=i,this.uvMatrix=this.texture.uvMatrix||new a.NW(t),this.pluginName="tilingSprite",this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(t){this.uvMatrix.clampMargin=t,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(t){this.tileTransform.scale.copyFrom(t)}get tilePosition(){return this.tileTransform.position}set tilePosition(t){this.tileTransform.position.copyFrom(t)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=0xffffff}_render(t){let e=this._texture;e&&e.valid&&(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),t.batch.setObjectRenderer(t.plugins[this.pluginName]),t.plugins[this.pluginName].render(this))}_calculateBounds(){let t=-(this._width*this._anchor._x),e=-(this._height*this._anchor._y),i=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,t,e,i,r)}getLocalBounds(t){return 0===this.children.length?(this._bounds.minX=-(this._width*this._anchor._x),this._bounds.minY=-(this._height*this._anchor._y),this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),t||(this._localBoundsRect||(this._localBoundsRect=new a.M_),t=this._localBoundsRect),this._bounds.getRectangle(t)):super.getLocalBounds.call(this,t)}containsPoint(t){this.worldTransform.applyInverse(t,iw);let e=this._width,i=this._height,r=-e*this.anchor._x;if(iw.x>=r&&iw.x<r+e){let t=-i*this.anchor._y;if(iw.y>=t&&iw.y<t+i)return!0}return!1}destroy(t){super.destroy(t),this.tileTransform=null,this.uvMatrix=null}static from(t,e){return new iP(t instanceof a.gP?t:a.gP.from(t,e),e.width,e.height)}get width(){return this._width}set width(t){this._width=t}get height(){return this._height}set height(t){this._height=t}}var iM=`#version 300 es
445#define SHADER_NAME Tiling-Sprite-100
446
447precision lowp float;
448
449in vec2 vTextureCoord;
450
451out vec4 fragmentColor;
452
453uniform sampler2D uSampler;
454uniform vec4 uColor;
455uniform mat3 uMapCoord;
456uniform vec4 uClampFrame;
457uniform vec2 uClampOffset;
458
459void main(void)
460{
461    vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
462    coord = (uMapCoord * vec3(coord, 1.0)).xy;
463    vec2 unclamped = coord;
464    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
465
466    vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
467
468    fragmentColor = texSample * uColor;
469}
470`,iC=`#version 300 es
471#define SHADER_NAME Tiling-Sprite-300
472
473precision lowp float;
474
475in vec2 aVertexPosition;
476in vec2 aTextureCoord;
477
478uniform mat3 projectionMatrix;
479uniform mat3 translationMatrix;
480uniform mat3 uTransform;
481
482out vec2 vTextureCoord;
483
484void main(void)
485{
486    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
487
488    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
489}
490`,iD=`#version 100
491#ifdef GL_EXT_shader_texture_lod
492    #extension GL_EXT_shader_texture_lod : enable
493#endif
494#define SHADER_NAME Tiling-Sprite-100
495
496precision lowp float;
497
498varying vec2 vTextureCoord;
499
500uniform sampler2D uSampler;
501uniform vec4 uColor;
502uniform mat3 uMapCoord;
503uniform vec4 uClampFrame;
504uniform vec2 uClampOffset;
505
506void main(void)
507{
508    vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
509    coord = (uMapCoord * vec3(coord, 1.0)).xy;
510    vec2 unclamped = coord;
511    coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
512
513    #ifdef GL_EXT_shader_texture_lod
514        vec4 texSample = unclamped == coord
515            ? texture2D(uSampler, coord) 
516            : texture2DLodEXT(uSampler, coord, 0);
517    #else
518        vec4 texSample = texture2D(uSampler, coord);
519    #endif
520
521    gl_FragColor = texSample * uColor;
522}
523`,iR=`#version 100
524#define SHADER_NAME Tiling-Sprite-100
525
526precision lowp float;
527
528attribute vec2 aVertexPosition;
529attribute vec2 aTextureCoord;
530
531uniform mat3 projectionMatrix;
532uniform mat3 translationMatrix;
533uniform mat3 uTransform;
534
535varying vec2 vTextureCoord;
536
537void main(void)
538{
539    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
539)).xy, 0.0, 1.0);
540
541    vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
542}
543`,iI=`#version 100
544#define SHADER_NAME Tiling-Sprite-Simple-100
545
546precision lowp float;
547
548varying vec2 vTextureCoord;
549
550uniform sampler2D uSampler;
551uniform vec4 uColor;
552
553void main(void)
554{
555    vec4 texSample = texture2D(uSampler, vTextureCoord);
556    gl_FragColor = texSample * uColor;
557}
558`;let iB=new a.uq;class iL extends a.Pt{constructor(t){super(t),t.runners.contextChange.add(this),this.quad=new a.X1,this.state=a.Uw.for2d()}contextChange(){let t=this.renderer,e={globals:t.globalUniforms};this.simpleShader=a.Mt.from(iR,iI,e),this.shader=t.context.webGLVersion>1?a.Mt.from(iC,iM,e):a.Mt.from(iR,iD,e)}render(t){let e=this.renderer,i=this.quad,r=i.vertices;r[0]=r[6]=-(t._width*t.anchor.x),r[1]=r[3]=-(t._height*t.anchor.y),r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);let s=t.uvRespectAnchor?t.anchor.x:0,n=t.uvRespectAnchor?t.anchor.y:0;(r=i.uvs)[0]=r[6]=-s,r[1]=r[3]=-n,r[2]=r[4]=1-s,r[5]=r[7]=1-n,i.invalidate();let o=t._texture,l=o.baseTexture,h=l.alphaMode>0,u=t.tileTransform.localTransform,d=t.uvMatrix,c=l.isPowerOfTwo&&o.frame.width===l.width&&o.frame.height===l.height;c&&(l._glTextures[e.CONTEXT_UID]?c=l.wrapMode!==a.uR.CLAMP:l.wrapMode===a.uR.CLAMP&&(l.wrapMode=a.uR.REPEAT));let p=c?this.simpleShader:this.shader,f=o.width,g=o.height,m=t._width,_=t._height;iB.set(u.a*f/m,u.b*f/_,u.c*g/m,u.d*g/_,u.tx/m,u.ty/_),iB.invert(),c?iB.prepend(d.mapCoord):(p.uniforms.uMapCoord=d.mapCoord.toArray(!0),p.uniforms.uClampFrame=d.uClampFrame,p.uniforms.uClampOffset=d.uClampOffset),p.uniforms.uTransform=iB.toArray(!0),p.uniforms.uColor=a.Q1.shared.setValue(t.tint).premultiply(t.worldAlpha,h).toArray(p.uniforms.uColor),p.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),p.uniforms.uSampler=o,e.shader.bind(p),e.geometry.bind(i),this.state.blendMode=a.Wp.correctBlendMode(t.blendMode,h),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}iL.extension={name:"tilingSprite",type:a.Ag.RendererPlugin},a.XO.add(iL);let iO=class t{constructor(t,e,i){this.linkedSheets=[],(t instanceof a.t5||t instanceof a.gP)&&(t={texture:t,data:e,resolutionFilename:i});let{texture:r,data:s,resolutionFilename:n=null,cachePrefix:o=""}=t;this.cachePrefix=o,this._texture=r instanceof a.gP?r:null,this.baseTexture=r instanceof a.t5?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=s;let l=this.baseTexture.resource;this.resolution=this._updateResolution(n||(l?l.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){let{scale:e}=this.data.meta,i=a.Wp.getResolutionOfUrl(t,null);return null===i&&(i="number"==typeof e?e:parseFloat(e??"1")),1!==i&&this.baseTexture.setResolution(i),i}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=t.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let i=e,r=t.BATCH_SIZE;for(;i-e<r&&i<this._frameKeys.length;){let t=this._frameKeys[i],e=this._frames[t],r=e.frame;if(r){let i=null,s=null,n=!1!==e.trimmed&&e.sourceSize?e.sourceSize:e.frame,o=new a.M_(0,0,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution);i=e.rotated?new a.M_(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.h)/this.resolution,Math.floor(r.w)/this.resolution):new a.M_(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution),!1!==e.trimmed&&e.spriteSourceSize&&(s=new a.M_(Math.floor(e.spriteSourceSize.x)/this.resolution,Math.floor(e.spriteSourceSize.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution)),this.textures[t]=new a.gP(this.baseTexture,i,o,s,2*!!e.rotated,e.anchor,e.borders),a.gP.addToCache(this.textures[t],this.cachePrefix+t.toString())}i++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){let r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*t.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*t.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};iO.BATCH_SIZE=1e3;let iF=iO,ik=["jpg","png","jpeg","avif","webp","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],iN={extension:a.Ag.Asset,cac
558he:{test:t=>t instanceof iF,getCacheableAssets:(t,e)=>(function t(e,i,r){let s={};if(e.forEach(t=>{s[t]=i}),Object.keys(i.textures).forEach(t=>{s[`${i.cachePrefix}${t}`]=i.textures[t]}),!r){let r=a.Wp.path.dirname(e[0]);i.linkedSheets.forEach((e,a)=>{Object.assign(s,t([`${r}/${i.data.meta.related_multi_packs[a]}`],e,!0))})}return s})(t,e,!1)},resolver:{test:t=>{let e=t.split("?")[0].split("."),i=e.pop(),r=e.pop();return"json"===i&&ik.includes(r)},parse:t=>{let e=t.split(".");return{resolution:parseFloat(a.W0.RETINA_PREFIX.exec(t)?.[1]??"1"),format:e[e.length-2],src:t}}},loader:{name:"spritesheetLoader",extension:{type:a.Ag.LoadParser,priority:tr.Normal},testParse:async(t,e)=>".json"===a.Wp.path.extname(e.src).toLowerCase()&&!!t.frames,async parse(t,e,i){let r,{texture:s,imageFilename:n,cachePrefix:o}=e?.data??{},l=a.Wp.path.dirname(e.src);if(l&&l.lastIndexOf("/")!==l.length-1&&(l+="/"),s&&s.baseTexture)r=s;else{let s=tq(l+(n??t.meta.image),e.src);r=(await i.load([s]))[s]}let h=new iF({texture:r.baseTexture,data:t,resolutionFilename:e.src,cachePrefix:o});await h.parse();let u=t?.meta?.related_multi_packs;if(Array.isArray(u)){let t=[];for(let r of u){if("string"!=typeof r)continue;let s=l+r;e.data?.ignoreMultiPack||(s=tq(s,e.src),t.push(i.load({src:s,data:{ignoreMultiPack:!0}})))}let r=await Promise.all(t);h.linkedSheets=r,r.forEach(t=>{t.linkedSheets=[h].concat(h.linkedSheets.filter(e=>e!==t))})}return h},unload(t){t.destroy(!0)}}};a.XO.add(iN);class iU{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class iW{static test(t){return"string"==typeof t&&t.startsWith("info face=")}static parse(t){let e=t.match(/^[a-z]+\s+.+$/gm),i={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let t in e){let r=e[t].match(/^[a-z]+/gm)[0],s=e[t].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(let t in s){let e=s[t].split("="),i=e[0],r=e[1].replace(/"/gm,""),n=parseFloat(r),o=isNaN(n)?r:n;a[i]=o}i[r].push(a)}let r=new iU;return i.info.forEach(t=>r.info.push({face:t.face,size:parseInt(t.size,10)})),i.common.forEach(t=>r.common.push({lineHeight:parseInt(t.lineHeight,10)})),i.page.forEach(t=>r.page.push({id:parseInt(t.id,10),file:t.file})),i.char.forEach(t=>r.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})),i.kerning.forEach(t=>r.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})),i.distanceField.forEach(t=>r.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType})),r}}class iH{static test(t){return"string"!=typeof t&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")}static parse(t){let e=new iU,i=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),s=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),n=t.getElementsByTagName("kerning"),o=t.getElementsByTagName("distanceField");for(let t=0;t<i.length;t++)e.info.push({face:i[t].getAttribute("face"),size:parseInt(i[t].getAttribute("size"),10)});for(let t=0;t<r.length;t++)e.common.push({lineHeight:parseInt(r[t].getAttribute("lineHeight"),10)});for(let t=0;t<s.length;t++)e.page.push({id:parseInt(s[t].getAttribute("id"),10)||0,file:s[t].getAttribute("file")});for(let t=0;t<a.length;t++){let i=a[t];e.char.push({id:parseInt(i.getAttribute("id"),10),page:parseInt(i.getAttribute("page"),10)||0,x:parseInt(i.getAttribute("x"),10),y:parseInt(i.getAttribute("y"),10),width:parseInt(i.getAttribute("width"),10),height:parseInt(i.getAttribute("height"),10),xoffset:parseInt(i.getAttribute("xoffset"),10),yoffset:parseInt(i.getAttribute("yoffset"),10),xadvance:parseInt(i.getAttribute("xadvance"),10)})}for(let t=0;t<n.length;t++)e.kerning.push({first:parseInt(n[t].getAttribute("first"),10),second:parseInt(n[t].getAttribute("second"),10),amount:parseInt(n[t].getAttribute("amount"),10)});for(let t=0;t<o.length;
558t++)e.distanceField.push({fieldType:o[t].getAttribute("fieldType"),distanceRange:parseInt(o[t].getAttribute("distanceRange"),10)});return e}}class iG{static test(t){return!!("string"==typeof t&&t.includes("<font>"))&&iH.test(a.W0.ADAPTER.parseXML(t))}static parse(t){return iH.parse(a.W0.ADAPTER.parseXML(t))}}let iz=[iW,iH,iG];function iX(t){for(let e=0;e<iz.length;e++)if(iz[e].test(t))return iz[e];return null}function ij(t){return Array.from?Array.from(t):t.split("")}function iV(t){return t.codePointAt?t.codePointAt(0):t.charCodeAt(0)}let iY=class t{constructor(t,e,i){let[r]=t.info,[s]=t.common,[n]=t.page,[o]=t.distanceField,l=a.Wp.getResolutionOfUrl(n.file),h={};this._ownsTextures=i,this.font=r.face,this.size=r.size,this.lineHeight=s.lineHeight/l,this.chars={},this.pageTextures=h;for(let i=0;i<t.page.length;i++){let{id:r,file:s}=t.page[i];h[r]=e instanceof Array?e[i]:e[s],o?.fieldType&&"none"!==o.fieldType&&(h[r].baseTexture.alphaMode=a.Gk.NO_PREMULTIPLIED_ALPHA,h[r].baseTexture.mipmap=a.E8.OFF)}for(let e=0;e<t.char.length;e++){let{id:i,page:r}=t.char[e],{x:s,y:n,width:o,height:u,xoffset:d,yoffset:c,xadvance:p}=t.char[e];s/=l,n/=l,o/=l,u/=l,d/=l,c/=l,p/=l;let f=new a.M_(s+h[r].frame.x/l,n+h[r].frame.y/l,o,u);this.chars[i]={xOffset:d,yOffset:c,xAdvance:p,kerning:{},texture:new a.gP(h[r].baseTexture,f),page:r}}for(let e=0;e<t.kerning.length;e++){let{first:i,second:r,amount:s}=t.kerning[e];i/=l,r/=l,s/=l,this.chars[r]&&(this.chars[r].kerning[i]=s)}this.distanceFieldRange=o?.distanceRange,this.distanceFieldType=o?.fieldType?.toLowerCase()??"none"}destroy(){for(let t in this.chars)this.chars[t].texture.destroy(),this.chars[t].texture=null;for(let t in this.pageTextures)this._ownsTextures&&this.pageTextures[t].destroy(!0),this.pageTextures[t]=null;this.chars=null,this.pageTextures=null}static install(e,i,r){let s;if(e instanceof iU)s=e;else{let t=iX(e);if(!t)throw Error("Unrecognized data format for font.");s=t.parse(e)}i instanceof a.gP&&(i=[i]);let n=new t(s,i,r);return t.available[n.font]=n,n}static uninstall(e){let i=t.available[e];if(!i)throw Error(`No font found named '${e}'`);i.destroy(),delete t.available[e]}static from(e,i,r){if(!e)throw Error("[BitmapFont] Property `name` is required.");let{chars:s,padding:n,resolution:o,textureWidth:l,textureHeight:h,...u}=Object.assign({},t.defaultOptions,r),d=function(t){"string"==typeof t&&(t=[t]);let e=[];for(let i=0,r=t.length;i<r;i++){let r=t[i];if(Array.isArray(r)){if(2!==r.length)throw Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);let t=r[0].charCodeAt(0),i=r[1].charCodeAt(0);if(i<t)throw Error("[BitmapFont]: Invalid character range.");for(let r=t;r<=i;r++)e.push(String.fromCharCode(r))}else e.push(...ij(r))}if(0===e.length)throw Error("[BitmapFont]: Empty set when resolving characters.");return e}(s),c=i instanceof ii?i:new ii(i),p=new iU;p.info[0]={face:c.fontFamily,size:c.fontSize},p.common[0]={lineHeight:c.fontSize};let f=0,g=0,m,_,y,v=0,x=[],b=[];for(let t=0;t<d.length;t++){m||((m=a.W0.ADAPTER.createCanvas()).width=l,m.height=h,_=m.getContext("2d"),y=new a.t5(m,{resolution:o,...u}),x.push(y),b.push(new a.gP(y)),p.page.push({id:b.length-1,file:""}));let e=d[t],i=e7.measureText(e,c,!1,m),r=i.width,s=Math.ceil(i.height),T=Math.ceil(("italic"===c.fontStyle?2:1)*r);if(g>=h-s*o){if(0===g)throw Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,m=null,_=null,y=null,g=0,f=0,v=0;continue}if(v=Math.max(s+i.fontProperties.descent,v),T*o+f>=l){if(0===f)throw Error(`[BitmapFont] textureWidth ${l}px is too small (fontFamily: '${c.fontFamily}', fontSize: ${c.fontSize}px, char: '${e}')`);--t,g+=v*o,g=Math.ceil(g),f=0,v=0;continue}!function(t,e,i,r,s,n,o){let l=i.text,h=i.fontProperties;e.translate(r,s),e.scale(n,n);let u=o.strokeThickness/2,d=-(o.strokeThickness/2);if(e.font=o.toFontString(),e.lineWidth=o.strokeThickness,e.textBaseline=o.textBaseline,e.lineJoin=o.lineJoin,e.miterLimit=o.miterLimit,e.fillStyle=function(t,e,i,r,s,a){let n,o=i.fill;if(!Array.isArray(o))return o;if(1===o.length)return o[0];let l=i.dropShadow?i.dropShadowDistance:0,h=i.padding||0,u=t.width/r-l-2*h,d=t.height/r-l-2*h,c=o.slice(),p=i.fillGradientStops.slice();if(!p.length){let t=c.length+1;for(let e=1;e<t;++e)p.push(e/t)}if(c.unshift(o[0]),p.unshift(0),c.push(o[o.length-1]),p.push(1),i.fillGradientType===e8.LINEAR_VERTICAL){n=e.createLinearGradient(u/2,h,u/2,d+h);let t=0,r=(a.fontProperties.fontSize+i.strokeThickness)/d;for(let e=0;e<s.length;e++){let i=a.lineHeight*e;for(let e=0;e<c.length;e++){let s=0,a=Math.max(t,i/d+("number"==typeof p[e]?p[e]:e/c.length)*r);a=Math.min(a,1),n.addColorStop(a,c[e]),t=a}}}else{n=e.createLinearGradient(h,d/2,u+h,d/2);let t=c.length+1,i=1;for(let e=0;e<c.length;e++){let r;r="number"==typeof p[e]?p[e]:i/t,n.addColorStop(r,c[e]),i++}}return n}
558(t,e,o,n,[l],i),e.strokeStyle=o.stroke,o.dropShadow){let t=o.dropShadowColor,i=o.dropShadowBlur*n,r=o.dropShadowDistance*n;e.shadowColor=a.Q1.shared.setValue(t).setAlpha(o.dropShadowAlpha).toRgbaString(),e.shadowBlur=i,e.shadowOffsetX=Math.cos(o.dropShadowAngle)*r,e.shadowOffsetY=Math.sin(o.dropShadowAngle)*r}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0;o.stroke&&o.strokeThickness&&e.strokeText(l,u,d+i.lineHeight-h.descent),o.fill&&e.fillText(l,u,d+i.lineHeight-h.descent),e.setTransform(1,0,0,1,0,0),e.fillStyle="rgba(0, 0, 0, 0)"}(m,_,i,f,g,o,c);let E=iV(i.text);p.char.push({id:E,page:b.length-1,x:f/o,y:g/o,width:T,height:s,xoffset:0,yoffset:0,xadvance:r-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0)}),f+=(T+2*n)*o,f=Math.ceil(f)}if(!r?.skipKerning)for(let t=0,e=d.length;t<e;t++){let i=d[t];for(let t=0;t<e;t++){let e=d[t],r=_.measureText(i).width,s=_.measureText(e).width,a=_.measureText(i+e).width-(r+s);a&&p.kerning.push({first:iV(i),second:iV(e),amount:a})}}let T=new t(p,b,!0);return void 0!==t.available[e]&&t.uninstall(e),t.available[e]=T,T}};iY.ALPHA=[["a","z"],["A","Z"]," "],iY.NUMERIC=[["0","9"]],iY.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],iY.ASCII=[[" ","~"]],iY.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:iY.ALPHANUMERIC},iY.available={};let i$=iY;var iq=`// Pixi texture info\r
559varying vec2 vTextureCoord;\r
560uniform sampler2D uSampler;\r
561\r
562// Tint\r
563uniform vec4 uColor;\r
564\r
565// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
566uniform float uFWidth;\r
567\r
568void main(void) {\r
569\r
570  // To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
571  vec4 texColor = texture2D(uSampler, vTextureCoord);\r
572\r
573  // MSDF\r
574  float median = texColor.r + texColor.g + texColor.b -\r
575                  min(texColor.r, min(texColor.g, texColor.b)) -\r
576                  max(texColor.r, max(texColor.g, texColor.b));\r
577  // SDF\r
578  median = min(median, texColor.a);\r
579\r
580  float screenPxDistance = uFWidth * (median - 0.5);\r
581  float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
582  if (median < 0.01) {\r
583    alpha = 0.0;\r
584  } else if (median > 0.99) {\r
585    alpha = 1.0;\r
586  }\r
587\r
588  // Gamma correction for coverage-like alpha\r
589  float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
590  float gamma = mix(1.0, 1.0 / 2.2, luma);\r
591  float coverage = pow(uColor.a * alpha, gamma);  \r
592\r
593  // NPM Textures, NPM outputs\r
594  gl_FragColor = vec4(uColor.rgb, coverage);\r
595}\r
596`,iQ=`// Mesh material default fragment\r
597attribute vec2 aVertexPosition;\r
598attribute vec2 aTextureCoord;\r
599\r
600uniform mat3 projectionMatrix;\r
601uniform mat3 translationMatrix;\r
602uniform mat3 uTextureMatrix;\r
603\r
604varying vec2 vTextureCoord;\r
605\r
606void main(void)\r
607{\r
608    gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0
608)).xy, 0.0, 1.0);\r
609\r
610    vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
611}\r
612`;let iK=[],iZ=[],iJ=[],i0=class t extends n.mc{constructor(e,i={}){super();let{align:r,tint:s,maxWidth:n,letterSpacing:o,fontName:l,fontSize:h}=Object.assign({},t.styleDefaults,i);if(!i$.available[l])throw Error(`Missing BitmapFont "${l}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=r,this._tintColor=new a.Q1(s),this._font=void 0,this._fontName=l,this._fontSize=h,this.text=e,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new a.oA(()=>{this.dirty=!0},this,0,0),this._roundPixels=a.W0.ROUND_PIXELS,this.dirty=!0,this._resolution=a.W0.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){let t=i$.available[this._fontName],e=this.fontSize,i=e/t.size,r=new a.bR,s=[],n=[],o=[],l=ij(this._text.replace(/(?:\r\n|\r)/g,`
613`)||" "),h=this._maxWidth*t.size/e,u="none"===t.distanceFieldType?iK:iZ,d=null,c=0,p=0,f=0,g=-1,m=0,_=0,y=0,v=0;for(let e=0;e<l.length;e++){let i=l[e],u=iV(i);if(/(?:\s)/.test(i)&&(g=e,m=c,v++),"\r"===i||i===`
614`){n.push(c),o.push(-1),p=Math.max(p,c),++f,++_,r.x=0,r.y+=t.lineHeight,d=null,v=0;continue}let x=t.chars[u];if(!x)continue;d&&x.kerning[d]&&(r.x+=x.kerning[d]);let b=iJ.pop()||{texture:a.gP.EMPTY,line:0,charCode:0,prevSpaces:0,position:new a.bR};b.texture=x.texture,b.line=f,b.charCode=u,b.position.x=Math.round(r.x+x.xOffset+this._letterSpacing/2),b.position.y=Math.round(r.y+x.yOffset),b.prevSpaces=v,s.push(b),c=b.position.x+Math.max(x.xAdvance-x.xOffset,x.texture.orig.width),r.x+=x.xAdvance+this._letterSpacing,y=Math.max(y,x.yOffset+x.texture.height),d=u,-1!==g&&h>0&&r.x>h&&(++_,a.Wp.removeItems(s,1+g-_,1+e-g),e=g,g=-1,n.push(m),o.push(s.length>0?s[s.length-1].prevSpaces:0),p=Math.max(p,m),f++,r.x=0,r.y+=t.lineHeight,d=null,v=0)}let x=l[l.length-1];"\r"!==x&&x!==`
615`&&(/(?:\s)/.test(x)&&(c=m),n.push(c),p=Math.max(p,c),o.push(-1));let b=[];for(let t=0;t<=f;t++){let e=0;"right"===this._align?e=p-n[t]:"center"===this._align?e=(p-n[t])/2:"justify"===this._align&&(e=o[t]<0?0:(p-n[t])/o[t]),b.push(e)}let T=s.length,E={},A=[],S=this._activePagesMeshData;u.push(...S);for(let e=0;e<T;e++){let i=s[e].texture,r=i.baseTexture.uid;if(!E[r]){let e=u.pop();if(!e){let i,r,s=new ej;"none"===t.distanceFieldType?(i=new e$(a.gP.EMPTY),r=a.B9.NORMAL):(i=new e$(a.gP.EMPTY,{program:a.BP.from(iQ,iq),uniforms:{uFWidth:0}}),r=a.B9.NORMAL_NPM);let n=new eX(s,i);n.blendMode=r,e={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:n,vertices:null,uvs:null,indices:null}}e.index=0,e.indexCount=0,e.vertexCount=0,e.uvsCount=0,e.total=0;let{_textureCache:s}=this;s[r]=s[r]||new a.gP(i.baseTexture),e.mesh.texture=s[r],e.mesh.tint=this._tintColor.value,A.push(e),E[r]=e}E[r].total++}for(let t=0;t<S.length;t++)A.includes(S[t])||this.removeChild(S[t].mesh);for(let t=0;t<A.length;t++)A[t].mesh.parent!==this&&this.addChild(A[t].mesh);for(let t in this._activePagesMeshData=A,E){let e=E[t],i=e.total;if(!(e.indices?.length>6*i)||e.vertices.length<2*eX.BATCHABLE_SIZE)e.vertices=new Float32Array(8*i),e.uvs=new Float32Array(8*i),e.indices=new Uint16Array(6*i);else{let t=e.total,i=e.vertices;for(let e=4*t*2;e<i.length;e++)i[e]=0}e.mesh.size=6*i}for(let t=0;t<T;t++){let e=s[t],r=e.position.x+b[e.line]*("justify"===this._align?e.prevSpaces:1);this._roundPixels&&(r=Math.round(r));let a=r*i,n=e.position.y*i,o=e.texture,l=E[o.baseTexture.uid],h=o.frame,u=o._uvs,d=l.index++;l.indices[6*d+0]=0+4*d,l.indices[6*d+1]=1+4*d,l.indices[6*d+2]=2+4*d,l.indices[6*d+3]=0+4*d,l.indices[6*d+4]=2+4*d,l.indices[6*d+5]=3+4*d,l.vertices[8*d+0]=a,l.vertices[8*d+1]=n,l.vertices[8*d+2]=a+h.width*i,l.vertices[8*d+3]=n,l.vertices[8*d+4]=a+h.width*i,l.vertices[8*d+5]=n+h.height*i,l.vertices[8*d+6]=a,l.vertices[8*d+7]=n+h.height*i,l.uvs[8*d+0]=u.x0,l.uvs[8*d+1]=u.y0,l.uvs[8*d+2]=u.x1,l.uvs[8*d+3]=u.y1,l.uvs[8*d+4]=u.x2,l.uvs[8*d+5]=u.y2,l.uvs[8*d+6]=u.x3,l.uvs[8*d+7]=u.y3}for(let e in this._textWidth=p*i,this._textHeight=(r.y+t.lineHeight)*i,E){let t=E[e];if(0!==this.anchor.x||0!==this.anchor.y){let e=0,i=this._textWidth*this.anchor.x,r=this._textHeight*this.anchor.y;for(let s=0;s<t.total;s++)t.vertices[e++]-=i,t.vertices[e++]-=r,t.vertices[e++]-=i,t.vertices[e++]-=r,t.vertices[e++]-=i,t.vertices[e++]-=r,t.vertices[e++]-=i,t.vertices[e++]-=r}this._maxLineHeight=y*i;let r=t.mesh.geometry.getBuffer("aVertexPosition"),s=t.mesh.geometry.getBuffer("aTextureCoord"),a=t.mesh.geometry.getIndex();
615r.data=t.vertices,s.data=t.uvs,a.data=t.indices,r.update(),s.update(),a.update()}for(let t=0;t<s.length;t++)iJ.push(s[t]);this._font=t,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0);let{distanceFieldRange:e,distanceFieldType:i,size:r}=i$.available[this._fontName];if("none"!==i){let{a:i,b:s,c:a,d:n}=this.worldTransform,o=(Math.abs(Math.sqrt(i*i+s*s))+Math.abs(Math.sqrt(a*a+n*n)))/2,l=this.fontSize/r,h=t._view.resolution;for(let t of this._activePagesMeshData)t.mesh.shader.uniforms.uFWidth=o*e*l*h}super._render(t)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){let t=i$.available[this._fontName];if(!t)throw Error(`Missing BitmapFont "${this._fontName}"`);this._font!==t&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(t){if(this.tint!==t){this._tintColor.setValue(t);for(let e=0;e<this._activePagesMeshData.length;e++)this._activePagesMeshData[e].mesh.tint=t}}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.dirty=!0)}get fontName(){return this._fontName}set fontName(t){if(!i$.available[t])throw Error(`Missing BitmapFont "${t}"`);this._fontName!==t&&(this._fontName=t,this.dirty=!0)}get fontSize(){return this._fontSize??i$.available[this._fontName].size}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.dirty=!0)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get text(){return this._text}set text(t){t=String(t??""),this._text!==t&&(this._text=t,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth!==t&&(this._maxWidth=t,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(t){t!==this._roundPixels&&(this._roundPixels=t,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}destroy(t){let{_textureCache:e}=this,i="none"===i$.available[this._fontName].distanceFieldType?iK:iZ;for(let t of(i.push(...this._activePagesMeshData),this._activePagesMeshData))this.removeChild(t.mesh);for(let t in this._activePagesMeshData=[],i.filter(t=>e[t.mesh.texture.baseTexture.uid]).forEach(t=>{t.mesh.texture=a.gP.EMPTY}),e)e[t].destroy(),delete e[t];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};i0.styleDefaults={align:"left",tint:0xffffff,maxWidth:0,letterSpacing:0};let i1=i0,i2=[".xml",".fnt"],i3={extension:{type:a.Ag.LoadParser,priority:tr.Normal},name:"loadBitmapFont",test:t=>i2.includes(a.Wp.path.extname(t).toLowerCase()),testParse:async t=>iW.test(t)||iG.test(t),async parse(t,e,i){let r=iW.test(t)?iW.parse(t):iG.parse(t),{src:s}=e,{page:n}=r,o=[];for(let t=0;t<n.length;++t){let e=n[t].file,i=a.Wp.path.join(a.Wp.path.dirname(s),e);i=tq(i,s),o.push(i)}let l=await i.load(o),h=o.map(t=>l[t]);return i$.install(r,h,!0)},load:async(t,e)=>(await a.W0.ADAPTER.fetch(t)).text(),unload(t){t.destroy()}};a.XO.add(i3);let i4=class t extends ii{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new t(Object.keys(t.defaultOptions).reduce((t,i)=>({...t,[i]:e[i]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(e=>{URL.revokeObjectURL(e.src),e.refs--,0===e.refs&&(e.fontFace&&document.fonts.delete(e.fontFace),delete t.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,i={}){let{availableFonts:r}=t;if(r[e]){let t=r[e];return this._fonts.push(t),t.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return a.W0.ADAPTER.fetch(e).then(t=>t.blob()).then(async t=>new Promise((e,i)=>{let r=URL.createObjectURL(t),s=new FileReader;s.onload=()=>e([r,s.result]),s.onerror=i,s.readAsDataURL(t)})).then(async([t,s])=>{let n=Object.assign({family:a.Wp.path.basename(e,a.Wp.path.extname(e)),weight:"normal",style:"normal",display:"auto",src:t,dataSrc:s,refs:1,originalUrl:e,fontFace:null},i);r[e]=n,this._fonts.push(n),this.styleID++;let o=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style,display:n.display});n.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirt
615y=!0})}addOverride(...t){let e=t.filter(t=>!this._overrides.includes(t));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){let e=t.filter(t=>this._overrides.includes(t));e.length>0&&(this._overrides=this._overrides.filter(t=>!e.includes(t)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t}
616            @font-face {
617                font-family: "${e.family}";
618                src: url('${e.dataSrc}');
619                font-weight: ${e.weight};
620                font-style: ${e.style};
621                font-display: ${e.display};
622            }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=a.Wp.rgb2hex(t)),"number"==typeof t?a.Wp.hex2string(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor),e=this.dropShadowAlpha,i=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(255*e|0).toString(16).padStart(2,"0"));let s=`${i}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${s} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${s} ${t}`}reset(){Object.assign(this,t.defaultOptions)}onBeforeDraw(){let{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){let{userAgent:t}=a.W0.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};i4.availableFonts={},i4.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let i5=i4,i8=class t extends h{constructor(e="",i={}){super(a.gP.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;let r=new Image,s=a.gP.from(r,{scaleMode:a.W0.SCALE_MODE,resourceOptions:{autoLoad:!1}});s.orig=new a.M_,s.trim=new a.M_,this.texture=s;let n="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",l=document.createElementNS(n,"svg"),h=document.createElementNS(n,"foreignObject"),u=document.createElementNS(o,"div"),d=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",l.appendChild(h),this.maxWidth=t.defaultMaxWidth,this.maxHeight=t.defaultMaxHeight,this._domElement=u,this._styleElement=d,this._svgRoot=l,this._foreignObject=h,this._foreignObject.appendChild(d),this._foreignObject.appendChild(u),this._image=r,this._loadImage=new Image,this._autoResolution=t.defaultAutoResolution,this._resolution=t.defaultResolution??a.W0.RESOLUTION,this.text=e,this.style=i}measureText(t){let{text:e,style:i,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:e,style:i.toCSS(r)}),this._styleElement.textContent=i.toGlobalCSS(),document.body.appendChild(this._svgRoot);let s=this._domElement.getBoundingClientRect();this._svgRoot.remove();let{width:a,height:n}=s;(a>this.maxWidth||n>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");let o=Math.min(this.maxWidth,Math.ceil(a)),l=Math.min(this.maxHeight,Math.ceil(n));return this._svgRoot.setAttribute("width",o.toString()),this._svgRoot.setAttribute("height",l.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),i!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(r)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:o+2*i.padding,height:l+2*i.padding}}async updateText(t=!0){let{style:e,_image:i,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;let{width:s,height:a}=this.measureText();i.width=r.width=Math.ceil(Math.max(1,s)),i.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;let n=this._updateID;await new Promise(t=>{r.onload=async()=>
622{if(n<this._updateID)return void t();await e.onBeforeDraw(),i.src=r.src,r.onload=null,r.src="",this.updateTexture(),t()};let s=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(s)}`})}get source(){return this._image}updateTexture(){let{style:t,texture:e,_image:i,resolution:r}=this,{padding:s}=t,{baseTexture:a}=e;e.trim.width=e._frame.width=i.width/r,e.trim.height=e._frame.height=i.height/r,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-2*s,e.orig.height=e._frame.height-2*s,this._onTextureUpdate(),a.setRealSize(i.width,i.height,r),this.dirty=!1}_render(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._render(t)}_renderCanvas(t){this._autoResolution&&this._resolution!==t.resolution&&(this._resolution=t.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(t)}getLocalBounds(t){return this.updateText(!0),super.getLocalBounds(t)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(e){"boolean"==typeof e&&(e={children:e}),e=Object.assign({},t.defaultDestroyOptions,e),super.destroy(e),this.ownsStyle&&this._style?.cleanFonts(),this._style=null,this._svgRoot?.remove(),this._svgRoot=null,this._domElement?.remove(),this._domElement=null,this._foreignObject?.remove(),this._foreignObject=null,this._styleElement?.remove(),this._styleElement=null,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=null,this._image.src="",this._image=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(t){this.updateText(!0);let e=a.Wp.sign(this.scale.x)||1;this.scale.x=e*t/this._image.width/this.resolution,this._width=t}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(t){this.updateText(!0);let e=a.Wp.sign(this.scale.y)||1;this.scale.y=e*t/this._image.height/this.resolution,this._height=t}get style(){return this._style}set style(t){this._style!==t&&((t=t||{})instanceof i5?(this.ownsStyle=!1,this._style=t):t instanceof ii?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=i5.from(t)):(this.ownsStyle=!0,this._style=new i5(t)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(t){t=String(""===t||null==t?" ":t),t=this.sanitiseText(t),this._text!==t&&(this._text=t,this.dirty=!0)}get resolution(){return this._resolution}set resolution(t){this._autoResolution=!1,this._resolution!==t&&(this._resolution=t,this.dirty=!0)}sanitiseText(t){return t.replace(/<br>/gi,"<br/>").replace(/<hr>/gi,"<hr/>").replace(/&nbsp;/gi,"&#160;")}};i8.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},i8.defaultMaxWidth=2024,i8.defaultMaxHeight=2024,i8.defaultAutoResolution=!0;let i9=i8},2374:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),!function(t,e){for(var i in e)Object.defineProperty(t,i,{enumerable:!0,get:e[i]})}(e,{cancelIdleCallback:function(){return r},requestIdleCallback:function(){return i}});let i="undefined"!=typeof self&&self.requestIdleCallback&&self.requestIdleCallback.bind(window)||function(t){let e=Date.now();return self.setTimeout(function(){t({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)},r="undefined"!=typeof self&&self.cancelIdleCallback&&self.cancelIdleCallback.bind(window)||function(t){return clearTimeout(t)};("function"==typeof e.default||"object"==typeof e.default&&null!==e.default)&&void 0===e.default.__esModule&&(Object.defineProperty(e.default,"__esModule",{value:!0}),Object.assign(e.default,e),t.exports=e.default)},3554:(t,e,i)=>{i.d(e,{default:()=>s.a});var r=i(9243),s=i.n(r)},9243:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),!function(t,e){for(var i in e)Object.defineProperty(t,i,{enumerable:!0,get:e[i]})}(e,{default:function(){return y},handleClientScriptLoad:function(){return g},initScriptLoader:function(){return m}});
622let r=i(8466),s=i(3011),a=i(5155),n=r._(i(7650)),o=s._(i(2115)),l=i(2830),h=i(333),u=i(2374),d=new Map,c=new Set,p=t=>{if(n.default.preinit)return void t.forEach(t=>{n.default.preinit(t,{as:"style"})});{let e=document.head;t.forEach(t=>{let i=document.createElement("link");i.type="text/css",i.rel="stylesheet",i.href=t,e.appendChild(i)})}},f=t=>{let{src:e,id:i,onLoad:r=()=>{},onReady:s=null,dangerouslySetInnerHTML:a,children:n="",strategy:o="afterInteractive",onError:l,stylesheets:u}=t,f=i||e;if(f&&c.has(f))return;if(d.has(e)){c.add(f),d.get(e).then(r,l);return}let g=()=>{s&&s(),c.add(f)},m=document.createElement("script"),_=new Promise((t,e)=>{m.addEventListener("load",function(e){t(),r&&r.call(this,e),g()}),m.addEventListener("error",function(t){e(t)})}).catch(function(t){l&&l(t)});a?(m.innerHTML=a.__html||"",g()):n?(m.textContent="string"==typeof n?n:Array.isArray(n)?n.join(""):"",g()):e&&(m.src=e,d.set(e,_)),(0,h.setAttributesFromProps)(m,t),"worker"===o&&m.setAttribute("type","text/partytown"),m.setAttribute("data-nscript",o),u&&p(u),document.body.appendChild(m)};function g(t){let{strategy:e="afterInteractive"}=t;"lazyOnload"===e?window.addEventListener("load",()=>{(0,u.requestIdleCallback)(()=>f(t))}):f(t)}function m(t){t.forEach(g),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(t=>{let e=t.id||t.getAttribute("src");c.add(e)})}function _(t){let{id:e,src:i="",onLoad:r=()=>{},onReady:s=null,strategy:h="afterInteractive",onError:d,stylesheets:p,...g}=t,{updateScripts:m,scripts:_,getIsSsr:y,appDir:v,nonce:x}=(0,o.useContext)(l.HeadManagerContext),b=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let t=e||i;b.current||(s&&t&&c.has(t)&&s(),b.current=!0)},[s,e,i]);let T=(0,o.useRef)(!1);if((0,o.useEffect)(()=>{if(!T.current){if("afterInteractive"===h)f(t);else"lazyOnload"===h&&("complete"===document.readyState?(0,u.requestIdleCallback)(()=>f(t)):window.addEventListener("load",()=>{(0,u.requestIdleCallback)(()=>f(t))}));T.current=!0}},[t,h]),("beforeInteractive"===h||"worker"===h)&&(m?(_[h]=(_[h]||[]).concat([{id:e,src:i,onLoad:r,onReady:s,onError:d,...g}]),m(_)):y&&y()?c.add(e||i):y&&!y()&&f(t)),v){if(p&&p.forEach(t=>{n.default.preinit(t,{as:"style"})}),"beforeInteractive"===h)if(!i)return g.dangerouslySetInnerHTML&&(g.children=g.dangerouslySetInnerHTML.__html,delete g.dangerouslySetInnerHTML),(0,a.jsx)("script",{nonce:x,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([0,{...g,id:e}])+")"}});else return n.default.preload(i,g.integrity?{as:"script",integrity:g.integrity,nonce:x,crossOrigin:g.crossOrigin}:{as:"script",nonce:x,crossOrigin:g.crossOrigin}),(0,a.jsx)("script",{nonce:x,dangerouslySetInnerHTML:{__html:"(self.__next_s=self.__next_s||[]).push("+JSON.stringify([i,{...g,id:e}])+")"}});"afterInteractive"===h&&i&&n.default.preload(i,g.integrity?{as:"script",integrity:g.integrity,nonce:x,crossOrigin:g.crossOrigin}:{as:"script",nonce:x,crossOrigin:g.crossOrigin})}return null}Object.defineProperty(_,"__nextScript",{value:!0});let y=_;("function"==typeof e.default||"object"==typeof e.default&&null!==e.default)&&void 0===e.default.__esModule&&(Object.defineProperty(e.default,"__esModule",{value:!0}),Object.assign(e.default,e),t.exports=e.default)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.