diff options
| author | LLLL Colonq <llll@colonq> | 2026-08-04 04:35:44 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2026-08-04 04:35:44 -0400 |
| commit | 3c7796f066647090ed8436778bdfe25f11844c05 (patch) | |
| tree | 0644a101004d91af4fcdc2f51fcc2e03f7f255ce /2026/games_submissions/sunshoes | |
| parent | a75221ab93f59d688f90cd83f0284ff98951fcfa (diff) | |
Prepare for upload
Diffstat (limited to '2026/games_submissions/sunshoes')
45 files changed, 0 insertions, 1104 deletions
diff --git a/2026/games_submissions/sunshoes/assets/BitmapFont-CoN36Cy_.js b/2026/games_submissions/sunshoes/assets/BitmapFont-CoN36Cy_.js deleted file mode 100644 index e5df6a3..0000000 --- a/2026/games_submissions/sunshoes/assets/BitmapFont-CoN36Cy_.js +++ /dev/null @@ -1,6 +0,0 @@ -import{E as q,d as B,v as k,T as O,f as j,b as E,C as P,R as H,c as $,I as J,g as K,e as V,h as L,i as Z,j as Q,k as ee,l as Y,m as te,n as se,o as C,w as ie,p as ne}from"./index-DvAPfvr6.js";class D extends q{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return B(k,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return B(k,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return B(k,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return B(k,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return B(k,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(e=!1){var t;this.emit("destroy",this),this.removeAllListeners();for(const s in this.chars)(t=this.chars[s].texture)==null||t.destroy();this.chars=null,e&&(this.pages.forEach(s=>s.texture.destroy(!0)),this.pages=null)}}const U=class G extends D{constructor(e){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentMaxCharHeight=0,this._currentPageIndex=-1,this._skipKerning=!1;const t={...G.defaultOptions,...e};this._textureSize=t.textureSize,this._mipmap=t.mipmap;const s=t.style.clone();t.overrideFill&&(s._fill.color=16777215,s._fill.alpha=1,s._fill.texture=O.WHITE,s._fill.fill=null),this.applyFillAsTint=t.overrideFill;const i=s.fontSize;s.fontSize=this.baseMeasurementFontSize;const n=j(s);t.overrideSize?(s._stroke&&(s._stroke.width*=this.baseRenderedFontSize/i),s.dropShadow&&(s.dropShadow.blur*=this.baseRenderedFontSize/i,s.dropShadow.distance*=this.baseRenderedFontSize/i)):s.fontSize=this.baseRenderedFontSize=i,this._style=s,this._skipKerning=t.skipKerning??!1,this.resolution=t.resolution??1,this._padding=t.padding??4,t.textureStyle&&(this._textureStyle=t.textureStyle instanceof E?t.textureStyle:new E(t.textureStyle)),this.fontMetrics=P.measureFont(n),this.lineHeight=s.lineHeight||this.fontMetrics.fontSize||s.fontSize}ensureCharacters(e){var _,v;const t=P.graphemeSegmenter(e).filter(y=>!this._currentChars.includes(y)).filter((y,m,d)=>d.indexOf(y)===m);if(!t.length)return;this._currentChars=[...this._currentChars,...t];let s;this._currentPageIndex===-1?s=this._nextPage():s=this.pages[this._currentPageIndex];let{canvas:i,context:n}=s.canvasAndContext,a=s.texture.source;const o=this._style;let r=this._currentX,h=this._currentY,l=this._currentMaxCharHeight;const f=this.baseRenderedFontSize/this.baseMeasurementFontSize,w=(((_=o.dropShadow)==null?void 0:_.distance)??0)+(((v=o._stroke)==null?void 0:v.width)??0),F=this._padding+w;let x=!1;const z=i.width/this.resolution,b=i.height/this.resolution;for(let y=0;y<t.length;y++){const m=t[y],d=P.measureText(m,o,i,!1);d.lineHeight=d.height;const p=d.width*f,g=Math.ceil((o.fontStyle==="italic"?2:1)*p),u=d.height*f,W=g+F*2,M=u+F*2;if(x=!1,m!==` -`&&m!=="\r"&&m!==" "&&m!==" "&&(x=!0,l=Math.ceil(Math.max(M,l))),r+W>z&&(h+=l,l=M,r=0,h+l>b)){a.update();const S=this._nextPage();i=S.canvasAndContext.canvas,n=S.canvasAndContext.context,a=S.texture.source,r=0,h=0,l=0}const T=n.measureText(m).width/f;if(this.chars[m]={id:m.codePointAt(0),xOffset:-(F/f),yOffset:-(F/f),xAdvance:T,kerning:{}},x){this._drawGlyph(n,d,r+F,h+F,f,o);const S=a.width*f,I=a.height*f,R=new H(r/S*a.width,h/I*a.height,W/S*a.width,M/I*a.height);this.chars[m].texture=new O({source:a,frame:R}),r+=Math.ceil(W)}}a.update(),this._currentX=r,this._currentY=h,this._currentMaxCharHeight=l,this._skipKerning||this._applyKerning(t,n,f)}get pageTextures(){return B(k,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(e,t,s){const i=this._measureCache;for(let n=0;n<e.length;n++){const a=e[n];for(let o=0;o<this._currentChars.length;o++){const r=this._currentChars[o];let h=i[a];h||(h=i[a]=t.measureText(a).width);let l=i[r];l||(l=i[r]=t.measureText(r).width);let f=t.measureText(a+r).width,w=f-(h+l);w&&this.chars[a]&&(this.chars[a].kerning[r]=w/s),f=t.measureText(a+r).width,w=f-(h+l),w&&this.chars[r]&&(this.chars[r].kerning[a]=w/s)}}}_nextPage(){this._currentPageIndex++;const e=this.resolution,t=$.getOptimalCanvasAndContext(this._textureSize,this._textureSize,e);this._setupContext(t.context,this._style,e);const s=e*(this.baseRenderedFontSize/this.baseMeasurementFontSize),i=new O({source:new J({resource:t.canvas,resolution:s,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})});this._textureStyle&&(i.source.style=this._textureStyle);const n={canvasAndContext:t,texture:i};return this.pages[this._currentPageIndex]=n,n}_setupContext(e,t,s){t.fontSize=this.baseRenderedFontSize,e.scale(s,s),e.font=j(t),t.fontSize=this.baseMeasurementFontSize,e.textBaseline=t.textBaseline;const i=t._stroke,n=(i==null?void 0:i.width)??0;if(i&&(e.lineWidth=n,e.lineJoin=i.join,e.miterLimit=i.miterLimit,e.strokeStyle=K(i,e)),t._fill&&(e.fillStyle=K(t._fill,e)),t.dropShadow){const a=t.dropShadow,o=V.shared.setValue(a.color).toArray(),r=a.blur*s,h=a.distance*s;e.shadowColor=`rgba(${o[0]*255},${o[1]*255},${o[2]*255},${a.alpha})`,e.shadowBlur=r,e.shadowOffsetX=Math.cos(a.angle)*h,e.shadowOffsetY=Math.sin(a.angle)*h}else e.shadowColor="black",e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0}_drawGlyph(e,t,s,i,n,a){const o=t.text,r=t.fontProperties,h=a._stroke,l=((h==null?void 0:h.width)??0)*n,f=s+l/2,w=i-l/2,F=r.descent*n,x=t.lineHeight*n;let z=!1;a.stroke&&l&&(z=!0,e.strokeText(o,f,w+x-F));const{shadowBlur:b,shadowOffsetX:_,shadowOffsetY:v}=e;a._fill&&(z&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillText(o,f,w+x-F)),z&&(e.shadowBlur=b,e.shadowOffsetX=_,e.shadowOffsetY=v)}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){const{canvasAndContext:t,texture:s}=this.pages[e];$.returnCanvasAndContext(t),s.destroy(!0)}this.pages=null}};U.defaultOptions={textureSize:512,style:new L,mipmap:!0};let N=U;function ae(c,e,t,s){var y,m;const i={width:0,height:0,offsetY:0,scale:e.fontSize/t.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};i.offsetY=t.baseLineOffset;let n=i.lines[0],a=null,o=!0;const r={width:0,start:0,index:0,positions:[],chars:[]},h=t.baseMeasurementFontSize/e.fontSize,l=e.letterSpacing*h,f=e.wordWrapWidth*h,w=e.lineHeight?e.lineHeight*h:t.lineHeight,F=e.wordWrap&&e.breakWords,x=Z(e.whiteSpace),z=Q(e.whiteSpace);if(x||z){const d=[];let p=x;for(let g=0;g<c.length;g++){let u=c[g];if(u==="\r"||u===` -`)if(z)u==="\r"&&c[g+1]===` -`&&g++,u=" ";else{x&&(p=!0),d.push(u);continue}if(ee(u))if(x&&Y(u)){if(p)continue;p=!0,d.push(" ")}else p=!1,d.push(u);else p=!1,d.push(u)}c=d}const b=d=>{const p=n.width;for(let g=0;g<r.index;g++){const u=d.positions[g];n.chars.push(d.chars[g]),n.charPositions.push(u+p)}n.width+=d.width,(r.index>0||!x)&&(o=!1),r.width=0,r.index=0,r.chars.length=0},_=()=>{let d=n.chars.length-1;if(s){let p=n.chars[d];for(;Y(p);)n.width-=t.chars[p].xAdvance,n.spacesIndex.pop(),p=n.chars[--d]}i.width=Math.max(i.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,i.lines.push(n),i.height+=w},v=d=>d-l>f;for(let d=0;d<c.length+1;d++){let p;const g=d===c.length;g||(p=c[d]);const u=t.chars[p];if(/(?:\s)/.test(p)||p==="\r"||p===` -`||g){if(!o&&e.wordWrap&&v(n.width+r.width)?(_(),b(r),!g&&u&&n.charPositions.push(0)):(r.start=n.width,b(r),!g&&u&&n.charPositions.push(0)),p==="\r"||p===` -`)_();else if(!g&&u){const S=u.xAdvance+(((y=u.kerning)==null?void 0:y[a])||0)+l;n.width+=S,n.spaceWidth=S,n.spacesIndex.push(n.charPositions.length),n.chars.push(p)}}else if(u){const T=((m=u.kerning)==null?void 0:m[a])||0,S=u.xAdvance+T+l;F&&v(r.width+S)&&(o||_(),b(r),_()),r.positions[r.index++]=r.width+T,r.chars.push(p),r.width+=S,te(p)&&(!o&&e.wordWrap&&v(n.width+r.width)&&_(),b(r))}a=p}return _(),e.align==="center"?re(i):e.align==="right"?oe(i):e.align==="justify"&&he(i),i}function re(c){for(let e=0;e<c.lines.length;e++){const t=c.lines[e],s=c.width/2-t.width/2;for(let i=0;i<t.charPositions.length;i++)t.charPositions[i]+=s}}function oe(c){for(let e=0;e<c.lines.length;e++){const t=c.lines[e],s=c.width-t.width;for(let i=0;i<t.charPositions.length;i++)t.charPositions[i]+=s}}function he(c){const e=c.width;for(let t=0;t<c.lines.length-2;t++){const s=c.lines[t];let i=0,n=s.spacesIndex[i++],a=0;const o=s.spacesIndex.length,h=(e-s.width)/o;for(let l=0;l<s.charPositions.length;l++)l===n&&(n=s.spacesIndex[i++],a+=h),s.charPositions[l]+=a}}function le(c){if(c==="")return[];typeof c=="string"&&(c=[c]);const e=[];for(let t=0,s=c.length;t<s;t++){const i=c[t];if(Array.isArray(i)){if(i.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);if(i[0].length===0||i[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");const n=i[0].charCodeAt(0),a=i[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let o=n,r=a;o<=r;o++)e.push(String.fromCharCode(o))}else e.push(...Array.from(i))}if(e.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return e}let A=0;class ce{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1,textureStyle:null},this.measureCache=se(1e3)}getFont(e,t){var a,o;let s=`${t.fontFamily}-bitmap`,i=!0;if(C.has(s)){const r=C.get(s);return(a=r.ensureCharacters)==null||a.call(r,e),r}if(t._fill.fill&&!t._stroke?(s+=t._fill.fill.styleKey,i=!1):(t._stroke||t.dropShadow)&&(s=`${t.styleKey}-bitmap`,i=!1),s+=`-${t.fontStyle}`,s+=`-${t.fontVariant}`,s+=`-${t.fontWeight}`,!C.has(s)){const r=Object.create(t);r._lineHeight=0;const h=new N({style:r,overrideFill:i,overrideSize:!0,...this.defaultOptions});A++,A>50&&ie("BitmapText",`You have dynamically created ${A} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),h.once("destroy",()=>{A--,C.remove(s)}),C.set(s,h)}const n=C.get(s);return(o=n.ensureCharacters)==null||o.call(n,e),n}getLayout(e,t,s=!0){const i=this.getFont(e,t),n=`${e}-${t.styleKey}-${s}`;if(this.measureCache.has(n))return this.measureCache.get(n);const a=P.graphemeSegmenter(e),o=ae(a,t,i,s);return this.measureCache.set(n,o),o}measureText(e,t,s=!0){return this.getLayout(e,t,s)}install(...e){var h,l,f,w;let t=e[0];typeof t=="string"&&(t={name:t,style:e[1],chars:(h=e[2])==null?void 0:h.chars,resolution:(l=e[2])==null?void 0:l.resolution,padding:(f=e[2])==null?void 0:f.padding,skipKerning:(w=e[2])==null?void 0:w.skipKerning},B(k,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));const s=t==null?void 0:t.name;if(!s)throw new Error("[BitmapFontManager] Property `name` is required.");t={...this.defaultOptions,...t};const i=t.style,n=i instanceof L?i:new L(i),a=t.dynamicFill??this._canUseTintForStyle(n),o=new N({style:n,overrideFill:a,skipKerning:t.skipKerning,padding:t.padding,resolution:t.resolution,overrideSize:!1,textureStyle:t.textureStyle}),r=le(t.chars);return o.ensureCharacters(r.join("")),C.set(`${s}-bitmap`,o),o.once("destroy",()=>C.remove(`${s}-bitmap`)),o}uninstall(e){const t=`${e}-bitmap`,s=C.get(t);s&&s.destroy()}_canUseTintForStyle(e){return!e._stroke&&(!e.dropShadow||e.dropShadow.color===0)&&!e._fill.fill&&e._fill.color===16777215}}const X=new ce;class pe extends D{constructor(e,t){super();const{textures:s,data:i}=e;Object.keys(i.pages).forEach(n=>{const a=i.pages[parseInt(n,10)],o=s[a.id];this.pages.push({texture:o})}),Object.keys(i.chars).forEach(n=>{const a=i.chars[n],{frame:o,source:r,rotate:h}=s[a.page],l=ne.transformRectCoords(a,o,h,new H),f=new O({frame:l,orig:new H(0,0,a.width,a.height),source:r,rotate:h});this.chars[n]={id:n.codePointAt(0),xOffset:a.xOffset,yOffset:a.yOffset,xAdvance:a.xAdvance,kerning:a.kerning??{},texture:f}}),this.baseRenderedFontSize=i.fontSize,this.baseMeasurementFontSize=i.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:i.fontSize},this.baseLineOffset=i.baseLineOffset,this.lineHeight=i.lineHeight,this.fontFamily=i.fontFamily,this.distanceField=i.distanceField??{type:"none",range:0},this.url=t}destroy(){super.destroy();for(let e=0;e<this.pages.length;e++){const{texture:t}=this.pages[e];t.destroy(!0)}this.pages=null}static install(e){X.install(e)}static uninstall(e){X.uninstall(e)}}export{pe as BitmapFont}; diff --git a/2026/games_submissions/sunshoes/assets/BufferResource-BZpoqTVb.js b/2026/games_submissions/sunshoes/assets/BufferResource-BZpoqTVb.js deleted file mode 100644 index 0aef32c..0000000 --- a/2026/games_submissions/sunshoes/assets/BufferResource-BZpoqTVb.js +++ /dev/null @@ -1,185 +0,0 @@ -import{w as U,q as g,r as c,u as S,B as _,s as m,E as I,t as p}from"./index-DvAPfvr6.js";const x={name:"local-uniform-bit",vertex:{header:` - - struct LocalUniforms { - uTransformMatrix:mat3x3<f32>, - uColor:vec4<f32>, - uRound:f32, - } - - @group(1) @binding(0) var<uniform> localUniforms : LocalUniforms; - `,main:` - vColor *= localUniforms.uColor; - modelMatrix *= localUniforms.uTransformMatrix; - `,end:` - if(localUniforms.uRound == 1) - { - vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); - } - `}},C={...x,vertex:{...x.vertex,header:x.vertex.header.replace("group(1)","group(2)")}},D={name:"local-uniform-bit",vertex:{header:` - - uniform mat3 uTransformMatrix; - uniform vec4 uColor; - uniform float uRound; - `,main:` - vColor *= uColor; - modelMatrix = uTransformMatrix; - `,end:` - if(uRound == 1.) - { - gl_Position.xy = roundPixels(gl_Position.xy, uResolution); - } - `}},O={name:"texture-bit",vertex:{header:` - - struct TextureUniforms { - uTextureMatrix:mat3x3<f32>, - } - - @group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms; - `,main:` - uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; - `},fragment:{header:` - @group(2) @binding(0) var uTexture: texture_2d<f32>; - @group(2) @binding(1) var uSampler: sampler; - - - `,main:` - outColor = textureSample(uTexture, uSampler, vUV); - `}},R={name:"texture-bit",vertex:{header:` - uniform mat3 uTextureMatrix; - `,main:` - uv = (uTextureMatrix * vec3(uv, 1.0)).xy; - `},fragment:{header:` - uniform sampler2D uTexture; - - - `,main:` - outColor = texture(uTexture, vUV); - `}};function A(e,t){for(const a in e.attributes){const s=e.attributes[a],r=t[a];r?(s.format??(s.format=r.format),s.offset??(s.offset=r.offset),s.instance??(s.instance=r.instance)):U(`Attribute ${a} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}M(e)}function M(e){const{buffers:t,attributes:a}=e,s={},r={};for(const n in t){const o=t[n];s[o.uid]=0,r[o.uid]=0}for(const n in a){const o=a[n];s[o.buffer.uid]+=g(o.format).stride}for(const n in a){const o=a[n];o.stride??(o.stride=s[o.buffer.uid]),o.start??(o.start=r[o.buffer.uid]),r[o.buffer.uid]+=g(o.format).stride}}const l=[];l[c.NONE]=void 0;l[c.DISABLED]={stencilWriteMask:0,stencilReadMask:0};l[c.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};l[c.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};l[c.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};l[c.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"keep"},stencilBack:{compare:"not-equal",passOp:"keep"}};class B{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!S())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const a=this.getUniformGroupData(t);t.buffer||(t.buffer=new _({data:new Float32Array(a.layout.size/4),usage:m.UNIFORM|m.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const a=t._signature;let s=this._syncFunctionHash[a];if(!s){const r=Object.keys(t.uniformStructures).map(d=>t.uniformStructures[d]),n=this._adaptor.createUboElements(r),o=this._generateUboSync(n.uboElements);s=this._syncFunctionHash[a]={layout:n,syncFunction:o}}return this._syncFunctionHash[a]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,a,s){const r=this.getUniformGroupData(t);t.buffer||(t.buffer=new _({data:new Float32Array(r.layout.size/4),usage:m.UNIFORM|m.COPY_DST}));let n=null;return a||(a=t.buffer.data,n=t.buffer.dataInt32),s||(s=0),r.syncFunction(t.uniforms,a,n,s),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const a=this.syncUniformGroup(t);return t.buffer.update(),a}destroy(){this._syncFunctionHash=null}}const h=[{type:"mat3x3<f32>",test:e=>e.value.a!==void 0,ubo:` - var matrix = uv[name].toArray(true); - data[offset] = matrix[0]; - data[offset + 1] = matrix[1]; - data[offset + 2] = matrix[2]; - data[offset + 4] = matrix[3]; - data[offset + 5] = matrix[4]; - data[offset + 6] = matrix[5]; - data[offset + 8] = matrix[6]; - data[offset + 9] = matrix[7]; - data[offset + 10] = matrix[8]; - `,uniform:` - gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); - `},{type:"vec4<f32>",test:e=>e.type==="vec4<f32>"&&e.size===1&&e.value.width!==void 0,ubo:` - v = uv[name]; - data[offset] = v.x; - data[offset + 1] = v.y; - data[offset + 2] = v.width; - data[offset + 3] = v.height; - `,uniform:` - cv = ud[name].value; - v = uv[name]; - if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { - cv[0] = v.x; - cv[1] = v.y; - cv[2] = v.width; - cv[3] = v.height; - gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); - } - `},{type:"vec2<f32>",test:e=>e.type==="vec2<f32>"&&e.size===1&&e.value.x!==void 0,ubo:` - v = uv[name]; - data[offset] = v.x; - data[offset + 1] = v.y; - `,uniform:` - cv = ud[name].value; - v = uv[name]; - if (cv[0] !== v.x || cv[1] !== v.y) { - cv[0] = v.x; - cv[1] = v.y; - gl.uniform2f(ud[name].location, v.x, v.y); - } - `},{type:"vec4<f32>",test:e=>e.type==="vec4<f32>"&&e.size===1&&e.value.red!==void 0,ubo:` - v = uv[name]; - data[offset] = v.red; - data[offset + 1] = v.green; - data[offset + 2] = v.blue; - data[offset + 3] = v.alpha; - `,uniform:` - cv = ud[name].value; - v = uv[name]; - if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { - cv[0] = v.red; - cv[1] = v.green; - cv[2] = v.blue; - cv[3] = v.alpha; - gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); - } - `},{type:"vec3<f32>",test:e=>e.type==="vec3<f32>"&&e.size===1&&e.value.red!==void 0,ubo:` - v = uv[name]; - data[offset] = v.red; - data[offset + 1] = v.green; - data[offset + 2] = v.blue; - `,uniform:` - cv = ud[name].value; - v = uv[name]; - if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { - cv[0] = v.red; - cv[1] = v.green; - cv[2] = v.blue; - gl.uniform3f(ud[name].location, v.red, v.green, v.blue); - } - `}];function k(e,t,a,s){const r=[` - var v = null; - var v2 = null; - var t = 0; - var index = 0; - var name = null; - var arrayOffset = null; - `];let n=0;for(let d=0;d<e.length;d++){const f=e[d],b=f.data.name;let y=!1,i=0;for(let u=0;u<h.length;u++)if(h[u].test(f.data)){i=f.offset/4,r.push(`name = "${b}";`,`offset += ${i-n};`,h[u][t]||h[u].ubo),y=!0;break}if(!y)if(f.data.size>1)i=f.offset/4,r.push(a(f,i-n));else{const u=s[f.data.type];i=f.offset/4,r.push(` - v = uv.${b}; - offset += ${i-n}; - ${u}; - `)}n=i}const o=r.join(` -`);return new Function("uv","data","dataInt32","offset",o)}function v(e,t){return` - for (let i = 0; i < ${e*t}; i++) { - data[offset + (((i / ${e})|0) * 4) + (i % ${e})] = v[i]; - } - `}const F={f32:` - data[offset] = v;`,i32:` - dataInt32[offset] = v;`,"vec2<f32>":` - data[offset] = v[0]; - data[offset + 1] = v[1];`,"vec3<f32>":` - data[offset] = v[0]; - data[offset + 1] = v[1]; - data[offset + 2] = v[2];`,"vec4<f32>":` - data[offset] = v[0]; - data[offset + 1] = v[1]; - data[offset + 2] = v[2]; - data[offset + 3] = v[3];`,"vec2<i32>":` - dataInt32[offset] = v[0]; - dataInt32[offset + 1] = v[1];`,"vec3<i32>":` - dataInt32[offset] = v[0]; - dataInt32[offset + 1] = v[1]; - dataInt32[offset + 2] = v[2];`,"vec4<i32>":` - dataInt32[offset] = v[0]; - dataInt32[offset + 1] = v[1]; - dataInt32[offset + 2] = v[2]; - dataInt32[offset + 3] = v[3];`,"mat2x2<f32>":` - data[offset] = v[0]; - data[offset + 1] = v[1]; - data[offset + 4] = v[2]; - data[offset + 5] = v[3];`,"mat3x3<f32>":` - data[offset] = v[0]; - data[offset + 1] = v[1]; - data[offset + 2] = v[2]; - data[offset + 4] = v[3]; - data[offset + 5] = v[4]; - data[offset + 6] = v[5]; - data[offset + 8] = v[6]; - data[offset + 9] = v[7]; - data[offset + 10] = v[8];`,"mat4x4<f32>":` - for (let i = 0; i < 16; i++) { - data[offset + i] = v[i]; - }`,"mat3x2<f32>":v(3,2),"mat4x2<f32>":v(4,2),"mat2x3<f32>":v(2,3),"mat4x3<f32>":v(4,3),"mat2x4<f32>":v(2,4),"mat3x4<f32>":v(3,4)},w={...F,"mat2x2<f32>":` - data[offset] = v[0]; - data[offset + 1] = v[1]; - data[offset + 2] = v[2]; - data[offset + 3] = v[3]; - `};class P extends I{constructor({buffer:t,offset:a,size:s}){super(),this.uid=p("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=p("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=a|0,this.size=s,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=p("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null,this.removeAllListeners()}}export{P as B,l as G,B as U,x as a,F as b,k as c,h as d,A as e,D as f,R as g,C as l,O as t,w as u}; diff --git a/2026/games_submissions/sunshoes/assets/CanvasRenderer-Yf_04ykh.js b/2026/games_submissions/sunshoes/assets/CanvasRenderer-Yf_04ykh.js deleted file mode 100644 index 72bfc86..0000000 --- a/2026/games_submissions/sunshoes/assets/CanvasRenderer-Yf_04ykh.js +++ /dev/null @@ -1 +0,0 @@ -import{x as vt,y as ne,z as _,A as Dt,D as re,F as z,H as ae,V as oe,J as ot,d as E,v as W,K as T,p as At,L as Ft,M as ct,N as L,w as ie,O as Ut,P as Ht,Q as le,e as Et,T as Wt,U as ce,W as he,X as de,Y as ue,Z as Lt,_ as pe,$ as fe}from"./index-DvAPfvr6.js";import{c as me,R as xe,S as ge,B as Ce,a as _e,b as ye,d as ve,A as be,C as Te}from"./RenderTargetSystem-Cp6tD-lP.js";import{S as qt}from"./Filter-BiIvpnZm.js";class Se{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class Pe{constructor(){this.instructions=new ne}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const bt=class yt{constructor(t){this._renderer=t,this._managedContexts=new vt({renderer:t,type:"resource",name:"graphicsContext"})}init(t){yt.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??yt.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,s=!!e[this._renderer.uid],n=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!s)&&(s&&n.reset(),n.isBatchable=!1,t.dirty=!1),n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new Pe,s=this.getGpuContext(t);return s.graphicsData=e,e.init(),e}_initContext(t){const e=new Se;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};bt.extension={type:[_.CanvasSystem],name:"graphicsContext"};bt.defaultOptions={bezierSmoothness:.5};let Me=bt;class Ot{constructor(t,e){this.state=qt.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new vt({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}Ot.extension={type:[_.CanvasPipes],name:"graphics"};class ke{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{Dt.return(t)}),this.batches.length=0}}class Vt{constructor(t,e){this.state=qt.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new vt({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,s=!!t._gpuData,r=this.renderer.graphicsContext.updateGpuContext(e);return!!(r.isBatchable||s!==r.isBatchable)}addRenderable(t,e){const n=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),n.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const s=this._getGpuDataForRenderable(t).batches;for(let n=0;n<s.length;n++){const r=s[n];r._batcher.updateElement(r)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,s=t.context;if(!e.graphicsContext.getGpuContext(s).batches.length)return;const r=s.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const o=r.resources.localUniforms.uniforms;o.uTransformMatrix=t.groupTransform,o.uRound=e._roundPixels|t._roundPixels,me(t.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),n=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),n.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const s=this.renderer.renderPipes.batch,n=this._getGpuDataForRenderable(t).batches;for(let r=0;r<n.length;r++){const o=n[r];s.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new ke;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const s=t.context,r=this.renderer.graphicsContext.getGpuContext(s),o=this.renderer._roundPixels|t._roundPixels;e.batches=r.batches.map(l=>{const i=Dt.get(re);return l.copyTo(i),i.renderable=t,i.roundPixels=o,i})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Vt.extension={type:[_.WebGLPipes,_.WebGPUPipes],name:"graphics"};z.add(Ot);z.add(Vt);z.add(Me);z.add(ae);class dt extends oe{constructor(t){t instanceof ot&&(t={context:t});const{context:e,roundPixels:s,...n}=t||{};super({label:"Graphics",...n}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new ot,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=s??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new dt(this._context.clone()):(this._ownedContext=null,new dt(this._context))}lineStyle(t,e,s){E(W,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const n={};return t&&(n.width=t),e&&(n.color=e),s&&(n.alpha=s),this.context.strokeStyle=n,this}beginFill(t,e){E(W,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const s={};return t!==void 0&&(s.color=t),e!==void 0&&(s.alpha=e),this.context.fillStyle=s,this}endFill(){E(W,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==ot.defaultStrokeStyle.width||t.color!==ot.defaultStrokeStyle.color||t.alpha!==ot.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return E(W,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return E(W,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return E(W,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return E(W,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return E(W,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return E(W,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}const Tt=class K{static _getPatternRepeat(t,e){const s=t&&t!=="clamp-to-edge",n=e&&e!=="clamp-to-edge";return s&&n?"repeat":s?"repeat-x":n?"repeat-y":"no-repeat"}start(t,e,s){}execute(t,e){var l,i,p,f;const s=e.elements;if(!s||!s.length)return;const n=t.renderer,r=n.canvasContext,o=r.activeContext;for(let y=0;y<s.length;y++){const A=s[y];if(!A.packAsQuad)continue;const g=A,m=g.texture,k=m?T.getCanvasSource(m):null;if(!k)continue;const C=m.source.style,B=r.smoothProperty,$=C.scaleMode!=="nearest";o[B]!==$&&(o[B]=$),r.setBlendMode(e.blendMode);const q=((l=n.globalUniforms.globalUniformData)==null?void 0:l.worldColor)??4294967295,F=g.color,S=(q>>>24&255)/255,v=(F>>>24&255)/255,X=((i=n.filter)==null?void 0:i.alphaMultiplier)??1,et=S*v*X;if(et<=0)continue;o.globalAlpha=et;const st=q&16777215,Q=F&16777215,P=Ft(ct(Q,st)),w=m.frame,R=C.addressModeU??C.addressMode,ut=C.addressModeV??C.addressMode,nt=K._getPatternRepeat(R,ut),O=m.source._resolution??m.source.resolution??1,J=(f=(p=g.renderable)==null?void 0:p.renderGroup)==null?void 0:f.isCachedAsTexture,d=w.x*O,u=w.y*O,x=w.width*O,V=w.height*O,G=g.bounds,M=n.renderTarget.renderTarget.isRoot,U=G.minX,H=G.minY,I=G.maxX-G.minX,D=G.maxY-G.minY,N=m.rotate,c=m.uvs,Y=Math.min(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),j=Math.max(c.x0,c.x1,c.x2,c.x3,c.y0,c.y1,c.y2,c.y3),b=nt!=="no-repeat"&&(Y<0||j>1),it=N&&!(!b&&(P!==16777215||N));it?(K._tempPatternMatrix.copyFrom(g.transform),At.matrixAppendRotationInv(K._tempPatternMatrix,N,U,H,I,D),r.setContextTransform(K._tempPatternMatrix,g.roundPixels===1,void 0,J&&M)):r.setContextTransform(g.transform,g.roundPixels===1,void 0,J&&M);const pt=I,ft=D;let rt=it?0:U,at=it?0:H;if(!it&&g.roundPixels===1&&(rt|=0,at|=0),b){let mt=k;const Z=P!==16777215&&!N,tt=w.width<=m.source.width&&w.height<=m.source.height;Z&&tt&&(mt=T.getTintedCanvas({texture:m},P));const xt=o.createPattern(mt,nt);if(!xt)continue;const Pt=pt,Mt=ft;if(Pt===0||Mt===0)continue;const kt=1/Pt,wt=1/Mt,Rt=(c.x1-c.x0)*kt,Gt=(c.y1-c.y0)*kt,Bt=(c.x3-c.x0)*wt,It=(c.y3-c.y0)*wt,ee=c.x0-Rt*rt-Bt*at,se=c.y0-Gt*rt-It*at,gt=m.source.pixelWidth,Ct=m.source.pixelHeight;K._tempPatternMatrix.set(Rt*gt,Gt*Ct,Bt*gt,It*Ct,ee*gt,se*Ct),T.applyPatternTransform(xt,K._tempPatternMatrix),o.fillStyle=xt,o.fillRect(rt,at,pt,ft)}else{const Z=P!==16777215||N?T.getTintedCanvas({texture:m},P):k,tt=Z!==k;o.drawImage(Z,tt?0:d,tt?0:u,tt?Z.width:x,tt?Z.height:V,rt,at,pt,ft)}}}};Tt._tempPatternMatrix=new L;Tt.extension={type:[_.CanvasPipesAdaptor],name:"batch"};let we=Tt;class Nt{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,s){this._renderer.renderPipes.batch.break(s);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&t.mask;const r=this._colorStack[this._colorStackIndex];r!==this._currentColor&&(this._currentColor=r,s.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1})),this._colorStackIndex++}pop(t,e,s){this._renderer.renderPipes.batch.break(s);const n=this._colorStack;this._colorStackIndex--;const r=n[this._colorStackIndex-1];r!==this._currentColor&&(this._currentColor=r,s.add({renderPipeId:"colorMask",colorMask:r,canBundle:!1}))}execute(t){}destroy(){this._renderer=null,this._colorStack=null}}Nt.extension={type:[_.CanvasPipes],name:"colorMask"};function Re(a,t,e,s,n,r){r=Math.max(0,Math.min(r,Math.min(s,n)/2)),a.moveTo(t+r,e),a.lineTo(t+s-r,e),a.quadraticCurveTo(t+s,e,t+s,e+r),a.lineTo(t+s,e+n-r),a.quadraticCurveTo(t+s,e+n,t+s-r,e+n),a.lineTo(t+r,e+n),a.quadraticCurveTo(t,e+n,t,e+n-r),a.lineTo(t,e+r),a.quadraticCurveTo(t,e,t+r,e)}function Yt(a,t){switch(t.type){case"rectangle":{const e=t;a.rect(e.x,e.y,e.width,e.height);break}case"roundedRectangle":{const e=t;Re(a,e.x,e.y,e.width,e.height,e.radius);break}case"circle":{const e=t;a.moveTo(e.x+e.radius,e.y),a.arc(e.x,e.y,e.radius,0,Math.PI*2);break}case"ellipse":{const e=t;a.ellipse?(a.moveTo(e.x+e.halfWidth,e.y),a.ellipse(e.x,e.y,e.halfWidth,e.halfHeight,0,0,Math.PI*2)):(a.save(),a.translate(e.x,e.y),a.scale(e.halfWidth,e.halfHeight),a.moveTo(1,0),a.arc(0,0,1,0,Math.PI*2),a.restore());break}case"triangle":{const e=t;a.moveTo(e.x,e.y),a.lineTo(e.x2,e.y2),a.lineTo(e.x3,e.y3),a.closePath();break}case"polygon":default:{const e=t,s=e.points;if(!(s!=null&&s.length))break;a.moveTo(s[0],s[1]);for(let n=2;n<s.length;n+=2)a.lineTo(s[n],s[n+1]);e.closePath&&a.closePath();break}}}function Ge(a,t,e){const s=[],n=[],r=[],o=Ut[t.type];if(!(o!=null&&o.build(t,s)))return!1;const l=t.closePath??!0;Ht(s,e,!1,l,n,r);for(let i=0;i<r.length;i+=3){const p=r[i]*2,f=r[i+1]*2,y=r[i+2]*2;a.moveTo(n[p],n[p+1]),a.lineTo(n[f],n[f+1]),a.lineTo(n[y],n[y+1]),a.closePath()}return!0}function Be(a,t){if(!(t!=null&&t.length))return!1;for(let e=0;e<t.length;e++){const s=t[e];if(!(s!=null&&s.shape))continue;const n=s.transform,r=n&&!n.isIdentity();r&&(a.save(),a.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),Yt(a,s.shape),r&&a.restore()}return!0}class jt{constructor(t){this._warnedMaskTypes=new Set,this._canvasMaskStack=[],this._renderer=t}push(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){var f,y,A;if(t.action!=="pushMaskBegin"&&t.action!=="popMaskEnd")return;const e=this._renderer,s=e.canvasContext,n=s==null?void 0:s.activeContext;if(!n)return;if(t.action==="popMaskEnd"){this._canvasMaskStack.pop()&&n.restore();return}t.inverse&&this._warnOnce("inverse","CanvasRenderer: inverse masks are not supported on Canvas2D; ignoring inverse flag.");const r=t.mask.mask;if(!(r instanceof dt)){this._warnOnce("nonGraphics","CanvasRenderer: only Graphics masks are supported in Canvas2D; skipping mask."),this._canvasMaskStack.push(!1);return}const o=r,l=(f=o.context)==null?void 0:f.instructions;if(!(l!=null&&l.length)){this._canvasMaskStack.push(!1);return}n.save(),s.setContextTransform(o.groupTransform,(e._roundPixels|o._roundPixels)===1),n.beginPath();let i=!1,p=!1;for(let g=0;g<l.length;g++){const m=l[g],k=m.action;if(k!=="fill"&&k!=="stroke")continue;const C=m.data,B=(y=C==null?void 0:C.path)==null?void 0:y.shapePath;if(!((A=B==null?void 0:B.shapePrimitives)!=null&&A.length))continue;const $=k==="stroke",q=B.shapePrimitives;for(let F=0;F<q.length;F++){const S=q[F];if(!(S!=null&&S.shape))continue;const v=S.transform,X=v&&!v.isIdentity();X&&(n.save(),n.transform(v.a,v.b,v.c,v.d,v.tx,v.ty)),$&&C.style?i=Ge(n,S.shape,C.style)||i:(Yt(n,S.shape),p=Be(n,S.holes)||p,i=!0),X&&n.restore()}}if(!i){n.restore(),this._canvasMaskStack.push(!1);return}p?n.clip("evenodd"):n.clip(),this._canvasMaskStack.push(!0)}destroy(){this._renderer=null,this._warnedMaskTypes=null,this._canvasMaskStack=null}_warnOnce(t,e){this._warnedMaskTypes.has(t)||(this._warnedMaskTypes.add(t),ie(e))}}jt.extension={type:[_.CanvasPipes],name:"stencilMask"};const h="source-over";function Ie(){const a=le(),t=Object.create(null);return t.inherit=h,t.none=h,t.normal="source-over",t.add="lighter",t.multiply=a?"multiply":h,t.screen=a?"screen":h,t.overlay=a?"overlay":h,t.darken=a?"darken":h,t.lighten=a?"lighten":h,t["color-dodge"]=a?"color-dodge":h,t["color-burn"]=a?"color-burn":h,t["hard-light"]=a?"hard-light":h,t["soft-light"]=a?"soft-light":h,t.difference=a?"difference":h,t.exclusion=a?"exclusion":h,t.saturation=a?"saturation":h,t.color=a?"color":h,t.luminosity=a?"luminosity":h,t["linear-burn"]=a?"color-burn":h,t["linear-dodge"]=a?"color-dodge":h,t["linear-light"]=a?"hard-light":h,t["pin-light"]=a?"hard-light":h,t["vivid-light"]=a?"hard-light":h,t["hard-mix"]=h,t.negation=a?"difference":h,t["normal-npm"]=t.normal,t["add-npm"]=t.add,t["screen-npm"]=t.screen,t.erase="destination-out",t.subtract=h,t.divide=h,t.min=h,t.max=h,t}const De=new L;class zt{constructor(t){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=Ie(),this._activeBlendMode="normal",this._projTransform=null,this._outerBlend=!1,this._warnedBlendModes=new Set,this._renderer=t}resolutionChange(t){this.activeResolution=t}init(){const t=this._renderer.background.alpha<1;if(this.rootContext=this._renderer.canvas.getContext("2d",{alpha:t}),this.activeContext=this.rootContext,this.activeResolution=this._renderer.resolution,!this.rootContext.imageSmoothingEnabled){const e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(t,e,s,n){var p;const r=n?L.IDENTITY:((p=this._renderer.globalUniforms.globalUniformData)==null?void 0:p.worldTransformMatrix)||L.IDENTITY;let o=De;o.copyFrom(r),o.append(t);const l=this._projTransform,i=this.activeResolution;if(s=s||i,l){const f=L.shared;f.copyFrom(o),f.prepend(l),o=f}e?this.activeContext.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*i|0,o.ty*i|0):this.activeContext.setTransform(o.a*s,o.b*s,o.c*s,o.d*s,o.tx*i,o.ty*i)}clear(t,e){const s=this.activeContext,n=this._renderer;if(s.clearRect(0,0,n.width,n.height),t){const r=Et.shared.setValue(t);s.globalAlpha=e??r.alpha,s.fillStyle=r.toHex(),s.fillRect(0,0,n.width,n.height),s.globalAlpha=1}}setBlendMode(t){if(this._activeBlendMode===t)return;this._activeBlendMode=t,this._outerBlend=!1;const e=this.blendModes[t];if(!e){this._warnedBlendModes.has(t)||(console.warn(`CanvasRenderer: blend mode "${t}" is not supported in Canvas2D; falling back to "source-over".`),this._warnedBlendModes.add(t)),this.activeContext.globalCompositeOperation="source-over";return}this.activeContext.globalCompositeOperation=e}destroy(){this.rootContext=null,this.activeContext=null,this._warnedBlendModes.clear()}}zt.extension={type:[_.CanvasSystem],name:"canvasContext"};class $t{constructor(){this.maxTextures=16,this.maxBatchableTextures=16,this.maxUniformBindings=0}init(){}}$t.extension={type:[_.CanvasSystem],name:"limits"};const Ae="#808080",lt=new L,Fe=new L,Ue=new L,_t=new L;function He(a,t,e){a.beginPath();for(let s=0;s<e.length;s+=3){const n=e[s]*2,r=e[s+1]*2,o=e[s+2]*2;a.moveTo(t[n],t[n+1]),a.lineTo(t[r],t[r+1]),a.lineTo(t[o],t[o+1]),a.closePath()}a.fill()}function Ee(a){return`#${(a&16777215).toString(16).padStart(6,"0")}`}function We(a,t,e,s,n,r){r=Math.max(0,Math.min(r,Math.min(s,n)/2)),a.moveTo(t+r,e),a.lineTo(t+s-r,e),a.quadraticCurveTo(t+s,e,t+s,e+r),a.lineTo(t+s,e+n-r),a.quadraticCurveTo(t+s,e+n,t+s-r,e+n),a.lineTo(t+r,e+n),a.quadraticCurveTo(t,e+n,t,e+n-r),a.lineTo(t,e+r),a.quadraticCurveTo(t,e,t+r,e)}function ht(a,t){switch(t.type){case"rectangle":{const e=t;a.rect(e.x,e.y,e.width,e.height);break}case"roundedRectangle":{const e=t;We(a,e.x,e.y,e.width,e.height,e.radius);break}case"circle":{const e=t;a.arc(e.x,e.y,e.radius,0,Math.PI*2);break}case"ellipse":{const e=t;a.ellipse?a.ellipse(e.x,e.y,e.halfWidth,e.halfHeight,0,0,Math.PI*2):(a.save(),a.translate(e.x,e.y),a.scale(e.halfWidth,e.halfHeight),a.arc(0,0,1,0,Math.PI*2),a.restore());break}case"triangle":{const e=t;a.moveTo(e.x,e.y),a.lineTo(e.x2,e.y2),a.lineTo(e.x3,e.y3),a.closePath();break}case"polygon":default:{const e=t,s=e.points;if(!(s!=null&&s.length))break;a.moveTo(s[0],s[1]);for(let n=2;n<s.length;n+=2)a.lineTo(s[n],s[n+1]);e.closePath&&a.closePath();break}}}function Le(a,t){if(!(t!=null&&t.length))return!1;for(let e=0;e<t.length;e++){const s=t[e];if(!(s!=null&&s.shape))continue;const n=s.transform,r=n&&!n.isIdentity();r&&(a.save(),a.transform(n.a,n.b,n.c,n.d,n.tx,n.ty)),ht(a,s.shape),r&&a.restore()}return!0}function qe(a,t,e,s){const n=a.fill;if(n instanceof he){n.buildGradient();const o=n.texture;if(o){const l=T.getTintedPattern(o,t),i=e?_t.copyFrom(e).scale(o.source.pixelWidth,o.source.pixelHeight):_t.copyFrom(n.transform);return s&&!a.textureSpace&&i.append(s),T.applyPatternTransform(l,i),l}}if(n instanceof de){const o=T.getTintedPattern(n.texture,t);return T.applyPatternTransform(o,n.transform,!1),o}const r=a.texture;if(r&&r!==Wt.WHITE){if(!r.source.resource)return Ae;const o=T.getTintedPattern(r,t),l=e?_t.copyFrom(e).scale(r.source.pixelWidth,r.source.pixelHeight):a.matrix;return T.applyPatternTransform(o,l),o}return Ee(t)}class Xt{constructor(){this.shader=null}contextChange(t){}execute(t,e){var $,q,F,S,v,X,et;const s=t.renderer,n=s.canvasContext,r=n.activeContext,o=e.groupTransform,l=(($=s.globalUniforms.globalUniformData)==null?void 0:$.worldColor)??4294967295,i=e.groupColorAlpha,p=(l>>>24&255)/255,f=(i>>>24&255)/255,y=((q=s.filter)==null?void 0:q.alphaMultiplier)??1,A=p*f*y;if(A<=0)return;const g=l&16777215,m=i&16777215,k=Ft(ct(m,g)),C=s._roundPixels|e._roundPixels;r.save(),n.setContextTransform(o,C===1),n.setBlendMode(e.groupBlendMode);const B=e.context.instructions;for(let st=0;st<B.length;st++){const Q=B[st];if(Q.action==="texture"){const d=Q.data,u=d.image,x=u?T.getCanvasSource(u):null;if(!x)continue;const V=d.alpha*A;if(V<=0)continue;const G=ct(d.style,k);r.globalAlpha=V;let M=x;G!==16777215&&(M=T.getTintedCanvas({texture:u},G));const U=u.frame,H=u.source._resolution??u.source.resolution??1;let I=U.x*H,D=U.y*H;const N=U.width*H,c=U.height*H;M!==x&&(I=0,D=0);const Y=d.transform,j=Y&&!Y.isIdentity(),b=u.rotate;j||b?(lt.copyFrom(o),j&<.append(Y),b&&At.matrixAppendRotationInv(lt,b,d.dx,d.dy,d.dw,d.dh),n.setContextTransform(lt,C===1)):n.setContextTransform(o,C===1),r.drawImage(M,I,D,M===x?N:M.width,M===x?c:M.height,b?0:d.dx,b?0:d.dy,d.dw,d.dh),(j||b)&&n.setContextTransform(o,C===1);continue}const P=Q.data,w=(F=P==null?void 0:P.path)==null?void 0:F.shapePath;if(!((S=w==null?void 0:w.shapePrimitives)!=null&&S.length))continue;const R=P.style,ut=ct(R.color,k),nt=R.alpha*A;if(nt<=0)continue;const O=Q.action==="stroke";if(r.globalAlpha=nt,O){const d=R;r.lineWidth=d.width,r.lineCap=d.cap,r.lineJoin=d.join,r.miterLimit=d.miterLimit}const J=w.shapePrimitives;if(!O&&((et=(X=(v=P.hole)==null?void 0:v.shapePath)==null?void 0:X.shapePrimitives)!=null&&et.length)){const d=J[J.length-1];d.holes=P.hole.shapePath.shapePrimitives}for(let d=0;d<J.length;d++){const u=J[d];if(!(u!=null&&u.shape))continue;const x=u.transform,V=x&&!x.isIdentity(),G=R.texture&&R.texture!==Wt.WHITE,M=R.textureSpace==="global"?x:null,U=G?ce(Fe,R,u.shape,M):null,H=V?Ue.copyFrom(o).append(x):o,I=qe(R,ut,U,H);if(V&&(r.save(),r.transform(x.a,x.b,x.c,x.d,x.tx,x.ty)),O){const D=R;if(D.alignment!==.5&&!D.pixelLine){const c=[],Y=[],j=[],b=Ut[u.shape.type];if(b!=null&&b.build(u.shape,c)){const St=u.shape.closePath??!0;Ht(c,D,!1,St,Y,j),r.fillStyle=I,He(r,Y,j)}else r.strokeStyle=I,r.beginPath(),ht(r,u.shape),r.stroke()}else r.strokeStyle=I,r.beginPath(),ht(r,u.shape),r.stroke()}else r.fillStyle=I,r.beginPath(),ht(r,u.shape),Le(r,u.holes)?r.fill("evenodd"):r.fill();V&&r.restore()}}r.restore()}destroy(){this.shader=null}}Xt.extension={type:[_.CanvasPipesAdaptor],name:"graphics"};class Oe{init(t,e){this._renderer=t,this._renderTargetSystem=e}initGpuRenderTarget(t){const e=t.colorTexture,{canvas:s,context:n}=this._ensureCanvas(e);return{canvas:s,context:n,width:s.width,height:s.height}}resizeGpuRenderTarget(t){const e=t.colorTexture,{canvas:s}=this._ensureCanvas(e);s.width=t.pixelWidth,s.height=t.pixelHeight}startRenderPass(t,e,s,n){const r=this._renderTargetSystem.getGpuRenderTarget(t);this._renderer.canvasContext.activeContext=r.context,this._renderer.canvasContext.activeResolution=t.resolution,e&&this.clear(t,e,s,n)}clear(t,e,s,n){const o=this._renderTargetSystem.getGpuRenderTarget(t).context,l=n||{x:0,y:0,width:t.pixelWidth,height:t.pixelHeight};if(o.setTransform(1,0,0,1,0,0),o.clearRect(l.x,l.y,l.width,l.height),s){const i=Et.shared.setValue(s);i.alpha>0&&(o.globalAlpha=i.alpha,o.fillStyle=i.toHex(),o.fillRect(l.x,l.y,l.width,l.height),o.globalAlpha=1)}}finishRenderPass(){}copyToTexture(t,e,s,n,r){const l=this._renderTargetSystem.getGpuRenderTarget(t).canvas,i=e.source,{context:p}=this._ensureCanvas(i),f=(r==null?void 0:r.x)??0,y=(r==null?void 0:r.y)??0;return p.drawImage(l,s.x,s.y,n.width,n.height,f,y,n.width,n.height),i.update(),e}destroyGpuRenderTarget(t){}_ensureCanvas(t){let e=t.resource;(!e||!ue.test(e))&&(e=Lt.get().createCanvas(t.pixelWidth,t.pixelHeight),t.resource=e),(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(e.width=t.pixelWidth,e.height=t.pixelHeight);const s=e.getContext("2d");return{canvas:e,context:s}}}class Jt extends xe{constructor(t){super(t),this.adaptor=new Oe,this.adaptor.init(t,this)}}Jt.extension={type:[_.CanvasSystem],name:"renderTarget"};class Kt{constructor(t){}init(){}initSource(t){}generateCanvas(t){const e=Lt.get().createCanvas(),s=e.getContext("2d"),n=T.getCanvasSource(t);if(!n)return e;const r=t.frame,o=t.source._resolution??t.source.resolution??1,l=r.x*o,i=r.y*o,p=r.width*o,f=r.height*o;return e.width=Math.ceil(p),e.height=Math.ceil(f),s.drawImage(n,l,i,p,f,0,0,p,f),e}getPixels(t){const e=this.generateCanvas(t);return{pixels:e.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,e.width,e.height).data,width:e.width,height:e.height}}destroy(){}}Kt.extension={type:[_.CanvasSystem],name:"texture"};const Ve=[...ge,zt,$t,Kt,Jt],Ne=[Ce,_e,ye,ve,be,jt,Nt,Te],Ye=[we,Xt],Qt=[],Zt=[],te=[];z.handleByNamedList(_.CanvasSystem,Qt);z.handleByNamedList(_.CanvasPipes,Zt);z.handleByNamedList(_.CanvasPipesAdaptor,te);z.add(...Ve,...Ne,...Ye);class Xe extends pe{constructor(){const t={name:"canvas",type:fe.CANVAS,systems:Qt,renderPipes:Zt,renderPipeAdaptors:te};super(t)}}export{Xe as CanvasRenderer}; diff --git a/2026/games_submissions/sunshoes/assets/Filter-BiIvpnZm.js b/2026/games_submissions/sunshoes/assets/Filter-BiIvpnZm.js deleted file mode 100644 index 127e4e5..0000000 --- a/2026/games_submissions/sunshoes/assets/Filter-BiIvpnZm.js +++ /dev/null @@ -1 +0,0 @@ -import{S as b,G as M,a as m}from"./index-DvAPfvr6.js";const F={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},i=0,n=1,d=2,r=3,l=4,o=5,h=class g{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<i)}set blend(t){!!(this.data&1<<i)!==t&&(this.data^=1<<i)}get offsets(){return!!(this.data&1<<n)}set offsets(t){!!(this.data&1<<n)!==t&&(this.data^=1<<n)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<d)}set culling(t){!!(this.data&1<<d)!==t&&(this.data^=1<<d)}get depthTest(){return!!(this.data&1<<r)}set depthTest(t){!!(this.data&1<<r)!==t&&(this.data^=1<<r)}get depthMask(){return!!(this.data&1<<o)}set depthMask(t){!!(this.data&1<<o)!==t&&(this.data^=1<<o)}get clockwiseFrontFace(){return!!(this.data&1<<l)}set clockwiseFrontFace(t){!!(this.data&1<<l)!==t&&(this.data^=1<<l)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=F[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const t=new g;return t.depthTest=!1,t.blend=!0,t}};h.default2d=h.for2d();let k=h;const p=class c extends b{constructor(t){t={...c.defaultOptions,...t},super(t),this.enabled=!0,this._state=k.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1),t.blendRequired&&this.addResource("uBackTexture",0,3)}apply(t,e,s,a){t.applyFilter(this,e,s,a)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const{gpu:e,gl:s,...a}=t;let f,u;return e&&(f=M.from(e)),s&&(u=m.from(s)),new c({gpuProgram:f,glProgram:u,...a})}};p.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};let y=p;export{y as F,k as S}; diff --git a/2026/games_submissions/sunshoes/assets/RenderTargetSystem-Cp6tD-lP.js b/2026/games_submissions/sunshoes/assets/RenderTargetSystem-Cp6tD-lP.js deleted file mode 100644 index ddb4458..0000000 --- a/2026/games_submissions/sunshoes/assets/RenderTargetSystem-Cp6tD-lP.js +++ /dev/null @@ -1,184 +0,0 @@ -import{ag as Ve,ab as oe,N as m,G as Ne,a as je,ah as le,z as l,F as W,A as w,ai as $e,aj as z,ak as T,$ as V,al as de,am as qe,T as f,r as g,a9 as D,an as ue,w as ce,ao as ee,ap as he,aq as pe,ar as fe,as as me,a4 as P,b as Ke,e as E,Z as N,aa as v,R as B,at as Ye,a2 as Je,a7 as Xe,a0 as te,au as re,d as p,t as Ze,Y as O,av as Qe,v as et,aw as tt,ax as rt}from"./index-DvAPfvr6.js";import{F as st,S as nt}from"./Filter-BiIvpnZm.js";var at=`in vec2 vMaskCoord; -in vec2 vTextureCoord; - -uniform sampler2D uTexture; -uniform sampler2D uMaskTexture; - -uniform float uAlpha; -uniform vec4 uMaskClamp; -uniform float uInverse; -uniform float uChannel; - -out vec4 finalColor; - -void main(void) -{ - float clip = step(3.5, - step(uMaskClamp.x, vMaskCoord.x) + - step(uMaskClamp.y, vMaskCoord.y) + - step(vMaskCoord.x, uMaskClamp.z) + - step(vMaskCoord.y, uMaskClamp.w)); - - // TODO look into why this is needed - float npmAlpha = uAlpha; - vec4 original = texture(uTexture, vTextureCoord); - vec4 masky = texture(uMaskTexture, vMaskCoord); - - float a; - if (uChannel == 1.0) { - a = masky.a * npmAlpha * clip; - } else { - float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); - a = alphaMul * masky.r * npmAlpha * clip; - } - - if (uInverse == 1.0) { - a = 1.0 - a; - } - - finalColor = original * a; -} -`,it=`in vec2 aPosition; - -out vec2 vTextureCoord; -out vec2 vMaskCoord; - - -uniform vec4 uInputSize; -uniform vec4 uOutputFrame; -uniform vec4 uOutputTexture; -uniform mat3 uFilterMatrix; - -vec4 filterVertexPosition( vec2 aPosition ) -{ - vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; - - position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; - position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; - - return vec4(position, 0.0, 1.0); -} - -vec2 filterTextureCoord( vec2 aPosition ) -{ - return aPosition * (uOutputFrame.zw * uInputSize.zw); -} - -vec2 getFilterCoord( vec2 aPosition ) -{ - return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; -} - -void main(void) -{ - gl_Position = filterVertexPosition(aPosition); - vTextureCoord = filterTextureCoord(aPosition); - vMaskCoord = getFilterCoord(aPosition); -} -`,se=`struct GlobalFilterUniforms { - uInputSize:vec4<f32>, - uInputPixel:vec4<f32>, - uInputClamp:vec4<f32>, - uOutputFrame:vec4<f32>, - uGlobalFrame:vec4<f32>, - uOutputTexture:vec4<f32>, -}; - -struct MaskUniforms { - uFilterMatrix:mat3x3<f32>, - uMaskClamp:vec4<f32>, - uAlpha:f32, - uInverse:f32, - uChannel:f32, -}; - -@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms; -@group(0) @binding(1) var uTexture: texture_2d<f32>; -@group(0) @binding(2) var uSampler : sampler; - -@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms; -@group(1) @binding(1) var uMaskTexture: texture_2d<f32>; - -struct VSOutput { - @builtin(position) position: vec4<f32>, - @location(0) uv : vec2<f32>, - @location(1) filterUv : vec2<f32>, -}; - -fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32> -{ - var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; - - position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; - position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; - - return vec4(position, 0.0, 1.0); -} - -fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32> -{ - return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); -} - -fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32> -{ - return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); -} - -fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32> -{ - return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; -} - -fn getSize() -> vec2<f32> -{ - return gfu.uGlobalFrame.zw; -} - -@vertex -fn mainVertex( - @location(0) aPosition : vec2<f32>, -) -> VSOutput { - return VSOutput( - filterVertexPosition(aPosition), - filterTextureCoord(aPosition), - getFilterCoord(aPosition) - ); -} - -@fragment -fn mainFragment( - @location(0) uv: vec2<f32>, - @location(1) filterUv: vec2<f32>, - @builtin(position) position: vec4<f32> -) -> @location(0) vec4<f32> { - - var maskClamp = filterUniforms.uMaskClamp; - var uAlpha = filterUniforms.uAlpha; - - var clip = step(3.5, - step(maskClamp.x, filterUv.x) + - step(maskClamp.y, filterUv.y) + - step(filterUv.x, maskClamp.z) + - step(filterUv.y, maskClamp.w)); - - var mask = textureSample(uMaskTexture, uSampler, filterUv); - var source = textureSample(uTexture, uSampler, uv); - - var a: f32; - if (filterUniforms.uChannel == 1.0) { - a = mask.a * uAlpha * clip; - } else { - var alphaMul = 1.0 - uAlpha * (1.0 - mask.a); - a = alphaMul * mask.r * uAlpha * clip; - } - - if (filterUniforms.uInverse == 1.0) { - a = 1.0 - a; - } - - return source * a; -} -`;class ot extends st{constructor(e){const{sprite:t,...r}=e,s=new Ve(t.texture),n=new oe({uFilterMatrix:{value:new m,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:e.inverse?1:0,type:"f32"},uChannel:{value:e.channel==="alpha"?1:0,type:"f32"}}),i=Ne.from({vertex:{source:se,entryPoint:"mainVertex"},fragment:{source:se,entryPoint:"mainFragment"}}),o=je.from({vertex:it,fragment:at,name:"mask-filter"});super({...r,gpuProgram:i,glProgram:o,clipToViewport:!1,resources:{filterUniforms:n,uMaskTexture:t.texture.source}}),this.sprite=t,this._textureMatrix=s}set inverse(e){this.resources.filterUniforms.uniforms.uInverse=e?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}set channel(e){this.resources.filterUniforms.uniforms.uChannel=e==="alpha"?1:0}get channel(){return this.resources.filterUniforms.uniforms.uChannel===1?"alpha":"red"}apply(e,t,r,s){this._textureMatrix.texture=this.sprite.texture,e.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,e.applyFilter(this,t,r,s)}}function lt(a,e,t){const r=(a>>24&255)/255;e[t++]=(a&255)/255*r,e[t++]=(a>>8&255)/255*r,e[t++]=(a>>16&255)/255*r,e[t++]=r}const j=class ge{constructor(e,t){var r,s;this.state=nt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=e,this._adaptor=t,(s=(r=this._adaptor).init)==null||s.call(r,this)}static getBatcher(e,t){return new this._availableBatchers[e]({maxTextures:t})}buildStart(e){let t=this._batchersByInstructionSet[e.uid];t||(t=this._batchersByInstructionSet[e.uid]=Object.create(null),t.default||(t.default=new le({maxTextures:this.renderer.limits.maxBatchableTextures}))),this._activeBatches=t,this._activeBatch=this._activeBatches.default;for(const r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(e,t){if(this._activeBatch.name!==e.batcherName){this._activeBatch.break(t);let r=this._activeBatches[e.batcherName];r||(r=this._activeBatches[e.batcherName]=ge.getBatcher(e.batcherName,this.renderer.limits.maxBatchableTextures),r.begin()),this._activeBatch=r}this._activeBatch.add(e)}break(e){this._activeBatch.break(e)}buildEnd(e){this._activeBatch.break(e);const t=this._activeBatches;for(const r in t){const s=t[r],n=s.geometry;n.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),n.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(e){const t=this._batchersByInstructionSet[e.uid];for(const r in t){const s=t[r],n=s.geometry;s.dirty&&(s.dirty=!1,n.buffers[0].update(s.attributeSize*4))}}execute(e){if(e.action==="startBatch"){const t=e.batcher,r=t.geometry,s=t.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,e)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const e in this._activeBatches)this._activeBatches[e].destroy();this._activeBatches=null}};j.extension={type:[l.WebGLPipes,l.WebGPUPipes,l.CanvasPipes],name:"batch"};j._availableBatchers=Object.create(null);let _e=j;W.handleByMap(l.Batcher,_e._availableBatchers);W.add(le);const dt=new z;class ut extends de{constructor(){super(),this.filters=[new ot({sprite:new qe(f.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(e){this.filters[0].sprite=e}get inverse(){return this.filters[0].inverse}set inverse(e){this.filters[0].inverse=e}get channel(){return this.filters[0].channel}set channel(e){this.filters[0].channel=e}}class xe{constructor(e){this._activeMaskStage=[],this._renderer=e}push(e,t,r){const s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1,maskedContainer:t}),e.inverse=t._maskOptions.inverse,e.channel=t._maskOptions.channel??"red",e.renderMaskToTexture){const n=e.mask;n.includeInBuild=!0,n.collectRenderables(r,s,null),n.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:e,maskedContainer:t,inverse:t._maskOptions.inverse,canBundle:!1})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1})}execute(e){const t=this._renderer,r=e.mask.renderMaskToTexture;if(e.action==="pushMaskBegin"){const s=w.get(ut);if(s.inverse=e.inverse,s.channel=e.mask.channel,r){e.mask.mask.measurable=!0;const n=$e(e.mask.mask,!0,dt);e.mask.mask.measurable=!1,n.ceil();const i=t.renderTarget.renderTarget.colorTexture.source,o=T.getOptimalTexture(n.width,n.height,i._resolution,i.antialias);t.renderTarget.push(o,!0),t.globalUniforms.push({offset:n,worldColor:4294967295});const d=s.sprite;d.texture=o,d.worldTransform.tx=n.minX,d.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer,filterTexture:o})}else s.sprite=e.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:e.maskedContainer})}else if(e.action==="pushMaskEnd"){const s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(t.type===V.WEBGL&&t.renderTarget.finishRenderPass(),t.renderTarget.pop(),t.globalUniforms.pop()),t.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(e.action==="popMaskEnd"){t.filter.pop();const s=this._activeMaskStage.pop();r&&T.returnTexture(s.filterTexture),w.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}xe.extension={type:[l.WebGLPipes,l.WebGPUPipes,l.CanvasPipes],name:"alphaMask"};class be{constructor(e){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=e}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;n[this._colorStackIndex]=n[this._colorStackIndex-1]&e.mask;const i=this._colorStack[this._colorStackIndex];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1})),this._colorStackIndex++}pop(e,t,r){this._renderer.renderPipes.batch.break(r);const n=this._colorStack;this._colorStackIndex--;const i=n[this._colorStackIndex-1];i!==this._currentColor&&(this._currentColor=i,r.add({renderPipeId:"colorMask",colorMask:i,canBundle:!1}))}execute(e){this._renderer.colorMask.setMask(e.colorMask)}destroy(){this._renderer=null,this._colorStack=null}}be.extension={type:[l.WebGLPipes,l.WebGPUPipes],name:"colorMask"};class Te{constructor(e){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=e}push(e,t,r){var s;const n=e,i=this._renderer;i.renderPipes.batch.break(r),i.renderPipes.blendMode.setBlendMode(n.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const o=n.mask;o.includeInBuild=!0,this._maskHash.has(n)||this._maskHash.set(n,{instructionsStart:0,instructionsLength:0});const d=this._maskHash.get(n);d.instructionsStart=r.instructionSize,o.collectRenderables(r,i,null),o.includeInBuild=!1,i.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:e,inverse:t._maskOptions.inverse,canBundle:!1});const h=r.instructionSize-d.instructionsStart-1;d.instructionsLength=h;const c=i.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(e,t,r){const s=e,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:t._maskOptions.inverse,canBundle:!1});const i=this._maskHash.get(e);for(let o=0;o<i.instructionsLength;o++)r.instructions[r.instructionSize++]=r.instructions[i.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(e){var t;const r=this._renderer,s=r,n=r.renderTarget.renderTarget.uid;let i=(t=this._maskStackHash)[n]??(t[n]=0);e.action==="pushMaskBegin"?(s.renderTarget.ensureDepthStencil(),s.stencil.setStencilMode(g.RENDERING_MASK_ADD,i),i++,s.colorMask.setMask(0)):e.action==="pushMaskEnd"?(e.inverse?s.stencil.setStencilMode(g.INVERSE_MASK_ACTIVE,i):s.stencil.setStencilMode(g.MASK_ACTIVE,i),s.colorMask.setMask(15)):e.action==="popMaskBegin"?(s.colorMask.setMask(0),i!==0?s.stencil.setStencilMode(g.RENDERING_MASK_REMOVE,i):(s.renderTarget.clear(null,D.STENCIL),s.stencil.setStencilMode(g.DISABLED,i)),i--):e.action==="popMaskEnd"&&(e.inverse?s.stencil.setStencilMode(g.INVERSE_MASK_ACTIVE,i):s.stencil.setStencilMode(g.MASK_ACTIVE,i),s.colorMask.setMask(15)),this._maskStackHash[n]=i}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}Te.extension={type:[l.WebGLPipes,l.WebGPUPipes],name:"stencilMask"};class ve{constructor(e){this._renderer=e}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(e,t){this._renderer.renderPipes.batch.break(t),t.add(e)}execute(e){e.isRenderable&&e.render(this._renderer)}destroy(){this._renderer=null}}ve.extension={type:[l.WebGLPipes,l.WebGPUPipes,l.CanvasPipes],name:"customRender"};function L(a,e){const t=a.instructionSet,r=t.instructions;for(let s=0;s<t.instructionSize;s++){const n=r[s];e[n.renderPipeId].execute(n)}}class ye{constructor(e){this._renderer=e}addRenderGroup(e,t){e.isCachedAsTexture?this._addRenderableCacheAsTexture(e,t):this._addRenderableDirect(e,t)}execute(e){e.isRenderable&&(e.isCachedAsTexture?this._executeCacheAsTexture(e):this._executeDirect(e))}destroy(){this._renderer=null}_addRenderableDirect(e,t){this._renderer.renderPipes.batch.break(t),e._batchableRenderGroup&&(w.return(e._batchableRenderGroup),e._batchableRenderGroup=null),t.add(e)}_addRenderableCacheAsTexture(e,t){const r=e._batchableRenderGroup??(e._batchableRenderGroup=w.get(ue));r.renderable=e.root,r.transform=e.root.relativeGroupTransform,r.texture=e.texture,r.bounds=e._textureBounds,t.add(e),this._renderer.renderPipes.blendMode.pushBlendMode(e,e.root.groupBlendMode,t),this._renderer.renderPipes.batch.addToBatch(r,t),this._renderer.renderPipes.blendMode.popBlendMode(t)}_executeCacheAsTexture(e){if(e.textureNeedsUpdate){e.textureNeedsUpdate=!1;const t=new m().translate(-e._textureBounds.x,-e._textureBounds.y);this._renderer.renderTarget.push(e.texture,!0,null,e.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:t,worldColor:4294967295,offset:{x:0,y:0}}),L(e,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup),e._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(e){this._renderer.globalUniforms.push({worldTransformMatrix:e.inverseParentTextureTransform,worldColor:e.worldColorAlpha}),L(e,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}}ye.extension={type:[l.WebGLPipes,l.WebGPUPipes,l.CanvasPipes],name:"renderGroup"};class Ce{constructor(e){this._renderer=e}addRenderable(e,t){const r=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,r),this._renderer.renderPipes.batch.addToBatch(r,t)}updateRenderable(e){const t=this._getGpuSprite(e);e.didViewUpdate&&this._updateBatchableSprite(e,t),t._batcher.updateElement(t)}validateRenderable(e){const t=this._getGpuSprite(e);return!t._batcher.checkAndUpdateTexture(t,e._texture)}_updateBatchableSprite(e,t){t.bounds=e.visualBounds,t.texture=e._texture}_getGpuSprite(e){return e._gpuData[this._renderer.uid]||this._initGPUSprite(e)}_initGPUSprite(e){const t=new ue;return t.renderable=e,t.transform=e.groupTransform,t.texture=e._texture,t.bounds=e.visualBounds,t.roundPixels=this._renderer._roundPixels|e._roundPixels,e._gpuData[this._renderer.uid]=t,t}destroy(){this._renderer=null}}Ce.extension={type:[l.WebGLPipes,l.WebGPUPipes,l.CanvasPipes],name:"sprite"};const y={};W.handle(l.BlendMode,a=>{if(!a.name)throw new Error("BlendMode extension must have a name property");y[a.name]=a.ref},a=>{delete y[a.name]});class ke{constructor(e){this._blendModeStack=[],this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=e,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}pushBlendMode(e,t,r){this._blendModeStack.push(t),this.setBlendMode(e,t,r)}popBlendMode(e){this._blendModeStack.pop();const t=this._blendModeStack[this._activeBlendMode.length-1]??"normal";this.setBlendMode(null,t,e)}setBlendMode(e,t,r){var n;const s=e instanceof ee;if(this._activeBlendMode===t){this._isAdvanced&&e&&!s&&((n=this._renderableList)==null||n.push(e));return}this._isAdvanced&&this._endAdvancedBlendMode(r),this._activeBlendMode=t,e&&(this._isAdvanced=!!y[t],this._isAdvanced&&this._beginAdvancedBlendMode(e,r))}_beginAdvancedBlendMode(e,t){this._renderer.renderPipes.batch.break(t);const r=this._activeBlendMode;if(!y[r]){ce(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}const s=this._ensureFilterEffect(r),n=e instanceof ee,i={renderPipeId:"filter",action:"pushFilter",filterEffect:s,renderables:n?null:[e],container:n?e.root:null,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_ensureFilterEffect(e){let t=this._filterHash[e];return t||(t=this._filterHash[e]=new de,t.filters=[new y[e]]),t}_endAdvancedBlendMode(e){this._isAdvanced=!1,this._renderableList=null,this._renderer.renderPipes.batch.break(e),e.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(e){this._isAdvanced&&this._endAdvancedBlendMode(e)}destroy(){this._renderer=null,this._renderableList=null;for(const e in this._filterHash)this._filterHash[e].destroy();this._filterHash=null}}ke.extension={type:[l.WebGLPipes,l.WebGPUPipes,l.CanvasPipes],name:"blendMode"};function F(a,e){e||(e=0);for(let t=e;t<a.length&&a[t];t++)a[t]=null}const ct=new P,ne=pe|fe|me;function Me(a,e=!1){ht(a);const t=a.childrenToUpdate,r=a.updateTick++;for(const s in t){const n=Number(s),i=t[s],o=i.list,d=i.index;for(let h=0;h<d;h++){const c=o[h];c.parentRenderGroup===a&&c.relativeRenderGroupDepth===n&&Re(c,r,0)}F(o,d),i.index=0}if(e)for(let s=0;s<a.renderGroupChildren.length;s++)Me(a.renderGroupChildren[s],e)}function ht(a){const e=a.root;let t;if(a.renderGroupParent){const r=a.renderGroupParent;a.worldTransform.appendFrom(e.relativeGroupTransform,r.worldTransform),a.worldColor=he(e.groupColor,r.worldColor),t=e.groupAlpha*r.worldAlpha}else a.worldTransform.copyFrom(e.localTransform),a.worldColor=e.localColor,t=e.localAlpha;t=t<0?0:t>1?1:t,a.worldAlpha=t,a.worldColorAlpha=a.worldColor+((t*255|0)<<24)}function Re(a,e,t){if(e===a.updateTick)return;a.updateTick=e,a.didChange=!1;const r=a.localTransform;a.updateLocalTransform();const s=a.parent;if(s&&!s.renderGroup?(t|=a._updateFlags,a.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),t&ne&&ae(a,s,t)):(t=a._updateFlags,a.relativeGroupTransform.copyFrom(r),t&ne&&ae(a,ct,t)),!a.renderGroup){const n=a.children,i=n.length;for(let h=0;h<i;h++)Re(n[h],e,t);const o=a.parentRenderGroup,d=a;d.renderPipeId&&!o.structureDidChange&&o.updateRenderable(d)}}function ae(a,e,t){if(t&fe){a.groupColor=he(a.localColor,e.groupColor);let r=a.localAlpha*e.groupAlpha;r=r<0?0:r>1?1:r,a.groupAlpha=r,a.groupColorAlpha=a.groupColor+((r*255|0)<<24)}t&me&&(a.groupBlendMode=a.localBlendMode==="inherit"?e.groupBlendMode:a.localBlendMode),t&pe&&(a.globalDisplayStatus=a.localDisplayStatus&e.globalDisplayStatus),a._updateFlags=0}function pt(a,e){const{list:t}=a.childrenRenderablesToUpdate;let r=!1;for(let s=0;s<a.childrenRenderablesToUpdate.index;s++){const n=t[s];if(r=e[n.renderPipeId].validateRenderable(n),r)break}return a.structureDidChange=r,r}const ft=new m;class Se{constructor(e){this._renderer=e}render({container:e,transform:t}){const r=e.parent,s=e.renderGroup.renderGroupParent;e.parent=null,e.renderGroup.renderGroupParent=null;const n=this._renderer,i=ft;t&&(i.copyFrom(e.renderGroup.localTransform),e.renderGroup.localTransform.copyFrom(t));const o=n.renderPipes;this._updateCachedRenderGroups(e.renderGroup,null),this._updateRenderGroups(e.renderGroup),n.globalUniforms.start({worldTransformMatrix:t?e.renderGroup.localTransform:e.renderGroup.worldTransform,worldColor:e.renderGroup.worldColorAlpha}),L(e.renderGroup,o),o.uniformBatch&&o.uniformBatch.renderEnd(),t&&e.renderGroup.localTransform.copyFrom(i),e.parent=r,e.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(e,t){if(e._parentCacheAsTextureRenderGroup=t,e.isCachedAsTexture){if(!e.textureNeedsUpdate)return;t=e}for(let r=e.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(e.renderGroupChildren[r],t);if(e.invalidateMatrices(),e.isCachedAsTexture){if(e.textureNeedsUpdate){const r=e.root.getLocalBounds(),s=this._renderer,n=e.textureOptions.resolution||s.view.resolution,i=e.textureOptions.antialias??s.view.antialias,o=e.textureOptions.scaleMode??"linear",d=e.texture;r.ceil(),e.texture&&T.returnTexture(e.texture,!0);const h=T.getOptimalTexture(r.width,r.height,n,i);h._source.style=new Ke({scaleMode:o}),e.texture=h,e._textureBounds||(e._textureBounds=new z),e._textureBounds.copyFrom(r),d!==e.texture&&e.renderGroupParent&&(e.renderGroupParent.structureDidChange=!0)}}else e.texture&&(T.returnTexture(e.texture,!0),e.texture=null)}_updateRenderGroups(e){const t=this._renderer,r=t.renderPipes;if(e.runOnRender(t),e.instructionSet.renderPipes=r,e.structureDidChange?F(e.childrenRenderablesToUpdate.list,0):pt(e,r),Me(e),e.structureDidChange?(e.structureDidChange=!1,this._buildInstructions(e,t)):this._updateRenderables(e),e.childrenRenderablesToUpdate.index=0,t.renderPipes.batch.upload(e.instructionSet),!(e.isCachedAsTexture&&!e.textureNeedsUpdate))for(let s=0;s<e.renderGroupChildren.length;s++)this._updateRenderGroups(e.renderGroupChildren[s])}_updateRenderables(e){const{list:t,index:r}=e.childrenRenderablesToUpdate;for(let s=0;s<r;s++){const n=t[s];n.didViewUpdate&&e.updateRenderable(n)}F(t,r)}_buildInstructions(e,t){const r=e.root,s=e.instructionSet;s.reset();const n=t.renderPipes?t:t.batch.renderer,i=n.renderPipes;i.batch.buildStart(s),i.blendMode.buildStart(),i.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,n,null),i.batch.buildEnd(s),i.blendMode.buildEnd(s)}}Se.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"renderGroup"};const $=class we{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new E(0),this.color=this._backgroundColor,this.alpha=1}init(e){e={...we.defaultOptions,...e},this.clearBeforeRender=e.clearBeforeRender,this.color=e.background||e.backgroundColor||this._backgroundColor,this.alpha=e.backgroundAlpha,this._backgroundColor.setAlpha(e.backgroundAlpha)}get color(){return this._backgroundColor}set color(e){E.shared.setValue(e).alpha<1&&this._backgroundColor.alpha===1&&ce("Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."),this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};$.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"background",priority:0};$.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let mt=$;const I={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},q=class Pe{constructor(e){this._renderer=e}_normalizeOptions(e,t={}){return e instanceof P||e instanceof f?{target:e,...t}:{...t,...e}}async image(e){const t=N.get().createImage();return t.src=await this.base64(e),t}async base64(e){e=this._normalizeOptions(e,Pe.defaultImageOptions);const{format:t,quality:r}=e,s=this.canvas(e);if(s.toBlob!==void 0)return new Promise((n,i)=>{s.toBlob(o=>{if(!o){i(new Error("ICanvas.toBlob failed!"));return}const d=new FileReader;d.onload=()=>n(d.result),d.onerror=i,d.readAsDataURL(o)},I[t],r)});if(s.toDataURL!==void 0)return s.toDataURL(I[t],r);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:I[t],quality:r});return new Promise((i,o)=>{const d=new FileReader;d.onload=()=>i(d.result),d.onerror=o,d.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e){e=this._normalizeOptions(e);const t=e.target,r=this._renderer;if(t instanceof f)return r.texture.generateCanvas(t);const s=r.textureGenerator.generateTexture(e),n=r.texture.generateCanvas(s);return s.destroy(!0),n}pixels(e){e=this._normalizeOptions(e);const t=e.target,r=this._renderer,s=t instanceof f?t:r.textureGenerator.generateTexture(e),n=r.texture.getPixels(s);return t instanceof P&&s.destroy(!0),n}texture(e){return e=this._normalizeOptions(e),e.target instanceof f?e.target:this._renderer.textureGenerator.generateTexture(e)}download(e){e=this._normalizeOptions(e);const t=this.canvas(e),r=document.createElement("a");r.download=e.filename??"image.png",r.href=t.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(e){const t=e.width??200;e=this._normalizeOptions(e);const r=this.canvas(e),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);const n=["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}destroy(){this._renderer=null}};q.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"extract"};q.defaultImageOptions={format:"png",quality:1};let gt=q;class K extends f{static create(e){const{dynamic:t,textureOptions:r,...s}=e;return new K({...r,source:new v(s),dynamic:t??!1})}resize(e,t,r){return this.source.resize(e,t,r),this}}const _t=new B,xt=new z,bt=[0,0,0,0];class Be{constructor(e){this._renderer=e}generateTexture(e){var c;e instanceof P&&(e={target:e,frame:void 0,textureSourceOptions:{},resolution:void 0});const t=e.resolution||this._renderer.resolution,r=e.antialias||this._renderer.view.antialias,s=e.target;let n=e.clearColor;n?n=Array.isArray(n)&&n.length===4?n:E.shared.setValue(n).toArray():n=bt;const i=((c=e.frame)==null?void 0:c.copyTo(_t))||Ye(s,xt).rectangle,o=e.defaultAnchor&&{defaultAnchor:e.defaultAnchor};i.width=Math.max(i.width,1/t)|0,i.height=Math.max(i.height,1/t)|0;const d=K.create({...e.textureSourceOptions,width:i.width,height:i.height,resolution:t,antialias:r,textureOptions:o}),h=m.shared.translate(-i.x,-i.y);return this._renderer.render({container:s,transform:h,target:d,clearColor:n}),d.source.updateMipmaps(),d}destroy(){this._renderer=null}}Be.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"textureGenerator"};function Tt(a){let e=!1;for(const r in a)if(a[r]==null){e=!0;break}if(!e)return a;const t=Object.create(null);for(const r in a){const s=a[r];s&&(t[r]=s)}return t}function vt(a){let e=0;for(let t=0;t<a.length;t++)a[t]==null?e++:a[t-e]=a[t];return a.length-=e,a}const Y=class Ge{constructor(e){this._managedResources=[],this._managedResourceHashes=[],this._managedCollections=[],this._ready=!1,this._renderer=e}init(e){e={...Ge.defaultOptions,...e},this.maxUnusedTime=e.gcMaxUnusedTime,this._frequency=e.gcFrequency,this.enabled=e.gcActive,this.now=performance.now()}get enabled(){return!!this._handler}set enabled(e){this.enabled!==e&&(e?(this._handler=this._renderer.scheduler.repeat(()=>{this._ready=!0},this._frequency,!1),this._collectionsHandler=this._renderer.scheduler.repeat(()=>{for(const t of this._managedCollections){const{context:r,collection:s,type:n}=t;n==="hash"?r[s]=Tt(r[s]):r[s]=vt(r[s])}},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._collectionsHandler),this._handler=0,this._collectionsHandler=0))}prerender({container:e}){this.now=performance.now(),e.renderGroup.gcTick=this._renderer.tick++,this._updateInstructionGCTick(e.renderGroup,e.renderGroup.gcTick)}postrender(){!this._ready||!this.enabled||(this.run(),this._ready=!1)}_updateInstructionGCTick(e,t){e.instructionSet.gcTick=t,e.gcTick=t;for(const r of e.renderGroupChildren)this._updateInstructionGCTick(r,t)}addCollection(e,t,r){this._managedCollections.push({context:e,collection:t,type:r})}addResource(e,t){var s,n;if(e._gcLastUsed!==-1){e._gcLastUsed=this.now,(s=e._onTouch)==null||s.call(e,this.now);return}const r=this._managedResources.length;e._gcData={index:r,type:t},e._gcLastUsed=this.now,(n=e._onTouch)==null||n.call(e,this.now),e.once("unload",this.removeResource,this),this._managedResources.push(e)}removeResource(e){const t=e._gcData;if(!t)return;const r=t.index,s=this._managedResources.length-1;if(r!==s){const n=this._managedResources[s];this._managedResources[r]=n,n._gcData.index=r}this._managedResources.length--,e._gcData=null,e._gcLastUsed=-1}addResourceHash(e,t,r,s=0){this._managedResourceHashes.push({context:e,hash:t,type:r,priority:s}),this._managedResourceHashes.sort((n,i)=>n.priority-i.priority)}run(){const e=performance.now(),t=this._managedResourceHashes;for(const s of t)this.runOnHash(s,e);let r=0;for(let s=0;s<this._managedResources.length;s++){const n=this._managedResources[s];r=this.runOnResource(n,e,r)}this._managedResources.length=r}updateRenderableGCTick(e,t){var n,i;const r=e.renderGroup??e.parentRenderGroup,s=((n=r==null?void 0:r.instructionSet)==null?void 0:n.gcTick)??-1;((r==null?void 0:r.gcTick)??0)===s&&(e._gcLastUsed=t,(i=e._onTouch)==null||i.call(e,t))}runOnResource(e,t,r){const s=e._gcData;return s.type==="renderable"&&this.updateRenderableGCTick(e,t),t-e._gcLastUsed<this.maxUnusedTime||!e.autoGarbageCollect?(this._managedResources[r]=e,s.index=r,r++):(e.unload(),e._gcData=null,e._gcLastUsed=-1,e.off("unload",this.removeResource,this)),r}_createHashClone(e,t){const r=Object.create(null);for(const s in e){if(s===t)break;e[s]!==null&&(r[s]=e[s])}return r}runOnHash(e,t){var h;const{context:r,hash:s,type:n}=e,i=r[s];let o=null,d=0;for(const c in i){const u=i[c];if(u===null){d++,d===1e4&&!o&&(o=this._createHashClone(i,c));continue}if(u._gcLastUsed===-1){u._gcLastUsed=t,(h=u._onTouch)==null||h.call(u,t),o&&(o[c]=u);continue}if(n==="renderable"&&this.updateRenderableGCTick(u,t),!(t-u._gcLastUsed<this.maxUnusedTime)&&u.autoGarbageCollect){if(n==="renderable"){const _=u,x=_.renderGroup??_.parentRenderGroup;x&&(x.structureDidChange=!0)}u.unload(),u._gcData=null,u._gcLastUsed=-1,o||(d+1!==1e4?(i[c]=null,d++):o=this._createHashClone(i,c))}else o&&(o[c]=u)}o&&(r[s]=o)}destroy(){this.enabled=!1,this._managedResources.forEach(e=>{e.off("unload",this.removeResource,this)}),this._managedResources.length=0,this._managedResourceHashes.length=0,this._managedCollections.length=0,this._renderer=null}};Y.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"gc",priority:0};Y.defaultOptions={gcActive:!0,gcMaxUnusedTime:6e4,gcFrequency:3e4};let yt=Y;class Ue{constructor(e){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=e}reset(){this._stackIndex=0;for(let e=0;e<this._activeUniforms.length;e++)this._uniformsPool.push(this._activeUniforms[e]);for(let e=0;e<this._activeBindGroups.length;e++)this._bindGroupPool.push(this._activeBindGroups[e]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(e){this.reset(),this.push(e)}bind({size:e,projectionMatrix:t,worldTransformMatrix:r,worldColor:s,offset:n}){const i=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{worldTransformMatrix:new m,worldColor:4294967295,offset:new Je},d={projectionMatrix:t||this._renderer.renderTarget.projectionMatrix,resolution:e||i.size,worldTransformMatrix:r||o.worldTransformMatrix,worldColor:s||o.worldColor,offset:n||o.offset,bindGroup:null},h=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(h);const c=h.uniforms;c.uProjectionMatrix=d.projectionMatrix,c.uResolution=d.resolution,c.uWorldTransformMatrix.copyFrom(d.worldTransformMatrix),c.uWorldTransformMatrix.tx-=d.offset.x,c.uWorldTransformMatrix.ty-=d.offset.y,lt(d.worldColor,c.uWorldColorAlpha,0),h.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(h,!1):(u=this._bindGroupPool.pop()||new Xe,this._activeBindGroups.push(u),u.setResource(h,0)),d.bindGroup=u,this._currentGlobalUniformData=d}push(e){this.bind(e),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===V.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new oe({uProjectionMatrix:{value:new m,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new m,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null,this._globalUniformDataStack.length=0,this._uniformsPool.length=0,this._activeUniforms.length=0,this._bindGroupPool.length=0,this._activeBindGroups.length=0,this._currentGlobalUniformData=null}}Ue.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"globalUniforms"};let Ct=1;class Ae{constructor(){this._tasks=[],this._offset=0}init(){te.system.add(this._update,this)}repeat(e,t,r=!0){const s=Ct++;let n=0;return r&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:e,duration:t,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:s}),s}cancel(e){for(let t=0;t<this._tasks.length;t++)if(this._tasks[t].id===e){this._tasks.splice(t,1);return}}_update(){const e=performance.now();for(let t=0;t<this._tasks.length;t++){const r=this._tasks[t];if(e-r.offset-r.last>=r.duration){const s=e-r.start;r.func(s),r.last=e}}}destroy(){te.system.remove(this._update,this),this._tasks.length=0}}Ae.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"scheduler",priority:0};let ie=!1;function kt(a){if(!ie){if(N.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const e=[`%c %c %c %c %c PixiJS %c v${re} (${a}) http://www.pixijs.com/ - -`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...e)}else globalThis.console&&globalThis.console.log(`PixiJS ${re} - ${a} - http://www.pixijs.com/`);ie=!0}}class J{constructor(e){this._renderer=e}init(e){if(e.hello){let t=this._renderer.name;this._renderer.type===V.WEBGL&&(t+=` ${this._renderer.context.webGLVersion}`),kt(t)}}}J.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"hello",priority:-2};J.defaultOptions={hello:!1};const X=class Ie{constructor(e){this._renderer=e}init(e){e={...Ie.defaultOptions,...e},this.maxUnusedTime=e.renderableGCMaxUnusedTime}get enabled(){return p("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled}set enabled(e){p("8.15.0","RenderableGCSystem.enabled is deprecated, please use the GCSystem.enabled instead."),this._renderer.gc.enabled=e}addManagedHash(e,t){p("8.15.0","RenderableGCSystem.addManagedHash is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"hash")}addManagedArray(e,t){p("8.15.0","RenderableGCSystem.addManagedArray is deprecated, please use the GCSystem.addCollection instead."),this._renderer.gc.addCollection(e,t,"array")}addRenderable(e){p("8.15.0","RenderableGCSystem.addRenderable is deprecated, please use the GCSystem instead."),this._renderer.gc.addResource(e,"renderable")}run(){p("8.15.0","RenderableGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};X.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"renderableGC",priority:0};X.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let Mt=X;const Z=class S{get count(){return this._renderer.tick}get checkCount(){return this._checkCount}set checkCount(e){p("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._checkCount=e}get maxIdle(){return this._renderer.gc.maxUnusedTime/1e3*60}set maxIdle(e){p("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.maxUnusedTime=e/60*1e3}get checkCountMax(){return Math.floor(this._renderer.gc._frequency/1e3)}set checkCountMax(e){p("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead.")}get active(){return this._renderer.gc.enabled}set active(e){p("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.enabled=e}constructor(e){this._renderer=e,this._checkCount=0}init(e){e.textureGCActive!==S.defaultOptions.textureGCActive&&(this.active=e.textureGCActive),e.textureGCMaxIdle!==S.defaultOptions.textureGCMaxIdle&&(this.maxIdle=e.textureGCMaxIdle),e.textureGCCheckCountMax!==S.defaultOptions.textureGCCheckCountMax&&(this.checkCountMax=e.textureGCCheckCountMax)}run(){p("8.15.0","TextureGCSystem.run is deprecated, please use the GCSystem instead."),this._renderer.gc.run()}destroy(){this._renderer=null}};Z.extension={type:[l.WebGLSystem,l.WebGPUSystem],name:"textureGC"};Z.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let Rt=Z;const De=class Ee{constructor(e={}){if(this.uid=Ze("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,e={...Ee.defaultOptions,...e},this.stencil=e.stencil,this.depth=e.depth,this.isRoot=e.isRoot,typeof e.colorTextures=="number"){this._managedColorTextures=!0;for(let t=0;t<e.colorTextures;t++)this.colorTextures.push(new v({width:e.width,height:e.height,resolution:e.resolution,antialias:e.antialias}))}else{this.colorTextures=[...e.colorTextures.map(r=>r.source)];const t=this.colorTexture.source;this.resize(t.width,t.height,t._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(e.depthStencilTexture||this.stencil)&&(e.depthStencilTexture instanceof f||e.depthStencilTexture instanceof v?this.depthStencilTexture=e.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const e=this._size;return e[0]=this.pixelWidth,e[1]=this.pixelHeight,e}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(e){this.resize(e.width,e.height,e._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new v({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(e,t,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((n,i)=>{s&&i===0||n.source.resize(e,t,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(e,t,r)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(e=>{e.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};De.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let H=De;const b=new Map;Qe.register(b);function Oe(a,e){if(!b.has(a)){const t=new f({source:new O({resource:a,...e})}),r=()=>{b.get(a)===t&&b.delete(a)};t.once("destroy",r),t.source.once("destroy",r),b.set(a,t)}return b.get(a)}const Q=class Le{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(e){this.texture.source.autoDensity=e}get resolution(){return this.texture.source._resolution}set resolution(e){this.texture.source.resize(this.texture.source.width,this.texture.source.height,e)}init(e){e={...Le.defaultOptions,...e},e.view&&(p(et,"ViewSystem.view has been renamed to ViewSystem.canvas"),e.canvas=e.view),this.screen=new B(0,0,e.width,e.height),this.canvas=e.canvas||N.get().createCanvas(),this.antialias=!!e.antialias,this.texture=Oe(this.canvas,e),this.renderTarget=new H({colorTextures:[this.texture],depth:!!e.depth,isRoot:!0}),this.texture.source.transparent=e.backgroundAlpha<1,this.resolution=e.resolution}resize(e,t,r){this.texture.source.resize(e,t,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(e=!1){(typeof e=="boolean"?e:!!(e!=null&&e.removeView))&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.texture.destroy()}};Q.extension={type:[l.WebGLSystem,l.WebGPUSystem,l.CanvasSystem],name:"view",priority:0};Q.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let St=Q;const Ut=[mt,Ue,J,St,Se,yt,Rt,Be,gt,tt,Mt,Ae],At=[ke,_e,Ce,ye,xe,Te,be,ve];function wt(a,e,t,r,s,n){const i=n?1:-1;return a.identity(),a.a=1/r*2,a.d=i*(1/s*2),a.tx=-1-e*a.a,a.ty=-i-t*a.d,a}function Pt(a){const e=a.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement&&document.body.contains(e)}class It{constructor(e){this.rootViewPort=new B,this.viewport=new B,this.mipLevel=0,this.layer=0,this.onRenderTargetChange=new rt("onRenderTargetChange"),this.projectionMatrix=new m,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=e,e.gc.addCollection(this,"_gpuRenderTargetHash","hash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:e,clear:t,clearColor:r,frame:s,mipLevel:n,layer:i}){var o,d;this._renderTargetStack.length=0,this.push(e,t,r,s,n??0,i??0),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=Pt(this.rootRenderTarget),(d=(o=this.adaptor).prerender)==null||d.call(o,this.rootRenderTarget)}postrender(){var e,t;(t=(e=this.adaptor).postrender)==null||t.call(e,this.rootRenderTarget)}bind(e,t=!0,r,s,n=0,i=0){const o=this.getRenderTarget(e),d=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=e;const h=this.getGpuRenderTarget(o);(o.pixelWidth!==h.width||o.pixelHeight!==h.height)&&(this.adaptor.resizeGpuRenderTarget(o),h.width=o.pixelWidth,h.height=o.pixelHeight);const c=o.colorTexture,u=this.viewport,G=c.arrayLayerCount||1;if((i|0)!==i&&(i|=0),i<0||i>=G)throw new Error(`[RenderTargetSystem] layer ${i} is out of bounds (arrayLayerCount=${G}).`);this.mipLevel=n|0,this.layer=i|0;const _=Math.max(c.pixelWidth>>n,1),x=Math.max(c.pixelHeight>>n,1);if(!s&&e instanceof f&&(s=e.frame),s){const C=c._resolution,k=1<<Math.max(n|0,0),Fe=s.x*C+.5|0,He=s.y*C+.5|0,We=s.width*C+.5|0,ze=s.height*C+.5|0;let M=Math.floor(Fe/k),R=Math.floor(He/k),U=Math.ceil(We/k),A=Math.ceil(ze/k);M=Math.min(Math.max(M,0),_-1),R=Math.min(Math.max(R,0),x-1),U=Math.min(Math.max(U,1),_-M),A=Math.min(Math.max(A,1),x-R),u.x=M,u.y=R,u.width=U,u.height=A}else u.x=0,u.y=0,u.width=_,u.height=x;return wt(this.projectionMatrix,0,0,u.width/c.resolution,u.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,t,r,u,n,i),d&&this.onRenderTargetChange.emit(o),o}clear(e,t=D.ALL,r,s=this.mipLevel,n=this.layer){t&&(e&&(e=this.getRenderTarget(e)),this.adaptor.clear(e||this.renderTarget,t,r,this.viewport,s,n))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(e,t=D.ALL,r,s,n=0,i=0){const o=this.bind(e,t,r,s,n,i);return this._renderTargetStack.push({renderTarget:o,frame:s,mipLevel:n,layer:i}),o}pop(){this._renderTargetStack.pop();const e=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(e.renderTarget,!1,null,e.frame,e.mipLevel,e.layer)}getRenderTarget(e){return e.isTexture&&(e=e.source),this._renderSurfaceToRenderTargetHash.get(e)??this._initRenderTarget(e)}copyToTexture(e,t,r,s,n){r.x<0&&(s.width+=r.x,n.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,n.y-=r.y,r.y=0);const{pixelWidth:i,pixelHeight:o}=e;return s.width=Math.min(s.width,i-r.x),s.height=Math.min(s.height,o-r.y),this.adaptor.copyToTexture(e,t,r,s,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport,0,this.layer))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((e,t)=>{e!==t&&e.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(e){let t=null;return O.test(e)&&(e=Oe(e).source),e instanceof H?t=e:e instanceof v&&(t=new H({colorTextures:[e]}),e.source instanceof O&&(t.isRoot=!0),e.once("destroy",()=>{t.destroy(),this._renderSurfaceToRenderTargetHash.delete(e);const r=this._gpuRenderTargetHash[t.uid];r&&(this._gpuRenderTargetHash[t.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),this._renderSurfaceToRenderTargetHash.set(e,t),t}getGpuRenderTarget(e){return this._gpuRenderTargetHash[e.uid]||(this._gpuRenderTargetHash[e.uid]=this.adaptor.initGpuRenderTarget(e))}resetState(){this.renderTarget=null,this.renderSurface=null}}export{xe as A,ke as B,ve as C,It as R,Ut as S,_e as a,Ce as b,lt as c,ye as d,At as e}; diff --git a/2026/games_submissions/sunshoes/assets/WebGLRenderer-CdpFaPwH.js b/2026/games_submissions/sunshoes/assets/WebGLRenderer-CdpFaPwH.js deleted file mode 100644 index 870b422..0000000 --- a/2026/games_submissions/sunshoes/assets/WebGLRenderer-CdpFaPwH.js +++ /dev/null @@ -1,156 +0,0 @@ -import{Z as R,z as d,x as F,s as B,w as p,q,a as Ne,S as P,T as S,ay as De,aa as Z,az as Ie,r as T,R as X,Y as y,a9 as C,ab as O,F as g,N as J,aA as Q,aB as Ge,aC as ee,aD as Ue,aE as Fe,_ as Pe,$ as Oe}from"./index-DvAPfvr6.js";import{e as Me,G as Le,c as we,b as He,U as Ve,B as te,d as N,f as re,g as Xe}from"./BufferResource-BZpoqTVb.js";import{S as M}from"./Filter-BiIvpnZm.js";import{R as ke,S as We,e as je}from"./RenderTargetSystem-Cp6tD-lP.js";function Ke(){const{userAgent:t}=R.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}class ne{constructor(){this._tempState=M.for2d(),this._didUploadHash={}}init(e){e.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(e,r,n){const s=e.renderer,i=this._didUploadHash[n.uid];s.shader.bind(n,i),i||(this._didUploadHash[n.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(r,n.glProgram)}execute(e,r){const n=e.renderer;this._tempState.blendMode=r.blendMode,n.state.set(this._tempState);const s=r.textures.textures;for(let i=0;i<r.textures.count;i++)n.texture.bind(s[i],i);n.geometry.draw(r.topology,r.size,r.start)}}ne.extension={type:[d.WebGLPipesAdaptor],name:"batch"};var A=(t=>(t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",t))(A||{});class $e{constructor(e,r){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.type=r}destroy(){this.buffer=null,this.updateID=-1,this.byteLength=-1,this.type=-1,this._lastBindBaseLocation=-1,this._lastBindCallId=-1}}class se{constructor(e){this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=e,this._managedBuffers=new F({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"glBuffer"})}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gl=null,this._boundBufferBases={}}contextChange(){this._gl=this._renderer.gl,this.destroyAll(!0),this._maxBindings=this._renderer.limits.maxUniformBindings}getGlBuffer(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this.createGLBuffer(e)}bind(e){const{_gl:r}=this,n=this.getGlBuffer(e);r.bindBuffer(n.type,n.buffer)}bindBufferBase(e,r){const{_gl:n}=this;this._boundBufferBases[r]!==e&&(this._boundBufferBases[r]=e,e._lastBindBaseLocation=r,n.bindBufferBase(n.UNIFORM_BUFFER,r,e.buffer))}nextBindBase(e){this._bindCallId++,this._minBaseLocation=0,e&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1&&(this._nextBindBaseIndex=1))}freeLocationForBufferBase(e){let r=this.getLastBindBaseLocation(e);if(r>=this._minBaseLocation)return e._lastBindCallId=this._bindCallId,r;let n=0,s=this._nextBindBaseIndex;for(;n<2;){s>=this._maxBindings&&(s=this._minBaseLocation,n++);const i=this._boundBufferBases[s];if(i&&i._lastBindCallId===this._bindCallId){s++;continue}break}return r=s,this._nextBindBaseIndex=s+1,n>=2?-1:(e._lastBindCallId=this._bindCallId,this._boundBufferBases[r]=null,r)}getLastBindBaseLocation(e){const r=e._lastBindBaseLocation;return this._boundBufferBases[r]===e?r:-1}bindBufferRange(e,r,n,s){const{_gl:i}=this;n||(n=0),r||(r=0),this._boundBufferBases[r]=null,i.bindBufferRange(i.UNIFORM_BUFFER,r||0,e.buffer,n*256,s||256)}updateBuffer(e){const{_gl:r}=this,n=this.getGlBuffer(e);if(e._updateID===n.updateID)return n;n.updateID=e._updateID,r.bindBuffer(n.type,n.buffer);const s=e.data,i=e.descriptor.usage&B.STATIC?r.STATIC_DRAW:r.DYNAMIC_DRAW;return s?n.byteLength>=s.byteLength?r.bufferSubData(n.type,0,s,0,e._updateSize/s.BYTES_PER_ELEMENT):(n.byteLength=s.byteLength,r.bufferData(n.type,s,i)):(n.byteLength=e.descriptor.size,r.bufferData(n.type,n.byteLength,i)),n}destroyAll(e=!1){this._managedBuffers.removeAll(e)}onBufferUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||this._gl.deleteBuffer(n.buffer))}createGLBuffer(e){const{_gl:r}=this;let n=A.ARRAY_BUFFER;e.descriptor.usage&B.INDEX?n=A.ELEMENT_ARRAY_BUFFER:e.descriptor.usage&B.UNIFORM&&(n=A.UNIFORM_BUFFER);const s=new $e(r.createBuffer(),n);return e._gpuData[this._renderer.uid]=s,this._managedBuffers.add(e),s}resetState(){this._boundBufferBases=Object.create(null)}}se.extension={type:[d.WebGLSystem],name:"buffer"};const L=class ie{constructor(e){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=e,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this._renderer.gl=e}init(e){e={...ie.defaultOptions,...e};let r=this.multiView=e.multiView;if(e.context&&r&&(p("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),r=!1),r?this.canvas=R.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,e.context)this.initFromContext(e.context);else{const n=this._renderer.background.alpha<1,s=e.premultipliedAlpha??!0,i=e.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(e.preferWebGLVersion,{alpha:n,premultipliedAlpha:s,antialias:i,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference??"default"})}}ensureCanvasSize(e){if(!this.multiView){e!==this.canvas&&p("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:r}=this;(r.width<e.width||r.height<e.height)&&(r.width=Math.max(e.width,e.width),r.height=Math.max(e.height,e.height))}initFromContext(e){this.gl=e,this.webGLVersion=e instanceof R.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(e),this._renderer.runners.contextChange.emit(e);const r=this._renderer.view.canvas;r.addEventListener("webglcontextlost",this.handleContextLost,!1),r.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(e,r){let n;const s=this.canvas;if(e===2&&(n=s.getContext("webgl2",r)),!n&&(n=s.getContext("webgl",r),!n))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=n,this.initFromContext(this.gl)}getExtensions(){const{gl:e}=this,r={anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc"),rgtc:e.getExtension("EXT_texture_compression_rgtc"),loseContext:e.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...r,drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:e.getExtension("ANGLE_instanced_arrays"),srgb:e.getExtension("EXT_sRGB")};else{this.extensions={...r,colorBufferFloat:e.getExtension("EXT_color_buffer_float")};const n=e.getExtension("WEBGL_provoking_vertex");n&&n.provokingVertexWEBGL(n.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(e){e.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var r;this.gl.isContextLost()&&((r=this.extensions.loseContext)==null||r.restoreContext())},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var r;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(r=this.extensions.loseContext)==null||r.loseContext()}forceContextLoss(){var e;(e=this.extensions.loseContext)==null||e.loseContext(),this._contextLossForced=!0}validateContext(e){const r=e.getContextAttributes();r&&!r.stencil&&p("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=this.supports,s=this.webGLVersion===2,i=this.extensions;n.uint32Indices=s||!!i.uint32ElementIndex,n.uniformBufferObject=s,n.vertexArrayObject=s||!!i.vertexArrayObject,n.srgbTextures=s||!!i.srgb,n.nonPowOf2wrapping=s,n.nonPowOf2mipmaps=s,n.msaa=s,n.uint32Indices||p("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};L.extension={type:[d.WebGLSystem],name:"context"};L.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let Ye=L;var G=(t=>(t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL",t))(G||{}),w=(t=>(t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",t))(w||{}),h=(t=>(t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT",t))(h||{});const k={uint8x2:h.UNSIGNED_BYTE,uint8x4:h.UNSIGNED_BYTE,sint8x2:h.BYTE,sint8x4:h.BYTE,unorm8x2:h.UNSIGNED_BYTE,unorm8x4:h.UNSIGNED_BYTE,snorm8x2:h.BYTE,snorm8x4:h.BYTE,uint16x2:h.UNSIGNED_SHORT,uint16x4:h.UNSIGNED_SHORT,sint16x2:h.SHORT,sint16x4:h.SHORT,unorm16x2:h.UNSIGNED_SHORT,unorm16x4:h.UNSIGNED_SHORT,snorm16x2:h.SHORT,snorm16x4:h.SHORT,float16x2:h.HALF_FLOAT,float16x4:h.HALF_FLOAT,float32:h.FLOAT,float32x2:h.FLOAT,float32x3:h.FLOAT,float32x4:h.FLOAT,uint32:h.UNSIGNED_INT,uint32x2:h.UNSIGNED_INT,uint32x3:h.UNSIGNED_INT,uint32x4:h.UNSIGNED_INT,sint32:h.INT,sint32x2:h.INT,sint32x3:h.INT,sint32x4:h.INT};function ze(t){return k[t]??k.float32}const qe={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ze{constructor(){this.vaoCache=Object.create(null)}destroy(){this.vaoCache=Object.create(null)}}class ae{constructor(e){this._renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._managedGeometries=new F({renderer:e,type:"resource",onUnload:this.onGeometryUnload.bind(this),name:"glGeometry"})}contextChange(){const e=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");this.destroyAll(!0);const r=this._renderer.context.extensions.vertexArrayObject;r&&(e.createVertexArray=()=>r.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s));const n=this._renderer.context.extensions.vertexAttribDivisorANGLE;n&&(e.drawArraysInstanced=(s,i,a,o)=>{n.drawArraysInstancedANGLE(s,i,a,o)},e.drawElementsInstanced=(s,i,a,o,c)=>{n.drawElementsInstancedANGLE(s,i,a,o,c)},e.vertexAttribDivisor=(s,i)=>n.vertexAttribDivisorANGLE(s,i)),this._activeGeometry=null,this._activeVao=null}bind(e,r){const n=this.gl;this._activeGeometry=e;const s=this.getVao(e,r);this._activeVao!==s&&(this._activeVao=s,n.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){const e=this._activeGeometry,r=this._renderer.buffer;for(let n=0;n<e.buffers.length;n++){const s=e.buffers[n];r.updateBuffer(s)}e._gcLastUsed=this._renderer.gc.now}checkCompatibility(e,r){const n=e.attributes,s=r._attributeData;for(const i in s)if(!n[i])throw new Error(`shader and geometry incompatible, geometry missing the "${i}" attribute`)}getSignature(e,r){const n=e.attributes,s=r._attributeData,i=["g",e.uid];for(const a in n)s[a]&&i.push(a,s[a].location);return i.join("-")}getVao(e,r){var n;return((n=e._gpuData[this._renderer.uid])==null?void 0:n.vaoCache[r._key])||this.initGeometryVao(e,r)}initGeometryVao(e,r,n=!0){const s=this._renderer.gl,i=this._renderer.buffer;this._renderer.shader._getProgramData(r),this.checkCompatibility(e,r);const a=this.getSignature(e,r);let o=e._gpuData[this._renderer.uid];o||(o=new Ze,e._gpuData[this._renderer.uid]=o,this._managedGeometries.add(e));const c=o.vaoCache;let u=c[a];if(u)return c[r._key]=u,u;Me(e,r._attributeData);const _=e.buffers;u=s.createVertexArray(),s.bindVertexArray(u);for(let f=0;f<_.length;f++){const l=_[f];i.bind(l)}return this.activateVao(e,r),c[r._key]=u,c[a]=u,s.bindVertexArray(null),u}onGeometryUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];if(!n)return;const s=n.vaoCache;if(!r)for(const i in s)this._activeVao!==s[i]&&this.resetState(),this.gl.deleteVertexArray(s[i])}destroyAll(e=!1){this._managedGeometries.removeAll(e)}activateVao(e,r){var o;const n=this._renderer.gl,s=this._renderer.buffer,i=e.attributes;e.indexBuffer&&s.bind(e.indexBuffer);let a=null;for(const c in i){const u=i[c],_=u.buffer,f=s.getGlBuffer(_),l=r._attributeData[c];if(l){a!==f&&(s.bind(_),a=f);const m=l.location;n.enableVertexAttribArray(m);const b=q(u.format),E=ze(u.format);if(((o=l.format)==null?void 0:o.substring(1,4))==="int"?n.vertexAttribIPointer(m,b.size,E,u.stride,u.offset):n.vertexAttribPointer(m,b.size,E,b.normalised,u.stride,u.offset),u.instance)if(this.hasInstance){const Ce=u.divisor??1;n.vertexAttribDivisor(m,Ce)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(e,r,n,s){const{gl:i}=this._renderer,a=this._activeGeometry,o=qe[e||a.topology];if(s??(s=a.instanceCount),a.indexBuffer){const c=a.indexBuffer.data.BYTES_PER_ELEMENT,u=c===2?i.UNSIGNED_SHORT:i.UNSIGNED_INT;s!==1?i.drawElementsInstanced(o,r||a.indexBuffer.data.length,u,(n||0)*c,s):i.drawElements(o,r||a.indexBuffer.data.length,u,(n||0)*c)}else s!==1?i.drawArraysInstanced(o,n||0,r||a.getSize(),s):i.drawArrays(o,n||0,r||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._managedGeometries.destroy(),this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}ae.extension={type:[d.WebGLSystem],name:"geometry"};const Je=new De({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),H=class oe{constructor(e){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=e}init(e={}){const{useBackBuffer:r,antialias:n}={...oe.defaultOptions,...e};this.useBackBuffer=r,this._antialias=n,this._renderer.context.supports.msaa||(p("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=M.for2d();const s=new Ne({vertex:` - attribute vec2 aPosition; - out vec2 vUv; - - void main() { - gl_Position = vec4(aPosition, 0.0, 1.0); - - vUv = (aPosition + 1.0) / 2.0; - - // flip dem UVs - vUv.y = 1.0 - vUv.y; - }`,fragment:` - in vec2 vUv; - out vec4 finalColor; - - uniform sampler2D uTexture; - - void main() { - finalColor = texture(uTexture, vUv); - }`,name:"big-triangle"});this._bigTriangleShader=new P({glProgram:s,resources:{uTexture:S.WHITE.source}})}renderStart(e){const r=this._renderer.renderTarget.getRenderTarget(e.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!r.isRoot,this._useBackBufferThisRender){const n=this._renderer.renderTarget.getRenderTarget(e.target);this._targetTexture=n.colorTexture,e.target=this._getBackBufferTexture(n.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const e=this._renderer;e.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(e.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,e.encoder.draw({geometry:Je,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(e){return this._backBufferTexture=this._backBufferTexture||new S({source:new Z({width:e.width,height:e.height,resolution:e._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(e.width,e.height,e._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};H.extension={type:[d.WebGLSystem],name:"backBuffer",priority:1};H.defaultOptions={useBackBuffer:!1};let Qe=H;class ce{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.gl.colorMask(!!(e&8),!!(e&4),!!(e&2),!!(e&1)))}}ce.extension={type:[d.WebGLSystem],name:"colorMask"};class ue{constructor(e){this.commandFinished=Promise.resolve(),this._renderer=e}setGeometry(e,r){this._renderer.geometry.bind(e,r.glProgram)}finishRenderPass(){}draw(e){const r=this._renderer,{geometry:n,shader:s,state:i,skipSync:a,topology:o,size:c,start:u,instanceCount:_}=e;r.shader.bind(s,a),r.geometry.bind(n,r.shader._activeProgram),i&&r.state.set(i),r.geometry.draw(o,c,u,_??n.instanceCount)}destroy(){this._renderer=null}}ue.extension={type:[d.WebGLSystem],name:"encoder"};class _e{constructor(e){this._renderer=e}contextChange(){const e=this._renderer.gl;this.maxTextures=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),this.maxBatchableTextures=Ie(this.maxTextures,e);const r=this._renderer.context.webGLVersion===2;this.maxUniformBindings=r?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0}destroy(){}}_e.extension={type:[d.WebGLSystem],name:"limits"};class et{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this._attachedMipLevel=0,this._attachedLayer=0,this.msaaRenderBuffer=[]}}class fe{constructor(e){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:T.NONE},this._renderTargetStencilState=Object.create(null),e.renderTarget.onRenderTargetChange.add(this)}contextChange(e){this._gl=e,this._comparisonFuncMapping={always:e.ALWAYS,never:e.NEVER,equal:e.EQUAL,"not-equal":e.NOTEQUAL,less:e.LESS,"less-equal":e.LEQUAL,greater:e.GREATER,"greater-equal":e.GEQUAL},this._stencilOpsMapping={keep:e.KEEP,zero:e.ZERO,replace:e.REPLACE,invert:e.INVERT,"increment-clamp":e.INCR,"decrement-clamp":e.DECR,"increment-wrap":e.INCR_WRAP,"decrement-wrap":e.DECR_WRAP},this.resetState()}onRenderTargetChange(e){if(this._activeRenderTarget===e)return;this._activeRenderTarget=e;let r=this._renderTargetStencilState[e.uid];r||(r=this._renderTargetStencilState[e.uid]={stencilMode:T.DISABLED,stencilReference:0}),this.setStencilMode(r.stencilMode,r.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=T.NONE,this._stencilCache.stencilReference=0}setStencilMode(e,r){const n=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,i=Le[e],a=this._stencilCache;if(n.stencilMode=e,n.stencilReference=r,e===T.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(e!==a.stencilMode||a.stencilReference!==r)&&(a.stencilMode=e,a.stencilReference=r,s.stencilFunc(this._comparisonFuncMapping[i.stencilBack.compare],r,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[i.stencilBack.passOp]))}}fe.extension={type:[d.WebGLSystem],name:"stencil"};const le={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function tt(t){const e=t.map(i=>({data:i,offset:0,size:0})),r=16;let n=0,s=0;for(let i=0;i<e.length;i++){const a=e[i];if(n=le[a.data.type],!n)throw new Error(`Unknown type ${a.data.type}`);a.data.size>1&&(n=Math.max(n,r)*a.data.size);const o=n===12?16:n;a.size=n;const c=s%r;c>0&&r-c<o?s+=(r-c)%16:s+=(n-c%n)%n,a.offset=s,s+=n}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function rt(t,e){const r=Math.max(le[t.data.type]/16,1),n=t.data.value.length/t.data.size,s=(4-n%4)%4,i=t.data.type.indexOf("i32")>=0?"dataInt32":"data";return` - v = uv.${t.data.name}; - offset += ${e}; - - arrayOffset = offset; - - t = 0; - - for(var i=0; i < ${t.data.size*r}; i++) - { - for(var j = 0; j < ${n}; j++) - { - ${i}[arrayOffset++] = v[t++]; - } - ${s!==0?`arrayOffset += ${s};`:""} - } - `}function nt(t){return we(t,"uboStd40",rt,He)}class he extends Ve{constructor(){super({createUboElements:tt,generateUboSync:nt})}}he.extension={type:[d.WebGLSystem],name:"ubo"};class st{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new X}init(e,r){this._renderer=e,this._renderTargetSystem=r,e.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new X;const e=this._renderer.gl;this._drawBuffersCache=[];for(let r=1;r<=16;r++)this._drawBuffersCache[r]=Array.from({length:r},(n,s)=>e.COLOR_ATTACHMENT0+s)}copyToTexture(e,r,n,s,i){const a=this._renderTargetSystem,o=this._renderer,c=a.getGpuRenderTarget(e),u=o.gl;return this.finishRenderPass(e),u.bindFramebuffer(u.FRAMEBUFFER,c.resolveTargetFramebuffer),o.texture.bind(r,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,i.x,i.y,n.x,n.y,s.width,s.height),r}startRenderPass(e,r=!0,n,s,i=0,a=0){const o=this._renderTargetSystem,c=e.colorTexture,u=o.getGpuRenderTarget(e);if(a!==0&&this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to array layers requires WebGL2.");if(i>0){if(u.msaa)throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to mip levels requires WebGL2.")}let _=s.y;e.isRoot&&(_=c.pixelHeight-s.height-s.y),e.colorTextures.forEach(m=>{this._renderer.texture.unbind(m)});const f=this._renderer.gl;f.bindFramebuffer(f.FRAMEBUFFER,u.framebuffer),!e.isRoot&&(u._attachedMipLevel!==i||u._attachedLayer!==a)&&(e.colorTextures.forEach((m,b)=>{const E=this._renderer.texture.getGlSource(m);if(E.target===f.TEXTURE_2D){if(a!==0)throw new Error("[RenderTargetSystem] layer must be 0 when rendering to 2D textures in WebGL.");f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0+b,f.TEXTURE_2D,E.texture,i)}else if(E.target===f.TEXTURE_2D_ARRAY){if(this._renderer.context.webGLVersion<2)throw new Error("[RenderTargetSystem] Rendering to 2D array textures requires WebGL2.");f.framebufferTextureLayer(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0+b,E.texture,i,a)}else if(E.target===f.TEXTURE_CUBE_MAP){if(a<0||a>5)throw new Error("[RenderTargetSystem] Cube map layer must be between 0 and 5.");f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0+b,f.TEXTURE_CUBE_MAP_POSITIVE_X+a,E.texture,i)}else throw new Error("[RenderTargetSystem] Unsupported texture target for render-to-layer in WebGL.")}),u._attachedMipLevel=i,u._attachedLayer=a),e.colorTextures.length>1&&this._setDrawBuffers(e,f);const l=this._viewPortCache;(l.x!==s.x||l.y!==_||l.width!==s.width||l.height!==s.height)&&(l.x=s.x,l.y=_,l.width=s.width,l.height=s.height,f.viewport(s.x,_,s.width,s.height)),!u.depthStencilRenderBuffer&&(e.stencil||e.depth)&&this._initStencil(u),this.clear(e,r,n)}finishRenderPass(e){const n=this._renderTargetSystem.getGpuRenderTarget(e);if(!n.msaa)return;const s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,n.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,n.framebuffer),s.blitFramebuffer(0,0,n.width,n.height,0,0,n.width,n.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)}initGpuRenderTarget(e){const n=this._renderer.gl,s=new et;return s._attachedMipLevel=0,s._attachedLayer=0,e.colorTexture instanceof y?(this._renderer.context.ensureCanvasSize(e.colorTexture.resource),s.framebuffer=null,s):(this._initColor(e,s),n.bindFramebuffer(n.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(e){const r=this._renderer.gl;e.framebuffer&&(r.deleteFramebuffer(e.framebuffer),e.framebuffer=null),e.resolveTargetFramebuffer&&(r.deleteFramebuffer(e.resolveTargetFramebuffer),e.resolveTargetFramebuffer=null),e.depthStencilRenderBuffer&&(r.deleteRenderbuffer(e.depthStencilRenderBuffer),e.depthStencilRenderBuffer=null),e.msaaRenderBuffer.forEach(n=>{r.deleteRenderbuffer(n)}),e.msaaRenderBuffer=null}clear(e,r,n,s,i=0,a=0){if(!r)return;if(a!==0)throw new Error("[RenderTargetSystem] Clearing array layers is not supported in WebGL renderer.");const o=this._renderTargetSystem;typeof r=="boolean"&&(r=r?C.ALL:C.NONE);const c=this._renderer.gl;if(r&C.COLOR){n??(n=o.defaultClearColor);const u=this._clearColorCache,_=n;(u[0]!==_[0]||u[1]!==_[1]||u[2]!==_[2]||u[3]!==_[3])&&(u[0]=_[0],u[1]=_[1],u[2]=_[2],u[3]=_[3],c.clearColor(_[0],_[1],_[2],_[3]))}c.clear(r)}resizeGpuRenderTarget(e){if(e.isRoot)return;const n=this._renderTargetSystem.getGpuRenderTarget(e);this._resizeColor(e,n),(e.stencil||e.depth)&&this._resizeStencil(n)}_initColor(e,r){const n=this._renderer,s=n.gl,i=s.createFramebuffer();if(r.resolveTargetFramebuffer=i,s.bindFramebuffer(s.FRAMEBUFFER,i),r.width=e.colorTexture.source.pixelWidth,r.height=e.colorTexture.source.pixelHeight,e.colorTextures.forEach((o,c)=>{const u=o.source;u.antialias&&(n.context.supports.msaa?r.msaa=!0:p("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),n.texture.bindSource(u,0);const _=n.texture.getGlSource(u),f=_.texture;if(_.target===s.TEXTURE_2D)s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+c,s.TEXTURE_2D,f,0);else if(_.target===s.TEXTURE_2D_ARRAY){if(n.context.webGLVersion<2)throw new Error("[RenderTargetSystem] TEXTURE_2D_ARRAY requires WebGL2.");s.framebufferTextureLayer(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+c,f,0,0)}else if(_.target===s.TEXTURE_CUBE_MAP)s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+c,s.TEXTURE_CUBE_MAP_POSITIVE_X,f,0);else throw new Error("[RenderTargetSystem] Unsupported texture target for framebuffer attachment.")}),r.msaa){const o=s.createFramebuffer();r.framebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.colorTextures.forEach((c,u)=>{const _=s.createRenderbuffer();r.msaaRenderBuffer[u]=_})}else r.framebuffer=i;this._resizeColor(e,r)}_resizeColor(e,r){const n=e.colorTexture.source;if(r.width=n.pixelWidth,r.height=n.pixelHeight,r._attachedMipLevel=0,r._attachedLayer=0,e.colorTextures.forEach((s,i)=>{i!==0&&s.source.resize(n.width,n.height,n._resolution)}),r.msaa){const s=this._renderer,i=s.gl,a=r.framebuffer;i.bindFramebuffer(i.FRAMEBUFFER,a),e.colorTextures.forEach((o,c)=>{const u=o.source;s.texture.bindSource(u,0);const f=s.texture.getGlSource(u).internalFormat,l=r.msaaRenderBuffer[c];i.bindRenderbuffer(i.RENDERBUFFER,l),i.renderbufferStorageMultisample(i.RENDERBUFFER,4,f,u.pixelWidth,u.pixelHeight),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+c,i.RENDERBUFFER,l)})}}_initStencil(e){if(e.framebuffer===null)return;const r=this._renderer.gl,n=r.createRenderbuffer();e.depthStencilRenderBuffer=n,r.bindRenderbuffer(r.RENDERBUFFER,n),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,n),this._resizeStencil(e)}_resizeStencil(e){const r=this._renderer.gl;r.bindRenderbuffer(r.RENDERBUFFER,e.depthStencilRenderBuffer),e.msaa?r.renderbufferStorageMultisample(r.RENDERBUFFER,4,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,this._renderer.context.webGLVersion===2?r.DEPTH24_STENCIL8:r.DEPTH_STENCIL,e.width,e.height)}prerender(e){const r=e.colorTexture.resource;this._renderer.context.multiView&&y.test(r)&&this._renderer.context.ensureCanvasSize(r)}postrender(e){if(this._renderer.context.multiView&&y.test(e.colorTexture.resource)){const r=this._renderer.context.canvas,n=e.colorTexture;n.context2D.drawImage(r,0,n.pixelHeight-r.height)}}_setDrawBuffers(e,r){const n=e.colorTextures.length,s=this._drawBuffersCache[n];if(this._renderer.context.webGLVersion===1){const i=this._renderer.context.extensions.drawBuffers;i?i.drawBuffersWEBGL(s):p("[RenderTexture] This WebGL1 context does not support rendering to multiple targets")}else r.drawBuffers(s)}}class de extends ke{constructor(e){super(e),this.adaptor=new st,this.adaptor.init(e,this)}}de.extension={type:[d.WebGLSystem],name:"renderTarget"};function it(t,e){const r=[],n=[` - var g = s.groups; - var sS = r.shader; - var p = s.glProgram; - var ugS = r.uniformGroup; - var resources; - `];let s=!1,i=0;const a=e._getProgramData(t.glProgram);for(const c in t.groups){const u=t.groups[c];r.push(` - resources = g[${c}].resources; - `);for(const _ in u.resources){const f=u.resources[_];if(f instanceof O)if(f.ubo){const l=t._uniformBindMap[c][Number(_)];r.push(` - sS.bindUniformBlock( - resources[${_}], - '${l}', - ${t.glProgram._uniformBlockData[l].index} - ); - `)}else r.push(` - ugS.updateUniformGroup(resources[${_}], p, sD); - `);else if(f instanceof te){const l=t._uniformBindMap[c][Number(_)];r.push(` - sS.bindUniformBlock( - resources[${_}], - '${l}', - ${t.glProgram._uniformBlockData[l].index} - ); - `)}else if(f instanceof Z){const l=t._uniformBindMap[c][_],m=a.uniformData[l];m&&(s||(s=!0,n.push(` - var tS = r.texture; - `)),e._gl.uniform1i(m.location,i),r.push(` - tS.bind(resources[${_}], ${i}); - `),i++)}}}const o=[...n,...r].join(` -`);return new Function("r","s","sD",o)}class at{constructor(e,r){this.program=e,this.uniformData=r,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function W(t,e,r){const n=t.createShader(e);return t.shaderSource(n,r),t.compileShader(n),n}function D(t){const e=new Array(t);for(let r=0;r<e.length;r++)e[r]=!1;return e}function me(t,e){switch(t){case"float":return 0;case"vec2":return new Float32Array(2*e);case"vec3":return new Float32Array(3*e);case"vec4":return new Float32Array(4*e);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*e);case"ivec3":return new Int32Array(3*e);case"ivec4":return new Int32Array(4*e);case"uvec2":return new Uint32Array(2*e);case"uvec3":return new Uint32Array(3*e);case"uvec4":return new Uint32Array(4*e);case"bool":return!1;case"bvec2":return D(2*e);case"bvec3":return D(3*e);case"bvec4":return D(4*e);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}let x=null;const j={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},ot={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function Ee(t,e){if(!x){const r=Object.keys(j);x={};for(let n=0;n<r.length;++n){const s=r[n];x[t[s]]=j[s]}}return x[e]}function ct(t,e){const r=Ee(t,e);return ot[r]||"float32"}function ut(t,e,r=!1){const n={},s=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=e.getActiveAttrib(t,a);if(o.name.startsWith("gl_"))continue;const c=ct(e,o.type);n[o.name]={location:0,format:c,stride:q(c).stride,offset:0,instance:!1,start:0}}const i=Object.keys(n);if(r){i.sort((a,o)=>a>o?1:-1);for(let a=0;a<i.length;a++)n[i[a]].location=a,e.bindAttribLocation(t,a,i[a]);e.linkProgram(t)}else for(let a=0;a<i.length;a++)n[i[a]].location=e.getAttribLocation(t,i[a]);return n}function _t(t,e){if(!e.ACTIVE_UNIFORM_BLOCKS)return{};const r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<n;s++){const i=e.getActiveUniformBlockName(t,s),a=e.getUniformBlockIndex(t,i),o=e.getActiveUniformBlockParameter(t,s,e.UNIFORM_BLOCK_DATA_SIZE);r[i]={name:i,index:a,size:o}}return r}function ft(t,e){const r={},n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<n;s++){const i=e.getActiveUniform(t,s),a=i.name.replace(/\[.*?\]$/,""),o=!!i.name.match(/\[.*?\]$/),c=Ee(e,i.type);r[a]={name:a,index:s,type:c,size:i.size,isArray:o,value:me(c,i.size)}}return r}function K(t,e){const r=t.getShaderSource(e);if(r===null){console.error("PixiJS Error: Could not retrieve shader source (WebGL context may be lost).");return}const n=r.split(` -`).map((_,f)=>`${f}: ${_}`),s=t.getShaderInfoLog(e)??"",i=s.split(` -`),a={},o=i.map(_=>parseFloat(_.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(_=>_&&!a[_]?(a[_]=!0,!0):!1),c=[""];o.forEach(_=>{n[_-1]=`%c${n[_-1]}%c`,c.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const u=n.join(` -`);c[0]=u,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...c),console.groupEnd()}function lt(t,e,r,n){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||K(t,r),t.getShaderParameter(n,t.COMPILE_STATUS)||K(t,n),console.error("PixiJS Error: Could not initialize shader."),t.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}function ht(t,e){const r=W(t,t.VERTEX_SHADER,e.vertex),n=W(t,t.FRAGMENT_SHADER,e.fragment),s=t.createProgram();t.attachShader(s,r),t.attachShader(s,n);const i=e.transformFeedbackVaryings;i&&(typeof t.transformFeedbackVaryings!="function"?p("TransformFeedback is not supported but TransformFeedbackVaryings are given."):t.transformFeedbackVaryings(s,i.names,i.bufferMode==="separate"?t.SEPARATE_ATTRIBS:t.INTERLEAVED_ATTRIBS)),t.linkProgram(s),t.getProgramParameter(s,t.LINK_STATUS)||lt(t,s,r,n),e._attributeData=ut(s,t,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(e.vertex)),e._uniformData=ft(s,t),e._uniformBlockData=_t(s,t),t.deleteShader(r),t.deleteShader(n);const a={};for(const c in e._uniformData){const u=e._uniformData[c];a[c]={location:t.getUniformLocation(s,c),value:me(u.type,u.size)}}return new at(s,a)}const v={textureCount:0,blockIndex:0};class be{constructor(e){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=e}contextChange(e){this._gl=e,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null}bind(e,r){if(this._setProgram(e.glProgram),r)return;v.textureCount=0,v.blockIndex=0;let n=this._shaderSyncFunctions[e.glProgram._key];n||(n=this._shaderSyncFunctions[e.glProgram._key]=this._generateShaderSync(e,this)),this._renderer.buffer.nextBindBase(!!e.glProgram.transformFeedbackVaryings),n(this._renderer,e,v)}updateUniformGroup(e){this._renderer.uniformGroup.updateUniformGroup(e,this._activeProgram,v)}bindUniformBlock(e,r,n=0){const s=this._renderer.buffer,i=this._getProgramData(this._activeProgram),a=e._bufferResource;a||this._renderer.ubo.updateUniformGroup(e);const o=e.buffer,c=s.updateBuffer(o),u=s.freeLocationForBufferBase(c);if(a){const{offset:f,size:l}=e;f===0&&l===o.data.byteLength?s.bindBufferBase(c,u):s.bindBufferRange(c,u,f)}else s.getLastBindBaseLocation(c)!==u&&s.bindBufferBase(c,u);const _=this._activeProgram._uniformBlockData[r].index;i.uniformBlockBindings[n]!==u&&(i.uniformBlockBindings[n]=u,this._renderer.gl.uniformBlockBinding(i.program,_,u))}_setProgram(e){if(this._activeProgram===e)return;this._activeProgram=e;const r=this._getProgramData(e);this._gl.useProgram(r.program)}_getProgramData(e){return this._programDataHash[e._key]||this._createProgramData(e)}_createProgramData(e){const r=e._key;return this._programDataHash[r]=ht(this._gl,e),this._programDataHash[r]}destroy(){for(const e of Object.keys(this._programDataHash))this._programDataHash[e].destroy();this._programDataHash=null,this._shaderSyncFunctions=null,this._activeProgram=null,this._renderer=null,this._gl=null}_generateShaderSync(e,r){return it(e,r)}resetState(){this._activeProgram=null}}be.extension={type:[d.WebGLSystem],name:"shader"};const dt={f32:`if (cv !== v) { - cu.value = v; - gl.uniform1f(location, v); - }`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { - cv[0] = v[0]; - cv[1] = v[1]; - gl.uniform2f(location, v[0], v[1]); - }`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - gl.uniform3f(location, v[0], v[1], v[2]); - }`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - cv[3] = v[3]; - gl.uniform4f(location, v[0], v[1], v[2], v[3]); - }`,i32:`if (cv !== v) { - cu.value = v; - gl.uniform1i(location, v); - }`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { - cv[0] = v[0]; - cv[1] = v[1]; - gl.uniform2i(location, v[0], v[1]); - }`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - gl.uniform3i(location, v[0], v[1], v[2]); - }`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - cv[3] = v[3]; - gl.uniform4i(location, v[0], v[1], v[2], v[3]); - }`,u32:`if (cv !== v) { - cu.value = v; - gl.uniform1ui(location, v); - }`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { - cv[0] = v[0]; - cv[1] = v[1]; - gl.uniform2ui(location, v[0], v[1]); - }`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - gl.uniform3ui(location, v[0], v[1], v[2]); - }`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - cv[3] = v[3]; - gl.uniform4ui(location, v[0], v[1], v[2], v[3]); - }`,bool:`if (cv !== v) { - cu.value = v; - gl.uniform1i(location, v); - }`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) { - cv[0] = v[0]; - cv[1] = v[1]; - gl.uniform2i(location, v[0], v[1]); - }`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - gl.uniform3i(location, v[0], v[1], v[2]); - }`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { - cv[0] = v[0]; - cv[1] = v[1]; - cv[2] = v[2]; - cv[3] = v[3]; - gl.uniform4i(location, v[0], v[1], v[2], v[3]); - }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},mt={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};function Et(t,e){const r=[` - var v = null; - var cv = null; - var cu = null; - var t = 0; - var gl = renderer.gl; - var name = null; - `];for(const n in t.uniforms){if(!e[n]){t.uniforms[n]instanceof O?t.uniforms[n].ubo?r.push(` - renderer.shader.bindUniformBlock(uv.${n}, "${n}"); - `):r.push(` - renderer.shader.updateUniformGroup(uv.${n}); - `):t.uniforms[n]instanceof te&&r.push(` - renderer.shader.bindBufferResource(uv.${n}, "${n}"); - `);continue}const s=t.uniformStructures[n];let i=!1;for(let a=0;a<N.length;a++){const o=N[a];if(s.type===o.type&&o.test(s)){r.push(`name = "${n}";`,N[a].uniform),i=!0;break}}if(!i){const o=(s.size===1?dt:mt)[s.type].replace("location",`ud["${n}"].location`);r.push(` - cu = ud["${n}"]; - cv = cu.value; - v = uv["${n}"]; - ${o};`)}}return new Function("ud","uv","renderer","syncData",r.join(` -`))}class pe{constructor(e){this._cache={},this._uniformGroupSyncHash={},this._renderer=e,this.gl=null,this._cache={}}contextChange(e){this.gl=e}updateUniformGroup(e,r,n){const s=this._renderer.shader._getProgramData(r);(!e.isStatic||e._dirtyId!==s.uniformDirtyGroups[e.uid])&&(s.uniformDirtyGroups[e.uid]=e._dirtyId,this._getUniformSyncFunction(e,r)(s.uniformData,e.uniforms,this._renderer,n))}_getUniformSyncFunction(e,r){var n;return((n=this._uniformGroupSyncHash[e._signature])==null?void 0:n[r._key])||this._createUniformSyncFunction(e,r)}_createUniformSyncFunction(e,r){const n=this._uniformGroupSyncHash[e._signature]||(this._uniformGroupSyncHash[e._signature]={}),s=this._getSignature(e,r._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(e,r._uniformData)),n[r._key]=this._cache[s],n[r._key]}_generateUniformsSync(e,r){return Et(e,r)}_getSignature(e,r,n){const s=e.uniforms,i=[`${n}-`];for(const a in s)i.push(a),r[a]&&i.push(r[a].type);return i.join("-")}destroy(){this._renderer=null,this._cache=null}}pe.extension={type:[d.WebGLSystem],name:"uniformGroup"};function bt(t){const e={};if(e.normal=[t.ONE,t.ONE_MINUS_SRC_ALPHA],e.add=[t.ONE,t.ONE],e.multiply=[t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.screen=[t.ONE,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.none=[0,0],e["normal-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA],e["add-npm"]=[t.SRC_ALPHA,t.ONE,t.ONE,t.ONE],e["screen-npm"]=[t.SRC_ALPHA,t.ONE_MINUS_SRC_COLOR,t.ONE,t.ONE_MINUS_SRC_ALPHA],e.erase=[t.ZERO,t.ONE_MINUS_SRC_ALPHA],!(t instanceof R.get().getWebGLRenderingContext()))e.min=[t.ONE,t.ONE,t.ONE,t.ONE,t.MIN,t.MIN],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,t.MAX,t.MAX];else{const n=t.getExtension("EXT_blend_minmax");n&&(e.min=[t.ONE,t.ONE,t.ONE,t.ONE,n.MIN_EXT,n.MIN_EXT],e.max=[t.ONE,t.ONE,t.ONE,t.ONE,n.MAX_EXT,n.MAX_EXT])}return e}const pt=0,St=1,Rt=2,gt=3,Tt=4,xt=5,Se=class U{constructor(e){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[pt]=this.setBlend,this.map[St]=this.setOffset,this.map[Rt]=this.setCullFace,this.map[gt]=this.setDepthTest,this.map[Tt]=this.setFrontFace,this.map[xt]=this.setDepthMask,this.checks=[],this.defaultState=M.for2d(),e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){this._invertFrontFace=!e.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(e){this.gl=e,this.blendModesMap=bt(e),this.resetState()}set(e){if(e||(e=this.defaultState),this.stateId!==e.data){let r=this.stateId^e.data,n=0;for(;r;)r&1&&this.map[n].call(this,!!(e.data&1<<n)),r>>=1,n++;this.stateId=e.data}for(let r=0;r<this.checks.length;r++)this.checks[r](this,e)}forceState(e){e||(e=this.defaultState);for(let r=0;r<this.map.length;r++)this.map[r].call(this,!!(e.data&1<<r));for(let r=0;r<this.checks.length;r++)this.checks[r](this,e);this.stateId=e.data}setBlend(e){this._updateCheck(U._checkBlendMode,e),this.gl[e?"enable":"disable"](this.gl.BLEND)}setOffset(e){this._updateCheck(U._checkPolygonOffset,e),this.gl[e?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this._cullFace=e,this.gl[e?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(e){this._frontFace=e,this._frontFaceDirty=!1;const r=this._invertFrontFace?!e:e;this._glFrontFace!==r&&(this._glFrontFace=r,this.gl.frontFace(this.gl[r?"CW":"CCW"]))}setBlendMode(e){if(this.blendModesMap[e]||(e="normal"),e===this.blendMode)return;this.blendMode=e;const r=this.blendModesMap[e],n=this.gl;r.length===2?n.blendFunc(r[0],r[1]):n.blendFuncSeparate(r[0],r[1],r[2],r[3]),r.length===6?(this._blendEq=!0,n.blendEquationSeparate(r[4],r[5])):this._blendEq&&(this._blendEq=!1,n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD))}setPolygonOffset(e,r){this.gl.polygonOffset(e,r)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(e,r){const n=this.checks.indexOf(e);r&&n===-1?this.checks.push(e):!r&&n!==-1&&this.checks.splice(n,1)}static _checkBlendMode(e,r){e.setBlendMode(r.blendMode)}static _checkPolygonOffset(e,r){e.setPolygonOffset(1,r.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};Se.extension={type:[d.WebGLSystem],name:"state"};let vt=Se;class At{constructor(e){this.target=w.TEXTURE_2D,this._layerInitMask=0,this.texture=e,this.width=-1,this.height=-1,this.type=h.UNSIGNED_BYTE,this.internalFormat=G.RGBA,this.format=G.RGBA,this.samplerType=0}destroy(){}}const Bt={id:"buffer",upload(t,e,r,n,s,i=!1){const a=s||e.target;!i&&e.width===t.width&&e.height===t.height?r.texSubImage2D(a,0,0,0,t.width,t.height,e.format,e.type,t.resource):r.texImage2D(a,0,e.internalFormat,t.width,t.height,0,e.format,e.type,t.resource),e.width=t.width,e.height=t.height}},yt={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},Ct={id:"compressed",upload(t,e,r,n,s,i){const a=s??e.target;r.pixelStorei(r.UNPACK_ALIGNMENT,4);let o=t.pixelWidth,c=t.pixelHeight;const u=!!yt[t.format];for(let _=0;_<t.resource.length;_++){const f=t.resource[_];u?r.compressedTexImage2D(a,_,e.internalFormat,o,c,0,f):r.texImage2D(a,_,e.internalFormat,o,c,0,e.format,e.type,f),o=Math.max(o>>1,1),c=Math.max(c>>1,1)}}},$=["right","left","top","bottom","front","back"];function Nt(t){return{id:"cube",upload(e,r,n,s){const i=e.faces;for(let a=0;a<$.length;a++){const o=$[a],c=i[o];(t[c.uploadMethodId]||t.image).upload(c,r,n,s,w.TEXTURE_CUBE_MAP_POSITIVE_X+a,(r._layerInitMask&1<<a)===0),r._layerInitMask|=1<<a}r.width=e.pixelWidth,r.height=e.pixelHeight}}}const Re={id:"image",upload(t,e,r,n,s,i=!1){const a=s||e.target,o=t.pixelWidth,c=t.pixelHeight,u=t.resourceWidth,_=t.resourceHeight,f=n===2,l=i||e.width!==o||e.height!==c,m=u>=o&&_>=c,b=t.resource;(f?Dt:It)(r,a,e,o,c,u,_,b,l,m),e.width=o,e.height=c}};function Dt(t,e,r,n,s,i,a,o,c,u){if(!u){c&&t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,null),t.texSubImage2D(e,0,0,0,i,a,r.format,r.type,o);return}if(!c){t.texSubImage2D(e,0,0,0,r.format,r.type,o);return}t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,o)}function It(t,e,r,n,s,i,a,o,c,u){if(!u){c&&t.texImage2D(e,0,r.internalFormat,n,s,0,r.format,r.type,null),t.texSubImage2D(e,0,0,0,r.format,r.type,o);return}if(!c){t.texSubImage2D(e,0,0,0,r.format,r.type,o);return}t.texImage2D(e,0,r.internalFormat,r.format,r.type,o)}const Gt=Ke(),Ut={id:"video",upload(t,e,r,n,s,i=Gt){if(!t.isValid){const a=s??e.target;r.texImage2D(a,0,e.internalFormat,1,1,0,e.format,e.type,null);return}Re.upload(t,e,r,n,s,i)}},Y={linear:9729,nearest:9728},Ft={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},I={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},Pt={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function z(t,e,r,n,s,i,a,o){const c=i;if(!o||t.addressModeU!=="repeat"||t.addressModeV!=="repeat"||t.addressModeW!=="repeat"){const u=I[a?"clamp-to-edge":t.addressModeU],_=I[a?"clamp-to-edge":t.addressModeV],f=I[a?"clamp-to-edge":t.addressModeW];e[s](c,e.TEXTURE_WRAP_S,u),e[s](c,e.TEXTURE_WRAP_T,_),e.TEXTURE_WRAP_R&&e[s](c,e.TEXTURE_WRAP_R,f)}if((!o||t.magFilter!=="linear")&&e[s](c,e.TEXTURE_MAG_FILTER,Y[t.magFilter]),r){if(!o||t.mipmapFilter!=="linear"){const u=Ft[t.minFilter][t.mipmapFilter];e[s](c,e.TEXTURE_MIN_FILTER,u)}}else e[s](c,e.TEXTURE_MIN_FILTER,Y[t.minFilter]);if(n&&t.maxAnisotropy>1){const u=Math.min(t.maxAnisotropy,e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));e[s](c,n.TEXTURE_MAX_ANISOTROPY_EXT,u)}t.compare&&e[s](c,e.TEXTURE_COMPARE_FUNC,Pt[t.compare])}function Ot(t){return{r8unorm:t.RED,r8snorm:t.RED,r8uint:t.RED,r8sint:t.RED,r16uint:t.RED,r16sint:t.RED,r16float:t.RED,rg8unorm:t.RG,rg8snorm:t.RG,rg8uint:t.RG,rg8sint:t.RG,r32uint:t.RED,r32sint:t.RED,r32float:t.RED,rg16uint:t.RG,rg16sint:t.RG,rg16float:t.RG,rgba8unorm:t.RGBA,"rgba8unorm-srgb":t.RGBA,rgba8snorm:t.RGBA,rgba8uint:t.RGBA,rgba8sint:t.RGBA,bgra8unorm:t.RGBA,"bgra8unorm-srgb":t.RGBA,rgb9e5ufloat:t.RGB,rgb10a2unorm:t.RGBA,rg11b10ufloat:t.RGB,rg32uint:t.RG,rg32sint:t.RG,rg32float:t.RG,rgba16uint:t.RGBA,rgba16sint:t.RGBA,rgba16float:t.RGBA,rgba32uint:t.RGBA,rgba32sint:t.RGBA,rgba32float:t.RGBA,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT,depth24plus:t.DEPTH_COMPONENT,"depth24plus-stencil8":t.DEPTH_STENCIL,depth32float:t.DEPTH_COMPONENT,"depth32float-stencil8":t.DEPTH_STENCIL}}function Mt(t,e){let r={},n=t.RGBA;return t instanceof R.get().getWebGLRenderingContext()?e.srgb&&(r={"rgba8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":e.srgb.SRGB8_ALPHA8_EXT}):(r={"rgba8unorm-srgb":t.SRGB8_ALPHA8,"bgra8unorm-srgb":t.SRGB8_ALPHA8},n=t.RGBA8),{r8unorm:t.R8,r8snorm:t.R8_SNORM,r8uint:t.R8UI,r8sint:t.R8I,r16uint:t.R16UI,r16sint:t.R16I,r16float:t.R16F,rg8unorm:t.RG8,rg8snorm:t.RG8_SNORM,rg8uint:t.RG8UI,rg8sint:t.RG8I,r32uint:t.R32UI,r32sint:t.R32I,r32float:t.R32F,rg16uint:t.RG16UI,rg16sint:t.RG16I,rg16float:t.RG16F,rgba8unorm:t.RGBA,...r,rgba8snorm:t.RGBA8_SNORM,rgba8uint:t.RGBA8UI,rgba8sint:t.RGBA8I,bgra8unorm:n,rgb9e5ufloat:t.RGB9_E5,rgb10a2unorm:t.RGB10_A2,rg11b10ufloat:t.R11F_G11F_B10F,rg32uint:t.RG32UI,rg32sint:t.RG32I,rg32float:t.RG32F,rgba16uint:t.RGBA16UI,rgba16sint:t.RGBA16I,rgba16float:t.RGBA16F,rgba32uint:t.RGBA32UI,rgba32sint:t.RGBA32I,rgba32float:t.RGBA32F,stencil8:t.STENCIL_INDEX8,depth16unorm:t.DEPTH_COMPONENT16,depth24plus:t.DEPTH_COMPONENT24,"depth24plus-stencil8":t.DEPTH24_STENCIL8,depth32float:t.DEPTH_COMPONENT32F,"depth32float-stencil8":t.DEPTH32F_STENCIL8,...e.s3tc?{"bc1-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":e.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...e.s3tc_sRGB?{"bc1-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":e.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...e.rgtc?{"bc4-r-unorm":e.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":e.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":e.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":e.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...e.bptc?{"bc6h-rgb-float":e.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":e.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":e.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":e.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...e.etc?{"etc2-rgb8unorm":e.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":e.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":e.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":e.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":e.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":e.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":e.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":e.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...e.astc?{"astc-4x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":e.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":e.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}function Lt(t){return{r8unorm:t.UNSIGNED_BYTE,r8snorm:t.BYTE,r8uint:t.UNSIGNED_BYTE,r8sint:t.BYTE,r16uint:t.UNSIGNED_SHORT,r16sint:t.SHORT,r16float:t.HALF_FLOAT,rg8unorm:t.UNSIGNED_BYTE,rg8snorm:t.BYTE,rg8uint:t.UNSIGNED_BYTE,rg8sint:t.BYTE,r32uint:t.UNSIGNED_INT,r32sint:t.INT,r32float:t.FLOAT,rg16uint:t.UNSIGNED_SHORT,rg16sint:t.SHORT,rg16float:t.HALF_FLOAT,rgba8unorm:t.UNSIGNED_BYTE,"rgba8unorm-srgb":t.UNSIGNED_BYTE,rgba8snorm:t.BYTE,rgba8uint:t.UNSIGNED_BYTE,rgba8sint:t.BYTE,bgra8unorm:t.UNSIGNED_BYTE,"bgra8unorm-srgb":t.UNSIGNED_BYTE,rgb9e5ufloat:t.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:t.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:t.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:t.UNSIGNED_INT,rg32sint:t.INT,rg32float:t.FLOAT,rgba16uint:t.UNSIGNED_SHORT,rgba16sint:t.SHORT,rgba16float:t.HALF_FLOAT,rgba32uint:t.UNSIGNED_INT,rgba32sint:t.INT,rgba32float:t.FLOAT,stencil8:t.UNSIGNED_BYTE,depth16unorm:t.UNSIGNED_SHORT,depth24plus:t.UNSIGNED_INT,"depth24plus-stencil8":t.UNSIGNED_INT_24_8,depth32float:t.FLOAT,"depth32float-stencil8":t.FLOAT_32_UNSIGNED_INT_24_8_REV}}function wt(t){return{"2d":t.TEXTURE_2D,cube:t.TEXTURE_CUBE_MAP,"1d":null,"3d":(t==null?void 0:t.TEXTURE_3D)||null,"2d-array":(t==null?void 0:t.TEXTURE_2D_ARRAY)||null,"cube-array":(t==null?void 0:t.TEXTURE_CUBE_MAP_ARRAY)||null}}const Ht=4,V=class ge{constructor(e){this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=e,this._managedTextures=new F({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"glTexture"});const r={image:Re,buffer:Bt,video:Ut,compressed:Ct,...ge.uploadExtensions};this._uploads={...r,cube:Nt(r)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gl=e,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Mt(e,this._renderer.context.extensions),this._mapFormatToType=Lt(e),this._mapFormatToFormat=Ot(e),this._mapViewDimensionToGlTarget=wt(e)),this._managedTextures.removeAll(!0),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let r=0;r<16;r++)this.bind(S.EMPTY,r)}initSource(e){this.bind(e)}bind(e,r=0){const n=e.source;e?(this.bindSource(n,r),this._useSeparateSamplers&&this._bindSampler(n.style,r)):(this.bindSource(null,r),this._useSeparateSamplers&&this._bindSampler(null,r))}bindSource(e,r=0){const n=this._gl;if(e._gcLastUsed=this._renderer.gc.now,this._boundTextures[r]!==e){this._boundTextures[r]=e,this._activateLocation(r),e||(e=S.EMPTY.source);const s=this.getGlSource(e);n.bindTexture(s.target,s.texture)}}_bindSampler(e,r=0){const n=this._gl;if(!e){this._boundSamplers[r]=null,n.bindSampler(r,null);return}const s=this._getGlSampler(e);this._boundSamplers[r]!==s&&(this._boundSamplers[r]=s,n.bindSampler(r,s))}unbind(e){const r=e.source,n=this._boundTextures,s=this._gl;for(let i=0;i<n.length;i++)if(n[i]===r){this._activateLocation(i);const a=this.getGlSource(r);s.bindTexture(a.target,null),n[i]=null}}_activateLocation(e){this._activeTextureLocation!==e&&(this._activeTextureLocation=e,this._gl.activeTexture(this._gl.TEXTURE0+e))}_initSource(e){const r=this._gl,n=new At(r.createTexture());if(n.type=this._mapFormatToType[e.format],n.internalFormat=this._mapFormatToInternalFormat[e.format],n.format=this._mapFormatToFormat[e.format],n.target=this._mapViewDimensionToGlTarget[e.viewDimension],n.target===null)throw new Error(`Unsupported view dimension: ${e.viewDimension} with this webgl version: ${this._renderer.context.webGLVersion}`);if(e.uploadMethodId==="cube"&&(n.target=r.TEXTURE_CUBE_MAP),e.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||e.isPowerOfTwo)){const i=Math.max(e.width,e.height);e.mipLevelCount=Math.floor(Math.log2(i))+1}return e._gpuData[this._renderer.uid]=n,this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceUpdate,this),e.on("styleChange",this.onStyleChange,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),this.updateStyle(e,!1),n}onStyleChange(e){this.updateStyle(e,!1)}updateStyle(e,r){const n=this._gl,s=this.getGlSource(e);n.bindTexture(s.target,s.texture),this._boundTextures[this._activeTextureLocation]=e,z(e.style,n,e.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.target,!this._renderer.context.supports.nonPowOf2wrapping&&!e.isPowerOfTwo,r)}onSourceUnload(e,r=!1){const n=e._gpuData[this._renderer.uid];n&&(r||(this.unbind(e),this._gl.deleteTexture(n.texture)),e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceUpdate,this),e.off("styleChange",this.onStyleChange,this),e.off("updateMipmaps",this.onUpdateMipmaps,this))}onSourceUpdate(e){const r=this._gl,n=this.getGlSource(e);r.bindTexture(n.target,n.texture),this._boundTextures[this._activeTextureLocation]=e;const s=e.alphaMode==="premultiply-alpha-on-upload";if(this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[e.uploadMethodId])this._uploads[e.uploadMethodId].upload(e,n,r,this._renderer.context.webGLVersion);else if(n.target===r.TEXTURE_2D)this._initEmptyTexture2D(n,e);else if(n.target===r.TEXTURE_2D_ARRAY)this._initEmptyTexture2DArray(n,e);else if(n.target===r.TEXTURE_CUBE_MAP)this._initEmptyTextureCube(n,e);else throw new Error("[GlTextureSystem] Unsupported texture target for empty allocation.");this._applyMipRange(n,e),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e,!1)}onUpdateMipmaps(e,r=!0){r&&this.bindSource(e,0);const n=this.getGlSource(e);this._gl.generateMipmap(n.target)}_initEmptyTexture2D(e,r){const n=this._gl;n.texImage2D(n.TEXTURE_2D,0,e.internalFormat,r.pixelWidth,r.pixelHeight,0,e.format,e.type,null);let s=Math.max(r.pixelWidth>>1,1),i=Math.max(r.pixelHeight>>1,1);for(let a=1;a<r.mipLevelCount;a++)n.texImage2D(n.TEXTURE_2D,a,e.internalFormat,s,i,0,e.format,e.type,null),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}_initEmptyTexture2DArray(e,r){if(this._renderer.context.webGLVersion!==2)throw new Error("[GlTextureSystem] TEXTURE_2D_ARRAY requires WebGL2.");const n=this._gl,s=Math.max(r.arrayLayerCount|0,1);n.texImage3D(n.TEXTURE_2D_ARRAY,0,e.internalFormat,r.pixelWidth,r.pixelHeight,s,0,e.format,e.type,null);let i=Math.max(r.pixelWidth>>1,1),a=Math.max(r.pixelHeight>>1,1);for(let o=1;o<r.mipLevelCount;o++)n.texImage3D(n.TEXTURE_2D_ARRAY,o,e.internalFormat,i,a,s,0,e.format,e.type,null),i=Math.max(i>>1,1),a=Math.max(a>>1,1)}_initEmptyTextureCube(e,r){const n=this._gl,s=6;for(let o=0;o<s;o++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,e.internalFormat,r.pixelWidth,r.pixelHeight,0,e.format,e.type,null);let i=Math.max(r.pixelWidth>>1,1),a=Math.max(r.pixelHeight>>1,1);for(let o=1;o<r.mipLevelCount;o++){for(let c=0;c<s;c++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,o,e.internalFormat,i,a,0,e.format,e.type,null);i=Math.max(i>>1,1),a=Math.max(a>>1,1)}}_applyMipRange(e,r){if(this._renderer.context.webGLVersion!==2||r.mipLevelCount<=1)return;const n=this._gl,s=Math.max((r.mipLevelCount|0)-1,0);n.texParameteri(e.target,n.TEXTURE_BASE_LEVEL,0),n.texParameteri(e.target,n.TEXTURE_MAX_LEVEL,s)}_initSampler(e){const r=this._gl,n=this._gl.createSampler();return this._glSamplers[e._resourceId]=n,z(e,r,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",n,!1,!0),this._glSamplers[e._resourceId]}_getGlSampler(e){return this._glSamplers[e._resourceId]||this._initSampler(e)}getGlSource(e){return e._gcLastUsed=this._renderer.gc.now,e._gpuData[this._renderer.uid]||this._initSource(e)}generateCanvas(e){const{pixels:r,width:n,height:s}=this.getPixels(e),i=R.get().createCanvas();i.width=n,i.height=s;const a=i.getContext("2d");if(a){const o=a.createImageData(n,s);o.data.set(r),a.putImageData(o,0,0)}return i}getPixels(e){const r=e.source.resolution,n=e.frame,s=Math.max(Math.round(n.width*r),1),i=Math.max(Math.round(n.height*r),1),a=new Uint8Array(Ht*s*i),o=this._renderer,c=o.renderTarget.getRenderTarget(e),u=o.renderTarget.getGpuRenderTarget(c),_=o.gl;return _.bindFramebuffer(_.FRAMEBUFFER,u.resolveTargetFramebuffer),_.readPixels(Math.round(n.x*r),Math.round(n.y*r),s,i,_.RGBA,_.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:s,height:i}}destroy(){this._managedTextures.destroy(),this._glSamplers=null,this._boundTextures=null,this._boundSamplers=null,this._mapFormatToInternalFormat=null,this._mapFormatToType=null,this._mapFormatToFormat=null,this._uploads=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(S.EMPTY.source),this._boundSamplers=Object.create(null);const e=this._gl;this._premultiplyAlpha=!1,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};V.extension={type:[d.WebGLSystem],name:"texture"};V.uploadExtensions=Object.create(null);let Te=V;g.handleByMap(d.TextureUploaderWebGL,Te.uploadExtensions);class xe{contextChange(e){const r=new O({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new J,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),n=e.limits.maxBatchableTextures,s=Q({name:"graphics",bits:[Ge,Ue(n),re,ee]});this.shader=new P({glProgram:s,resources:{localUniforms:r,batchSamplers:Fe(n)}})}execute(e,r){const n=r.context,s=n.customShader||this.shader,i=e.renderer,a=i.graphicsContext,{batcher:o,instructions:c}=a.getContextRenderData(n);s.groups[0]=i.globalUniforms.bindGroup,i.state.set(e.state),i.shader.bind(s),i.geometry.bind(o.geometry,s.glProgram);const u=c.instructions;for(let _=0;_<c.instructionSize;_++){const f=u[_];if(f.size){for(let l=0;l<f.textures.count;l++)i.texture.bind(f.textures.textures[l],l);i.geometry.draw(f.topology,f.size,f.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}xe.extension={type:[d.WebGLPipesAdaptor],name:"graphics"};class ve{init(){const e=Q({name:"mesh",bits:[re,Xe,ee]});this._shader=new P({glProgram:e,resources:{uTexture:S.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new J}}}})}execute(e,r){const n=e.renderer;let s=r._shader;if(s){if(!s.glProgram){p("Mesh shader has no glProgram",r.shader);return}}else{s=this._shader;const i=r.texture,a=i.source;s.resources.uTexture=a,s.resources.uSampler=a.style,s.resources.textureUniforms.uniforms.uTextureMatrix=i.textureMatrix.mapCoord}s.groups[100]=n.globalUniforms.bindGroup,s.groups[101]=e.localUniformsBindGroup,n.encoder.draw({geometry:r._geometry,shader:s,state:r.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ve.extension={type:[d.WebGLPipesAdaptor],name:"mesh"};const Vt=[...We,he,Qe,Ye,_e,se,Te,de,ae,pe,be,ue,vt,fe,ce],Xt=[...je],kt=[ne,ve,xe],Ae=[],Be=[],ye=[];g.handleByNamedList(d.WebGLSystem,Ae);g.handleByNamedList(d.WebGLPipes,Be);g.handleByNamedList(d.WebGLPipesAdaptor,ye);g.add(...Vt,...Xt,...kt);class Yt extends Pe{constructor(){const e={name:"webgl",type:Oe.WEBGL,systems:Ae,renderPipes:Be,renderPipeAdaptors:ye};super(e)}}export{Yt as WebGLRenderer}; diff --git a/2026/games_submissions/sunshoes/assets/WebGPURenderer-Ddwua8JA.js b/2026/games_submissions/sunshoes/assets/WebGPURenderer-Ddwua8JA.js deleted file mode 100644 index 2247c5a..0000000 --- a/2026/games_submissions/sunshoes/assets/WebGPURenderer-Ddwua8JA.js +++ /dev/null @@ -1,41 +0,0 @@ -import{a5 as D,z as l,x as k,t as le,a6 as fe,Z as T,r as C,s as B,B as ge,a7 as z,a8 as R,w as v,a9 as y,Y as me,aa as _e,ab as F,c as E,F as G,N as O,ac as I,ad as be,ae as W,af as xe,S as H,T as A,_ as ye,$ as Ge}from"./index-DvAPfvr6.js";import{c as Pe,u as Se,U as Te,B as Be,G as Ce,e as ve,l as Ue,a as Me,t as we}from"./BufferResource-BZpoqTVb.js";import{S as N}from"./Filter-BiIvpnZm.js";import{R as Re,S as Ee,e as Ae}from"./RenderTargetSystem-Cp6tD-lP.js";const P=N.for2d();class V{start(e,t,r){const s=e.renderer,i=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=t,i.setGeometry(t,n),P.blendMode="normal",s.pipeline.getPipeline(t,n,P);const a=s.globalUniforms.bindGroup;i.resetBindGroup(1),i.setBindGroup(0,a,n)}execute(e,t){const r=this._shader.gpuProgram,s=e.renderer,i=s.encoder;if(!t.bindGroup){const u=t.textures;t.bindGroup=D(u.textures,u.count,s.limits.maxBatchableTextures)}P.blendMode=t.blendMode;const n=s.bindGroup.getBindGroup(t.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,P,t.topology);t.bindGroup._touch(s.gc.now,s.tick),i.setPipeline(a),i.renderPassEncoder.setBindGroup(1,n),i.renderPassEncoder.drawIndexed(t.size,1,t.start)}}V.extension={type:[l.WebGPUPipesAdaptor],name:"batch"};class j{constructor(e){this._hash=Object.create(null),this._renderer=e}contextChange(e){this._gpu=e}getBindGroup(e,t,r){return e._updateKey(),this._hash[e._key]||this._createBindGroup(e,t,r)}_createBindGroup(e,t,r){const s=this._gpu.device,i=t.layout[r],n=[],a=this._renderer;for(const f in i){const h=e.resources[f]??e.resources[i[f]];let p;if(h._resourceType==="uniformGroup"){const d=h;a.ubo.updateUniformGroup(d);const m=d.buffer;p={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(h._resourceType==="buffer"){const d=h;p={buffer:a.buffer.getGPUBuffer(d),offset:0,size:d.descriptor.size}}else if(h._resourceType==="bufferResource"){const d=h;p={buffer:a.buffer.getGPUBuffer(d.buffer),offset:d.offset,size:d.size}}else if(h._resourceType==="textureSampler"){const d=h;p=a.texture.getGpuSampler(d)}else if(h._resourceType==="textureSource"){const d=h;p=a.texture.getTextureView(d)}n.push({binding:i[f],resource:p})}const u=a.shader.getProgramData(t).bindGroups[r],c=s.createBindGroup({layout:u,entries:n});return this._hash[e._key]=c,c}destroy(){this._hash=null,this._renderer=null}}j.extension={type:[l.WebGPUSystem],name:"bindGroup"};class Le{constructor(e){this.gpuBuffer=e}destroy(){this.gpuBuffer.destroy(),this.gpuBuffer=null}}class K{constructor(e){this._renderer=e,this._managedBuffers=new k({renderer:e,type:"resource",onUnload:this.onBufferUnload.bind(this),name:"gpuBuffer"})}contextChange(e){this._gpu=e}getGPUBuffer(e){var t;return e._gcLastUsed=this._renderer.gc.now,((t=e._gpuData[this._renderer.uid])==null?void 0:t.gpuBuffer)||this.createGPUBuffer(e)}updateBuffer(e){const t=this.getGPUBuffer(e),r=e.data;return e._updateID&&r&&(e._updateID=0,this._gpu.device.queue.writeBuffer(t,0,r.buffer,0,(e._updateSize||r.byteLength)+3&-4)),t}destroyAll(){this._managedBuffers.removeAll()}onBufferUnload(e){e.off("update",this.updateBuffer,this),e.off("change",this.onBufferChange,this)}createGPUBuffer(e){const t=this._gpu.device.createBuffer(e.descriptor);return e._updateID=0,e._resourceId=le("resource"),e.data&&(fe(e.data.buffer,t.getMappedRange(),e.data.byteOffset,e.data.byteLength),t.unmap()),e._gpuData[this._renderer.uid]=new Le(t),this._managedBuffers.add(e)&&(e.on("update",this.updateBuffer,this),e.on("change",this.onBufferChange,this)),t}onBufferChange(e){this._managedBuffers.remove(e),e._updateID=0,this.createGPUBuffer(e)}destroy(){this._managedBuffers.destroy(),this._renderer=null,this._gpu=null}}K.extension={type:[l.WebGPUSystem],name:"buffer"};class De{constructor({minUniformOffsetAlignment:e}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=e,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(e){if(e>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${e*4}`);const t=this.byteIndex;let r=t+e*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,t}addGroup(e){const t=this.addEmptyGroup(e.length);for(let r=0;r<e.length;r++)this.data[t/4+r]=e[r];return t}destroy(){this.data=null}}class q{constructor(e){this._colorMaskCache=15,this._renderer=e}setMask(e){this._colorMaskCache!==e&&(this._colorMaskCache=e,this._renderer.pipeline.setColorMask(e))}destroy(){this._renderer=null,this._colorMaskCache=null}}q.extension={type:[l.WebGPUSystem],name:"colorMask"};class U{constructor(e){this._renderer=e}async init(e){return this._initPromise?this._initPromise:(this._initPromise=(e.gpu?Promise.resolve(e.gpu):this._createDeviceAndAdaptor(e)).then(t=>{this.gpu=t,this.extensions={transientAttachment:typeof GPUTextureUsage.TRANSIENT_ATTACHMENT=="number"},this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(e){this._renderer.gpu=e}async _createDeviceAndAdaptor(e){const t=await T.get().getNavigator().gpu.requestAdapter({powerPreference:e.powerPreference,forceFallbackAdapter:e.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(i=>t.features.has(i)),s=await t.requestDevice({requiredFeatures:r});return{adapter:t,device:s}}destroy(){this.gpu=null,this.extensions=null,this._renderer=null}}U.extension={type:[l.WebGPUSystem],name:"device"};U.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};class Y{constructor(e){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=e}renderStart(){this.commandFinished=new Promise(e=>{this._resolveCommandFinished=e}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(e){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(e.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(e){this.renderPassEncoder.setViewport(e.x,e.y,e.width,e.height,0,1)}setPipelineFromGeometryProgramAndState(e,t,r,s){const i=this._renderer.pipeline.getPipeline(e,t,r,s);this.setPipeline(i)}setPipeline(e){this._boundPipeline!==e&&(this._boundPipeline=e,this.renderPassEncoder.setPipeline(e))}_setVertexBuffer(e,t){this._boundVertexBuffer[e]!==t&&(this._boundVertexBuffer[e]=t,this.renderPassEncoder.setVertexBuffer(e,this._renderer.buffer.updateBuffer(t)))}_setIndexBuffer(e){if(this._boundIndexBuffer===e)return;this._boundIndexBuffer=e;const t=e.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(e),t)}resetBindGroup(e){this._boundBindGroup[e]=null}setBindGroup(e,t,r){if(this._boundBindGroup[e]===t)return;this._boundBindGroup[e]=t,t._touch(this._renderer.gc.now,this._renderer.tick);const s=this._renderer.bindGroup.getBindGroup(t,r,e);this.renderPassEncoder.setBindGroup(e,s)}setGeometry(e,t){const r=this._renderer.pipeline.getBufferNamesToBind(e,t);for(const s in r)this._setVertexBuffer(parseInt(s,10),e.attributes[r[s]].buffer);e.indexBuffer&&this._setIndexBuffer(e.indexBuffer)}_setShaderBindGroups(e,t){for(const r in e.groups){const s=e.groups[r];t||this._syncBindGroup(s),this.setBindGroup(r,s,e.gpuProgram)}}_syncBindGroup(e){for(const t in e.resources){const r=e.resources[t];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(e){const{geometry:t,shader:r,state:s,topology:i,size:n,start:a,instanceCount:u,skipSync:c}=e;this.setPipelineFromGeometryProgramAndState(t,r.gpuProgram,s,i),this.setGeometry(t,r.gpuProgram),this._setShaderBindGroups(r,c),t.indexBuffer?this.renderPassEncoder.drawIndexed(n||t.indexBuffer.data.length,u??t.instanceCount,a||0):this.renderPassEncoder.draw(n||t.getSize(),u??t.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const e=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1],this._renderer.renderTarget.mipLevel,this._renderer.renderTarget.layer);this.renderPassEncoder=this.commandEncoder.beginRenderPass(e);const t=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,i={...this._boundBindGroup};this._clearCache();const n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(t);for(const a in r)this._setVertexBuffer(a,r[a]);for(const a in i)this.setBindGroup(a,i[a],null);this._setIndexBuffer(s)}_clearCache(){for(let e=0;e<16;e++)this._boundBindGroup[e]=null,this._boundVertexBuffer[e]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(e){this._gpu=e}}Y.extension={type:[l.WebGPUSystem],name:"encoder",priority:1};class ${constructor(e){this._renderer=e}contextChange(){this.maxTextures=this._renderer.device.gpu.device.limits.maxSampledTexturesPerShaderStage,this.maxBatchableTextures=this.maxTextures}destroy(){}}$.extension={type:[l.WebGPUSystem],name:"limits"};class X{constructor(e){this._renderTargetStencilState=Object.create(null),this._renderer=e,e.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(e){let t=this._renderTargetStencilState[e.uid];t||(t=this._renderTargetStencilState[e.uid]={stencilMode:C.DISABLED,stencilReference:0}),this._activeRenderTarget=e,this.setStencilMode(t.stencilMode,t.stencilReference)}setStencilMode(e,t){const r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=e,r.stencilReference=t;const s=this._renderer;s.pipeline.setStencilMode(e),s.encoder.renderPassEncoder.setStencilReference(t)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}X.extension={type:[l.WebGPUSystem],name:"stencil"};const S={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function ke(o){const e=o.map(r=>({data:r,offset:0,size:0}));let t=0;for(let r=0;r<e.length;r++){const s=e[r];let i=S[s.data.type].size;const n=S[s.data.type].align;if(!S[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(i=Math.max(i,n)*s.data.size),t=Math.ceil(t/n)*n,s.size=i,s.offset=t,t+=i}return t=Math.ceil(t/16)*16,{uboElements:e,size:t}}function ze(o,e){const{size:t,align:r}=S[o.data.type],s=(r-t)/4,i=o.data.type.indexOf("i32")>=0?"dataInt32":"data";return` - v = uv.${o.data.name}; - ${e!==0?`offset += ${e};`:""} - - arrayOffset = offset; - - t = 0; - - for(var i=0; i < ${o.data.size*(t/4)}; i++) - { - for(var j = 0; j < ${t/4}; j++) - { - ${i}[arrayOffset++] = v[t++]; - } - ${s!==0?`arrayOffset += ${s};`:""} - } - `}function Fe(o){return Pe(o,"uboWgsl",ze,Se)}class Z extends Te{constructor(){super({createUboElements:ke,generateUboSync:Fe})}}Z.extension={type:[l.WebGPUSystem],name:"ubo"};const b=128;class J{constructor(e){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=e,this._batchBuffer=new De({minUniformOffsetAlignment:b});const t=256/b;for(let r=0;r<t;r++){let s=B.UNIFORM|B.COPY_DST;r===0&&(s|=B.COPY_SRC),this._buffers.push(new ge({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){this._bindGroupHash=Object.create(null),this._batchBuffer.clear()}getUniformBindGroup(e,t){if(!t&&this._bindGroupHash[e.uid])return this._bindGroupHash[e.uid];this._renderer.ubo.ensureUniformGroup(e);const r=e.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(e,this._batchBuffer.data,s/4),this._bindGroupHash[e.uid]=this._getBindGroup(s/b),this._bindGroupHash[e.uid]}getUboResource(e){this._renderer.ubo.updateUniformGroup(e);const t=e.buffer.data,r=this._batchBuffer.addGroup(t);return this._getBufferResource(r/b)}getArrayBindGroup(e){const t=this._batchBuffer.addGroup(e);return this._getBindGroup(t/b)}getArrayBufferResource(e){const r=this._batchBuffer.addGroup(e)/b;return this._getBufferResource(r)}_getBufferResource(e){if(!this._bufferResources[e]){const t=this._buffers[e%2];this._bufferResources[e]=new Be({buffer:t,offset:(e/2|0)*256,size:b})}return this._bufferResources[e]}_getBindGroup(e){if(!this._bindGroups[e]){const t=new z({0:this._getBufferResource(e)});this._bindGroups[e]=t}return this._bindGroups[e]}_uploadBindGroups(){const e=this._renderer.buffer,t=this._buffers[0];t.update(this._batchBuffer.byteIndex),e.updateBuffer(t);const r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){const i=this._buffers[s];r.copyBufferToBuffer(e.getGPUBuffer(t),b,e.getGPUBuffer(i),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){var e;for(let t=0;t<this._bindGroups.length;t++)(e=this._bindGroups[t])==null||e.destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._renderer=null}}J.extension={type:[l.WebGPUPipes],name:"uniformBatch"};const Oe={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function Ie(o,e,t,r,s){return o<<24|e<<16|t<<10|r<<5|s}function We(o,e,t,r,s){return t<<8|o<<5|r<<3|s<<1|e}class Q{constructor(e){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._colorTargetCount=1,this._renderer=e}contextChange(e){this._gpu=e,this.setStencilMode(C.DISABLED),this._updatePipeHash()}setMultisampleCount(e){this._multisampleCount!==e&&(this._multisampleCount=e,this._updatePipeHash())}setRenderTarget(e){this._multisampleCount=e.msaaSamples,this._depthStencilAttachment=e.descriptor.depthStencilAttachment?1:0,this._colorTargetCount=e.colorTargetCount,this._updatePipeHash()}setColorMask(e){this._colorMask!==e&&(this._colorMask=e,this._updatePipeHash())}setStencilMode(e){this._stencilMode!==e&&(this._stencilMode=e,this._stencilState=Ce[e],this._updatePipeHash())}setPipeline(e,t,r,s){const i=this.getPipeline(e,t,r);s.setPipeline(i)}getPipeline(e,t,r,s){e._layoutKey||(ve(e,t.attributeData),this._generateBufferKey(e)),s||(s=e.topology);const i=Ie(e._layoutKey,t._layoutKey,r.data,r._blendModeId,Oe[s]);return this._pipeCache[i]?this._pipeCache[i]:(this._pipeCache[i]=this._createPipeline(e,t,r,s),this._pipeCache[i])}_createPipeline(e,t,r,s){const i=this._gpu.device,n=this._createVertexBufferLayouts(e,t),a=this._renderer.state.getColorTargets(r,this._colorTargetCount),u=this._stencilMode===C.RENDERING_MASK_ADD?0:this._colorMask;for(let p=0;p<a.length;p++)a[p].writeMask=u;const c=this._renderer.shader.getProgramData(t).pipeline,f={vertex:{module:this._getModule(t.vertex.source),entryPoint:t.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(t.fragment.source),entryPoint:t.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:c,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(f.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),i.createRenderPipeline(f)}_getModule(e){return this._moduleCache[e]||this._createModule(e)}_createModule(e){const t=this._gpu.device;return this._moduleCache[e]=t.createShaderModule({code:e}),this._moduleCache[e]}_generateBufferKey(e){const t=[];let r=0;const s=Object.keys(e.attributes).sort();for(let n=0;n<s.length;n++){const a=e.attributes[s[n]];t[r++]=a.offset,t[r++]=a.format,t[r++]=a.stride,t[r++]=a.instance}const i=t.join("|");return e._layoutKey=R(i,"geometry"),e._layoutKey}_generateAttributeLocationsKey(e){const t=[];let r=0;const s=Object.keys(e.attributeData).sort();for(let n=0;n<s.length;n++){const a=e.attributeData[s[n]];t[r++]=a.location}const i=t.join("|");return e._attributeLocationsKey=R(i,"programAttributes"),e._attributeLocationsKey}getBufferNamesToBind(e,t){const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];const s=this._createVertexBufferLayouts(e,t),i=Object.create(null),n=t.attributeData;for(let a=0;a<s.length;a++){const c=Object.values(s[a].attributes)[0].shaderLocation;for(const f in n)if(n[f].location===c){i[a]=f;break}}return this._bindingNamesCache[r]=i,i}_createVertexBufferLayouts(e,t){t._attributeLocationsKey||this._generateAttributeLocationsKey(t);const r=e._layoutKey<<16|t._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];const s=[];return e.buffers.forEach(i=>{const n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(const u in t.attributeData){const c=e.attributes[u];(c.divisor??1)!==1&&v(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===i&&(n.arrayStride=c.stride,n.stepMode=c.instance?"instance":"vertex",a.push({shaderLocation:t.attributeData[u].location,offset:c.offset,format:c.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){const e=We(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment,this._colorTargetCount);this._pipeStateCaches[e]||(this._pipeStateCaches[e]=Object.create(null)),this._pipeCache=this._pipeStateCaches[e]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}Q.extension={type:[l.WebGPUSystem],name:"pipeline"};class He{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class Ne{init(e,t){this._renderer=e,this._renderTargetSystem=t}copyToTexture(e,t,r,s,i){const n=this._renderer,a=this._getGpuColorTexture(e),u=n.texture.getGpuSource(t.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:u,origin:i},s),t}startRenderPass(e,t=!0,r,s,i=0,n=0){var f,h;const u=this._renderTargetSystem.getGpuRenderTarget(e);if(n!==0&&((f=u.msaaTextures)!=null&&f.length))throw new Error("[RenderTargetSystem] Rendering to array layers is not supported with MSAA render targets.");if(i>0&&((h=u.msaaTextures)!=null&&h.length))throw new Error("[RenderTargetSystem] Rendering to mip levels is not supported with MSAA render targets.");const c=this.getDescriptor(e,t,r,i,n);u.descriptor=c,this._renderer.pipeline.setRenderTarget(u),this._renderer.encoder.beginRenderPass(u),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);return t.contexts[0]?t.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(e.colorTextures[0].source)}getDescriptor(e,t,r,s=0,i=0){var h;typeof t=="boolean"&&(t=t?y.ALL:y.NONE);const n=this._renderTargetSystem,a=n.getGpuRenderTarget(e),u=e.colorTextures.map((p,d)=>{const m=a.contexts[d];let g,x;if(m){if(i!==0)throw new Error("[RenderTargetSystem] Rendering to array layers is not supported for canvas targets.");g=m.getCurrentTexture().createView()}else g=this._renderer.texture.getGpuSource(p).createView({dimension:"2d",baseMipLevel:s,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1});let w=!1;a.msaaTextures[d]&&(x=g,g=this._renderer.texture.getTextureView(a.msaaTextures[d]),w=a.msaaTextures[d].transient);const pe=t&y.COLOR?"clear":"load";return r??(r=n.defaultClearColor),{view:g,resolveTarget:x,clearValue:r,storeOp:w?"discard":"store",loadOp:pe}});let c;if((e.stencil||e.depth)&&!e.depthStencilTexture&&(e.ensureDepthStencilTexture(),e.depthStencilTexture.source.sampleCount=a.msaa?4:1,e.depthStencilTexture.source.transient=!!((h=a.msaaTextures[0])!=null&&h.transient)),e.depthStencilTexture){const p=t&y.STENCIL?"clear":"load",d=t&y.DEPTH?"clear":"load",m=e.depthStencilTexture.source.transient?"discard":"store";c={view:this._renderer.texture.getGpuSource(e.depthStencilTexture.source).createView({dimension:"2d",baseMipLevel:s,mipLevelCount:1,baseArrayLayer:i,arrayLayerCount:1}),stencilStoreOp:m,stencilLoadOp:p,depthClearValue:1,depthLoadOp:d,depthStoreOp:m}}return{colorAttachments:u,depthStencilAttachment:c}}clear(e,t=!0,r,s,i=0,n=0){if(!t)return;const{gpu:a,encoder:u}=this._renderer,c=a.device;if(u.commandEncoder===null){const h=c.createCommandEncoder(),p=this.getDescriptor(e,t,r,i,n),d=h.beginRenderPass(p);d.setViewport(s.x,s.y,s.width,s.height,0,1),d.end();const m=h.finish();c.queue.submit([m])}else this.startRenderPass(e,t,r,s,i,n)}initGpuRenderTarget(e){var r;e.isRoot=!0;const t=new He;return t.colorTargetCount=e.colorTextures.length,e.colorTextures.forEach((s,i)=>{if(s instanceof me){const n=s.resource.getContext("webgpu"),a=s.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:a})}catch(u){console.error(u)}t.contexts[i]=n}if(t.msaa=s.source.antialias,s.source.antialias){const n=new _e({width:0,height:0,sampleCount:4,transient:s.source.transient,arrayLayerCount:s.source.arrayLayerCount});t.msaaTextures[i]=n}}),t.msaa&&(t.msaaSamples=4,e.depthStencilTexture&&(e.depthStencilTexture.source.sampleCount=4,e.depthStencilTexture.source.transient=!!((r=t.msaaTextures[0])!=null&&r.transient))),t}destroyGpuRenderTarget(e){e.contexts.forEach(t=>{t.unconfigure()}),e.msaaTextures.forEach(t=>{t.destroy()}),e.msaaTextures.length=0,e.contexts.length=0}ensureDepthStencilTexture(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);e.depthStencilTexture&&t.msaa&&(e.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(e){const t=this._renderTargetSystem.getGpuRenderTarget(e);t.width=e.width,t.height=e.height,t.msaa&&e.colorTextures.forEach((r,s)=>{const i=t.msaaTextures[s];i==null||i.resize(r.source.width,r.source.height,r.source._resolution)})}}class ee extends Re{constructor(e){super(e),this.adaptor=new Ne,this.adaptor.init(e,this)}}ee.extension={type:[l.WebGPUSystem],name:"renderTarget"};class te{constructor(){this._gpuProgramData=Object.create(null)}contextChange(e){this._gpu=e}getProgramData(e){return this._gpuProgramData[e._layoutKey]||this._createGPUProgramData(e)}_createGPUProgramData(e){const t=this._gpu.device,r=e.gpuLayout.map(i=>t.createBindGroupLayout({entries:i})),s={bindGroupLayouts:r};return this._gpuProgramData[e._layoutKey]={bindGroups:r,pipeline:t.createPipelineLayout(s)},this._gpuProgramData[e._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}te.extension={type:[l.WebGPUSystem],name:"shader"};const _={};_.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};_.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};_.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};_.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};_.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};_.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};_["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};_["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};_["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};_.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};_.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};_.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class re{constructor(){this.defaultState=new N,this.defaultState.blend=!0}contextChange(e){this.gpu=e}getColorTargets(e,t){const r=_[e.blendMode]||_.normal,s=[],i={format:"bgra8unorm",writeMask:0,blend:r};for(let n=0;n<t;n++)s[n]=i;return s}destroy(){this.gpu=null}}re.extension={type:[l.WebGPUSystem],name:"state"};const Ve={type:"image",upload(o,e,t,r=0){const s=o.resource,i=(o.pixelWidth|0)*(o.pixelHeight|0),n=s.byteLength/i;t.device.queue.writeTexture({texture:e,origin:{x:0,y:0,z:r}},s,{offset:0,rowsPerImage:o.pixelHeight,bytesPerRow:o.pixelWidth*n},{width:o.pixelWidth,height:o.pixelHeight,depthOrArrayLayers:1})}},se={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},je={blockBytes:4,blockWidth:1,blockHeight:1},Ke={type:"compressed",upload(o,e,t,r=0){let s=o.pixelWidth,i=o.pixelHeight;const n=se[o.format]||je;for(let a=0;a<o.resource.length;a++){const u=o.resource[a],c=Math.ceil(s/n.blockWidth)*n.blockBytes;t.device.queue.writeTexture({texture:e,mipLevel:a,origin:{x:0,y:0,z:r}},u,{offset:0,bytesPerRow:c},{width:Math.ceil(s/n.blockWidth)*n.blockWidth,height:Math.ceil(i/n.blockHeight)*n.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},L=["right","left","top","bottom","front","back"];function qe(o){return{type:"cube",upload(e,t,r){const s=e.faces;for(let i=0;i<L.length;i++){const n=L[i],a=s[n];(o[a.uploadMethodId]||o.image).upload(a,t,r,i)}}}}const ie={type:"image",upload(o,e,t,r=0){const s=o.resource;if(!s)return;if(globalThis.HTMLImageElement&&s instanceof HTMLImageElement){const u=T.get().createCanvas(s.width,s.height);u.getContext("2d").drawImage(s,0,0,s.width,s.height),o.resource=u,v("ImageSource: Image element passed, converting to canvas and replacing resource.")}const i=Math.min(e.width,o.resourceWidth||o.pixelWidth),n=Math.min(e.height,o.resourceHeight||o.pixelHeight),a=o.alphaMode==="premultiply-alpha-on-upload";t.device.queue.copyExternalImageToTexture({source:s},{texture:e,origin:{x:0,y:0,z:r},premultipliedAlpha:a},{width:i,height:n})}},Ye={type:"video",upload(o,e,t,r){ie.upload(o,e,t,r)}};class $e{constructor(e){this.device=e,this.sampler=e.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(e){let t=this.pipelines[e];return t||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` - var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>( - vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0)); - - struct VertexOutput { - @builtin(position) position : vec4<f32>, - @location(0) texCoord : vec2<f32>, - }; - - @vertex - fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { - var output : VertexOutput; - output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5); - output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0); - return output; - } - - @group(0) @binding(0) var imgSampler : sampler; - @group(0) @binding(1) var img : texture_2d<f32>; - - @fragment - fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> { - return textureSample(img, imgSampler, texCoord); - } - `})),t=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:e}]}}),this.pipelines[e]=t),t}generateMipmap(e){const t=this._getMipmapPipeline(e.format);if(e.dimension==="3d"||e.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=e;const s=e.depthOrArrayLayers||1,i=e.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!i){const u={size:{width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s},format:e.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:e.mipLevelCount-1};r=this.device.createTexture(u)}const n=this.device.createCommandEncoder({}),a=t.getBindGroupLayout(0);for(let u=0;u<s;++u){let c=e.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),f=i?1:0;for(let h=1;h<e.mipLevelCount;++h){const p=r.createView({baseMipLevel:f++,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),d=n.beginRenderPass({colorAttachments:[{view:p,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:c}]});d.setPipeline(t),d.setBindGroup(0,m),d.draw(3,1,0,0),d.end(),c=p}}if(!i){const u={width:Math.ceil(e.width/2),height:Math.ceil(e.height/2),depthOrArrayLayers:s};for(let c=1;c<e.mipLevelCount;++c)n.copyTextureToTexture({texture:r,mipLevel:c-1},{texture:e,mipLevel:c},u),u.width=Math.ceil(u.width/2),u.height=Math.ceil(u.height/2)}return this.device.queue.submit([n.finish()]),i||r.destroy(),e}}class Xe{constructor(e){this.textureView=null,this.gpuTexture=e}destroy(){this.gpuTexture.destroy(),this.textureView=null,this.gpuTexture=null}}const M=class ne{constructor(e){this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._renderer=e,e.gc.addCollection(this,"_bindGroupHash","hash"),this._managedTextures=new k({renderer:e,type:"resource",onUnload:this.onSourceUnload.bind(this),name:"gpuTextureSource"});const t={image:ie,buffer:Ve,video:Ye,compressed:Ke,...ne.uploadExtensions};this._uploads={...t,cube:qe(t)}}get managedTextures(){return Object.values(this._managedTextures.items)}contextChange(e){this._gpu=e}initSource(e){var t;return((t=e._gpuData[this._renderer.uid])==null?void 0:t.gpuTexture)||this._initSource(e)}_initSource(e){if(e.autoGenerateMipmaps){const c=Math.max(e.pixelWidth,e.pixelHeight);e.mipLevelCount=Math.floor(Math.log2(c))+1}let t;e.sampleCount>1?(t=GPUTextureUsage.RENDER_ATTACHMENT,e.transient&&this._renderer.device.extensions.transientAttachment&&(t|=GPUTextureUsage.TRANSIENT_ATTACHMENT)):(t=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST,e.uploadMethodId!=="compressed"&&(t|=GPUTextureUsage.RENDER_ATTACHMENT,t|=GPUTextureUsage.COPY_SRC));const r=se[e.format]||{blockWidth:1,blockHeight:1},s=Math.ceil(e.pixelWidth/r.blockWidth)*r.blockWidth,i=Math.ceil(e.pixelHeight/r.blockHeight)*r.blockHeight,n={label:e.label,size:{width:s,height:i,depthOrArrayLayers:e.arrayLayerCount},format:e.format,sampleCount:e.sampleCount,mipLevelCount:e.mipLevelCount,dimension:e.dimension,usage:t},a=this._gpu.device.createTexture(n);return e._gpuData[this._renderer.uid]=new Xe(a),this._managedTextures.add(e)&&(e.on("update",this.onSourceUpdate,this),e.on("resize",this.onSourceResize,this),e.on("updateMipmaps",this.onUpdateMipmaps,this)),this.onSourceUpdate(e),a}onSourceUpdate(e){const t=this.getGpuSource(e);t&&(this._uploads[e.uploadMethodId]&&this._uploads[e.uploadMethodId].upload(e,t,this._gpu),e.autoGenerateMipmaps&&e.mipLevelCount>1&&this.onUpdateMipmaps(e))}onUpdateMipmaps(e){this._mipmapGenerator||(this._mipmapGenerator=new $e(this._gpu.device));const t=this.getGpuSource(e);this._mipmapGenerator.generateMipmap(t)}onSourceUnload(e){e.off("update",this.onSourceUpdate,this),e.off("resize",this.onSourceResize,this),e.off("updateMipmaps",this.onUpdateMipmaps,this)}onSourceResize(e){e._gcLastUsed=this._renderer.gc.now;const t=e._gpuData[this._renderer.uid],r=t==null?void 0:t.gpuTexture;r?(r.width!==e.pixelWidth||r.height!==e.pixelHeight)&&(t.destroy(),this._bindGroupHash[e.uid]=null,e._gpuData[this._renderer.uid]=null,this.initSource(e)):this.initSource(e)}_initSampler(e){return this._gpuSamplers[e._resourceId]=this._gpu.device.createSampler(e),this._gpuSamplers[e._resourceId]}getGpuSampler(e){return this._gpuSamplers[e._resourceId]||this._initSampler(e)}getGpuSource(e){var t;return e._gcLastUsed=this._renderer.gc.now,((t=e._gpuData[this._renderer.uid])==null?void 0:t.gpuTexture)||this.initSource(e)}getTextureBindGroup(e){return this._bindGroupHash[e.uid]||this._createTextureBindGroup(e)}_createTextureBindGroup(e){const t=e.source;return this._bindGroupHash[e.uid]=new z({0:t,1:t.style,2:new F({uTextureMatrix:{type:"mat3x3<f32>",value:e.textureMatrix.mapCoord}})}),this._bindGroupHash[e.uid]}getTextureView(e){const t=e.source;t._gcLastUsed=this._renderer.gc.now;let r=t._gpuData[this._renderer.uid];return r||(this.initSource(t),r=t._gpuData[this._renderer.uid]),r.textureView||(r.textureView=r.gpuTexture.createView({dimension:t.viewDimension})),r.textureView}generateCanvas(e){const t=this._renderer,r=t.gpu.device.createCommandEncoder(),s=T.get().createCanvas();s.width=e.source.pixelWidth,s.height=e.source.pixelHeight;const i=s.getContext("webgpu");return i.configure({device:t.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:T.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:t.texture.getGpuSource(e.source),origin:{x:0,y:0}},{texture:i.getCurrentTexture()},{width:s.width,height:s.height}),t.gpu.device.queue.submit([r.finish()]),s}getPixels(e){const t=this.generateCanvas(e),r=E.getOptimalCanvasAndContext(t.width,t.height),s=r.context;s.drawImage(t,0,0);const{width:i,height:n}=t,a=s.getImageData(0,0,i,n),u=new Uint8ClampedArray(a.data.buffer);return E.returnCanvasAndContext(r),{pixels:u,width:i,height:n}}destroy(){this._managedTextures.destroy();for(const e of Object.keys(this._bindGroupHash)){const t=Number(e),r=this._bindGroupHash[t];r==null||r.destroy()}this._renderer=null,this._gpu=null,this._mipmapGenerator=null,this._gpuSamplers=null,this._bindGroupHash=null}};M.extension={type:[l.WebGPUSystem],name:"texture"};M.uploadExtensions=Object.create(null);let ae=M;G.handleByMap(l.TextureUploaderWebGPU,ae.uploadExtensions);class oe{constructor(){this._maxTextures=0}contextChange(e){const t=new F({uTransformMatrix:{value:new O,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}});this._maxTextures=e.limits.maxBatchableTextures;const r=I({name:"graphics",bits:[be,xe(this._maxTextures),Ue,W]});this.shader=new H({gpuProgram:r,resources:{localUniforms:t}})}execute(e,t){const r=t.context,s=r.customShader||this.shader,i=e.renderer,n=i.graphicsContext,{batcher:a,instructions:u}=n.getContextRenderData(r),c=i.encoder;c.setGeometry(a.geometry,s.gpuProgram);const f=i.globalUniforms.bindGroup;c.setBindGroup(0,f,s.gpuProgram);const h=i.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);c.setBindGroup(2,h,s.gpuProgram);const p=u.instructions;let d=null;for(let m=0;m<u.instructionSize;m++){const g=p[m];if(g.topology!==d&&(d=g.topology,c.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,e.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){const x=g.textures;g.bindGroup=D(x.textures,x.count,this._maxTextures),g.gpuBindGroup=i.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}c.setBindGroup(1,g.bindGroup,s.gpuProgram),c.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}oe.extension={type:[l.WebGPUPipesAdaptor],name:"graphics"};class ue{init(){const e=I({name:"mesh",bits:[Me,we,W]});this._shader=new H({gpuProgram:e,resources:{uTexture:A.EMPTY._source,uSampler:A.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new O}}}})}execute(e,t){const r=e.renderer;let s=t._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(t.texture);else if(!s.gpuProgram){v("Mesh shader has no gpuProgram",t.shader);return}const i=s.gpuProgram;if(i.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),i.autoAssignLocalUniforms){const n=e.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:t._geometry,shader:s,state:t.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ue.extension={type:[l.WebGPUPipesAdaptor],name:"mesh"};const Ze=[...Ee,Z,Y,U,$,K,ae,ee,te,re,Q,q,X,j],Je=[...Ae,J],Qe=[V,ue,oe],ce=[],de=[],he=[];G.handleByNamedList(l.WebGPUSystem,ce);G.handleByNamedList(l.WebGPUPipes,de);G.handleByNamedList(l.WebGPUPipesAdaptor,he);G.add(...Ze,...Je,...Qe);class at extends ye{constructor(){const e={name:"webgpu",type:Ge.WEBGPU,systems:ce,renderPipes:de,renderPipeAdaptors:he};super(e)}}export{at as WebGPURenderer}; diff --git a/2026/games_submissions/sunshoes/assets/animations/explosion.json b/2026/games_submissions/sunshoes/assets/animations/explosion.json deleted file mode 100644 index 55a2776..0000000 --- a/2026/games_submissions/sunshoes/assets/animations/explosion.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "frames": { - "explosion-0": { - "frame": { "x": 0, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 } - }, - "explosion-1": { - "frame": { "x": 32, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 } - }, - "explosion-2": { - "frame": { "x": 64, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 } - }, - "explosion-3": { - "frame": { "x": 96, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 } - }, - "explosion-4": { - "frame": { "x": 128, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 } - }, - "explosion-5": { - "frame": { "x": 160, "y": 0, "w": 32, "h": 32 }, - "sourceSize": { "w": 32, "h": 32 }, - "spriteSourceSize": { "x": 0, "y": 0, "w": 32, "h": 32 } - } - }, - "meta": { - "image": "/explosion.png", - "format": "RGBA8888", - "size": { "w": 192, "h": 32 }, - "scale": 1 - }, - "animations": { - "explosion": ["explosion-0", "explosion-1", "explosion-2", "explosion-3", "explosion-4", "explosion-5"] - } -} diff --git a/2026/games_submissions/sunshoes/assets/animations/explosion.png b/2026/games_submissions/sunshoes/assets/animations/explosion.png Binary files differdeleted file mode 100644 index 1244e21..0000000 --- a/2026/games_submissions/sunshoes/assets/animations/explosion.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/browserAll-1STCoqOQ.js b/2026/games_submissions/sunshoes/assets/browserAll-1STCoqOQ.js deleted file mode 100644 index 26fbd19..0000000 --- a/2026/games_submissions/sunshoes/assets/browserAll-1STCoqOQ.js +++ /dev/null @@ -1,14 +0,0 @@ -import{a0 as A,a1 as Z,a2 as g,a3 as te,z as b,E as ie,w as y,F as w,a4 as V}from"./index-DvAPfvr6.js";import"./webworkerAll-3Ebn88U3.js";import"./Filter-BiIvpnZm.js";class q{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),i=this._canvas.width,s=this._canvas.height,n=t.width/i*this._renderer.resolution,o=t.height/s*this._renderer.resolution,r=t.left,h=t.top,d=`translate(${r}px, ${h}px) scale(${n}, ${o})`;d!==this._lastTransform&&(this._domElement.style.transform=d,this._lastTransform=d)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const i=this.canvas.width,s=this.canvas.height,n=t.contentRect.width/i*this._renderer.resolution,o=t.contentRect.height/s*this._renderer.resolution;(this._lastScaleX!==n||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=n,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||A.shared.add(this.updateTranslation,this,Z.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&A.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class O{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=O.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new g,this.page=new g,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}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(e,t,i){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,i,s,n){throw new 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}}var I=/iPhone/i,B=/iPod/i,C=/iPad/i,U=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,R=/Android/i,E=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,M=/Silk/i,m=/Windows Phone/i,X=/\bWindows(?:.+)ARM\b/i,K=/BlackBerry/i,Y=/BB10/i,H=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,N=/Mobile(?:.+)Firefox\b/i,$=function(a){return typeof a<"u"&&a.platform==="MacIntel"&&typeof a.maxTouchPoints=="number"&&a.maxTouchPoints>1&&typeof MSStream>"u"};function se(a){return function(e){return e.test(a)}}function G(a){var e={userAgent:"",platform:"",maxTouchPoints:0};!a&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof a=="string"?e.userAgent=a:a&&a.userAgent&&(e={userAgent:a.userAgent,platform:a.platform,maxTouchPoints:a.maxTouchPoints||0});var t=e.userAgent,i=t.split("[FBAN");typeof i[1]<"u"&&(t=i[0]),i=t.split("Twitter"),typeof i[1]<"u"&&(t=i[0]);var s=se(t),n={apple:{phone:s(I)&&!s(m),ipod:s(B),tablet:!s(I)&&(s(C)||$(e))&&!s(m),universal:s(U),device:(s(I)||s(B)||s(C)||s(U)||$(e))&&!s(m)},amazon:{phone:s(E),tablet:!s(E)&&s(M),device:s(E)||s(M)},android:{phone:!s(m)&&s(E)||!s(m)&&s(k),tablet:!s(m)&&!s(E)&&!s(k)&&(s(M)||s(R)),device:!s(m)&&(s(E)||s(M)||s(k)||s(R))||s(/\bokhttp\b/i)},windows:{phone:s(m),tablet:s(X),device:s(m)||s(X)},other:{blackberry:s(K),blackberry10:s(Y),opera:s(H),firefox:s(N),chrome:s(F),device:s(K)||s(Y)||s(H)||s(N)||s(F)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const ne=G.default??G,oe=ne(globalThis.navigator),re=9,W=100,ae=0,le=0,j=2,z=1,he=-1e3,ce=-1e3,de=2,L=class J{constructor(e,t=oe){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${z}px`,e.style.height=`${z}px`,e.style.position="absolute",e.style.top=`${he}px`,e.style.left=`${ce}px`,e.style.zIndex=de.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${ae}px`,this._div.style.left=`${le}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=j.toString(),this._canvasObserver=new q({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){var e,t;if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const i of this._children)(e=i._accessibleDiv)!=null&&e.parentNode&&(i._accessibleDiv.parentNode.removeChild(i._accessibleDiv),i._accessibleDiv=null),i._accessibleActive=!1;for(const i in this._pools)this._pools[i].forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),delete this._pools[i];(t=this._div)!=null&&t.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let i=0;i<t.length;i++)this._updateAccessibleObjects(t[i])}init(e){const i={accessibilityOptions:{...J.defaultOptions,...(e==null?void 0:e.accessibilityOptions)||{}}};this.debug=i.accessibilityOptions.debug,this._activateOnTab=i.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=i.accessibilityOptions.deactivateOnMouseMove,i.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const i of this._children)i._renderId===this._renderId&&t.add(this._children.indexOf(i))}for(let i=this._children.length-1;i>=0;i--){const s=this._children[i];t.has(i)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._getPool(s.accessibleType).push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,te(this._children,i,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let i=0;i<this._children.length;i++){const s=this._children[i];if(!s._accessibleActive||!s._accessibleDiv)continue;const n=s._accessibleDiv,o=s.hitArea||s.getBounds().rectangle;if(s.hitArea){const r=s.worldTransform;n.style.left=`${r.tx+o.x*r.a}px`,n.style.top=`${r.ty+o.y*r.d}px`,n.style.width=`${o.width*r.a}px`,n.style.height=`${o.height*r.d}px`}else this._capHitArea(o),n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.style.width=`${o.width}px`,n.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:i}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>i&&(e.height=i-e.y)}_addChild(e){let i=this._getPool(e.accessibleType).pop();i?(i.innerHTML="",i.removeAttribute("title"),i.removeAttribute("aria-label"),i.tabIndex=0):(e.accessibleType==="button"?i=document.createElement("button"):(i=document.createElement(e.accessibleType),i.style.cssText=` - color: transparent; - pointer-events: none; - padding: 0; - margin: 0; - border: 0; - outline: 0; - background: transparent; - box-sizing: border-box; - user-select: none; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - `,e.accessibleText&&(i.innerText=e.accessibleText)),i.style.width=`${W}px`,i.style.height=`${W}px`,i.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",i.style.position="absolute",i.style.zIndex=j.toString(),i.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?i.setAttribute("aria-live","off"):i.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?i.setAttribute("aria-relevant","additions"):i.setAttribute("aria-relevant","text"),i.addEventListener("click",this._onClick.bind(this)),i.addEventListener("focus",this._onFocus.bind(this)),i.addEventListener("focusout",this._onFocusOut.bind(this))),i.style.pointerEvents=e.accessiblePointerEvents,i.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?i.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(i.title=`container ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&i.setAttribute("aria-label",e.accessibleHint),e.interactive?i.tabIndex=e.tabIndex:i.tabIndex=0,this.debug&&this._updateDebugHTML(i),e._accessibleActive=!0,e._accessibleDiv=i,i.container=e,this._children.push(e),this._div.appendChild(e._accessibleDiv)}_dispatchEvent(e,t){const{container:i}=e.target,s=this._renderer.events.rootBoundary,n=Object.assign(new O(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,t.forEach(o=>s.dispatchEvent(n,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode!==re||!this._activateOnTab||this._activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this._deactivate()}destroy(){var e;this._deactivate(),this._destroyTouchHook(),(e=this._canvasObserver)==null||e.destroy(),this._canvasObserver=null,this._div=null,this._pools=null,this._children=null,this._renderer=null,this._hookDiv=null,globalThis.removeEventListener("keydown",this._boundOnKeyDown),this._boundOnKeyDown=null,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._boundOnMouseMove=null}setAccessibilityEnabled(e){e?this._activate():this._deactivate()}_getPool(e){return this._pools[e]||(this._pools[e]=[]),this._pools[e]}};L.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"accessibility"};L.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};let ue=L;const pe={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_accessibleActive:!1,_accessibleDiv:null,_renderId:-1};class Q{constructor(e){this._attachedDomElements=[],this._renderer=e,this._renderer.runners.postrender.add(this),this._renderer.runners.init.add(this),this._domElement=document.createElement("div"),this._domElement.style.position="absolute",this._domElement.style.top="0",this._domElement.style.left="0",this._domElement.style.pointerEvents="none",this._domElement.style.zIndex="1000"}init(){this._canvasObserver=new q({domElement:this._domElement,renderer:this._renderer})}addRenderable(e,t){this._attachedDomElements.includes(e)||this._attachedDomElements.push(e)}updateRenderable(e){}validateRenderable(e){return!0}postrender(){const e=this._attachedDomElements;if(e.length===0){this._domElement.remove();return}this._canvasObserver.ensureAttached();for(let t=0;t<e.length;t++){const i=e[t],s=i.element;if(!i.parent||i.globalDisplayStatus<7)s==null||s.remove(),e.splice(t,1),t--;else{this._domElement.contains(s)||(s.style.position="absolute",s.style.pointerEvents="auto",this._domElement.appendChild(s));const n=i.worldTransform,o=i._anchor,r=i.width*o.x,h=i.height*o.y;s.style.transformOrigin=`${r}px ${h}px`,s.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-r}, ${n.ty-h})`,s.style.opacity=i.groupAlpha.toString()}}}destroy(){var e;this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++)(e=this._attachedDomElements[t].element)==null||e.remove();this._attachedDomElements.length=0,this._domElement.remove(),this._canvasObserver.destroy(),this._renderer=null}}Q.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"dom"};class ve{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this._tickerAdded||!this.domElement||(A.system.add(this._tickerUpdate,this,Z.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(A.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}const e=this.events._rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(this.events.supportsPointerEvents?new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType,pointerId:e.pointerId}):new MouseEvent("mousemove",{clientX:e.clientX,clientY:e.clientY}))}_tickerUpdate(e){this._deltaTime+=e.deltaTime,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}destroy(){this.removeTickerListener(),this.events=null,this.domElement=null,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}}const _=new ve;class D extends O{constructor(){super(...arguments),this.client=new g,this.movement=new g,this.offset=new g,this.global=new g,this.screen=new g}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(e,t,i){return e.worldTransform.applyInverse(i||this.global,t)}getModifierState(e){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,i,s,n,o,r,h,d,p,u,l,v,c,Ee){throw new Error("Method not implemented.")}}class f extends D{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}class T extends D{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}}T.DOM_DELTA_PIXEL=0;T.DOM_DELTA_LINE=1;T.DOM_DELTA_PAGE=2;const fe=2048,me=new g,P=new g;class _e{constructor(e){this.dispatch=new ie,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,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(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((i,s)=>i.priority-s.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let i=0,s=t.length;i<s;i++)t[i].fn(e);else y(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){_.pauseUpdate=!0;const s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",n=this[s](this.rootTarget,this.rootTarget.eventMode,me.set(e,t),this.hitTestFn,this.hitPruneFn);return n&&n[0]}propagate(e,t){if(!e.target)return;const i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let s=0,n=i.length-1;s<n;s++)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let s=i.length-2;s>=0;s--)if(e.currentTarget=i[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,i=this._allInteractiveElements){if(i.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const s=Array.isArray(t)?t:[t];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{e.currentTarget=i[n],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let i=0;i<fe&&e!==this.rootTarget&&e.parent;i++){if(!e.parent)throw new Error("Cannot find propagation path to disconnected target");t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,i,s,n,o=!1){let r=!1;if(this._interactivePrune(e))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(_.pauseUpdate=!1),e.interactiveChildren&&e.children){const p=e.children;for(let u=p.length-1;u>=0;u--){const l=p[u],v=this.hitTestMoveRecursive(l,this._isInteractive(t)?t:l.eventMode,i,s,n,o||n(e,i));if(v){if(v.length>0&&!v[v.length-1].parent)continue;const c=e.isInteractive();(v.length>0||c)&&(c&&this._allInteractiveElements.push(e),v.push(e)),this._hitElements.length===0&&(this._hitElements=v),r=!0}}}const h=this._isInteractive(t),d=e.isInteractive();return d&&d&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:r?this._hitElements:h&&!n(e,i)&&s(e,i)?d?[e]:[]:null}hitTestRecursive(e,t,i,s,n){if(this._interactivePrune(e)||n(e,i))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(_.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children,d=i;for(let p=h.length-1;p>=0;p--){const u=h[p],l=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,d,s,n);if(l){if(l.length>0&&!l[l.length-1].parent)continue;const v=e.isInteractive();return(l.length>0||v)&&l.push(e),l}}}const o=this._isInteractive(t),r=e.isInteractive();return o&&s(e,i)?r?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!e||!e.visible||!e.renderable||!e.measurable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,P),!e.hitArea.contains(P.x,P.y)))return!0;if(e.effects&&e.effects.length)for(let i=0;i<e.effects.length;i++){const s=e.effects[i];if(s.containsPoint&&!s.containsPoint(t,this.hitTestFn))return!0}return!1}hitTestFn(e,t){return e.hitArea?!0:e!=null&&e.containsPoint?(e.worldTransform.applyInverse(t,P),e.containsPoint(P)):!1}notifyTarget(e,t){var n,o;if(!e.currentTarget.isInteractive())return;t??(t=e.type);const i=`on${t}`;(o=(n=e.currentTarget)[i])==null||o.call(n,e);const s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this._notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this._notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const s=t.button===2;this.dispatchEvent(t,s?"rightdown":"mousedown")}const i=this.trackingData(e.pointerId);i.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,d;if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.overTargets);if(((h=s.overTargets)==null?void 0:h.length)>0&&n!==t.target){const p=e.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(e,p,n);if(this.dispatchEvent(u,"pointerout"),i&&this.dispatchEvent(u,"mouseout"),!t.composedPath().includes(n)){const l=this.createPointerEvent(e,"pointerleave",n);for(l.eventPhase=l.AT_TARGET;l.target&&!t.composedPath().includes(l.target);)l.currentTarget=l.target,this.notifyTarget(l),i&&this.notifyTarget(l,"mouseleave"),l.target=l.target.parent;this.freeEvent(l)}this.freeEvent(u)}if(n!==t.target){const p=e.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(t,p);this.dispatchEvent(u,"pointerover"),i&&this.dispatchEvent(u,"mouseover");let l=n==null?void 0:n.parent;for(;l&&l!==this.rootTarget.parent&&l!==t.target;)l=l.parent;if(!l||l===this.rootTarget.parent){const c=this.clonePointerEvent(t,"pointerenter");for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==n&&c.target!==this.rootTarget.parent;)c.currentTarget=c.target,this.notifyTarget(c),i&&this.notifyTarget(c,"mouseenter"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(u)}const o=[],r=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),r&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),r&&o.push("globaltouchmove")),i&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),r&&o.push("globalmousemove"),this.cursor=(d=t.target)==null?void 0:d.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.createPointerEvent(e),s=i.pointerType==="mouse"||i.pointerType==="pen";this.dispatchEvent(i,"pointerover"),s&&this.dispatchEvent(i,"mouseover"),i.pointerType==="mouse"&&(this.cursor=(o=i.target)==null?void 0:o.cursor);const n=this.clonePointerEvent(i,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=i.composedPath(),this.freeEvent(i),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const i=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(e,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),i=this.createPointerEvent(e);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const r=i.button===2;this.dispatchEvent(i,r?"rightup":"mouseup")}const s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[e.button]);let o=n;if(n&&!i.composedPath().includes(n)){let r=n;for(;r&&!i.composedPath().includes(r);){if(i.currentTarget=r,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const h=i.button===2;this.notifyTarget(i,h?"rightupoutside":"mouseupoutside")}r=r.parent}delete s.pressTargetsByButton[e.button],o=r}if(o){const r=this.clonePointerEvent(i,"click");r.target=o,r.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:r.target,timeStamp:t});const h=s.clicksByButton[e.button];if(h.target===r.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=r.target,h.timeStamp=t,r.detail=h.clickCount,r.pointerType==="mouse"){const d=r.button===2;this.dispatchEvent(r,d?"rightclick":"click")}else r.pointerType==="touch"&&this.dispatchEvent(r,"tap");this.dispatchEvent(r,"pointertap"),this.freeEvent(r)}this.freeEvent(i)}mapPointerUpOutside(e){if(!(e instanceof f)){y("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),i=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof T)){y("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let i=1;i<e.length&&e[i].parent===t;i++)t=e[i];return t}createPointerEvent(e,t,i){const s=this.allocateEvent(f);return this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e,s.target=i??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof t=="string"&&(s.type=t),s}createWheelEvent(e){const t=this.allocateEvent(T);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){const i=this.allocateEvent(f);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=t??i.type,i}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof f&&t instanceof f&&(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)}copyMouseData(e,t){e instanceof D&&t instanceof D&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);const t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.defaultPrevented=!1,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");const t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}_notifyListeners(e,t){const i=e.currentTarget._events[t];if(i)if("fn"in i)i.once&&e.currentTarget.removeListener(t,i.fn,void 0,!0),i.fn.call(i.context,e);else for(let s=0,n=i.length;s<n&&!e.propagationImmediatelyStopped;s++)i[s].once&&e.currentTarget.removeListener(t,i[s].fn,void 0,!0),i[s].fn.call(i[s].context,e)}}const ge=1,ye={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},S=class x{constructor(e){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=e,this.rootBoundary=new _e(null),_.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new f(null),this._rootWheelEvent=new T(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...x.defaultEventFeatures},{set:(t,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),t[i]=s,!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){const{canvas:t,resolution:i}=this.renderer;this.setTargetElement(t),this.resolution=i,x._defaultEventMode=e.eventMode??"passive",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){_.destroy(),this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(e){e||(e="default");let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this._currentCursor===e)return;this._currentCursor=e;const i=this.cursorStyles[e];if(i)switch(typeof i){case"string":t&&(this.domElement.style.cursor=i);break;case"function":i(e);break;case"object":t&&Object.assign(this.domElement.style,i);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this._rootPointerEvent}_onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let i=0,s=t.length;i<s;i++){const n=t[i],o=this._bootstrapEvent(this._rootPointerEvent,n);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,_.pointerMoved();const t=this._normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this._bootstrapEvent(this._rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);const i=t!==this.domElement?"outside":"",s=this._normalizeToPointerData(e);for(let n=0,o=s.length;n<o;n++){const r=this._bootstrapEvent(this._rootPointerEvent,s[n]);r.type+=i,this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this._normalizeToPointerData(e);for(let i=0,s=t.length;i<s;i++){const n=this._bootstrapEvent(this._rootPointerEvent,t[i]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;const t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this._removeEvents(),this.domElement=e,_.domElement=e,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;_.addTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="none",e.msTouchAction="none"):this.supportsPointerEvents&&(e.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;_.removeTickerListener();const e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming="",e.msTouchAction=""):this.supportsPointerEvents&&(e.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(e,t,i){const s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{width:this.domElement.width,height:this.domElement.height,left:0,top:0},n=1/this.resolution;e.x=(t-s.left)*(this.domElement.width/s.width)*n,e.y=(i-s.top)*(this.domElement.height/s.height)*n}_normalizeToPointerData(e){const t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let i=0,s=e.changedTouches.length;i<s;i++){const n=e.changedTouches[i];typeof n.button>"u"&&(n.button=0),typeof n.buttons>"u"&&(n.buttons=1),typeof n.isPrimary>"u"&&(n.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof n.width>"u"&&(n.width=n.radiusX||1),typeof n.height>"u"&&(n.height=n.radiusY||1),typeof n.tiltX>"u"&&(n.tiltX=0),typeof n.tiltY>"u"&&(n.tiltY=0),typeof n.pointerType>"u"&&(n.pointerType="touch"),typeof n.pointerId>"u"&&(n.pointerId=n.identifier||0),typeof n.pressure>"u"&&(n.pressure=n.force||.5),typeof n.twist>"u"&&(n.twist=0),typeof n.tangentialPressure>"u"&&(n.tangentialPressure=0),typeof n.layerX>"u"&&(n.layerX=n.offsetX=n.clientX),typeof n.layerY>"u"&&(n.layerY=n.offsetY=n.clientY),n.isNormalized=!0,n.type=e.type,n.altKey??(n.altKey=e.altKey),n.ctrlKey??(n.ctrlKey=e.ctrlKey),n.metaKey??(n.metaKey=e.metaKey),n.shiftKey??(n.shiftKey=e.shiftKey),t.push(n)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const i=e;typeof i.isPrimary>"u"&&(i.isPrimary=!0),typeof i.width>"u"&&(i.width=1),typeof i.height>"u"&&(i.height=1),typeof i.tiltX>"u"&&(i.tiltX=0),typeof i.tiltY>"u"&&(i.tiltY=0),typeof i.pointerType>"u"&&(i.pointerType="mouse"),typeof i.pointerId>"u"&&(i.pointerId=ge),typeof i.pressure>"u"&&(i.pressure=.5),typeof i.twist>"u"&&(i.twist=0),typeof i.tangentialPressure>"u"&&(i.tangentialPressure=0),i.isNormalized=!0,t.push(i)}else t.push(e);return t}normalizeWheelEvent(e){const t=this._rootWheelEvent;return this._transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}_bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,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.tiltY=t.tiltY,e.twist=t.twist,this._transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=ye[e.type]||e.type),e}_transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};S.extension={name:"events",type:[b.WebGLSystem,b.CanvasSystem,b.WebGPUSystem],priority:-1};S.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let ee=S;const be={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,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(a){this.eventMode=a?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??ee.defaultEventMode},set eventMode(a){this._internalEventMode=a},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(a,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof t=="object"?t.signal:void 0,n=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;a=i?`${a}capture`:a;const r=typeof e=="function"?e:e.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(a,r,o)}),n?h.once(a,r,o):h.on(a,r,o)},removeEventListener(a,e,t){const i=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;a=i?`${a}capture`:a,e=typeof e=="function"?e:e.handleEvent,this.off(a,e,s)},dispatchEvent(a){if(!(a instanceof O))throw new Error("Container cannot propagate events outside of the Federated Events API");return a.defaultPrevented=!1,a.path=null,a.target=this,a.manager.dispatchEvent(a),!a.defaultPrevented}};w.add(ue);w.mixin(V,pe);w.add(Q);w.add(ee);w.mixin(V,be); diff --git a/2026/games_submissions/sunshoes/assets/bunny.png b/2026/games_submissions/sunshoes/assets/bunny.png Binary files differdeleted file mode 100644 index 79c3167..0000000 --- a/2026/games_submissions/sunshoes/assets/bunny.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/index-DvAPfvr6.js b/2026/games_submissions/sunshoes/assets/index-DvAPfvr6.js deleted file mode 100644 index 4694962..0000000 --- a/2026/games_submissions/sunshoes/assets/index-DvAPfvr6.js +++ /dev/null @@ -1,300 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["games/sunshoes/assets/browserAll-1STCoqOQ.js","games/sunshoes/assets/webworkerAll-3Ebn88U3.js","games/sunshoes/assets/Filter-BiIvpnZm.js","games/sunshoes/assets/WebGPURenderer-Ddwua8JA.js","games/sunshoes/assets/BufferResource-BZpoqTVb.js","games/sunshoes/assets/RenderTargetSystem-Cp6tD-lP.js","games/sunshoes/assets/WebGLRenderer-CdpFaPwH.js","games/sunshoes/assets/CanvasRenderer-Yf_04ykh.js"])))=>i.map(i=>d[i]); -var ra=Object.defineProperty;var na=(s,t,e)=>t in s?ra(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var G=(s,t,e)=>na(s,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const n of r)if(n.type==="childList")for(const o of n.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function e(r){const n={};return r.integrity&&(n.integrity=r.integrity),r.referrerPolicy&&(n.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?n.credentials="include":r.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function i(r){if(r.ep)return;r.ep=!0;const n=e(r);fetch(r.href,n)}})();const oa="modulepreload",aa=function(s){return"/"+s},ji={},pe=function(t,e,i){let r=Promise.resolve();if(e&&e.length>0){let o=function(l){return Promise.all(l.map(c=>Promise.resolve(c).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),h=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));r=o(e.map(l=>{if(l=aa(l),l in ji)return;ji[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":oa,c||(f.as="script"),f.crossOrigin="",f.href=l,h&&f.setAttribute("nonce",h),document.head.appendChild(f),c)return new Promise((d,p)=>{f.addEventListener("load",d),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function n(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&n(a.reason);return t().catch(n)})};var I=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.TextureUploaderWebGL="texture-uploader-webgl",s.TextureUploaderWebGPU="texture-uploader-webgpu",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(I||{});const ni=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Je=(s,t)=>ni(s).priority??t,K={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(ni).forEach(t=>{t.type.forEach(e=>{var i,r;return(r=(i=this._removeHandlers)[e])==null?void 0:r.call(i,t)})}),this},add(...s){return s.map(ni).forEach(t=>{t.type.forEach(e=>{var n,o;const i=this._addHandlers,r=this._queue;i[e]?(o=i[e])==null||o.call(i,t):(r[e]=r[e]||[],(n=r[e])==null||n.push(t))})}),this},handle(s,t,e){var o;const i=this._addHandlers,r=this._removeHandlers;if(i[s]||r[s])throw new Error(`Extension type ${s} already has a handler`);i[s]=t,r[s]=e;const n=this._queue;return n[s]&&((o=n[s])==null||o.forEach(a=>t(a)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,i=>{t.findIndex(n=>n.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((n,o)=>Je(o.value,e)-Je(n.value,e)))},i=>{const r=t.findIndex(n=>n.name===i.name);r!==-1&&t.splice(r,1)})},handleByList(s,t,e=-1){return this.handle(s,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((r,n)=>Je(n,e)-Je(r,e)))},i=>{const r=t.indexOf(i.ref);r!==-1&&t.splice(r,1)})},mixin(s,...t){for(const e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}},ha={extension:{type:I.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await pe(()=>import("./browserAll-1STCoqOQ.js"),__vite__mapDeps([0,1,2]))}},la={extension:{type:I.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await pe(()=>import("./webworkerAll-3Ebn88U3.js"),__vite__mapDeps([1,2]))}};class ot{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new ot(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function ca(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Ls={exports:{}},Yi;function ua(){return Yi||(Yi=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function r(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function n(h,l,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new r(c,u||h,f),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],d]:h._events[p].push(d):(h._events[p]=d,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new i:delete h._events[l]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)t.call(c,u)&&l.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,p=new Array(d);f<d;f++)p[f]=u[f].fn;return p},a.prototype.listenerCount=function(l){var c=e?e+l:l,u=this._events[c];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,c,u,f,d,p){var g=e?e+l:l;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,y,x;if(m.fn){switch(m.once&&this.removeListener(l,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,u),!0;case 4:return m.fn.call(m.context,c,u,f),!0;case 5:return m.fn.call(m.context,c,u,f,d),!0;case 6:return m.fn.call(m.context,c,u,f,d,p),!0}for(x=1,y=new Array(_-1);x<_;x++)y[x-1]=arguments[x];m.fn.apply(m.context,y)}else{var w=m.length,v;for(x=0;x<w;x++)switch(m[x].once&&this.removeListener(l,m[x].fn,void 0,!0),_){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,c);break;case 3:m[x].fn.call(m[x].context,c,u);break;case 4:m[x].fn.call(m[x].context,c,u,f);break;default:if(!y)for(v=1,y=new Array(_-1);v<_;v++)y[v-1]=arguments[v];m[x].fn.apply(m[x].context,y)}}return!0},a.prototype.on=function(l,c,u){return n(this,l,c,u,!1)},a.prototype.once=function(l,c,u){return n(this,l,c,u,!0)},a.prototype.removeListener=function(l,c,u,f){var d=e?e+l:l;if(!this._events[d])return this;if(!c)return o(this,d),this;var p=this._events[d];if(p.fn)p.fn===c&&(!f||p.once)&&(!u||p.context===u)&&o(this,d);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==c||f&&!p[g].once||u&&p[g].context!==u)&&m.push(p[g]);m.length?this._events[d]=m.length===1?m[0]:m:o(this,d)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new i,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,s.exports=a})(Ls)),Ls.exports}var da=ua();const ft=ca(da),fa=Math.PI*2,pa=180/Math.PI,ma=Math.PI/180;class lt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new lt(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Bs.x=0,Bs.y=0,Bs}}const Bs=new lt;class W{constructor(t=1,e=0,i=0,r=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,r,n,o){return this.a=t,this.b=e,this.c=i,this.d=r,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new lt;const i=t.x,r=t.y;return e.x=this.a*i+this.c*r+this.tx,e.y=this.b*i+this.d*r+this.ty,e}applyInverse(t,e){e=e||new lt;const i=this.a,r=this.b,n=this.c,o=this.d,a=this.tx,h=this.ty,l=1/(i*o+n*-r),c=t.x,u=t.y;return e.x=o*l*c+-n*l*u+(h*n-a*o)*l,e.y=i*l*u+-r*l*c+(-h*i+a*r)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),r=this.a,n=this.c,o=this.tx;return this.a=r*e-this.b*i,this.b=r*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){const i=t.a,r=t.b,n=t.c,o=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,f=e.d;return this.a=i*l+r*u,this.b=i*c+r*f,this.c=n*l+o*u,this.d=n*c+o*f,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*f+e.ty,this}setTransform(t,e,i,r,n,o,a,h,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=t-(i*this.a+r*this.c),this.ty=e-(i*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,r=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,r=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-r,n),h=Math.atan2(i,e),l=Math.abs(a+h);return l<1e-5||Math.abs(fa-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(o.x*e+o.y*r),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,r=this.d,n=this.tx,o=t*r-e*i;return this.a=r/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-r*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new W;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return _a.identity()}static get shared(){return ga.identity()}}const ga=new W,_a=new W,qt=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Kt=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Qt=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Zt=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],oi=[],mn=[],ts=Math.sign;function ya(){for(let s=0;s<16;s++){const t=[];oi.push(t);for(let e=0;e<16;e++){const i=ts(qt[s]*qt[e]+Qt[s]*Kt[e]),r=ts(Kt[s]*qt[e]+Zt[s]*Kt[e]),n=ts(qt[s]*Qt[e]+Qt[s]*Zt[e]),o=ts(Kt[s]*Qt[e]+Zt[s]*Zt[e]);for(let a=0;a<16;a++)if(qt[a]===i&&Kt[a]===r&&Qt[a]===n&&Zt[a]===o){t.push(a);break}}}for(let s=0;s<16;s++){const t=new W;t.set(qt[s],Kt[s],Qt[s],Zt[s],0,0),mn.push(t)}}ya();const O={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:s=>qt[s],uY:s=>Kt[s],vX:s=>Qt[s],vY:s=>Zt[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>oi[s][t],sub:(s,t)=>oi[s][O.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?O.S:O.N:Math.abs(t)*2<=Math.abs(s)?s>0?O.E:O.W:t>0?s>0?O.SE:O.SW:s>0?O.NE:O.NW,matrixAppendRotationInv:(s,t,e=0,i=0,r=0,n=0)=>{const o=mn[O.inv(t)],a=o.a,h=o.b,l=o.c,c=o.d,u=e-Math.min(0,a*r,l*n,a*r+l*n),f=i-Math.min(0,h*r,c*n,h*r+c*n),d=s.a,p=s.b,g=s.c,m=s.d;s.a=a*d+h*g,s.b=a*p+h*m,s.c=l*d+c*g,s.d=l*p+c*m,s.tx=u*d+f*g+s.tx,s.ty=u*p+f*m+s.ty},transformRectCoords:(s,t,e,i)=>{const{x:r,y:n,width:o,height:a}=s,{x:h,y:l,width:c,height:u}=t;return e===O.E?(i.set(r+h,n+l,o,a),i):e===O.S?i.set(c-n-a+h,r+l,a,o):e===O.W?i.set(c-r-o+h,u-n-a+l,o,a):e===O.N?i.set(n+h,u-r-o+l,a,o):i.set(r+h,n+l,o,a)}},es=[new lt,new lt,new lt,new lt];class tt{constructor(t=0,e=0,i=0,r=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new tt(0,0,0,0)}clone(){return new tt(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,i,r=.5){const{width:n,height:o}=this;if(n<=0||o<=0)return!1;const a=this.x,h=this.y,l=i*(1-r),c=i-l,u=a-l,f=a+n+l,d=h-l,p=h+o+l,g=a+c,m=a+n-c,_=h+c,y=h+o-c;return t>=u&&t<=f&&e>=d&&e<=p&&!(t>g&&t<m&&e>_&&e<y)}intersects(t,e){if(!e){const k=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=k)return!1;const S=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>S}const i=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=i||o<=n)return!1;const a=es[0].set(t.left,t.top),h=es[1].set(t.left,t.bottom),l=es[2].set(t.right,t.top),c=es[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=i||Math.min(a.x,h.x,l.x,c.x)>=r||Math.max(a.y,h.y,l.y,c.y)<=n||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const f=u*(h.y-a.y),d=u*(a.x-h.x),p=f*i+d*n,g=f*r+d*n,m=f*i+d*o,_=f*r+d*o;if(Math.max(p,g,m,_)<=f*a.x+d*a.y||Math.min(p,g,m,_)>=f*c.x+d*c.y)return!1;const y=u*(a.y-l.y),x=u*(l.x-a.x),w=y*i+x*n,v=y*r+x*n,b=y*i+x*o,A=y*r+x*o;return!(Math.max(w,v,b,A)<=y*a.x+x*a.y||Math.min(w,v,b,A)>=y*c.x+x*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=r-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=r,this.height=n-r,this}getBounds(t){return t||(t=new tt),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,i=t.y,r=t.x+t.width,n=t.y+t.height;return e>=this.x&&e<this.x+this.width&&i>=this.y&&i<this.y+this.height&&r>=this.x&&r<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(t,e,i,r){return this.x=t,this.y=e,this.width=i,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Fs={default:-1};function J(s="default"){return Fs[s]===void 0&&(Fs[s]=-1),++Fs[s]}const Xi=new Set,_t="8.0.0",xa="8.3.4",ue={quiet:!1,noColor:!1},X=((s,t,e=3)=>{if(ue.quiet||Xi.has(t))return;let i=new Error().stack;const r=`${t} -Deprecated since v${s}`,n=typeof console.groupCollapsed=="function"&&!ue.noColor;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",r):(i=i.split(` -`).splice(e).join(` -`),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(i))),Xi.add(t)});Object.defineProperties(X,{quiet:{get:()=>ue.quiet,set:s=>{ue.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>ue.noColor,set:s=>{ue.noColor=s},enumerable:!0,configurable:!1}});const gn=()=>{};function _e(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function qi(s){return!(s&s-1)&&!!s}function _n(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const Ki=Object.create(null);function ba(s){const t=Ki[s];return t===void 0&&(Ki[s]=J("resource")),t}const yn=class xn extends ft{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...xn.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){X(_t,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this._sharedResourceId=null,this.emit("change",this)}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=ba(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};yn.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let ye=yn;const bn=class wn extends ft{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=J("textureSource"),this._resourceType="textureSource",this._resourceId=J("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this.transient=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...wn.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.transient=t.transient??!1,this.alphaMode=t.alphaMode,this.style=new ye(_n(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var t,e;this._resourceId=J("resource"),this.emit("change",this),this.emit("unload",this);for(const i in this._gpuData)(e=(t=this._gpuData[i])==null?void 0:t.destroy)==null||e.call(t);this._gpuData=Object.create(null)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i||(i=this._resolution),t||(t=this.width),e||(e=this.height);const r=Math.round(t*i),n=Math.round(e*i);return this.width=r/i,this.height=n/i,this._resolution=i,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=J("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=qi(this.pixelWidth)&&qi(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};bn.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let St=bn;class Ri extends St{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super({...t,resource:e,format:i}),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Ri.extension=I.TextureSource;const Qi=new W;class wa{constructor(t,e){this.mapCoord=new W,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this._texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this)),this.update()}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let r=0;r<t.length;r+=2){const n=t[r],o=t[r+1];e[r]=n*i.a+o*i.c+i.tx,e[r+1]=n*i.b+o*i.d+i.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const i=t.orig,r=t.trim;r&&(Qi.set(i.width/r.width,0,0,i.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Qi));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,h=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+h)/n.width,o[1]=(t.frame.y+a+h)/n.height,o[2]=(t.frame.x+t.frame.width-a+h)/n.width,o[3]=(t.frame.y+t.frame.height-a+h)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}class U extends ft{constructor({source:t,label:e,frame:i,orig:r,trim:n,defaultAnchor:o,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=J("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new tt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(t==null?void 0:t.source)??new St,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=h??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new wa(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:r}=this._source,n=e.x/i,o=e.y/r,a=e.width/i,h=e.height/r;let l=this.rotate;if(l){const c=a/2,u=h/2,f=n+c,d=o+u;l=O.add(l,O.NW),t.x0=f+c*O.uX(l),t.y0=d+u*O.uY(l),l=O.add(l,2),t.x1=f+c*O.uX(l),t.y1=d+u*O.uY(l),l=O.add(l,2),t.x2=f+c*O.uX(l),t.y2=d+u*O.uY(l),l=O.add(l,2),t.x3=f+c*O.uX(l),t.y3=d+u*O.uY(l)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+h,t.x3=n,t.y3=o+h}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),t&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(_t,"Texture.baseTexture is now Texture.source"),this._source}}U.EMPTY=new U({label:"EMPTY",source:new St({label:"EMPTY"})});U.EMPTY.destroy=gn;U.WHITE=new U({source:new Ri({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});U.WHITE.destroy=gn;function vn(s,t,e){const{width:i,height:r}=e.orig,n=e.trim;if(n){const o=n.width,a=n.height;s.minX=n.x-t._x*i,s.maxX=s.minX+o,s.minY=n.y-t._y*r,s.maxY=s.minY+a}else s.minX=-t._x*i,s.maxX=s.minX+i,s.minY=-t._y*r,s.maxY=s.minY+r}const Zi=new W;class vt{constructor(t=1/0,e=1/0,i=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Zi,this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new tt);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Zi,this}set(t,e,i,r){this.minX=t,this.minY=e,this.maxX=i,this.maxY=r}addFrame(t,e,i,r,n){n||(n=this.matrix);const o=n.a,a=n.b,h=n.c,l=n.d,c=n.tx,u=n.ty;let f=this.minX,d=this.minY,p=this.maxX,g=this.maxY,m=o*t+h*e+c,_=a*t+l*e+u;m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),m=o*i+h*e+c,_=a*i+l*e+u,m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),m=o*t+h*r+c,_=a*t+l*r+u,m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),m=o*i+h*r+c,_=a*i+l*r+u,m<f&&(f=m),_<d&&(d=_),m>p&&(p=m),_>g&&(g=_),this.minX=f,this.minY=d,this.maxX=p,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,i=this.minY,r=this.maxX,n=this.maxY,{a:o,b:a,c:h,d:l,tx:c,ty:u}=t;let f=o*e+h*i+c,d=a*e+l*i+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=o*r+h*i+c,d=a*r+l*i+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*e+h*n+c,d=a*e+l*n+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=o*r+h*n+c,d=a*r+l*n+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,r){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>r&&(this.maxY=r),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new vt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,r){let n=this.minX,o=this.minY,a=this.maxX,h=this.maxY;r||(r=this.matrix);const l=r.a,c=r.b,u=r.c,f=r.d,d=r.tx,p=r.ty;for(let g=e;g<i;g+=2){const m=t[g],_=t[g+1],y=l*m+u*_+d,x=c*m+f*_+p;n=y<n?y:n,o=x<o?x:o,a=y>a?y:a,h=x>h?x:h}this.minX=n,this.minY=o,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var va={grad:.9,turn:360,rad:360/(2*Math.PI)},Et=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},rt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},bt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},An=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},Ji=function(s){return{r:bt(s.r,0,255),g:bt(s.g,0,255),b:bt(s.b,0,255),a:bt(s.a)}},Gs=function(s){return{r:rt(s.r),g:rt(s.g),b:rt(s.b),a:rt(s.a,3)}},Aa=/^#([0-9a-f]{3,8})$/i,ss=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Sn=function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},Cn=function(s){var t=s.h,e=s.s,i=s.v,r=s.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),h=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,a,o,o,h,i][l],g:255*[h,i,i,a,o,o][l],b:255*[o,o,h,i,i,a][l],a:r}},tr=function(s){return{h:An(s.h),s:bt(s.s,0,100),l:bt(s.l,0,100),a:bt(s.a)}},er=function(s){return{h:rt(s.h),s:rt(s.s),l:rt(s.l),a:rt(s.a,3)}},sr=function(s){return Cn((e=(t=s).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Ge=function(s){return{h:(t=Sn(s)).h,s:(r=(200-(e=t.s))*(i=t.v)/100)>0&&r<200?e*i/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,i,r},Sa=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ca=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ta=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pa=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ai={string:[[function(s){var t=Aa.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?rt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?rt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=Ta.exec(s)||Pa.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:Ji({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(s){var t=Sa.exec(s)||Ca.exec(s);if(!t)return null;var e,i,r=tr({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(va[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return sr(r)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,i=s.b,r=s.a,n=r===void 0?1:r;return Et(t)&&Et(e)&&Et(i)?Ji({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,i=s.l,r=s.a,n=r===void 0?1:r;if(!Et(t)||!Et(e)||!Et(i))return null;var o=tr({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return sr(o)},"hsl"],[function(s){var t=s.h,e=s.s,i=s.v,r=s.a,n=r===void 0?1:r;if(!Et(t)||!Et(e)||!Et(i))return null;var o=(function(a){return{h:An(a.h),s:bt(a.s,0,100),v:bt(a.v,0,100),a:bt(a.a)}})({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Cn(o)},"hsv"]]},ir=function(s,t){for(var e=0;e<t.length;e++){var i=t[e][0](s);if(i)return[i,t[e][1]]}return[null,void 0]},Ma=function(s){return typeof s=="string"?ir(s.trim(),ai.string):typeof s=="object"&&s!==null?ir(s,ai.object):[null,void 0]},Ds=function(s,t){var e=Ge(s);return{h:e.h,s:bt(e.s+100*t,0,100),l:e.l,a:e.a}},Os=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},rr=function(s,t){var e=Ge(s);return{h:e.h,s:e.s,l:bt(e.l+100*t,0,100),a:e.a}},hi=(function(){function s(t){this.parsed=Ma(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return rt(Os(this.rgba),2)},s.prototype.isDark=function(){return Os(this.rgba)<.5},s.prototype.isLight=function(){return Os(this.rgba)>=.5},s.prototype.toHex=function(){return t=Gs(this.rgba),e=t.r,i=t.g,r=t.b,o=(n=t.a)<1?ss(rt(255*n)):"","#"+ss(e)+ss(i)+ss(r)+o;var t,e,i,r,n,o},s.prototype.toRgb=function(){return Gs(this.rgba)},s.prototype.toRgbString=function(){return t=Gs(this.rgba),e=t.r,i=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+r+", "+n+")":"rgb("+e+", "+i+", "+r+")";var t,e,i,r,n},s.prototype.toHsl=function(){return er(Ge(this.rgba))},s.prototype.toHslString=function(){return t=er(Ge(this.rgba)),e=t.h,i=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+r+"%, "+n+")":"hsl("+e+", "+i+"%, "+r+"%)";var t,e,i,r,n},s.prototype.toHsv=function(){return t=Sn(this.rgba),{h:rt(t.h),s:rt(t.s),v:rt(t.v),a:rt(t.a,3)};var t},s.prototype.invert=function(){return Pt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),Pt(Ds(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),Pt(Ds(this.rgba,-t))},s.prototype.grayscale=function(){return Pt(Ds(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),Pt(rr(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),Pt(rr(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?Pt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):rt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=Ge(this.rgba);return typeof t=="number"?Pt({h:t,s:e.s,l:e.l,a:e.a}):rt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===Pt(t).toHex()},s})(),Pt=function(s){return s instanceof hi?s:new hi(s)},nr=[],ka=function(s){s.forEach(function(t){nr.indexOf(t)<0&&(t(hi,ai),nr.push(t))})};function Ea(s,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var r in e)i[e[r]]=r;var n={};s.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=i[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,f="black";if(!n.length)for(var d in e)n[d]=new s(e[d]).toRgb();for(var p in e){var g=(a=c,h=n[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<u&&(u=g,f=p)}return f}},t.string.push([function(o){var a=o.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new s(h).toRgb():null},"name"])}ka([Ea]);const xe=class Be{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Be)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((n,o)=>n===e[o]);if(t!==null&&e!==null){const n=Object.keys(t),o=Object.keys(e);return n.length!==o.length?!1:n.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,r]=this._components;return{r:t,g:e,b:i,a:r}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(r*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,i,r,n]=this._components;return t[0]=e,t[1]=i,t[2]=r,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,i,r]=this._components;return t[0]=e,t[1]=i,t[2]=r,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,r,n]=Be._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(t){let e,i,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,r,n=255]=t,e/=255,i/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Be.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Pt(t);o.isValid()&&({r:e,g:i,b:r,a:n}=o.rgba,e/=255,i/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Be||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};xe.shared=new xe;xe._temp=new xe;xe.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let q=xe;const Ia={cullArea:null,cullable:!1,cullableChildren:!0};let Ws=0;const or=500;function Y(...s){Ws!==or&&(Ws++,Ws===or?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}const Qe={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)},release(){this._registeredResources.forEach(s=>s.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(s){return this._registeredResources.has(s)},reset(){this._registeredResources.clear()}};class Ra{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){var i;let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),(i=e.init)==null||i.call(e,t),e}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}class La{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Ra(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const At=new La;Qe.register(At);const Ba={get isCachedAsTexture(){var s;return!!((s=this.renderGroup)!=null&&s.isCachedAsTexture)},cacheAsTexture(s){typeof s=="boolean"&&s===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(s===!0?{}:s))},updateCacheTexture(){var s;(s=this.renderGroup)==null||s.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(s){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(s)}};function Fa(s,t,e){const i=s.length;let r;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(r=t;r<n;++r)s[r]=s[r+e];s.length=n}const Ga={allowChildren:!0,removeChildren(s=0,t){var n;const e=t??this.children.length,i=e-s,r=[];if(i>0&&i<=e){for(let a=e-1;a>=s;a--){const h=this.children[a];h&&(r.push(h),h.parent=null)}Fa(this.children,s,e);const o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(r);for(let a=0;a<r.length;++a){const h=r[a];(n=h.parentRenderLayer)==null||n.detach(h),this.emit("childRemoved",h,this,a),r[a].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}else if(i===0&&this.children.length===0)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(s){const t=this.getChildAt(s);return this.removeChild(t)},getChildAt(s){if(s<0||s>=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||X(_t,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);const i=s.parent===this;if(s.parent){const n=s.parent.children.indexOf(s);if(i){if(n===t)return s;s.parent.children.splice(n,1)}else s.removeFromParent()}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s._updateFlags=15;const r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(s),this.sortableChildren&&(this.sortDirty=!0),i||(this.emit("childAdded",s,this,t),s.emit("added",this)),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=s;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var s;(s=this.parent)==null||s.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),s.setFromMatrix(e),s},replaceChild(s,t){s.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(s)),t.setFromMatrix(s.localTransform),t.updateLocalTransform(),this.removeChild(s)}},Da={collectRenderables(s,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(s,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,s):this.collectRenderablesWithEffects(s,t,e))},collectRenderablesSimple(s,t,e){const i=this.children,r=i.length;for(let n=0;n<r;n++)i[n].collectRenderables(s,t,e)},collectRenderablesWithEffects(s,t,e){const{renderPipes:i}=t;for(let r=0;r<this.effects.length;r++){const n=this.effects[r];i[n.pipe].push(n,this,s)}this.collectRenderablesSimple(s,t,e);for(let r=this.effects.length-1;r>=0;r--){const n=this.effects[r];i[n.pipe].pop(n,this,s)}}};class ar{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}class Oa{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const i=this._tests[e];if(i.test(t))return At.get(i.maskClass,t)}return t}returnMaskEffect(t){At.return(t)}}const li=new Oa;K.handleByList(I.MaskEffect,li._effectClasses);const Wa={_maskEffect:null,_maskOptions:{inverse:!1,channel:"red"},_filterEffect:null,effects:[],_markStructureAsChanged(){const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0)},addEffect(s){this.effects.indexOf(s)===-1&&(this.effects.push(s),this.effects.sort((e,i)=>e.priority-i.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(s){const t=this._maskEffect;(t==null?void 0:t.mask)!==s&&(t&&(this.removeEffect(t),li.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=li.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){var s;return(s=this._maskEffect)==null?void 0:s.mask},setMask(s){this._maskOptions={...this._maskOptions,...s},s.mask&&(this.mask=s.mask),this._markStructureAsChanged()},set filters(s){var n;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new ar);s=s;const e=(s==null?void 0:s.length)>0,i=((n=t.filters)==null?void 0:n.length)>0,r=e!==i;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),r&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){var s;return(s=this._filterEffect)==null?void 0:s.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new ar),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},Ua={label:null,get name(){return X(_t,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){X(_t,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let i=0;i<e.length;i++){const r=e[i];if(r.label===s||s instanceof RegExp&&s.test(r.label))return r}if(t)for(let i=0;i<e.length;i++){const n=e[i].getChildByLabel(s,!0);if(n)return n}return null},getChildrenByLabel(s,t=!1,e=[]){const i=this.children;for(let r=0;r<i.length;r++){const n=i[r];(n.label===s||s instanceof RegExp&&s.test(n.label))&&e.push(n)}if(t)for(let r=0;r<i.length;r++)i[r].getChildrenByLabel(s,!0,e);return e}},ut=At.getPool(W),Lt=At.getPool(vt),za=new W,Ha={getFastGlobalBounds(s,t){t||(t=new vt),t.clear(),this._getGlobalBoundsRecursive(!!s,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(s,t,e){let i=t;if(s&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const r=!!this.effects.length;if((this.renderGroup||r)&&(i=Lt.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;i.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const n=this.children;for(let o=0;o<n.length;o++)n[o]._getGlobalBoundsRecursive(s,i,e)}if(r){let n=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(n||(n=!0,i.applyMatrix(o.worldTransform)),this.effects[a].addBounds(i,!0));n&&i.applyMatrix(o.worldTransform.copyTo(za).invert()),t.addBounds(i),Lt.return(i)}else this.renderGroup&&(t.addBounds(i,this.relativeGroupTransform),Lt.return(i))}};function Tn(s,t,e){e.clear();let i,r;return s.parent?t?i=s.parent.worldTransform:(r=ut.get().identity(),i=Li(s,r)):i=W.IDENTITY,Pn(s,e,i,t),r&&ut.return(r),e.isValid||e.set(0,0,0,0),e}function Pn(s,t,e,i){var a,h;if(!s.visible||!s.measurable)return;let r;i?r=s.worldTransform:(s.updateLocalTransform(),r=ut.get(),r.appendFrom(s.localTransform,e));const n=t,o=!!s.effects.length;if(o&&(t=Lt.get().clear()),s.boundsArea)t.addRect(s.boundsArea,r);else{const l=s.bounds;l&&!l.isEmpty()&&(t.matrix=r,t.addBounds(l));for(let c=0;c<s.children.length;c++)Pn(s.children[c],t,r,i)}if(o){for(let l=0;l<s.effects.length;l++)(h=(a=s.effects[l]).addBounds)==null||h.call(a,t);n.addBounds(t,W.IDENTITY),Lt.return(t)}i||ut.return(r)}function Li(s,t){const e=s.parent;return e&&(Li(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function Mn(s,t){if(s===16777215||!t)return t;if(t===16777215||!s)return s;const e=s>>16&255,i=s>>8&255,r=s&255,n=t>>16&255,o=t>>8&255,a=t&255,h=e*n/255|0,l=i*o/255|0,c=r*a/255|0;return(h<<16)+(l<<8)+c}const hr=16777215;function lr(s,t){return s===hr?t:t===hr?s:Mn(s,t)}function fs(s){return((s&255)<<16)+(s&65280)+(s>>16&255)}const Na={getGlobalAlpha(s){if(s)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(s=new W,t){if(t)return s.copyFrom(this.worldTransform);this.updateLocalTransform();const e=Li(this,ut.get().identity());return s.appendFrom(this.localTransform,e),ut.return(e),s},getGlobalTint(s){if(s)return this.renderGroup?fs(this.renderGroup.worldColor):this.parentRenderGroup?fs(lr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=lr(t,e.localColor),e=e.parent;return fs(t)}};function kn(s,t,e){return t.clear(),e||(e=W.IDENTITY),En(s,t,e,s,!0),t.isValid||t.set(0,0,0,0),t}function En(s,t,e,i,r){var h,l;let n;if(r)n=ut.get(),n=e.copyTo(n);else{if(!s.visible||!s.measurable)return;s.updateLocalTransform();const c=s.localTransform;n=ut.get(),n.appendFrom(c,e)}const o=t,a=!!s.effects.length;if(a&&(t=Lt.get().clear()),s.boundsArea)t.addRect(s.boundsArea,n);else{s.renderPipeId&&(t.matrix=n,t.addBounds(s.bounds));const c=s.children;for(let u=0;u<c.length;u++)En(c[u],t,n,i,!1)}if(a){for(let c=0;c<s.effects.length;c++)(l=(h=s.effects[c]).addLocalBounds)==null||l.call(h,t,i);o.addBounds(t,W.IDENTITY),Lt.return(t)}ut.return(n)}function In(s,t){const e=s.children;for(let i=0;i<e.length;i++){const r=e[i],n=r.uid,o=(r._didViewChangeTick&65535)<<16|r._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,r.children.length&&In(r,t)}return t.didChange}const Va=new W,$a={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(s,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=s/t*e:this.scale.x=e},_setHeight(s,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=s/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new vt});const s=this._localBoundsCacheData;return s.index=1,s.didChange=!1,s.data[0]!==this._didViewChangeTick&&(s.didChange=!0,s.data[0]=this._didViewChangeTick),In(this,s),s.didChange&&kn(this,s.localBounds,Va),s.localBounds},getBounds(s,t){return Tn(this,s,t||new vt)}},ja={_onRender:null,set onRender(s){const t=this.renderGroup||this.parentRenderGroup;if(!s){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=s},get onRender(){return this._onRender}},Ya={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(s){this._zIndex!==s&&(this._zIndex=s,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(Xa))}};function Xa(s,t){return s._zIndex-t._zIndex}const qa={getGlobalPosition(s=new lt,t=!1){return this.parent?this.parent.toGlobal(this._position,s,t):(s.x=this._position.x,s.y=this._position.y),s},toGlobal(s,t,e=!1){const i=this.getGlobalTransform(ut.get(),e);return t=i.apply(s,t),ut.return(i),t},toLocal(s,t,e,i){t&&(s=t.toGlobal(s,e,i));const r=this.getGlobalTransform(ut.get(),i);return e=r.applyInverse(s,e),ut.return(r),e}};class Rn{constructor(){this.uid=J("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let Ka=0;class Qa{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new ye(this.textureOptions)}createTexture(t,e,i,r){const n=new St({...this.textureOptions,width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1,autoGenerateMipmaps:r});return new U({source:n,label:`texturePool_${Ka++}`})}getOptimalTexture(t,e,i=1,r,n=!1){let o=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);o=_e(o),a=_e(a);const h=r?1:0,l=n?1:0,c=(o<<17)+(a<<2)+(l<<1)+h;this._texturePool[c]||(this._texturePool[c]=[]);let u=this._texturePool[c].pop();return u||(u=this.createTexture(o,a,r,n)),u.source._resolution=i,u.source.width=o/i,u.source.height=a/i,u.source.pixelWidth=o,u.source.pixelHeight=a,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=c,u}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t,e=!1){const i=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[i].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let r=0;r<i.length;r++)i[r].destroy(!0)}this._texturePool={}}}const Ts=new Qa;Qe.register(Ts);class Za{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new W,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Rn,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let i=0;i<e.length;i++){const r=e[i];r._updateFlags=15,this.addChild(r)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Ts.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let i=0;i<e.length;i++)this.removeChild(e[i])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let r=0;r<i.length;r++)this._getChildren(i[r],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new W),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new W),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new W),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function Ja(s,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(s[i]=t[i])}const Us=new ot(null),is=new ot(null),zs=new ot(null,1,1),rs=new ot(null),cr=1,th=2,Hs=4;class Ut extends ft{constructor(t={}){var e,i;super(),this.uid=J("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new W,this.relativeGroupTransform=new W,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ot(this,0,0),this._scale=zs,this._pivot=is,this._origin=rs,this._skew=Us,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],Ja(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(r=>this.addChild(r)),(i=t.parent)==null||i.addChild(this)}static mixin(t){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),K.mixin(Ut,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||X(_t,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let r=0;r<t.length;r++)this.addChild(t[r]);return t[0]}const e=t[0],i=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),i&&(i.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,i&&i.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let r=0;r<t.length;r++)this.removeChild(t[r]);return t[0]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=At.get(Za,this),this.groupTransform=W.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),At.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new W),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*pa}set angle(t){this.rotation=t*ma}get pivot(){return this._pivot===is&&(this._pivot=new ot(this,0,0)),this._pivot}set pivot(t){this._pivot===is&&(this._pivot=new ot(this,0,0),this._origin!==rs&&Y("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Us&&(this._skew=new ot(this,0,0)),this._skew}set skew(t){this._skew===Us&&(this._skew=new ot(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===zs&&(this._scale=new ot(this,1,1)),this._scale}set scale(t){this._scale===zs&&(this._scale=new ot(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===rs&&(this._origin=new ot(this,0,0)),this._origin}set origin(t){this._origin===rs&&(this._origin=new ot(this,0,0),this._pivot!==is&&Y("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){const i=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX:this.scale.x,typeof t.scaleY=="number"?t.scaleY:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,r=this._pivot,n=this._origin,o=this._position,a=i._x,h=i._y,l=r._x,c=r._y,u=-n._x,f=-n._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*h,e.d=this._sy*h,e.tx=o._x-(l*e.a+c*e.c)+(u*e.a+f*e.c)-u,e.ty=o._y-(l*e.b+c*e.d)+(u*e.b+f*e.d)-f}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=cr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const i=q.shared.setValue(t??16777215).toBgrNumber();i!==this.localColor&&(this.localColor=i,this._updateFlags|=cr,this._onUpdate())}get tint(){return fs(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=th,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Hs,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Hs,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Hs,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var r;if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t==null?void 0:t.children)&&e)for(let n=0;n<e.length;++n)e[n].destroy(t);(r=this.renderGroup)==null||r.destroy(),this.renderGroup=null}}K.mixin(Ut,Ga,Ha,qa,ja,$a,Wa,Ua,Ya,Ia,Ba,Na,Da);class Ln extends Ut{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new vt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:r}=t;return i>=e.minX&&i<=e.maxX&&r>=e.minY&&r<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){const{renderPipes:r}=e;r.blendMode.pushBlendMode(this,this.groupBlendMode,t);const o=r[this.renderPipeId];o!=null&&o.addRenderable&&o.addRenderable(this,t),this.didViewUpdate=!1;const a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,i);r.blendMode.popBlendMode(t)}}class yt extends Ln{constructor(t=U.EMPTY){t instanceof U&&(t={texture:t});const{texture:e=U.EMPTY,anchor:i,roundPixels:r,width:n,height:o,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof U?new yt(t):new yt(U.from(t,e))}set texture(t){t||(t=U.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return vn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return X("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,i=this._bounds,{width:r,height:n}=e.orig;i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*n,i.maxY=i.minY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const eh=new vt;function Bn(s,t,e){const i=eh;s.measurable=!0,Tn(s,e,i),t.addBoundsMask(i),s.measurable=!1}function Fn(s,t,e){const i=Lt.get();s.measurable=!0;const r=ut.get().identity(),n=Gn(s,e,r);kn(s,i,n),s.measurable=!1,t.addBoundsMask(i),ut.return(r),Lt.return(i)}function Gn(s,t,e){return s?(s!==t&&(Gn(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(Y("Mask bounds, renderable is not inside the root container"),e)}class Dn{constructor(t){this.priority=0,this.inverse=!1,this.channel="red",this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof yt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||Bn(this.mask,t,e)}addLocalBounds(t,e){Fn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof yt}}Dn.extension=I.MaskEffect;class On{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}On.extension=I.MaskEffect;class Wn{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){Bn(this.mask,t,e)}addLocalBounds(t,e){Fn(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof Ut}}Wn.extension=I.MaskEffect;const sh={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};let ur=sh;const z={get(){return ur},set(s){ur=s}};class Un extends St{constructor(t){t.resource||(t.resource=z.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const r=super.resize(t,e,i);return r&&this.resizeCanvas(),r}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}Un.extension=I.TextureSource;class be extends St{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}be.extension=I.TextureSource;var ze=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(ze||{});class Ns{constructor(t,e=null,i=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=r}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const zn=class gt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Ns(null,null,1/0),this.deltaMS=1/gt.targetFPMS,this.elapsedMS=1/gt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=ze.NORMAL){return this._addListener(new Ns(t,e,i))}addOnce(t,e,i=ze.NORMAL){return this._addListener(new Ns(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*gt.targetFPMS;const i=this._head;let r=i.next;for(;r;)r=r.emit(this);i.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(Math.max(0,t)/1e3,gt.targetFPMS);this._maxElapsedMS=1/e,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){t===0?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!gt._shared){const t=gt._shared=new gt;t.autoStart=!0,t._protected=!0}return gt._shared}static get system(){if(!gt._system){const t=gt._system=new gt;t.autoStart=!0,t._protected=!0}return gt._system}};zn.targetFPMS=.06;let dt=zn,Vs;async function Hn(){return Vs??(Vs=(async()=>{var o;const t=z.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(a=>{const h=document.createElement("video");h.onloadeddata=()=>a(h),h.onerror=()=>a(null),h.autoplay=!1,h.crossOrigin="anonymous",h.preload="auto",h.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",h.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(i),(o=t.getExtension("WEBGL_lose_context"))==null||o.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Vs}const Ps=class Nn extends St{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Nn.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),this._onLoadedMetadata=this._onLoadedMetadata.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=dt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.isValid||t.addEventListener("loadedmetadata",this._onLoadedMetadata),this.alphaMode=await Hn(),this._load=new Promise((i,r)=>{this.isValid?i(this):(this._resolve=i,this._reject=r,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onLoadedMetadata(){this.isValid&&this._mediaReady()}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlayThrough),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&this.isValid&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("loadedmetadata",this._onLoadedMetadata),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(dt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(dt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(dt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ps.extension=I.TextureSource;Ps.defaultOptions={...St.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Ps.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let De=Ps;const Tt=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(i=>typeof i=="string"||e?t(i):i):s);class ih{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){const e=this._cache.get(t);return e||Y(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const i=Tt(t);let r;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.test(e)){r=l.getCacheableAssets(i,e);break}}const n=new Map(Object.entries(r||{}));r||i.forEach(h=>{n.set(h,e)});const o=[...n.keys()],a={cacheKeys:o,keys:i};i.forEach(h=>{this._cacheMap.set(h,a)}),o.forEach(h=>{const l=r?r[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&Y("[Cache] already has key:",h),this._cache.set(h,n.get(h))})}remove(t){if(!this._cacheMap.has(t)){Y(`[Assets] Asset id ${t} was not found in the Cache`);return}const e=this._cacheMap.get(t);e.cacheKeys.forEach(r=>{this._cache.delete(r)}),e.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const nt=new ih,ci=[];K.handleByList(I.TextureSource,ci);function Vn(s={}){const t=s&&s.resource,e=t?s.resource:s,i=t?s:{resource:s};for(let r=0;r<ci.length;r++){const n=ci[r];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function rh(s={},t=!1){const e=s&&s.resource,i=e?s.resource:s,r=e?s:{resource:s};if(!t&&nt.has(i))return nt.get(i);const n=new U({source:Vn(r)});return n.on("destroy",()=>{nt.has(i)&&nt.remove(i)}),t||nt.set(i,n),n}function nh(s,t=!1){return typeof s=="string"?nt.get(s):s instanceof St?new U({source:s}):rh(s,t)}U.from=nh;St.from=Vn;K.add(Dn,On,Wn,De,be,Un,Ri);var Gt=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(Gt||{});function Ct(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function Ce(s){return s.split("?")[0].split("#")[0]}function oh(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ah(s,t,e){return s.replace(new RegExp(oh(t),"g"),e)}function hh(s,t){let e="",i=0,r=-1,n=0,o=-1;for(let a=0;a<=s.length;++a){if(a<s.length)o=s.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(e.length<2||i!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",i=0):(e=e.slice(0,h),i=e.length-1-e.lastIndexOf("/")),r=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,r=a,n=0;continue}}}else e.length>0?e+=`/${s.slice(r+1,a)}`:e=s.slice(r+1,a),i=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const at={toPosix(s){return ah(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Ct(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(Ct(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const i=Ce(this.toPosix(t??z.get().getBaseUrl())),r=Ce(this.toPosix(e??this.rootname(i)));return s=this.toPosix(s),s.startsWith("/")?at.join(r,s.slice(1)):this.isAbsolute(s)?s:this.join(i,s)},normalize(s){if(Ct(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const i=s.endsWith("/");return s=hh(s),s.length>0&&i&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return Ct(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const i=s[e];if(Ct(i),i.length>0)if(t===void 0)t=i;else{const r=s[e-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?t+=`/../${i}`:t+=`/${i}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(Ct(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let i=-1,r=!0;const n=this.getProtocol(s),o=s;s=s.slice(n.length);for(let a=s.length-1;a>=1;--a)if(t=s.charCodeAt(a),t===47){if(!r){i=a;break}}else r=!1;return i===-1?e?"/":this.isUrl(o)?n+s:n:e&&i===1?"//":n+s.slice(0,i)},rootname(s){Ct(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){Ct(s),t&&Ct(t),s=Ce(this.toPosix(s));let e=0,i=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let o=t.length-1,a=-1;for(n=s.length-1;n>=0;--n){const h=s.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(h===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=s.length),s.slice(e,i)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!r){e=n+1;break}}else i===-1&&(r=!1,i=n+1);return i===-1?"":s.slice(e,i)},extname(s){Ct(s),s=Ce(this.toPosix(s));let t=-1,e=0,i=-1,r=!0,n=0;for(let o=s.length-1;o>=0;--o){const a=s.charCodeAt(o);if(a===47){if(!r){e=o+1;break}continue}i===-1&&(r=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":s.slice(t,i)},parse(s){Ct(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=Ce(this.toPosix(s));let e=s.charCodeAt(0);const i=this.isAbsolute(s);let r;t.root=this.rootname(s),i||this.hasProtocol(s)?r=1:r=0;let n=-1,o=0,a=-1,h=!0,l=s.length-1,c=0;for(;l>=r;--l){if(e=s.charCodeAt(l),e===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),e===46?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||a===-1||c===0||c===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&i?t.base=t.name=s.slice(1,a):t.base=t.name=s.slice(o,a)):(o===0&&i?(t.name=s.slice(1,n),t.base=s.slice(1,a)):(t.name=s.slice(o,n),t.base=s.slice(o,a)),t.ext=s.slice(n,a)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function $n(s,t,e,i,r){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?$n(s.replace(i[e],a),t,e+1,i,r):r.push(s.replace(i[e],a))}}function lh(s){const t=/\{(.*?)\}/g,e=s.match(t),i=[];if(e){const r=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),$n(s,r,0,e,i)}else i.push(s);return i}const gs=s=>!Array.isArray(s);class ve{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,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.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){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return Tt(e||i,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>(o==null?void 0:o.src)??o):n!=null&&n.src?n.src:n,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&Y("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let r=e;Array.isArray(e)||(r=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),r.forEach(n=>{const o=n.src,a=n.alias;let h;if(typeof a=="string"){const l=this._createBundleAssetId(t,a);i.push(l),h=[a,l]}else{const l=a.map(c=>this._createBundleAssetId(t,c));i.push(...l),h=[...a,...l]}this.add({...n,alias:h,src:o})}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;i=n=>{this.hasKey(n)&&Y(`[Resolver] already has key: ${n} overwriting`)},Tt(e).forEach(n=>{const{src:o}=n;let{data:a,format:h,loadParser:l,parser:c}=n;const u=Tt(o).map(g=>typeof g=="string"?lh(g):Array.isArray(g)?g:[g]),f=this.getAlias(n);Array.isArray(f)?f.forEach(i):i(f);const d=[],p=g=>{const m=this._parsers.find(_=>_.test(g));return{src:g,...m==null?void 0:m.parse(g)}};u.forEach(g=>{g.forEach(m=>{let _={};if(typeof m!="object"?_=p(m):(a=m.data??a,h=m.format??h,(m.loadParser||m.parser)&&(l=m.loadParser??l,c=m.parser??c),_={...p(m.src),...m}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:f,data:a,format:h,loadParser:l,parser:c,progressSize:n.progressSize}),d.push(_)})}),f.forEach(g=>{this._assetMap[g]=d})})}resolveBundle(t){const e=gs(t);t=Tt(t);const i={};return t.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(r,h)]=l}i[r]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const r in e)i[r]=e[r].src;return i}return e.src}resolve(t){const e=gs(t);t=Tt(t);const i={};return t.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(h=>{const l=n.filter(c=>c[a]?c[a]===h:!1);l.length&&(n=l)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});i[r]=this._resolverHash[r]}),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++){const i=t[e],r=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:i,data:r,loadParser:n,parser:o,format:a,progressSize:h}=e;return(this._basePath||this._rootPath)&&(t.src=at.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=n??t.loadParser,t.parser=o??t.parser,t.format=a??t.format??ch(t.src),h!==void 0&&(t.progressSize=h),t}}ve.RETINA_PREFIX=/@([0-9\.]+)x/;function ch(s){return s.split(".").pop().split("?").shift().split("#").shift()}const ui=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},jn=class Fe{constructor(t,e){this.linkedSheets=[];let i=t;(t==null?void 0:t.source)instanceof St&&(i={texture:t,data:e});const{texture:r,data:n,cachePrefix:o=""}=i;this.cachePrefix=o,this._texture=r instanceof U?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=n;const a=parseFloat(n.meta.scale);a?(this.resolution=a,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Fe.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,e=!1){let i=t;const r=e?1/0:Fe.BATCH_SIZE;for(;i-t<r&&i<this._frameKeys.length;){const n=this._frameKeys[i],o=this._frames[n],a=o.frame;if(a){let h=null,l=null;const c=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,u=new tt(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);o.rotated?h=new tt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):h=new tt(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(l=new tt(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[n]=new U({source:this.textureSource,frame:h,orig:u,trim:l,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:n.toString()})}i++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const r=t[e][i];this.animations[e].push(this.textures[r])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Fe.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Fe.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};jn.BATCH_SIZE=1e3;let dr=jn;const uh=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function Yn(s,t,e){const i={};if(s.forEach(r=>{i[r]=t}),Object.keys(t.textures).forEach(r=>{i[`${t.cachePrefix}${r}`]=t.textures[r]}),!e){const r=at.dirname(s[0]);t.linkedSheets.forEach((n,o)=>{const a=Yn([`${r}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const dh={extension:I.Asset,cache:{test:s=>s instanceof dr,getCacheableAssets:(s,t)=>Yn(s,t,!1)},resolver:{extension:{type:I.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),i=e.pop(),r=e.pop();return i==="json"&&uh.includes(r)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=ve.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:I.LoadParser,priority:Gt.Normal,name:"spritesheetLoader"},async testParse(s,t){return at.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var u,f;const{texture:i,imageFilename:r,textureOptions:n,cachePrefix:o}=(t==null?void 0:t.data)??{};let a=at.dirname(t.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let h;if(i instanceof U)h=i;else{const d=ui(a+(r??s.meta.image),t.src);h=(await e.load([{src:d,data:n}]))[d]}const l=new dr({texture:h.source,data:s,cachePrefix:o});await l.parse();const c=(u=s==null?void 0:s.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(c)){const d=[];for(const g of c){if(typeof g!="string")continue;let m=a+g;(f=t.data)!=null&&f.ignoreMultiPack||(m=ui(m,t.src),d.push(e.load({src:m,data:{textureOptions:n,ignoreMultiPack:!0}})))}const p=await Promise.all(d);l.linkedSheets=p,p.forEach(g=>{g.linkedSheets=[l].concat(l.linkedSheets.filter(m=>m!==g))})}return l},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};K.add(dh);const $s=Object.create(null),fr=Object.create(null);function Bi(s,t){let e=fr[s];return e===void 0&&($s[t]===void 0&&($s[t]=1),fr[s]=e=$s[t]++),e}let ne;function Xn(){return(!ne||ne!=null&&ne.isContextLost())&&(ne=z.get().createCanvas().getContext("webgl",{})),ne}let ns;function fh(){if(!ns){ns="mediump";const s=Xn();s&&s.getShaderPrecisionFormat&&(ns=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return ns}function ph(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),` - - #ifdef GL_ES // This checks if it is WebGL1 - #define in varying - #define finalColor gl_FragColor - #define texture texture2D - #endif - ${s} - `):` - - #ifdef GL_ES // This checks if it is WebGL1 - #define in attribute - #define out varying - #endif - ${s} - `}function mh(s,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let r=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return r==="highp"&&i!=="highp"&&(r="mediump"),`precision ${r} float; -${s}`}else if(i!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function gh(s,t){return t?`#version 300 es -${s}`:s}const _h={},yh={};function xh(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?_h:yh;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`} -${s}`}function bh(s,t){return t?s.replace("#version 300 es",""):s}const js={stripVersion:bh,ensurePrecision:mh,addProgramDefines:ph,setProgramName:xh,insertVersion:gh},Te=Object.create(null),qn=class di{constructor(t){t={...di.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:fh()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let r=t.fragment,n=t.vertex;Object.keys(js).forEach(o=>{const a=i[o];r=js[o](r,a,!0),n=js[o](n,a,!1)}),this.fragment=r,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Bi(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null,Te[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Te[e]||(Te[e]=new di(t),Te[e]._cacheKey=e),Te[e]}};qn.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Kn=qn;const pr={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function wh(s){return pr[s]??pr.float32}const vh={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},mr=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function gr(s,t){let e;for(;(e=mr.exec(s))!==null;){const i=vh[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:i,stride:wh(i).stride,offset:0,instance:!1,start:0}}mr.lastIndex=0}function Ah(s){return s.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function Sh({source:s,entryPoint:t}){const e={},i=Ah(s),r=i.indexOf(`fn ${t}(`);if(r===-1)return e;const n=i.indexOf("->",r);if(n===-1)return e;const o=i.substring(r,n);if(gr(o,e),Object.keys(e).length===0){const a=o.match(/\(\s*\w+\s*:\s*(\w+)/);if(a){const h=a[1],l=new RegExp(`struct\\s+${h}\\s*\\{([^}]+)\\}`,"s"),c=i.match(l);c&&gr(c[1],e)}}return e}function Ys(s){var u,f;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,i=/@binding\((\d+)\)/,r=/var(<[^>]+>)? (\w+)/,n=/:\s*([\w<>]+)/,o=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=(u=s.match(t))==null?void 0:u.map(d=>({group:parseInt(d.match(e)[1],10),binding:parseInt(d.match(i)[1],10),name:d.match(r)[2],isUniform:d.match(r)[1]==="<uniform>",type:d.match(n)[1]}));if(!l)return{groups:[],structs:[]};const c=((f=s.match(o))==null?void 0:f.map(d=>{const p=d.match(h)[1],g=d.match(a).reduce((m,_)=>{const[y,x]=_.split(":");return m[y.trim()]=x.trim(),m},{});return g?{name:p,members:g}:null}).filter(({name:d})=>l.some(p=>p.type===d||p.type.includes(`<${d}>`))))??[];return{groups:l,structs:c}}var Jt=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(Jt||{});function Ch({groups:s}){const t=[];for(let e=0;e<s.length;e++){const i=s[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:Jt.VERTEX|Jt.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"||i.type.startsWith("texture_2d<")?t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):i.type==="texture_2d_array"||i.type.startsWith("texture_2d_array<")?t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(i.type==="texture_cube"||i.type.startsWith("texture_cube<"))&&t[i.group].push({binding:i.binding,visibility:Jt.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function Th({groups:s}){const t=[];for(let e=0;e<s.length;e++){const i=s[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function Ph(s,t){const e=new Set,i=new Set,r=[...s.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...s.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:r,groups:n}}const Pe=Object.create(null);class Ms{constructor(t){var a,h;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:i,layout:r,gpuLayout:n,name:o}=t;if(this.name=o,this.fragment=e,this.vertex=i,e.source===i.source){const l=Ys(e.source);this.structsAndGroups=l}else{const l=Ys(i.source),c=Ys(e.source);this.structsAndGroups=Ph(l,c)}this.layout=r??Th(this.structsAndGroups),this.gpuLayout=n??Ch(this.structsAndGroups),this.autoAssignGlobalUniforms=((a=this.layout[0])==null?void 0:a.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((h=this.layout[1])==null?void 0:h.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Bi(i,"program")}get attributeData(){return this._attributeData??(this._attributeData=Sh(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,Pe[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Pe[e]||(Pe[e]=new Ms(t),Pe[e]._cacheKey=e),Pe[e]}}const Qn=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Mh=Qn.reduce((s,t)=>(s[t]=!0,s),{});function kh(s,t){switch(s){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}const Zn=class Jn{constructor(t,e){this._touched=0,this.uid=J("uniform"),this._resourceType="uniformGroup",this._resourceId=J("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Jn.defaultOptions,...e},this.uniformStructures=t;const i={};for(const r in t){const n=t[r];if(n.name=r,n.size=n.size??1,!Mh[n.type]){const o=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(o){const[,a,h]=o;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${a}', size: ${h} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${Qn.join(", ")}`)}n.value??(n.value=kh(n.type,n.size)),i[r]=n.value}this.uniforms=i,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Bi(Object.keys(i).map(r=>`${r}-${t[r].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Zn.defaultOptions={ubo:!1,isStatic:!1};let to=Zn;class ps{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const r=t[i];this.setResource(r,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var r,n;const i=this.resources[e];t!==i&&((r=i==null?void 0:i.off)==null||r.call(i,"change",this.onResourceChange,this),(n=t.on)==null||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const i=this.resources;for(const r in i)i[r]._gcLastUsed=t,i[r]._touched=e}destroy(){var e;const t=this.resources;for(const i in t){const r=t[i];(e=r==null?void 0:r.off)==null||e.call(r,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var fi=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(fi||{});class Fi extends ft{constructor(t){super(),this.uid=J("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:i,groups:r,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=fi.WEBGPU),i&&(o|=fi.WEBGL)),this.compatibleRenderers=o;const h={};if(!n&&!r&&(n={}),n&&r)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&r&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&r&&a)for(const l in a)for(const c in a[l]){const u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&r&&!a){const l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(n){r={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(const c in n)h[c]||(r[99]||(r[99]=new ps,this._ownedBindGroups.push(r[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(const c in n){const u=c;let f=n[c];!f.source&&!f._resourceType&&(f=new to(f));const d=h[u];d&&(r[d.group]||(r[d.group]=new ps,this._ownedBindGroups.push(r[d.group])),r[d.group].setResource(f,d.binding))}}this.groups=r,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(r,h)}addResource(t,e,i){var r,n;(r=this._uniformBindMap)[e]||(r[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new ps,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const r in e){const n=e[r];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return i}destroy(t=!1){var e,i;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(r=>{r.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:i,...r}=t;let n,o;return e&&(n=Ms.from(e)),i&&(o=Kn.from(i)),new Fi({gpuProgram:n,glProgram:o,...r})}}const pi=[];K.handleByNamedList(I.Environment,pi);async function Eh(s){if(!s)for(let t=0;t<pi.length;t++){const e=pi[t];if(e.value.test()){await e.value.load();return}}}let Me;function Ih(){if(typeof Me=="boolean")return Me;try{Me=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Me=!1}return Me}const He=new Set;let mi=!1;function _r(s,t,e=2){const i=t&&t.length,r=i?t[0]*e:s.length;He.size&&He.clear();let n=eo(s,0,r,e,!0);const o=[];if(!n||n.next===n.prev)return o;let a=0,h=0,l=0;if(i&&(n=Gh(s,t,n,e)),s.length>80*e){a=s[0],h=s[1];let c=a,u=h;for(let f=e;f<r;f+=e){const d=s[f],p=s[f+1];d<a&&(a=d),p<h&&(h=p),d>c&&(c=d),p>u&&(u=p)}l=Math.max(c-a,u-h),l=l!==0?32767/l:0}return gi(n,o,a,h,l),o}function eo(s,t,e,i,r){let n=null;if(r===qh(s,t,e,i)>0)for(let o=t;o<e;o+=i)n=br(o/i|0,s[o],s[o+1],n);else for(let o=e-i;o>=t;o-=i)n=br(o/i|0,s[o],s[o+1],n);return n&&Ne(n,n.next)&&($e(n),n=n.next),n}function ie(s,t=s){const e=t===s;let i=s,r;do r=!1,i!==i.next&&(He.size===0||!He.has(i))&&(Ne(i,i.next)||st(i.prev,i,i.next)===0)?((e||i===t)&&(t=i.prev),mi=!0,$e(i),i=i.prev,r=!0):(e||i!==t)&&(i=i.next,r=!e);while(r||i!==t);return t}function gi(s,t,e,i,r){r&&Nh(s,e,i,r);let n=s,o=!1;for(;s.prev!==s.next;){const a=s.prev,h=s.next;if(st(a,s,h)<0&&(r?Lh(s,e,i,r):Rh(s))){t.push(a.i,s.i,h.i),$e(s),s=h,n=h;continue}if(s=h,s===n){if(mi=!1,s=ie(s),mi){n=s;continue}if(!o){s=Bh(s,t),n=s,o=!0;continue}Fh(s,t,e,i,r);break}}}function Rh(s){const t=s.prev,e=s,i=s.next,r=t.x,n=e.x,o=i.x,a=t.y,h=e.y,l=i.y,c=Math.min(r,n,o),u=Math.min(a,h,l),f=Math.max(r,n,o),d=Math.max(a,h,l);let p=i.next;for(;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=u&&p.y<=d&&!(r===p.x&&a===p.y)&&ys(r,a,n,h,o,l,p.x,p.y)&&st(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Lh(s,t,e,i){const r=s.prev,n=s,o=s.next,a=r.x,h=n.x,l=o.x,c=r.y,u=n.y,f=o.y,d=Math.min(a,h,l),p=Math.min(c,u,f),g=Math.max(a,h,l),m=Math.max(c,u,f),_=bi(d,p,t,e,i),y=bi(g,m,t,e,i);let x=s.prevZ;for(;x&&x.z>=_;){if(x.x>=d&&x.x<=g&&x.y>=p&&x.y<=m&&x!==o&&!(a===x.x&&c===x.y)&&ys(a,c,h,u,l,f,x.x,x.y)&&st(x.prev,x,x.next)>=0)return!1;x=x.prevZ}let w=s.nextZ;for(;w&&w.z<=y;){if(w.x>=d&&w.x<=g&&w.y>=p&&w.y<=m&&w!==o&&!(a===w.x&&c===w.y)&&ys(a,c,h,u,l,f,w.x,w.y)&&st(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Bh(s,t){let e=s,i=!1;do{const r=e.prev,n=e.next.next;ro(r,e,e.next,n,!1)&&Ve(r,n)&&Ve(n,r)&&(t.push(r.i,e.i,n.i),$e(e),$e(e.next),e=s=n,i=!0),e=e.next}while(e!==s);return i?ie(e):e}function Fh(s,t,e,i,r){let n=s;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&jh(n,o)){let a=no(n,o);n=ie(n,n.next),a=ie(a,a.next),gi(n,t,e,i,r),gi(a,t,e,i,r);return}o=o.next}n=n.next}while(n!==s)}let _i=!1;function Gh(s,t,e,i){const r=[];for(let n=0,o=t.length;n<o;n++){const a=t[n]*i,h=n<o-1?t[n+1]*i:s.length,l=eo(s,a,h,i,!1);l===l.next&&He.add(l),r.push($h(l))}r.sort(Dh),Wh(s.length/i,t.length),io(e,e),_i=!0;for(let n=0;n<r.length;n++)e=Oh(r[n],e);return _i=!1,ie(e)}function Dh(s,t){return s.x-t.x||s.y-t.y||(s.next.y-s.y)/(s.next.x-s.x)-(t.next.y-t.y)/(t.next.x-t.x)}function Oh(s,t){const e=zh(s,t);if(!e)return t;const i=no(e,s),r=i.next;return io(e,r.next),ie(i,i.next),ie(e,e.next)}const so=16;let Z=new Float64Array(0),_s=0;const yi=[],xi=[];function Wh(s,t){const e=Math.ceil((s+2*t)/so)+t+2;Z.length<e*4&&(Z=new Float64Array(e*4)),_s=0}function io(s,t){let e=s;do{const i=_s++;yi[i]=e;let r=1/0,n=1/0,o=-1/0,a=-1/0,h=0;do{const c=e.next;e.z=i,e.x<r&&(r=e.x),e.x>o&&(o=e.x),e.y<n&&(n=e.y),e.y>a&&(a=e.y),c.x<r&&(r=c.x),c.x>o&&(o=c.x),c.y<n&&(n=c.y),c.y>a&&(a=c.y),e=c}while(++h<so&&e!==t);xi[i]=e;const l=i*4;Z[l]=r,Z[l+1]=n,Z[l+2]=o,Z[l+3]=a}while(e!==t)}function Uh(s,t){const e=s.z*4;t.x<Z[e]&&(Z[e]=t.x),t.y<Z[e+1]&&(Z[e+1]=t.y),t.x>Z[e+2]&&(Z[e+2]=t.x),t.y>Z[e+3]&&(Z[e+3]=t.y)}function yr(s){let t=xi[s];for(;t.prev.next!==t;)t=t.next;return xi[s]=t,t}function xr(s){let t=yi[s];for(;t.prev.next!==t;)t=t.next;return yi[s]=t,t}function zh(s,t){let e=t;const i=s.x,r=s.y;let n=-1/0,o;if(Ne(s,e))return e;for(let f=0,d=0;f<_s;f++,d+=4){if(r<Z[d+1]||r>Z[d+3]||Z[d]>i||Z[d+2]<=n)continue;const p=yr(f);e=xr(f);do{if(e.prev.next===e){if(Ne(s,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){const g=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(g<=i&&g>n&&(n=g,o=e.x<e.next.x?e:e.next,g===i))return o}}e=e.next}while(e!==p)}if(!o)return null;const a=o.x,h=o.y,l=Math.min(r,h),c=Math.max(r,h);let u=1/0;for(let f=0,d=0;f<_s;f++,d+=4){if(Z[d+2]<a||Z[d]>i||Z[d+3]<l||Z[d+1]>c)continue;const p=yr(f);e=xr(f);do{if(e.prev.next===e&&i>=e.x&&e.x>=a&&i!==e.x&&ys(r<h?i:n,r,a,h,r<h?n:i,r,e.x,e.y)){const g=Math.abs(r-e.y)/(i-e.x);(Ve(e,s)||e.y===r&&e.next.y===r&&e.next.x>i)&&(g<u||g===u&&(e.x>o.x||e.x===o.x&&Hh(o,e)))&&(o=e,u=g)}e=e.next}while(e!==p)}return o}function Hh(s,t){return st(s.prev,s,t.prev)<0&&st(t.next,s,s.next)<0}const xt=[];let ke=[],jt=new Uint32Array(0),Ee=new Uint32Array(0);const Ie=new Uint32Array(256);function Nh(s,t,e,i){let r=s,n=0;do r.z=bi(r.x,r.y,t,e,i),xt[n++]=r,r=r.next;while(r!==s);Vh(n);let o=null;for(let a=0;a<n;a++){const h=xt[a];h.prevZ=o,o&&(o.nextZ=h),o=h}o.nextZ=null}function Vh(s){if(s<=32){for(let t=1;t<s;t++){const e=xt[t],i=e.z;let r=t-1;for(;r>=0&&xt[r].z>i;)xt[r+1]=xt[r],r--;xt[r+1]=e}return}jt.length<s&&(jt=new Uint32Array(s),Ee=new Uint32Array(s),ke=new Array(s));for(let t=0;t<s;t++)jt[t]=xt[t].z;os(s,xt,jt,ke,Ee,0),os(s,ke,Ee,xt,jt,8),os(s,xt,jt,ke,Ee,16),os(s,ke,Ee,xt,jt,24)}function os(s,t,e,i,r,n){Ie.fill(0);for(let a=0;a<s;a++)Ie[e[a]>>>n&255]++;let o=0;for(let a=0;a<256;a++){const h=Ie[a];Ie[a]=o,o+=h}for(let a=0;a<s;a++){const h=e[a],l=Ie[h>>>n&255]++;i[l]=t[a],r[l]=h}}function bi(s,t,e,i,r){return s=(s-e)*r|0,t=(t-i)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function $h(s){let t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function ys(s,t,e,i,r,n,o,a){return(r-o)*(t-a)>=(s-o)*(n-a)&&(s-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(r-o)*(i-a)}function jh(s,t){const e=Ne(s,t)&&st(s.prev,s,s.next)>0&&st(t.prev,t,t.next)>0;return s.next.i!==t.i&&(e||Ve(s,t)&&Ve(t,s)&&(st(s.prev,s,t.prev)!==0||st(s,t.prev,t)!==0))&&!Yh(s,t)&&(e||Xh(s,t))}function st(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function Ne(s,t){return s.x===t.x&&s.y===t.y}function ro(s,t,e,i,r=!0){const n=st(s,t,e),o=st(s,t,i),a=st(e,i,s),h=st(e,i,t);return(n>0&&o<0||n<0&&o>0)&&(a>0&&h<0||a<0&&h>0)?!0:r?!!(n===0&&as(s,e,t)||o===0&&as(s,i,t)||a===0&&as(e,s,i)||h===0&&as(e,t,i)):!1}function as(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Yh(s,t){const e=Math.min(s.x,t.x),i=Math.max(s.x,t.x),r=Math.min(s.y,t.y),n=Math.max(s.y,t.y);let o=s;do{const a=o.next;if(o.x>i&&a.x>i||o.x<e&&a.x<e||o.y>n&&a.y>n||o.y<r&&a.y<r){o=a;continue}if(o.i!==s.i&&a.i!==s.i&&o.i!==t.i&&a.i!==t.i&&ro(o,a,s,t))return!0;o=a}while(o!==s);return!1}function Ve(s,t){return st(s.prev,s,s.next)<0?st(s,t,s.next)>=0&&st(s,s.prev,t)>=0:st(s,t,s.prev)<0||st(s,s.next,t)<0}function Xh(s,t){let e=s,i=!1;const r=(s.x+t.x)/2,n=(s.y+t.y)/2;do{const o=e.next;e.y>n!=o.y>n&&r<(o.x-e.x)*(n-e.y)/(o.y-e.y)+e.x&&(i=!i),e=o}while(e!==s);return i}function no(s,t){const e=wi(s.i,s.x,s.y),i=wi(t.i,t.x,t.y),r=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function br(s,t,e,i){const r=wi(s,t,e);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function $e(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ),_i&&Uh(s.prev,s.next)}function wi(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function qh(s,t,e,i){let r=0;for(let n=t,o=e-i;n<e;n+=i)r+=(s[o]-s[n])*(s[n+1]+s[o+1]),o=n;return r}const Kh=_r.default||_r;var oo=(s=>(s[s.NONE=0]="NONE",s[s.COLOR=16384]="COLOR",s[s.STENCIL=1024]="STENCIL",s[s.DEPTH=256]="DEPTH",s[s.COLOR_DEPTH=16640]="COLOR_DEPTH",s[s.COLOR_STENCIL=17408]="COLOR_STENCIL",s[s.DEPTH_STENCIL=1280]="DEPTH_STENCIL",s[s.ALL=17664]="ALL",s))(oo||{});class Qh{constructor(t){this.items=[],this._name=t}emit(t,e,i,r,n,o,a,h){const{name:l,items:c}=this;for(let u=0,f=c.length;u<f;u++)c[u][l](t,e,i,r,n,o,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}const Zh=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],ao=class ho extends ft{constructor(t){super(),this.tick=0,this.uid=J("renderer"),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const e=[...Zh,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Eh(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash)t={...this._systemsHash[i].constructor.defaultOptions,...t};t={...ho.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){this.tick++;let i=t;if(i instanceof Ut&&(i={container:i},e&&(X(_t,"passing a second argument is deprecated, please use render options instead"),i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor??(i.clearColor=this.background.colorRgba),i.clear??(i.clear=this.background.clearBeforeRender)),i.clearColor){const r=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=r?i.clearColor:q.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),i.container.visible&&(i.container.enableRenderGroup(),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i))}resize(t,e,i){const r=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==r&&this.runners.resolutionChange.emit(i)}clear(t={}){const e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=oo.ALL);const{clear:i,clearColor:r,target:n,mipLevel:o,layer:a}=t;q.shared.setValue(r??this.background.colorRgba),e.renderTarget.clear(n,i,q.shared.toArray(),o??0,a??0)}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Qh(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const r in this.runners)this.runners[r].add(i);return this}_addPipes(t,e){const i=e.reduce((r,n)=>(r[n.name]=n.value,r),{});t.forEach(r=>{const n=r.value,o=r.name,a=i[o];this.renderPipes[o]=new n(this,a?new a:null),this.runners.destroy.add(this.renderPipes[o])})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),(t===!0||typeof t=="object"&&t.releaseGlobalResources)&&Qe.release(),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null,this.removeAllListeners()}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Ih())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}resetState(){this.runners.resetState.emit()}};ao.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let lo=ao,hs;function Jh(s){return hs!==void 0||(hs=(()=>{var e;const t={stencil:!0,failIfMajorPerformanceCaveat:s??lo.defaultOptions.failIfMajorPerformanceCaveat};try{if(!z.get().getWebGLRenderingContext())return!1;let r=z.get().createCanvas().getContext("webgl",t);const n=!!((e=r==null?void 0:r.getContextAttributes())!=null&&e.stencil);if(r){const o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,n}catch{return!1}})()),hs}let ls;async function tl(s={}){return ls!==void 0||(ls=await(async()=>{const t=z.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(s)).requestDevice(),!0}catch{return!1}})()),ls}const wr=["webgl","webgpu","canvas"];async function el(s){let t=[];s.preference?Array.isArray(s.preference)?t=s.preference.slice():(t.push(s.preference),wr.forEach(n=>{n!==s.preference&&t.push(n)})):t=wr.slice();let e,i={};for(let n=0;n<t.length;n++){const o=t[n];if(o==="webgpu"&&await tl()){const{WebGPURenderer:a}=await pe(async()=>{const{WebGPURenderer:h}=await import("./WebGPURenderer-Ddwua8JA.js");return{WebGPURenderer:h}},__vite__mapDeps([3,4,2,5]));e=a,i={...s,...s.webgpu};break}else if(o==="webgl"&&Jh(s.failIfMajorPerformanceCaveat??lo.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:a}=await pe(async()=>{const{WebGLRenderer:h}=await import("./WebGLRenderer-CdpFaPwH.js");return{WebGLRenderer:h}},__vite__mapDeps([6,4,2,5]));e=a,i={...s,...s.webgl};break}else if(o==="canvas"){const{CanvasRenderer:a}=await pe(async()=>{const{CanvasRenderer:h}=await import("./CanvasRenderer-Yf_04ykh.js");return{CanvasRenderer:h}},__vite__mapDeps([7,5,2]));e=a,i={...s,...s.canvasOptions};break}}if(delete i.webgpu,delete i.webgl,delete i.canvasOptions,!e)throw new Error("No available renderer for the current environment");const r=new e;return await r.init(i),r}const co="8.19.0";class uo{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,co)}static destroy(){}}uo.extension=I.Application;class sl{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,co)}destroy(){this._renderer=null}}sl.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"initHook",priority:-10};class fo{static init(t){Object.defineProperty(this,"resizeTo",{configurable:!0,set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(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=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,i=n}this.renderer.resize(e,i),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}}fo.extension=I.Application;class po{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{configurable:!0,set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,ze.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?dt.shared:new dt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}po.extension=I.Application;K.add(fo);K.add(po);const mo=class vi{constructor(...t){this.stage=new Ut,t[0]!==void 0&&X(_t,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.stage||(this.stage=new Ut),this.renderer=await el(t),vi._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(_t,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}get domContainerRoot(){var t;return(t=this.renderer.renderPipes.dom)==null?void 0:t._domElement}destroy(t=!1,e=!1){const i=vi._plugins.slice(0);i.reverse(),i.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};mo._plugins=[];let go=mo;K.handleByList(I.Application,go._plugins);K.add(uo);const Xs={test(s){return typeof s=="string"&&s.startsWith("info face=")},parse(s){const t=s.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const u in t){const f=t[u].match(/^[a-z]+/gm)[0],d=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(const g in d){const m=d[g].split("="),_=m[0],y=m[1].replace(/"/gm,""),x=parseFloat(y),w=isNaN(x)?y:x;p[_]=w}e[f].push(p)}const i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[r]=e.info,[n]=e.common,[o]=e.distanceField??[];o&&(i.distanceField={range:parseInt(o.distanceRange,10),type:o.fieldType}),i.fontSize=parseInt(r.size,10),i.fontFamily=r.face,i.lineHeight=parseInt(n.lineHeight,10);const a=e.page;for(let u=0;u<a.length;u++)i.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});const h={};i.baseLineOffset=i.lineHeight-parseInt(n.base,10);const l=e.char;for(let u=0;u<l.length;u++){const f=l[u],d=parseInt(f.id,10);let p=f.letter??f.char??String.fromCharCode(d);p==="space"&&(p=" "),h[d]=p,i.chars[p]={id:d,page:parseInt(f.page,10)||0,x:parseInt(f.x,10),y:parseInt(f.y,10),width:parseInt(f.width,10),height:parseInt(f.height,10),xOffset:parseInt(f.xoffset,10),yOffset:parseInt(f.yoffset,10),xAdvance:parseInt(f.xadvance,10),kerning:{}}}const c=e.kerning||[];for(let u=0;u<c.length;u++){const f=parseInt(c[u].first,10),d=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);i.chars[h[d]]&&(i.chars[h[d]].kerning[h[f]]=p)}return i}},vr={test(s){const t=s;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(s){const t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=s.getElementsByTagName("info")[0],i=s.getElementsByTagName("common")[0],r=s.getElementsByTagName("distanceField")[0];r&&(t.distanceField={type:r.getAttribute("fieldType"),range:parseInt(r.getAttribute("distanceRange"),10)});const n=s.getElementsByTagName("page"),o=s.getElementsByTagName("char"),a=s.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(i.getAttribute("lineHeight"),10);for(let l=0;l<n.length;l++)t.pages.push({id:parseInt(n[l].getAttribute("id"),10)||0,file:n[l].getAttribute("file")});const h={};t.baseLineOffset=t.lineHeight-parseInt(i.getAttribute("base"),10);for(let l=0;l<o.length;l++){const c=o[l],u=parseInt(c.getAttribute("id"),10);let f=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);f==="space"&&(f=" "),h[u]=f,t.chars[f]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){const c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),f=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]]&&(t.chars[h[u]].kerning[h[c]]=f)}return t}},Ar={test(s){return typeof s=="string"&&s.match(/<font(\s|>)/)?vr.test(z.get().parseXML(s)):!1},parse(s){return vr.parse(z.get().parseXML(s))}},il=[".xml",".fnt"],rl={extension:{type:I.CacheParser,name:"cacheBitmapFont"},test:s=>!!(s!=null&&s.pages)&&!!(s!=null&&s.chars)&&typeof(s==null?void 0:s.fontFamily)=="string"&&s.fontFamily!=="",getCacheableAssets(s,t){const e={};return s.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},nl={extension:{type:I.LoadParser,priority:Gt.Normal},name:"loadBitmapFont",id:"bitmap-font",test(s){return il.includes(at.extname(s).toLowerCase())},async testParse(s){return Xs.test(s)||Ar.test(s)},async parse(s,t,e){const i=Xs.test(s)?Xs.parse(s):Ar.parse(s),{src:r}=t,{pages:n}=i,o=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let f=0;f<n.length;++f){const d=n[f].file;let p=at.join(at.dirname(r),d);p=ui(p,r),o.push({src:p,data:a})}const[h,{BitmapFont:l}]=await Promise.all([e.load(o),pe(()=>import("./BitmapFont-CoN36Cy_.js"),[])]),c=o.map(f=>h[f.src]);return new l({data:i,textures:c},r)},async load(s,t){return await(await z.get().fetch(s)).text()},async unload(s,t,e){await Promise.all(s.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),s.destroy()}};class ol{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const 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())}}const al={extension:{type:I.CacheParser,name:"cacheTextureArray"},test:s=>Array.isArray(s)&&s.every(t=>t instanceof U),getCacheableAssets:(s,t)=>{const e={};return s.forEach(i=>{t.forEach((r,n)=>{e[i+(n===0?"":n+1)]=r})}),e}};async function _o(s){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=s});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(s)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}const hl={extension:{type:I.DetectionParser,priority:1},test:async()=>_o("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async s=>[...s,"avif"],remove:async s=>s.filter(t=>t!=="avif")},Sr=["png","jpg","jpeg"],ll={extension:{type:I.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async s=>[...s,...Sr],remove:async s=>s.filter(t=>!Sr.includes(t))},cl="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ks(s){return cl?!1:document.createElement("video").canPlayType(s)!==""}const ul={extension:{type:I.DetectionParser,priority:0},test:async()=>ks("video/mp4"),add:async s=>[...s,"mp4","m4v"],remove:async s=>s.filter(t=>t!=="mp4"&&t!=="m4v")},dl={extension:{type:I.DetectionParser,priority:0},test:async()=>ks("video/ogg"),add:async s=>[...s,"ogv"],remove:async s=>s.filter(t=>t!=="ogv")},fl={extension:{type:I.DetectionParser,priority:0},test:async()=>ks("video/webm"),add:async s=>[...s,"webm"],remove:async s=>s.filter(t=>t!=="webm")},pl={extension:{type:I.DetectionParser,priority:0},test:async()=>_o("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async s=>[...s,"webp"],remove:async s=>s.filter(t=>t!=="webp")},yo=class ms{constructor(){this.loadOptions={...ms.defaultOptions},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){const i={promise:null,parser:null};return i.promise=(async()=>{var o,a;let r=null,n=null;if((e.parser||e.loadParser)&&(n=this._parserHash[e.parser||e.loadParser],e.loadParser&&Y(`[Assets] "loadParser" is deprecated, use "parser" instead for ${t}`),n||Y(`[Assets] specified load parser "${e.parser||e.loadParser}" not found while loading ${t}`)),!n){for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];if(l.load&&((o=l.test)!=null&&o.call(l,t,e,this))){n=l;break}}if(!n)return Y(`[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 n.load(t,e,this),i.parser=n;for(let h=0;h<this.parsers.length;h++){const l=this.parsers[h];l.parse&&l.parse&&await((a=l.testParse)==null?void 0:a.call(l,r,e,this))&&(r=await l.parse(r,e,this)||r,i.parser=l)}return r})(),i}async load(t,e){this._parsersValidated||this._validateParsers();const i=typeof e=="function"?{...ms.defaultOptions,...this.loadOptions,onProgress:e}:{...ms.defaultOptions,...this.loadOptions,...e||{}},{onProgress:r,onError:n,strategy:o,retryCount:a,retryDelay:h}=i;let l=0;const c={},u=gs(t),f=Tt(t,g=>({alias:[g],src:g,data:{}})),d=f.reduce((g,m)=>g+(m.progressSize||1),0),p=f.map(async g=>{const m=at.toAbsolute(g.src);c[g.src]||(await this._loadAssetWithRetry(m,g,{onProgress:r,onError:n,strategy:o,retryCount:a,retryDelay:h},c),l+=g.progressSize||1,r&&r(l/d))});return await Promise.all(p),u?c[f[0].src]:c}async unload(t){const i=Tt(t,r=>({alias:[r],src:r})).map(async r=>{var a,h;const n=at.toAbsolute(r.src),o=this.promiseCache[n];if(o){const l=await o.promise;delete this.promiseCache[n],await((h=(a=o.parser)==null?void 0:a.unload)==null?void 0:h.call(a,l,r,this))}});await Promise.all(i)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name||t.id).reduce((t,e)=>(!e.name&&!e.id?Y("[Assets] parser should have an id"):(t[e.name]||t[e.id])&&Y(`[Assets] parser id conflict "${e.id}"`),t[e.name]=e,e.id&&(t[e.id]=e),t),{})}async _loadAssetWithRetry(t,e,i,r){let n=0;const{onError:o,strategy:a,retryCount:h,retryDelay:l}=i,c=u=>new Promise(f=>setTimeout(f,u));for(;;)try{this.promiseCache[t]||(this.promiseCache[t]=this._getLoadPromiseAndParser(t,e)),r[e.src]=await this.promiseCache[t].promise;return}catch(u){delete this.promiseCache[t],delete r[e.src],n++;const f=a!=="retry"||n>h;if(a==="retry"&&!f){o&&o(u,e),await c(l);continue}if(a==="skip"){o&&o(u,e);return}o&&o(u,e);const d=new Error(`[Loader.load] Failed to load ${t}. -${u}`);throw u instanceof Error&&u.stack&&(d.stack=u.stack),d}}};yo.defaultOptions={onProgress:void 0,onError:void 0,strategy:"throw",retryCount:3,retryDelay:250};let ml=yo;function Ae(s,t){if(Array.isArray(t)){for(const e of t)if(s.startsWith(`data:${e}`))return!0;return!1}return s.startsWith(`data:${t}`)}function Se(s,t){const e=s.split("?")[0],i=at.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const gl=".json",_l="application/json",yl={extension:{type:I.LoadParser,priority:Gt.Low},name:"loadJson",id:"json",test(s){return Ae(s,_l)||Se(s,gl)},async load(s){return await(await z.get().fetch(s)).json()}},xl=".txt",bl="text/plain",wl={name:"loadTxt",id:"text",extension:{type:I.LoadParser,priority:Gt.Low,name:"loadTxt"},test(s){return Ae(s,bl)||Se(s,xl)},async load(s){return await(await z.get().fetch(s)).text()}},vl=["normal","bold","100","200","300","400","500","600","700","800","900"],Al=[".ttf",".otf",".woff",".woff2"],Sl=["font/ttf","font/otf","font/woff","font/woff2"],Cl=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Tl(s){const t=at.extname(s),r=at.basename(s,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1));let n=r.length>0;for(const a of r)if(!a.match(Cl)){n=!1;break}let o=r.join(" ");return n||(o=`"${o.replace(/[\\"]/g,"\\$&")}"`),o}const Pl=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Ml(s){return Pl.test(s)?s:encodeURI(s)}const kl={extension:{type:I.LoadParser,priority:Gt.Low},name:"loadWebFont",id:"web-font",test(s){return Ae(s,Sl)||Se(s,Al)},async load(s,t){var i,r,n;const e=z.get().getFontFaceSet();if(e){const o=[],a=((i=t.data)==null?void 0:i.family)??Tl(s),h=((n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(c=>vl.includes(c)))??["normal"],l=t.data??{};for(let c=0;c<h.length;c++){const u=h[c],f=new FontFace(a,`url('${Ml(s)}')`,{...l,weight:u});await f.load(),e.add(f),o.push(f)}return nt.has(`${a}-and-url`)?nt.get(`${a}-and-url`).entries.push({url:s,faces:o}):nt.set(`${a}-and-url`,{entries:[{url:s,faces:o}]}),o.length===1?o[0]:o}return Y("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(s){const t=Array.isArray(s)?s:[s],e=t[0].family,i=nt.get(`${e}-and-url`),r=i.entries.find(n=>n.faces.some(o=>t.indexOf(o)!==-1));r.faces=r.faces.filter(n=>t.indexOf(n)===-1),r.faces.length===0&&(i.entries=i.entries.filter(n=>n!==r)),t.forEach(n=>{z.get().getFontFaceSet().delete(n)}),i.entries.length===0&&nt.remove(`${e}-and-url`)}},qs={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},El=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Il=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function Rl(s){const t=[];return s.replace(El,(e,i,r)=>{let n=i.toLowerCase(),o=i;const a=Ll(r);for(n==="m"&&a.length>2&&(t.push([o,...a.splice(0,2)]),n="l",o=o==="m"?"l":"L");;){if(a.length===qs[n])return t.push([o,...a]),"";if(a.length<qs[n])throw new Error("malformed path data");t.push([o,...a.splice(0,qs[n])])}}),t}function Ll(s){const t=s.match(Il);return t?t.map(Number):[]}function Bl(s,t){const e=Rl(s),i=[];let r=null,n=0,o=0;for(let a=0;a<e.length;a++){const h=e[a],l=h[0],c=h;switch(l){case"M":n=c[1],o=c[2],t.moveTo(n,o);break;case"m":n+=c[1],o+=c[2],t.moveTo(n,o);break;case"H":n=c[1],t.lineTo(n,o);break;case"h":n+=c[1],t.lineTo(n,o);break;case"V":o=c[1],t.lineTo(n,o);break;case"v":o+=c[1],t.lineTo(n,o);break;case"L":n=c[1],o=c[2],t.lineTo(n,o);break;case"l":n+=c[1],o+=c[2],t.lineTo(n,o);break;case"C":n=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,o);break;case"c":t.bezierCurveTo(n+c[1],o+c[2],n+c[3],o+c[4],n+c[5],o+c[6]),n+=c[5],o+=c[6];break;case"S":n=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],n,o);break;case"s":t.bezierCurveToShort(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"Q":n=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],n,o);break;case"q":t.quadraticCurveTo(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"T":n=c[1],o=c[2],t.quadraticCurveToShort(n,o);break;case"t":n+=c[1],o+=c[2],t.quadraticCurveToShort(n,o);break;case"A":n=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"a":n+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"Z":case"z":t.closePath(),i.length>0&&(r=i.pop(),r?(n=r.startX,o=r.startY):(n=0,o=0)),r=null;break;default:Y(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&r===null&&(r={startX:n,startY:o},i.push(r))}return t}class Gi{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Gi(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=i}strokeContains(t,e,i,r=.5){if(this.radius===0)return!1;const n=this.x-t,o=this.y-e,a=this.radius,h=(1-r)*i,l=Math.sqrt(n*n+o*o);return l<=a+h&&l>a-(i-h)}getBounds(t){return t||(t=new tt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class Di{constructor(t=0,e=0,i=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=r}clone(){return new Di(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1}strokeContains(t,e,i,r=.5){const{halfWidth:n,halfHeight:o}=this;if(n<=0||o<=0)return!1;const a=i*(1-r),h=i-a,l=n-h,c=o-h,u=n+a,f=o+a,d=t-this.x,p=e-this.y,g=d*d/(l*l)+p*p/(c*c),m=d*d/(u*u)+p*p/(f*f);return g>1&&m<=1}getBounds(t){return t||(t=new tt),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function Fl(s,t,e,i,r,n){const o=s-e,a=t-i,h=r-e,l=n-i,c=o*h+a*l,u=h*h+l*l;let f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=i):f>1?(d=r,p=n):(d=e+f*h,p=i+f*l);const g=s-d,m=t-p;return g*g+m*m}let Gl,Dl;class Oe{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let r=0,n=e.length;r<n;r++)i.push(e[r].x,e[r].y);e=i}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,i=e.length;for(let r=0;r<i;r+=2){const n=e[r],o=e[r+1],a=e[(r+2)%i],h=e[(r+3)%i];t+=(a-n)*(h+o)}return t<0}containsPolygon(t){const e=this.getBounds(Gl),i=t.getBounds(Dl);if(!e.containsRect(i))return!1;const r=t.points;for(let n=0;n<r.length;n+=2){const o=r[n],a=r[n+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new Oe(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const r=this.points.length/2;for(let n=0,o=r-1;n<r;o=n++){const a=this.points[n*2],h=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(i=!i)}return i}strokeContains(t,e,i,r=.5){const n=i*i,o=n*(1-r),a=n-o,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){const u=h[c],f=h[c+1],d=h[(c+2)%h.length],p=h[(c+3)%h.length],g=Fl(t,e,u,f,d,p),m=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(g<=(m<0?a:o))return!0}return!1}getBounds(t){t||(t=new tt);const e=this.points;let i=1/0,r=-1/0,n=1/0,o=-1/0;for(let a=0,h=e.length;a<h;a+=2){const l=e[a],c=e[a+1];i=l<i?l:i,r=l>r?l:r,n=c<n?c:n,o=c>o?c:o}return t.x=i,t.width=r-i,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return X("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return X("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const cs=(s,t,e,i,r,n,o)=>{const a=s-e,h=t-i,l=Math.sqrt(a*a+h*h);return l>=r-n&&l<=r+o};class Oi{constructor(t=0,e=0,i=0,r=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=r,this.radius=n}getBounds(t){return t||(t=new tt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Oi(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let r=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(r*r+n*n<=o||(r=t-(this.x+this.width-i),r*r+n*n<=o)||(n=e-(this.y+this.height-i),r*r+n*n<=o)||(r=t-(this.x+i),r*r+n*n<=o))return!0}return!1}strokeContains(t,e,i,r=.5){const{x:n,y:o,width:a,height:h,radius:l}=this,c=i*(1-r),u=i-c,f=n+l,d=o+l,p=a-l*2,g=h-l*2,m=n+a,_=o+h;return(t>=n-c&&t<=n+u||t>=m-u&&t<=m+c)&&e>=d&&e<=d+g||(e>=o-c&&e<=o+u||e>=_-u&&e<=_+c)&&t>=f&&t<=f+p?!0:t<f&&e<d&&cs(t,e,f,d,l,u,c)||t>m-l&&e<d&&cs(t,e,m-l,d,l,u,c)||t>m-l&&e>_-l&&cs(t,e,m-l,_-l,l,u,c)||t<f&&e>_-l&&cs(t,e,f,_-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const xo={};function Ol(s,t,e){let i=2166136261;for(let r=0;r<t;r++)i^=s[r].uid,i=Math.imul(i,16777619),i>>>=0;return xo[i]||Wl(s,t,i,e)}function Wl(s,t,e,i){const r={};let n=0;for(let a=0;a<i;a++){const h=a<t?s[a]:U.EMPTY.source;r[n++]=h.source,r[n++]=h.style}const o=new ps(r);return xo[e]=o,o}class Cr{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}function Tr(s,t,e,i){if(e??(e=0),i??(i=Math.min(s.byteLength-e,t.byteLength)),!(e&7)&&!(i&7)){const r=i/8;new Float64Array(t,0,r).set(new Float64Array(s,e,r))}else if(!(e&3)&&!(i&3)){const r=i/4;new Float32Array(t,0,r).set(new Float32Array(s,e,r))}else new Uint8Array(t).set(new Uint8Array(s,e,i))}const Ul={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var zl=(s=>(s[s.DISABLED=0]="DISABLED",s[s.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",s[s.MASK_ACTIVE=2]="MASK_ACTIVE",s[s.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",s[s.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",s[s.NONE=5]="NONE",s))(zl||{});function Pr(s,t){return t.alphaMode==="no-premultiply-alpha"&&Ul[s]||s}const Hl=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` -`);function Nl(s){let t="";for(let e=0;e<s;++e)e>0&&(t+=` -else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function Vl(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const i=Hl.replace(/%forloop%/gi,Nl(s));if(t.shaderSource(e,i),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}}finally{t.deleteShader(e)}return s}let oe=null;function $l(){var t;if(oe)return oe;const s=Xn();return oe=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),oe=Vl(oe,s),(t=s.getExtension("WEBGL_lose_context"))==null||t.loseContext(),oe}class jl{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}class Yl{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new jl,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const We=[];let xs=0;Qe.register({clear:()=>{if(We.length>0)for(const s of We)s&&s.destroy();We.length=0,xs=0}});function Mr(){return xs>0?We[--xs]:new Yl}function kr(s){s.elements=null,We[xs++]=s}let Re=0;const bo=class wo{constructor(t){this.uid=J("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...wo.defaultOptions,...t},t.maxTextures||(X("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=$l());const{maxTextures:e,attributesInitialSize:i,indicesInitialSize:r}=t;this.attributeBuffer=new Cr(i*4),this.indexBuffer=new Uint16Array(r),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)kr(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let i=Mr(),r=i.textures;r.clear();const n=e[this.elementStart];let o=Pr(n.blendMode,n.texture._source),a=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",p=[];const g=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const _=e[m];e[m]=null;const x=_.texture._source,w=Pr(_.blendMode,x),v=o!==w||a!==_.topology;if(x._batchTick===Re&&!v){_._textureId=x._textureBindLocation,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,h,l,_._attributeStart,_._textureId),this.packQuadIndex(c,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,h,l,_._attributeStart,_._textureId),this.packIndex(_,c,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=i,p.push(_);continue}x._batchTick=Re,(r.count>=g||v)&&(this._finishBatch(i,f,u-f,r,o,a,t,d,p),d="renderBatch",f=u,o=w,a=_.topology,i=Mr(),r=i.textures,r.clear(),p=[],++Re),_._textureId=x._textureBindLocation=r.count,r.ids[x.uid]=r.count,r.textures[r.count++]=x,_._batch=i,p.push(_),u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,h,l,_._attributeStart,_._textureId),this.packQuadIndex(c,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,h,l,_._attributeStart,_._textureId),this.packIndex(_,c,_._indexStart,_._attributeStart/this.vertexSize))}r.count>0&&(this._finishBatch(i,f,u-f,r,o,a,t,d,p),f=u,++Re),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u}_finishBatch(t,e,i,r,n,o,a,h,l){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=r,t.blendMode=n,t.topology=o,t.start=e,t.size=i,t.elements=l,++Re,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new Cr(e);Tr(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const r=i>65535?new Uint32Array(i):new Uint16Array(i);if(r.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)r[n]=e[n];else Tr(e.buffer,r.buffer);this.indexBuffer=r}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,r){const n=t.indices,o=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<o;l++)e[i++]=r+n[l+a]-h}destroy(t={}){var e;if(this.batches!==null){for(let i=0;i<this.batchIndex;i++)kr(this.batches[i]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&((e=this.shader)==null||e.destroy(),this.shader=null);for(let i=0;i<this._elements.length;i++)this._elements[i]&&(this._elements[i]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};bo.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Xl=bo;var pt=(s=>(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(pt||{});class je extends ft{constructor(t){let{data:e,size:i}=t;const{usage:r,label:n,shrinkToFit:o}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=J("buffer"),this._resourceType="buffer",this._resourceId=J("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i??(i=e==null?void 0:e.byteLength);const a=!!e;this.descriptor={size:i,usage:r,mappedAtCreation:a,label:n},this.shrinkToFit=o??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&pt.STATIC)}set static(t){t?this.descriptor.usage|=pt.STATIC:this.descriptor.usage&=~pt.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const r=this._data;if(this._data=t,this._dataInt32=null,!r||r.length!==t.length){!this.shrinkToFit&&r&&t.byteLength<r.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=J("resource"),this.emit("change",this));return}i&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function vo(s,t){if(!(s instanceof je)){let e=t?pt.INDEX:pt.VERTEX;s instanceof Array&&(t?(s=new Uint32Array(s),e=pt.INDEX|pt.COPY_DST):(s=new Float32Array(s),e=pt.VERTEX|pt.COPY_DST)),s=new je({data:s,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return s}function ql(s,t,e){const i=s.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const r=i.buffer.data;let n=1/0,o=1/0,a=-1/0,h=-1/0;const l=r.BYTES_PER_ELEMENT,c=(i.offset||0)/l,u=(i.stride||8)/l;for(let f=c;f<r.length;f+=u){const d=r[f],p=r[f+1];d>a&&(a=d),p>h&&(h=p),d<n&&(n=d),p<o&&(o=p)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=h,e}function Kl(s){return(s instanceof je||Array.isArray(s)||s.BYTES_PER_ELEMENT)&&(s={buffer:s}),s.buffer=vo(s.buffer,!1),s}class Ql extends ft{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=J("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new vt,this._boundsDirty=!0;const{attributes:e,indexBuffer:i,topology:r}=t;if(this.buffers=[],this.attributes={},e)for(const n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,i&&this.addIndex(i),this.topology=r||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const i=Kl(e);this.buffers.indexOf(i.buffer)===-1&&(this.buffers.push(i.buffer),i.buffer.on("update",this.onBufferUpdate,this),i.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=i}addIndex(t){this.indexBuffer=vo(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,ql(this,"aPosition",this._bounds)):this._bounds}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(i=>i.destroy()),this.unload(),(e=this.indexBuffer)==null||e.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Zl=new Float32Array(1),Jl=new Uint32Array(1);class tc extends Ql{constructor(){const e=new je({data:Zl,label:"attribute-batch-buffer",usage:pt.VERTEX|pt.COPY_DST,shrinkToFit:!1}),i=new je({data:Jl,label:"index-batch-buffer",usage:pt.INDEX|pt.COPY_DST,shrinkToFit:!1}),r=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:r,offset:0},aUV:{buffer:e,format:"float32x2",stride:r,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:r,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:r,offset:20}},indexBuffer:i})}}function Er(s,t,e){if(s)for(const i in s){const r=i.toLocaleLowerCase(),n=t[r];if(n){let o=s[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}else Y(`${i} placement hook does not exist in shader`)}}const ec=/\{\{(.*?)\}\}/g;function Ir(s){var i;const t={};return(((i=s.match(ec))==null?void 0:i.map(r=>r.replace(/[{()}]/g,"")))??[]).forEach(r=>{t[r]=[]}),t}function Rr(s,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function Lr(s,t,e=!1){const i=[];Rr(t,i),s.forEach(a=>{a.header&&Rr(a.header,i)});const r=i;e&&r.sort();const n=r.map((a,h)=>` @location(${h}) ${a},`).join(` -`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",` -${n} -`),o}function Br(s,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(s))!==null;)t.push(e[1])}function sc(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function ic(s){const t=/@.*?\s+/g;return s.replace(t,"")}function rc(s,t){const e=[];Br(t,e),s.forEach(h=>{h.header&&Br(h.header,e)});let i=0;const r=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${i++}) ${h}`).join(`, -`),n=e.sort().map(h=>` var ${ic(h)};`).join(` -`),o=`return VSOutput( - ${e.sort().map(h=>` ${sc(h)}`).join(`, -`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",` -${r} -`),a=a.replace("{{start}}",` -${n} -`),a=a.replace("{{return}}",` -${o} -`),a}function Fr(s,t){let e=s;for(const i in t){const r=t[i];r.join(` -`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----// -${r.join(` -`)} -//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const Wt=Object.create(null),Ks=new Map;let nc=0;function oc({template:s,bits:t}){const e=Ao(s,t);if(Wt[e])return Wt[e];const{vertex:i,fragment:r}=hc(s,t);return Wt[e]=So(i,r,t),Wt[e]}function ac({template:s,bits:t}){const e=Ao(s,t);return Wt[e]||(Wt[e]=So(s.vertex,s.fragment,t)),Wt[e]}function hc(s,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let r=Lr(e,s.vertex,!0);r=rc(e,r);const n=Lr(i,s.fragment,!0);return{vertex:r,fragment:n}}function Ao(s,t){return t.map(e=>(Ks.has(e)||Ks.set(e,nc++),Ks.get(e))).sort((e,i)=>e-i).join("-")+s.vertex+s.fragment}function So(s,t,e){const i=Ir(s),r=Ir(t);return e.forEach(n=>{Er(n.vertex,i,n.name),Er(n.fragment,r,n.name)}),{vertex:Fr(s,i),fragment:Fr(t,r)}}const lc=` - @in aPosition: vec2<f32>; - @in aUV: vec2<f32>; - - @out @builtin(position) vPosition: vec4<f32>; - @out vUV : vec2<f32>; - @out vColor : vec4<f32>; - - {{header}} - - struct VSOutput { - {{struct}} - }; - - @vertex - fn main( {{in}} ) -> VSOutput { - - var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; - var modelMatrix = mat3x3<f32>( - 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0 - ); - var position = aPosition; - var uv = aUV; - - {{start}} - - vColor = vec4<f32>(1., 1., 1., 1.); - - {{main}} - - vUV = uv; - - var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; - - vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0); - - vColor *= globalUniforms.uWorldColorAlpha; - - {{end}} - - {{return}} - }; -`,cc=` - @in vUV : vec2<f32>; - @in vColor : vec4<f32>; - - {{header}} - - @fragment - fn main( - {{in}} - ) -> @location(0) vec4<f32> { - - {{start}} - - var outColor:vec4<f32>; - - {{main}} - - var finalColor:vec4<f32> = outColor * vColor; - - {{end}} - - return finalColor; - }; -`,uc=` - in vec2 aPosition; - in vec2 aUV; - - out vec4 vColor; - out vec2 vUV; - - {{header}} - - void main(void){ - - mat3 worldTransformMatrix = uWorldTransformMatrix; - mat3 modelMatrix = mat3( - 1.0, 0.0, 0.0, - 0.0, 1.0, 0.0, - 0.0, 0.0, 1.0 - ); - vec2 position = aPosition; - vec2 uv = aUV; - - {{start}} - - vColor = vec4(1.); - - {{main}} - - vUV = uv; - - mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix; - - gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); - - vColor *= uWorldColorAlpha; - - {{end}} - } -`,dc=` - - in vec4 vColor; - in vec2 vUV; - - out vec4 finalColor; - - {{header}} - - void main(void) { - - {{start}} - - vec4 outColor; - - {{main}} - - finalColor = outColor * vColor; - - {{end}} - } -`,fc={name:"global-uniforms-bit",vertex:{header:` - struct GlobalUniforms { - uProjectionMatrix:mat3x3<f32>, - uWorldTransformMatrix:mat3x3<f32>, - uWorldColorAlpha: vec4<f32>, - uResolution: vec2<f32>, - } - - @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms; - `}},pc={name:"global-uniforms-bit",vertex:{header:` - uniform mat3 uProjectionMatrix; - uniform mat3 uWorldTransformMatrix; - uniform vec4 uWorldColorAlpha; - uniform vec2 uResolution; - `}};function mc({bits:s,name:t}){const e=oc({template:{fragment:cc,vertex:lc},bits:[fc,...s]});return Ms.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function gc({bits:s,name:t}){return new Kn({name:t,...ac({template:{vertex:uc,fragment:dc},bits:[pc,...s]})})}const _c={name:"color-bit",vertex:{header:` - @in aColor: vec4<f32>; - `,main:` - vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a); - `}},yc={name:"color-bit",vertex:{header:` - in vec4 aColor; - `,main:` - vColor *= vec4(aColor.rgb * aColor.a, aColor.a); - `}},Qs={};function xc(s){const t=[];if(s===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i<s;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(` -`)}function bc(s){const t=[];if(s===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<s;e++)e===s-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(` -`)}function wc(s){return Qs[s]||(Qs[s]={name:"texture-batch-bit",vertex:{header:` - @in aTextureIdAndRound: vec2<u32>; - @out @interpolate(flat) vTextureId : u32; - `,main:` - vTextureId = aTextureIdAndRound.y; - `,end:` - if(aTextureIdAndRound.x == 1) - { - vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); - } - `},fragment:{header:` - @in @interpolate(flat) vTextureId: u32; - - ${xc(s)} - `,main:` - var uvDx = dpdx(vUV); - var uvDy = dpdy(vUV); - - ${bc(s)} - `}}),Qs[s]}const Zs={};function vc(s){const t=[];for(let e=0;e<s;e++)e>0&&t.push("else"),e<s-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(` -`)}function Ac(s){return Zs[s]||(Zs[s]={name:"texture-batch-bit",vertex:{header:` - in vec2 aTextureIdAndRound; - out float vTextureId; - - `,main:` - vTextureId = aTextureIdAndRound.y; - `,end:` - if(aTextureIdAndRound.x == 1.) - { - gl_Position.xy = roundPixels(gl_Position.xy, uResolution); - } - `},fragment:{header:` - in float vTextureId; - - uniform sampler2D uTextures[${s}]; - - `,main:` - - ${vc(s)} - `}}),Zs[s]}const Sc={name:"round-pixels-bit",vertex:{header:` - fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32> - { - return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; - } - `}},Cc={name:"round-pixels-bit",vertex:{header:` - vec2 roundPixels(vec2 position, vec2 targetSize) - { - return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; - } - `}},Gr={};function Tc(s){let t=Gr[s];if(t)return t;const e=new Int32Array(s);for(let i=0;i<s;i++)e[i]=i;return t=Gr[s]=new to({uTextures:{value:e,type:"i32",size:s}},{isStatic:!0}),t}class Dr extends Fi{constructor(t){const e=gc({name:"batch",bits:[yc,Ac(t),Cc]}),i=mc({name:"batch",bits:[_c,wc(t),Sc]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Tc(t)}}),this.maxTextures=t}}let Le=null;const Co=class To extends Xl{constructor(t){super(t),this.geometry=new tc,this.name=To.extension.name,this.vertexSize=6,Le??(Le=new Dr(t.maxTextures)),this.shader=Le}packAttributes(t,e,i,r,n){const o=n<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,{positions:p,uvs:g}=t,m=t.color,_=t.attributeOffset,y=_+t.attributeSize;for(let x=_;x<y;x++){const w=x*2,v=p[w],b=p[w+1];e[r++]=h*v+c*b+f,e[r++]=u*b+l*v+d,e[r++]=g[w],e[r++]=g[w+1],i[r++]=m,i[r++]=o}}packQuadAttributes(t,e,i,r,n){const o=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,f=a.tx,d=a.ty,p=t.bounds,g=p.maxX,m=p.minX,_=p.maxY,y=p.minY,x=o.uvs,w=t.color,v=n<<16|t.roundPixels&65535;e[r+0]=h*m+c*y+f,e[r+1]=u*y+l*m+d,e[r+2]=x.x0,e[r+3]=x.y0,i[r+4]=w,i[r+5]=v,e[r+6]=h*g+c*y+f,e[r+7]=u*y+l*g+d,e[r+8]=x.x1,e[r+9]=x.y1,i[r+10]=w,i[r+11]=v,e[r+12]=h*g+c*_+f,e[r+13]=u*_+l*g+d,e[r+14]=x.x2,e[r+15]=x.y2,i[r+16]=w,i[r+17]=v,e[r+18]=h*m+c*_+f,e[r+19]=u*_+l*m+d,e[r+20]=x.x3,e[r+21]=x.y3,i[r+22]=w,i[r+23]=v}_updateMaxTextures(t){this.shader.maxTextures!==t&&(Le=new Dr(t),this.shader=Le)}destroy(){this.shader=null,super.destroy()}};Co.extension={type:[I.Batcher],name:"default"};let Pc=Co;class Po{constructor(t){this.items=Object.create(null);const{renderer:e,type:i,onUnload:r,priority:n,name:o}=t;this._renderer=e,e.gc.addResourceHash(this,"items",i,n??0),this._onUnload=r,this.name=o}add(t){return this.items[t.uid]?!1:(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){var r;if(!this.items[t.uid])return;const i=t._gpuData[this._renderer.uid];i&&((r=this._onUnload)==null||r.call(this,t,...e),i.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach(e=>e&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function Mc(s,t,e,i,r,n,o,a=null){let h=0;e*=t,r*=n;const l=a.a,c=a.b,u=a.c,f=a.d,d=a.tx,p=a.ty;for(;h<o;){const g=s[e],m=s[e+1];i[r]=l*g+u*m+d,i[r+1]=c*g+f*m+p,r+=n,e+=t,h++}}function kc(s,t,e,i){let r=0;for(t*=e;r<i;)s[t]=0,s[t+1]=0,t+=e,r++}function Mo(s,t,e,i,r){const n=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),i||(i=2),r||(r=s.length/i-e);let u=e*i;for(let f=0;f<r;f++){const d=s[u],p=s[u+1];s[u]=n*d+a*p+l,s[u+1]=o*d+h*p+c,u+=i}}const Ec=new W;class ko{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Mn(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||Ec}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Ye={extension:{type:I.ShapeBuilder,name:"circle"},build(s,t){let e,i,r,n,o,a;if(s.type==="circle"){const w=s;if(o=a=w.radius,o<=0)return!1;e=w.x,i=w.y,r=n=0}else if(s.type==="ellipse"){const w=s;if(o=w.halfWidth,a=w.halfHeight,o<=0||a<=0)return!1;e=w.x,i=w.y,r=n=0}else{const w=s,v=w.width/2,b=w.height/2;e=w.x+v,i=w.y+b,o=a=Math.max(0,Math.min(w.radius,Math.min(v,b))),r=v-o,n=b-a}if(r<0||n<0)return!1;const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(r?4:0)+(n?4:0);if(l===0)return!1;if(h===0)return t[0]=t[6]=e+r,t[1]=t[3]=i+n,t[2]=t[4]=e-r,t[5]=t[7]=i-n,!0;let c=0,u=h*4+(r?2:0)+2,f=u,d=l,p=r+o,g=n,m=e+p,_=e-p,y=i+g;if(t[c++]=m,t[c++]=y,t[--u]=y,t[--u]=_,n){const w=i-g;t[f++]=_,t[f++]=w,t[--d]=w,t[--d]=m}for(let w=1;w<h;w++){const v=Math.PI/2*(w/h),b=r+Math.cos(v)*o,A=n+Math.sin(v)*a,k=e+b,P=e-b,S=i+A,T=i-A;t[c++]=k,t[c++]=S,t[--u]=S,t[--u]=P,t[f++]=P,t[f++]=T,t[--d]=T,t[--d]=k}p=r,g=n+a,m=e+p,_=e-p,y=i+g;const x=i-g;return t[c++]=m,t[c++]=y,t[--d]=x,t[--d]=m,r&&(t[c++]=_,t[c++]=y,t[--d]=x,t[--d]=_),!0},triangulate(s,t,e,i,r,n){if(s.length===0)return;let o=0,a=0;for(let c=0;c<s.length;c+=2)o+=s[c],a+=s[c+1];o/=s.length/2,a/=s.length/2;let h=i;t[h*e]=o,t[h*e+1]=a;const l=h++;for(let c=0;c<s.length;c+=2)t[h*e]=s[c],t[h*e+1]=s[c+1],c>0&&(r[n++]=h,r[n++]=l,r[n++]=h-1),h++;r[n++]=l+1,r[n++]=l,r[n++]=h-1}},Ic={...Ye,extension:{...Ye.extension,name:"ellipse"}},Rc={...Ye,extension:{...Ye.extension,name:"roundedRectangle"}},Eo=1e-4,Or=1e-4;function Lc(s){const t=s.length;if(t<6)return 1;let e=0;for(let i=0,r=s[t-2],n=s[t-1];i<t;i+=2){const o=s[i],a=s[i+1];e+=(o-r)*(a+n),r=o,n=a}return e<0?-1:1}function Wr(s,t,e,i,r,n,o,a){const h=s-e*r,l=t-i*r,c=s+e*n,u=t+i*n;let f,d;o?(f=i,d=-e):(f=-i,d=e);const p=h+f,g=l+d,m=c+f,_=u+d;return a.push(p,g),a.push(m,_),2}function Yt(s,t,e,i,r,n,o,a){const h=e-s,l=i-t;let c=Math.atan2(h,l),u=Math.atan2(r-s,n-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let f=c;const d=u-c,p=Math.abs(d),g=Math.sqrt(h*h+l*l),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,_=d/m;if(f+=_,a){o.push(s,t),o.push(e,i);for(let y=1,x=f;y<m;y++,x+=_)o.push(s,t),o.push(s+Math.sin(x)*g,t+Math.cos(x)*g);o.push(s,t),o.push(r,n)}else{o.push(e,i),o.push(s,t);for(let y=1,x=f;y<m;y++,x+=_)o.push(s+Math.sin(x)*g,t+Math.cos(x)*g),o.push(s,t);o.push(r,n),o.push(s,t)}return m*2}function Bc(s,t,e,i,r,n){const o=Eo;if(s.length===0)return;const a=t;let h=a.alignment;if(t.alignment!==.5){let L=Lc(s);h=(h-.5)*L+.5}const l=new lt(s[0],s[1]),c=new lt(s[s.length-2],s[s.length-1]),u=i,f=Math.abs(l.x-c.x)<o&&Math.abs(l.y-c.y)<o;if(u){s=s.slice(),f&&(s.pop(),s.pop(),c.set(s[s.length-2],s[s.length-1]));const L=(l.x+c.x)*.5,H=(c.y+l.y)*.5;s.unshift(L,H),s.push(L,H)}const d=r,p=s.length/2;let g=s.length;const m=d.length/2,_=a.width/2,y=_*_,x=a.miterLimit*a.miterLimit;let w=s[0],v=s[1],b=s[2],A=s[3],k=0,P=0,S=-(v-A),T=w-b,M=0,R=0,B=Math.sqrt(S*S+T*T);S/=B,T/=B,S*=_,T*=_;const ht=h,C=(1-ht)*2,E=ht*2;u||(a.cap==="round"?g+=Yt(w-S*(C-E)*.5,v-T*(C-E)*.5,w-S*C,v-T*C,w+S*E,v+T*E,d,!0)+2:a.cap==="square"&&(g+=Wr(w,v,S,T,C,E,!0,d))),d.push(w-S*C,v-T*C),d.push(w+S*E,v+T*E);for(let L=1;L<p-1;++L){w=s[(L-1)*2],v=s[(L-1)*2+1],b=s[L*2],A=s[L*2+1],k=s[(L+1)*2],P=s[(L+1)*2+1],S=-(v-A),T=w-b,B=Math.sqrt(S*S+T*T),S/=B,T/=B,S*=_,T*=_,M=-(A-P),R=b-k,B=Math.sqrt(M*M+R*R),M/=B,R/=B,M*=_,R*=_;const H=b-w,V=v-A,D=b-k,et=P-A,ct=H*D+V*et,mt=V*D-et*H,it=mt<0;if(Math.abs(mt)<.001*Math.abs(ct)){d.push(b-S*C,A-T*C),d.push(b+S*E,A+T*E),ct>=0&&(a.join==="round"?g+=Yt(b,A,b-S*C,A-T*C,b-M*C,A-R*C,d,!1)+4:g+=2,d.push(b-M*E,A-R*E),d.push(b+M*C,A+R*C));continue}const kt=(-S+w)*(-T+A)-(-S+b)*(-T+v),zt=(-M+k)*(-R+A)-(-M+b)*(-R+P),re=(H*zt-D*kt)/mt,Ze=(et*kt-V*zt)/mt,Rs=(re-b)*(re-b)+(Ze-A)*(Ze-A),Ht=b+(re-b)*C,Nt=A+(Ze-A)*C,Vt=b-(re-b)*E,$t=A-(Ze-A)*E,sa=Math.min(H*H+V*V,D*D+et*et),$i=it?C:E,ia=sa+$i*$i*y;Rs<=ia?a.join==="bevel"||Rs/y>x?(it?(d.push(Ht,Nt),d.push(b+S*E,A+T*E),d.push(Ht,Nt),d.push(b+M*E,A+R*E)):(d.push(b-S*C,A-T*C),d.push(Vt,$t),d.push(b-M*C,A-R*C),d.push(Vt,$t)),g+=2):a.join==="round"?it?(d.push(Ht,Nt),d.push(b+S*E,A+T*E),g+=Yt(b,A,b+S*E,A+T*E,b+M*E,A+R*E,d,!0)+4,d.push(Ht,Nt),d.push(b+M*E,A+R*E)):(d.push(b-S*C,A-T*C),d.push(Vt,$t),g+=Yt(b,A,b-S*C,A-T*C,b-M*C,A-R*C,d,!1)+4,d.push(b-M*C,A-R*C),d.push(Vt,$t)):(d.push(Ht,Nt),d.push(Vt,$t)):(d.push(b-S*C,A-T*C),d.push(b+S*E,A+T*E),a.join==="round"?it?g+=Yt(b,A,b+S*E,A+T*E,b+M*E,A+R*E,d,!0)+2:g+=Yt(b,A,b-S*C,A-T*C,b-M*C,A-R*C,d,!1)+2:a.join==="miter"&&Rs/y<=x&&(it?(d.push(Vt,$t),d.push(Vt,$t)):(d.push(Ht,Nt),d.push(Ht,Nt)),g+=2),d.push(b-M*C,A-R*C),d.push(b+M*E,A+R*E),g+=2)}w=s[(p-2)*2],v=s[(p-2)*2+1],b=s[(p-1)*2],A=s[(p-1)*2+1],S=-(v-A),T=w-b,B=Math.sqrt(S*S+T*T),S/=B,T/=B,S*=_,T*=_,d.push(b-S*C,A-T*C),d.push(b+S*E,A+T*E),u||(a.cap==="round"?g+=Yt(b-S*(C-E)*.5,A-T*(C-E)*.5,b-S*C,A-T*C,b+S*E,A+T*E,d,!1)+2:a.cap==="square"&&(g+=Wr(b,A,S,T,C,E,!1,d)));const N=Or*Or;for(let L=m;L<g+m-2;++L)w=d[L*2],v=d[L*2+1],b=d[(L+1)*2],A=d[(L+1)*2+1],k=d[(L+2)*2],P=d[(L+2)*2+1],!(Math.abs(w*(A-P)+b*(P-v)+k*(v-A))<N)&&n.push(L,L+1,L+2)}function Fc(s,t,e,i){const r=Eo;if(s.length===0)return;const n=s[0],o=s[1],a=s[s.length-2],h=s[s.length-1],l=t||Math.abs(n-a)<r&&Math.abs(o-h)<r,c=e,u=s.length/2,f=c.length/2;for(let d=0;d<u;d++)c.push(s[d*2]),c.push(s[d*2+1]);for(let d=0;d<u-1;d++)i.push(f+d,f+d+1);l&&i.push(f+u-1,f)}function Io(s,t,e,i,r,n,o){const a=Kh(s,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)n[o++]=a[l]+r,n[o++]=a[l+1]+r,n[o++]=a[l+2]+r;let h=r*i;for(let l=0;l<s.length;l+=2)e[h]=s[l],e[h+1]=s[l+1],h+=i}const Gc=[],Dc={extension:{type:I.ShapeBuilder,name:"polygon"},build(s,t){for(let e=0;e<s.points.length;e++)t[e]=s.points[e];return!0},triangulate(s,t,e,i,r,n){Io(s,Gc,t,e,i,r,n)}},Oc={extension:{type:I.ShapeBuilder,name:"rectangle"},build(s,t){const e=s,i=e.x,r=e.y,n=e.width,o=e.height;return n>0&&o>0?(t[0]=i,t[1]=r,t[2]=i+n,t[3]=r,t[4]=i+n,t[5]=r+o,t[6]=i,t[7]=r+o,!0):!1},triangulate(s,t,e,i,r,n){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[6],t[i+o+1]=s[7],o+=e,t[i+o]=s[4],t[i+o+1]=s[5],o+=e;const a=i/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2,r[n++]=a+1,r[n++]=a+3,r[n++]=a+2}},Wc={extension:{type:I.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,!0},triangulate(s,t,e,i,r,n){let o=0;i*=e,t[i+o]=s[0],t[i+o+1]=s[1],o+=e,t[i+o]=s[2],t[i+o+1]=s[3],o+=e,t[i+o]=s[4],t[i+o+1]=s[5];const a=i/e;r[n++]=a,r[n++]=a+1,r[n++]=a+2}},Ur=[{offset:0,color:"white"},{offset:1,color:"black"}],Wi=class Ai{constructor(...t){this.uid=J("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=Uc(t);e={...e.type==="radial"?Ai.defaultRadialOptions:Ai.defaultLinearOptions,..._n(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(r=>{this.addColorStop(r.offset,r.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:q.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:i,y:r}=this.end,n=i-t,o=r-e;const a=n<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){const m=t;t=i,i=m,n*=-1}if(o<0){const m=e;e=r,r=m,o*=-1}}const h=this.colorStops.length?this.colorStops:Ur,l=this._textureSize,{canvas:c,context:u}=Hr(l,1),f=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);zr(f,h),u.fillStyle=f,u.fillRect(0,0,l,1),this.texture=new U({source:new be({resource:c,addressMode:this._wrapMode})});const d=Math.sqrt(n*n+o*o),p=Math.atan2(o,n),g=new W;g.scale(d/l,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:Ur,e=this._textureSize,{canvas:i,context:r}=Hr(e,e),{x:n,y:o}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,f=h-c,d=e/(c*2),p=(n-u)*d,g=(o-f)*d,m=r.createRadialGradient(p,g,l*d,(a-u)*d,(h-f)*d,c*d);zr(m,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=m,r.translate(p,g),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-p,-g),r.fillRect(0,0,e,e),this.texture=new U({source:new be({resource:i,addressMode:this._wrapMode})});const _=new W;this.textureSpace==="local"?_.scale(2*c,2*c):_.scale(1/d,1/d),_.translate(u,f),this.transform=_}destroy(){var t;(t=this.texture)==null||t.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};Wi.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Wi.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Ft=Wi;function zr(s,t){for(let e=0;e<t.length;e++){const i=t[e];s.addColorStop(i.offset,i.color)}}function Hr(s,t){const e=z.get().createCanvas(s,t),i=e.getContext("2d");return{canvas:e,context:i}}function Uc(s){let t=s[0]??{};return(typeof t=="number"||s[1])&&(X("8.5.2","use options object instead"),t={type:"linear",start:{x:s[0],y:s[1]},end:{x:s[2],y:s[3]},textureSpace:s[4],textureSize:s[5]??Ft.defaultLinearOptions.textureSize}),t}const zc=new W,Hc=new tt;function Nc(s,t,e,i){const r=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const o=e.getBounds(Hc);t.width&&o.pad(t.width);const{x:a,y:h}=o,l=1/o.width,c=1/o.height,u=-a*l,f=-h*c,d=r.a,p=r.b,g=r.c,m=r.d;r.a*=l,r.b*=l,r.c*=c,r.d*=c,r.tx=u*d+f*g+r.tx,r.ty=u*p+f*m+r.ty}else r.translate(t.texture.frame.x,t.texture.frame.y),r.scale(1/t.texture.source.width,1/t.texture.source.height);const n=t.texture.source.style;return!(t.fill instanceof Ft)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),i&&r.append(zc.copyFrom(i).invert()),r}const Es={};K.handleByMap(I.ShapeBuilder,Es);K.add(Oc,Dc,Wc,Ye,Ic,Rc);const Vc=new tt,$c=new W;function jc(s,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r<s.instructions.length;r++){const n=s.instructions[r];if(n.action==="texture")Yc(n.data,i,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,h=n.data.style,l=n.data.hole;o&&l&&Nr(l.shapePath,h,!0,i,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Nr(a,h,o,i,e)}}}function Yc(s,t,e){const i=[],r=Es.rectangle,n=Vc;n.x=s.dx,n.y=s.dy,n.width=s.dw,n.height=s.dh;const o=s.transform;if(!r.build(n,i))return;const{vertices:a,uvs:h,indices:l}=e,c=l.length,u=a.length/2;o&&Mo(i,o),r.triangulate(i,a,2,u,l,c);const f=s.image,d=f.uvs;h.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const p=At.get(ko);p.indexOffset=c,p.indexSize=l.length-c,p.attributeOffset=u,p.attributeSize=a.length/2-u,p.baseColor=s.style,p.alpha=s.alpha,p.texture=f,p.geometryData=e,t.push(p)}function Nr(s,t,e,i,r){const{vertices:n,uvs:o,indices:a}=r;s.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{const u=[],f=Es[h.type];if(!f.build(h,u))return;const d=a.length,p=n.length/2;let g="triangle-list";if(l&&Mo(u,l),e){const x=h.closePath??!0,w=t;w.pixelLine?(Fc(u,x,n,a),g="line-list"):Bc(u,w,!1,x,n,a)}else if(c){const x=[],w=u.slice();Xc(c).forEach(b=>{x.push(w.length/2),w.push(...b)}),Io(w,x,n,2,p,a,d)}else f.triangulate(u,n,2,p,a,d);const m=o.length/2,_=t.texture;if(_!==U.WHITE){const x=Nc($c,t,h,l);Mc(n,2,p,o,m,2,n.length/2-p,x)}else kc(o,m,2,n.length/2-p);const y=At.get(ko);y.indexOffset=d,y.indexSize=a.length-d,y.attributeOffset=p,y.attributeSize=n.length/2-p,y.baseColor=t.color,y.alpha=t.alpha,y.texture=_,y.geometryData=r,y.topology=g,i.push(y)})}function Xc(s){const t=[];for(let e=0;e<s.length;e++){const i=s[e].shape,r=[];Es[i.type].build(i,r)&&t.push(r)}return t}class qc{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{At.return(t)}),this.graphicsData&&At.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class Kc{constructor(){this.instructions=new Rn}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new Pc({maxTextures:e}),this.instructions.reset()}get geometry(){return X(xa,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const Ui=class Si{constructor(t){this._renderer=t,this._managedContexts=new Po({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Si.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??Si.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],i=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&i.reset(),jc(t,i);const r=t.batchMode;t.customShader||r==="no-batch"?i.isBatchable=!1:r==="auto"?i.isBatchable=i.geometryData.vertices.length<400:i.isBatchable=!0,t.dirty=!1}return i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=At.get(Kc,{maxTextures:this._renderer.limits.maxBatchableTextures}),i=t._gpuData[this._renderer.uid],{batches:r,geometryData:n}=i;i.graphicsData=e;const o=n.vertices.length,a=n.indices.length;for(let u=0;u<r.length;u++)r[u].applyTransform=!1;const h=e.batcher;h.ensureAttributeBuffer(o),h.ensureIndexBuffer(a),h.begin();for(let u=0;u<r.length;u++){const f=r[u];h.add(f)}h.finish(e.instructions);const l=h.geometry;l.indexBuffer.setDataWithSize(h.indexBuffer,h.indexSize,!0),l.buffers[0].setDataWithSize(h.attributeBuffer.float32View,h.attributeSize,!0);const c=h.batches;for(let u=0;u<c.length;u++){const f=c[u];f.bindGroup=Ol(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new qc;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};Ui.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"graphicsContext"};Ui.defaultOptions={bezierSmoothness:.5};let Ro=Ui;const Qc=8,us=11920929e-14,Zc=1;function Lo(s,t,e,i,r,n,o,a,h,l){const u=Math.min(.99,Math.max(0,l??Ro.defaultOptions.bezierSmoothness));let f=(Zc-u)/1;return f*=f,Jc(t,e,i,r,n,o,a,h,s,f),s}function Jc(s,t,e,i,r,n,o,a,h,l){Ci(s,t,e,i,r,n,o,a,h,l,0),h.push(o,a)}function Ci(s,t,e,i,r,n,o,a,h,l,c){if(c>Qc)return;const u=(s+e)/2,f=(t+i)/2,d=(e+r)/2,p=(i+n)/2,g=(r+o)/2,m=(n+a)/2,_=(u+d)/2,y=(f+p)/2,x=(d+g)/2,w=(p+m)/2,v=(_+x)/2,b=(y+w)/2;if(c>0){let A=o-s,k=a-t;const P=Math.abs((e-o)*k-(i-a)*A),S=Math.abs((r-o)*k-(n-a)*A);if(P>us&&S>us){if((P+S)*(P+S)<=l*(A*A+k*k)){h.push(v,b);return}}else if(P>us){if(P*P<=l*(A*A+k*k)){h.push(v,b);return}}else if(S>us){if(S*S<=l*(A*A+k*k)){h.push(v,b);return}}else if(A=v-(s+o)/2,k=b-(t+a)/2,A*A+k*k<=l){h.push(v,b);return}}Ci(s,t,u,f,_,y,v,b,h,l,c+1),Ci(v,b,x,w,g,m,o,a,h,l,c+1)}const tu=8,eu=11920929e-14,su=1;function iu(s,t,e,i,r,n,o,a){const l=Math.min(.99,Math.max(0,a??Ro.defaultOptions.bezierSmoothness));let c=(su-l)/1;return c*=c,ru(t,e,i,r,n,o,s,c),s}function ru(s,t,e,i,r,n,o,a){Ti(o,s,t,e,i,r,n,a,0),o.push(r,n)}function Ti(s,t,e,i,r,n,o,a,h){if(h>tu)return;const l=(t+i)/2,c=(e+r)/2,u=(i+n)/2,f=(r+o)/2,d=(l+u)/2,p=(c+f)/2;let g=n-t,m=o-e;const _=Math.abs((i-n)*m-(r-o)*g);if(_>eu){if(_*_<=a*(g*g+m*m)){s.push(d,p);return}}else if(g=d-(t+n)/2,m=p-(e+o)/2,g*g+m*m<=a){s.push(d,p);return}Ti(s,t,e,l,c,d,p,a,h+1),Ti(s,d,p,u,f,n,o,a,h+1)}function Bo(s,t,e,i,r,n,o,a){let h=Math.abs(r-n);(!o&&r>n||o&&n>r)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(i,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=r;l*=o?-1:1;for(let u=0;u<a+1;u++){const f=Math.cos(c),d=Math.sin(c),p=t+f*i,g=e+d*i;s.push(p,g),c+=l}}function nu(s,t,e,i,r,n){const o=s[s.length-2],h=s[s.length-1]-e,l=o-t,c=r-e,u=i-t,f=Math.abs(h*u-l*c);if(f<1e-8||n===0){(s[s.length-2]!==t||s[s.length-1]!==e)&&s.push(t,e);return}const d=h*h+l*l,p=c*c+u*u,g=h*c+l*u,m=n*Math.sqrt(d)/f,_=n*Math.sqrt(p)/f,y=m*g/d,x=_*g/p,w=m*u+_*l,v=m*c+_*h,b=l*(_+y),A=h*(_+y),k=u*(m+x),P=c*(m+x),S=Math.atan2(A-v,b-w),T=Math.atan2(P-v,k-w);Bo(s,w+t,v+e,n,S,T,l*c>u*h)}const Ue=Math.PI*2,Js={centerX:0,centerY:0,ang1:0,ang2:0},ti=({x:s,y:t},e,i,r,n,o,a,h)=>{s*=e,t*=i;const l=r*s-n*t,c=n*s+r*t;return h.x=l+o,h.y=c+a,h};function ou(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),n=Math.sin(s),o=Math.cos(s+t),a=Math.sin(s+t);return[{x:r-n*i,y:n+r*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const Vr=(s,t,e,i)=>{const r=s*i-t*e<0?-1:1;let n=s*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),r*Math.acos(n)},au=(s,t,e,i,r,n,o,a,h,l,c,u,f)=>{const d=Math.pow(r,2),p=Math.pow(n,2),g=Math.pow(c,2),m=Math.pow(u,2);let _=d*p-d*m-p*g;_<0&&(_=0),_/=d*m+p*g,_=Math.sqrt(_)*(o===a?-1:1);const y=_*r/n*u,x=_*-n/r*c,w=l*y-h*x+(s+e)/2,v=h*y+l*x+(t+i)/2,b=(c-y)/r,A=(u-x)/n,k=(-c-y)/r,P=(-u-x)/n,S=Vr(1,0,b,A);let T=Vr(b,A,k,P);a===0&&T>0&&(T-=Ue),a===1&&T<0&&(T+=Ue),f.centerX=w,f.centerY=v,f.ang1=S,f.ang2=T};function hu(s,t,e,i,r,n,o,a=0,h=0,l=0){if(n===0||o===0)return;const c=Math.sin(a*Ue/360),u=Math.cos(a*Ue/360),f=u*(t-i)/2+c*(e-r)/2,d=-c*(t-i)/2+u*(e-r)/2;if(f===0&&d===0)return;n=Math.abs(n),o=Math.abs(o);const p=Math.pow(f,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(o,2);p>1&&(n*=Math.sqrt(p),o*=Math.sqrt(p)),au(t,e,i,r,n,o,h,l,c,u,f,d,Js);let{ang1:g,ang2:m}=Js;const{centerX:_,centerY:y}=Js;let x=Math.abs(m)/(Ue/4);Math.abs(1-x)<1e-7&&(x=1);const w=Math.max(Math.ceil(x),1);m/=w;let v=s[s.length-2],b=s[s.length-1];const A={x:0,y:0};for(let k=0;k<w;k++){const P=ou(g,m),{x:S,y:T}=ti(P[0],n,o,u,c,_,y,A),{x:M,y:R}=ti(P[1],n,o,u,c,_,y,A),{x:B,y:ht}=ti(P[2],n,o,u,c,_,y,A);Lo(s,v,b,S,T,M,R,B,ht),v=B,b=ht,g+=m}}function lu(s,t,e){const i=(o,a)=>{const h=a.x-o.x,l=a.y-o.y,c=Math.sqrt(h*h+l*l),u=h/c,f=l/c;return{len:c,nx:u,ny:f}},r=(o,a)=>{o===0?s.moveTo(a.x,a.y):s.lineTo(a.x,a.y)};let n=t[t.length-1];for(let o=0;o<t.length;o++){const a=t[o%t.length],h=a.radius??e;if(h<=0){r(o,a),n=a;continue}const l=t[(o+1)%t.length],c=i(a,n),u=i(a,l);if(c.len<1e-4||u.len<1e-4){r(o,a),n=a;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=!0):f>0&&(d=-1,p=!0);const g=f/2;let m,_=Math.abs(Math.cos(g)*h/Math.sin(g));_>Math.min(c.len/2,u.len/2)?(_=Math.min(c.len/2,u.len/2),m=Math.abs(_*Math.sin(g)/Math.cos(g))):m=h;const y=a.x+u.nx*_+-u.ny*m*d,x=a.y+u.ny*_+u.nx*m*d,w=Math.atan2(c.ny,c.nx)+Math.PI/2*d,v=Math.atan2(u.ny,u.nx)-Math.PI/2*d;o===0&&s.moveTo(y+Math.cos(w)*m,x+Math.sin(w)*m),s.arc(y,x,m,w,v,p),n=a}}function cu(s,t,e,i){const r=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),n=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),o=t.length;for(let a=0;a<o;a++){const h=t[(a+1)%o],l=h.radius??e;if(l<=0){a===0?s.moveTo(h.x,h.y):s.lineTo(h.x,h.y);continue}const c=t[a],u=t[(a+2)%o],f=r(c,h);let d;if(f<1e-4)d=h;else{const m=Math.min(f/2,l);d=n(h,c,m/f)}const p=r(u,h);let g;if(p<1e-4)g=h;else{const m=Math.min(p/2,l);g=n(h,u,m/p)}a===0?s.moveTo(d.x,d.y):s.lineTo(d.x,d.y),s.quadraticCurveTo(h.x,h.y,g.x,g.y,i)}}const uu=new tt;class du{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new vt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,r=i[i.length-2],n=i[i.length-1];return(r!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,r,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return Bo(a,t,e,i,r,n,o),this}arcTo(t,e,i,r,n){this._ensurePoly();const o=this._currentPoly.points;return nu(o,t,e,i,r,n),this}arcToSvg(t,e,i,r,n,o,a){const h=this._currentPoly.points;return hu(h,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,i,r,n),this}bezierCurveTo(t,e,i,r,n,o,a){this._ensurePoly();const h=this._currentPoly;return Lo(this._currentPoly.points,h.lastX,h.lastY,t,e,i,r,n,o,a),this}quadraticCurveTo(t,e,i,r,n){this._ensurePoly();const o=this._currentPoly;return iu(this._currentPoly.points,o.lastX,o.lastY,t,e,i,r,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const i=this.shapePrimitives,r=i.length;for(let n=0;n<t.instructions.length;n++){const o=t.instructions[n];this[o.action](...o.data)}if(t.checkForHoles&&i.length-r>1){let n=null;for(let o=r;o<i.length;o++){const a=i[o];if(a.shape.type==="polygon"){const h=a.shape,l=n==null?void 0:n.shape;l&&l.containsPolygon(h)?(n.holes||(n.holes=[]),n.holes.push(a),i.copyWithin(o,o+1),i.length--,o--):n=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,r,n){return this.drawShape(new tt(t,e,i,r),n),this}circle(t,e,i,r){return this.drawShape(new Gi(t,e,i),r),this}poly(t,e,i){const r=new Oe(t);return r.closePath=e,this.drawShape(r,i),this}regularPoly(t,e,i,r,n=0,o){r=Math.max(r|0,3);const a=-1*Math.PI/2+n,h=Math.PI*2/r,l=[];for(let c=0;c<r;c++){const u=a-c*h;l.push(t+i*Math.cos(u),e+i*Math.sin(u))}return this.poly(l,!0,o),this}roundPoly(t,e,i,r,n,o=0,a){if(r=Math.max(r|0,3),n<=0)return this.regularPoly(t,e,i,r,o);const h=i*Math.sin(Math.PI/r)-.001;n=Math.min(n,h);const l=-1*Math.PI/2+o,c=Math.PI*2/r,u=(r-2)*Math.PI/r/2;for(let f=0;f<r;f++){const d=f*c+l,p=t+i*Math.cos(d),g=e+i*Math.sin(d),m=d+Math.PI+u,_=d-Math.PI-u,y=p+n*Math.cos(m),x=g+n*Math.sin(m),w=p+n*Math.cos(_),v=g+n*Math.sin(_);f===0?this.moveTo(y,x):this.lineTo(y,x),this.quadraticCurveTo(p,g,w,v,a)}return this.closePath()}roundShape(t,e,i=!1,r){return t.length<3?this:(i?cu(this,t,e,r):lu(this,t,e),this.closePath())}filletRect(t,e,i,r,n){if(n===0)return this.rect(t,e,i,r);const o=Math.min(i,r)/2,a=Math.min(o,Math.max(-o,n)),h=t+i,l=e+r,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+i-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,i,r,n,o){if(n<=0)return this.rect(t,e,i,r);const a=Math.min(n,Math.min(i,r)/2),h=t+i,l=e+r,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,o)}ellipse(t,e,i,r,n){return this.drawShape(new Di(t,e,i,r),n),this}roundRect(t,e,i,r,n,o){return this.drawShape(new Oi(t,e,i,r,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Oe,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Oe,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=i;i=n.a*i+n.c*r+n.tx,r=n.b*o+n.d*r+n.ty}this._currentPoly.points.push(i,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const r=e[i],n=r.shape.getBounds(uu);r.transform?t.addRect(n,r.transform):t.addRect(n)}return t}}class Bt{constructor(t,e=!1){this.instructions=[],this.uid=J("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Bl(t,this):this.instructions=(t==null?void 0:t.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new du(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,i,r,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(lt.shared);let h=0,l=0;if(!o||o.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=o.data[2],l=o.data[3];const c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,i,r,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,i){const r=this.instructions[this.instructions.length-1],n=this.getLastPoint(lt.shared);let o=0,a=0;if(!r||r.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=r.data[0],a=r.data[1];const h=n.x,l=n.y;o=h+(h-o),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,i]}),this._dirty=!0,this}rect(t,e,i,r,n){return this.instructions.push({action:"rect",data:[t,e,i,r,n]}),this._dirty=!0,this}circle(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,i,r,n,o,a){n||(n=r/2);const h=-1*Math.PI/2+o,l=i*2,c=Math.PI*2/l,u=[];for(let f=0;f<l;f++){const d=f%2?n:r,p=f*c+h;u.push(t+d*Math.cos(p),e+d*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){const e=new Bt;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const r=this.instructions[i];e.instructions.push({action:r.action,data:r.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,i=t.b,r=t.c,n=t.d,o=t.tx,a=t.ty;let h=0,l=0,c=0,u=0,f=0,d=0,p=0,g=0;for(let m=0;m<this.instructions.length;m++){const _=this.instructions[m],y=_.data;switch(_.action){case"moveTo":case"lineTo":h=y[0],l=y[1],y[0]=e*h+r*l+o,y[1]=i*h+n*l+a;break;case"bezierCurveTo":c=y[0],u=y[1],f=y[2],d=y[3],h=y[4],l=y[5],y[0]=e*c+r*u+o,y[1]=i*c+n*u+a,y[2]=e*f+r*d+o,y[3]=i*f+n*d+a,y[4]=e*h+r*l+o,y[5]=i*h+n*l+a;break;case"quadraticCurveTo":c=y[0],u=y[1],h=y[2],l=y[3],y[0]=e*c+r*u+o,y[1]=i*c+n*u+a,y[2]=e*h+r*l+o,y[3]=i*h+n*l+a;break;case"arcToSvg":h=y[5],l=y[6],p=y[0],g=y[1],y[0]=e*p+r*g,y[1]=i*p+n*g,y[5]=e*h+r*l+o,y[6]=i*h+n*l+a;break;case"circle":y[4]=ae(y[3],t);break;case"rect":y[4]=ae(y[4],t);break;case"ellipse":y[8]=ae(y[8],t);break;case"roundRect":y[5]=ae(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=ae(y[2],t);break;case"regularPoly":case"chamferRect":y[5]=ae(y[5],t);break;case"closePath":break;default:Y("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}function ae(s,t){return s?s.prepend(t):t.clone()}function Q(s,t,e){const i=s.getAttribute(t);return i?Number(i):e}function fu(s,t){const e=s.querySelectorAll("defs");for(let i=0;i<e.length;i++){const r=e[i];for(let n=0;n<r.children.length;n++){const o=r.children[n];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=pu(o);break;case"radialgradient":t.defs[o.id]=mu();break}}}}function pu(s){const t=Q(s,"x1",0),e=Q(s,"y1",0),i=Q(s,"x2",1),r=Q(s,"y2",0),n=s.getAttribute("gradientUnits")||"objectBoundingBox",o=new Ft(t,e,i,r,n==="objectBoundingBox"?"local":"global");for(let a=0;a<s.children.length;a++){const h=s.children[a],l=Q(h,"offset",0),c=q.shared.setValue(h.getAttribute("stop-color")).toNumber();o.addColorStop(l,c)}return o}function mu(s){return Y("[SVG Parser] Radial gradients are not yet supported"),new Ft(0,0,1,0)}function $r(s){const t=s.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const jr={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function Fo(s,t){const e=s.getAttribute("style"),i={},r={},n={strokeStyle:i,fillStyle:r,useFill:!1,useStroke:!1};for(const o in jr){const a=s.getAttribute(o);a&&Yr(t,n,o,a.trim())}if(e){const o=e.split(";");for(let a=0;a<o.length;a++){const h=o[a].trim(),[l,c]=h.split(":");jr[l]&&Yr(t,n,l,c.trim())}}return{strokeStyle:n.useStroke?i:null,fillStyle:n.useFill?r:null,useFill:n.useFill,useStroke:n.useStroke}}function Yr(s,t,e,i){switch(e){case"stroke":if(i!=="none"){if(i.startsWith("url(")){const r=$r(i);t.strokeStyle.fill=s.defs[r]}else t.strokeStyle.color=q.shared.setValue(i).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(i);break;case"fill":if(i!=="none"){if(i.startsWith("url(")){const r=$r(i);t.fillStyle.fill=s.defs[r]}else t.fillStyle.color=q.shared.setValue(i).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(i);break;case"stroke-opacity":t.strokeStyle.alpha=Number(i);break;case"opacity":t.fillStyle.alpha=Number(i),t.strokeStyle.alpha=Number(i);break}}function gu(s){if(s.length<=2)return!0;const t=s.map(a=>a.area).sort((a,h)=>h-a),[e,i]=t,r=t[t.length-1],n=e/i,o=i/r;return!(n>3&&o<2)}function _u(s){return s.split(/(?=[Mm])/).filter(i=>i.trim().length>0)}function yu(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),i=[],r=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(i.push(e[c]),r.push(e[c+1]));if(i.length===0||r.length===0)return 0;const n=Math.min(...i),o=Math.max(...i),a=Math.min(...r),h=Math.max(...r);return(o-n)*(h-a)}function Xr(s,t){const e=new Bt(s,!1);for(const i of e.instructions)t.instructions.push(i)}function xu(s,t){if(typeof s=="string"){const o=document.createElement("div");o.innerHTML=s.trim(),s=o.querySelector("svg")}const e={context:t,defs:{},path:new Bt};fu(s,e);const i=s.children,{fillStyle:r,strokeStyle:n}=Fo(s,e);for(let o=0;o<i.length;o++){const a=i[o];a.nodeName.toLowerCase()!=="defs"&&Go(a,e,r,n)}return t}function Go(s,t,e,i){const r=s.children,{fillStyle:n,strokeStyle:o}=Fo(s,t);n&&e?e={...e,...n}:n&&(e=n),o&&i?i={...i,...o}:o&&(i=o);const a=!e&&!i;a&&(e={color:0});let h,l,c,u,f,d,p,g,m,_,y,x,w,v,b,A,k;switch(s.nodeName.toLowerCase()){case"path":{v=s.getAttribute("d");const P=s.getAttribute("fill-rule"),S=_u(v),T=P==="evenodd",M=S.length>1;if(T&&M){const B=S.map(C=>({path:C,area:yu(C)}));if(B.sort((C,E)=>E.area-C.area),S.length>3||!gu(B))for(let C=0;C<B.length;C++){const E=B[C],N=C===0;t.context.beginPath();const L=new Bt(void 0,!0);Xr(E.path,L),t.context.path(L),N?(e&&t.context.fill(e),i&&t.context.stroke(i)):t.context.cut()}else for(let C=0;C<B.length;C++){const E=B[C],N=C%2===1;t.context.beginPath();const L=new Bt(void 0,!0);Xr(E.path,L),t.context.path(L),N?t.context.cut():(e&&t.context.fill(e),i&&t.context.stroke(i))}}else{const B=P?P==="evenodd":!0;b=new Bt(v,B),t.context.path(b),e&&t.context.fill(e),i&&t.context.stroke(i)}break}case"circle":p=Q(s,"cx",0),g=Q(s,"cy",0),m=Q(s,"r",0),t.context.ellipse(p,g,m,m),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"rect":h=Q(s,"x",0),l=Q(s,"y",0),A=Q(s,"width",0),k=Q(s,"height",0),_=Q(s,"rx",0),y=Q(s,"ry",0),_||y?t.context.roundRect(h,l,A,k,_||y):t.context.rect(h,l,A,k),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"ellipse":p=Q(s,"cx",0),g=Q(s,"cy",0),_=Q(s,"rx",0),y=Q(s,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,_,y),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"line":c=Q(s,"x1",0),u=Q(s,"y1",0),f=Q(s,"x2",0),d=Q(s,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),i&&t.context.stroke(i);break;case"polygon":w=s.getAttribute("points"),x=w.match(/-?\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":w=s.getAttribute("points"),x=w.match(/-?\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:{Y(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<r.length;P++)Go(r[P],t,e,i)}function bu(s){return s.texture!==void 0}const qr={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class Is{constructor(t,e){this.uid=J("fillPattern"),this._tick=0,this.transform=new W;const i=bu(t)?t:{texture:t,repetition:e};this.texture=i.texture,this.textureSpace=i.textureSpace??"global";const r=i.repetition;r&&(this.texture.source.style.addressModeU=qr[r].addressModeU,this.texture.source.style.addressModeV=qr[r].addressModeV)}setTransform(t){if(t){if(this.transform.equals(t))return;this.transform.copyFrom(t)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function wu(s){return q.isColorLike(s)}function Kr(s){return s instanceof Is}function Qr(s){return s instanceof Ft}function vu(s){return s instanceof U}function Au(s,t,e){const i=q.shared.setValue(t??0);return s.color=i.toNumber(),s.alpha=i.alpha===1?e.alpha:i.alpha,s.texture=U.WHITE,{...e,...s}}function Su(s,t,e){return s.texture=t,{...e,...s}}function Zr(s,t,e){return s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Jr(s,t,e){return t.buildGradient(),s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Cu(s,t){const e={...t,...s},i=q.shared.setValue(e.color);return e.alpha*=i.alpha,e.color=i.toNumber(),e}function se(s,t){if(s==null)return null;const e={},i=s;return wu(s)?Au(e,s,t):vu(s)?Su(e,s,t):Kr(s)?Zr(e,s,t):Qr(s)?Jr(e,s,t):i.fill&&Kr(i.fill)?Zr(i,i.fill,t):i.fill&&Qr(i.fill)?Jr(i,i.fill,t):Cu(i,t)}function bs(s,t){const{width:e,alignment:i,miterLimit:r,cap:n,join:o,pixelLine:a,...h}=t,l=se(s,h);return l?{width:e,alignment:i,miterLimit:r,cap:n,join:o,pixelLine:a,...l}:null}function Tu(s,t){let e=1;const i=s.shapePath.shapePrimitives;for(let r=0;r<i.length;r++){const n=i[r].shape;if(n.type!=="polygon")continue;const o=n.points,a=o.length;if(a<6)continue;const h=n.closePath;for(let l=0;l<a;l+=2){if(!h&&(l===0||l===a-2))continue;const c=(l-2+a)%a,u=(l+2)%a,f=o[c],d=o[c+1],p=o[l],g=o[l+1],m=o[u],_=o[u+1],y=f-p,x=d-g,w=m-p,v=_-g,b=y*y+x*x,A=w*w+v*v;if(b<1e-12||A<1e-12)continue;let S=(y*w+x*v)/Math.sqrt(b*A);S<-1?S=-1:S>1&&(S=1);const T=Math.sqrt((1-S)*.5);if(T<1e-6)continue;const M=Math.min(1/T,t);M>e&&(e=M)}}return e}const Pu=new lt,tn=new W,zi=class Mt extends ft{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=J("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new Bt,this._transform=new W,this._fillStyle={...Mt.defaultFillStyle},this._strokeStyle={...Mt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new vt,this._boundsDirty=!0}clone(){const t=new Mt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=se(t,Mt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=bs(t,Mt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=se(t,Mt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=se(t,Mt.defaultStrokeStyle),this}texture(t,e,i,r,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:r||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?q.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Bt,this}fill(t,e){let i;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="stroke"?i=r.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(X(_t,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=se(t,Mt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(lt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=bs(t,Mt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,r,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,r,n,o),this}arcTo(t,e,i,r,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*r+o.tx,o.b*i+o.d*r+o.ty,n),this}arcToSvg(t,e,i,r,n,o,a){this._tick++;const h=this._transform;return this._activePath.arcToSvg(t,e,i,r,n,h.a*o+h.c*a+h.tx,h.b*o+h.d*a+h.ty),this}bezierCurveTo(t,e,i,r,n,o,a){this._tick++;const h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*i+h.c*r+h.tx,h.b*i+h.d*r+h.ty,h.a*n+h.c*o+h.tx,h.b*n+h.d*o+h.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,r){return this._tick++,this._activePath.ellipse(t,e,i,r,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,r=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,o=i.b*t+i.d*e+i.ty;return r.length===1&&r[0].action==="moveTo"?(r[0].data[0]=n,r[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,i,r,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*r+o.tx,o.b*i+o.d*r+o.ty,n),this}rect(t,e,i,r){return this._tick++,this._activePath.rect(t,e,i,r,this._transform.clone()),this}roundRect(t,e,i,r,n){return this._tick++,this._activePath.roundRect(t,e,i,r,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,r,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,r,n,o),this}roundPoly(t,e,i,r,n,o){return this._tick++,this._activePath.roundPoly(t,e,i,r,n,o),this}roundShape(t,e,i,r){return this._tick++,this._activePath.roundShape(t,e,i,r),this}filletRect(t,e,i,r,n){return this._tick++,this._activePath.filletRect(t,e,i,r,n),this}chamferRect(t,e,i,r,n,o){return this._tick++,this._activePath.chamferRect(t,e,i,r,n,o),this}star(t,e,i,r,n=0,o=0){return this._tick++,this._activePath.star(t,e,i,r,n,o,this._transform.clone()),this}svg(t){return this._tick++,xu(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,r,n,o){return t instanceof W?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,r,n,o),this)}transform(t,e,i,r,n,o){return t instanceof W?(this._transform.append(t),this):(tn.set(t,e,i,r,n,o),this._transform.append(tn),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const i=this.instructions[e],r=i.action;if(r==="fill"){const n=i.data;t.addBounds(n.path.bounds)}else if(r==="texture"){const n=i.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(r==="stroke"){const n=i.data,o=n.style.alignment;let a=n.style.width*(1-o);n.style.join==="miter"&&(a*=Tu(n.path,n.style.miterLimit));const h=n.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){var r;if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let i=!1;for(let n=0;n<e.length;n++){const o=e[n],a=o.data,h=a.path;if(!o.action||!h)continue;const l=a.style,c=h.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){const f=c[u].shape;if(!l||!f)continue;const d=c[u].transform,p=d?d.applyInverse(t,Pu):t;if(o.action==="fill")i=f.contains(p.x,p.y);else{const m=l;i=f.strokeContains(p.x,p.y,m.width,m.alignment)}const g=a.hole;if(g){const m=(r=g.shapePath)==null?void 0:r.shapePrimitives;if(m)for(let _=0;_<m.length;_++)m[_].shape.contains(p.x,p.y)&&(i=!1)}if(i)return!0}}return i}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(i)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(i))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};zi.defaultFillStyle={color:16777215,alpha:1,texture:U.WHITE,matrix:null,fill:null,textureSpace:"local"};zi.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:U.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let te=zi;function Hi(s,t=1){var i;const e=(i=ve.RETINA_PREFIX)==null?void 0:i.exec(s);return e?parseFloat(e[1]):t}function Ni(s,t,e){s.label=e,s._sourceOrigin=e;const i=new U({source:s,label:e}),r=()=>{delete t.promiseCache[e],nt.has(e)&&nt.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&(Y("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),r())}),i.once("destroy",()=>{s.destroyed||(Y("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),i}const Mu=".svg",ku="image/svg+xml",Eu={extension:{type:I.LoadParser,priority:Gt.Low,name:"loadSVG"},name:"loadSVG",id:"svg",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(s){return Ae(s,ku)||Se(s,Mu)},async load(s,t,e){var i;return((i=t.data)==null?void 0:i.parseAsGraphicsContext)??this.config.parseAsGraphicsContext?Ru(s):Iu(s,t,e,this.config.crossOrigin)},unload(s){s.destroy(!0)}};async function Iu(s,t,e,i){var m,_,y;const r=await z.get().fetch(s),n=z.get().createImage();n.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(await r.text())}`,n.crossOrigin=i,await n.decode();const o=((m=t.data)==null?void 0:m.width)??n.width,a=((_=t.data)==null?void 0:_.height)??n.height,h=((y=t.data)==null?void 0:y.resolution)||Hi(s),l=Math.ceil(o*h),c=Math.ceil(a*h),u=z.get().createCanvas(l,c),f=u.getContext("2d");f.imageSmoothingEnabled=!0,f.imageSmoothingQuality="high",f.drawImage(n,0,0,o*h,a*h);const{parseAsGraphicsContext:d,...p}=t.data??{},g=new be({resource:u,alphaMode:"premultiply-alpha-on-upload",resolution:h,...p});return Ni(g,e,s)}async function Ru(s){const e=await(await z.get().fetch(s)).text(),i=new te;return i.svg(e),i}const Lu=`(function () { - 'use strict'; - - const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII="; - async function checkImageBitmap() { - try { - if (typeof createImageBitmap !== "function") return false; - const response = await fetch(WHITE_PNG); - const imageBlob = await response.blob(); - const imageBitmap = await createImageBitmap(imageBlob); - return imageBitmap.width === 1 && imageBitmap.height === 1; - } catch (_e) { - return false; - } - } - void checkImageBitmap().then((result) => { - self.postMessage(result); - }); - -})(); -`;let me=null,Pi=class{constructor(){me||(me=URL.createObjectURL(new Blob([Lu],{type:"application/javascript"}))),this.worker=new Worker(me)}};Pi.revokeObjectURL=function(){me&&(URL.revokeObjectURL(me),me=null)};const Bu=`(function () { - 'use strict'; - - async function loadImageBitmap(url, alphaMode) { - const response = await fetch(url); - if (!response.ok) { - throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`); - } - const imageBlob = await response.blob(); - return alphaMode === "premultiplied-alpha" ? createImageBitmap(imageBlob, { premultiplyAlpha: "none" }) : createImageBitmap(imageBlob); - } - self.onmessage = async (event) => { - try { - const imageBitmap = await loadImageBitmap(event.data.data[0], event.data.data[1]); - self.postMessage({ - data: imageBitmap, - uuid: event.data.uuid, - id: event.data.id - }, [imageBitmap]); - } catch (e) { - self.postMessage({ - error: e, - uuid: event.data.uuid, - id: event.data.id - }); - } - }; - -})(); -`;let ge=null;class Do{constructor(){ge||(ge=URL.createObjectURL(new Blob([Bu],{type:"application/javascript"}))),this.worker=new Worker(ge)}}Do.revokeObjectURL=function(){ge&&(URL.revokeObjectURL(ge),ge=null)};let en=0,ei;class Fu{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new Pi;e.addEventListener("message",i=>{e.terminate(),Pi.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){ei===void 0&&(ei=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<ei&&(this._createdWorkers++,t=new Do().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){this._resolveHash[t.uuid]&&(t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),delete this._resolveHash[t.uuid])}async _run(t,e){await this._initWorkers();const i=new Promise((r,n)=>{this._queue.push({id:t,arguments:e,resolve:r,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[en]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:en++,id:i})}reset(){this._workerPool.forEach(t=>t.terminate()),this._workerPool.length=0,Object.values(this._resolveHash).forEach(({reject:t})=>{t==null||t(new Error("WorkerManager has been reset before completion"))}),this._resolveHash={},this._queue.length=0,this._initialized=!1,this._createdWorkers=0}}const sn=new Fu,Gu=[".jpeg",".jpg",".png",".webp",".avif"],Du=["image/jpeg","image/png","image/webp","image/avif"];async function Ou(s,t){var r;const e=await z.get().fetch(s);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${s}: ${e.status} ${e.statusText}`);const i=await e.blob();return((r=t==null?void 0:t.data)==null?void 0:r.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const Oo={name:"loadTextures",id:"texture",extension:{type:I.LoadParser,priority:Gt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(s){return Ae(s,Du)||Se(s,Gu)},async load(s,t,e){var n;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await sn.isImageBitmapSupported()?i=await sn.loadImageBitmap(s,t):i=await Ou(s,t):i=await new Promise((o,a)=>{i=z.get().createImage(),i.crossOrigin=this.config.crossOrigin,i.src=s,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=a)});const r=new be({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((n=t.data)==null?void 0:n.resolution)||Hi(s),...t.data});return Ni(r,e,s)},unload(s){s.destroy(!0)}},Wu=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"];let si,ii;function Uu(s,t,e){e===void 0&&!t.startsWith("data:")?s.crossOrigin=Hu(t):e!==!1&&(s.crossOrigin=typeof e=="string"?e:"anonymous")}function zu(s){return new Promise((t,e)=>{s.addEventListener("canplaythrough",i),s.addEventListener("error",r),s.load();function i(){n(),t()}function r(o){n(),e(o)}function n(){s.removeEventListener("canplaythrough",i),s.removeEventListener("error",r)}})}function Hu(s,t=globalThis.location){if(s.startsWith("data:"))return"";t||(t=globalThis.location);const e=new URL(s,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function Nu(){const s=[],t=[];for(const e of Wu){const i=De.MIME_TYPES[e.substring(1)]||`video/${e.substring(1)}`;ks(i)&&(s.push(e),t.includes(i)||t.push(i))}return{validVideoExtensions:s,validVideoMime:t}}const Vu={name:"loadVideo",id:"video",extension:{type:I.LoadParser,name:"loadVideo"},test(s){if(!si||!ii){const{validVideoExtensions:i,validVideoMime:r}=Nu();si=i,ii=r}const t=Ae(s,ii),e=Se(s,si);return t||e},async load(s,t,e){var h,l;const i={...De.defaultOptions,resolution:((h=t.data)==null?void 0:h.resolution)||Hi(s),alphaMode:((l=t.data)==null?void 0:l.alphaMode)||await Hn(),...t.data},r=document.createElement("video"),n={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(n).forEach(c=>{const u=n[c];u!==void 0&&r.setAttribute(c,u)}),i.muted===!0&&(r.muted=!0),Uu(r,s,i.crossorigin);const o=document.createElement("source");let a;if(i.mime)a=i.mime;else if(s.startsWith("data:"))a=s.slice(5,s.indexOf(";"));else if(!s.startsWith("blob:")){const c=s.split("?")[0].slice(s.lastIndexOf(".")+1).toLowerCase();a=De.MIME_TYPES[c]||`video/${c}`}return o.src=s,a&&(o.type=a),new Promise((c,u)=>{i.preload&&!i.autoPlay&&r.load(),r.addEventListener("canplay",f),r.addEventListener("error",d),o.addEventListener("error",d),r.appendChild(o);async function f(){const g=new De({...i,resource:r});p(),t.data.preload&&await zu(r),c(Ni(g,e,s))}function d(g){p(),u(g)}function p(){r.removeEventListener("canplay",f),r.removeEventListener("error",d),o.removeEventListener("error",d)}})},unload(s){s.destroy(!0)}},Wo={extension:{type:I.ResolveParser,name:"resolveTexture"},test:Oo.test,parse:s=>{var t;return{resolution:parseFloat(((t=ve.RETINA_PREFIX.exec(s))==null?void 0:t[1])??"1"),format:s.split(".").pop(),src:s}}},$u={extension:{type:I.ResolveParser,priority:-2,name:"resolveJson"},test:s=>ve.RETINA_PREFIX.test(s)&&s.endsWith(".json"),parse:Wo.parse};class ju{constructor(){this._detections=[],this._initialized=!1,this.resolver=new ve,this.loader=new ml,this.cache=nt,this._backgroundLoader=new ol(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var n,o;if(this._initialized){Y("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let a=t.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const e=((n=t.texturePreference)==null?void 0:n.resolution)??1,i=typeof e=="number"?[e]:e,r=await this._detectFormats({preferredFormats:(o=t.texturePreference)==null?void 0:o.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:i}}),t.preferences&&this.setPreferences(t.preferences),t.loadOptions&&(this.loader.loadOptions={...this.loader.loadOptions,...t.loadOptions})}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=gs(t),r=Tt(t).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(r),o=await this._mapLoadToResolve(n,e);return i?o[r[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},o=Object.keys(r);let a=0;const h=[],l=()=>{e==null||e(h.reduce((u,f)=>u+f,0)/a)},c=o.map((u,f)=>{const d=r[u],p=Object.values(d),m=[...new Set(p.flat())].reduce((_,y)=>_+(y.progressSize||1),0);return h.push(0),a+=m,this._mapLoadToResolve(d,_=>{h[f]=_*m,l()}).then(_=>{n[u]=_})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return nt.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=nt.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const r=await this.loader.load(i,e);this._backgroundLoader.active=!0;const n={};return i.forEach(o=>{const a=r[o.src],h=[o.src];o.alias&&h.push(...o.alias),h.forEach(l=>{n[l]=a}),nt.set(h,a)}),n}async unload(t){this._initialized||await this.init();const e=Tt(t).map(r=>typeof r!="string"?r.src:r),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Tt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{nt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,r)=>e.indexOf(i)===r),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const de=new ju;K.handleByList(I.LoadParser,de.loader.parsers).handleByList(I.ResolveParser,de.resolver.parsers).handleByList(I.CacheParser,de.cache.parsers).handleByList(I.DetectionParser,de.detections);K.add(al,ll,hl,pl,ul,dl,fl,yl,wl,kl,Eu,Oo,Vu,nl,rl,Wo,$u);const rn={loader:I.LoadParser,resolver:I.ResolveParser,cache:I.CacheParser,detection:I.DetectionParser};K.handle(I.Asset,s=>{const t=s.ref;Object.entries(rn).filter(([e])=>!!t[e]).forEach(([e,i])=>K.add(Object.assign(t[e],{extension:t[e].extension??i})))},s=>{const t=s.ref;Object.keys(rn).filter(e=>!!t[e]).forEach(e=>K.remove(t[e]))});let he;function nn(s){const t=z.get().createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=s,e.fillRect(0,0,6,1),t}function Yu(){if(he!==void 0)return he;try{const s=nn("#ff00ff"),t=nn("#ffff00"),i=z.get().createCanvas(6,1).getContext("2d");i.globalCompositeOperation="multiply",i.drawImage(s,0,0),i.drawImage(t,2,0);const r=i.getImageData(2,0,1,1);if(!r)he=!1;else{const n=r.data;he=n[0]===255&&n[1]===0&&n[2]===0}}catch{he=!1}return he}const $={canvas:null,convertTintToImage:!1,cacheStepsPerColorChannel:8,canUseMultiply:Yu(),tintMethod:null,_canvasSourceCache:new WeakMap,_unpremultipliedCache:new WeakMap,getCanvasSource:s=>{const t=s.source,e=t==null?void 0:t.resource;if(!e)return null;const i=t.alphaMode==="premultiplied-alpha",r=t.resourceWidth??t.pixelWidth,n=t.resourceHeight??t.pixelHeight,o=r!==t.pixelWidth||n!==t.pixelHeight;if(i){if((e instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)&&!o)return e;const a=$._unpremultipliedCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas}if(e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof ArrayBuffer){const a=$._canvasSourceCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas;const h=z.get().createCanvas(t.pixelWidth,t.pixelHeight),l=h.getContext("2d"),c=l.createImageData(t.pixelWidth,t.pixelHeight),u=c.data,f=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(t.format==="bgra8unorm")for(let d=0;d<u.length&&d+3<f.length;d+=4)u[d]=f[d+2],u[d+1]=f[d+1],u[d+2]=f[d],u[d+3]=f[d+3];else u.set(f.subarray(0,u.length));return l.putImageData(c,0,0),$._canvasSourceCache.set(t,{canvas:h,resourceId:t._resourceId}),h}if(i){const a=z.get().createCanvas(t.pixelWidth,t.pixelHeight),h=a.getContext("2d",{willReadFrequently:!0});a.width=t.pixelWidth,a.height=t.pixelHeight,h.drawImage(e,0,0);const l=h.getImageData(0,0,a.width,a.height),c=l.data;for(let u=0;u<c.length;u+=4){const f=c[u+3];if(f>0){const d=255/f;c[u]=Math.min(255,c[u]*d+.5),c[u+1]=Math.min(255,c[u+1]*d+.5),c[u+2]=Math.min(255,c[u+2]*d+.5)}}return h.putImageData(l,0,0),$._unpremultipliedCache.set(t,{canvas:a,resourceId:t._resourceId}),a}if(o){const a=$._canvasSourceCache.get(t);if((a==null?void 0:a.resourceId)===t._resourceId)return a.canvas;const h=z.get().createCanvas(t.pixelWidth,t.pixelHeight),l=h.getContext("2d");return h.width=t.pixelWidth,h.height=t.pixelHeight,l.drawImage(e,0,0),$._canvasSourceCache.set(t,{canvas:h,resourceId:t._resourceId}),h}return e},getTintedCanvas:(s,t)=>{const e=s.texture,i=q.shared.setValue(t).toHex(),r=e.tintCache||(e.tintCache={}),n=r[i],o=e.source._resourceId;if((n==null?void 0:n.tintId)===o)return n;const a=n&&"getContext"in n?n:z.get().createCanvas();return $.tintMethod(e,t,a),a.tintId=o,r[i]=a,r[i]},getTintedPattern:(s,t)=>{const e=q.shared.setValue(t).toHex(),i=s.patternCache||(s.patternCache={}),r=s.source._resourceId;let n=i[e];return(n==null?void 0:n.tintId)===r||($.canvas||($.canvas=z.get().createCanvas()),$.tintMethod(s,t,$.canvas),n=$.canvas.getContext("2d").createPattern($.canvas,"repeat"),n.tintId=r,i[e]=n),n},applyPatternTransform:(s,t,e=!0)=>{if(!t)return;const i=s;if(!i.setTransform)return;const r=globalThis.DOMMatrix;if(!r)return;const n=new r([t.a,t.b,t.c,t.d,t.tx,t.ty]);i.setTransform(e?n.inverse():n)},tintWithMultiply:(s,t,e)=>{const i=e.getContext("2d"),r=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;r.x*=n,r.y*=n,r.width*=n,r.height*=n;const a=O.isVertical(o),h=a?r.height:r.width,l=a?r.width:r.height;e.width=Math.ceil(h),e.height=Math.ceil(l),i.save(),i.fillStyle=q.shared.setValue(t).toHex(),i.fillRect(0,0,h,l),i.globalCompositeOperation="multiply";const c=$.getCanvasSource(s);if(!c){i.restore();return}o&&$._applyInverseRotation(i,o,r.width,r.height),i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.globalCompositeOperation="destination-atop",i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.restore()},tintWithOverlay:(s,t,e)=>{const i=e.getContext("2d"),r=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;r.x*=n,r.y*=n,r.width*=n,r.height*=n;const a=O.isVertical(o),h=a?r.height:r.width,l=a?r.width:r.height;e.width=Math.ceil(h),e.height=Math.ceil(l),i.save(),i.globalCompositeOperation="copy",i.fillStyle=q.shared.setValue(t).toHex(),i.fillRect(0,0,h,l),i.globalCompositeOperation="destination-atop";const c=$.getCanvasSource(s);if(!c){i.restore();return}o&&$._applyInverseRotation(i,o,r.width,r.height),i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.restore()},tintWithPerPixel:(s,t,e)=>{const i=e.getContext("2d"),r=s.frame.clone(),n=s.source._resolution??s.source.resolution??1,o=s.rotate;r.x*=n,r.y*=n,r.width*=n,r.height*=n;const a=O.isVertical(o),h=a?r.height:r.width,l=a?r.width:r.height;e.width=Math.ceil(h),e.height=Math.ceil(l),i.save(),i.globalCompositeOperation="copy";const c=$.getCanvasSource(s);if(!c){i.restore();return}o&&$._applyInverseRotation(i,o,r.width,r.height),i.drawImage(c,r.x,r.y,r.width,r.height,0,0,r.width,r.height),i.restore();const u=t>>16&255,f=t>>8&255,d=t&255,p=i.getImageData(0,0,h,l),g=p.data;for(let m=0;m<g.length;m+=4)g[m]=g[m]*u/255,g[m+1]=g[m+1]*f/255,g[m+2]=g[m+2]*d/255;i.putImageData(p,0,0)},_applyInverseRotation:(s,t,e,i)=>{const r=O.inv(t),n=O.uX(r),o=O.uY(r),a=O.vX(r),h=O.vY(r),l=-Math.min(0,n*e,a*i,n*e+a*i),c=-Math.min(0,o*e,h*i,o*e+h*i);s.transform(n,o,a,h,l,c)}};$.tintMethod=$.canUseMultiply?$.tintWithMultiply:$.tintWithPerPixel;class Xu{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=z.get().createCanvas();i.width=t,i.height=e;const r=i.getContext("2d");return{canvas:i,context:r}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=_e(t),e=_e(e);const r=(t<<17)+(e<<1);this._canvasPool[r]||(this._canvasPool[r]=[]);let n=this._canvasPool[r].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:r}=e,n=(i<<17)+(r<<1);t.context.resetTransform(),t.context.clearRect(0,0,i,r),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Mi=new Xu;Qe.register(Mi);const qu=new vt;function Ku(s,t,e,i,r=!1){const n=qu;n.minX=0,n.minY=0,n.maxX=s.width/i|0,n.maxY=s.height/i|0;const o=Ts.getOptimalTexture(n.width,n.height,i,!1,r);return o.source.uploadMethodId="image",o.source.resource=s,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/i,o.frame.height=e/i,o.source.emit("update",o.source),o.updateUvs(),o}class ws extends yt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const{animationSpeed:i=1,autoPlay:r=!1,autoUpdate:n=!0,loop:o=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...f}=e,[d]=c;super({...f,texture:d instanceof U?d:d.texture}),this._textures=null,this._durations=null,this._autoUpdate=n,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=o,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,r&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(dt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(dt.shared.add(this.update,this,ze.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,r=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;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()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<r||this.animationSpeed<0&&this.currentFrame>r)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t=!1){if(typeof t=="boolean"?t:t==null?void 0:t.texture){const i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._textures.forEach(r=>{this.texture!==r&&r.destroy(i)})}this._textures=[],this._durations=null,this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;i<t.length;++i)e.push(U.from(t[i]));return new ws(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(U.from(t[i]));return new ws(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof U)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 new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const 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?(dt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(dt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Qu extends Ln{constructor(t,e){const{text:i,resolution:r,style:n,anchor:o,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=r??null,this.allowChildren=!1,this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t||(t={}),(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,r=-e*this.anchor.x;let n=0;return t.x>=r&&t.x<=r+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}get styleKey(){return`${this._text}:${this._style.styleKey}:${this._resolution}`}}function Zu(s,t){let e=s[0]??{};return(typeof e=="string"||s[1])&&(X(_t,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:s[1]}),e}let Xt=null,Rt=null;function Ju(s,t){Xt||(Xt=z.get().createCanvas(256,128),Rt=Xt.getContext("2d",{willReadFrequently:!0}),Rt.globalCompositeOperation="copy",Rt.globalAlpha=1),(Xt.width<s||Xt.height<t)&&(Xt.width=_e(s),Xt.height=_e(t))}function on(s,t,e){for(let i=0,r=4*e*t;i<t;++i,r+=4)if(s[r+3]!==0)return!1;return!0}function an(s,t,e,i,r){const n=4*t;for(let o=i,a=i*n+4*e;o<=r;++o,a+=n)if(s[a+3]!==0)return!1;return!0}function td(...s){let t=s[0];t.canvas||(t={canvas:s[0],resolution:s[1]});const{canvas:e}=t,i=Math.min(t.resolution??1,1),r=t.width??e.width,n=t.height??e.height;let o=t.output;if(Ju(r,n),!Rt)throw new TypeError("Failed to get canvas 2D context");Rt.drawImage(e,0,0,r,n,0,0,r*i,n*i);const h=Rt.getImageData(0,0,r,n).data;let l=0,c=0,u=r-1,f=n-1;for(;c<n&&on(h,r,c);)++c;if(c===n)return tt.EMPTY;for(;on(h,r,f);)--f;for(;an(h,r,l,c,f);)++l;for(;an(h,r,u,c,f);)--u;return++u,++f,Rt.globalCompositeOperation="source-over",Rt.strokeRect(l,c,u-l,f-c),Rt.globalCompositeOperation="copy",o??(o=new tt),o.set(l/i,c/i,(u-l)/i,(f-c)/i),o}/** - * tiny-lru - * - * @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com> - * @license BSD-3-Clause - * @version 11.4.7 - */class ed{constructor(t=0,e=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=e}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const e=this.items[t];delete this.items[t],this.size--,e.prev!==null&&(e.prev.next=e.next),e.next!==null&&(e.next.prev=e.prev),this.first===e&&(this.first=e.next),this.last===e&&(this.last=e.prev)}return this}entries(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++){const r=t[i];e[i]=[r,this.get(r)]}return e}evict(t=!1){if(t||this.size>0){const e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(t){let e;return this.has(t)&&(e=this.items[t].expiry),e}get(t){const e=this.items[t];if(e!==void 0){if(this.ttl>0&&e.expiry<=Date.now()){this.delete(t);return}return this.moveToEnd(e),e.value}}has(t){return t in this.items}moveToEnd(t){this.last!==t&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),t.prev=this.last,t.next=null,this.last!==null&&(this.last.next=t),this.last=t,this.first===null&&(this.first=t))}keys(){const t=new Array(this.size);let e=this.first,i=0;for(;e!==null;)t[i++]=e.key,e=e.next;return t}setWithEvicted(t,e,i=this.resetTtl){let r=null;if(this.has(t))this.set(t,e,!0,i);else{this.max>0&&this.size===this.max&&(r={...this.first},this.evict(!0));let n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e};++this.size===1?this.first=n:this.last.next=n,this.last=n}return r}set(t,e,i=!1,r=this.resetTtl){let n=this.items[t];return i||n!==void 0?(n.value=e,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.moveToEnd(n)):(this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:e},++this.size===1?this.first=n:this.last.next=n,this.last=n),this}values(t=this.keys()){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=this.get(t[i]);return e}}function sd(s=1e3,t=0,e=!1){if(isNaN(s)||s<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof e!="boolean")throw new TypeError("Invalid resetTtl value");return new ed(s,t,e)}function Uo(s){return!!s.tagStyles&&Object.keys(s.tagStyles).length>0}function zo(s){return s.includes("<")}function id(s,t){return s.clone().assign(t)}function rd(s,t){const e=[],i=t.tagStyles;if(!Uo(t)||!zo(s))return e.push({text:s,style:t}),e;const r=[t],n=[];let o="",a=0;for(;a<s.length;){const h=s[a];if(h==="<"){const l=s.indexOf(">",a);if(l===-1){o+=h,a++;continue}const c=s.indexOf("<",a+1);if(c!==-1&&c<l){o+=h,a++;continue}const u=s.slice(a+1,l);if(u.startsWith("/")){const f=u.slice(1).trim();if(n.length>0&&n[n.length-1]===f){o.length>0&&(e.push({text:o,style:r[r.length-1]}),o=""),r.pop(),n.pop(),a=l+1;continue}else{o+=s.slice(a,l+1),a=l+1;continue}}else{const f=u.trim();if(i[f]){o.length>0&&(e.push({text:o,style:r[r.length-1]}),o="");const d=r[r.length-1],p=id(d,i[f]);r.push(p),n.push(f),a=l+1;continue}else{o+=s.slice(a,l+1),a=l+1;continue}}}else o+=h,a++}return o.length>0&&e.push({text:o,style:r[r.length-1]}),e}const nd=[10,13],od=new Set(nd),ad=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],hd=new Set(ad),ld=[9,32],cd=new Set(ld),ud=[45,8208,8211,8212,173],dd=new Set(ud),fd=/(\r\n|\r|\n)/,pd=/(?:\r\n|\r|\n)/;function vs(s){return typeof s!="string"?!1:od.has(s.charCodeAt(0))}function wt(s,t){return typeof s!="string"?!1:hd.has(s.charCodeAt(0))}function Yd(s){return typeof s!="string"?!1:cd.has(s.charCodeAt(0))}function md(s){return typeof s!="string"?!1:dd.has(s.charCodeAt(0))}function Ho(s){return s==="normal"||s==="pre-line"}function No(s){return s==="normal"}function It(s){if(typeof s!="string")return"";let t=s.length-1;for(;t>=0&&wt(s[t]);)t--;return t<s.length-1?s.slice(0,t+1):s}function Vo(s){const t=[],e=[];if(typeof s!="string")return t;for(let i=0;i<s.length;i++){const r=s[i],n=s[i+1];if(wt(r)||vs(r)){e.length>0&&(t.push(e.join("")),e.length=0),r==="\r"&&n===` -`?(t.push(`\r -`),i++):t.push(r);continue}e.push(r),md(r)&&n&&!wt(n)&&!vs(n)&&(t.push(e.join("")),e.length=0)}return e.length>0&&t.push(e.join("")),t}function $o(s,t,e,i){const r=e(s),n=[];for(let o=0;o<r.length;o++){let a=r[o],h=a,l=1;for(;r[o+l];){const c=r[o+l];if(!i(h,c,s,o,t))a+=c,h=c,l++;else break}o+=l-1,n.push(a)}return n}const gd=/\r\n|\r|\n/g;function _d(s,t,e,i,r,n,o,a,h){var B,ht;const l=rd(s,t);if(No(t.whiteSpace))for(let C=0;C<l.length;C++){const E=l[C];l[C]={text:E.text.replace(gd," "),style:E.style}}const u=[];let f=[];for(const C of l){const E=C.text.split(fd);for(let N=0;N<E.length;N++){const L=E[N];L===`\r -`||L==="\r"||L===` -`?(u.push(f),f=[]):L.length>0&&f.push({text:L,style:C.style})}}(f.length>0||u.length===0)&&u.push(f);const d=e?yd(u,t,i,n,a,h):u,p=[],g=[],m=[],_=[],y=[];let x=0;const w=t._fontString,v=o(w);v.fontSize===0&&(v.fontSize=t.fontSize,v.ascent=t.fontSize);let b="",A=!!t.dropShadow,k=((B=t._stroke)==null?void 0:B.width)||0;for(const C of d){let E=0,N=v.ascent,L=v.descent,H="";for(const D of C){const et=D.style._fontString,ct=o(et);et!==b&&(i.font=et,b=et);const mt=r(D.text,D.style.letterSpacing,i);E+=mt,N=Math.max(N,ct.ascent),L=Math.max(L,ct.descent),H+=D.text;const it=((ht=D.style._stroke)==null?void 0:ht.width)||0;it>k&&(k=it),!A&&D.style.dropShadow&&(A=!0)}C.length===0&&(N=v.ascent,L=v.descent),p.push(E),g.push(N),m.push(L),y.push(H);const V=t.lineHeight||N+L;_.push(V+t.leading),x=Math.max(x,E)}const P=k,S=x+P+(t.dropShadow?t.dropShadow.distance:0);let T=0;for(let C=0;C<_.length;C++)T+=_[C];T=Math.max(T,_[0]+P);const M=T+(t.dropShadow?t.dropShadow.distance:0),R=t.lineHeight||v.fontSize;return{width:S,height:M,lines:y,lineWidths:p,lineHeight:R+t.leading,maxLineWidth:x,fontProperties:v,runsByLine:d,lineAscents:g,lineDescents:m,lineHeights:_,hasDropShadow:A}}function yd(s,t,e,i,r,n){var m;const{letterSpacing:o,whiteSpace:a,wordWrapWidth:h,breakWords:l}=t,c=Ho(a),u=h+o,f={};let d="";const p=(_,y)=>{const x=`${_}|${y.styleKey}`;let w=f[x];if(w===void 0){const v=y._fontString;v!==d&&(e.font=v,d=v),w=i(_,y.letterSpacing,e)+y.letterSpacing,f[x]=w}return w},g=[];for(const _ of s){const y=xd(_),x=g.length,w=M=>{let R=0,B=M;do{const{token:ht,style:C}=y[B];R+=p(ht,C),B++}while(B<y.length&&y[B].continuesFromPrevious);return R},v=M=>{const R=[];let B=M;do R.push({token:y[B].token,style:y[B].style}),B++;while(B<y.length&&y[B].continuesFromPrevious);return R};let b=[],A=0,k=!c,P=null;const S=()=>{P&&P.text.length>0&&b.push(P),P=null},T=()=>{if(S(),b.length>0){const M=b[b.length-1];M.text=It(M.text),M.text.length===0&&b.pop()}g.push(b),b=[],A=0,k=!1};for(let M=0;M<y.length;M++){const{token:R,style:B,continuesFromPrevious:ht}=y[M],C=p(R,B);if(c){const L=wt(R),H=(P==null?void 0:P.text[P.text.length-1])??((m=b[b.length-1])==null?void 0:m.text.slice(-1))??"",V=H?wt(H):!1;if(L&&V)continue}const E=!ht,N=E?w(M):C;if(N>u&&E)if(A>0&&T(),l){const L=v(M);for(let H=0;H<L.length;H++){const V=L[H].token,D=L[H].style,et=$o(V,l,n,r);for(const ct of et){const mt=p(ct,D);mt+A>u&&T(),!P||P.style!==D?(S(),P={text:ct,style:D}):P.text+=ct,A+=mt}}M+=L.length-1}else{const L=v(M);S(),g.push(L.map(H=>({text:H.token,style:H.style}))),k=!1,M+=L.length-1}else if(N+A>u&&E){if(wt(R)){k=!1;continue}T(),P={text:R,style:B},A=C}else if(ht&&!l)!P||P.style!==B?(S(),P={text:R,style:B}):P.text+=R,A+=C;else{const L=wt(R);if(A===0&&L&&!k)continue;!P||P.style!==B?(S(),P={text:R,style:B}):P.text+=R,A+=C}}if(S(),b.length>0){const M=b[b.length-1];M.text=It(M.text),M.text.length===0&&b.pop()}(b.length>0||g.length===x)&&g.push(b)}return g}function xd(s){const t=[];let e=!1;for(const i of s){const r=Vo(i.text);let n=!0;for(const o of r){const a=wt(o)||vs(o),h=n&&e&&!a;t.push({token:o,style:i.style,continuesFromPrevious:h}),e=!a,n=!1}}return t}const bd={willReadFrequently:!0};function hn(s,t,e,i,r){let n=e[s];return typeof n!="number"&&(n=r(s,t,i)+t,e[s]=n),n}function wd(s,t,e,i,r,n,o){const a=e.getContext("2d",bd);a.font=t._fontString;let h=0,l="";const c=[],u=Object.create(null),{letterSpacing:f,whiteSpace:d}=t,p=Ho(d),g=No(d);let m=!p;const _=t.wordWrapWidth+f,y=Vo(s);for(let w=0;w<y.length;w++){let v=y[w];if(vs(v)){if(!g){c.push(It(l)),m=!p,l="",h=0;continue}v=" "}if(p){const A=wt(v),k=wt(l[l.length-1]);if(A&&k)continue}const b=hn(v,f,u,a,i);if(b>_)if(l!==""&&(c.push(It(l)),l="",h=0),r(v,t.breakWords)){const A=$o(v,t.breakWords,o,n);for(const k of A){const P=hn(k,f,u,a,i);P+h>_&&(c.push(It(l)),m=!1,l="",h=0),l+=k,h+=P}}else l.length>0&&(c.push(It(l)),l="",h=0),c.push(It(v)),m=!1,l="",h=0;else b+h>_&&(m=!1,c.push(It(l)),l="",h=0),(l.length>0||!wt(v)||m)&&(l+=v,h+=b)}const x=It(l);return x.length>0&&c.push(x),c.join(` -`)}const ln={willReadFrequently:!0},Dt=class F{static get experimentalLetterSpacingSupported(){let t=F._experimentalLetterSpacingSupported;if(t===void 0){const e=z.get().getCanvasRenderingContext2D().prototype;t=F._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,r,n,o,a,h,l,c){this.text=t,this.style=e,this.width=i,this.height=r,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l,c&&(this.runsByLine=c.runsByLine,this.lineAscents=c.lineAscents,this.lineDescents=c.lineDescents,this.lineHeights=c.lineHeights,this.hasDropShadow=c.hasDropShadow)}static measureText(t=" ",e,i=F._canvas,r=e.wordWrap){var w;const n=`${t}-${e.styleKey}-wordWrap-${r}`;if(F._measurementCache.has(n))return F._measurementCache.get(n);if(Uo(e)&&zo(t)){const v=_d(t,e,r,F._context,F._measureText,F._measureTextAdvance,F.measureFont,F.canBreakChars,F.wordWrapSplit),b=new F(t,e,v.width,v.height,v.lines,v.lineWidths,v.lineHeight,v.maxLineWidth,v.fontProperties,{runsByLine:v.runsByLine,lineAscents:v.lineAscents,lineDescents:v.lineDescents,lineHeights:v.lineHeights,hasDropShadow:v.hasDropShadow});return F._measurementCache.set(n,b),b}const a=e._fontString,h=F.measureFont(a);h.fontSize===0&&(h.fontSize=e.fontSize,h.ascent=e.fontSize,h.descent=0);const l=F._context;l.font=a;const u=(r?F._wordWrap(t,e,i):t).split(pd),f=new Array(u.length);let d=0;for(let v=0;v<u.length;v++){const b=F._measureText(u[v],e.letterSpacing,l);f[v]=b,d=Math.max(d,b)}const p=((w=e._stroke)==null?void 0:w.width)??0,g=e.lineHeight||h.fontSize,m=F._adjustWidthForStyle(d,e),_=Math.max(g,h.fontSize+p)+(u.length-1)*(g+e.leading),y=F._adjustHeightForStyle(_,e),x=new F(t,e,m,y,u,f,g+e.leading,d,h);return F._measurementCache.set(n,x),x}static _adjustWidthForStyle(t,e){var n;const i=((n=e._stroke)==null?void 0:n.width)||0;let r=t+i;return e.dropShadow&&(r+=e.dropShadow.distance),r}static _adjustHeightForStyle(t,e){let i=t;return e.dropShadow&&(i+=e.dropShadow.distance),i}static _measureText(t,e,i){const{metricWidth:r,metrics:n,letterSpacingVal:o}=F._measureTextCore(t,e,i),a=-(n.actualBoundingBoxLeft??0);let l=(n.actualBoundingBoxRight??0)-a;return n.width>0&&(l+=o),Math.max(r,l)}static _measureTextAdvance(t,e,i){return F._measureTextCore(t,e,i).metricWidth}static _measureTextCore(t,e,i){let r=!1;F.experimentalLetterSpacingSupported&&(F.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,r=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));const n=i.measureText(t);let o=n.width,a=0;return o>0&&(r?a=-e:a=(F.graphemeSegmenter(t).length-1)*e,o+=a),{metricWidth:o,metrics:n,letterSpacingVal:a}}static _wordWrap(t,e,i=F._canvas){return wd(t,e,i,F._measureTextAdvance,F.canBreakWords,F.canBreakChars,F.wordWrapSplit)}static isBreakingSpace(t,e){return wt(t)}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,r,n){return!0}static wordWrapSplit(t){return F.graphemeSegmenter(t)}static measureFont(t){if(F._fonts[t])return F._fonts[t];const e=F._context;e.font=t;const i=e.measureText(F.METRICS_STRING+F.BASELINE_SYMBOL),r=i.actualBoundingBoxAscent??0,n=i.actualBoundingBoxDescent??0,o={ascent:r,descent:n,fontSize:r+n};return F._fonts[t]=o,o}static clearMetrics(t=""){t?delete F._fonts[t]:F._fonts={}}static get _canvas(){if(!F.__canvas){let t;try{const e=new OffscreenCanvas(0,0),i=e.getContext("2d",ln);if(i!=null&&i.measureText)return F.__canvas=e,e;t=z.get().createCanvas()}catch{t=z.get().createCanvas()}t.width=t.height=10,F.__canvas=t}return F.__canvas}static get _context(){return F.__context||(F.__context=F._canvas.getContext("2d",ln)),F.__context}};Dt.METRICS_STRING="|ÉqÅ";Dt.BASELINE_SYMBOL="M";Dt.BASELINE_MULTIPLIER=1.4;Dt.HEIGHT_MULTIPLIER=2;Dt.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const s=new Intl.Segmenter;return t=>{const e=s.segment(t),i=[];let r=0;for(const n of e)i[r++]=n.segment;return i}}return s=>[...s]})();Dt.experimentalLetterSpacing=!1;Dt._fonts={};Dt._measurementCache=sd(1e3);let Ot=Dt;const vd=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function ki(s){const t=typeof s.fontSize=="number"?`${s.fontSize}px`:s.fontSize;let e=s.fontFamily;Array.isArray(s.fontFamily)||(e=s.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let r=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!vd.includes(r)&&(r=`"${r}"`),e[i]=r}return`${s.fontStyle} ${s.fontVariant} ${s.fontWeight} ${t} ${e.join(",")}`}const cn=1e5;function ds(s,t,e,i=0,r=0,n=0){if(s.texture===U.WHITE&&!s.fill)return q.shared.setValue(s.color).setAlpha(s.alpha??1).toHexa();if(s.fill){if(s.fill instanceof Is){const o=s.fill,a=t.createPattern(o.texture.source.resource,"repeat");return $.applyPatternTransform(a,o.transform,!1),a}else if(s.fill instanceof Ft){const o=s.fill,a=o.type==="linear",h=o.textureSpace==="local";let l=1,c=1;h&&e&&(l=e.width+i,c=e.height+i);let u,f=!1;if(a){const{start:d,end:p}=o;u=t.createLinearGradient(d.x*l+r,d.y*c+n,p.x*l+r,p.y*c+n),f=Math.abs(p.x-d.x)<Math.abs((p.y-d.y)*.1)}else{const{center:d,innerRadius:p,outerCenter:g,outerRadius:m}=o;u=t.createRadialGradient(d.x*l+r,d.y*c+n,p*l,g.x*l+r,g.y*c+n,m*l)}if(f&&h&&e){const d=e.lineHeight/c;for(let p=0;p<e.lines.length;p++){const g=(p*e.lineHeight+i/2)/c;o.colorStops.forEach(m=>{let _=g+m.offset*d;_=Math.max(0,Math.min(1,_)),u.addColorStop(Math.floor(_*cn)/cn,q.shared.setValue(m.color).toHex())})}}else o.colorStops.forEach(d=>{u.addColorStop(d.offset,q.shared.setValue(d.color).toHex())});return u}}else{const o=t.createPattern(s.texture.source.resource,"repeat"),a=s.matrix.copyTo(W.shared);return a.scale(s.texture.source.pixelWidth,s.texture.source.pixelHeight),o.setTransform(a),o}return Y("FillStyle not recognised",s),"red"}const un=new tt;function le(s){let t=0;for(let e=0;e<s.length;e++)s.charCodeAt(e)===32&&t++;return t}class Ad{getCanvasAndContext(t){const{text:e,style:i,resolution:r=1}=t,n=i._getFinalPadding(),o=Ot.measureText(e||" ",i),a=Math.ceil(Math.ceil(Math.max(1,o.width)+n*2)*r),h=Math.ceil(Math.ceil(Math.max(1,o.height)+n*2)*r),l=Mi.getOptimalCanvasAndContext(a,h);this._renderTextToCanvas(i,n,r,l,o);const c=i.trim?td({canvas:l.canvas,width:a,height:h,resolution:1,output:un}):un.set(0,0,a,h);return{canvasAndContext:l,frame:c}}returnCanvasAndContext(t){Mi.returnCanvasAndContext(t)}_renderTextToCanvas(t,e,i,r,n){var v,b,A;if(n.runsByLine&&n.runsByLine.length>0){this._renderTaggedTextToCanvas(n,t,e,i,r);return}const{canvas:o,context:a}=r,h=ki(t),l=n.lines,c=n.lineHeight,u=n.lineWidths,f=n.maxLineWidth,d=n.fontProperties,p=o.height;if(a.resetTransform(),a.scale(i,i),a.textBaseline=t.textBaseline,(v=t._stroke)!=null&&v.width){const k=t._stroke;a.lineWidth=k.width,a.miterLimit=k.miterLimit,a.lineJoin=k.join,a.lineCap=k.cap}a.font=h;let g,m;const _=t.dropShadow?2:1,x=(((b=t._stroke)==null?void 0:b.width)??0)/2;let w=(c-d.fontSize)/2;c-d.fontSize<0&&(w=0);for(let k=0;k<_;++k){const P=t.dropShadow&&k===0,S=P?Math.ceil(Math.max(1,p)+e*2):0,T=S*i;if(P)this._setupDropShadow(a,t,i,T);else{const M=t._gradientBounds,R=t._gradientOffset;if(M){const B={width:M.width,height:M.height,lineHeight:M.height,lines:n.lines};this._setFillAndStrokeStyles(a,t,B,e,x,(R==null?void 0:R.x)??0,(R==null?void 0:R.y)??0)}else R?this._setFillAndStrokeStyles(a,t,n,e,x,R.x,R.y):this._setFillAndStrokeStyles(a,t,n,e,x);a.shadowColor="rgba(0,0,0,0)"}for(let M=0;M<l.length;M++){g=x,m=x+M*c+d.ascent+w,g+=this._getAlignmentOffset(u[M],f,t.align);let R=0;if(t.align==="justify"&&t.wordWrap&&M<l.length-1){const B=le(l[M]);B>0&&(R=(f-u[M])/B)}(A=t._stroke)!=null&&A.width&&this._drawLetterSpacing(l[M],t,r,g+e,m+e-S,!0,R),t._fill!==void 0&&this._drawLetterSpacing(l[M],t,r,g+e,m+e-S,!1,R)}}}_renderTaggedTextToCanvas(t,e,i,r,n){var x,w,v;const{canvas:o,context:a}=n,{runsByLine:h,lineWidths:l,maxLineWidth:c,lineAscents:u,lineHeights:f,hasDropShadow:d}=t,p=o.height;a.resetTransform(),a.scale(r,r),a.textBaseline=e.textBaseline;const g=d?2:1;let m=((x=e._stroke)==null?void 0:x.width)??0;for(const b of h)for(const A of b){const k=((w=A.style._stroke)==null?void 0:w.width)??0;k>m&&(m=k)}const _=m/2,y=[];for(let b=0;b<h.length;b++){const A=h[b],k=[];for(const P of A){const S=ki(P.style);a.font=S,k.push({width:Ot._measureText(P.text,P.style.letterSpacing,a),font:S})}y.push(k)}for(let b=0;b<g;++b){const A=d&&b===0,k=A?Math.ceil(Math.max(1,p)+i*2):0,P=k*r;A||(a.shadowColor="rgba(0,0,0,0)");let S=_;for(let T=0;T<h.length;T++){const M=h[T],R=l[T],B=u[T],ht=f[T],C=y[T];let E=_;E+=this._getAlignmentOffset(R,c,e.align);let N=0;if(e.align==="justify"&&e.wordWrap&&T<h.length-1){let V=0;for(const D of M)V+=le(D.text);V>0&&(N=(c-R)/V)}const L=S+B;let H=E+i;for(let V=0;V<M.length;V++){const D=M[V],{width:et,font:ct}=C[V];if(a.font=ct,a.textBaseline=D.style.textBaseline,(v=D.style._stroke)!=null&&v.width){const it=D.style._stroke;if(a.lineWidth=it.width,a.miterLimit=it.miterLimit,a.lineJoin=it.join,a.lineCap=it.cap,A)if(D.style.dropShadow)this._setupDropShadow(a,D.style,r,P);else{const kt=le(D.text);H+=et+kt*N;continue}else{const kt=Ot.measureFont(ct),zt=D.style.lineHeight||kt.fontSize,re={width:et,height:zt,lineHeight:zt,lines:[D.text]};a.strokeStyle=ds(it,a,re,i*2,H-i,S)}this._drawLetterSpacing(D.text,D.style,n,H,L+i-k,!0,N)}const mt=le(D.text);H+=et+mt*N}H=E+i;for(let V=0;V<M.length;V++){const D=M[V],{width:et,font:ct}=C[V];if(a.font=ct,a.textBaseline=D.style.textBaseline,D.style._fill!==void 0){if(A)if(D.style.dropShadow)this._setupDropShadow(a,D.style,r,P);else{const it=le(D.text);H+=et+it*N;continue}else{const it=Ot.measureFont(ct),kt=D.style.lineHeight||it.fontSize,zt={width:et,height:kt,lineHeight:kt,lines:[D.text]};a.fillStyle=ds(D.style._fill,a,zt,i*2,H-i,S)}this._drawLetterSpacing(D.text,D.style,n,H,L+i-k,!1,N)}const mt=le(D.text);H+=et+mt*N}S+=ht}}}_setFillAndStrokeStyles(t,e,i,r,n,o=0,a=0){var h;if(t.fillStyle=e._fill?ds(e._fill,t,i,r*2,o,a):null,(h=e._stroke)!=null&&h.width){const l=n+r*2;t.strokeStyle=ds(e._stroke,t,i,l,o,a)}}_setupDropShadow(t,e,i,r){t.fillStyle="black",t.strokeStyle="black";const n=e.dropShadow,o=n.color,a=n.alpha;t.shadowColor=q.shared.setValue(o).setAlpha(a).toRgbaString();const h=n.blur*i,l=n.distance*i;t.shadowBlur=h,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l+r}_getAlignmentOffset(t,e,i){return i==="right"?e-t:i==="center"?(e-t)/2:0}_drawLetterSpacing(t,e,i,r,n,o=!1,a=0){const{context:h}=i,l=e.letterSpacing;let c=!1;if(Ot.experimentalLetterSpacingSupported&&(Ot.experimentalLetterSpacing?(h.letterSpacing=`${l}px`,h.textLetterSpacing=`${l}px`,c=!0):(h.letterSpacing="0px",h.textLetterSpacing="0px")),(l===0||c)&&a===0){o?h.strokeText(t,r,n):h.fillText(t,r,n);return}if(a!==0&&(l===0||c)){const g=t.split(" ");let m=r;const _=h.measureText(" ").width;for(let y=0;y<g.length;y++)o?h.strokeText(g[y],m,n):h.fillText(g[y],m,n),m+=h.measureText(g[y]).width+_+a;return}let u=r;const f=Ot.graphemeSegmenter(t);let d=h.measureText(t).width,p=0;for(let g=0;g<f.length;++g){const m=f[g];o?h.strokeText(m,u,n):h.fillText(m,u,n);let _="";for(let y=g+1;y<f.length;++y)_+=f[y];p=h.measureText(_).width,u+=d-p+l,m===" "&&(u+=a),d=p}}}const fe=new Ad,Vi=class ee extends ft{constructor(t={}){super(),this.uid=J("textStyle"),this._tick=0,this._cachedFontString=null,Sd(t),t instanceof ee&&(t=t._toObject());const r={...ee.defaultTextStyle,...t};for(const n in r){const o=n;this[o]=r[n]}this._tagStyles=t.tagStyles??void 0,this.update(),this._tick=0}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.update())}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.update())}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ee.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ee.defaultDropShadow}):null,this.update())}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily!==t&&(this._fontFamily=t,this.update())}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update())}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t.toLowerCase(),this.update())}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.update())}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.update())}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.update())}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.update())}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.update())}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.update())}get filters(){return this._filters}set filters(t){this._filters!==t&&(this._filters=Object.freeze(t),this.update())}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.update())}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.update())}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.update())}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.update())}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.update())}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy({...te.defaultFillStyle,...t},()=>{this._fill=se({...this._originalFill},te.defaultFillStyle)})),this._fill=se(t===0?"black":t,te.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...te.defaultStrokeStyle,...t},()=>{this._stroke=bs({...this._originalStroke},te.defaultStrokeStyle)})),this._stroke=bs(t,te.defaultStrokeStyle),this.update())}get tagStyles(){return this._tagStyles}set tagStyles(t){this._tagStyles!==t&&(this._tagStyles=t??void 0,this.update())}update(){this._tick++,this._cachedFontString=null,this.emit("update",this)}reset(){const t=ee.defaultTextStyle;for(const e in t)this[e]=t[e]}assign(t){for(const e in t){const i=e;this[i]=t[e]}return this}get styleKey(){return`${this.uid}-${this._tick}`}get _fontString(){return this._cachedFontString===null&&(this._cachedFontString=ki(this)),this._cachedFontString}_toObject(){return{align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...this._dropShadow}:null,fill:this._fill?{...this._fill}:void 0,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke?{...this._stroke}:void 0,textBaseline:this.textBaseline,trim:this.trim,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,filters:this._filters?[...this._filters]:void 0,tagStyles:this._tagStyles?{...this._tagStyles}:void 0}}clone(){return new ee(this._toObject())}_getFinalPadding(){let t=0;if(this._filters)for(let e=0;e<this._filters.length;e++)t+=this._filters[e].padding;return Math.max(this._padding,t)}destroy(t=!1){var i,r,n,o;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const a=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(i=this._fill)!=null&&i.texture&&this._fill.texture.destroy(a),(r=this._originalFill)!=null&&r.texture&&this._originalFill.texture.destroy(a),(n=this._stroke)!=null&&n.texture&&this._stroke.texture.destroy(a),(o=this._originalStroke)!=null&&o.texture&&this._originalStroke.texture.destroy(a)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,r,n)=>(i[r]===n||(i[r]=n,e==null||e(r,n),this.update()),!0)})}_isFillStyle(t){return(t??null)!==null&&!(q.isColorLike(t)||t instanceof Ft||t instanceof Is)}};Vi.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Vi.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let As=Vi;function Sd(s){const t=s;if(typeof t.dropShadow=="boolean"&&t.dropShadow){const e=As.defaultDropShadow;s.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){X(_t,"strokeThickness is now a part of stroke");const e=t.stroke;let i={};if(q.isColorLike(e))i.color=e;else if(e instanceof Ft||e instanceof Is)i.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))i=e;else throw new Error("Invalid stroke value.");s.stroke={...i,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){if(X(_t,"gradient fill is now a fill pattern: `new FillGradient(...)`"),!Array.isArray(t.fill)||t.fill.length===0)throw new Error("Invalid fill value. Expected an array of colors for gradient fill.");t.fill.length!==t.fillGradientStops.length&&Y("The number of fill colors must match the number of fill gradient stops.");const e=new Ft({start:{x:0,y:0},end:{x:0,y:1},textureSpace:"local"}),i=t.fillGradientStops.slice(),r=t.fill.map(n=>q.shared.setValue(n).toNumber());i.forEach((n,o)=>{e.addColorStop(n,r[o])}),s.fill={fill:e}}}function Cd(s,t){const{texture:e,bounds:i}=s,r=t._style._getFinalPadding();vn(i,t._anchor,e);const n=t._anchor._x*r*2,o=t._anchor._y*r*2;i.minX-=r-n,i.minY-=r-o,i.maxX-=r-n,i.maxY-=r-o}class Td{constructor(){this.batcherName="default",this.topology="triangle-list",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}destroy(){this.reset()}}class Pd extends Td{}class jo{constructor(t){this._renderer=t,t.runners.resolutionChange.add(this),this._managedTexts=new Po({renderer:t,type:"renderable",onUnload:this.onTextUnload.bind(this),name:"canvasText"})}resolutionChange(){for(const t in this._managedTexts.items){const e=this._managedTexts.items[t];e!=null&&e._autoResolution&&e.onViewUpdate()}}validateRenderable(t){const e=this._getGpuText(t),i=t.styleKey;return e.currentKey!==i?!0:t._didTextUpdate}addRenderable(t,e){const i=this._getGpuText(t);if(t._didTextUpdate){const r=t._autoResolution?this._renderer.resolution:t.resolution;(i.currentKey!==t.styleKey||t._resolution!==r)&&this._updateGpuText(t),t._didTextUpdate=!1,Cd(i,t)}this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t);e._batcher.updateElement(e)}_updateGpuText(t){const e=this._getGpuText(t);e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,e.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t.styleKey}_getGpuText(t){return t._gpuData[this._renderer.uid]||this.initGpuText(t)}initGpuText(t){const e=new Pd;return e.currentKey="--",e.renderable=t,e.transform=t.groupTransform,e.bounds={minX:0,maxX:1,minY:0,maxY:0},e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._gpuData[this._renderer.uid]=e,this._managedTexts.add(t),e}onTextUnload(t){const e=t._gpuData[this._renderer.uid];if(!e)return;const{canvasText:i}=this._renderer;i.getReferenceCount(e.currentKey)>0?i.decreaseReferenceCount(e.currentKey):e.texture&&i.returnTexture(e.texture)}destroy(){this._managedTexts.destroy(),this._renderer=null}}jo.extension={type:[I.WebGLPipes,I.WebGPUPipes,I.CanvasPipes],name:"text"};class Yo{constructor(t,e){this._activeTextures={},this._renderer=t,this._retainCanvasContext=e}getTexture(t,e,i,r){typeof t=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof As||(t.style=new As(t.style)),t.textureStyle instanceof ye||(t.textureStyle=new ye(t.textureStyle)),typeof t.text!="string"&&(t.text=t.text.toString());const{text:n,style:o,textureStyle:a,autoGenerateMipmaps:h}=t,l=t.resolution??this._renderer.resolution,{frame:c,canvasAndContext:u}=fe.getCanvasAndContext({text:n,style:o,resolution:l}),f=Ku(u.canvas,c.width,c.height,l,h);if(a&&(f.source.style=a),o.trim&&(c.pad(o.padding),f.frame.copyFrom(c),f.frame.scale(1/l),f.updateUvs()),o.filters){const d=this._applyFilters(f,o.filters);return this.returnTexture(f),fe.returnCanvasAndContext(u),d}return this._renderer.texture.initSource(f._source),this._retainCanvasContext||fe.returnCanvasAndContext(u),f}returnTexture(t){const e=t.source,i=e.resource;if(this._retainCanvasContext&&(i!=null&&i.getContext)){const r=i.getContext("2d");r&&fe.returnCanvasAndContext({canvas:i,context:r})}e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Ts.returnTexture(t,!0)}renderTextToCanvas(){X("8.10.0","CanvasTextSystem.renderTextToCanvas: no longer supported, use CanvasTextSystem.getTexture instead")}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t.styleKey;if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const i=this.getTexture({text:t.text,style:t.style,resolution:t._resolution,textureStyle:t.textureStyle,autoGenerateMipmaps:t.autoGenerateMipmaps});return this._activeTextures[e]={texture:i,usageCount:1},i}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(this.returnTexture(e.texture),this._activeTextures[t]=null))}getReferenceCount(t){var e;return((e=this._activeTextures[t])==null?void 0:e.usageCount)??0}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}_applyFilters(t,e){const i=this._renderer.renderTarget.renderTarget,r=this._renderer.filter.generateFilteredTexture({texture:t,filters:e});return this._renderer.renderTarget.bind(i,!1),r}destroy(){this._renderer=null;for(const t in this._activeTextures)this._activeTextures[t]&&this.returnTexture(this._activeTextures[t].texture);this._activeTextures=null}}class Xo extends Yo{constructor(t){super(t,!0)}}Xo.extension={type:[I.CanvasSystem],name:"canvasText"};class qo extends Yo{constructor(t){super(t,!1)}}qo.extension={type:[I.WebGLSystem,I.WebGPUSystem],name:"canvasText"};K.add(Xo);K.add(qo);K.add(jo);class Md extends Qu{constructor(...t){const e=Zu(t,"Text");super(e,As),this.renderPipeId="text",e.textureStyle&&(this.textureStyle=e.textureStyle instanceof ye?e.textureStyle:new ye(e.textureStyle)),this.autoGenerateMipmaps=e.autoGenerateMipmaps??St.defaultOptions.autoGenerateMipmaps}updateBounds(){const t=this._bounds,e=this._anchor;let i=0,r=0;if(this._style.trim){const{frame:n,canvasAndContext:o}=fe.getCanvasAndContext({text:this.text,style:this._style,resolution:1});fe.returnCanvasAndContext(o),i=n.width,r=n.height}else{const n=Ot.measureText(this._text,this._style);i=n.width,r=n.height}t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*r,t.maxY=t.minY+r}}K.add(ha,la);let Ko;function kd(s){return Ko=s,s}function Xe(){return Ko}class Ei{static setParamValue(t,e){if(t.setValueAtTime){const i=Xe().context;t.setValueAtTime(e,i.audioContext.currentTime)}else t.value=e;return e}}class Ed extends ft{constructor(){super(...arguments),this.speed=1,this.muted=!1,this.volume=1,this.paused=!1}refresh(){this.emit("refresh")}refreshPaused(){this.emit("refreshPaused")}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters")}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners()}}let Id=0;const Ii=class extends ft{constructor(s){super(),this.id=Id++,this.init(s)}set(s,t){if(this[s]===void 0)throw new Error(`Property with name ${s} does not exist.`);switch(s){case"speed":this.speed=t;break;case"volume":this.volume=t;break;case"paused":this.paused=t;break;case"loop":this.loop=t;break;case"muted":this.muted=t;break}return this}get progress(){const{currentTime:s}=this._source;return s/this._duration}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}_onPlay(){this._playing=!0}_onPause(){this._playing=!1}init(s){this._playing=!1,this._duration=s.source.duration;const t=this._source=s.source.cloneNode(!1);t.src=s.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),s.context.on("refresh",this.refresh,this),s.context.on("refreshPaused",this.refreshPaused,this),this._media=s}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause())}stop(){this._internalStop(),this._source&&this.emit("stop")}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(s){console.warn("HTML Audio does not support filters")}refresh(){const s=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;const e=s.volume*(s.muted?0:1),i=t.volume*(t.muted?0:1),r=this._volume*(this._muted?0:1);this._source.volume=r*e*i,this._source.playbackRate=this._speed*s.speed*t.speed}refreshPaused(){const s=this._media.context,t=this._media.parent,e=this._paused||t.paused||s.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e))}play(s){const{start:t,end:e,speed:i,loop:r,volume:n,muted:o}=s;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!r,this._muted=o,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=!1),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Ii.PADDING),this._end=Math.min(this._end+Ii.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.shared.add(this._onUpdate,this))},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start")}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete()}_onComplete(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this)}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();const s=this._source;s&&(s.onended=null,s.onplay=null,s.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=!1,this._end=null,this._start=0,this._duration=0,this._playing=!1,this._pausedReal=!1,this._paused=!1,this._muted=!1,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null)}toString(){return`[HTMLAudioInstance id=${this.id}]`}};let Qo=Ii;Qo.PADDING=.1;class Rd extends ft{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url)}create(){return new Qo(this)}get isPlayable(){return!!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters")}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null)}get source(){return this._source}load(t){const e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=!0;const h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h)},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;const r=()=>{a(),i.isLoaded=!0;const h=i.autoPlayStart();t&&t(null,i,h)},n=()=>{a(),t&&t(new Error("Sound loading has been aborted"))},o=()=>{a();const h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h)},a=()=>{e.removeEventListener("canplaythrough",r),e.removeEventListener("load",r),e.removeEventListener("abort",n),e.removeEventListener("error",o)};e.addEventListener("canplaythrough",r,!1),e.addEventListener("load",r,!1),e.addEventListener("abort",n,!1),e.addEventListener("error",o,!1),e.load()}}class Ld{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time")}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null}}const Ss=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Bd=["audio/mpeg","audio/ogg"],Cs={};function Fd(s){const t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"'},e=document.createElement("audio"),i={},r=/^no$/;Ss.forEach(n=>{const o=e.canPlayType(`audio/${n}`).replace(r,""),a=t[n]?e.canPlayType(t[n]).replace(r,""):"";i[n]=!!o||!!a}),Object.assign(Cs,i)}Fd();let Gd=0;class Dd extends ft{constructor(t){super(),this.id=Gd++,this._media=null,this._paused=!1,this._muted=!1,this._elapsed=0,this.init(t)}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case"speed":this.speed=e;break;case"volume":this.volume=e;break;case"muted":this.muted=e;break;case"loop":this.loop=e;break;case"paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"))}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(!0)}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh()}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh()}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh()}get filters(){return this._filters}set filters(t){var e;this._filters&&((e=this._filters)==null||e.filter(i=>i).forEach(i=>i.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t!=null&&t.length?t.slice(0):null,this.refresh()}refresh(){if(!this._source)return;const t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;const i=t.volume*(t.muted?0:1),r=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);Ei.setParamValue(this._gain.gain,n*r*i),Ei.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters()}applyFilters(){var t;if((t=this._filters)!=null&&t.length){this._source.disconnect();let e=this._source;this._filters.forEach(i=>{e.connect(i.destination),e=i}),e.connect(this._gain)}}refreshPaused(){const t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i))}play(t){const{start:e,end:i,speed:r,loop:n,volume:o,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=!1;const{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=r,this._volume=o,this._loop=!!n,this._muted=a,this._filters=h,this.refresh();const u=this._source.buffer.duration;this._duration=u,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(!0),this.enableTicker(!0)}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.shared.add(this._updateListener,this)}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused()}destroy(){var t;this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),(t=this._filters)==null||t.forEach(e=>e.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=!1,this._elapsed=0,this._duration=0,this._paused=!1,this._muted=!1,this._pausedReal=!1}toString(){return`[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update()}_update(t=!1){if(this._source){const e=this._now(),i=e-this._lastUpdate;if(i>0||t){const r=this._source.playbackRate.value;this._elapsed+=i*r,this._lastUpdate=e;const n=this._duration;let o;if(this._source.loopStart){const a=this._source.loopEnd-this._source.loopStart;o=(this._source.loopStart+this._elapsed%a)/n}else o=this._elapsed%n/n;this._progress=o,this.emit("progress",this._progress,n)}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this)}_internalStop(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null}}_onComplete(){if(this._source){this.enableTicker(!1),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this)}}class Zo{constructor(t,e){this._output=e,this._input=t}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect()}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i}),e.connect(this._output)}}destroy(){this.filters=null,this._input=null,this._output=null}}const Jo=class extends Zo{constructor(s){const t=s.audioContext,e=t.createBufferSource(),i=t.createGain(),r=t.createAnalyser();e.connect(r),r.connect(i),i.connect(s.destination),super(r,i),this.context=s,this.bufferSource=e,this.gain=i,this.analyser=r}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Jo.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null}cloneBufferSource(){const s=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=s.buffer,Ei.setParamValue(t.playbackRate,s.playbackRate.value),t.loop=s.loop;const e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}};let ta=Jo;ta.BUFFER_SIZE=0;class Od{init(t){this.parent=t,this._nodes=new ta(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t)}this._source=null,this.source=null}create(){return new Dd(this)}get context(){return this.parent.context}get isPlayable(){return!!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set")}async _loadUrl(t){const e=this.parent.url,i=await z.get().fetch(e);this._decode(await i.arrayBuffer(),t)}_decode(t,e){const i=(r,n)=>{if(r)e&&e(r);else{this.parent.isLoaded=!0,this.buffer=n;const o=this.parent.autoPlayStart();e&&e(null,this.parent,o)}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i)}}const ce=class{static from(s){let t={};typeof s=="string"?t.url=s:s instanceof ArrayBuffer||s instanceof AudioBuffer||s instanceof HTMLAudioElement?t.source=s:Array.isArray(s)?t.url=s:t=s,t={autoPlay:!1,singleInstance:!1,url:null,source:null,preload:!1,volume:1,speed:1,complete:null,loaded:null,loop:!1,...t},Object.freeze(t);const e=Xe().useLegacy?new Rd:new Od;return new ce(e,t)}constructor(s,t){this.media=s,this.options=t,this._instances=[],this._sprites={},this.media.init(this);const e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=!1,this._preloadQueue=null,this.isPlaying=!1,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded)}preferUrl(s){const[t]=s.map(e=>({url:e,ext:at.extname(e).slice(1)})).filter(({ext:e})=>Cs[e]).sort((e,i)=>Ss.indexOf(e.ext)-Ss.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return Xe().context}pause(){return this.isPlaying=!1,this.paused=!0,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=!1,this}get paused(){return this._paused}set paused(s){this._paused=s,this.refreshPaused()}get speed(){return this._speed}set speed(s){this._speed=s,this.refresh()}get filters(){return this.media.filters}set filters(s){this.media.filters=s}addSprites(s,t){if(typeof s=="object"){const i={};for(const r in s)i[r]=this.addSprites(r,s[r]);return i}console.assert(!this._sprites[s],`Alias ${s} is already taken`);const e=new Ld(this,t);return this._sprites[s]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null}removeSprites(s){if(s){const t=this._sprites[s];t!==void 0&&(t.destroy(),delete this._sprites[s])}else for(const t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=!1,this._autoPlayOptions=null,this;this.isPlaying=!1;for(let s=this._instances.length-1;s>=0;s--)this._instances[s].stop();return this}play(s,t){let e;if(typeof s=="string"?e={sprite:s,loop:this.loop,complete:t}:typeof s=="function"?(e={},e.complete=s):e=s,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:!1,loop:!1,...e||{}},e.sprite){const r=e.sprite;console.assert(!!this._sprites[r],`Alias ${r} is not available`);const n=this._sprites[r];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(r=>{this._preloadQueue.push(()=>{r(this.play(e))})}):(this._preloadQueue=[],this.autoPlay=!0,this._autoPlayOptions=e,new Promise((r,n)=>{this._preload((o,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,o?n(o):(e.loaded&&e.loaded(o,a,h),r(h))})}));(this.singleInstance||e.singleInstance)&&this._removeInstances();const i=this._createInstance();return this._instances.push(i),this.isPlaying=!0,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i)}),i.once("stop",()=>{this._onComplete(i)}),i.play(e),i}refresh(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refresh()}refreshPaused(){const s=this._instances.length;for(let t=0;t<s;t++)this._instances[t].refreshPaused()}get volume(){return this._volume}set volume(s){this._volume=s,this.refresh()}get muted(){return this._muted}set muted(s){this._muted=s,this.refresh()}get loop(){return this._loop}set loop(s){this._loop=s,this.refresh()}_preload(s){this.media.load(s)}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let s;return this.autoPlay&&(s=this.play(this._autoPlayOptions)),s}_removeInstances(){for(let s=this._instances.length-1;s>=0;s--)this._poolInstance(this._instances[s]);this._instances.length=0}_onComplete(s){if(this._instances){const t=this._instances.indexOf(s);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0}this._poolInstance(s)}_createInstance(){if(ce._pool.length>0){const s=ce._pool.pop();return s.init(this.media),s}return this.media.create()}_poolInstance(s){s.destroy(),ce._pool.indexOf(s)<0&&ce._pool.push(s)}};let qe=ce;qe._pool=[];class Ke extends Zo{constructor(){const t=window,e=new Ke.AudioContext,i=e.createDynamicsCompressor(),r=e.createAnalyser();r.connect(i),i.connect(e.destination),super(r,i),this.autoPause=!0,this._ctx=e,this._offlineCtx=new Ke.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=r,this.events=new ft,this.volume=1,this.speed=1,this.muted=!1,this.paused=!1,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,!0),document.addEventListener("touchstart",this._unlock,!0),document.addEventListener("touchend",this._unlock,!0)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur)}onFocus(){if(!this.autoPause)return;const t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused())}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=!0,this.refreshPaused()))}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,!0),document.removeEventListener("touchend",this._unlock,!0),document.removeEventListener("touchstart",this._unlock,!0),this._locked=!1))}playEmptySound(){const t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume()}static get AudioContext(){const t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){const t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();const t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t}get paused(){return this._paused}refresh(){this.events.emit("refresh")}refreshPaused(){this.events.emit("refreshPaused")}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){const i=n=>{e(new Error((n==null?void 0:n.message)||"Unable to decode file"))},r=this._offlineCtx.decodeAudioData(t,n=>{e(null,n)},i);r&&r.catch(i)}}class Wd{constructor(){this.init()}init(){return this.supported&&(this._webAudioContext=new Ke),this._htmlAudioContext=new Ed,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t)}get supported(){return Ke.AudioContext!==null}add(t,e){if(typeof t=="object"){const n={};for(const o in t){const a=this._getOptions(t[o],e);n[o]=this.add(o,a)}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof qe)return this._sounds[t]=e,e;const i=this._getOptions(e),r=qe.from(i);return this._sounds[t]=r,r}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext}get disableAutoPause(){return!this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t}remove(t){return this.exists(t,!0),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh()}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh()}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=!0,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=!1,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=!0,this._context.refresh(),this}unmuteAll(){return this._context.muted=!1,this._context.refresh(),this}removeAll(){for(const t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(const t in this._sounds)this._sounds[t].stop();return this}exists(t,e=!1){const i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(const t in this._sounds)if(this._sounds[t].isPlaying)return!0;return!1}find(t){return this.exists(t,!0),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){const i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){const i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}}const dn=s=>{var i;const t=s.src;let e=(i=s==null?void 0:s.alias)==null?void 0:i[0];return(!e||s.src===e)&&(e=at.basename(t,at.extname(t))),e},Ud={extension:I.Asset,detection:{test:async()=>!0,add:async s=>[...s,...Ss.filter(t=>Cs[t])],remove:async s=>s.filter(t=>s.includes(t))},loader:{name:"sound",extension:{type:[I.LoadParser],priority:Gt.High},test(s){const t=at.extname(s).slice(1);return!!Cs[t]||Bd.some(e=>s.startsWith(`data:${e}`))},async load(s,t){const e=await new Promise((i,r)=>qe.from({...t.data,url:s,preload:!0,loaded(n,o){var a,h;n?r(n):i(o),(h=(a=t.data)==null?void 0:a.loaded)==null||h.call(a,n,o)}}));return Xe().add(dn(t),e),e},async unload(s,t){Xe().remove(dn(t))}}};K.add(Ud);const j=kd(new Wd);class fn{constructor(t,e){G(this,"font");G(this,"difficulty");G(this,"game");G(this,"currentPlayerLives");G(this,"updatePlayerLives",!0);G(this,"updateEnemyLives",!0);G(this,"playerLives");G(this,"enemyLives");G(this,"outcome",null);this.font="",this.difficulty=t,this.game=e,this.currentPlayerLives=3,this.playerLives=[],this.enemyLives=[]}render(){this.updatePlayerLives&&(this.drawLives(this.game.playerLives),this.updatePlayerLives=!1,this.drawEnemyLives())}drawLives(t){let e=0;for(;e<t;){const i=yt.from("life");i.anchor=.5,i.x=10+15*e,i.y=10,i.width=12.5,i.height=12.5,i.label=`life${e+1}`,this.playerLives.push(i),this.game.app.stage.addChild(i),e++}}removeLife(){const t=this.game.app.stage.getChildByLabel("life1"),e=this.game.app.stage.getChildByLabel("life2"),i=this.game.app.stage.getChildByLabel("life3");i!==null&&!i.destroyed?i.destroy():e!==null&&!e.destroyed?e.destroy():t!==null&&t.destroy()}removeEnemyLife(){const t=this.game.app.stage.getChildByLabel("enemyLife1"),e=this.game.app.stage.getChildByLabel("enemyLife2"),i=this.game.app.stage.getChildByLabel("enemyLife3");i!==null&&!i.destroyed?i.destroy():e!==null&&!e.destroyed?e.destroy():t!==null&&t.destroy()}drawEnemyLives(){let t=0;for(;t<3;){const e=yt.from("wave");e.anchor=.5,e.x=this.game.app.screen.width-(10+t*15),e.y=10,e.width=12.5,e.height=12.5,e.label=`enemyLife${t+1}`,this.enemyLives.push(e),this.game.app.stage.addChild(e),t++}}shakeLives(t){if(this.game.framesRendered%30==0){const e=this.playerLives.filter(r=>!r.destroyed);this.playerLives.forEach(r=>{e.length==1&&(r.rotation==0?r.rotation=.5*1*t.deltaTime:r.rotation>0?r.rotation=.5*-1*t.deltaTime:r.rotation<0&&(r.rotation=.5*1*t.deltaTime))});const i=this.enemyLives.filter(r=>r.destroyed).length;this.enemyLives.forEach(r=>{i===2&&!r.destroyed&&r.label==="enemyLife1"&&(r.y==10||r.y>10?r.y=r.y-2*t.deltaTime:r.y<10&&(r.y=r.y+2*t.deltaTime))})}}renderOutcome(t,e,i){if(!this.game.app.stage.getChildByLabel("outcome")){const r=new Md({text:t,style:{fill:"#ffffff",fontSize:36,fontFamily:"silkscreen"},anchor:.5});return r.x=e,r.y=i,r.label="outcome",this.game.app.stage.addChild(r),r}}update(t){this.shakeLives(t)}}class we{constructor(t,e,i,r,n){G(this,"type");G(this,"texture");G(this,"sound");G(this,"speed");G(this,"yDirection");G(this,"behavior");G(this,"sprite");G(this,"entity");G(this,"stats");G(this,"game");G(this,"scattered",!1);G(this,"scatterSpeed",.25);this.stats=this.getStats(e),this.game=t.game,this.entity=t,this.type=e,this.texture=this.stats.texture,this.behavior=this.stats.behavior,this.speed=this.stats.speed,this.sound=this.stats.sound,this.yDirection=i,this.sprite=this.spawn(r,n),this.scatterSpeed=.25}spawn(t,e){const i=yt.from(this.texture);return i.x=t,i.y=e,i.anchor.set(.5),i.scale.set(.075),this.game.app.stage.addChild(i),j.play(this.sound,{volume:.45}),i}update(t){if(this.sprite.destroyed){this.entity.bullets=this.entity.bullets.filter(i=>!i.sprite.destroyed);return}const e=this.sprite.getBounds();if(e.y<-(this.sprite.height+5)||e.y>this.game.app.screen.height+this.sprite.height)this.sprite.destroy(),this.entity.bullets=this.entity.bullets.filter(i=>!i.sprite.destroyed);else{switch(this.type){case 1:this.entity.constructor.name=="Enemy"&&(console.log(this.entity.constructor.name),this.sprite.tint="#ff1362");break;case 2:this.sprite.width+=.2*t.deltaTime,this.sprite.height+=.2*t.deltaTime;break;case 3:this.sprite.y>this.game.app.screen.height/2-20&&!this.scattered&&this.sprite.label!=="left"&&this.sprite.label!=="right"&&this.scatter(this),this.sprite.rotation+=.5*t.deltaTime;break}this.sprite.y+=this.stats.speed*this.yDirection*.2*t.deltaTime,this.sprite.label=="left"?this.sprite.x-=this.scatterSpeed*t.deltaTime:this.sprite.label=="right"&&(this.sprite.x+=this.scatterSpeed*t.deltaTime)}}scatter(t){let e=t.sprite.x-t.sprite.width/2;const i=t.sprite.y,r=new we(t.entity,t.type,t.yDirection,e,i);r.sprite.label="left",r.sprite.alpha=.5,this.entity.bullets.push(r),e=t.sprite.x+t.sprite.width/2;const n=new we(t.entity,t.type,t.yDirection,e,i);n.sprite.label="right",n.sprite.alpha=.5,t.scattered=!0,this.entity.bullets.push(n)}getStats(t){return{1:{texture:"bullet1",behavior:"normal",speed:9,sound:"enemyShoot1"},2:{texture:"bullet2",behavior:"grow",speed:6,sound:"shoot1"},3:{texture:"bullet3",behavior:"scatter",speed:10-.75,sound:"enemyShoot"}}[t]}}class ea{constructor(t,e,i){G(this,"health");G(this,"texture");G(this,"fireRate");G(this,"bulletType");G(this,"sprite");G(this,"game");G(this,"shootCooldown",250);G(this,"shootOnCooldown",!1);G(this,"bullets",[]);this.health=e,this.texture="",this.fireRate=0,this.bulletType=t,this.sprite=yt.from(""),this.game=i}takeDamage(){this.health--,this.health<=0?(this.destroy(),this.game.removeLife(this)):j.play("hit")}collided(t){if(this.sprite.destroyed||t.destroyed)return!1;const e=this.sprite.getBounds(),i=t.getBounds();return e.x<i.x+i.width&&e.x+e.width>i.x&&e.y<i.y+i.height&&e.y+e.height>i.y}shoot(){if(!this.sprite)return;const t=this.sprite.x,e=this.sprite.y;new we(this,this.bulletType,1,t,e)}update(t){this.bullets.forEach(e=>{e.update(t)})}destroy(){const t=de.cache.get("explosion").animations,e=new ws(t.explosion),i=this.sprite.getBounds();e.animationSpeed=.16,e.loop=!1,e.position.set(i.x,i.y),e.play(),j.play("explosion2"),this.game.app.stage.addChild(e),this.sprite.destroy(),setTimeout(()=>{e.destroy()},500)}}class ri extends ea{constructor(t,e){super(1,t,e),this.texture="player"}spawn(){const t=yt.from(this.texture);return t.anchor.set(.5),t.scale.set(.05),t.position.set(this.game.app.screen.width/2,this.game.app.screen.height-t.height),t.label="player",this.game.app.stage.addChild(t),this.sprite=t,this.game.app.stage.on("pointermove",this.move.bind(this)),t}shoot(){if(!this.sprite||this.shootOnCooldown)return;const t=this.sprite.x,e=this.sprite.y,i=new we(this,this.bulletType,-1,t,e);this.sprite&&this.bullets.push(i),this.cooldown()}cooldown(){this.shootOnCooldown=!0,setTimeout(()=>{this.shootOnCooldown=!1},this.shootCooldown)}move(t){if(!this.sprite.destroyed){const e=this.sprite.width/2,i=this.sprite.height/2,r=t.global;r.x<=this.game.app.screen.width-e&&r.x>=e&&(this.sprite.x=r.x),r.y<=this.game.app.screen.height-i&&r.y>=i&&(this.sprite.y=r.y)}}takeDamage(){if(this.health--,this.game.playerDamageTaken++,this.game.removeLife(this),this.health<=0){this.game.music.stop(),this.destroy();const t=Math.floor(Math.random()*2)+1;setTimeout(()=>{j.play(`player_death_${t}`,{complete:()=>{this.game.end(!1)}})},400)}else j.play(`player_hit_0${this.game.playerDamageTaken}`)}update(t){super.update(t),this.game.enemies.forEach(e=>{e.bullets.forEach(i=>{this.collided(i.sprite)&&(i.sprite.destroy(),this.takeDamage())})})}}class pn extends ea{constructor(e,i){super(e,0,i);G(this,"direction",1);G(this,"stats");this.stats=this.getStats(e),this.health=this.stats.health,this.texture=this.stats.texture,this.fireRate=this.stats.fireRate,this.sprite=this.spawn(),this.shootCooldown=this.stats.fireRate}spawn(){const e=yt.from(this.texture);return e.anchor=.5,e.scale.set(.075),e.x=Math.floor(Math.random()*this.game.app.stage.width),e.y=-e.height,e.rotation=Math.PI,this.game.app.stage.addChild(e),e}update(e){this.sprite.destroyed?this.sprite.destroyed&&this.bullets.length===0&&(this.game.enemies=[]):(this.move(),this.shoot()),this.bullets.forEach(i=>{i.update(e)}),this.game.player.bullets.forEach(i=>{this.collided(i.sprite)&&(i.sprite.destroy(),this.takeDamage())})}shoot(){if(!this.sprite||this.shootOnCooldown||this.game.player.sprite.destroyed)return;const e=this.sprite.x,i=this.sprite.y,r=new we(this,this.bulletType,1,e,i);this.sprite&&this.bullets.push(r),this.cooldown()}move(){if(this.sprite.y<25)this.sprite.y+=1;else{const e=this.direction;let i=e;Math.floor(Math.random()*500)===1?i=-i:(this.sprite.x>=this.game.app.screen.width-this.sprite.width/2&&e==1||this.sprite.x>=this.game.app.screen.width&&e==-1?i=-1:(this.sprite.x<=this.game.app.screen.width&&e==1||this.sprite.x<=15&&e==-1)&&(i=1),this.sprite.x+=i),this.direction=i}}cooldown(){this.shootOnCooldown=!0,setTimeout(()=>{this.shootOnCooldown=!1},this.shootCooldown)}getStats(e){return{1:{texture:"enemy1",health:1,fireRate:750},2:{texture:"enemy2",health:4,fireRate:800},3:{texture:"enemy3",health:6,fireRate:750}}[e]}}const zd=240,Hd=160;class Nd{constructor(){G(this,"app");G(this,"ready",!1);G(this,"width",zd);G(this,"height",Hd);G(this,"difficulty",0);G(this,"playerLives",3);G(this,"playerKills",0);G(this,"playerDamageTaken",0);G(this,"music");G(this,"player");G(this,"ui");G(this,"state","loading");G(this,"enemies",[]);G(this,"framesRendered");this.app=new go,this.music=qe.from({url:"assets/sounds/bgm.wav",preload:!0,loop:!0,volume:.25}),this.ui=new fn(this.difficulty,this),this.framesRendered=0,this.player=new ri(3,this)}listen(){window.addEventListener("message",t=>{switch(t.data.op){case"start":t.data.difficulty!==void 0&&t.data.difficulty!==null&&(this.difficulty=t.data.difficulty),this.restart(),window.parent.postMessage({op:"started",verb:"shoot!"});break;default:console.log(`shoot! - received unknown event: ${t}`);break}}),this.ready=!0,this.music.play(),window.parent.postMessage({op:"ready"})}async preload(){const t=[{alias:"background",src:"/games/sunshoes/assets/sprites/bg.png"},{alias:"player",src:"/games/sunshoes/assets/sprites/player.png"},{alias:"bullet1",src:"/games/sunshoes/assets/sprites/bullet1.png"},{alias:"bullet2",src:"/games/sunshoes/assets/sprites/bullet2.png"},{alias:"bullet3",src:"/games/sunshoes/assets/sprites/bullet3.png"},{alias:"enemy1",src:"/games/sunshoes/assets/sprites/enemy1.png"},{alias:"enemy2",src:"/games/sunshoes/assets/sprites/enemy2.png"},{alias:"enemy3",src:"/games/sunshoes/assets/sprites/enemy3.png"},{alias:"life",src:"/games/sunshoes/assets/sprites/mrgreen.png"},{alias:"wave",src:"/games/sunshoes/assets/sprites/mrred.png"},{alias:"explosion",src:"/games/sunshoes/assets/animations/explosion.json"},{alias:"silkscreen",src:"/games/sunshoes/assets/ui/silkscreen_regular.ttf",data:{family:"silkscreen"}},{alias:"bungeespice",src:"/games/sunshoes/assets/ui/bungeespice.ttf",data:{family:"bungeespice"}}];j.add("bgm","/games/sunshoes/assets/sounds/bgm.wav"),j.add("shoot","/games/sunshoes/assets/sounds/shoot.wav"),j.add("shoot1","/games/sunshoes/assets/sounds/shoot1.wav"),j.add("enemyShoot","/games/sunshoes/assets/sounds/enemyShoot.wav"),j.add("enemyShoot1","/games/sunshoes/assets/sounds/enemyShoot1.wav"),j.add("hit","/games/sunshoes/assets/sounds/hit.wav"),j.add("success","/games/sunshoes/assets/sounds/success.wav"),j.add("failure","/games/sunshoes/assets/sounds/failure.wav"),j.add("explosion2","/games/sunshoes/assets/sounds/explosion2.wav"),j.add("player_hit_01","/games/sunshoes/assets/sounds/pain_jack_01.wav"),j.add("player_hit_02","/games/sunshoes/assets/sounds/pain_jack_02.wav"),j.add("player_hit_03","/games/sunshoes/assets/sounds/pain_jack_03.wav"),j.add("player_death_1","/games/sunshoes/assets/sounds/death_jack_01.wav"),j.add("player_death_2","/games/sunshoes/assets/sounds/death_jack_02.wav"),j.disableAutoPause=!0,await de.load(t)}setup(){(this.player.sprite.texture==null||this.player.sprite.texture.label==="EMPTY")&&(this.player=new ri(this.playerLives,this),this.player.spawn()),this.drawUI(),this.app.stage.onclick=()=>{this.player.sprite.destroyed||this.player.shoot()}}async initialize(){await this.app.init({width:this.width,height:this.height,background:"#1e1e1f"}),document.getElementById("container").appendChild(this.app.canvas);const t=yt.from("background");this.app.stage.addChild(t),this.app.stage.interactive=!0,this.app.renderer.events.cursorStyles.default="none",this.setup(),this.state="playing"}drawUI(){this.ui.outcome!==null&&this.ui.outcome!==void 0&&this.ui.outcome.destroy(),this.ui.render()}removeLife(t){t instanceof ri?this.ui.removeLife():t instanceof pn&&(this.ui.removeEnemyLife(),this.playerKills++)}update(t){if(this.framesRendered+=1,this.ui.update(t),this.player.update(t),this.enemies.length>0)this.enemies.forEach(e=>{e.update(t)});else if(this.playerKills<3){const e=new pn(this.playerKills+1,this);this.enemies.push(e)}this.playerKills===3&&this.state!=="ended"?this.end(!0):this.playerDamageTaken===this.playerLives&&this.state}end(t){this.ready=!1;const e=this.width/2,i=this.height/2,r=t?"YOU WIN!":"YOU LOSE!",n=t?"success":"failure";!j.find(n).isPlaying&&this.state!=="ended"&&(this.ui.outcome=this.ui.renderOutcome(r,e,i),this.app.stage.onclick=null,j.stopAll(),this.music.stop(),this.state="ended",setTimeout(()=>{j.play(n,{volume:.25,complete:()=>{for(;this.playerKills>0;)this.ui.removeEnemyLife(),this.playerKills--;for(;this.playerLives>0;)this.ui.removeLife(),this.playerLives--;this.app.stop(),window.parent.postMessage({op:"done",win:t})}})},500))}restart(){for(this.music.stop(),j.stopAll(),this.state="loading",this.player.bullets.forEach(t=>{t.sprite.destroyed||t.sprite.destroy()}),this.enemies.forEach(t=>{t.sprite.destroyed||t.sprite.destroy()}),this.enemies=[],this.teardown();this.playerKills>0;)this.ui.removeEnemyLife(),this.playerKills--;for(;this.playerLives>0;)this.ui.removeLife(),this.playerLives--;this.playerLives=3,this.playerKills=0,this.playerDamageTaken=0,this.app.stage.removeChild(this.player.sprite),this.player.sprite.destroy(),this.ui=new fn(this.difficulty,this),this.ui.updatePlayerLives=!0,this.setup(),this.listen(),this.app.start()}teardown(){var e,i;this.ui.outcome&&(this.app.stage.removeChild(this.ui.outcome),(e=this.ui.outcome)==null||e.destroy(),(i=this.app.stage.getChildByLabel("outcome"))==null||i.destroy());const t=this.app.stage.getChildByLabel("outcome");t!==null&&t.destroy()}triggerRestart(t=10){window.postMessage({op:"start",difficulty:t})}}(async()=>{const s=new Nd;await s.preload(),await s.initialize(),s.listen();const t=s.app;window.restart=()=>{s.restart()},window.triggerRestart=()=>{s.triggerRestart()},t.ticker.add(e=>{s.update(e)})})();export{fi as $,At as A,je as B,Ot as C,ko as D,ft as E,K as F,Ms as G,Ro as H,be as I,te as J,$ as K,fs as L,Mn as M,W as N,Es as O,Bc as P,Yu as Q,tt as R,Fi as S,U as T,Nc as U,Ln as V,Ft as W,Is as X,Un as Y,z as Z,lo as _,Kn as a,dt as a0,ze as a1,lt as a2,Fa as a3,Ut as a4,Ol as a5,Tr as a6,ps as a7,Bi as a8,oo as a9,gc as aA,yc as aB,Cc as aC,Ac as aD,Tc as aE,Ku as aF,St as aa,to as ab,mc as ac,_c as ad,Sc as ae,wc as af,wa as ag,Pc as ah,Tn as ai,vt as aj,Ts as ak,ar as al,yt as am,Td as an,Za as ao,lr as ap,Hs as aq,cr as ar,th as as,kn as at,co as au,Qe as av,sl as aw,Qh as ax,Ql as ay,Vl as az,ye as b,Mi as c,X as d,q as e,ki as f,ds as g,As as h,Ho as i,No as j,wt as k,Yd as l,md as m,sd as n,nt as o,O as p,wh as q,zl as r,pt as s,J as t,Ih as u,_t as v,Y as w,Po as x,Rn as y,I as z}; diff --git a/2026/games_submissions/sunshoes/assets/logo.svg b/2026/games_submissions/sunshoes/assets/logo.svg deleted file mode 100644 index 81b6418..0000000 --- a/2026/games_submissions/sunshoes/assets/logo.svg +++ /dev/null @@ -1,54 +0,0 @@ -<svg width="735" height="289" viewBox="0 0 735 289" fill="none" xmlns="http://www.w3.org/2000/svg"> -<g clip-path="url(#clip0_7_84)"> -<path d="M304.17 288.01V89.99H244.97C244.77 89.99 244.56 89.99 244.34 90C233.7 90.37 225.15 99.12 225.05 109.76C225.05 109.82 225.05 109.88 225.05 109.93V268.4C225.05 268.73 225.07 269.1 225.1 269.51C226 279.71 234.54 287.53 244.77 287.97C245.2 287.99 245.61 288 245.99 288H304.17V288.01Z" fill="#E72264"/> -<path d="M548.21 287.91C559.24 287.08 567.97 278 568.05 266.93C568.05 266.86 568.05 266.79 568.05 266.72V110.16C568.05 110.1 568.05 110.03 568.05 109.97C568 99.03 559.1 90.11 548.16 90C548.08 90 548 90 547.92 90H488.93V288.02H545.74C546.51 288.02 547.34 287.98 548.21 287.92V287.91Z" fill="#E72264"/> -<path d="M293.07 90H355.07C361.15 90 369.75 94.92 374.29 101L505.76 277C510.3 283.08 509.05 288 502.98 288H440.98C434.9 288 426.3 283.08 421.76 277L290.28 101C285.74 94.93 286.99 90 293.06 90H293.07Z" fill="#E72264"/> -<path d="M498.07 90H436.07C429.99 90 421.39 94.92 416.85 101L285.38 277C280.84 283.08 282.09 288 288.16 288H350.16C356.24 288 364.84 283.08 369.38 277L500.85 101C505.39 94.93 504.14 90 498.07 90Z" fill="#E72264"/> -<path d="M529.07 0C550.05 0 567.07 17.01 567.07 38C567.07 58.99 550.06 76 529.07 76C508.08 76 491.07 58.99 491.07 38C491.07 17.01 508.08 0 529.07 0Z" fill="#E72264"/> -<path d="M265.07 0C286.05 0 303.07 17.01 303.07 38C303.07 58.99 286.06 76 265.07 76C244.08 76 227.07 58.99 227.07 38C227.07 17.01 244.08 0 265.07 0Z" fill="#E72264"/> -<path d="M695.07 0H635.07C613.53 0 596.07 17.46 596.07 39V99C596.07 120.54 613.53 138 635.07 138H695.07C716.61 138 734.07 120.54 734.07 99V39C734.07 17.46 716.61 0 695.07 0ZM655.44 39.34V79.84C655.44 85.3 654.35 90.04 652.17 94.05C649.99 98.06 646.88 101.17 642.84 103.38C638.8 105.59 634.01 106.7 628.48 106.7C623.78 106.7 619.72 105.85 616.29 104.16C612.86 102.47 609.98 100.1 607.63 97.06C607.63 97.06 601.08 89.99 607.08 85C613.21 79.9 618.52 86.58 618.52 86.58C619.76 88.31 621.23 89.61 622.93 90.47C624.62 91.34 626.54 91.77 628.69 91.77C630.69 91.77 632.46 91.36 633.98 90.53C635.5 89.7 636.71 88.46 637.61 86.8C638.51 85.14 638.96 83.1 638.96 80.68V39.35C638.96 39.35 638.8 31.01 647.08 31.01C655.36 31.01 655.45 39.35 655.45 39.35L655.44 39.34ZM714.35 98.38C709.82 102.86 703.15 105.56 694.35 106.48C688.3 107.12 683.02 106.7 678.52 105.23C674.02 103.76 669.81 101.21 665.88 97.59C665.88 97.59 659.8 92.35 664.7 85.77C668.38 80.82 675.3 85.96 675.3 85.96C677.92 88.4 680.73 90.2 683.74 91.38C686.75 92.56 690.14 92.95 693.93 92.55C697.3 92.2 699.86 91.28 701.62 89.81C703.38 88.34 704.14 86.5 703.91 84.3C703.71 82.38 702.94 80.86 701.61 79.75C700.28 78.64 698.53 77.75 696.37 77.07C694.21 76.39 691.89 75.79 689.4 75.25C686.91 74.71 684.39 74.02 681.83 73.18C679.27 72.34 676.9 71.23 674.7 69.86C672.5 68.49 670.66 66.64 669.16 64.29C667.66 61.94 666.72 58.95 666.34 55.31C665.86 50.77 666.54 46.77 668.36 43.31C670.19 39.85 672.97 37.07 676.71 34.97C680.45 32.87 684.8 31.56 689.75 31.04C694.91 30.5 699.68 30.9 704.06 32.24C708.44 33.59 712.17 35.63 715.24 38.36C715.24 38.36 719.54 41.97 716.05 48.18C713.34 53.01 705.73 50.11 705.73 50.11C703.29 48.07 700.89 46.62 698.55 45.76C696.2 44.9 693.65 44.61 690.9 44.9C688.08 45.2 685.9 45.97 684.36 47.2C682.82 48.44 682.16 50.06 682.37 52.05C682.56 53.84 683.33 55.23 684.69 56.24C686.05 57.24 687.78 58.05 689.9 58.66C692.01 59.27 694.34 59.86 696.86 60.43C699.39 61 701.93 61.69 704.48 62.5C707.03 63.31 709.4 64.47 711.57 65.98C713.74 67.49 715.6 69.45 717.14 71.86C718.68 74.27 719.65 77.4 720.06 81.25C720.79 88.2 718.89 93.91 714.35 98.38Z" fill="#E72264"/> -<path d="M107.17 0.340088C47.98 0.340088 0 48.3201 0 107.51C0 108.67 0.02 109.82 0.06 110.97V213.96C0.06 213.96 0.06 213.97 0.06 213.98V224.45C0.06 224.45 0.06 224.45 0.07 224.44V250.33C0.07 250.53 0.06 250.72 0.06 250.92C0.06 251.12 0.07 251.32 0.08 251.52V252H0.09C0.66 271.89 16.95 287.84 36.98 287.84C57.01 287.84 73.47 271.89 74.04 252V213.98H104.66C105.49 214 106.33 214.01 107.16 214.01C166.35 214.01 214.33 166.7 214.33 107.51C214.33 48.3201 166.36 0.340088 107.17 0.340088ZM107.17 140.01C100.62 140.01 84.02 140.01 77.13 140.01H74.07V107.52C74.07 89.3101 88.96 74.5401 107.17 74.5401C125.38 74.5401 140.15 89.3101 140.15 107.52C140.15 125.73 125.38 140.02 107.17 140.02V140.01Z" fill="#E72264"/> -<path opacity="0.15" d="M36.05 214H73.99V252.01H73.82C73.25 271.9 56.96 287.85 36.93 287.85C16.9 287.85 0.6 271.9 0.03 252.01H0.02V251.53C0.02 251.33 0 251.13 0 250.93C0 250.73 0.01 250.54 0.01 250.34V247.66C1.15 229.87 17.94 214 36.04 214H36.05Z" fill="#1D1D1B"/> -<g opacity="0.05"> -<path opacity="0.5" d="M0.0599976 168.28V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03V125.45C44.2 128.59 17.77 144.66 0.0599976 168.28Z" fill="black"/> -<path d="M0.119995 248.37C8.84 241.97 19.42 238.2 30.84 238.2H74.06V213.98H37.03C17.47 213.98 1.48 229.15 0.119995 248.37Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V126.79C43.95 129.74 17.39 146.16 0.0599976 170.27V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C18 213.98 2.34001 228.35 0.26001 246.83C8.97001 240.03 19.73 236.01 31.4 236.01H74.05V213.99H37.02L37.03 213.98Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V128.12C43.68 130.87 16.95 147.69 0.0599976 172.34V213.97C0.0599976 173.71 33.89 140.57 74.05 140.02V140.03Z" fill="black"/> -<path d="M37.03 213.98C18.53 213.98 3.22002 227.55 0.460022 245.28C9.12002 238.09 20.06 233.8 31.96 233.8H74.05V213.98H37.02H37.03Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V129.46C43.37 132 16.46 149.28 0.0599976 174.53V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C19.06 213.98 4.08998 226.79 0.72998 243.77C9.31998 236.18 20.41 231.6 32.53 231.6H74.06V213.98H37.03Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V130.81C43.01 133.11 15.89 150.93 0.0599976 176.84V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C19.6 213.98 5.00001 226.03 1.07001 242.24C9.54001 234.26 20.77 229.39 33.09 229.39H74.05V213.97H37.02L37.03 213.98Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V132.16C42.6 134.22 15.22 152.65 0.0599976 179.32V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C20.15 213.98 5.92998 225.28 1.47998 240.71C9.79998 232.34 21.14 227.19 33.66 227.19H74.06V213.98H37.03Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V133.52C42.12 135.31 14.43 154.48 0.0599976 182.01V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C20.72 213.98 6.88001 224.54 1.95001 239.19C10.08 230.44 21.53 224.99 34.21 224.99H74.05V213.98H37.02H37.03Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V134.89C41.53 136.39 13.47 156.46 0.0599976 185V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C21.28 213.98 7.83999 223.83 2.48999 237.7C10.4 228.56 21.92 222.79 34.78 222.79H74.06V213.98H37.03Z" fill="black"/> -</g> -<g opacity="0.05"> -<path opacity="0.5" d="M74.05 140.03V136.29C40.78 137.48 12.24 158.68 0.0599976 188.47V213.98C0.0599976 173.72 33.89 140.58 74.05 140.03Z" fill="black"/> -<path d="M37.03 213.98C21.85 213.98 8.80999 223.13 3.10999 236.21C10.74 226.68 22.34 220.59 35.35 220.59H74.06V213.98H37.03Z" fill="black"/> -</g> -</g> -<defs> -<clipPath id="clip0_7_84"> -<rect width="734.07" height="288.01" fill="white"/> -</clipPath> -</defs> -</svg> diff --git a/2026/games_submissions/sunshoes/assets/sounds/bgm.wav b/2026/games_submissions/sunshoes/assets/sounds/bgm.wav Binary files differdeleted file mode 100644 index 521c4d3..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/bgm.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/death_jack_01.wav b/2026/games_submissions/sunshoes/assets/sounds/death_jack_01.wav Binary files differdeleted file mode 100644 index 87d74e2..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/death_jack_01.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/death_jack_02.wav b/2026/games_submissions/sunshoes/assets/sounds/death_jack_02.wav Binary files differdeleted file mode 100644 index 668ee8c..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/death_jack_02.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/enemyShoot.wav b/2026/games_submissions/sunshoes/assets/sounds/enemyShoot.wav Binary files differdeleted file mode 100644 index 2b1bd9c..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/enemyShoot.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/enemyShoot1.wav b/2026/games_submissions/sunshoes/assets/sounds/enemyShoot1.wav Binary files differdeleted file mode 100644 index 6da85a0..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/enemyShoot1.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/explode3.wav b/2026/games_submissions/sunshoes/assets/sounds/explode3.wav Binary files differdeleted file mode 100644 index ce351b8..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/explode3.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/explosion.wav b/2026/games_submissions/sunshoes/assets/sounds/explosion.wav Binary files differdeleted file mode 100644 index bb02923..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/explosion.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/explosion2.wav b/2026/games_submissions/sunshoes/assets/sounds/explosion2.wav Binary files differdeleted file mode 100644 index 8b55562..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/explosion2.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/failure.wav b/2026/games_submissions/sunshoes/assets/sounds/failure.wav Binary files differdeleted file mode 100644 index f5e6bdf..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/failure.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/hit.wav b/2026/games_submissions/sunshoes/assets/sounds/hit.wav Binary files differdeleted file mode 100644 index 404f869..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/hit.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/pain_jack_01.wav b/2026/games_submissions/sunshoes/assets/sounds/pain_jack_01.wav Binary files differdeleted file mode 100644 index 52ec0f1..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/pain_jack_01.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/pain_jack_02.wav b/2026/games_submissions/sunshoes/assets/sounds/pain_jack_02.wav Binary files differdeleted file mode 100644 index 86e796b..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/pain_jack_02.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/pain_jack_03.wav b/2026/games_submissions/sunshoes/assets/sounds/pain_jack_03.wav Binary files differdeleted file mode 100644 index 7985efa..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/pain_jack_03.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/shoot.wav b/2026/games_submissions/sunshoes/assets/sounds/shoot.wav Binary files differdeleted file mode 100644 index 1b24753..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/shoot.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/shoot1.wav b/2026/games_submissions/sunshoes/assets/sounds/shoot1.wav Binary files differdeleted file mode 100644 index 13bfdf0..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/shoot1.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sounds/success.wav b/2026/games_submissions/sunshoes/assets/sounds/success.wav Binary files differdeleted file mode 100644 index 9ec0a03..0000000 --- a/2026/games_submissions/sunshoes/assets/sounds/success.wav +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/bg.png b/2026/games_submissions/sunshoes/assets/sprites/bg.png Binary files differdeleted file mode 100644 index 0860020..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/bg.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/bullet1.png b/2026/games_submissions/sunshoes/assets/sprites/bullet1.png Binary files differdeleted file mode 100644 index 1f7a8df..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/bullet1.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/bullet2.png b/2026/games_submissions/sunshoes/assets/sprites/bullet2.png Binary files differdeleted file mode 100644 index ec08181..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/bullet2.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/bullet3.png b/2026/games_submissions/sunshoes/assets/sprites/bullet3.png Binary files differdeleted file mode 100644 index e027ad5..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/bullet3.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/enemy1.png b/2026/games_submissions/sunshoes/assets/sprites/enemy1.png Binary files differdeleted file mode 100644 index 59b173e..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/enemy1.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/enemy2.png b/2026/games_submissions/sunshoes/assets/sprites/enemy2.png Binary files differdeleted file mode 100644 index 78ce9ad..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/enemy2.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/enemy3.png b/2026/games_submissions/sunshoes/assets/sprites/enemy3.png Binary files differdeleted file mode 100644 index e4b0214..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/enemy3.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/mrgreen.png b/2026/games_submissions/sunshoes/assets/sprites/mrgreen.png Binary files differdeleted file mode 100644 index 4245197..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/mrgreen.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/mrred.png b/2026/games_submissions/sunshoes/assets/sprites/mrred.png Binary files differdeleted file mode 100644 index 3b4324a..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/mrred.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/sprites/player.png b/2026/games_submissions/sunshoes/assets/sprites/player.png Binary files differdeleted file mode 100644 index 6327f5e..0000000 --- a/2026/games_submissions/sunshoes/assets/sprites/player.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/ui/bungeespice.ttf b/2026/games_submissions/sunshoes/assets/ui/bungeespice.ttf Binary files differdeleted file mode 100644 index 8040ccf..0000000 --- a/2026/games_submissions/sunshoes/assets/ui/bungeespice.ttf +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/ui/silkscreen_regular.ttf b/2026/games_submissions/sunshoes/assets/ui/silkscreen_regular.ttf Binary files differdeleted file mode 100644 index 8caff81..0000000 --- a/2026/games_submissions/sunshoes/assets/ui/silkscreen_regular.ttf +++ /dev/null diff --git a/2026/games_submissions/sunshoes/assets/webworkerAll-3Ebn88U3.js b/2026/games_submissions/sunshoes/assets/webworkerAll-3Ebn88U3.js deleted file mode 100644 index 00cf31e..0000000 --- a/2026/games_submissions/sunshoes/assets/webworkerAll-3Ebn88U3.js +++ /dev/null @@ -1,83 +0,0 @@ -import{N as k,K as O,c as A,aF as M,aj as P,z as b,G as U,a as E,ab as z,a7 as V,ak as _,T as v,ay as Y,$ as X,w as q,F as R}from"./index-DvAPfvr6.js";import{F as L}from"./Filter-BiIvpnZm.js";const y=new k;function G(m,e){e.clear();const t=e.matrix;for(let r=0;r<m.length;r++){const i=m[r];if(i.globalDisplayStatus<7)continue;const n=i.renderGroup??i.parentRenderGroup;n!=null&&n.isCachedAsTexture?e.matrix=y.copyFrom(n.textureOffsetInverseTransform).append(i.worldTransform):n!=null&&n._parentCacheAsTextureRenderGroup?e.matrix=y.copyFrom(n._parentCacheAsTextureRenderGroup.inverseWorldTransform).append(i.groupTransform):e.matrix=i.worldTransform,e.addBounds(i.bounds)}return e.matrix=t,e}function S(m){return typeof m.getCanvasFilterString=="function"}class W{constructor(){this.skip=!1,this.useClip=!1,this.filters=null,this.container=null,this.bounds=new P,this.cssFilterString=""}}class C{constructor(e){this._filterStack=[],this._filterStackIndex=0,this._savedStates=[],this._alphaMultiplier=1,this._warnedFilterTypes=new Set,this.renderer=e}push(e){const t=this._pushFilterFrame(),r=e.filterEffect.filters;if(t.skip=!1,t.useClip=!1,t.filters=r,t.container=e.container,t.cssFilterString="",r.every(o=>!o.enabled)){t.skip=!0;return}const i=[],n=1;for(const o of r){if(!o.enabled)continue;if(!S(o)){this._warnUnsupportedFilter(o);continue}const l=o.getCanvasFilterString();if(l===null){this._warnUnsupportedFilter(o);continue}l&&i.push(l)}if(i.length===0&&n===1){t.skip=!0;return}t.cssFilterString=i.join(" "),this._calculateFilterArea(e,t.bounds),t.useClip=!!e.filterEffect.filterArea;const s=this.renderer.canvasContext.activeContext,a=s.filter||"none";if(this._savedStates.push({filter:a,alphaMultiplier:this._alphaMultiplier}),t.useClip&&Number.isFinite(t.bounds.width)&&Number.isFinite(t.bounds.height)&&t.bounds.width>0&&t.bounds.height>0){const o=this.renderer.canvasContext.activeResolution||1;s.save(),s.setTransform(1,0,0,1,0,0),s.beginPath(),s.rect(t.bounds.x*o,t.bounds.y*o,t.bounds.width*o,t.bounds.height*o),s.clip()}else t.useClip=!1;t.cssFilterString&&(s.filter=a!=="none"?`${a} ${t.cssFilterString}`:t.cssFilterString)}pop(){const e=this._popFilterFrame();if(e.skip)return;const t=this._savedStates.pop();if(!t)return;const r=this.renderer.canvasContext.activeContext;e.useClip?r.restore():r.filter=t.filter,this._alphaMultiplier=t.alphaMultiplier}generateFilteredTexture({texture:e,filters:t}){if(!(t!=null&&t.length)||t.every(d=>!d.enabled))return e;const r=[],i=1;for(const d of t){if(!d.enabled)continue;if(!S(d)){this._warnUnsupportedFilter(d);continue}const F=d.getCanvasFilterString();if(F===null){this._warnUnsupportedFilter(d);continue}F&&r.push(F)}if(r.length===0&&i===1)return e;const n=O.getCanvasSource(e);if(!n)return e;const s=e.frame,a=e.source._resolution??e.source.resolution??1,o=s.width,l=s.height,f=A.getOptimalCanvasAndContext(o,l,a),{canvas:c,context:u}=f;u.setTransform(1,0,0,1,0,0),u.clearRect(0,0,c.width,c.height),r.length&&(u.filter=r.join(" "));const p=s.x*a,h=s.y*a,x=o*a,T=l*a;return u.drawImage(n,p,h,x,T,0,0,x,T),u.filter="none",u.globalAlpha=1,M(c,o,l,a)}_calculateFilterArea(e,t){if(e.renderables?G(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const r=e.container.renderGroup||e.container.parentRenderGroup,i=r==null?void 0:r.cacheToLocalTransform;i&&t.applyMatrix(i)}}_warnUnsupportedFilter(e){var r;const t=((r=e==null?void 0:e.constructor)==null?void 0:r.name)||"Filter";this._warnedFilterTypes.has(t)||(this._warnedFilterTypes.add(t),console.warn(`CanvasRenderer: filter "${t}" is not supported in Canvas2D and will be skipped.`))}get alphaMultiplier(){return this._alphaMultiplier}_pushFilterFrame(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new W),this._filterStackIndex++,e}_popFilterFrame(){return this._filterStackIndex<=0?this._filterStack[0]:(this._filterStackIndex--,this._filterStack[this._filterStackIndex])}destroy(){this._filterStack=null,this._savedStates=null,this._warnedFilterTypes=null,this._alphaMultiplier=1}}C.extension={type:[b.CanvasSystem],name:"filter"};var j=`in vec2 aPosition; -out vec2 vTextureCoord; - -uniform vec4 uInputSize; -uniform vec4 uOutputFrame; -uniform vec4 uOutputTexture; - -vec4 filterVertexPosition( void ) -{ - vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; - - position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; - position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; - - return vec4(position, 0.0, 1.0); -} - -vec2 filterTextureCoord( void ) -{ - return aPosition * (uOutputFrame.zw * uInputSize.zw); -} - -void main(void) -{ - gl_Position = filterVertexPosition(); - vTextureCoord = filterTextureCoord(); -} -`,N=`in vec2 vTextureCoord; -out vec4 finalColor; -uniform sampler2D uTexture; -void main() { - finalColor = texture(uTexture, vTextureCoord); -} -`,w=`struct GlobalFilterUniforms { - uInputSize: vec4<f32>, - uInputPixel: vec4<f32>, - uInputClamp: vec4<f32>, - uOutputFrame: vec4<f32>, - uGlobalFrame: vec4<f32>, - uOutputTexture: vec4<f32>, -}; - -@group(0) @binding(0) var <uniform> gfu: GlobalFilterUniforms; -@group(0) @binding(1) var uTexture: texture_2d<f32>; -@group(0) @binding(2) var uSampler: sampler; - -struct VSOutput { - @builtin(position) position: vec4<f32>, - @location(0) uv: vec2<f32> -}; - -fn filterVertexPosition(aPosition: vec2<f32>) -> vec4<f32> -{ - var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; - - position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; - position.y = position.y * (2.0 * gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; - - return vec4(position, 0.0, 1.0); -} - -fn filterTextureCoord(aPosition: vec2<f32>) -> vec2<f32> -{ - return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); -} - -@vertex -fn mainVertex( - @location(0) aPosition: vec2<f32>, -) -> VSOutput { - return VSOutput( - filterVertexPosition(aPosition), - filterTextureCoord(aPosition) - ); -} - -@fragment -fn mainFragment( - @location(0) uv: vec2<f32>, -) -> @location(0) vec4<f32> { - return textureSample(uTexture, uSampler, uv); -} -`;class $ extends L{constructor(){const e=U.from({vertex:{source:w,entryPoint:"mainVertex"},fragment:{source:w,entryPoint:"mainFragment"},name:"passthrough-filter"}),t=E.from({vertex:j,fragment:N,name:"passthrough-filter"});super({gpuProgram:e,glProgram:t})}}class I{constructor(e){this._renderer=e}push(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:t,filterEffect:e})}pop(e,t,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(e){e.action==="pushFilter"?this._renderer.filter.push(e):e.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}I.extension={type:[b.WebGLPipes,b.WebGPUPipes,b.CanvasPipes],name:"filter"};const H=new Y({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:8,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class K{constructor(){this.skip=!1,this.inputTexture=null,this.backTexture=null,this.filters=null,this.bounds=new P,this.container=null,this.blendRequired=!1,this.outputRenderSurface=null,this.globalFrame={x:0,y:0,width:0,height:0},this.firstEnabledIndex=-1,this.lastEnabledIndex=-1}}class B{constructor(e){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new z({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new V({}),this.renderer=e}get activeBackTexture(){var e;return(e=this._activeFilterData)==null?void 0:e.backTexture}push(e){const t=this.renderer,r=e.filterEffect.filters,i=this._pushFilterData();i.skip=!1,i.filters=r,i.container=e.container,i.outputRenderSurface=t.renderTarget.renderSurface;const n=t.renderTarget.renderTarget.colorTexture.source,s=n.resolution,a=n.antialias;if(r.every(p=>!p.enabled)){i.skip=!0;return}const o=i.bounds;if(this._calculateFilterArea(e,o),this._calculateFilterBounds(i,t.renderTarget.rootViewPort,a,s,1),i.skip)return;const l=this._getPreviousFilterData(),f=this._findFilterResolution(s);let c=0,u=0;l&&(c=l.bounds.minX,u=l.bounds.minY),this._calculateGlobalFrame(i,c,u,f,n.width,n.height),this._setupFilterTextures(i,o,t,l)}generateFilteredTexture({texture:e,filters:t}){const r=this._pushFilterData();this._activeFilterData=r,r.skip=!1,r.filters=t;const i=e.source,n=i.resolution,s=i.antialias;if(t.every(p=>!p.enabled))return r.skip=!0,e;const a=r.bounds;if(a.addRect(e.frame),this._calculateFilterBounds(r,a.rectangle,s,n,0),r.skip)return e;const o=n;this._calculateGlobalFrame(r,0,0,o,i.width,i.height),r.outputRenderSurface=_.getOptimalTexture(a.width,a.height,r.resolution,r.antialias),r.backTexture=v.EMPTY,r.inputTexture=e,this.renderer.renderTarget.finishRenderPass(),this._applyFiltersToTexture(r,!0);const u=r.outputRenderSurface;return u.source.alphaMode="premultiplied-alpha",u}pop(){const e=this.renderer,t=this._popFilterData();t.skip||(e.globalUniforms.pop(),e.renderTarget.finishRenderPass(),this._activeFilterData=t,this._applyFiltersToTexture(t,!1),t.blendRequired&&_.returnTexture(t.backTexture),_.returnTexture(t.inputTexture))}getBackTexture(e,t,r){const i=e.colorTexture.source._resolution,n=_.getOptimalTexture(t.width,t.height,i,!1);let s=t.minX,a=t.minY;r&&(s-=r.minX,a-=r.minY),s=Math.floor(s*i),a=Math.floor(a*i);const o=Math.ceil(t.width*i),l=Math.ceil(t.height*i);return this.renderer.renderTarget.copyToTexture(e,n,{x:s,y:a},{width:o,height:l},{x:0,y:0}),n}applyFilter(e,t,r,i){const n=this.renderer,s=this._activeFilterData,o=s.outputRenderSurface===r,l=n.renderTarget.rootRenderTarget.colorTexture.source._resolution,f=this._findFilterResolution(l);let c=0,u=0;if(o){const h=this._findPreviousFilterOffset();c=h.x,u=h.y}this._updateFilterUniforms(t,r,s,c,u,f,o,i);const p=e.enabled?e:this._getPassthroughFilter();this._setupBindGroupsAndRender(p,t,n)}calculateSpriteMatrix(e,t){const r=this._activeFilterData,i=e.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),n=t.worldTransform.copyTo(k.shared),s=t.renderGroup||t.parentRenderGroup;return s&&s.cacheToLocalTransform&&n.prepend(s.cacheToLocalTransform),n.invert(),i.prepend(n),i.scale(1/t.texture.orig.width,1/t.texture.orig.height),i.translate(t.anchor.x,t.anchor.y),i}destroy(){var e;(e=this._passthroughFilter)==null||e.destroy(!0),this._passthroughFilter=null}_getPassthroughFilter(){return this._passthroughFilter??(this._passthroughFilter=new $),this._passthroughFilter}_setupBindGroupsAndRender(e,t,r){if(r.renderPipes.uniformBatch){const i=r.renderPipes.uniformBatch.getUboResource(this._filterGlobalUniforms);this._globalFilterBindGroup.setResource(i,0)}else this._globalFilterBindGroup.setResource(this._filterGlobalUniforms,0);this._globalFilterBindGroup.setResource(t.source,1),this._globalFilterBindGroup.setResource(t.source.style,2),e.groups[0]=this._globalFilterBindGroup,r.encoder.draw({geometry:H,shader:e,state:e._state,topology:"triangle-list"}),r.type===X.WEBGL&&r.renderTarget.finishRenderPass()}_setupFilterTextures(e,t,r,i){if(e.backTexture=v.EMPTY,e.inputTexture=_.getOptimalTexture(t.width,t.height,e.resolution,e.antialias),e.blendRequired){r.renderTarget.finishRenderPass();const n=r.renderTarget.getRenderTarget(e.outputRenderSurface);e.backTexture=this.getBackTexture(n,t,i==null?void 0:i.bounds)}r.renderTarget.bind(e.inputTexture,!0),r.globalUniforms.push({offset:t})}_calculateGlobalFrame(e,t,r,i,n,s){const a=e.globalFrame;a.x=t*i,a.y=r*i,a.width=n*i,a.height=s*i}_updateFilterUniforms(e,t,r,i,n,s,a,o){const l=this._filterGlobalUniforms.uniforms,f=l.uOutputFrame,c=l.uInputSize,u=l.uInputPixel,p=l.uInputClamp,h=l.uGlobalFrame,x=l.uOutputTexture;a?(f[0]=r.bounds.minX-i,f[1]=r.bounds.minY-n):(f[0]=0,f[1]=0),f[2]=e.frame.width,f[3]=e.frame.height,c[0]=e.source.width,c[1]=e.source.height,c[2]=1/c[0],c[3]=1/c[1],u[0]=e.source.pixelWidth,u[1]=e.source.pixelHeight,u[2]=1/u[0],u[3]=1/u[1],p[0]=.5*u[2],p[1]=.5*u[3],p[2]=e.frame.width*c[2]-.5*u[2],p[3]=e.frame.height*c[3]-.5*u[3];const T=this.renderer.renderTarget.rootRenderTarget.colorTexture;h[0]=i*s,h[1]=n*s,h[2]=T.source.width*s,h[3]=T.source.height*s,t instanceof v&&(t.source.resource=null);const d=this.renderer.renderTarget.getRenderTarget(t);this.renderer.renderTarget.bind(t,!!o),t instanceof v?(x[0]=t.frame.width,x[1]=t.frame.height):(x[0]=d.width,x[1]=d.height),x[2]=d.isRoot?-1:1,this._filterGlobalUniforms.update()}_findFilterResolution(e){let t=this._filterStackIndex-1;for(;t>0&&this._filterStack[t].skip;)--t;return t>0&&this._filterStack[t].inputTexture?this._filterStack[t].inputTexture.source._resolution:e}_findPreviousFilterOffset(){let e=0,t=0,r=this._filterStackIndex;for(;r>0;){r--;const i=this._filterStack[r];if(!i.skip){e=i.bounds.minX,t=i.bounds.minY;break}}return{x:e,y:t}}_calculateFilterArea(e,t){if(e.renderables?G(e.renderables,t):e.filterEffect.filterArea?(t.clear(),t.addRect(e.filterEffect.filterArea),t.applyMatrix(e.container.worldTransform)):e.container.getFastGlobalBounds(!0,t),e.container){const i=(e.container.renderGroup||e.container.parentRenderGroup).cacheToLocalTransform;i&&t.applyMatrix(i)}}_applyFiltersToTexture(e,t){const r=e.inputTexture,i=e.bounds,n=e.filters,s=e.firstEnabledIndex,a=e.lastEnabledIndex;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(e.backTexture.source,3),s===a)n[s].apply(this,r,e.outputRenderSurface,t);else{let o=e.inputTexture;const l=_.getOptimalTexture(i.width,i.height,o.source._resolution,!1);let f=l;for(let c=s;c<a;c++){const u=n[c];if(!u.enabled)continue;u.apply(this,o,f,!0);const p=o;o=f,f=p}n[a].apply(this,o,e.outputRenderSurface,t),_.returnTexture(l)}}_calculateFilterBounds(e,t,r,i,n){var d;const s=this.renderer,a=e.bounds,o=e.filters;let l=1/0,f=0,c=!0,u=!1,p=!1,h=!0,x=-1,T=-1;for(let F=0;F<o.length;F++){const g=o[F];if(!g.enabled)continue;if(x===-1&&(x=F),T=F,l=Math.min(l,g.resolution==="inherit"?i:g.resolution),f+=g.padding,g.antialias==="off"?c=!1:g.antialias==="inherit"&&c&&(c=r),g.clipToViewport||(h=!1),!!!(g.compatibleRenderers&s.type)){p=!1;break}if(g.blendRequired&&!(((d=s.backBuffer)==null?void 0:d.useBackBuffer)??!0)){q("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),p=!1;break}p=!0,u||(u=g.blendRequired)}if(!p){e.skip=!0;return}if(h&&a.fitBounds(0,t.width/i,0,t.height/i),a.scale(l).ceil().scale(1/l).pad((f|0)*n),!a.isPositive){e.skip=!0;return}e.antialias=c,e.resolution=l,e.blendRequired=u,e.firstEnabledIndex=x,e.lastEnabledIndex=T}_popFilterData(){return this._filterStackIndex--,this._filterStack[this._filterStackIndex]}_getPreviousFilterData(){let e,t=this._filterStackIndex-1;for(;t>0&&(t--,e=this._filterStack[t],!!e.skip););return e}_pushFilterData(){let e=this._filterStack[this._filterStackIndex];return e||(e=this._filterStack[this._filterStackIndex]=new K),this._filterStackIndex++,e}}B.extension={type:[b.WebGLSystem,b.WebGPUSystem],name:"filter"};R.add(B,C);R.add(I); diff --git a/2026/games_submissions/sunshoes/favicon.png b/2026/games_submissions/sunshoes/favicon.png Binary files differdeleted file mode 100644 index fdc13bc..0000000 --- a/2026/games_submissions/sunshoes/favicon.png +++ /dev/null diff --git a/2026/games_submissions/sunshoes/index.html b/2026/games_submissions/sunshoes/index.html deleted file mode 100644 index a48485f..0000000 --- a/2026/games_submissions/sunshoes/index.html +++ /dev/null @@ -1,17 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="UTF-8" /> - <link rel="icon" type="image/png" href="/favicon.png" /> - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <link rel="stylesheet" href="/style.css"> - <title>SHOOT! - LCOLONQ MICROJAM 2K26-A-PALOOZA</title> - <script type="module" crossorigin src="/games/sunshoes/assets/index-DvAPfvr6.js"></script> -</head> - -<body> - <div id="app"> - <div id="container"></div> - </div> -</body> -</html> diff --git a/2026/games_submissions/sunshoes/style.css b/2026/games_submissions/sunshoes/style.css deleted file mode 100644 index 93e65aa..0000000 --- a/2026/games_submissions/sunshoes/style.css +++ /dev/null @@ -1,19 +0,0 @@ -body { - margin: 0; - padding: 0; - color: rgba(255, 255, 255, 0.87); - background-color: #000000; -} - -#app { - width: 100%; - height: 100vh; - overflow: hidden; - display: flex; - justify-content: center; - align-items: center; -} - -canvas { - cursor: none !important; -} |
