diff --git a/js/2-jsloadentry.js b/js/2-jsloadentry.js index f04cd21..94d78e5 100644 --- a/js/2-jsloadentry.js +++ b/js/2-jsloadentry.js @@ -14,7 +14,11 @@ scriptManager.loadjs("./js/libutil.js"); scriptManager.loadjs("./js/libcubicbezier.js"); scriptManager.loadjs("./js/libwebglcheck.js"); - scriptManager.loadjs("./js/libpixi_v891gl.min.js"); + if(window.EnableDebugMode) { + scriptManager.loadjs("./js/libpixi_v891gl.dev.min.js"); + } else { + scriptManager.loadjs("./js/libpixi_v891gl.prod.min.js"); + } await scriptManager.waitAll(); await scriptManager.loadjs("./js/libtransition.js"); await scriptManager.loadjs("./js/libmain.js"); diff --git a/js/libpixi_v891gl.min.js b/js/libpixi_v891gl.dev.min.js similarity index 96% rename from js/libpixi_v891gl.min.js rename to js/libpixi_v891gl.dev.min.js index 5e3ce62..8fc13d0 100644 --- a/js/libpixi_v891gl.min.js +++ b/js/libpixi_v891gl.dev.min.js @@ -1,4 +1,10 @@ -window.PIXI=function(exports){"use strict";var __defProp$1d=Object.defineProperty,__defProps$r=Object.defineProperties,__getOwnPropDescs$r=Object.getOwnPropertyDescriptors,__getOwnPropSymbols$1d=Object.getOwnPropertySymbols,__hasOwnProp$1d=Object.prototype.hasOwnProperty,__propIsEnum$1d=Object.prototype.propertyIsEnumerable,__defNormalProp$1d=(obj,key,value)=>key in obj?__defProp$1d(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues$1d=(a,b)=>{for(var prop in b=b||{})__hasOwnProp$1d.call(b,prop)&&__defNormalProp$1d(a,prop,b[prop]);if(__getOwnPropSymbols$1d)for(var prop of __getOwnPropSymbols$1d(b))__propIsEnum$1d.call(b,prop)&&__defNormalProp$1d(a,prop,b[prop]);return a},ExtensionType2={Application:"application",WebGLPipes:"webgl-pipes",WebGLPipesAdaptor:"webgl-pipes-adaptor",WebGLSystem:"webgl-system",WebGPUPipes:"webgpu-pipes",WebGPUPipesAdaptor:"webgpu-pipes-adaptor",WebGPUSystem:"webgpu-system",CanvasSystem:"canvas-system",CanvasPipesAdaptor:"canvas-pipes-adaptor",CanvasPipes:"canvas-pipes",Asset:"asset",LoadParser:"load-parser",ResolveParser:"resolve-parser",CacheParser:"cache-parser",DetectionParser:"detection-parser",MaskEffect:"mask-effect",BlendMode:"blend-mode",TextureSource:"texture-source",Environment:"environment",ShapeBuilder:"shape-builder",Batcher:"batcher"};const normalizeExtension=ext=>{if("function"==typeof ext||"object"==typeof ext&&ext.extension){if(!ext.extension)throw new Error("Extension class must have an extension object");var metadata="object"!=typeof ext.extension?{type:ext.extension}:ext.extension,metadata=__spreadValues$1d({},metadata);ext=__defProps$r(metadata,__getOwnPropDescs$r({ref:ext}))}if("object"!=typeof ext)throw new Error("Invalid extension type");return"string"==typeof(ext=__spreadValues$1d({},ext)).type&&(ext.type=[ext.type]),ext},normalizeExtensionPriority=(ext,defaultPriority)=>null!=(ext=normalizeExtension(ext).priority)?ext:defaultPriority,extensions={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...extensions2){return extensions2.map(normalizeExtension).forEach(ext=>{ext.type.forEach(type=>{var _a;return null==(type=(_a=this._removeHandlers)[type])?void 0:type.call(_a,ext)})}),this},add(...extensions2){return extensions2.map(normalizeExtension).forEach(ext=>{ext.type.forEach(type=>{var _b,handlers=this._addHandlers,queue=this._queue;handlers[type]?null!=(_b=handlers[type])&&_b.call(handlers,ext):(queue[type]=queue[type]||[],null!=(_b=queue[type])&&_b.push(ext))})}),this},handle(type,onAdd,onRemove){var addHandlers=this._addHandlers,removeHandlers=this._removeHandlers;if(addHandlers[type]||removeHandlers[type])throw new Error(`Extension type ${type} already has a handler`);return addHandlers[type]=onAdd,removeHandlers[type]=onRemove,(addHandlers=this._queue)[type]&&(null!=(removeHandlers=addHandlers[type])&&removeHandlers.forEach(ext=>onAdd(ext)),delete addHandlers[type]),this},handleByMap(type,map){return this.handle(type,extension=>{extension.name&&(map[extension.name]=extension.ref)},extension=>{extension.name&&delete map[extension.name]})},handleByNamedList(type,map,defaultPriority=-1){return this.handle(type,extension=>{0<=map.findIndex(item=>item.name===extension.name)||(map.push({name:extension.name,value:extension.ref}),map.sort((a,b)=>normalizeExtensionPriority(b.value,defaultPriority)-normalizeExtensionPriority(a.value,defaultPriority)))},extension=>{var index=map.findIndex(item=>item.name===extension.name);-1!==index&&map.splice(index,1)})},handleByList(type,list,defaultPriority=-1){return this.handle(type,extension=>{list.includes(extension.ref)||(list.push(extension.ref),list.sort((a,b)=>normalizeExtensionPriority(b,defaultPriority)-normalizeExtensionPriority(a,defaultPriority)))},extension=>{-1!==(extension=list.indexOf(extension.ref))&&list.splice(extension,1)})},mixin(Target,...sources){for(const source of sources)Object.defineProperties(Target.prototype,Object.getOwnPropertyDescriptors(source))}};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var eventemitter3$1={exports:{}};function t(r){return"string"==typeof r?0key in obj?__defProp$1c(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value;!function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})}([function(e,f){var d,a={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"},r={};for(d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var n=r[this.toHex()];if(n)return n;if(null!=f&&f.closest){var g,o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(g in a){var d=o,i=l[g];(d=Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2))v===value2[i]):null!==value1&&null!==value2?(type1=Object.keys(value1),keys2=Object.keys(value2),type1.length===keys2.length&&type1.every(key=>value1[key]===value2[key])):value1===value2)}toRgba(){var[r,g,b,a]=this._components;return{r:r,g:g,b:b,a:a}}toRgb(){var[r,g,b]=this._components;return{r:r,g:g,b:b}}toRgbaString(){var[r,g,b]=this.toUint8RgbArray();return`rgba(${r},${g},${b},${this.alpha})`}toUint8RgbArray(out){var[r,g,b]=this._components;return this._arrayRgb||(this._arrayRgb=[]),(out=out||this._arrayRgb)[0]=Math.round(255*r),out[1]=Math.round(255*g),out[2]=Math.round(255*b),out}toArray(out){this._arrayRgba||(this._arrayRgba=[]),out=out||this._arrayRgba;var[r,g,b,a]=this._components;return out[0]=r,out[1]=g,out[2]=b,out[3]=a,out}toRgbArray(out){this._arrayRgb||(this._arrayRgb=[]),out=out||this._arrayRgb;var[r,g,b]=this._components;return out[0]=r,out[1]=g,out[2]=b,out}toNumber(){return this._int}toBgrNumber(){var[r,g,b]=this.toUint8RgbArray();return(b<<16)+(g<<8)+r}toLittleEndianNumber(){var value=this._int;return(value>>16)+(65280&value)+((255&value)<<16)}multiply(value){var[value,g,b,a]=_Color._temp.setValue(value)._components;return this._components[0]*=value,this._components[1]*=g,this._components[2]*=b,this._components[3]*=a,this._refreshInt(),this._value=null,this}premultiply(alpha,applyToRGB=!0){return applyToRGB&&(this._components[0]*=alpha,this._components[1]*=alpha,this._components[2]*=alpha),this._components[3]=alpha,this._refreshInt(),this._value=null,this}toPremultiplied(alpha,applyToRGB=!0){if(1===alpha)return(255<<24)+this._int;if(0===alpha)return applyToRGB?0:this._int;let r=this._int>>16&255,g=this._int>>8&255,b=255&this._int;return applyToRGB&&(r=r*alpha+.5|0,g=g*alpha+.5|0,b=b*alpha+.5|0),(255*alpha<<24)+(r<<16)+(g<<8)+b}toHex(){var hexString=this._int.toString(16);return"#"+("000000".substring(0,6-hexString.length)+hexString)}toHexa(){var alphaString=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-alphaString.length)+alphaString}setAlpha(alpha){return this._components[3]=this._clamp(alpha),this}_normalize(value){let r,g,b,a;var match;if(("number"==typeof value||value instanceof Number)&&0<=value&&value<=16777215?(r=(value>>16&255)/255,g=(value>>8&255)/255,b=(255&value)/255,a=1):(Array.isArray(value)||value instanceof Float32Array)&&3<=value.length&&value.length<=4?(value=this._clamp(value),[r,g,b,a=1]=value):(value instanceof Uint8Array||value instanceof Uint8ClampedArray)&&3<=value.length&&value.length<=4?(value=this._clamp(value,0,255),[r,g,b,a=255]=value,r/=255,g/=255,b/=255,a/=255):"string"!=typeof value&&"object"!=typeof value||("string"==typeof value&&(match=_Color.HEX_PATTERN.exec(value))&&(value="#"+match[2]),(match=w(value)).isValid()&&({r,g,b,a}=match.rgba,r/=255,g/=255,b/=255)),void 0===r)throw new Error("Unable to convert color "+value);this._components[0]=r,this._components[1]=g,this._components[2]=b,this._components[3]=a,this._refreshInt()}_refreshInt(){this._clamp(this._components);var[r,g,b]=this._components;this._int=(255*r<<16)+(255*g<<8)+(255*b|0)}_clamp(value,min=0,max=1){return"number"==typeof value?Math.min(Math.max(value,min),max):(value.forEach((v,i)=>{value[i]=Math.min(Math.max(v,min),max)}),value)}static isColorLike(value){return"number"==typeof value||"string"==typeof value||value instanceof Number||value instanceof _Color||Array.isArray(value)||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Float32Array||void 0!==value.r&&void 0!==value.g&&void 0!==value.b||void 0!==value.r&&void 0!==value.g&&void 0!==value.b&&void 0!==value.a||void 0!==value.h&&void 0!==value.s&&void 0!==value.l||void 0!==value.h&&void 0!==value.s&&void 0!==value.l&&void 0!==value.a||void 0!==value.h&&void 0!==value.s&&void 0!==value.v||void 0!==value.h&&void 0!==value.s&&void 0!==value.v&&void 0!==value.a}};_Color.shared=new _Color,_Color._temp=new _Color,_Color.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Color=_Color;eventemitter3$1={cullArea:null,cullable:!1,cullableChildren:!0};const PI_2=2*Math.PI,RAD_TO_DEG=180/Math.PI,DEG_TO_RAD=Math.PI/180;class Point{constructor(x=0,y=0){this.x=0,this.y=0,this.x=x,this.y=y}clone(){return new Point(this.x,this.y)}copyFrom(p){return this.set(p.x,p.y),this}copyTo(p){return p.set(this.x,this.y),p}equals(p){return p.x===this.x&&p.y===this.y}set(x=0,y=x){return this.x=x,this.y=y,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return tempPoint.x=0,tempPoint.y=0,tempPoint}}const tempPoint=new Point;class Matrix{constructor(a=1,b=0,c=0,d=1,tx=0,ty=0){this.array=null,this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty}fromArray(array){this.a=array[0],this.b=array[1],this.c=array[3],this.d=array[4],this.tx=array[2],this.ty=array[5]}set(a,b,c,d,tx,ty){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty,this}toArray(transpose,out){return this.array||(this.array=new Float32Array(9)),out=out||this.array,transpose?(out[0]=this.a,out[1]=this.b,out[2]=0,out[3]=this.c,out[4]=this.d,out[5]=0,out[6]=this.tx,out[7]=this.ty):(out[0]=this.a,out[1]=this.c,out[2]=this.tx,out[3]=this.b,out[4]=this.d,out[5]=this.ty,out[6]=0,out[7]=0),out[8]=1,out}apply(pos,newPos){newPos=newPos||new Point;var x=pos.x,pos=pos.y;return newPos.x=this.a*x+this.c*pos+this.tx,newPos.y=this.b*x+this.d*pos+this.ty,newPos}applyInverse(pos,newPos){newPos=newPos||new Point;var a=this.a,b=this.b,c=this.c,d=this.d,tx=this.tx,ty=this.ty,id=1/(a*d+c*-b),x=pos.x,pos=pos.y;return newPos.x=d*id*x+-c*id*pos+(ty*c-tx*d)*id,newPos.y=a*id*pos+-b*id*x+(-ty*a+tx*b)*id,newPos}translate(x,y){return this.tx+=x,this.ty+=y,this}scale(x,y){return this.a*=x,this.d*=y,this.c*=x,this.b*=y,this.tx*=x,this.ty*=y,this}rotate(angle){var cos=Math.cos(angle),angle=Math.sin(angle),a1=this.a,c1=this.c,tx1=this.tx;return this.a=a1*cos-this.b*angle,this.b=a1*angle+this.b*cos,this.c=c1*cos-this.d*angle,this.d=c1*angle+this.d*cos,this.tx=tx1*cos-this.ty*angle,this.ty=tx1*angle+this.ty*cos,this}append(matrix){var a1=this.a,b1=this.b,c1=this.c,d1=this.d;return this.a=matrix.a*a1+matrix.b*c1,this.b=matrix.a*b1+matrix.b*d1,this.c=matrix.c*a1+matrix.d*c1,this.d=matrix.c*b1+matrix.d*d1,this.tx=matrix.tx*a1+matrix.ty*c1+this.tx,this.ty=matrix.tx*b1+matrix.ty*d1+this.ty,this}appendFrom(a,b){var a1=a.a,b1=a.b,c1=a.c,d1=a.d,tx=a.tx,a=a.ty,a2=b.a,b2=b.b,c2=b.c,d2=b.d;return this.a=a1*a2+b1*c2,this.b=a1*b2+b1*d2,this.c=c1*a2+d1*c2,this.d=c1*b2+d1*d2,this.tx=tx*a2+a*c2+b.tx,this.ty=tx*b2+a*d2+b.ty,this}setTransform(x,y,pivotX,pivotY,scaleX,scaleY,rotation,skewX,skewY){return this.a=Math.cos(rotation+skewY)*scaleX,this.b=Math.sin(rotation+skewY)*scaleX,this.c=-Math.sin(rotation-skewX)*scaleY,this.d=Math.cos(rotation-skewX)*scaleY,this.tx=x-(pivotX*this.a+pivotY*this.c),this.ty=y-(pivotX*this.b+pivotY*this.d),this}prepend(matrix){var a1,c1,tx1=this.tx;return 1===matrix.a&&0===matrix.b&&0===matrix.c&&1===matrix.d||(a1=this.a,c1=this.c,this.a=a1*matrix.a+this.b*matrix.c,this.b=a1*matrix.b+this.b*matrix.d,this.c=c1*matrix.a+this.d*matrix.c,this.d=c1*matrix.b+this.d*matrix.d),this.tx=tx1*matrix.a+this.ty*matrix.c+matrix.tx,this.ty=tx1*matrix.b+this.ty*matrix.d+matrix.ty,this}decompose(transform){var a=this.a,b=this.b,c=this.c,d=this.d,pivot=transform.pivot,skewX=-Math.atan2(-c,d),skewY=Math.atan2(b,a),delta=Math.abs(skewX+skewY);return delta<1e-5||Math.abs(PI_2-delta)<1e-5?(transform.rotation=skewY,transform.skew.x=transform.skew.y=0):(transform.rotation=0,transform.skew.x=skewX,transform.skew.y=skewY),transform.scale.x=Math.sqrt(a*a+b*b),transform.scale.y=Math.sqrt(c*c+d*d),transform.position.x=this.tx+(pivot.x*a+pivot.y*c),transform.position.y=this.ty+(pivot.x*b+pivot.y*d),transform}invert(){var a1=this.a,b1=this.b,c1=this.c,d1=this.d,tx1=this.tx,n=a1*d1-b1*c1;return this.a=d1/n,this.b=-b1/n,this.c=-c1/n,this.d=a1/n,this.tx=(c1*this.ty-d1*tx1)/n,this.ty=-(a1*this.ty-b1*tx1)/n,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){var matrix=new Matrix;return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix}copyTo(matrix){return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix}copyFrom(matrix){return this.a=matrix.a,this.b=matrix.b,this.c=matrix.c,this.d=matrix.d,this.tx=matrix.tx,this.ty=matrix.ty,this}equals(matrix){return matrix.a===this.a&&matrix.b===this.b&&matrix.c===this.c&&matrix.d===this.d&&matrix.tx===this.tx&&matrix.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 identityMatrix$1.identity()}static get shared(){return tempMatrix$6.identity()}}const tempMatrix$6=new Matrix,identityMatrix$1=new Matrix;class ObservablePoint{constructor(observer,x,y){this._x=x||0,this._y=y||0,this._observer=observer}clone(observer){return new ObservablePoint(null!=observer?observer:this._observer,this._x,this._y)}set(x=0,y=x){return this._x===x&&this._y===y||(this._x=x,this._y=y,this._observer._onUpdate(this)),this}copyFrom(p){return this._x===p.x&&this._y===p.y||(this._x=p.x,this._y=p.y,this._observer._onUpdate(this)),this}copyTo(p){return p.set(this._x,this._y),p}equals(p){return p.x===this._x&&p.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(value){this._x!==value&&(this._x=value,this._observer._onUpdate(this))}get y(){return this._y}set y(value){this._y!==value&&(this._y=value,this._observer._onUpdate(this))}}const uidCache={default:-1};function uid$1(name="default"){return void 0===uidCache[name]&&(uidCache[name]=-1),++uidCache[name]}const warnings={},v8_0_0="8.0.0";function deprecation(version,message,ignoreDepth=3){if(!warnings[message]){let stack=(new Error).stack;void 0===stack?console.warn("PixiJS Deprecation Warning: ",message+` +/*! + * PixiJS - v8.9.1 + * Compiled Thu, 27 Mar 2025 12:09:55 UTC + * + * PixiJS is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */window.PIXI=function(exports){"use strict";var __defProp$1d=Object.defineProperty,__defProps$r=Object.defineProperties,__getOwnPropDescs$r=Object.getOwnPropertyDescriptors,__getOwnPropSymbols$1d=Object.getOwnPropertySymbols,__hasOwnProp$1d=Object.prototype.hasOwnProperty,__propIsEnum$1d=Object.prototype.propertyIsEnumerable,__defNormalProp$1d=(obj,key,value)=>key in obj?__defProp$1d(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues$1d=(a,b)=>{for(var prop in b=b||{})__hasOwnProp$1d.call(b,prop)&&__defNormalProp$1d(a,prop,b[prop]);if(__getOwnPropSymbols$1d)for(var prop of __getOwnPropSymbols$1d(b))__propIsEnum$1d.call(b,prop)&&__defNormalProp$1d(a,prop,b[prop]);return a},ExtensionType2={Application:"application",WebGLPipes:"webgl-pipes",WebGLPipesAdaptor:"webgl-pipes-adaptor",WebGLSystem:"webgl-system",WebGPUPipes:"webgpu-pipes",WebGPUPipesAdaptor:"webgpu-pipes-adaptor",WebGPUSystem:"webgpu-system",CanvasSystem:"canvas-system",CanvasPipesAdaptor:"canvas-pipes-adaptor",CanvasPipes:"canvas-pipes",Asset:"asset",LoadParser:"load-parser",ResolveParser:"resolve-parser",CacheParser:"cache-parser",DetectionParser:"detection-parser",MaskEffect:"mask-effect",BlendMode:"blend-mode",TextureSource:"texture-source",Environment:"environment",ShapeBuilder:"shape-builder",Batcher:"batcher"};const normalizeExtension=ext=>{if("function"==typeof ext||"object"==typeof ext&&ext.extension){if(!ext.extension)throw new Error("Extension class must have an extension object");var metadata="object"!=typeof ext.extension?{type:ext.extension}:ext.extension,metadata=__spreadValues$1d({},metadata);ext=__defProps$r(metadata,__getOwnPropDescs$r({ref:ext}))}if("object"!=typeof ext)throw new Error("Invalid extension type");return"string"==typeof(ext=__spreadValues$1d({},ext)).type&&(ext.type=[ext.type]),ext},normalizeExtensionPriority=(ext,defaultPriority)=>null!=(ext=normalizeExtension(ext).priority)?ext:defaultPriority,extensions={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...extensions2){return extensions2.map(normalizeExtension).forEach(ext=>{ext.type.forEach(type=>{var _a;return null==(type=(_a=this._removeHandlers)[type])?void 0:type.call(_a,ext)})}),this},add(...extensions2){return extensions2.map(normalizeExtension).forEach(ext=>{ext.type.forEach(type=>{var _b,handlers=this._addHandlers,queue=this._queue;handlers[type]?null!=(_b=handlers[type])&&_b.call(handlers,ext):(queue[type]=queue[type]||[],null!=(_b=queue[type])&&_b.push(ext))})}),this},handle(type,onAdd,onRemove){var addHandlers=this._addHandlers,removeHandlers=this._removeHandlers;if(addHandlers[type]||removeHandlers[type])throw new Error(`Extension type ${type} already has a handler`);return addHandlers[type]=onAdd,removeHandlers[type]=onRemove,(addHandlers=this._queue)[type]&&(null!=(removeHandlers=addHandlers[type])&&removeHandlers.forEach(ext=>onAdd(ext)),delete addHandlers[type]),this},handleByMap(type,map){return this.handle(type,extension=>{extension.name&&(map[extension.name]=extension.ref)},extension=>{extension.name&&delete map[extension.name]})},handleByNamedList(type,map,defaultPriority=-1){return this.handle(type,extension=>{0<=map.findIndex(item=>item.name===extension.name)||(map.push({name:extension.name,value:extension.ref}),map.sort((a,b)=>normalizeExtensionPriority(b.value,defaultPriority)-normalizeExtensionPriority(a.value,defaultPriority)))},extension=>{var index=map.findIndex(item=>item.name===extension.name);-1!==index&&map.splice(index,1)})},handleByList(type,list,defaultPriority=-1){return this.handle(type,extension=>{list.includes(extension.ref)||(list.push(extension.ref),list.sort((a,b)=>normalizeExtensionPriority(b,defaultPriority)-normalizeExtensionPriority(a,defaultPriority)))},extension=>{-1!==(extension=list.indexOf(extension.ref))&&list.splice(extension,1)})},mixin(Target,...sources){for(const source of sources)Object.defineProperties(Target.prototype,Object.getOwnPropertyDescriptors(source))}};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}var eventemitter3$1={exports:{}};function t(r){return"string"==typeof r?0key in obj?__defProp$1c(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value;!function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})}([function(e,f){var d,a={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"},r={};for(d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var n=r[this.toHex()];if(n)return n;if(null!=f&&f.closest){var g,o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(g in a){var d=o,i=l[g];(d=Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2))v===value2[i]):null!==value1&&null!==value2?(type1=Object.keys(value1),keys2=Object.keys(value2),type1.length===keys2.length&&type1.every(key=>value1[key]===value2[key])):value1===value2)}toRgba(){var[r,g,b,a]=this._components;return{r:r,g:g,b:b,a:a}}toRgb(){var[r,g,b]=this._components;return{r:r,g:g,b:b}}toRgbaString(){var[r,g,b]=this.toUint8RgbArray();return`rgba(${r},${g},${b},${this.alpha})`}toUint8RgbArray(out){var[r,g,b]=this._components;return this._arrayRgb||(this._arrayRgb=[]),(out=out||this._arrayRgb)[0]=Math.round(255*r),out[1]=Math.round(255*g),out[2]=Math.round(255*b),out}toArray(out){this._arrayRgba||(this._arrayRgba=[]),out=out||this._arrayRgba;var[r,g,b,a]=this._components;return out[0]=r,out[1]=g,out[2]=b,out[3]=a,out}toRgbArray(out){this._arrayRgb||(this._arrayRgb=[]),out=out||this._arrayRgb;var[r,g,b]=this._components;return out[0]=r,out[1]=g,out[2]=b,out}toNumber(){return this._int}toBgrNumber(){var[r,g,b]=this.toUint8RgbArray();return(b<<16)+(g<<8)+r}toLittleEndianNumber(){var value=this._int;return(value>>16)+(65280&value)+((255&value)<<16)}multiply(value){var[value,g,b,a]=_Color._temp.setValue(value)._components;return this._components[0]*=value,this._components[1]*=g,this._components[2]*=b,this._components[3]*=a,this._refreshInt(),this._value=null,this}premultiply(alpha,applyToRGB=!0){return applyToRGB&&(this._components[0]*=alpha,this._components[1]*=alpha,this._components[2]*=alpha),this._components[3]=alpha,this._refreshInt(),this._value=null,this}toPremultiplied(alpha,applyToRGB=!0){if(1===alpha)return(255<<24)+this._int;if(0===alpha)return applyToRGB?0:this._int;let r=this._int>>16&255,g=this._int>>8&255,b=255&this._int;return applyToRGB&&(r=r*alpha+.5|0,g=g*alpha+.5|0,b=b*alpha+.5|0),(255*alpha<<24)+(r<<16)+(g<<8)+b}toHex(){var hexString=this._int.toString(16);return"#"+("000000".substring(0,6-hexString.length)+hexString)}toHexa(){var alphaString=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-alphaString.length)+alphaString}setAlpha(alpha){return this._components[3]=this._clamp(alpha),this}_normalize(value){let r,g,b,a;var match;if(("number"==typeof value||value instanceof Number)&&0<=value&&value<=16777215?(r=(value>>16&255)/255,g=(value>>8&255)/255,b=(255&value)/255,a=1):(Array.isArray(value)||value instanceof Float32Array)&&3<=value.length&&value.length<=4?(value=this._clamp(value),[r,g,b,a=1]=value):(value instanceof Uint8Array||value instanceof Uint8ClampedArray)&&3<=value.length&&value.length<=4?(value=this._clamp(value,0,255),[r,g,b,a=255]=value,r/=255,g/=255,b/=255,a/=255):"string"!=typeof value&&"object"!=typeof value||("string"==typeof value&&(match=_Color.HEX_PATTERN.exec(value))&&(value="#"+match[2]),(match=w(value)).isValid()&&({r,g,b,a}=match.rgba,r/=255,g/=255,b/=255)),void 0===r)throw new Error("Unable to convert color "+value);this._components[0]=r,this._components[1]=g,this._components[2]=b,this._components[3]=a,this._refreshInt()}_refreshInt(){this._clamp(this._components);var[r,g,b]=this._components;this._int=(255*r<<16)+(255*g<<8)+(255*b|0)}_clamp(value,min=0,max=1){return"number"==typeof value?Math.min(Math.max(value,min),max):(value.forEach((v,i)=>{value[i]=Math.min(Math.max(v,min),max)}),value)}static isColorLike(value){return"number"==typeof value||"string"==typeof value||value instanceof Number||value instanceof _Color||Array.isArray(value)||value instanceof Uint8Array||value instanceof Uint8ClampedArray||value instanceof Float32Array||void 0!==value.r&&void 0!==value.g&&void 0!==value.b||void 0!==value.r&&void 0!==value.g&&void 0!==value.b&&void 0!==value.a||void 0!==value.h&&void 0!==value.s&&void 0!==value.l||void 0!==value.h&&void 0!==value.s&&void 0!==value.l&&void 0!==value.a||void 0!==value.h&&void 0!==value.s&&void 0!==value.v||void 0!==value.h&&void 0!==value.s&&void 0!==value.v&&void 0!==value.a}};_Color.shared=new _Color,_Color._temp=new _Color,_Color.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Color=_Color;eventemitter3$1={cullArea:null,cullable:!1,cullableChildren:!0};const PI_2=2*Math.PI,RAD_TO_DEG=180/Math.PI,DEG_TO_RAD=Math.PI/180;class Point{constructor(x=0,y=0){this.x=0,this.y=0,this.x=x,this.y=y}clone(){return new Point(this.x,this.y)}copyFrom(p){return this.set(p.x,p.y),this}copyTo(p){return p.set(this.x,this.y),p}equals(p){return p.x===this.x&&p.y===this.y}set(x=0,y=x){return this.x=x,this.y=y,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return tempPoint.x=0,tempPoint.y=0,tempPoint}}const tempPoint=new Point;class Matrix{constructor(a=1,b=0,c=0,d=1,tx=0,ty=0){this.array=null,this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty}fromArray(array){this.a=array[0],this.b=array[1],this.c=array[3],this.d=array[4],this.tx=array[2],this.ty=array[5]}set(a,b,c,d,tx,ty){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=tx,this.ty=ty,this}toArray(transpose,out){return this.array||(this.array=new Float32Array(9)),out=out||this.array,transpose?(out[0]=this.a,out[1]=this.b,out[2]=0,out[3]=this.c,out[4]=this.d,out[5]=0,out[6]=this.tx,out[7]=this.ty):(out[0]=this.a,out[1]=this.c,out[2]=this.tx,out[3]=this.b,out[4]=this.d,out[5]=this.ty,out[6]=0,out[7]=0),out[8]=1,out}apply(pos,newPos){newPos=newPos||new Point;var x=pos.x,pos=pos.y;return newPos.x=this.a*x+this.c*pos+this.tx,newPos.y=this.b*x+this.d*pos+this.ty,newPos}applyInverse(pos,newPos){newPos=newPos||new Point;var a=this.a,b=this.b,c=this.c,d=this.d,tx=this.tx,ty=this.ty,id=1/(a*d+c*-b),x=pos.x,pos=pos.y;return newPos.x=d*id*x+-c*id*pos+(ty*c-tx*d)*id,newPos.y=a*id*pos+-b*id*x+(-ty*a+tx*b)*id,newPos}translate(x,y){return this.tx+=x,this.ty+=y,this}scale(x,y){return this.a*=x,this.d*=y,this.c*=x,this.b*=y,this.tx*=x,this.ty*=y,this}rotate(angle){var cos=Math.cos(angle),angle=Math.sin(angle),a1=this.a,c1=this.c,tx1=this.tx;return this.a=a1*cos-this.b*angle,this.b=a1*angle+this.b*cos,this.c=c1*cos-this.d*angle,this.d=c1*angle+this.d*cos,this.tx=tx1*cos-this.ty*angle,this.ty=tx1*angle+this.ty*cos,this}append(matrix){var a1=this.a,b1=this.b,c1=this.c,d1=this.d;return this.a=matrix.a*a1+matrix.b*c1,this.b=matrix.a*b1+matrix.b*d1,this.c=matrix.c*a1+matrix.d*c1,this.d=matrix.c*b1+matrix.d*d1,this.tx=matrix.tx*a1+matrix.ty*c1+this.tx,this.ty=matrix.tx*b1+matrix.ty*d1+this.ty,this}appendFrom(a,b){var a1=a.a,b1=a.b,c1=a.c,d1=a.d,tx=a.tx,a=a.ty,a2=b.a,b2=b.b,c2=b.c,d2=b.d;return this.a=a1*a2+b1*c2,this.b=a1*b2+b1*d2,this.c=c1*a2+d1*c2,this.d=c1*b2+d1*d2,this.tx=tx*a2+a*c2+b.tx,this.ty=tx*b2+a*d2+b.ty,this}setTransform(x,y,pivotX,pivotY,scaleX,scaleY,rotation,skewX,skewY){return this.a=Math.cos(rotation+skewY)*scaleX,this.b=Math.sin(rotation+skewY)*scaleX,this.c=-Math.sin(rotation-skewX)*scaleY,this.d=Math.cos(rotation-skewX)*scaleY,this.tx=x-(pivotX*this.a+pivotY*this.c),this.ty=y-(pivotX*this.b+pivotY*this.d),this}prepend(matrix){var a1,c1,tx1=this.tx;return 1===matrix.a&&0===matrix.b&&0===matrix.c&&1===matrix.d||(a1=this.a,c1=this.c,this.a=a1*matrix.a+this.b*matrix.c,this.b=a1*matrix.b+this.b*matrix.d,this.c=c1*matrix.a+this.d*matrix.c,this.d=c1*matrix.b+this.d*matrix.d),this.tx=tx1*matrix.a+this.ty*matrix.c+matrix.tx,this.ty=tx1*matrix.b+this.ty*matrix.d+matrix.ty,this}decompose(transform){var a=this.a,b=this.b,c=this.c,d=this.d,pivot=transform.pivot,skewX=-Math.atan2(-c,d),skewY=Math.atan2(b,a),delta=Math.abs(skewX+skewY);return delta<1e-5||Math.abs(PI_2-delta)<1e-5?(transform.rotation=skewY,transform.skew.x=transform.skew.y=0):(transform.rotation=0,transform.skew.x=skewX,transform.skew.y=skewY),transform.scale.x=Math.sqrt(a*a+b*b),transform.scale.y=Math.sqrt(c*c+d*d),transform.position.x=this.tx+(pivot.x*a+pivot.y*c),transform.position.y=this.ty+(pivot.x*b+pivot.y*d),transform}invert(){var a1=this.a,b1=this.b,c1=this.c,d1=this.d,tx1=this.tx,n=a1*d1-b1*c1;return this.a=d1/n,this.b=-b1/n,this.c=-c1/n,this.d=a1/n,this.tx=(c1*this.ty-d1*tx1)/n,this.ty=-(a1*this.ty-b1*tx1)/n,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){var matrix=new Matrix;return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix}copyTo(matrix){return matrix.a=this.a,matrix.b=this.b,matrix.c=this.c,matrix.d=this.d,matrix.tx=this.tx,matrix.ty=this.ty,matrix}copyFrom(matrix){return this.a=matrix.a,this.b=matrix.b,this.c=matrix.c,this.d=matrix.d,this.tx=matrix.tx,this.ty=matrix.ty,this}equals(matrix){return matrix.a===this.a&&matrix.b===this.b&&matrix.c===this.c&&matrix.d===this.d&&matrix.tx===this.tx&&matrix.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 identityMatrix$1.identity()}static get shared(){return tempMatrix$6.identity()}}const tempMatrix$6=new Matrix,identityMatrix$1=new Matrix;class ObservablePoint{constructor(observer,x,y){this._x=x||0,this._y=y||0,this._observer=observer}clone(observer){return new ObservablePoint(null!=observer?observer:this._observer,this._x,this._y)}set(x=0,y=x){return this._x===x&&this._y===y||(this._x=x,this._y=y,this._observer._onUpdate(this)),this}copyFrom(p){return this._x===p.x&&this._y===p.y||(this._x=p.x,this._y=p.y,this._observer._onUpdate(this)),this}copyTo(p){return p.set(this._x,this._y),p}equals(p){return p.x===this._x&&p.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(value){this._x!==value&&(this._x=value,this._observer._onUpdate(this))}get y(){return this._y}set y(value){this._y!==value&&(this._y=value,this._observer._onUpdate(this))}}const uidCache={default:-1};function uid$1(name="default"){return void 0===uidCache[name]&&(uidCache[name]=-1),++uidCache[name]}const warnings={},v8_0_0="8.0.0";function deprecation(version,message,ignoreDepth=3){if(!warnings[message]){let stack=(new Error).stack;void 0===stack?console.warn("PixiJS Deprecation Warning: ",message+` Deprecated since v`+version):(stack=stack.split("\n").splice(ignoreDepth).join("\n"),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",message+` Deprecated since v`+version),console.warn(stack),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",message+` Deprecated since v`+version),console.warn(stack))),warnings[message]=!0}}class Pool{constructor(ClassType,initialSize){this._pool=[],this._count=0,this._index=0,this._classType=ClassType,initialSize&&this.prepopulate(initialSize)}prepopulate(total){for(let i=0;i{var name=stats[pool._classType.name]?pool._classType.name+pool._classType.ID:pool._classType.name;stats[name]={free:pool.totalFree,used:pool.totalUsed,size:pool.totalSize}}),stats}}const BigPool=new PoolGroupClass;var cacheAsTextureMixin={get isCachedAsTexture(){var _a;return!(null==(_a=this.renderGroup)||!_a.isCachedAsTexture)},cacheAsTexture(val){"boolean"==typeof val&&!1===val?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===val?{}:val))},updateCacheTexture(){var _a;null!=(_a=this.renderGroup)&&_a.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(val){deprecation("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(val)}};function removeItems(arr,startIdx,removeCount){var length=arr.length;let i;if(!(length<=startIdx||0===removeCount)){var len=length-(removeCount=length=beginIndex;i--){var child=this.children[i];child&&(removed.push(child),child.parent=null)}removeItems(this.children,beginIndex,endIndex),(endIndex=this.renderGroup||this.parentRenderGroup)&&endIndex.removeChildren(removed);for(let i=0;i=this.children.length)throw new Error(`getChildAt: Index (${index}) does not exist.`);return this.children[index]},setChildIndex(child,index){if(index<0||index>=this.children.length)throw new Error(`The index ${index} supplied is out of bounds `+this.children.length);this.getChildIndex(child),this.addChildAt(child,index)},getChildIndex(child){if(-1===(child=this.children.indexOf(child)))throw new Error("The supplied Container must be a child of the caller");return child},addChildAt(child,index){this.allowChildren||deprecation(v8_0_0,"addChildAt: Only Containers will be allowed to add children in v8.0.0");var children=this.children;if(index<0||index>children.length)throw new Error(child+`addChildAt: The index ${index} supplied is out of bounds `+children.length);if(child.parent){var currentIndex=child.parent.children.indexOf(child);if(child.parent===this&¤tIndex===index)return child;-1!==currentIndex&&child.parent.children.splice(currentIndex,1)}return index===children.length?children.push(child):children.splice(index,0,child),child.parent=this,child.didChange=!0,child._updateFlags=15,(currentIndex=this.renderGroup||this.parentRenderGroup)&¤tIndex.addChild(child),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",child,this,index),child.emit("added",this),child},swapChildren(child,child2){var index2,index1;child!==child2&&(index1=this.getChildIndex(child),index2=this.getChildIndex(child2),this.children[index1]=child2,this.children[index2]=child,(index1=this.renderGroup||this.parentRenderGroup)&&(index1.structureDidChange=!0),this._didContainerChangeTick++)},removeFromParent(){var _a;null!=(_a=this.parent)&&_a.removeChild(this)},reparentChild(...child){return 1===child.length?this.reparentChildAt(child[0],this.children.length):(child.forEach(c=>this.reparentChildAt(c,this.children.length)),child[0])},reparentChildAt(child,index){var childMat;return child.parent===this?this.setChildIndex(child,index):(childMat=child.worldTransform.clone(),child.removeFromParent(),this.addChildAt(child,index),(index=this.worldTransform.clone()).invert(),childMat.prepend(index),child.setFromMatrix(childMat)),child}},collectRenderablesMixin={collectRenderables(instructionSet,renderer,currentLayer){this.parentRenderLayer&&this.parentRenderLayer!==currentLayer||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(instructionSet,renderer,currentLayer):this.renderGroup?renderer.renderPipes.renderGroup.addRenderGroup(this.renderGroup,instructionSet):this.collectRenderablesWithEffects(instructionSet,renderer,currentLayer))},collectRenderablesSimple(instructionSet,renderer,currentLayer){var children=this.children,length=children.length;for(let i=0;i{this.add({test:test.test,maskClass:test})}))}add(test){this._tests.push(test)}getMaskEffect(item){this._initialized||this.init();for(let i=0;ikey in obj?__defProp$1b(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues$1b=(a,b)=>{for(var prop in b=b||{})__hasOwnProp$1b.call(b,prop)&&__defNormalProp$1b(a,prop,b[prop]);if(__getOwnPropSymbols$1b)for(var prop of __getOwnPropSymbols$1b(b))__propIsEnum$1b.call(b,prop)&&__defNormalProp$1b(a,prop,b[prop]);return a},effectsMixin={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){var renderGroup=this.renderGroup||this.parentRenderGroup;renderGroup&&(renderGroup.structureDidChange=!0)},addEffect(effect){-1===this.effects.indexOf(effect)&&(this.effects.push(effect),this.effects.sort((a,b)=>a.priority-b.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(effect){-1!==(effect=this.effects.indexOf(effect))&&(this.effects.splice(effect,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(value){var effect=this._maskEffect;(null==effect?void 0:effect.mask)!==value&&(effect&&(this.removeEffect(effect),MaskEffectManager.returnMaskEffect(effect),this._maskEffect=null),null!=value)&&(this._maskEffect=MaskEffectManager.getMaskEffect(value),this.addEffect(this._maskEffect))},setMask(options){this._maskOptions=__spreadValues$1b(__spreadValues$1b({},this._maskOptions),options),options.mask&&(this.mask=options.mask),this._markStructureAsChanged()},get mask(){var _a;return null==(_a=this._maskEffect)?void 0:_a.mask},set filters(value){Array.isArray(value)||(value=value&&[value]);var effect=this._filterEffect||(this._filterEffect=new FilterEffect),hasFilters=0<(null==value?void 0:value.length),_a=hasFilters!=0<(null==(_a=effect.filters)?void 0:_a.length);value=Array.isArray(value)?value.slice(0):value,effect.filters=Object.freeze(value),_a&&(hasFilters?this.addEffect(effect):(this.removeEffect(effect),effect.filters=null!=value?value:null))},get filters(){var _a;return null==(_a=this._filterEffect)?void 0:_a.filters},set filterArea(value){this._filterEffect||(this._filterEffect=new FilterEffect),this._filterEffect.filterArea=value},get filterArea(){var _a;return null==(_a=this._filterEffect)?void 0:_a.filterArea}},findMixin={label:null,get name(){return deprecation(v8_0_0,"Container.name property has been removed, use Container.label instead"),this.label},set name(value){deprecation(v8_0_0,"Container.name property has been removed, use Container.label instead"),this.label=value},getChildByName(name,deep=!1){return this.getChildByLabel(name,deep)},getChildByLabel(label,deep=!1){var children=this.children;for(let i=0;i=this.x&&x=this.y&&y=x1||Math.max(lt.y,lb.y,rt.y,rb.y)<=y0||Math.min(lt.y,lb.y,rt.y,rb.y)>=y1||(n00=(transform=s*(lb.y-lt.y))*x0+(lb=s*(lt.x-lb.x))*y0,n10=transform*x1+lb*y0,n01=transform*x0+lb*y1,n11=transform*x1+lb*y1,Math.max(n00,n10,n01,n11)<=transform*lt.x+lb*lt.y)||Math.min(n00,n10,n01,n11)>=transform*rb.x+lb*rb.y||(n01=(n00=s*(lt.y-rt.y))*x0+(n10=s*(rt.x-lt.x))*y0,n11=n00*x1+n10*y0,transform=n00*x0+n10*y1,lb=n00*x1+n10*y1,Math.max(n01,n11,transform,lb)<=n00*lt.x+n10*lt.y)||Math.min(n01,n11,transform,lb)>=n00*rb.x+n10*rb.y)):(s=(this.xother.right?other:this).right<=s)&&(this.yother.bottom?other:this).bottom)}pad(paddingX=0,paddingY=paddingX){return this.x-=paddingX,this.y-=paddingY,this.width+=2*paddingX,this.height+=2*paddingY,this}fit(rectangle){var x1=Math.max(this.x,rectangle.x),x2=Math.min(this.x+this.width,rectangle.x+rectangle.width),y1=Math.max(this.y,rectangle.y),rectangle=Math.min(this.y+this.height,rectangle.y+rectangle.height);return this.x=x1,this.width=Math.max(x2-x1,0),this.y=y1,this.height=Math.max(rectangle-y1,0),this}ceil(resolution=1,eps=.001){var x2=Math.ceil((this.x+this.width-eps)*resolution)/resolution,y2=Math.ceil((this.y+this.height-eps)*resolution)/resolution;return this.x=Math.floor((this.x+eps)*resolution)/resolution,this.y=Math.floor((this.y+eps)*resolution)/resolution,this.width=x2-this.x,this.height=y2-this.y,this}enlarge(rectangle){var x1=Math.min(this.x,rectangle.x),x2=Math.max(this.x+this.width,rectangle.x+rectangle.width),y1=Math.min(this.y,rectangle.y),rectangle=Math.max(this.y+this.height,rectangle.y+rectangle.height);return this.x=x1,this.width=x2-x1,this.y=y1,this.height=rectangle-y1,this}getBounds(out){return(out=out||new Rectangle).copyFrom(this),out}containsRect(other){var x1,y1,x2;return!(this.width<=0||this.height<=0)&&(x1=other.x,y1=other.y,x2=other.x+other.width,other=other.y+other.height,x1>=this.x)&&x1=this.y&&y1=this.x&&x2=this.y&&otherthis.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new Rectangle);var rectangle=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(rectangle.x=0,rectangle.y=0,rectangle.width=0,rectangle.height=0):rectangle.copyFromBounds(this),rectangle}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=defaultMatrix,this}set(x0,y0,x1,y1){this.minX=x0,this.minY=y0,this.maxX=x1,this.maxY=y1}addFrame(x0,y0,x1,y1,matrix){var a=(matrix=matrix||this.matrix).a,b=matrix.b,c=matrix.c,d=matrix.d,tx=matrix.tx,matrix=matrix.ty;let minX=this.minX,minY=this.minY,maxX=this.maxX,maxY=this.maxY;var x=a*x0+c*y0+tx,y=b*x0+d*y0+matrix;xmaxX&&(maxX=x),y>maxY&&(maxY=y),y=b*x1+d*y0+matrix,(x=a*x1+c*y0+tx)maxX&&(maxX=x),y>maxY&&(maxY=y),y=b*x0+d*y1+matrix,(x=a*x0+c*y1+tx)maxX&&(maxX=x),y>maxY&&(maxY=y),y=b*x1+d*y1+matrix,(x=a*x1+c*y1+tx)maxX&&(maxX=x),y>maxY&&(maxY=y),this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY}addRect(rect,matrix){this.addFrame(rect.x,rect.y,rect.x+rect.width,rect.y+rect.height,matrix)}addBounds(bounds,matrix){this.addFrame(bounds.minX,bounds.minY,bounds.maxX,bounds.maxY,matrix)}addBoundsMask(mask){this.minX=(this.minX>mask.minX?this:mask).minX,this.minY=(this.minY>mask.minY?this:mask).minY,this.maxX=(this.maxXthis.maxX?x:this.maxX,this.maxY=y>this.maxY?y:this.maxY,y=b*minX+d*maxY+ty,this.minX=(x=matrix*minX+c*maxY+tx)this.maxX?x:this.maxX,this.maxY=y>this.maxY?y:this.maxY,y=b*maxX+d*maxY+ty,this.minX=(x=matrix*maxX+c*maxY+tx)this.maxX?x:this.maxX,this.maxY=y>this.maxY?y:this.maxY}fit(rect){return this.minXrect.right&&(this.maxX=rect.right),this.minYrect.bottom&&(this.maxY=rect.bottom),this}fitBounds(left,right,top,bottom){return this.minXright&&(this.maxX=right),this.minYbottom&&(this.maxY=bottom),this}pad(paddingX,paddingY=paddingX){return this.minX-=paddingX,this.maxX+=paddingX,this.minY-=paddingY,this.maxY+=paddingY,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 Bounds(this.minX,this.minY,this.maxX,this.maxY)}scale(x,y=x){return this.minX*=x,this.minY*=y,this.maxX*=x,this.maxY*=y,this}get x(){return this.minX}set x(value){var width=this.maxX-this.minX;this.minX=value,this.maxX=value+width}get y(){return this.minY}set y(value){var height=this.maxY-this.minY;this.minY=value,this.maxY=value+height}get width(){return this.maxX-this.minX}set width(value){this.maxX=this.minX+value}get height(){return this.maxY-this.minY}set height(value){this.maxY=this.minY+value}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return 0maxX?x:maxX,maxY=localX>maxY?localX:maxY}this.minX=minX,this.minY=minY,this.maxX=maxX,this.maxY=maxY}containsPoint(x,y){return this.minX<=x&&this.minY<=y&&this.maxX>=x&&this.maxY>=y}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(bounds){return this.minX=bounds.minX,this.minY=bounds.minY,this.maxX=bounds.maxX,this.maxY=bounds.maxY,this}}const matrixPool=new Pool(Matrix),boundsPool=new Pool(Bounds),tempMatrix$5=new Matrix;var getFastGlobalBoundsMixin={getFastGlobalBounds(factorRenderLayers,bounds){return(bounds=bounds||new Bounds).clear(),this._getGlobalBoundsRecursive(!!factorRenderLayers,bounds,this.parentRenderLayer),bounds.isValid||bounds.set(0,0,0,0),factorRenderLayers=this.renderGroup||this.parentRenderGroup,bounds.applyMatrix(factorRenderLayers.worldTransform),bounds},_getGlobalBoundsRecursive(factorRenderLayers,bounds,currentLayer){let localBounds=bounds;if((!factorRenderLayers||!this.parentRenderLayer||this.parentRenderLayer===currentLayer)&&7===this.localDisplayStatus&&this.measurable){var manageEffects=!!this.effects.length;if((this.renderGroup||manageEffects)&&(localBounds=boundsPool.get().clear()),this.boundsArea)bounds.addRect(this.boundsArea,this.worldTransform);else{this.renderPipeId&&(viewBounds=this.bounds,localBounds.addFrame(viewBounds.minX,viewBounds.minY,viewBounds.maxX,viewBounds.maxY,this.groupTransform));var viewBounds,children=this.children;for(let i=0;i>16&255)*(color2>>16&255)/255|0)<<16)+(((color1>>8&255)*(color2>>8&255)/255|0)<<8)+((255&color1)*(255&color2)/255|0):color1:color2}const WHITE_BGR=16777215;function multiplyColors(localBGRColor,parentBGRColor){return localBGRColor===WHITE_BGR?parentBGRColor:parentBGRColor===WHITE_BGR?localBGRColor:multiplyHexColors(localBGRColor,parentBGRColor)}function bgr2rgb(color){return((255&color)<<16)+(65280&color)+(color>>16&255)}var getGlobalMixin={getGlobalAlpha(skipUpdate){if(skipUpdate)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let alpha=this.alpha,current=this.parent;for(;current;)alpha*=current.alpha,current=current.parent;return alpha},getGlobalTransform(matrix,skipUpdate){return skipUpdate?matrix.copyFrom(this.worldTransform):(this.updateLocalTransform(),skipUpdate=updateTransformBackwards(this,matrixPool.get().identity()),matrix.appendFrom(this.localTransform,skipUpdate),matrixPool.return(skipUpdate),matrix)},getGlobalTint(skipUpdate){if(skipUpdate)return this.renderGroup?bgr2rgb(this.renderGroup.worldColor):this.parentRenderGroup?bgr2rgb(multiplyColors(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let color=this.localColor,parent=this.parent;for(;parent;)color=multiplyColors(color,parent.localColor),parent=parent.parent;return bgr2rgb(color)}};let warnCount=0;const maxWarnings=500;function warn(...args){warnCount!==maxWarnings&&(++warnCount===maxWarnings?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...args))}function getLocalBounds(target,bounds,relativeMatrix){return bounds.clear(),function _getLocalBounds(target,bounds,parentTransform,rootContainer,isRoot){var _a,_b;let relativeTransform;if(isRoot)relativeTransform=matrixPool.get(),relativeTransform=parentTransform.copyTo(relativeTransform);else{if(!target.visible||!target.measurable)return;target.updateLocalTransform(),isRoot=target.localTransform,(relativeTransform=matrixPool.get()).appendFrom(isRoot,parentTransform)}if(isRoot=bounds,(parentTransform=!!target.effects.length)&&(bounds=boundsPool.get().clear()),target.boundsArea)bounds.addRect(target.boundsArea,relativeTransform);else{target.renderPipeId&&(bounds.matrix=relativeTransform,bounds.addBounds(target.bounds));var children=target.children;for(let i=0;i>>1)|v>>>2)|v>>>4)|v>>>8)|v>>>16)}function isPow2(v){return!(v&v-1||!v)}function definedProps(obj){var result={};for(const key in obj)void 0!==obj[key]&&(result[key]=obj[key]);return result}var __defProp$1a=Object.defineProperty,__getOwnPropSymbols$1a=Object.getOwnPropertySymbols,__hasOwnProp$1a=Object.prototype.hasOwnProperty,__propIsEnum$1a=Object.prototype.propertyIsEnumerable,__defNormalProp$1a=(obj,key,value)=>key in obj?__defProp$1a(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues$1a=(a,b)=>{for(var prop in b=b||{})__hasOwnProp$1a.call(b,prop)&&__defNormalProp$1a(a,prop,b[prop]);if(__getOwnPropSymbols$1a)for(var prop of __getOwnPropSymbols$1a(b))__propIsEnum$1a.call(b,prop)&&__defNormalProp$1a(a,prop,b[prop]);return a};const idHash$1=Object.create(null),_TextureStyle=class _TextureStyle extends EventEmitter{constructor(options={}){var _a;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,options=__spreadValues$1a(__spreadValues$1a({},_TextureStyle.defaultOptions),options),this.addressMode=options.addressMode,this.addressModeU=null!=(_a=options.addressModeU)?_a:this.addressModeU,this.addressModeV=null!=(_a=options.addressModeV)?_a:this.addressModeV,this.addressModeW=null!=(_a=options.addressModeW)?_a:this.addressModeW,this.scaleMode=options.scaleMode,this.magFilter=null!=(_a=options.magFilter)?_a:this.magFilter,this.minFilter=null!=(_a=options.minFilter)?_a:this.minFilter,this.mipmapFilter=null!=(_a=options.mipmapFilter)?_a:this.mipmapFilter,this.lodMinClamp=options.lodMinClamp,this.lodMaxClamp=options.lodMaxClamp,this.compare=options.compare,this.maxAnisotropy=null!=(_a=options.maxAnisotropy)?_a:1}set addressMode(value){this.addressModeU=value,this.addressModeV=value,this.addressModeW=value}get addressMode(){return this.addressModeU}set wrapMode(value){deprecation(v8_0_0,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=value}get wrapMode(){return this.addressMode}set scaleMode(value){this.magFilter=value,this.minFilter=value,this.mipmapFilter=value}get scaleMode(){return this.magFilter}set maxAnisotropy(value){this._maxAnisotropy=Math.min(value,16),1key in obj?__defProp$19(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues$19=(a,b)=>{for(var prop in b=b||{})__hasOwnProp$19.call(b,prop)&&__defNormalProp$19(a,prop,b[prop]);if(__getOwnPropSymbols$19)for(var prop of __getOwnPropSymbols$19(b))__propIsEnum$19.call(b,prop)&&__defNormalProp$19(a,prop,b[prop]);return a};const _TextureSource=class _TextureSource extends EventEmitter{constructor(options={}){var _a;super(),this.options=options,this.uid=uid$1("textureSource"),this._resourceType="textureSource",this._resourceId=uid$1("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.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,options=__spreadValues$19(__spreadValues$19({},_TextureSource.defaultOptions),options),this.label=null!=(_a=options.label)?_a:"",this.resource=options.resource,this.autoGarbageCollect=options.autoGarbageCollect,this._resolution=options.resolution,options.width?this.pixelWidth=options.width*this._resolution:this.pixelWidth=this.resource&&null!=(_a=this.resourceWidth)?_a:1,options.height?this.pixelHeight=options.height*this._resolution:this.pixelHeight=this.resource&&null!=(_a=this.resourceHeight)?_a:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=options.format,this.dimension=options.dimensions,this.mipLevelCount=options.mipLevelCount,this.autoGenerateMipmaps=options.autoGenerateMipmaps,this.sampleCount=options.sampleCount,this.antialias=options.antialias,this.alphaMode=options.alphaMode,this.style=new TextureStyle(definedProps(options)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(value){var _a;this.style!==value&&(null!=(_a=this._style)&&_a.off("change",this._onStyleChange,this),this._style=value,null!=(_a=this._style)&&_a.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(value){this._style.addressMode=value}get repeatMode(){return this._style.addressMode}set repeatMode(value){this._style.addressMode=value}get magFilter(){return this._style.magFilter}set magFilter(value){this._style.magFilter=value}get minFilter(){return this._style.minFilter}set minFilter(value){this._style.minFilter=value}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(value){this._style.mipmapFilter=value}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(value){this._style.lodMinClamp=value}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(value){this._style.lodMaxClamp=value}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){var resolution=this._resolution;if(this.resize(this.resourceWidth/resolution,this.resourceHeight/resolution))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=uid$1("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){var resource=this.resource;return resource.naturalWidth||resource.videoWidth||resource.displayWidth||resource.width}get resourceHeight(){var resource=this.resource;return resource.naturalHeight||resource.videoHeight||resource.displayHeight||resource.height}get resolution(){return this._resolution}set resolution(resolution){this._resolution!==resolution&&(this._resolution=resolution,this.width=this.pixelWidth/resolution,this.height=this.pixelHeight/resolution)}resize(width,height,resolution){return resolution=resolution||this._resolution,width=width||this.width,height=height||this.height,width=Math.round(width*resolution),height=Math.round(height*resolution),this.width=width/resolution,this.height=height/resolution,this._resolution=resolution,(this.pixelWidth!==width||this.pixelHeight!==height)&&(this._refreshPOT(),this.pixelWidth=width,this.pixelHeight=height,this.emit("resize",this),this._resourceId=uid$1("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&1ux[ind],uY:ind=>uy[ind],vX:ind=>vx[ind],vY:ind=>vy[ind],inv:rotation=>8&rotation?15&rotation:7&-rotation,add:(rotationSecond,rotationFirst)=>rotationCayley[rotationSecond][rotationFirst],sub:(rotationSecond,rotationFirst)=>rotationCayley[rotationSecond][groupD8.inv(rotationFirst)],rotate180:rotation=>4^rotation,isVertical:rotation=>2==(3&rotation),byDirection:(dx,dy)=>2*Math.abs(dx)<=Math.abs(dy)?0<=dy?groupD8.S:groupD8.N:2*Math.abs(dy)<=Math.abs(dx)?0{(rotation=rotationMatrices[groupD8.inv(rotation)]).tx=tx,rotation.ty=ty,matrix.append(rotation)}};var NOOP=()=>{},__defProp$18=Object.defineProperty,__defProps$q=Object.defineProperties,__getOwnPropDescs$q=Object.getOwnPropertyDescriptors,__getOwnPropSymbols$18=Object.getOwnPropertySymbols,__hasOwnProp$18=Object.prototype.hasOwnProperty,__propIsEnum$18=Object.prototype.propertyIsEnumerable,__defNormalProp$18=(obj,key,value)=>key in obj?__defProp$18(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value;class BufferImageSource extends TextureSource{constructor(options){var buffer=options.resource||new Float32Array(options.width*options.height*4),format=options.format||(buffer instanceof Float32Array?"rgba32float":buffer instanceof Int32Array||buffer instanceof Uint32Array?"rgba32uint":buffer instanceof Int16Array||buffer instanceof Uint16Array?"rgba16uint":(0 instanceof Int8Array,"bgra8unorm"));super((options=((a,b)=>{for(var prop in b=options||{})__hasOwnProp$18.call(b,prop)&&__defNormalProp$18(a,prop,b[prop]);if(__getOwnPropSymbols$18)for(var prop of __getOwnPropSymbols$18(b))__propIsEnum$18.call(b,prop)&&__defNormalProp$18(a,prop,b[prop]);return a})({}),__defProps$q(options,__getOwnPropDescs$q({resource:buffer,format:format})))),this.uploadMethodId="buffer"}static test(resource){return resource instanceof Int8Array||resource instanceof Uint8Array||resource instanceof Uint8ClampedArray||resource instanceof Int16Array||resource instanceof Uint16Array||resource instanceof Int32Array||resource instanceof Uint32Array||resource instanceof Float32Array}}BufferImageSource.extension=ExtensionType2.TextureSource;const tempMat=new Matrix;class TextureMatrix{constructor(texture,clampMargin){this.mapCoord=new Matrix,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===clampMargin?texture.width<10?0:.5:clampMargin,this.isSimple=!1,this.texture=texture}get texture(){return this._texture}set texture(value){var _a;this.texture!==value&&(null!=(_a=this._texture)&&_a.removeListener("update",this.update,this),this._texture=value,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(uvs,out){void 0===out&&(out=uvs);var mat=this.mapCoord;for(let i=0;ikey in obj?__defProp$17(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value;let count=0;class TexturePoolClass{constructor(textureOptions){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=textureOptions||{},this.enableFullScreen=!1}createTexture(pixelWidth,pixelHeight,antialias){var a=new TextureSource((a=((a,b)=>{for(var prop in b=b||{})__hasOwnProp$17.call(b,prop)&&__defNormalProp$17(a,prop,b[prop]);if(__getOwnPropSymbols$17)for(var prop of __getOwnPropSymbols$17(b))__propIsEnum$17.call(b,prop)&&__defNormalProp$17(a,prop,b[prop]);return a})({},this.textureOptions),__defProps$p(a,__getOwnPropDescs$p({width:pixelWidth,height:pixelHeight,resolution:1,antialias:antialias,autoGarbageCollect:!1}))));return new Texture({source:a,label:"texturePool_"+count++})}getOptimalTexture(frameWidth,frameHeight,resolution=1,antialias){var po2Width=Math.ceil(frameWidth*resolution-1e-6),po2Height=Math.ceil(frameHeight*resolution-1e-6),key=((po2Width=nextPow2(po2Width))<<17)+((po2Height=nextPow2(po2Height))<<1)+(antialias?1:0);this._texturePool[key]||(this._texturePool[key]=[]);let texture=this._texturePool[key].pop();return(texture=texture||this.createTexture(po2Width,po2Height,antialias)).source._resolution=resolution,texture.source.width=po2Width/resolution,texture.source.height=po2Height/resolution,texture.source.pixelWidth=po2Width,texture.source.pixelHeight=po2Height,texture.frame.x=0,texture.frame.y=0,texture.frame.width=frameWidth,texture.frame.height=frameHeight,texture.updateUvs(),this._poolKeyHash[texture.uid]=key,texture}getSameSizeTexture(texture,antialias=!1){var source=texture.source;return this.getOptimalTexture(texture.width,texture.height,source._resolution,antialias)}returnTexture(renderTexture){var key=this._poolKeyHash[renderTexture.uid];this._texturePool[key].push(renderTexture)}clear(destroyTextures){if(destroyTextures=!1!==destroyTextures)for(const i in this._texturePool){var textures=this._texturePool[i];if(textures)for(let j=0;jthis.addChild(child)),null!=(_a=options.parent)&&_a.addChild(this)}static mixin(source){deprecation("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),extensions.mixin(Container,source)}set _didChangeId(value){this._didViewChangeTick=value>>12&4095,this._didContainerChangeTick=4095&value}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...children){if(this.allowChildren||deprecation(v8_0_0,"addChild: Only Containers will be allowed to add children in v8.0.0"),1key in obj?__defProp$16(obj,key,{enumerable:!0,configurable:!0,writable:!0,value:value}):obj[key]=value,__spreadValues$16=(a,b)=>{for(var prop in b=b||{})__hasOwnProp$16.call(b,prop)&&__defNormalProp$16(a,prop,b[prop]);if(__getOwnPropSymbols$16)for(var prop of __getOwnPropSymbols$16(b))__propIsEnum$16.call(b,prop)&&__defNormalProp$16(a,prop,b[prop]);return a};const _AccessibilitySystem=class _AccessibilitySystem{constructor(renderer,_mobileInfo=isMobile){this._mobileInfo=_mobileInfo,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(_mobileInfo.tablet||_mobileInfo.phone)&&this._createTouchHook(),this._renderer=renderer}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){var hookDiv=document.createElement("button");hookDiv.style.width="1px",hookDiv.style.height="1px",hookDiv.style.position="absolute",hookDiv.style.top="-1000px",hookDiv.style.left="-1000px",hookDiv.style.zIndex=2..toString(),hookDiv.style.backgroundColor="#FF0000",hookDiv.title="select to enable accessibility for this content",hookDiv.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(hookDiv),this._hookDiv=hookDiv}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(!this._isActive){this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width="100px",this._div.style.height="100px",this._div.style.position="absolute",this._div.style.top="0px",this._div.style.left="0px",this._div.style.zIndex=2..toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));const canvas=this._renderer.view.canvas;if(canvas.parentNode)canvas.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{const observer=new MutationObserver(()=>{canvas.parentNode&&(canvas.parentNode.appendChild(this._div),observer.disconnect(),this._initAccessibilitySetup())});observer.observe(document.body,{childList:!0,subtree:!0})}}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(this._isActive&&!this._isMobileAccessibility){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const child of this._children)child._accessibleDiv&&child._accessibleDiv.parentNode&&(child._accessibleDiv.parentNode.removeChild(child._accessibleDiv),child._accessibleDiv=null),child._accessibleActive=!1;this._pool.forEach(div=>{div.parentNode&&div.parentNode.removeChild(div)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(container){if(container.visible&&container.accessibleChildren){container.accessible&&(container._accessibleActive||this._addChild(container),container._renderId=this._renderId);var children=container.children;if(children)for(let i=0;i title : ${div.title}
tabIndex: `+div.tabIndex}_capHitArea(hitArea){hitArea.x<0&&(hitArea.width+=hitArea.x,hitArea.x=0),hitArea.y<0&&(hitArea.height+=hitArea.y,hitArea.y=0);var{width:viewWidth,height:viewHeight}=this._renderer;hitArea.x+hitArea.width>viewWidth&&(hitArea.width=viewWidth-hitArea.x),hitArea.y+hitArea.height>viewHeight&&(hitArea.height=viewHeight-hitArea.y)}_addChild(container){let div=this._pool.pop();div||("button"===container.accessibleType?div=document.createElement("button"):((div=document.createElement(container.accessibleType)).style.cssText=` diff --git a/js/libpixi_v891gl.prod.min.js b/js/libpixi_v891gl.prod.min.js new file mode 100644 index 0000000..e30cb0f --- /dev/null +++ b/js/libpixi_v891gl.prod.min.js @@ -0,0 +1,2238 @@ +/*! + * PixiJS - v8.9.1 + * Compiled Thu, 27 Mar 2025 12:09:55 UTC + * + * PixiJS is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */window.PIXI=function(h){"use strict";var hx=Object.defineProperty,dx=Object.defineProperties,px=Object.getOwnPropertyDescriptors,Lu=Object.getOwnPropertySymbols,fx=Object.prototype.hasOwnProperty,mx=Object.prototype.propertyIsEnumerable,Nu=(r,t,e)=>t in r?hx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hu=(r,t)=>{for(var e in t=t||{})fx.call(t,e)&&Nu(r,e,t[e]);if(Lu)for(var e of Lu(t))mx.call(t,e)&&Nu(r,e,t[e]);return r},r={Application:"application",WebGLPipes:"webgl-pipes",WebGLPipesAdaptor:"webgl-pipes-adaptor",WebGLSystem:"webgl-system",WebGPUPipes:"webgpu-pipes",WebGPUPipesAdaptor:"webgpu-pipes-adaptor",WebGPUSystem:"webgpu-system",CanvasSystem:"canvas-system",CanvasPipesAdaptor:"canvas-pipes-adaptor",CanvasPipes:"canvas-pipes",Asset:"asset",LoadParser:"load-parser",ResolveParser:"resolve-parser",CacheParser:"cache-parser",DetectionParser:"detection-parser",MaskEffect:"mask-effect",BlendMode:"blend-mode",TextureSource:"texture-source",Environment:"environment",ShapeBuilder:"shape-builder",Batcher:"batcher"};const on=r=>{var t;if(("function"==typeof r||"object"==typeof r&&r.extension)&&(t="object"!=typeof r.extension?{type:r.extension}:r.extension,r=((r,t)=>dx(r,px(t)))(Hu({},t),{ref:r})),"object"!=typeof r)throw new Error("Invalid extension type");return"string"==typeof(r=Hu({},r)).type&&(r.type=[r.type]),r},lr=(r,t)=>null!=(r=on(r).priority)?r:t,B={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(on).forEach(t=>{t.type.forEach(e=>{var i;return null==(e=(i=this._removeHandlers)[e])?void 0:e.call(i,t)})}),this},add(...r){return r.map(on).forEach(t=>{t.type.forEach(e=>{var s,n=this._addHandlers,o=this._queue;n[e]?null!=(s=n[e])&&s.call(n,t):(o[e]=o[e]||[],null!=(s=o[e])&&s.push(t))})}),this},handle(r,t,e){var s=this._addHandlers,n=this._removeHandlers;return s[r]=t,n[r]=e,(s=this._queue)[r]&&(null!=(n=s[r])&&n.forEach(a=>t(a)),delete s[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{0<=t.findIndex(s=>s.name===i.name)||(t.push({name:i.name,value:i.ref}),t.sort((s,n)=>lr(n.value,e)-lr(s.value,e)))},i=>{var s=t.findIndex(n=>n.name===i.name);-1!==s&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>lr(n,e)-lr(s,e)))},i=>{-1!==(i=t.indexOf(i.ref))&&t.splice(i,1)})},mixin(r,...t){for(const e of t)Object.defineProperties(r.prototype,Object.getOwnPropertyDescriptors(e))}};function an(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Vt(r){return"string"==typeof r?0t in r?Px(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;(function(r){r.forEach(function(t){Ju.indexOf(t)<0&&(t(oi,cn),Ju.push(t))})})([function(r,t){var s,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(s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var u=i[this.toHex()];if(u)return u;if(null!=o&&o.closest){var m,c=this.toRgb(),d=1/0,p="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(m in e){var a=c,l=n[m];(a=Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2)){for(var e in t=t||{})wx.call(t,e)&&ec(r,e,t[e]);if(tc)for(var e of tc(t))Rx.call(t,e)&&ec(r,e,t[e]);return r})({},t):t}_isSourceEqual(t,e){var n,i=typeof t;return i==typeof e&&("number"==i||"string"==i||t instanceof Number?t===e:Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)?t.length===e.length&&t.every((s,n)=>s===e[n]):null!==t&&null!==e?(i=Object.keys(t),n=Object.keys(e),i.length===n.length&&i.every(o=>t[o]===e[o])):t===e)}toRgba(){var[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){var[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){var[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){var[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),(t=t||this._arrayRgb)[0]=Math.round(255*e),t[1]=Math.round(255*i),t[2]=Math.round(255*s),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;var[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;var[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){var[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){var t=this._int;return(t>>16)+(65280&t)+((255&t)<<16)}multiply(t){var[t,i,s,n]=ii._temp.setValue(t)._components;return this._components[0]*=t,this._components[1]*=i,this._components[2]*=s,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(1===t)return(255<<24)+this._int;if(0===t)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=255&this._int;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(255*t<<24)+(i<<16)+(s<<8)+n}toHex(){var t=this._int.toString(16);return"#"+("000000".substring(0,6-t.length)+t)}toHexa(){var t=Math.round(255*this._components[3]).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,n;var a;if(("number"==typeof t||t instanceof Number)&&0<=t&&t<=16777215?(e=(t>>16&255)/255,i=(t>>8&255)/255,s=(255&t)/255,n=1):(Array.isArray(t)||t instanceof Float32Array)&&3<=t.length&&t.length<=4?(t=this._clamp(t),[e,i,s,n=1]=t):(t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&3<=t.length&&t.length<=4?(t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255):"string"!=typeof t&&"object"!=typeof t||("string"==typeof t&&(a=ii.HEX_PATTERN.exec(t))&&(t="#"+a[2]),(a=kt(t)).isValid()&&({r:e,g:i,b:s,a:n}=a.rgba,e/=255,i/=255,s/=255)),void 0===e)throw new Error("Unable to convert color "+t);this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this._refreshInt()}_refreshInt(){this._clamp(this._components);var[t,e,i]=this._components;this._int=(255*t<<16)+(255*e<<8)+(255*i|0)}_clamp(t,e=0,i=1){return"number"==typeof t?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return"number"==typeof t||"string"==typeof t||t instanceof Number||t instanceof ii||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||void 0!==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}}).shared=new ln,ln._temp=new ln,ln.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let X=ln;const rc={cullArea:null,cullable:!1,cullableChildren:!0},ic=2*Math.PI,sc=180/Math.PI,nc=Math.PI/180;class V{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new V(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}static get shared(){return pn.x=0,pn.y=0,pn}}const pn=new V;class M{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,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,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){return this.array||(this.array=new Float32Array(9)),e=e||this.array,t?(e[0]=this.a,e[1]=this.b,e[2]=0,e[3]=this.c,e[4]=this.d,e[5]=0,e[6]=this.tx,e[7]=this.ty):(e[0]=this.a,e[1]=this.c,e[2]=this.tx,e[3]=this.b,e[4]=this.d,e[5]=this.ty,e[6]=0,e[7]=0),e[8]=1,e}apply(t,e){e=e||new V;var i=t.x,t=t.y;return e.x=this.a*i+this.c*t+this.tx,e.y=this.b*i+this.d*t+this.ty,e}applyInverse(t,e){e=e||new V;var i=this.a,s=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,u=1/(i*o+n*-s),c=t.x,t=t.y;return e.x=o*u*c+-n*u*t+(l*n-a*o)*u,e.y=i*u*t+-s*u*c+(-l*i+a*s)*u,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){var e=Math.cos(t),t=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*t,this.b=s*t+this.b*e,this.c=n*e-this.d*t,this.d=n*t+this.d*e,this.tx=o*e-this.ty*t,this.ty=o*t+this.ty*e,this}append(t){var e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){var i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,t=t.ty,u=e.a,c=e.b,d=e.c,p=e.d;return this.a=i*u+s*d,this.b=i*c+s*p,this.c=n*u+o*d,this.d=n*c+o*p,this.tx=a*u+t*d+e.tx,this.ty=a*c+t*p+e.ty,this}setTransform(t,e,i,s,n,o,a,l,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){var i,s,e=this.tx;return 1===t.a&&0===t.b&&0===t.c&&1===t.d||(i=this.a,s=this.c,this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d),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){var e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),l=Math.atan2(i,e),u=Math.abs(a+l);return u<1e-5||Math.abs(ic-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){var t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.tx&&0===this.ty}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){var t=new M;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}static get IDENTITY(){return Ox.identity()}static get shared(){return Cx.identity()}}const Cx=new M,Ox=new M;class rt{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new rt(null!=t?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}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))}}const cr={default:-1};function K(r="default"){return void 0===cr[r]&&(cr[r]=-1),++cr[r]}class ai{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{var 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}}const N=new oc,ac={get isCachedAsTexture(){var r;return!(null==(r=this.renderGroup)||!r.isCachedAsTexture)},cacheAsTexture(r){"boolean"==typeof r&&!1===r?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(!0===r?{}:r))},updateCacheTexture(){var r;null!=(r=this.renderGroup)&&r.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(r){this.cacheAsTexture(r)}};function fn(r,t,e){var i=r.length;let s;if(!(i<=t||0===e)){var n=i-(e=i=r;o--){var a=this.children[o];a&&(s.push(a),a.parent=null)}fn(this.children,r,t),(t=this.renderGroup||this.parentRenderGroup)&&t.removeChildren(s);for(let o=0;o=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds `+this.children.length);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){if(-1===(r=this.children.indexOf(r)))throw new Error("The supplied Container must be a child of the caller");return r},addChildAt(r,t){var e=this.children;if(t<0||t>e.length)throw new Error(r+`addChildAt: The index ${t} supplied is out of bounds `+e.length);if(r.parent){var s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;-1!==s&&r.parent.children.splice(s,1)}return t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r._updateFlags=15,(s=this.renderGroup||this.parentRenderGroup)&&s.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){var i,e;r!==t&&(e=this.getChildIndex(r),i=this.getChildIndex(t),this.children[e]=t,this.children[i]=r,(e=this.renderGroup||this.parentRenderGroup)&&(e.structureDidChange=!0),this._didContainerChangeTick++)},removeFromParent(){var r;null!=(r=this.parent)&&r.removeChild(this)},reparentChild(...r){return 1===r.length?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){var e;return r.parent===this?this.setChildIndex(r,t):(e=r.worldTransform.clone(),r.removeFromParent(),this.addChildAt(r,t),(t=this.worldTransform.clone()).invert(),e.prepend(t),r.setFromMatrix(e)),r}},uc={collectRenderables(r,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(r,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,r):this.collectRenderablesWithEffects(r,t,e))},collectRenderablesSimple(r,t,e){var i=this.children,s=i.length;for(let n=0;n{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;et in r?Bx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pc=(r,t)=>{for(var e in t=t||{})Ix.call(t,e)&&dc(r,e,t[e]);if(hc)for(var e of hc(t))Fx.call(t,e)&&dc(r,e,t[e]);return r};const fc={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){var r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0)},addEffect(r){-1===this.effects.indexOf(r)&&(this.effects.push(r),this.effects.sort((t,e)=>t.priority-e.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(r){-1!==(r=this.effects.indexOf(r))&&(this.effects.splice(r,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(r){var t=this._maskEffect;(null==t?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),li.returnMaskEffect(t),this._maskEffect=null),null!=r)&&(this._maskEffect=li.getMaskEffect(r),this.addEffect(this._maskEffect))},setMask(r){this._maskOptions=pc(pc({},this._maskOptions),r),r.mask&&(this.mask=r.mask),this._markStructureAsChanged()},get mask(){var r;return null==(r=this._maskEffect)?void 0:r.mask},set filters(r){Array.isArray(r)||(r=r&&[r]);var e=this._filterEffect||(this._filterEffect=new hr),i=0<(null==r?void 0:r.length),t=i!=0<(null==(t=e.filters)?void 0:t.length);r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),t&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=null!=r?r:null))},get filters(){var r;return null==(r=this._filterEffect)?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new hr),this._filterEffect.filterArea=r},get filterArea(){var r;return null==(r=this._filterEffect)?void 0:r.filterArea}},mc={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){var e=this.children;for(let i=0;i=this.x&&t=this.y&&e=s||Math.max(a.y,l.y,u.y,c.y)<=n||Math.min(a.y,l.y,u.y,c.y)>=o||(m=(e=d*(l.y-a.y))*i+(l=d*(a.x-l.x))*n,_=e*s+l*n,g=e*i+l*o,b=e*s+l*o,Math.max(m,_,g,b)<=e*a.x+l*a.y)||Math.min(m,_,g,b)>=e*c.x+l*c.y||(g=(m=d*(a.y-u.y))*i+(_=d*(u.x-a.x))*n,b=m*s+_*n,e=m*i+_*o,l=m*s+_*o,Math.max(g,b,e,l)<=m*a.x+_*a.y)||Math.min(g,b,e,l)>=m*c.x+_*c.y)):(d=(this.xt.right?t:this).right<=d)&&(u=(this.yt.bottom?t:this).bottom>u))}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this}fit(t){var e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),t=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(t-s,0),this}ceil(t=1,e=.001){var i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){var e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),t=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=t-s,this}getBounds(t){return(t=t||new z).copyFrom(this),t}containsRect(t){var e,i,s;return!(this.width<=0||this.height<=0)&&(e=t.x,i=t.y,s=t.x+t.width,t=t.y+t.height,e>=this.x)&&e=this.y&&i=this.x&&s=this.y&&tthis.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new z);var 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=gc,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,n){var o=(n=n||this.matrix).a,a=n.b,l=n.c,u=n.d,c=n.tx,n=n.ty;let p=this.minX,f=this.minY,m=this.maxX,_=this.maxY,g=o*t+l*e+c,b=a*t+u*e+n;gm&&(m=g),b>_&&(_=b),b=a*i+u*e+n,(g=o*i+l*e+c)m&&(m=g),b>_&&(_=b),b=a*t+u*s+n,(g=o*t+l*s+c)m&&(m=g),b>_&&(_=b),b=a*i+u*s+n,(g=o*i+l*s+c)m&&(m=g),b>_&&(_=b),this.minX=p,this.minY=f,this.maxX=m,this.maxY=_}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:t).minX,this.minY=(this.minY>t.minY?this:t).minY,this.maxX=(this.maxXthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,f=a*e+u*n+d,this.minX=(p=t*e+l*n+c)this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,f=a*s+u*n+d,this.minX=(p=t*s+l*n+c)this.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minXe&&(this.maxX=e),this.minYs&&(this.maxY=s),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 nt(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){var e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){var 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 0a?x:a,l=g>l?g:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}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}}const ct=new ai(M),$t=new ai(nt),Dx=new M,_c={getFastGlobalBounds(r,t){return(t=t||new nt).clear(),this._getGlobalBoundsRecursive(!!r,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0),r=this.renderGroup||this.parentRenderGroup,t.applyMatrix(r.worldTransform),t},_getGlobalBoundsRecursive(r,t,e){let i=t;if(!(r&&this.parentRenderLayer&&this.parentRenderLayer!==e||7!==this.localDisplayStatus)&&this.measurable){var s=!!this.effects.length;if((this.renderGroup||s)&&(i=$t.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{this.renderPipeId&&(o=this.bounds,i.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform));var o,n=this.children;for(let o=0;o>16&255)*(t>>16&255)/255|0)<<16)+(((r>>8&255)*(t>>8&255)/255|0)<<8)+((255&r)*(255&t)/255|0):r:t}const bc=16777215;function pr(r,t){return r===bc?t:t===bc?r:gn(r,t)}function Be(r){return((255&r)<<16)+(65280&r)+(r>>16&255)}var vc={getGlobalAlpha(r){if(r)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(r,t){return t?r.copyFrom(this.worldTransform):(this.updateLocalTransform(),t=ci(this,ct.get().identity()),r.appendFrom(this.localTransform,t),ct.return(t),r)},getGlobalTint(r){if(r)return this.renderGroup?Be(this.renderGroup.worldColor):this.parentRenderGroup?Be(pr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=pr(t,e.localColor),e=e.parent;return Be(t)}};function hi(r,t,e){return t.clear(),function yc(r,t,e,i,s){var n,o;let a;if(s)a=ct.get(),a=e.copyTo(a);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform(),s=r.localTransform,(a=ct.get()).appendFrom(s,e)}if(s=t,(e=!!r.effects.length)&&(t=$t.get().clear()),r.boundsArea)t.addRect(r.boundsArea,a);else{r.renderPipeId&&(t.matrix=a,t.addBounds(r.bounds));var c=r.children;for(let d=0;d>>1)|r>>>2)|r>>>4)|r>>>8)|r>>>16)}function vn(r){return!(r&r-1||!r)}function Bt(r){var t={};for(const e in r)void 0!==r[e]&&(t[e]=r[e]);return t}var Lx=Object.defineProperty,Pc=Object.getOwnPropertySymbols,Nx=Object.prototype.hasOwnProperty,Hx=Object.prototype.propertyIsEnumerable,wc=(r,t,e)=>t in r?Lx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Rc=(r,t)=>{for(var e in t=t||{})Nx.call(t,e)&&wc(r,e,t[e]);if(Pc)for(var e of Pc(t))Hx.call(t,e)&&wc(r,e,t[e]);return r};const Mc=Object.create(null);(Cc=class Fy extends ft{constructor(t={}){var e;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=Rc(Rc({},Fy.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=null!=(e=t.addressModeU)?e:this.addressModeU,this.addressModeV=null!=(e=t.addressModeV)?e:this.addressModeV,this.addressModeW=null!=(e=t.addressModeW)?e:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=null!=(e=t.magFilter)?e:this.magFilter,this.minFilter=null!=(e=t.minFilter)?e:this.minFilter,this.mipmapFilter=null!=(e=t.mipmapFilter)?e:this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=null!=(e=t.maxAnisotropy)?e:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){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),1t in r?jx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bc=(r,t)=>{for(var e in t=t||{})zx.call(t,e)&&Gc(r,e,t[e]);if(Oc)for(var e of Oc(t))Vx.call(t,e)&&Gc(r,e,t[e]);return r};(Cc=class Dy extends ft{constructor(t={}){var e;super(),this.options=t,this.uid=K("textureSource"),this._resourceType="textureSource",this._resourceId=K("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.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t=Bc(Bc({},Dy.defaultOptions),t),this.label=null!=(e=t.label)?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&null!=(e=this.resourceWidth)?e:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&null!=(e=this.resourceHeight)?e:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new yn(Bt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e;this.style!==t&&(null!=(e=this._style)&&e.off("change",this._onStyleChange,this),this._style=t,null!=(e=this._style)&&e.on("change",this._onStyleChange,this),this._onStyleChange())}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){var t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=K("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){var t=this.resource;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){var t=this.resource;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){return i=i||this._resolution,t=t||this.width,e=e||this.height,t=Math.round(t*i),e=Math.round(e*i),this.width=t/i,this.height=e/i,this._resolution=i,(this.pixelWidth!==t||this.pixelHeight!==e)&&(this._refreshPOT(),this.pixelWidth=t,this.pixelHeight=e,this.emit("resize",this),this._resourceId=K("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&1pe[r],uY:r=>fe[r],vX:r=>me[r],vY:r=>ge[r],inv:r=>8&r?15&r:7&-r,add:(r,t)=>xn[r][t],sub:(r,t)=>xn[r][$.inv(t)],rotate180:r=>4^r,isVertical:r=>2==(3&r),byDirection:(r,t)=>2*Math.abs(r)<=Math.abs(t)?0<=t?$.S:$.N:2*Math.abs(t)<=Math.abs(r)?0{(t=Fc[$.inv(t)]).tx=e,t.ty=i,r.append(t)}},Tn=()=>{};var Yx=Object.defineProperty,Kx=Object.defineProperties,qx=Object.getOwnPropertyDescriptors,Dc=Object.getOwnPropertySymbols,Zx=Object.prototype.hasOwnProperty,Qx=Object.prototype.propertyIsEnumerable,Uc=(r,t,e)=>t in r?Yx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class pi extends Q{constructor(t){var e=t.resource||new Float32Array(t.width*t.height*4),i=t.format||(e instanceof Float32Array?"rgba32float":e instanceof Int32Array||e instanceof Uint32Array?"rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?"rgba16uint":(0 instanceof Int8Array,"bgra8unorm"));super((t=((r,t)=>{for(var e in t=t||{})Zx.call(t,e)&&Uc(r,e,t[e]);if(Dc)for(var e of Dc(t))Qx.call(t,e)&&Uc(r,e,t[e]);return r})({},t),Kx(t,qx({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}}pi.extension=r.TextureSource;const kc=new M;class Sn{constructor(t,e){this.mapCoord=new M,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=void 0===e?t.width<10?0:.5:e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&(null!=(e=this._texture)&&e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){void 0===e&&(e=t);var i=this.mapCoord;for(let s=0;st in r?e0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;let l0=0;class Nc{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){return t=new Q(((r,t)=>r0(r,i0(t)))(((r,t)=>{for(var e in t=t||{})s0.call(t,e)&&Lc(r,e,t[e]);if($c)for(var e of $c(t))n0.call(t,e)&&Lc(r,e,t[e]);return r})({},this.textureOptions),{width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!1})),new P({source:t,label:"texturePool_"+l0++})}getOptimalTexture(t,e,i=1,s){var n=Math.ceil(t*i-1e-6),o=Math.ceil(e*i-1e-6),a=((n=de(n))<<17)+((o=de(o))<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return(l=l||this.createTexture(n,o,s)).source._resolution=i,l.source.width=n/i,l.source.height=o/i,l.source.pixelWidth=n,l.source.pixelHeight=o,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){var i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){var e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=!1!==t)for(const e in this._texturePool){var i=this._texturePool[e];if(i)for(let s=0;sthis.addChild(s)),null!=(e=t.parent)&&e.addChild(this)}static mixin(t){B.mixin(lt,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=4095&t}get _didChangeId(){return 4095&this._didContainerChangeTick|(4095&this._didViewChangeTick)<<12}addChild(...t){if(1t in r?h0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nh=(r,t)=>{for(var e in t=t||{})d0.call(t,e)&&sh(r,e,t[e]);if(ih)for(var e of ih(t))p0.call(t,e)&&sh(r,e,t[e]);return r},Cc=((Mn=class Uy{constructor(t,e=rh){this._mobileInfo=e,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook(),this._renderer=t}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){var t=document.createElement("button");t.style.width="1px",t.style.height="1px",t.style.position="absolute",t.style.top="-1000px",t.style.left="-1000px",t.style.zIndex=2..toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(!this._isActive){this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width="100px",this._div.style.height="100px",this._div.style.position="absolute",this._div.style.top="0px",this._div.style.left="0px",this._div.style.zIndex=2..toString(),this._div.style.pointerEvents="none"),this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._deactivateOnMouseMove&&(this._onMouseMove=this._onMouseMove.bind(this),globalThis.document.addEventListener("mousemove",this._onMouseMove,!0));const t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{const e=new MutationObserver(()=>{t.parentNode&&(t.parentNode.appendChild(this._div),e.disconnect(),this._initAccessibilitySetup())});e.observe(document.body,{childList:!0,subtree:!0})}}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(this._isActive&&!this._isMobileAccessibility){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const t of this._children)t._accessibleDiv&&t._accessibleDiv.parentNode&&(t._accessibleDiv.parentNode.removeChild(t._accessibleDiv),t._accessibleDiv=null),t._accessibleActive=!1;this._pool.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this._div&&this._div.parentNode&&this._div.parentNode.removeChild(this._div),this._pool=[],this._children=[]}}_updateAccessibleObjects(t){if(t.visible&&t.accessibleChildren){t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);var e=t.children;if(e)for(let i=0;i title : ${t.title}
tabIndex: `+t.tabIndex}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||("button"===t.accessibleType?e=document.createElement("button"):((e=document.createElement(t.accessibleType)).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; + `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="container "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,(t._accessibleDiv=e).container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){const i=t.target.container,s=this._renderer.events.rootBoundary,n=Object.assign(new Fe(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){9===t.keyCode&&this._activateOnTab&&this._activate()}_onMouseMove(t){0===t.movementX&&0===t.movementY||this._deactivate()}destroy(){this._deactivate(),this._destroyTouchHook(),this._div=null,this._pool=null,this._children=null,this._renderer=null,this._activateOnTab&&globalThis.removeEventListener("keydown",this._onKeyDown)}setAccessibilityEnabled(t){t?this._activate():this._deactivate()}}).extension={type:[r.WebGLSystem,r.WebGPUSystem],name:"accessibility"},Mn.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0},Mn),Mn={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1};B.add(Cc),B.mixin(lt,Mn);class Cn{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),(this._resizeTo=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){this._cancelResize();let e,i;var s,n;i=this._resizeTo===globalThis.window?(e=globalThis.innerWidth,globalThis.innerHeight):({clientWidth:s,clientHeight:n}=this._resizeTo,e=s,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}}Cn.extension=r.Application;var Yt=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))({});class bi{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){return this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t)),t=this.next,this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(t){(this.previous=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);var e=this.next;return this.next=t?null:e,this.previous=null,e}}var ch=class wt{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 bi(null,null,1/0),this.deltaMS=1/wt.targetFPMS,this.elapsedMS=1/wt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started)&&null===this._requestId&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick))}}_requestIfNeeded(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Yt.NORMAL){return this._addListener(new bi(t,e,i))}addOnce(t,e,i=Yt.NORMAL){return this._addListener(new bi(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(i);break}e=(i=e).next}t.previous||t.connect(i)}else t.connect(i);return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i=i.match(t,e)?i.destroy():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)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var n=t-this._lastFrame|0;if(n{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ut.shared:new ut,t.autoStart&&this.start()}static destroy(){var t;this._ticker&&(t=this._ticker,this.ticker=null,t.destroy())}}On.extension=r.Application,B.add(Cn),B.add(On);const Kt=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){!this._tickerAdded&&this.domElement&&(ut.system.add(this._tickerUpdate,this,Yt.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ut.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){var t;this.domElement&&!this._pauseUpdate&&(this._didMove?this._didMove=!1:(t=this.events._rootPointerEvent,this.events.supportsTouchEvents&&"touch"===t.pointerType||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,this._deltaTimei.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i{t.currentTarget=i[n],this.notifyTarget(t,o)})}}propagationPath(t){var e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,i,s,n,o=!1){let a=!1;if(this._interactivePrune(t))return null;if("dynamic"!==t.eventMode&&"dynamic"!==e||(Kt.pauseUpdate=!1),t.interactiveChildren&&t.children){var c=t.children;for(let d=c.length-1;0<=d;d--){var m,p=c[d];!(p=this.hitTestMoveRecursive(p,this._isInteractive(e)?e:p.eventMode,i,s,n,o||n(t,i)))||0t in r?S0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const R0={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Gn=class Ou{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new hh(null),Kt.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Mt(null),this._rootWheelEvent=new _e(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(((r,t)=>{for(var e in t=Ou.defaultEventFeatures||{})E0.call(t,e)&&ph(r,e,t[e]);if(dh)for(var e of dh(t))A0.call(t,e)&&ph(r,e,t[e]);return r})({}),{set:(e,i,s)=>("globalMove"===i&&(this.rootBoundary.enableGlobalMoveEvents=s),e[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(t){var{canvas:s,resolution:n}=this.renderer;this.setTargetElement(s),this.resolution=n,Ou._defaultEventMode=null!=(s=t.eventMode)?s:"passive",Object.assign(this.features,null!=(n=t.eventFeatures)?n:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor!==t){this._currentCursor=t;var i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i)}else e&&"string"==typeof t&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(this.features.click){this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;var e=this._normalizeToPointerData(t);!this.autoPreventDefault||!e[0].isNormalized||!t.cancelable&&"cancelable"in t||t.preventDefault();for(let i=0,s=e.length;i{l.off(r,a,o)}),n?l.once(r,a,o):l.on(r,a,o)},removeEventListener(r,t,e){var e="boolean"==typeof e&&e||"object"==typeof e&&e.capture,s="function"==typeof t?void 0:t;t="function"==typeof t?t:t.handleEvent,this.off(r=e?r+"capture":r,t,s)},dispatchEvent(r){if(r instanceof Fe)return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented;throw new Error("Container cannot propagate events outside of the Federated Events API")}},B.add(Bn),B.mixin(lt,ch);class In{constructor(t){this._destroyRenderableBound=this.destroyRenderable.bind(this),this._attachedDomElements=[],this._renderer=t,this._renderer.runners.postrender.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"}addRenderable(t,e){this._attachedDomElements.includes(t)||(this._attachedDomElements.push(t),t.on("destroyed",this._destroyRenderableBound))}updateRenderable(t){}validateRenderable(t){return!0}destroyRenderable(t){var e=this._attachedDomElements.indexOf(t);-1!==e&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){var t,e=this._attachedDomElements;if(0===e.length)this._domElement.remove();else{var i=this._renderer.view.canvas;this._domElement.parentNode!==i.parentNode&&null!=(t=i.parentNode)&&t.appendChild(this._domElement),this._domElement.style.transform=`translate(${i.offsetLeft}px, ${i.offsetTop}px)`;for(let s=0;s=e.minX&&t<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){var t;this._didViewChangeTick++,this._boundsDirty=!0,!this.didViewUpdate&&(this.didViewUpdate=!0,t=this.renderGroup||this.parentRenderGroup)&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,i){var{renderPipes:s,renderableGC:n}=e,o=(s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),n.addRenderable(this),this.didViewUpdate=!1,this.children),a=o.length;for(let l=0;lt in r?M0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class G0 extends Lt{constructor(t={}){var s=t.anchor;super(((r,t)=>{for(var e in t=t||{})mh.call(t,e)&&_h(r,e,t[e]);if(vi)for(var e of vi(t))gh.call(t,e)&&_h(r,e,t[e]);return r})({label:"DOMContainer"},((r,t)=>{var e={};for(i in r)mh.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&vi)for(var i of vi(r))t.indexOf(i)<0&&gh.call(r,i)&&(e[i]=r[i]);return e})(t,["element","anchor"]))),this.renderPipeId="dom",this.batched=!1,this._anchor=new V(0,0),s&&(this.anchor=s),this.element=t.element||document.createElement("div")}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}set element(t){this._element!==t&&(this._element=t,this.onViewUpdate())}get element(){return this._element}updateBounds(){var s,t=this._bounds,e=this._element;e?({offsetWidth:e,offsetHeight:s}=e,t.minX=0,t.maxX=e,t.minY=0,t.maxY=s):(t.minX=0,t.minY=0,t.maxX=0,t.maxY=0)}destroy(t=!1){super.destroy(t),null!=(t=null==(t=this._element)?void 0:t.parentNode)&&t.removeChild(this._element),this._element=null,this._anchor=null}}B.add(In);var xt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))({}),bh={createCanvas:(r,t)=>{var e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return null!=(r=document.baseURI)?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>(new DOMParser).parseFromString(r,"text/xml")};let vh=bh;const H={get(){return vh},set(r){vh=r}};function It(r){if("string"!=typeof r)throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}function _r(r){return r.split("?")[0].split("#")[0]}const mt={toPosix(r){return r.replace(new RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){return It(r),r=this.toPosix(r),(r=/^file:\/\/\//.exec(r)||/^[^/:]+:\/{0,2}/.exec(r))?r[0]:""},toAbsolute(r,t,e){return It(r),this.isDataUrl(r)||this.isBlobUrl(r)?r:(t=_r(this.toPosix(null!=t?t:H.get().getBaseUrl())),e=_r(this.toPosix(null!=e?e:this.rootname(t))),(r=this.toPosix(r)).startsWith("/")?mt.join(e,r.slice(1)):this.isAbsolute(r)?r:this.join(t,r))},normalize(r){if(It(r),0===r.length)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;let t="";var e=(r=this.toPosix(r)).startsWith("/"),i=(this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length)),r.endsWith("/"));return 0<(r=function(r){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a=s;--c){if(47===(e=r.charCodeAt(c))){if(u)continue;a=c+1;break}-1===l&&(u=!1,l=c+1),46===e?-1===o?o=c:1!==d&&(d=1):-1!==o&&(d=-1)}-1===o||-1===l||0===d||1===d&&o===l-1&&o===a+1?-1!==l&&(0===a&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(0===a&&i?(t.name=r.slice(1,o),t.base=r.slice(1,l)):(t.name=r.slice(a,o),t.base=r.slice(a,l)),t.ext=r.slice(o,l)),t.dir=this.dirname(r)}return t},sep:"/",delimiter:":",joinExtensions:[".html"]},Ct=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>"string"==typeof i||e?t(i):i):r);function xh(r){var e=r.match(/\{(.*?)\}/g),i=[];if(e){const s=[];e.forEach(n=>{n=n.substring(1,n.length-1).split(","),s.push(n)}),function yh(r,t,e,i,s){var n=t[e];for(let o=0;o!Array.isArray(r);var D0=Object.defineProperty,U0=Object.defineProperties,k0=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,$0=Object.prototype.hasOwnProperty,L0=Object.prototype.propertyIsEnumerable,Sh=(r,t,e)=>t in r?D0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ue=(r,t)=>{for(var e in t=t||{})$0.call(t,e)&&Sh(r,e,t[e]);if(Th)for(var e of Th(t))L0.call(t,e)&&Sh(r,e,t[e]);return r};class re{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){var e;if(this._bundleIdConnector=null!=(e=t.connector)?e:this._bundleIdConnector,this._createBundleAssetId=null!=(e=t.createBundleAssetId)?e:this._createBundleAssetId,this._extractAssetIdFromBundle=null!=(e=t.extractAssetIdFromBundle)?e:this._extractAssetIdFromBundle,"bar"!==this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","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("string"==typeof t)this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>encodeURIComponent(i)+"="+encodeURIComponent(e[i])).join("&")}}getAlias(t){var{alias:t,src:i}=t;return Ct(t||i,s=>"string"==typeof s?s:Array.isArray(s)?s.map(n=>{var o;return null!=(o=null==n?void 0:n.src)?o:n}):null!=s&&s.src?s.src:s,!0)}addManifest(t){this._manifest,(this._manifest=t).bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let s=e;(s=Array.isArray(e)?s:Object.entries(e).map(([n,o])=>"string"==typeof o||Array.isArray(o)?{alias:n,src:o}:Ue({alias:n},o))).forEach(n=>{var o=n.src,a=n.alias;let l;if("string"==typeof a){var u=this._createBundleAssetId(t,a);i.push(u),l=[a,u]}else{const u=a.map(c=>this._createBundleAssetId(t,c));i.push(...u),l=[...a,...u]}this.add(((r,t)=>U0(r,k0(t)))(Ue({},n),{alias:l,src:o}))}),this._bundles[t]=i}add(t){var e=[];Array.isArray(t)?e.push(...t):e.push(t),Ct(e).forEach(s=>{var n=s.src;let{data:o,format:a,loadParser:l}=s;const u=Ct(n).map(p=>"string"==typeof p?xh(p):Array.isArray(p)?p:[p]),c=this.getAlias(s),d=[];u.forEach(p=>{p.forEach(f=>{var m;let b={};if("object"!=typeof f){b.src=f;for(let x=0;x{this._assetMap[p]=d})})}resolveBundle(t){var e=br(t);t=Ct(t);const i={};return t.forEach(s=>{var n=this._bundles[s];if(n){var o=this.resolve(n),a={};for(const l in o){var u=o[l];a[this._extractAssetIdFromBundle(s,l)]=u}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){var e=this.resolve(t);if("string"==typeof t)return e.src;var i={};for(const s in e)i[s]=e[s].src;return i}resolve(t){var e=br(t);t=Ct(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=this._getPreferredOrder(n);null!=o&&o.priority.forEach(a=>{o.params[a].forEach(l=>{var u=n.filter(c=>!!c[a]&&c[a]===l);u.length&&(n=u)})}),this._resolverHash[s]=n[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){return this._defaultSearchParams?t+(/\?/.test(t)?"&":"?")+this._defaultSearchParams:t}_buildResolvedAsset(t,e){var{aliases:e,data:o,loadParser:a,format:l}=e;return(this._basePath||this._rootPath)&&(t.src=mt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=null!=(e=null!=e?e:t.alias)?e:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Ue(Ue({},o||{}),t.data),t.loadParser=null!=a?a:t.loadParser,t.format=null!=(e=null!=l?l:t.format)?e:Eh(t.src),t}}function Eh(r){return r.split(".").pop().split("?").shift().split("#").shift()}re.RETINA_PREFIX=/@([0-9\.]+)x/;const yi=(r,t)=>((t=t.split("?")[1])&&(r+="?"+t),r),Ah=class si{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof P?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e,(e=parseFloat(e.meta.scale))?(this.resolution=e,t.source.resolution=this.resolution):this.resolution=t.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<=si.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;for(var i=si.BATCH_SIZE;e-t{this._batchIndex*si.BATCH_SIZEr instanceof Fn,getCacheableAssets:(r,t)=>function Ph(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=mt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{o=Ph([s+"/"+t.data.meta.related_multi_packs[o]],n,!0),Object.assign(i,o)})}return i}(r,t,!1)},resolver:{extension:{type:r.ResolveParser,name:"resolveSpritesheet"},test:r=>{var e=(r=r.split("?")[0].split(".")).pop(),r=r.pop();return"json"===e&&H0.includes(r)},parse:r=>{var t,i=r.split(".");return{resolution:parseFloat(null!=(t=null==(t=re.RETINA_PREFIX.exec(r))?void 0:t[1])?t:"1"),format:i[i.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:r.LoadParser,priority:xt.Normal,name:"spritesheetLoader"},async testParse(r,t){return".json"===mt.extname(t.src).toLowerCase()&&!!r.frames},async parse(r,t,e){var n,c,{texture:i,imageFilename:a,textureOptions:l}=null!=(i=null==t?void 0:t.data)?i:{};let u=mt.dirname(t.src);u&&u.lastIndexOf("/")!==u.length-1&&(u+="/"),c=i instanceof P?i:(i=yi(u+(null!=a?a:r.meta.image),t.src),(await e.load([{src:i,data:l}]))[i]);const d=new Fn(c.source,r);await d.parse();var g,i=null==(a=null==r?void 0:r.meta)?void 0:a.related_multi_packs;if(Array.isArray(i)){var f=[];for(const _ of i)"string"!=typeof _||(g=u+_,null!=(n=t.data)&&n.ignoreMultiPack)||(g=yi(g,t.src),f.push(e.load({src:g,data:{textureOptions:l,ignoreMultiPack:!0}})));r=await Promise.all(f),(d.linkedSheets=r).forEach(_=>{_.linkedSheets=[d].concat(d.linkedSheets.filter(g=>g!==_))})}return d},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};function Dn(r,t,e){var o,a,{width:i,height:s}=e.orig;(e=e.trim)?(o=e.width,a=e.height,r.minX=e.x-t._x*i,r.maxX=r.minX+o,r.minY=e.y-t._y*s,r.maxY=r.minY+a):(r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*s,r.maxY=r.minY+s)}B.add(wh);var X0=Object.defineProperty,xi=Object.getOwnPropertySymbols,Rh=Object.prototype.hasOwnProperty,Mh=Object.prototype.propertyIsEnumerable,Ch=(r,t,e)=>t in r?X0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class Ft extends Lt{constructor(t=P.EMPTY){var t=t instanceof P?{texture:t}:t,{texture:i=P.EMPTY,anchor:s,roundPixels:n,width:o,height:a}=t;super(((r,t)=>{for(var e in t=t||{})Rh.call(t,e)&&Ch(r,e,t[e]);if(xi)for(var e of xi(t))Mh.call(t,e)&&Ch(r,e,t[e]);return r})({label:"Sprite"},((r,t)=>{var e={};for(i in r)Rh.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&xi)for(var i of xi(r))t.indexOf(i)<0&&Mh.call(r,i)&&(e[i]=r[i]);return e})(t,["texture","anchor","roundPixels","width","height"]))),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new rt({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=null!=n&&n,void 0!==o&&(this.width=o),void 0!==a&&(this.height=a)}static from(t,e=!1){return t instanceof P?new Ft(t):new Ft(P.from(t,e))}set texture(t){t=t||P.EMPTY;var 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 Dn(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return this.visualBounds}updateBounds(){var t=this._anchor,e=this._texture,i=this._bounds,{width:e,height:n}=e.orig;i.minX=-t._x*e,i.maxX=i.minX+e,i.minY=-t._y*n,i.maxY=i.minY+n}destroy(t=!1){super.destroy(t),("boolean"==typeof t?t:null!=t&&t.texture)&&(t="boolean"==typeof t?t:null==t?void 0:t.textureSource,this._texture.destroy(t)),this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?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||{}).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){var i;"object"==typeof t?(e=null!=(i=t.height)?i:t.width,t=t.width):null==e&&(e=t),void 0!==t&&this._setWidth(t,this._texture.orig.width),void 0!==e&&this._setHeight(e,this._texture.orig.height)}}const V0=new nt;function Ti(r,t,e){var i=V0;r.measurable=!0,dr(r,e,i),t.addBoundsMask(i),r.measurable=!1}function Si(r,t,e){var i=$t.get(),s=(r.measurable=!0,ct.get().identity());hi(r,i,Un(r,e,s)),r.measurable=!1,t.addBoundsMask(i),ct.return(s),$t.return(i)}function Un(r,t,e){return r&&r!==t&&(Un(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class kn{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",null!=t&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Ft),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){this.inverse||Ti(this.mask,t,e)}addLocalBounds(t,e){Si(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof Ft}}kn.extension=r.MaskEffect;class $n{constructor(t){this.priority=0,this.pipe="colorMask",null!=t&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return"number"==typeof t}}$n.extension=r.MaskEffect;class Ln{constructor(t){this.priority=0,this.pipe="stencilMask",null!=t&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){Ti(this.mask,t,e)}addLocalBounds(t,e){Si(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}destroy(){this.reset()}static test(t){return t instanceof lt}}Ln.extension=r.MaskEffect;class Nt extends Q{constructor(t){t.resource||(t.resource=H.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){return(t=super.resize(t,e,i))&&this.resizeCanvas(),t}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"))}}Nt.extension=r.TextureSource;class ie extends Q{constructor(t){var e;t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement&&((e=H.get().createCanvas(t.resource.width,t.resource.height)).getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e),super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}ie.extension=r.TextureSource;let Nn;async function Hn(){return Nn=null==Nn?(async()=>{var i,s,e,t=document.createElement("canvas").getContext("webgl");return t&&(e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()}))&&(i=t.createTexture(),t.bindTexture(t.TEXTURE_2D,i),s=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,s),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),e=new Uint8Array(4),t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,e),t.deleteFramebuffer(s),t.deleteTexture(i),null!=(s=t.getExtension("WEBGL_lose_context"))&&s.loseContext(),e[0]<=e[3])?"premultiplied-alpha":"premultiply-alpha-on-upload"})():Nn}var W0=Object.defineProperty,Y0=Object.defineProperties,K0=Object.getOwnPropertyDescriptors,Oh=Object.getOwnPropertySymbols,q0=Object.prototype.hasOwnProperty,Z0=Object.prototype.propertyIsEnumerable,Gh=(r,t,e)=>t in r?W0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Xn=(r,t)=>{for(var e in t=t||{})q0.call(t,e)&&Gh(r,e,t[e]);if(Oh)for(var e of Oh(t))Z0.call(t,e)&&Gh(r,e,t[e]);return r},Ei=class ky extends Q{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=Xn(Xn({},ky.defaultOptions),t),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=!1!==t.autoPlay,this.alphaMode=null!=(e=t.alphaMode)?e:"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),!1!==t.autoLoad&&this.load()}updateFrame(){var t;this.destroyed||(this._updateFPS&&(t=ut.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){const t=this.resource,e=this.options;(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.alphaMode=await Hn(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,void 0!==e.preloadTimeoutMs&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())})}return 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(){var t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return 2Y0(r,K0({autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1})))(Xn({},Q.defaultOptions)),Ei.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let vr=Ei;const W=new class{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){return this._cache.get(t)}set(t,e){var i=Ct(t);let s;for(let l=0;l{n.set(l,e)}),[...n.keys()]),a={cacheKeys:o,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{s&&s[l],this._cache.has(l)&&this._cache.get(l),this._cache.set(l,n.get(l))})}remove(t){this._cacheMap.has(t)&&((t=this._cacheMap.get(t)).cacheKeys.forEach(i=>{this._cache.delete(i)}),t.keys.forEach(i=>{this._cacheMap.delete(i)}))}get parsers(){return this._parsers}},jn=[];function zn(r={}){var t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s{W.has(i)&&W.remove(i)}),t||W.set(i,r),r)}function Ih(r,t=!1){return"string"==typeof r?W.get(r):r instanceof Q?new P({source:r}):Bh(r,t)}B.handleByList(r.TextureSource,jn),P.from=Ih,Q.from=zn,B.add(kn,$n,Ln,vr,ie,Nt,pi);class Ht{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){var s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(this._dirty){this._dirty=!1;var t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}}setResource(t,e){var n=this.resources[e];t!==n&&(n&&null!=(n=t.off)&&n.call(t,"change",this.onResourceChange,this),null!=(n=t.on)&&n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){var e=this.resources;for(const i in e)e[i]._touched=t}destroy(){var t,e=this.resources;for(const i in e){var s=e[i];null!=(t=s.off)&&t.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){var e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}let yr;function Vn(){return yr=!yr||null!=yr&&yr.isContextLost()?H.get().createCanvas().getContext("webgl",{}):yr}const e1=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function Fh(r,t){if(0===r)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");var e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){var i=e1.replace(/%forloop%/gi,function(r){let t="";for(let e=0;e>>=0;return Dh[e]||function(r,t,e){var i={};let s=0;Wn=Wn||be();for(let o=0;o(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",r[r.NONE=5]="NONE",r))({});function $e(r,t){return"no-premultiply-alpha"===t.alphaMode&&Uh[r]||r}class kh{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;tt in r?s1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nh=(r,t)=>{for(var e in t=t||{})n1.call(t,e)&&Lh(r,e,t[e]);if($h)for(var e of $h(t))o1.call(t,e)&&Lh(r,e,t[e]);return r};class Hh{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new kh,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const Xh=[];let Yn=0;function jh(){return 0this.attributeBuffer.size&&this._resizeAttributeBuffer(4*this.attributeSize),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);var l=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,c=this.indexBuffer;let d=this._batchIndexSize,p=this._batchIndexStart,f="startBatch";var m=this.maxTextures;for(let _=this.elementStart;_=m||y)&&(this._finishBatch(i,p,d-p,s,o,a,t,f),f="renderBatch",p=d,o=x,a=g.topology,i=jh(),(s=i.textures).clear(),++xr),g._textureId=b._textureBindLocation=s.count,s.ids[b.uid]=s.count,s.textures[s.count++]=b,g._batch=i,d+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,l,u,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,l,u,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize))):(g._textureId=b._textureBindLocation,d+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,l,u,g._attributeStart,g._textureId),this.packQuadIndex(c,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,l,u,g._attributeStart,g._textureId),this.packIndex(g,c,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=i)}0(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))({});class ht extends ft{constructor(t){let{data:e,size:i}=t;var{usage:t,label:n,shrinkToFit:o}=t,a=(super(),this.uid=K("buffer"),this._resourceType="buffer",this._resourceId=K("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,null==i&&(i=null==e?void 0:e.byteLength),!!e);this.descriptor={size:i,usage:t,mappedAtCreation:a,label:n},this.shrinkToFit=null==o||o}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&L.STATIC)}set static(t){t?this.descriptor.usage|=L.STATIC:this.descriptor.usage&=~L.STATIC}setDataWithSize(t,e,i){this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t||(e=this._data,this._data=t,this._dataInt32=null,e&&e.length===t.length)||!this.shrinkToFit&&e&&t.byteLengtha&&(a=f),m>l&&(l=m),fe.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const l1=new Float32Array(1),u1=new Uint32Array(1);class Kh extends ye{constructor(){var t=new ht({data:l1,label:"attribute-batch-buffer",usage:L.VERTEX|L.COPY_DST,shrinkToFit:!1});super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:24,offset:0},aUV:{buffer:t,format:"float32x2",stride:24,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:24,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:24,offset:20}},indexBuffer:new ht({data:u1,label:"index-batch-buffer",usage:L.INDEX|L.COPY_DST,shrinkToFit:!1})})}}const qn=Object.create(null),qh=Object.create(null);function Le(r,t){let e=qh[r];return void 0===e&&(void 0===qn[t]&&(qn[t]=1),qh[r]=e=qn[t]++),e}let wi;function Zh(){var r;return wi||(wi="mediump",(r=Vn())&&r.getShaderPrecisionFormat&&(wi=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")),wi}function Qh(r,t,e){return t?r:e?` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in varying + #define finalColor gl_FragColor + #define texture texture2D + #endif + ${r=r.replace("out vec4 finalColor;","")} + `:` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in attribute + #define out varying + #endif + ${r} + `}function Jh(r,t,e){var i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;return"precision"===r.substring(0,9)?"highp"!==i&&"precision highp"===r.substring(0,15)?r.replace("precision highp","precision mediump"):r:`precision ${e="highp"===(e=e?t.requestedFragmentPrecision:t.requestedVertexPrecision)&&"highp"!==i?"mediump":e} float; +`+r}function td(r,t){return t?`#version 300 es +`+r:r}const c1={},h1={};function ed(r,{name:t="pixi-program"},e=!0){return t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex",(e=e?c1:h1)[t]?(e[t]++,t+="-"+e[t]):e[t]=1,-1!==r.indexOf("#define SHADER_NAME")?r:"#define SHADER_NAME "+t+` +`+r}function rd(r,t){return t?r.replace("#version 300 es",""):r}var d1=Object.defineProperty,id=Object.getOwnPropertySymbols,p1=Object.prototype.hasOwnProperty,f1=Object.prototype.propertyIsEnumerable,sd=(r,t,e)=>t in r?d1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nd=(r,t)=>{for(var e in t=t||{})p1.call(t,e)&&sd(r,e,t[e]);if(id)for(var e of id(t))f1.call(t,e)&&sd(r,e,t[e]);return r};const Zn={stripVersion:rd,ensurePrecision:Jh,addProgramDefines:Qh,setProgramName:ed,insertVersion:td},Qn=Object.create(null),od=class Gu{constructor(t){const e=-1!==(t=nd(nd({},Gu.defaultOptions),t)).fragment.indexOf("#version 300 es"),i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Zh()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let s=t.fragment,n=t.vertex;Object.keys(Zn).forEach(o=>{var a=i[o];s=Zn[o](s,a,!0),n=Zn[o](n,a,!1)}),this.fragment=s,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Le(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}static from(t){var e=t.vertex+":"+t.fragment;return Qn[e]||(Qn[e]=new Gu(t)),Qn[e]}};od.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Tt=od;const ad={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 qt(r){return null!=(r=ad[r])?r:ad.float32}const m1={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"};function ld({source:r,entryPoint:t}){var i={};if(-1!==(t=r.indexOf("fn "+t))){var n=r.indexOf("->",t);if(-1!==n)for(var l,o=r.substring(t,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;null!==(l=a.exec(o));){var e=null!=(e=m1[l[3]])?e:"float32";i[l[2]]={location:parseInt(l[1],10),format:e,stride:qt(e).stride,offset:0,instance:!1,start:0}}}return i}function Ri(r){var t;const n=/@group\((\d+)\)/,o=/@binding\((\d+)\)/,a=/var(<[^>]+>)? (\w+)/,l=/:\s*(\w+)/,c=/(\w+)\s*:\s*([\w\<\>]+)/g,d=/struct\s+(\w+)/,p=null==(t=r.match(/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g))?void 0:t.map(m=>({group:parseInt(m.match(n)[1],10),binding:parseInt(m.match(o)[1],10),name:m.match(a)[2],isUniform:""===m.match(a)[1],type:m.match(l)[1]}));return p?(t=null!=(r=null==(t=r.match(/struct\s+(\w+)\s*{([^}]+)}/g))?void 0:t.map(m=>{var _=m.match(d)[1];return(m=m.match(c).reduce((b,x)=>{var[x,T]=x.split(":");return b[x.trim()]=T.trim(),b},{}))?{name:_,members:m}:null}).filter(({name:m})=>p.some(_=>_.type===m)))?r:[],{groups:p,structs:t}):{groups:[],structs:[]}}var Ne=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))({});function ud({groups:r}){var t=[];for(let e=0;e!e.has(o.name)&&(e.add(o.name),!0)),n=[...r.groups,...t.groups].filter(o=>(o=o.name+"-"+o.binding,!i.has(o)&&(i.add(o),!0)));return{structs:s,groups:n}}const Jn=Object.create(null);class gt{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var u,{fragment:t,vertex:n,layout:o,gpuLayout:a,name:l}=t;this.name=l,this.fragment=t,this.vertex=n,t.source===n.source?(l=Ri(t.source),this.structsAndGroups=l):(u=Ri(n.source),t=Ri(t.source),this.structsAndGroups=hd(u,t)),this.layout=null!=o?o:cd(this.structsAndGroups),this.gpuLayout=null!=a?a:ud(this.structsAndGroups),this.autoAssignGlobalUniforms=void 0!==(null==(l=this.layout[0])?void 0:l.globalUniforms),this.autoAssignLocalUniforms=void 0!==(null==(n=this.layout[1])?void 0:n.localUniforms),this._generateProgramKey()}_generateProgramKey(){var{vertex:t,fragment:e}=this,t=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Le(t,"program")}get attributeData(){return null==this._attributeData&&(this._attributeData=ld(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){var e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:`+t.vertex.entryPoint;return Jn[e]||(Jn[e]=new gt(t)),Jn[e]}}function to(r,t,e){if(r)for(const i in r){var n=t[i.toLocaleLowerCase()];if(n){let o=r[i];"header"===i&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}}}const dd=/\{\{(.*?)\}\}/g;function eo(r){const i={};return(null!=(r=null==(r=r.match(dd))?void 0:r.map(s=>s.replace(/[{()}]/g,"")))?r:[]).forEach(s=>{i[s]=[]}),i}function pd(r,t){for(var e,i=/@in\s+([^;]+);/g;null!==(e=i.exec(r));)t.push(e[1])}function ro(r,t,e=!1){const i=[];pd(t,i),r.forEach(a=>{a.header&&pd(a.header,i)}),r=i,e&&r.sort(),e=r.map((a,l)=>` @location(${l}) ${a},`).join(` +`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",` +${e} +`)}function fd(r,t){for(var e,i=/@out\s+([^;]+);/g;null!==(e=i.exec(r));)t.push(e[1])}function md(r,t){const e=[];fd(t,e),r.forEach(l=>{l.header&&fd(l.header,e)});let i=0;var r=e.sort().map(l=>-1` var ${l.replace(/@.*?\s+/g,"")};`).join(` +`),o=`return VSOutput( + ${e.sort().map(l=>" "+((l=/\b(\w+)\s*:/g.exec(l))?l[1]:"")).join(`, +`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=(a=(a=a.replace("{{struct}}",` +${r} +`)).replace("{{start}}",` +${n} +`)).replace("{{return}}",` +${o} +`)}function io(r,t){let e=r;for(const i in t){var s=t[i];e=s.join(` +`).length?e.replace(`{{${i}}}`,`//-----${i} START-----// +${s.join(` +`)} +//----${i} FINISH----//`):e.replace(`{{${i}}}`,"")}return e}const xe=Object.create(null),so=new Map;let b1=0;function gd({template:r,bits:t}){var s,e=bd(r,t);return xe[e]||({vertex:r,fragment:s}=function(r,t){var e=t.map(o=>o.vertex).filter(o=>!!o),t=t.map(o=>o.fragment).filter(o=>!!o);return{vertex:md(e,ro(e,r.vertex,!0)),fragment:ro(t,r.fragment,!0)}}(r,t),xe[e]=vd(r,s,t)),xe[e]}function _d({template:r,bits:t}){var e=bd(r,t);return xe[e]||(xe[e]=vd(r.vertex,r.fragment,t)),xe[e]}function bd(r,t){return t.map(e=>(so.has(e)||so.set(e,b1++),so.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function vd(r,t,e){const i=eo(r),s=eo(t);return e.forEach(n=>{to(n.vertex,i,n.name),to(n.fragment,s,n.name)}),{vertex:io(r,i),fragment:io(t,s)}}const yd=` + @in aPosition: vec2; + @in aUV: vec2; + + @out @builtin(position) vPosition: vec4; + @out vUV : vec2; + @out vColor : vec4; + + {{header}} + + struct VSOutput { + {{struct}} + }; + + @vertex + fn main( {{in}} ) -> VSOutput { + + var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; + var modelMatrix = mat3x3( + 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(1., 1., 1., 1.); + + {{main}} + + vUV = uv; + + var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; + + vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= globalUniforms.uWorldColorAlpha; + + {{end}} + + {{return}} + }; +`,xd=` + @in vUV : vec2; + @in vColor : vec4; + + {{header}} + + @fragment + fn main( + {{in}} + ) -> @location(0) vec4 { + + {{start}} + + var outColor:vec4; + + {{main}} + + var finalColor:vec4 = outColor * vColor; + + {{end}} + + return finalColor; + }; +`,Td=` + 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}} + } +`,Sd=` + + in vec4 vColor; + in vec2 vUV; + + out vec4 finalColor; + + {{header}} + + void main(void) { + + {{start}} + + vec4 outColor; + + {{main}} + + finalColor = outColor * vColor; + + {{end}} + } +`,Ed={name:"global-uniforms-bit",vertex:{header:` + struct GlobalUniforms { + uProjectionMatrix:mat3x3, + uWorldTransformMatrix:mat3x3, + uWorldColorAlpha: vec4, + uResolution: vec2, + } + + @group(0) @binding(0) var globalUniforms : GlobalUniforms; + `}},y1={name:"global-uniforms-ubo-bit",vertex:{header:` + uniform globalUniforms { + mat3 uProjectionMatrix; + mat3 uWorldTransformMatrix; + vec4 uWorldColorAlpha; + vec2 uResolution; + }; + `}},Ad={name:"global-uniforms-bit",vertex:{header:` + uniform mat3 uProjectionMatrix; + uniform mat3 uWorldTransformMatrix; + uniform vec4 uWorldColorAlpha; + uniform vec2 uResolution; + `}};var x1=Object.defineProperty,Pd=Object.getOwnPropertySymbols,T1=Object.prototype.hasOwnProperty,S1=Object.prototype.propertyIsEnumerable,wd=(r,t,e)=>t in r?x1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;function He({bits:r,name:t}){return r=gd({template:{fragment:xd,vertex:yd},bits:[Ed,...r]}),gt.from({name:t,vertex:{source:r.vertex,entryPoint:"main"},fragment:{source:r.fragment,entryPoint:"main"}})}function Xe({bits:r,name:t}){return new Tt(((r,t)=>{for(var e in t=t||{})T1.call(t,e)&&wd(r,e,t[e]);if(Pd)for(var e of Pd(t))S1.call(t,e)&&wd(r,e,t[e]);return r})({name:t},_d({template:{vertex:Td,fragment:Sd},bits:[Ad,...r]})))}const Mi={name:"color-bit",vertex:{header:` + @in aColor: vec4; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},Ci={name:"color-bit",vertex:{header:` + in vec4 aColor; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},no={};function Oi(r){return no[r]||(no[r]={name:"texture-batch-bit",vertex:{header:` + @in aTextureIdAndRound: vec2; + @out @interpolate(flat) vTextureId : u32; + `,main:` + vTextureId = aTextureIdAndRound.y; + `,end:` + if(aTextureIdAndRound.x == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + @in @interpolate(flat) vTextureId: u32; + + ${function(r){var t=[];if(1===r)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(` +`)}(r)} + `,main:` + var uvDx = dpdx(vUV); + var uvDy = dpdy(vUV); + + ${function(r){var t=[];if(1===r)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e, targetSize: vec2) -> vec2 + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}},ze={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; + } + `}},ao=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4","vec2","vec3","vec4"],Rd=ao.reduce((r,t)=>(r[t]=!0,r),{});function Md(r,t){switch(r){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var R1=Object.defineProperty,Cd=Object.getOwnPropertySymbols,M1=Object.prototype.hasOwnProperty,C1=Object.prototype.propertyIsEnumerable,Od=(r,t,e)=>t in r?R1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gd=(r,t)=>{for(var e in t=t||{})M1.call(t,e)&&Od(r,e,t[e]);if(Cd)for(var e of Cd(t))C1.call(t,e)&&Od(r,e,t[e]);return r};(Bd=class $y{constructor(t,e){this._touched=0,this.uid=K("uniform"),this._resourceType="uniformGroup",this._resourceId=K("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e=Gd(Gd({},$y.defaultOptions),e);var i,n={};for(const o in this.uniformStructures=t){var a=t[o];if(a.name=o,a.size=null!=(i=a.size)?i:1,!Rd[a.type])throw new Error(`Uniform type ${a.type} is not supported. Supported uniform types are: `+ao.join(", "));null==a.value&&(a.value=Md(a.type,a.size)),n[o]=a.value}this.uniforms=n,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Le(Object.keys(n).map(o=>o+"-"+t[o].type).join("-"),"uniform-group")}update(){this._dirtyId++}}).defaultOptions={ubo:!1,isStatic:!1};let st=Bd;const Id={};function Bi(r){var t=Id[r];if(!t){var e=new Int32Array(r);for(let i=0;i(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))({}),O1=Object.defineProperty,Ii=Object.getOwnPropertySymbols,Fd=Object.prototype.hasOwnProperty,Dd=Object.prototype.propertyIsEnumerable,Ud=(r,t,e)=>t in r?O1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class St extends ft{constructor(t){super(),this.uid=K("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,void 0===o&&(o=0,e&&(o|=_t.WEBGPU),i)&&(o|=_t.WEBGL),this.compatibleRenderers=o;const l={};if((n=n||s?n:{})&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(const u in a)for(const c in a[u]){var d=a[u][c];l[d]={group:u,binding:c,name:d}}else if(e&&s&&!a)t=e.structsAndGroups.groups,a={},t.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c});else if(n){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c});let u=0;for(const c in n)l[c]||(s[99]||(s[99]=new Ht,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:u,name:c},a[99]=a[99]||{},a[99][u]=c,u++);for(const c in n){const d=c;let p=n[c];p.source||p._resourceType||(p=new st(p));var f=l[d];f&&(s[f.group]||(s[f.group]=new Ht,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(p,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s;(s=this._uniformBindMap)[e]||(s[e]={}),(s=this._uniformBindMap[e])[i]||(s[i]=t),this.groups[e]||(this.groups[e]=new Ht,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){var i={};for(const s in e){const n=e[s];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){this.emit("destroy",this),t&&(null!=(t=this.gpuProgram)&&t.destroy(),null!=(t=this.glProgram))&&t.destroy(),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){var{gpu:i,gl:s}=t,t=((r,t)=>{var e={};for(i in r)Fd.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Ii)for(var i of Ii(r))t.indexOf(i)<0&&Dd.call(r,i)&&(e[i]=r[i]);return e})(t,["gpu","gl"]);let o,a;return i&&(o=gt.from(i)),s&&(a=Tt.from(s)),new St(((r,t)=>{for(var e in t=t||{})Fd.call(t,e)&&Ud(r,e,t[e]);if(Ii)for(var e of Ii(t))Dd.call(t,e)&&Ud(r,e,t[e]);return r})({gpuProgram:o,glProgram:a},t))}}class kd extends St{constructor(t){super({glProgram:Xe({name:"batch",bits:[Ci,Gi(t),ze]}),gpuProgram:He({name:"batch",bits:[Mi,Oi(t),je]}),resources:{batchSamplers:Bi(t)}})}}let $d=null,Fi=((Bd=class Ly extends Ei{constructor(){super(...arguments),this.geometry=new Kh,this.shader=$d=$d||new kd(this.maxTextures),this.name=Ly.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,n){var o=n<<16|65535&t.roundPixels,l=(n=t.transform).a,u=n.b,c=n.c,d=n.d,p=n.tx,f=n.ty,{positions:m,uvs:_}=t,g=t.color,x=(n=t.attributeOffset)+t.attributeSize;for(let y=n;y>16|65280&t|(255&t)<<16,i=this.renderable;return i?gn(t,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):t+(255*this.alpha<<24)}get transform(){var t;return(null==(t=this.renderable)?void 0:t.groupTransform)||I1}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"}}var F1=Object.defineProperty,D1=Object.defineProperties,U1=Object.getOwnPropertyDescriptors,Nd=Object.getOwnPropertySymbols,k1=Object.prototype.hasOwnProperty,$1=Object.prototype.propertyIsEnumerable,Hd=(r,t,e)=>t in r?F1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$i=(r,t)=>D1(r,U1(t));const Zt={extension:{type:r.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,n,o,a;if("circle"===r.type)e=r.x,i=r.y,o=a=r.radius,s=n=0;else if("ellipse"===r.type){var T=r;e=T.x,i=T.y,o=T.halfWidth,a=T.halfHeight,s=n=0}else{const T=r,A=T.width/2,S=T.height/2;e=T.x+A,i=T.y+S,o=a=Math.max(0,Math.min(T.radius,Math.min(A,S))),s=A-o,n=S-a}if(0<=o&&0<=a&&0<=s&&0<=n){var l=Math.ceil(2.3*Math.sqrt(o+a));if(0!=(r=8*l+(s?4:0)+(n?4:0)))if(0===l)t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n;else{let c=0,d=4*l+(s?2:0)+2,p=d,f=r,m=s+o,_=n,g=e+m,b=e-m,x=i+_;if(t[c++]=g,t[c++]=x,t[--d]=x,t[--d]=b,n){const T=i-_;t[p++]=b,t[p++]=T,t[--f]=T,t[--f]=g}for(let T=1;T{for(var e in t=t||{})k1.call(t,e)&&Hd(r,e,t[e]);if(Nd)for(var e of Nd(t))$1.call(t,e)&&Hd(r,e,t[e]);return r})({},Zt),{extension:$i(Bd({},Zt.extension),{name:"ellipse"})}),jd=$i(Bd({},Zt),{extension:$i(Bd({},Zt.extension),{name:"roundedRectangle"})}),co=1e-4,ho=1e-4;function zd(r){var t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],n=r[t-1];id&&(d+=2*Math.PI);var p=c,f=d-c,m=Math.abs(f),_=Math.sqrt(l*l+u*u),g=1+(15*m*Math.sqrt(_)/Math.PI>>0),b=f/g;if(p+=b,a){o.push(r,t),o.push(e,i);for(let x=1,y=p;x=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&n=e.x&&e.x>=u&&i!==e.x&&Ve(so.x||e.x===o.x&&function(r,t){return q(r.prev,r,t.prev)<0&&q(t.next,r,r.next)<0}(o,e)))&&(o=e,d=p),(e=e.next)!==l;);return o}(r,t);return e?(Se(r=Zd(e,r),r.next),Se(e,e.next)):t}(s[n],e);return e}(r,t,n,e)),r.length>80*e){for(var a=u=r[0],l=c=r[1],m=e;m=b&&T&&T.z<=x;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&Ve(a,c,l,d,u,p,y.x,y.y)&&0<=q(y.prev,y,y.next)||(y=y.prevZ,T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&Ve(a,c,l,d,u,p,T.x,T.y)&&0<=q(T.prev,T,T.next)))return;T=T.nextZ}for(;y&&y.z>=b;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&Ve(a,c,l,d,u,p,y.x,y.y)&&0<=q(y.prev,y,y.next))return;y=y.prevZ}for(;T&&T.z<=x;){if(T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&Ve(a,c,l,d,u,p,T.x,T.y)&&0<=q(T.prev,T,T.next))return;T=T.nextZ}return 1}}(r,i,s):function(r){var t=r.prev,e=r;if(!(0<=q(t,e,r=r.next))){for(var s=t.x,n=e.x,o=r.x,a=t.y,l=e.y,u=r.y,c=s=c&&m.x<=p&&m.y>=d&&m.y<=f&&Ve(s,a,n,l,o,u,m.x,m.y)&&0<=q(m.prev,m,m.next))return;m=m.next}return 1}}(r))t.push(l.i/e|0),t.push(r.i/e|0),t.push(u.i/e|0),Er(r),r=u.next,a=u.next;else if((r=u)===a){o?1===o?Tr(r=function(r,t,e){var i=r;do{var s=i.prev,n=i.next.next}while(!Hi(s,n)&&qd(s,i,i.next,n)&&Sr(s,n)&&Sr(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Er(i),Er(i.next),i=r=n),(i=i.next)!==r);return Se(i)}(Se(r),t,e),t,e,i,s,n,2):2===o&&function(r,t,e,i,s,n){var o=r;do{for(var l,a=o.next.next;a!==o.prev;){if(o.i!==a.i&&function(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&qd(e,e.next,r,t))return 1}while((e=e.next)!==r)}(r,t)&&(Sr(r,t)&&Sr(t,r)&&function(r,t){for(var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),(e=e.next)!==r;);return i}(r,t)&&(q(r.prev,r,t.prev)||q(r,t.prev,t))||Hi(r,t)&&0=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function ji(r){return 0{var p=a.length,f=n.length/2,m=[],_=Ar[l.type];let g="triangle-list";if(_.build(l,m),u&&Di(m,u),e){var d=null==(d=l.closePath)||d,A=t;A.pixelLine?(Yd(m,d,n,a),g="line-list"):Wd(m,A,!1,d,n,a)}else if(c){const T=[],A=m.slice();(function(r){var t=[];for(let e=0;e{T.push(A.length/2),A.push(...S)}),go(A,T,n,2,f,a,p)}else _.triangulate(m,n,2,f,a,p);A=o.length/2,(d=t.texture)!==P.WHITE?(_=tp(oT,t,l,u),lo(n,2,f,o,A,2,n.length/2-f,_)):uo(o,A,2,n.length/2-f),(c=N.get(Ui)).indexOffset=p,c.indexSize=a.length-p,c.attributeOffset=f,c.attributeSize=n.length/2-f,c.baseColor=t.color,c.alpha=t.alpha,c.texture=d,c.geometryData=s,c.topology=g,i.push(c)})}class ip{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class sp{constructor(){this.batcher=new Fi,this.instructions=new bn}init(){this.instructions.reset()}get geometry(){return this.batcher.geometry}}(Bd=class Bu{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Bu.defaultOptions.bezierSmoothness=null!=(t=null==t?void 0:t.bezierSmoothness)?t:Bu.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);var i;return t.dirty&&(e?this._cleanGraphicsContextData(t):e=this._initContext(t),ep(t,e),i=t.batchMode,t.customShader||"no-batch"===i?e.isBatchable=!1:"auto"===i&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1),e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){var e=N.get(sp),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],n=s.vertices.length,s=s.indices.length;for(let c=0;c{N.return(i)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}}).extension={type:[r.WebGLSystem,r.WebGPUSystem,r.CanvasSystem],name:"graphicsContext"},Bd.defaultOptions={bezierSmoothness:.5};let zi=Bd;const uT={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},wo=class Ny{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(1&this.data)}set blend(t){!!(1&this.data)!==t&&(this.data^=1)}get offsets(){return!!(2&this.data)}set offsets(t){!!(2&this.data)!==t&&(this.data^=2)}set cullMode(t){"none"===t?this.culling=!1:(this.culling=!0,this.clockwiseFrontFace="front"===t)}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(4&this.data)}set culling(t){!!(4&this.data)!==t&&(this.data^=4)}get depthTest(){return!!(8&this.data)}set depthTest(t){!!(8&this.data)!==t&&(this.data^=8)}get depthMask(){return!!(32&this.data)}set depthMask(t){!!(32&this.data)!==t&&(this.data^=32)}get clockwiseFrontFace(){return!!(16&this.data)}set clockwiseFrontFace(t){!!(16&this.data)!==t&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(t){this.blend="none"!==t,this._blendMode=t,this._blendModeId=uT[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){var t=new Ny;return t.depthTest=!1,t.blend=!0,t}};wo.default2d=wo.for2d();let Et=wo;function We(r,t,e){var i=(r>>24&255)/255;t[e++]=(255&r)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}class Ro{constructor(t,e){this.state=Et.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),this.renderer.renderableGC.addManagedHash(this,"_graphicsBatchesHash")}validateRenderable(t){var e=t.context,t=!!this._graphicsBatchesHash[t.uid];return!(!(e=this.renderer.graphicsContext.updateGpuContext(e)).isBatchable&&t===e.isBatchable)}addRenderable(t,e){var i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){var e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i{var a=N.get(Ui);return o.copyTo(a),a.renderable=t,a.roundPixels=s,a});return void 0===this._graphicsBatchesHash[t.uid]&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{N.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}}Ro.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"graphics"},B.add(Ro),B.add(zi);class Vi{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._textureMatrixUpdateId=-1,this._uvUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}get topology(){return this._topology||this.geometry.topology}set topology(t){this._topology=t}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}setTexture(t){this.texture!==t&&(this.texture=t,this._textureMatrixUpdateId=-1)}get uvs(){var t=this.geometry.getBuffer("aUV"),e=t.data;let i=e;var s=this.texture.textureMatrix;return s.isSimple||(i=this._transformedUvs,this._textureMatrixUpdateId===s._updateID&&this._uvUpdateId===t._updateID)||((!i||i.length"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Ht({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init(),t.renderableGC.addManagedHash(this,"_gpuBatchableMeshHash"),t.renderableGC.addManagedHash(this,"_meshDataHash")}validateRenderable(t){var e=this._getMeshData(t),i=e.batched,s=t.batched;return i!==(e.batched=s)||!!s&&((i=t._geometry).indices.length!==e.indexSize||i.positions.length!==e.vertexSize?(e.indexSize=i.indices.length,e.vertexSize=i.positions.length,!0):((s=this._getBatchableMesh(t)).texture.uid!==t._texture.uid&&(s._textureMatrixUpdateId=-1),!s._batcher.checkAndUpdateTexture(s,t._texture)))}addRenderable(t,e){var i=this.renderer.renderPipes.batch,s=this._getMeshData(t).batched;s?((s=this._getBatchableMesh(t)).setTexture(t._texture),s.geometry=t._geometry,i.addToBatch(s,e)):(i.break(e),e.add(t))}updateRenderable(t){var e;t.batched&&((e=this._gpuBatchableMeshHash[t.uid]).setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e))}destroyRenderable(t){this._meshDataHash[t.uid]=null;var e=this._gpuBatchableMeshHash[t.uid];e&&(N.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){var e;t.isRenderable&&(t.state.blendMode=$e(t.groupBlendMode,t.texture._source),(e=this.localUniforms).uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),We(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t))}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){var e;return this._meshDataHash[t.uid]={batched:t.batched,indexSize:null==(e=t._geometry.indices)?void 0:e.length,vertexSize:null==(e=t._geometry.positions)?void 0:e.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){var e=N.get(Vi);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e}destroy(){for(const t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&N.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}Mo.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"mesh"},B.add(Mo);class np{execute(t,e){var i=t.state,s=t.renderer,n=e.shader||t.defaultShader,o=(n.resources.uTexture=e.texture._source,n.resources.uniforms=t.localUniforms,s.gl),t=t.getBuffers(e),i=(s.shader.bind(n),s.state.set(i),s.geometry.bind(t.geometry,n.glProgram),2===t.geometry.indexBuffer.data.BYTES_PER_ELEMENT?o.UNSIGNED_SHORT:o.UNSIGNED_INT);o.drawElements(o.TRIANGLES,6*e.particleChildren.length,i,0)}}function Co(r,t=null){var e=6*r;if((t=65535this._size&&(e=!0,this._size=Math.max(t.length,1.5*this._size|0),this.staticAttributeBuffer=new ve(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new ve(this._size*this._dynamicStride*4*4),this.indexBuffer=Co(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));var i=this.dynamicAttributeBuffer;this._dynamicUpload(t,i.float32View,i.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e&&(i=this.staticAttributeBuffer,this._staticUpload(t,i.float32View,i.uint32View),this._staticBuffer.setDataWithSize(i.float32View,t.length*this._staticStride*4,!0))}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}var up=`varying vec2 vUV; +varying vec4 vColor; + +uniform sampler2D uTexture; + +void main(void){ + vec4 color = texture2D(uTexture, vUV) * vColor; + gl_FragColor = color; +}`,cp=`attribute vec2 aVertex; +attribute vec2 aUV; +attribute vec4 aColor; + +attribute vec2 aPosition; +attribute float aRotation; + +uniform mat3 uTranslationMatrix; +uniform float uRound; +uniform vec2 uResolution; +uniform vec4 uColor; + +varying vec2 vUV; +varying vec4 vColor; + +vec2 roundPixels(vec2 position, vec2 targetSize) +{ + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; +} + +void main(void){ + float cosRotation = cos(aRotation); + float sinRotation = sin(aRotation); + float x = aVertex.x * cosRotation - aVertex.y * sinRotation; + float y = aVertex.x * sinRotation + aVertex.y * cosRotation; + + vec2 v = vec2(x, y); + v = v + aPosition; + + gl_Position = vec4((uTranslationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); + + if(uRound == 1.0) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + + vUV = aUV; + vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor; +} +`,Oo=` +struct ParticleUniforms { + uProjectionMatrix:mat3x3, + uColor:vec4, + uResolution:vec2, + uRoundPixels:f32, +}; + +@group(0) @binding(0) var uniforms: ParticleUniforms; + +@group(1) @binding(0) var uTexture: texture_2d; +@group(1) @binding(1) var uSampler : sampler; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) color : vec4, + }; +@vertex +fn mainVertex( + @location(0) aVertex: vec2, + @location(1) aPosition: vec2, + @location(2) aUV: vec2, + @location(3) aColor: vec4, + @location(4) aRotation: f32, +) -> VSOutput { + + let v = vec2( + aVertex.x * cos(aRotation) - aVertex.y * sin(aRotation), + aVertex.x * sin(aRotation) + aVertex.y * cos(aRotation) + ) + aPosition; + + let position = vec4((uniforms.uProjectionMatrix * vec3(v, 1.0)).xy, 0.0, 1.0); + + let vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uniforms.uColor; + + return VSOutput( + position, + aUV, + vColor, + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) color: vec4, + @builtin(position) position: vec4, +) -> @location(0) vec4 { + + var sample = textureSample(uTexture, uSampler, uv) * color; + + return sample; +}`;class hp extends St{constructor(){super({glProgram:Tt.from({vertex:cp,fragment:up}),gpuProgram:gt.from({fragment:{source:Oo,entryPoint:"mainFragment"},vertex:{source:Oo,entryPoint:"mainVertex"}}),resources:{uTexture:P.WHITE.source,uSampler:new yn({}),uniforms:{uTranslationMatrix:{value:new M,type:"mat3x3"},uColor:{value:new X(16777215),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}}})}}class Go{constructor(t,e){this.state=Et.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new st({uTranslationMatrix:{value:new M,type:"mat3x3"},uColor:{value:new Float32Array(4),type:"vec4"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new hp,this.state=Et.for2d()}validateRenderable(t){return!1}addRenderable(t,e){this.renderer.renderPipes.batch.break(e),e.add(t)}getBuffers(t){return this._gpuBufferHash[t.uid]||this._initBuffer(t)}_initBuffer(t){return this._gpuBufferHash[t.uid]=new lp({size:t.particleChildren.length,properties:t._properties}),t.on("destroyed",this._destroyRenderableBound),this._gpuBufferHash[t.uid]}updateRenderable(t){}destroyRenderable(t){this._gpuBufferHash[t.uid].destroy(),this._gpuBufferHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}execute(t){var i,n,s,e=t.particleChildren;0!==e.length&&(i=this.renderer,s=this.getBuffers(t),t.texture||(t.texture=e[0].texture),n=this.state,s.update(e,t._childrenDirty),t._childrenDirty=!1,n.blendMode=$e(t.blendMode,t.texture._source),e=(s=this.localUniforms.uniforms).uTranslationMatrix,t.worldTransform.copyTo(e),e.prepend(i.globalUniforms.globalUniformData.projectionMatrix),s.uResolution=i.globalUniforms.globalUniformData.resolution,s.uRound=i._roundPixels|t._roundPixels,We(t.groupColorAlpha,s.uColor,0),this.adaptor.execute(this,t))}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}class Bo extends Go{constructor(t){super(t,new np)}}Bo.extension={type:[r.WebGLPipes],name:"particle"};class dp{execute(t,e){var i=t.renderer,s=((s=e.shader||t.defaultShader).groups[0]=i.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=i.texture.getTextureBindGroup(e.texture),t.state),o=t.getBuffers(e);i.encoder.draw({geometry:o.geometry,shader:e.shader||t.defaultShader,state:s,size:6*e.particleChildren.length})}}class Io extends Go{constructor(t){super(t,new dp)}}Io.extension={type:[r.WebGPUPipes],name:"particle"},B.add(Bo),B.add(Io);class Pr{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}}function Wi(r,t){var{texture:r,bounds:i}=r,r=(Dn(i,t._anchor,r),t._style.padding);i.minX-=r,i.minY-=r,i.maxX-=r,i.maxY-=r}class Fo{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this),this._renderer.renderableGC.addManagedHash(this,"_gpuText")}resolutionChange(){for(const t in this._gpuText){var e=this._gpuText[t];e&&(e=e.batchableSprite.renderable)._autoResolution&&(e._resolution=this._renderer.resolution,e.onViewUpdate())}}validateRenderable(t){var e=this._getGpuText(t),t=t._getKey();return e.currentKey!==t}addRenderable(t,e){var i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){var e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){var e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),N.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){var e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Wi(s,t)}_updateGpuText(t){var e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){var e={texture:null,currentKey:"--",batchableSprite:N.get(Pr)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=(t._autoResolution?this._renderer:t).resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}Fo.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"text"};class pp{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){var i=H.get().createCanvas(),t=(i.width=t,i.height=e,i.getContext("2d"));return{canvas:i,context:t}}getOptimalCanvasAndContext(t,e,i=1){return t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),i=((t=de(t))<<17)+((e=de(e))<<1),this._canvasPool[i]||(this._canvasPool[i]=[]),(i=this._canvasPool[i].pop())||this._createCanvasAndContext(t,e)}returnCanvasAndContext(t){var{width:i,height:s}=t.canvas,n=(i<<17)+(s<<1);t.context.clearRect(0,0,i,s),this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Xt=new pp;function fp(r,t,e){for(let i=0,s=4*e*t;it in r?dT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,vp=(r,t)=>{for(var e in t=t||{})pT.call(t,e)&&bp(r,e,t[e]);if(_p)for(var e of _p(t))fT.call(t,e)&&bp(r,e,t[e]);return r};const yp=[{offset:0,color:"white"},{offset:1,color:"black"}],Do=class Iu{constructor(...t){this.uid=K("fillGradient"),this.type="linear",this.colorStops=[];var s="radial"===(t=function(r){var t,i=null!=(t=r[0])?t:{};return"number"==typeof i||r[1]?{type:"linear",start:{x:r[0],y:r[1]},end:{x:r[2],y:r[3]},textureSpace:r[4],textureSize:null!=(t=r[5])?t:Qt.defaultLinearOptions.textureSize}:i}(t)).type?Iu.defaultRadialOptions:Iu.defaultLinearOptions,t=vp(vp({},s),Bt(t));this._textureSize=t.textureSize,"radial"===t.type?(this.center=t.center,this.outerCenter=null!=(s=t.outerCenter)?s:this.center,this.innerRadius=t.innerRadius,this.outerRadius=t.outerRadius,this.scale=t.scale,this.rotation=t.rotation):(this.start=t.start,this.end=t.end),this.textureSpace=t.textureSpace,this.type=t.type,t.colorStops.forEach(n=>{this.addColorStop(n.offset,n.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:X.shared.setValue(e).toHexa()}),this}buildLinearGradient(){var e,t,n,c,s,f,i;this.texture||(t=this.colorStops.length?this.colorStops:yp,{canvas:i,context:s}=Tp(e=this._textureSize,1),{x:t,y:n}=(xp(n=s.createLinearGradient(0,0,this._textureSize,0),t),s.fillStyle=n,s.fillRect(0,0,e,1),this.texture=new P({source:new ie({resource:i})}),this.start),{x:s,y:i}=this.end,c=new M,s-=t,i-=n,f=Math.sqrt(s*s+i*i),i=Math.atan2(i,s),c.scale(f/e,1),c.rotate(i),c.translate(t,n),"local"===this.textureSpace&&c.scale(e,e),this.transform=c)}buildGradient(){"linear"===this.type?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){var t,e,i,s,l,c,n,o,f,m,_,u,a;this.texture||(t=this.colorStops.length?this.colorStops:yp,{canvas:i,context:s}=Tp(e=this._textureSize,e),{x:n,y:o}=this.center,{x:a,y:l}=this.outerCenter,u=this.innerRadius,c=this.outerRadius,xp(u=s.createRadialGradient(m=(n-(n=a-c))*(f=e/(2*c)),_=(o-(o=l-c))*f,u*f,(a-n)*f,(l-o)*f,c*f),t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=u,s.translate(m,_),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-_),s.fillRect(0,0,e,e),this.texture=new P({source:new ie({resource:i,addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"})}),(a=new M).scale(1/f,1/f),a.translate(n,o),"local"===this.textureSpace&&a.scale(e,e),this.transform=a)}get styleKey(){return this.uid}destroy(){var t;null!=(t=this.texture)&&t.destroy(!0),this.texture=null}};Do.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256},Do.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256};let Qt=Do;function xp(r,t){for(let e=0;es?u:s,n=co?c:o}return t.x=i,t.width=s-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}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const qi=(r,t,e,i,s,n,o)=>(r-=e,e=t-i,s-n<=(t=Math.sqrt(r*r+e*e))&&t<=s+o);class Zi{constructor(t=0,e=0,i=0,s=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n}getBounds(t){return(t=t||new z).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Zi(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)&&t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){var 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 s=t-(this.x+i),n=e-(this.y+i);var o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i))*s+n*n<=o||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i))*s+n*n<=o)return!0}return!1}strokeContains(t,e,i,s=.5){var{x:n,y:o,width:a,height:l,radius:u}=this,i=i-(s=i*(1-s)),p=n+u,f=o+u,g=n+a,b=o+l;return(n-s<=t&&t<=n+i||g-i<=t&&t<=g+s)&&f<=e&&e<=f+(l-2*u)||(o-s<=e&&e<=o+i||b-i<=e&&e<=b+s)&&p<=t&&t<=p+(a-2*u)||tET)){var d=Math.PI,p=(r+e)/2,f=(t+i)/2,m=(e+s)/2,_=(i+n)/2,g=(s+o)/2,b=(n+a)/2,x=(p+m)/2,y=(f+_)/2,S=(x+(m=(m+g)/2))/2,E=(y+(_=(_+b)/2))/2;if(0Qi&&w>Qi){if((R+w)*(R+w)<=u*(U*U+O*O)){if(Ke=d&&(D=2*d-D),G>=d&&(G=2*d-G),D+GEe)return l.push(e,i);if(G>Ee)return l.push(s,n)}}}else if(R>Qi){if(R*R<=u*(U*U+O*O)){if(Ke=d?2*d-D:D)Ee)return l.push(e,i)}}else if(w>Qi){if(w*w<=u*(U*U+O*O)){if(Ke=d?2*d-D:D)Ee)return l.push(s,n)}}else if((U=S-(r+o)/2)*U+(O=E-(t+a)/2)*O<=u)return l.push(S,E)}Lo(r,t,p,f,x,y,S,E,l,u,c+1),Lo(S,E,m,_,g,b,o,a,l,u,c+1)}})(r,t,e,i,s,n,o,a,l,u,0),l.push(o,a)}(t,e,i,s,n,o,a,l,r,u*=u),r}function Pp(r,t,e,i,s,n,o,a){return a=1-Math.min(.99,Math.max(0,null!=a?a:zi.defaultOptions.bezierSmoothness)),function(r,t,e,i,s,n,o,a){(function No(r,t,e,i,s,n,o,a,l){if(!(8(e=n*(r*=e)+s*(t*=i),l.x=s*r-n*t+o,l.y=e+a,l),Rp=(r,t,e,i)=>{let n=r*e+t*i;return(n=1{var f=Math.pow(s,2),m=Math.pow(n,2),_=Math.pow(c,2),g=Math.pow(d,2);let b=f*m-f*g-m*_,w=(b<0&&(b=0),b/=f*g+m*_,m=u*(f=(b=Math.sqrt(b)*(o===a?-1:1))*s/n*d)-l*(g=b*-n/s*c)+(r+e)/2,_=l*f+u*g+(t+i)/2,o=(c-f)/s,r=(d-g)/n,e=(-c-f)/s,l=(-d-g)/n,u=Rp(1,0,o,r),Rp(o,r,e,l));0===a&&0{var u=l.x-a.x,l=l.y-a.y;return{len:a=Math.sqrt(u*u+l*l),nx:u/a,ny:l/a}},n=(a,l)=>{0===a?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y)};let o=t[t.length-1];for(let a=0;aMath.min(d.len/2,c.len/2)?(x=Math.min(d.len/2,c.len/2),Math.abs(x*Math.sin(g)/Math.cos(g))):i,g=l.x+c.nx*x+-c.ny*b*m,i=l.y+c.ny*x+c.nx*b*m,d=Math.atan2(d.ny,d.nx)+Math.PI/2*m,c=Math.atan2(c.ny,c.nx)-Math.PI/2*m,0===a&&r.moveTo(g+Math.cos(d)*b,i+Math.sin(d)*b),r.arc(g,i,b,d,c,_)}}o=l}}function Op(r,t,e,i){var n=(l,u)=>Math.sqrt((l.x-u.x)**2+(l.y-u.y)**2),o=(l,u,c)=>({x:l.x+(u.x-l.x)*c,y:l.y+(u.y-l.y)*c}),a=t.length;for(let l=0;lt in r?UT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ji=(r,t)=>{for(var e in t=t||{})kT.call(t,e)&&Dp(r,e,t[e]);if(Fp)for(var e of Fp(t))$T.call(t,e)&&Dp(r,e,t[e]);return r};function Up(r,t){"string"==typeof r&&((o=document.createElement("div")).innerHTML=r.trim(),r=o.querySelector("svg"));var o,e={context:t,defs:{},path:new se},i=(Ip(r,e),r.children),{fillStyle:s,strokeStyle:n}=Yo(r,e);for(let o=0;oparseInt(O,10)),t.context.poly(y,!0),e&&t.context.fill(e),i&&t.context.stroke(i);break;case"polyline":T=r.getAttribute("points"),y=T.match(/\d+/g).map(O=>parseInt(O,10)),t.context.poly(y,!1),i&&t.context.stroke(i);break;case"g":case"svg":break;default:Ot(`[SVG parser] <${r.nodeName}> elements unsupported`)}n&&(e=null);for(let O=0;Ot in r?LT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dt=(r,t)=>{for(var e in t=t||{})$p.call(t,e)&&Np(r,e,t[e]);if(ts)for(var e of ts(t))Lp.call(t,e)&&Np(r,e,t[e]);return r};function Hp(r){return r instanceof wr}function Xp(r){return r instanceof Qt}function jp(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,Dt(Dt({},e),r)}function zp(r,t,e){return t.buildGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,r.textureSpace=t.textureSpace,Dt(Dt({},e),r)}function ne(r,t){var e,i;return null==r?null:(e={},function(r){return X.isColorLike(r)}(i=r)?function(r,t,e){return t=X.shared.setValue(null!=t?t:0),r.color=t.toNumber(),r.alpha=(1===t.alpha?e:t).alpha,r.texture=P.WHITE,Dt(Dt({},e),r)}(e,r,t):function(r){return r instanceof P}(r)?function(r,t,e){return r.texture=t,Dt(Dt({},e),r)}(e,r,t):Hp(r)?jp(e,r,t):Xp(r)?zp(e,r,t):i.fill&&Hp(i.fill)?jp(i,i.fill,t):i.fill&&Xp(i.fill)?zp(i,i.fill,t):function(r,t){return t=Dt(Dt({},t),r),r=X.shared.setValue(t.color),t.alpha*=r.alpha,t.color=r.toNumber(),t}(i,t))}function Or(r,t){var{width:i,alignment:s,miterLimit:n,cap:o,join:a,pixelLine:l}=t;return(r=ne(r,((r,t)=>{var e={};for(i in r)$p.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&ts)for(var i of ts(r))t.indexOf(i)<0&&Lp.call(r,i)&&(e[i]=r[i]);return e})(t,["width","alignment","miterLimit","cap","join","pixelLine"])))?Dt({width:i,alignment:s,miterLimit:n,cap:o,join:a,pixelLine:l},r):null}var WT=Object.defineProperty,Vp=Object.getOwnPropertySymbols,YT=Object.prototype.hasOwnProperty,KT=Object.prototype.propertyIsEnumerable,Wp=(r,t,e)=>t in r?WT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qe=(r,t)=>{for(var e in t=t||{})YT.call(t,e)&&Wp(r,e,t[e]);if(Vp)for(var e of Vp(t))KT.call(t,e)&&Wp(r,e,t[e]);return r};const qT=new V,Yp=new M,qo=class zt extends ft{constructor(){super(...arguments),this.uid=K("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new se,this._transform=new M,this._fillStyle=qe({},zt.defaultFillStyle),this._strokeStyle=qe({},zt.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new nt,this._boundsDirty=!0}clone(){var t=new zt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=qe({},this._fillStyle),t._strokeStyle=qe({},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=ne(t,zt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Or(t,zt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=ne(t,zt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=ne(t,zt.defaultStrokeStyle),this}texture(t,e,i,s,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?X.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new se,this}fill(t,e){var s=this.instructions[this.instructions.length-1];return(s=0===this._tick&&s&&"stroke"===s.action?s.data.path:this._activePath.clone())&&(null!=t&&(this._fillStyle=ne(t=void 0!==e&&"number"==typeof t?{color:t,alpha:e}:t,zt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0),this}_initNextPathLocation(){var{x:t,y:e}=this._activePath.getLastPoint(V.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){var i=this.instructions[this.instructions.length-1];return(i=0===this._tick&&i&&"fill"===i.action?i.data.path:this._activePath.clone())&&(null!=t&&(this._strokeStyle=Or(t,zt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0),this}cut(){for(let t=0;t<2;t++){var e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&("stroke"===e.action||"fill"===e.action)){if(!e.data.hole){e.data.hole=i;break}e.data.hole.addPath(i)}}return this._initNextPathLocation(),this}arc(t,e,i,s,n,o){this._tick++;var a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,n,o),this}arcTo(t,e,i,s,n){this._tick++;var 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*s+o.tx,o.b*i+o.d*s+o.ty,n),this}arcToSvg(t,e,i,s,n,o,a){this._tick++;var l=this._transform;return this._activePath.arcToSvg(t,e,i,s,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,n,o,a){this._tick++;var l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.ty,a),this}closePath(){var t;return this._tick++,null!=(t=this._activePath)&&t.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,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++;var 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++;var i=this._transform,s=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,t=i.b*t+i.d*e+i.ty;return 1===s.length&&"moveTo"===s[0].action?(s[0].data[0]=n,s[0].data[1]=t):this._activePath.moveTo(n,t),this}quadraticCurveTo(t,e,i,s,n){this._tick++;var 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*s+o.tx,o.b*i+o.d*s+o.ty,n),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,n){return this._tick++,this._activePath.roundRect(t,e,i,s,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,s,n,o),this}roundPoly(t,e,i,s,n,o){return this._tick++,this._activePath.roundPoly(t,e,i,s,n,o),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,n){return this._tick++,this._activePath.filletRect(t,e,i,s,n),this}chamferRect(t,e,i,s,n,o){return this._tick++,this._activePath.chamferRect(t,e,i,s,n,o),this}star(t,e,i,s,n=0,o=0){return this._tick++,this._activePath.star(t,e,i,s,n,o,this._transform.clone()),this}svg(t){return this._tick++,Up(t,this),this}restore(){var 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:qe({},this._fillStyle),strokeStyle:qe({},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,s,n,o){return t instanceof M?this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty):this._transform.set(t,e,i,s,n,o),this}transform(t,e,i,s,n,o){return t instanceof M?this._transform.append(t):(Yp.set(t,e,i,s,n,o),this._transform.append(Yp)),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.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;var t=this._bounds;t.clear();for(let e=0;et in r?JT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,At=(r,t)=>{for(var e in t=t||{})rS.call(t,e)&&Qp(r,e,t[e]);if(Zp)for(var e of Zp(t))iS.call(t,e)&&Qp(r,e,t[e]);return r};($i=class ar extends ft{constructor(t={}){super(),function(r){var a,o=r;if("boolean"==typeof o.dropShadow&&o.dropShadow&&(a=Pt.defaultDropShadow,r.dropShadow={alpha:null!=(t=o.dropShadowAlpha)?t:a.alpha,angle:null!=(t=o.dropShadowAngle)?t:a.angle,blur:null!=(t=o.dropShadowBlur)?t:a.blur,color:null!=(t=o.dropShadowColor)?t:a.color,distance:null!=(t=o.dropShadowDistance)?t:a.distance}),void 0!==o.strokeThickness){var t=o.stroke;let l={};if(X.isColorLike(t))l.color=t;else if(t instanceof Qt||t instanceof wr)l.fill=t;else{if(!Object.hasOwnProperty.call(t,"color")&&!Object.hasOwnProperty.call(t,"fill"))throw new Error("Invalid stroke value.");l=t}r.stroke=((r,t)=>tS(r,eS(t)))(At({},l),{width:o.strokeThickness})}if(Array.isArray(o.fillGradientStops)){let a;null==r.fontSize?r.fontSize=Pt.defaultTextStyle.fontSize:a="string"==typeof r.fontSize?parseInt(r.fontSize,10):r.fontSize;const l=new Qt({start:{x:0,y:0},end:{x:0,y:1.7*(a||0)}}),u=o.fillGradientStops.map(c=>X.shared.setValue(c).toNumber());u.forEach((c,d)=>{d/=u.length-1,l.addColorStop(d,c)}),r.fill={fill:l}}}(t);var e=At(At({},ar.defaultTextStyle),t);for(const i in e)this[i]=e[i];this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow=null!==t&&"object"==typeof t?this._createProxy(At(At({},ar.defaultDropShadow),t)):t?this._createProxy(At({},ar.defaultDropShadow)):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize="string"==typeof t?parseInt(t,10):t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t.toLowerCase(),this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set 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(At(At({},dt.defaultFillStyle),t),()=>{this._fill=ne(At({},this._originalFill),dt.defaultFillStyle)})),this._fill=ne(0===t?"black":t,dt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(At(At({},dt.defaultStrokeStyle),t),()=>{this._stroke=Or(At({},this._originalStroke),dt.defaultStrokeStyle)})),this._stroke=Or(t,dt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Zo(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){var t=ar.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ar({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?At({},this._dropShadow):null,fill:this._fill,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,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var e;this.removeAllListeners(),("boolean"==typeof t?t:null!=t&&t.texture)&&(t="boolean"==typeof t?t:null==t?void 0:t.textureSource,null!=(e=this._fill)&&e.texture&&this._fill.texture.destroy(t),null!=(e=this._originalFill)&&e.texture&&this._originalFill.texture.destroy(t),null!=(e=this._stroke)&&e.texture&&this._stroke.texture.destroy(t),null!=(e=this._originalStroke))&&e.texture&&this._originalStroke.texture.destroy(t),this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,n)=>(i[s]=n,null!=e&&e(s,n),this.update(),!0)})}_isFillStyle(t){return null!==(null!=t?t:null)&&!(X.isColorLike(t)||t instanceof Qt||t instanceof wr)}}).defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},$i.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 Pt=$i;const oS=new nt;function Jo(r,t,e,i){var s=oS;return s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0,(s=it.getOptimalTexture(s.width,s.height,i,!1)).source.uploadMethodId="image",s.source.resource=r,s.source.alphaMode="premultiply-alpha-on-upload",s.frame.width=t/i,s.frame.height=e/i,s.source.emit("update",s.source),s.updateUvs(),s}const aS=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Gr(r){var t="number"==typeof r.fontSize?r.fontSize+"px":r.fontSize,e=r.fontFamily;for(let i=(e=Array.isArray(r.fontFamily)?e:r.fontFamily.split(",")).length-1;0<=i;i--){let s=e[i].trim();/([\"\'])[^\'\"]+\1/.test(s)||aS.includes(s)||(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} `+e.join(",")}const ta={willReadFrequently:!0},Ut=class C{static get experimentalLetterSpacingSupported(){let t=C._experimentalLetterSpacingSupported;var e;return void 0!==t&&(e=H.get().getCanvasRenderingContext2D().prototype,t=C._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e),t}constructor(t,e,i,s,n,o,a,l,u){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=u}static measureText(t=" ",e,i=C._canvas,s=e.wordWrap){var o=t+":"+e.styleKey;if(C._measurementCache[o])return C._measurementCache[o];var o=Gr(e),l=C.measureFont(o),u=(0===l.fontSize&&(l.fontSize=e.fontSize,l.ascent=e.fontSize),C.__context),c=(u.font=o,(s?C._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/)),d=new Array(c.length);let p=0;for(let b=0;bm&&(a+=C._addLine(o),f=!1,o="",n=0),o+=A,n+=U}}else{0m&&(f=!1,a+=C._addLine(o),o="",n=0),(0{if("function"!=typeof(null==Intl?void 0:Intl.Segmenter))return r=>[...r];{const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}})(),Ut.experimentalLetterSpacing=!1,Ut._fonts={},Ut._newlines=[10,13],Ut._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Ut._measurementCache={};let jt=Ut;function Br(r,t,e,i=0){var o,a,s,m,_;if(r.texture===P.WHITE&&!r.fill)return X.shared.setValue(r.color).setAlpha(null!=(s=r.alpha)?s:1).toHexa();if(!r.fill){const n=t.createPattern(r.texture.source.resource,"repeat"),o=r.matrix.copyTo(M.shared);return o.scale(r.texture.frame.width,r.texture.frame.height),n.setTransform(o),n}if(r.fill instanceof wr)return s=r.fill,o=t.createPattern(s.texture.source.resource,"repeat"),(a=s.transform.copyTo(M.shared)).scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(a),o;if(r.fill instanceof Qt){const n=r.fill,o="linear"===n.type,a="local"===n.textureSpace;let l=1,u=1;a&&e&&(l=e.width+i,u=e.height+i);let c,d=!1;if(o?({start:s,end:r}=n,c=t.createLinearGradient(s.x*l,s.y*u,r.x*l,r.y*u),d=Math.abs(r.x-s.x){var g=m+_.offset*p;c.addColorStop(Math.floor(1e5*g)/1e5,X.shared.setValue(_.color).toHex())})}}else n.colorStops.forEach(p=>{c.addColorStop(p.offset,X.shared.setValue(p.color).toHex())});return c}return"red"}class ea{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){var t=jt.measureText(t||" ",i),n=Math.ceil(Math.ceil(Math.max(1,t.width)+2*i.padding)*e),t=Math.ceil(Math.ceil(Math.max(1,t.height)+2*i.padding)*e),n=Math.ceil(n-1e-6),t=Math.ceil(t-1e-6);return{width:de(n),height:de(t)}}getTexture(t,e,i,s){(t="string"==typeof t?{text:t,style:i,resolution:e}:t).style instanceof Pt||(t.style=new Pt(t.style));var{texture:i,canvasAndContext:e}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(i._source),Xt.returnCanvasAndContext(e),i}createTextureAndCanvas(t){var{text:i,style:s}=t,t=null!=(t=t.resolution)?t:this._renderer.resolution,o=jt.measureText(i||" ",s),a=Math.ceil(Math.ceil(Math.max(1,o.width)+2*s.padding)*t),o=Math.ceil(Math.ceil(Math.max(1,o.height)+2*s.padding)*t),u=Xt.getOptimalCanvasAndContext(a,o),c=u.canvas,i=(this.renderTextToCanvas(i,s,t,u),Jo(c,a,o,t));return s.trim&&(a=gp(c,t),i.frame.copyFrom(a),i.updateUvs()),{texture:i,canvasAndContext:u}}getManagedTexture(t){t._resolution=(t._autoResolution?this._renderer:t).resolution;var s,e=t._getKey();return this._activeTextures[e]?(this._increaseReferenceCount(e),this._activeTextures[e].texture):({texture:t,canvasAndContext:s}=this.createTextureAndCanvas(t),this._activeTextures[e]={canvasAndContext:s,texture:t,usageCount:1},t)}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){var e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",it.returnTexture(t)}decreaseReferenceCount(t){var e=this._activeTextures[t];e.usageCount--,0===e.usageCount&&(Xt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){var u,{canvas:c,context:d}=s,p=Gr(e),f=jt.measureText(t||" ",e),m=f.lines,_=f.lineHeight,g=f.lineWidths,b=f.maxLineWidth,x=f.fontProperties,y=c.height;d.resetTransform(),d.scale(i,i),d.textBaseline=e.textBaseline,null!=(t=e._stroke)&&t.width&&(c=e._stroke,d.lineWidth=c.width,d.miterLimit=c.miterLimit,d.lineJoin=c.join,d.lineCap=c.cap),d.font=p;let T,A;var S=e.dropShadow?2:1;for(let E=0;Et in r?lS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class Ze extends Lt{constructor(t){var{context:i,roundPixels:s}=t=(t instanceof dt?{context:t}:t)||{};super(((r,t)=>{for(var e in t=t||{})tf.call(t,e)&&rf(r,e,t[e]);if(es)for(var e of es(t))ef.call(t,e)&&rf(r,e,t[e]);return r})({label:"Graphics"},((r,t)=>{var e={};for(i in r)tf.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&es)for(var i of es(r))t.indexOf(i)<0&&ef.call(r,i)&&(e[i]=r[i]);return e})(t,["context","roundPixels"]))),this.renderPipeId="graphics",this._context=i||(this._ownedContext=new dt),this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=null!=s&&s}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,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):!0!==t&&!0!==(null==t?void 0:t.context)||this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(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 Ze(this._context.clone()):(this._ownedContext=null,new Ze(this._context))}lineStyle(t,e,i){var s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){var i={};return void 0!==t&&(i.color=t),void 0!==e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){this.context.fill();var t=this.context.strokeStyle;return t.width===dt.defaultStrokeStyle.width&&t.color===dt.defaultStrokeStyle.color&&t.alpha===dt.defaultStrokeStyle.alpha||this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const sf={name:"local-uniform-msdf-bit",vertex:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32, + uRound:f32, + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32 + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance)); + `}},nf={name:"local-uniform-msdf-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); + } + `},fragment:{header:` + uniform float uDistance; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance)); + `}},of={name:"msdf-bit",fragment:{header:` + fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 { + + // MSDF + var median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + var screenPxDistance = distance * (median - 0.5); + var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + var gamma: f32 = mix(1.0, 1.0 / 2.2, luma); + var coverage: f32 = pow(shapeColor.a * alpha, gamma); + + return coverage; + + } + `}},af={name:"msdf-bit",fragment:{header:` + float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) { + + // MSDF + float median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + float screenPxDistance = distance * (median - 0.5); + float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + float gamma = mix(1.0, 1.0 / 2.2, luma); + float coverage = pow(shapeColor.a * alpha, gamma); + + return coverage; + } + `}};let ra,ia;class lf extends St{constructor(){var t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new M,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=be();null==ra&&(ra=He({name:"sdf-shader",bits:[Mi,Oi(e),sf,of,je]})),super({glProgram:ia=null==ia?Xe({name:"sdf-shader",bits:[Ci,Gi(e),nf,af,ze]}):ia,gpuProgram:ra,resources:{localUniforms:t,batchSamplers:Bi(e)}})}}class sa extends ft{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 this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)null!=(e=this.chars[i].texture)&&e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}function na(r){if(""===r)return[];var t=[];for(let e=0,i=(r="string"==typeof r?[r]:r).length;et in r?hS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hf=(r,t)=>{for(var e in t=t||{})dS.call(t,e)&&cf(r,e,t[e]);if(uf)for(var e of uf(t))pS.call(t,e)&&cf(r,e,t[e]);return r};(Bd=class Hy extends sa{constructor(t){super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;var t=hf(hf({},Hy.defaultOptions),t),o=(this._textureSize=t.textureSize,this._mipmap=t.mipmap,t.style.clone()),a=(t.overrideFill&&(o._fill.color=16777215,o._fill.alpha=1,o._fill.texture=P.WHITE,o._fill.fill=null),this.applyFillAsTint=t.overrideFill,o.fontSize),l=(o.fontSize=this.baseMeasurementFontSize,Gr(o));t.overrideSize?o._stroke&&(o._stroke.width*=this.baseRenderedFontSize/a):o.fontSize=this.baseRenderedFontSize=a,this._style=o,this._skipKerning=null!=(a=t.skipKerning)&&a,this.resolution=null!=(a=t.resolution)?a:1,this._padding=null!=(a=t.padding)?a:4,this.fontMetrics=jt.measureFont(l),this.lineHeight=o.lineHeight||this.fontMetrics.fontSize||o.fontSize}ensureCharacters(t){var o=na(t).filter(T=>!this._currentChars.includes(T)).filter((T,A,S)=>S.indexOf(T)===A);if(o.length){this._currentChars=[...this._currentChars,...o];let a,{canvas:l,context:u}=(a=-1===this._currentPageIndex?this._nextPage():this.pages[this._currentPageIndex]).canvasAndContext,c=a.texture.source;var d=this._style;let p=this._currentX,f=this._currentY;var m=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=this._padding*m;let g=0,b=!1;var x=l.width/this.resolution,y=l.height/this.resolution;for(let T=0;Tx&&(f+=g,g=w,p=0,f+g>y)&&(c.update(),G=this._nextPage(),l=G.canvasAndContext.canvas,u=G.canvasAndContext.context,c=G.texture.source,f=0),E/m-(null!=(E=null==(G=d.dropShadow)?void 0:G.distance)?E:0)-(null!=(E=null==(E=d._stroke)?void 0:E.width)?E:0));if(this.chars[A]={id:A.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:E,kerning:{}},b){this._drawGlyph(u,S,p+_,f+_,m,d);const G=c.width*m,et=c.height*m,ee=new z(p/G*c.width,f/et*c.height,R/G*c.width,w/et*c.height);this.chars[A].texture=new P({source:c,frame:ee}),p+=Math.ceil(R)}}c.update(),this._currentX=p,this._currentY=f,this._skipKerning&&this._applyKerning(o,u)}}get pageTextures(){return this.pages}_applyKerning(t,e){var i=this._measureCache;for(let s=0;s{let m=n.chars.length-1;if(i){let _=n.chars[m];for(;" "===_;)n.width-=e.chars[_].xAdvance,_=n.chars[--m]}s.width=Math.max(s.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(n),s.height+=e.lineHeight},d=e.baseMeasurementFontSize/t.fontSize,p=t.letterSpacing*d,f=t.wordWrapWidth*d;for(let m=0;mf?c():l.start=n.width,(m=>{var _=n.width;for(let g=0;gt in r?_S(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,la=(r,t)=>{for(var e in t=t||{})bS.call(t,e)&&ff(r,e,t[e]);if(pf)for(var e of pf(t))vS.call(t,e)&&ff(r,e,t[e]);return r};let rs=0;const Ir=new class{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}}getFont(t,e){var i;let s=e.fontFamily+"-bitmap",n=!0;if(e._fill.fill&&!e._stroke)s+=e._fill.fill.styleKey,n=!1;else if(e._stroke||e.dropShadow){let a=e.styleKey;a=a.substring(0,a.lastIndexOf("-")),s=a+"-bitmap",n=!1}return W.has(s)||(e=new oa(la({style:e,overrideFill:n,overrideSize:!0},this.defaultOptions)),50<++rs&&Ot("BitmapText",`You have dynamically created ${rs} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),e.once("destroy",()=>{rs--,W.remove(s)}),W.set(s,e)),null!=(i=(e=W.get(s)).ensureCharacters)&&i.call(e,t),e}getLayout(t,e,i=!0){var s=this.getFont(t,e);return aa([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var e,o=t[0];const a=null==(o="string"==typeof o?{name:o,style:t[1],chars:null==(e=t[2])?void 0:e.chars,resolution:null==(e=t[2])?void 0:e.resolution,padding:null==(e=t[2])?void 0:e.padding,skipKerning:null==(e=t[2])?void 0:e.skipKerning}:o)?void 0:o.name;if(a)return t=null!==(e=(t=(o=la(la({},this.defaultOptions),o)).style)instanceof Pt?t:new Pt(t))._fill.fill&&void 0!==e._fill.fill,e=new oa({style:e,overrideFill:t,skipKerning:o.skipKerning,padding:o.padding,resolution:o.resolution,overrideSize:!1}),t=na(o.chars),e.ensureCharacters(t.join("")),W.set(a+"-bitmap",e),e.once("destroy",()=>W.remove(a+"-bitmap")),e;throw new Error("[BitmapFontManager] Property `name` is required.")}uninstall(t){t+="-bitmap",(t=W.get(t))&&t.destroy()}};class ua{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){var e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){var i=this._getGpuBitmapText(t);mf(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){var e=this._gpuBitmapText[t].context;e.customShader&&(N.return(e.customShader),e.customShader=null),N.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){var e=this._getGpuBitmapText(t);mf(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){var i=e.context,s=Ir.getFont(t.text,t._style),n=(i.clear(),"none"===s.distanceField.type||i.customShader||(i.customShader=N.get(lf)),Array.from(t.text)),e=t._style;let a=s.baseLineOffset;var l=aa(n,e,s,!0);let u=0;var c=e.padding,d=l.scale;let p=l.width,f=l.height+l.offsetY;e._stroke&&(p+=e._stroke.width/d,f+=e._stroke.width/d),i.translate(-t._anchor._x*p-c,-t._anchor._y*f-c).scale(d,d);var m=s.applyFillAsTint?e._fill.color:16777215;for(let _=0;_{console.error(n)}),t._didTextUpdate=!1,Wi(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;var s,a,i=this._getGpuText(t);i.generatingTexture||(s=t._getKey(),this._renderer.htmlText.decreaseReferenceCount(i.currentKey),i.generatingTexture=!0,i.currentKey=s,s=null!=(s=t.resolution)?s:this._renderer.resolution,s=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),(a=i.batchableSprite).texture=i.texture=s,i.generatingTexture=!1,i.textureNeedsUploading=!0,t.onViewUpdate(),Wi(a,t))}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){var e={texture:P.EMPTY,currentKey:"--",batchableSprite:N.get(Pr),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=P.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=(t._autoResolution?this._renderer:t).resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}function gf(){var r=H.get().getNavigator().userAgent;return/^((?!chrome|android).)*safari/i.test(r)}ca.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"htmlText"};const ha="http://www.w3.org/2000/svg",da="http://www.w3.org/1999/xhtml";class pa{constructor(){this.svgRoot=document.createElementNS(ha,"svg"),this.foreignObject=document.createElementNS(ha,"foreignObject"),this.domElement=document.createElementNS(da,"div"),this.styleElement=document.createElementNS(da,"style"),this.image=new Image;var{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}function _f(r){var t=r._stroke,e=r._fill,e=[`div { ${["color: "+X.shared.setValue(e.color).toHex(),`font-size: ${r.fontSize}px`,"font-family: "+r.fontFamily,"font-weight: "+r.fontWeight,"font-style: "+r.fontStyle,"font-variant: "+r.fontVariant,`letter-spacing: ${r.letterSpacing}px`,"text-align: "+r.align,`padding: ${r.padding}px`,"white-space: "+("pre"===r.whiteSpace&&r.wordWrap?"pre-wrap":r.whiteSpace),...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?["word-wrap: "+(r.breakWords?"break-all":"break-word"),`max-width: ${r.wordWrapWidth}px`]:[],...t?[vf(t)]:[],...r.dropShadow?[bf(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return function(r,t){for(const e in r){var i=r[e],s=[];for(const n in i)xf[n]?s.push(xf[n](i[n])):yf[n]&&s.push(yf[n].replace("{{VALUE}}",i[n]));t.push(`${e} { ${s.join(";")} }`)}}(r.tagStyles,e),e.join(" ")}function bf(r){var t=X.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),s=Math.round(Math.cos(r.angle)*r.distance)+`px ${Math.round(Math.sin(r.angle)*r.distance)}px`;return 0"color: "+X.shared.setValue(r).toHex(),breakWords:r=>"word-wrap: "+(r?"break-all":"break-word"),stroke:vf,dropShadow:bf};var TS=Object.defineProperty,Tf=Object.getOwnPropertySymbols,SS=Object.prototype.hasOwnProperty,ES=Object.prototype.propertyIsEnumerable,Sf=(r,t,e)=>t in r?TS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class Ae extends Pt{constructor(t={}){super(t),this._cssOverrides=[],null==this.cssOverrides&&(this.cssOverrides=t.cssOverrides),this.tagStyles=null!=(t=t.tagStyles)?t:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Zo(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new Ae({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?((r,t)=>{for(var e in t=t||{})SS.call(t,e)&&Sf(r,e,t[e]);if(Tf)for(var e of Tf(t))ES.call(t,e)&&Sf(r,e,t[e]);return r})({},this.dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=_f(this)),this._cssStyle}addOverride(...t){0<(t=t.filter(i=>!this.cssOverrides.includes(i))).length&&(this.cssOverrides.push(...t),this.update())}removeOverride(...t){const e=t.filter(i=>this.cssOverrides.includes(i));0!e.includes(i)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function Ef(r,t){const e=t.fontFamily,i=[],s={},o=r.match(/font-family:([^;"\s]+)/g);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l{a(l.split(":")[1].trim())});for(const l in t.tagStyles)a(t.tagStyles[l].fontFamily);return i}async function Af(r){const t=await(await H.get().fetch(r)).blob(),e=new FileReader;return new Promise((i,s)=>{e.onloadend=()=>i(e.result),e.onerror=s,e.readAsDataURL(t)})}async function fa(r,t){return t=await Af(t),`@font-face { + font-family: "${r.fontFamily}"; + src: url('${t}'); + font-weight: ${r.fontWeight}; + font-style: ${r.fontStyle}; + }`}const Fr=new Map;async function Pf(r,t,e){return r=r.filter(s=>W.has(s+"-and-url")).map((s,n)=>{var o;return Fr.has(s)||(o=W.get(s+"-and-url").url,0===n?Fr.set(s,fa({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},o)):Fr.set(s,fa({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},o))),Fr.get(s)}),(await Promise.all(r)).join(` +`)}function wf(r,t,e,i,s){var{domElement:n,styleElement:o,svgRoot:a}=s,{width:t,height:r}=(n.innerHTML=`
${r}
`,n.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),o.textContent=i,s.image);return a.setAttribute("width",t.toString()),a.setAttribute("height",r.toString()),(new XMLSerializer).serializeToString(a)}function Rf(r,t){var i=(t=Xt.getOptimalCanvasAndContext(r.width,r.height,t)).context;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),t}function Mf(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src="data:image/svg+xml;charset=utf8,"+encodeURIComponent(t),r.crossOrigin="anonymous"})}let Cf;function ma(r,t,e,i){var{domElement:i,styleElement:n,svgRoot:o}=i=i||(Cf=Cf||new pa),r=(i.innerHTML=`
${r}
`,i.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(n.textContent=e),document.body.appendChild(o),i.getBoundingClientRect()),n=(o.remove(),2*t.padding);return{width:r.width-n,height:r.height-n}}class is{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===_t.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){return this._activeTextures[s]?(this._increaseReferenceCount(s),this._activeTextures[s].promise):(t=this._buildTexturePromise(t,e,i).then(o=>this._activeTextures[s].texture=o),this._activeTextures[s]={texture:null,promise:t,usageCount:1},t)}async _buildTexturePromise(t,e,i){var s=N.get(pa),n=Ef(t,i),o=await Pf(n,i,Ae.defaultTextStyle),a=ma(t,i,o,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+2*i.padding)*e),a=Math.ceil(Math.ceil(Math.max(1,a.height)+2*i.padding)*e),c=s.image,l=(c.width=2+(0|l),c.height=2+(0|a),wf(t,i,e,o,s)),a=(await Mf(c,l,gf()&&0{e.texture=i,this._cleanUp(e)}).catch(()=>{}),this._activeTextures[t]=null)}_cleanUp(t){it.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}}is.extension={type:[r.WebGLSystem,r.WebGPUSystem,r.CanvasSystem],name:"htmlText"},is.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"},B.add(is),B.add(ca);var PS=Object.defineProperty,Of=Object.getOwnPropertySymbols,wS=Object.prototype.hasOwnProperty,RS=Object.prototype.propertyIsEnumerable,Gf=(r,t,e)=>t in r?PS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bf=(r,t)=>{for(var e in t=t||{})wS.call(t,e)&&Gf(r,e,t[e]);if(Of)for(var e of Of(t))RS.call(t,e)&&Gf(r,e,t[e]);return r};($i=class Xy extends ye{constructor(...t){let i=null!=(e=t[0])?e:{};i instanceof Float32Array&&(i={positions:i,uvs:t[1],indices:t[2]});var e=(i=Bf(Bf({},Xy.defaultOptions),i)).positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||(i.positions?new Float32Array(e.length):new Float32Array([0,0,1,0,1,1,0,1])),t=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit;super({attributes:{aPosition:{buffer:new ht({data:e,label:"attribute-mesh-positions",shrinkToFit:a,usage:L.VERTEX|L.COPY_DST}),format:"float32x2",stride:8,offset:0},aUV:{buffer:new ht({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:L.VERTEX|L.COPY_DST}),format:"float32x2",stride:8,offset:0}},indexBuffer:new ht({data:t,label:"index-mesh-buffer",shrinkToFit:a,usage:L.INDEX|L.COPY_DST}),topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}}).defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let oe=$i;var MS=Object.defineProperty,CS=Object.defineProperties,OS=Object.getOwnPropertyDescriptors,Ff=Object.getOwnPropertySymbols,GS=Object.prototype.hasOwnProperty,BS=Object.prototype.propertyIsEnumerable,Df=(r,t,e)=>t in r?MS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const Qe={name:"local-uniform-bit",vertex:{header:` + + struct LocalUniforms { + uTransformMatrix:mat3x3, + uColor:vec4, + uRound:f32, + } + + @group(1) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `}},$f=($i=(r,t)=>CS(r,OS(t)))((Bd=(r,t)=>{for(var e in t=t||{})GS.call(t,e)&&Df(r,e,t[e]);if(Ff)for(var e of Ff(t))BS.call(t,e)&&Df(r,e,t[e]);return r})({},Qe),{vertex:$i(Bd({},Qe.vertex),{header:Qe.vertex.header.replace("group(1)","group(2)")})}),ss={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); + } + `}},Lf={name:"tiling-bit",vertex:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy; + + position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy; + `},fragment:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + + var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV); + coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy; + var unclamped = coord; + coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw); + + var bias = 0.; + + if(unclamped.x == coord.x && unclamped.y == coord.y) + { + bias = -32.; + } + + outColor = textureSampleBias(uTexture, uSampler, coord, bias); + `}},Nf={name:"tiling-bit",vertex:{header:` + uniform mat3 uTextureTransform; + uniform vec4 uSizeAnchor; + + `,main:` + uv = (uTextureTransform * vec3(aUV, 1.0)).xy; + + position = (position - uSizeAnchor.zw) * uSizeAnchor.xy; + `},fragment:{header:` + uniform sampler2D uTexture; + uniform mat3 uMapCoord; + uniform vec4 uClampFrame; + uniform vec2 uClampOffset; + `,main:` + + vec2 coord = vUV + ceil(uClampOffset - vUV); + coord = (uMapCoord * vec3(coord, 1.0)).xy; + vec2 unclamped = coord; + coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); + + outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 + + `}};let ga,_a;class Hf extends St{constructor(){null==ga&&(ga=He({name:"tiling-sprite-shader",bits:[Qe,Lf,je]})),null==_a&&(_a=Xe({name:"tiling-sprite-shader",bits:[ss,Nf,ze]}));var t=new st({uMapCoord:{value:new M,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new M,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:_a,gpuProgram:ga,resources:{localUniforms:new st({uTransformMatrix:{value:new M,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:P.EMPTY.source,uSampler:P.EMPTY.source.style}})}updateUniforms(t,e,i,s,n,o){var a=this.resources.tilingUniforms,l=o.width,u=o.height,c=o.textureMatrix,d=a.uniforms.uTextureTransform;d.set(i.a*l/t,i.b*l/e,i.c*u/t,i.d*u/e,i.tx/t,i.ty/e),d.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=d,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=n,o&&(this.resources.uTexture=o.source,this.resources.uSampler=o.source.style)}}class Xf extends oe{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function jf(r,t){var e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}function zf(r,t,e,i){let s=0;var n=r.length/(t||2),o=i.a,a=i.b,l=i.c,u=i.d,c=i.tx,d=i.ty;for(e*=t;st in r?IS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Kf=(r,t)=>{for(var e in t=t||{})FS.call(t,e)&&Yf(r,e,t[e]);if(Wf)for(var e of Wf(t))DS.call(t,e)&&Yf(r,e,t[e]);return r};($i=class jy extends oe{constructor(...t){var e;super({});let i=null!=(e=t[0])?e:{};"number"==typeof i&&(i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){t=Kf(Kf({},jy.defaultOptions),t),this.verticesX=null!=(e=this.verticesX)?e:t.verticesX,this.verticesY=null!=(e=this.verticesY)?e:t.verticesY,this.width=null!=(e=this.width)?e:t.width,this.height=null!=(e=this.height)?e:t.height;var e,o=this.verticesX*this.verticesY,a=[],l=[],u=[],c=this.verticesX-1,d=this.verticesY-1,p=this.width/c,f=this.height/d;for(let _=0;_t in r?US(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Jf=(r,t)=>{for(var e in t=t||{})kS.call(t,e)&&Qf(r,e,t[e]);if(Zf)for(var e of Zf(t))$S.call(t,e)&&Qf(r,e,t[e]);return r};(Bd=class zy extends os{constructor(t={}){super({width:(t=Jf(Jf({},zy.defaultOptions),t)).width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){var e;this.width=null!=(e=t.width)?e:this.width,this.height=null!=(e=t.height)?e:this.height,this._originalWidth=null!=(e=t.originalWidth)?e:this._originalWidth,this._originalHeight=null!=(e=t.originalHeight)?e:this._originalHeight,this._leftWidth=null!=(e=t.leftWidth)?e:this._leftWidth,this._rightWidth=null!=(e=t.rightWidth)?e:this._rightWidth,this._topHeight=null!=(e=t.topHeight)?e:this._topHeight,this._bottomHeight=null!=(e=t.bottomHeight)?e:this._bottomHeight,this._anchorX=null==(e=t.anchor)?void 0:e.x,this._anchorY=null==(e=t.anchor)?void 0:e.y,this.updateUvs(),this.updatePositions()}updatePositions(){var t=this.positions,{width:e,height:i,_leftWidth:s,_rightWidth:n,_topHeight:o,_bottomHeight:a,_anchorX:l,_anchorY:u}=this,c=s+n,p=o+a,c=Math.min(c"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new Ht({}),this.renderer=t}get activeBackTexture(){var t;return null==(t=this._activeFilterData)?void 0:t.backTexture}push(t){var e,s=this.renderer,n=t.filterEffect.filters,o=(this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData()),this._filterStack[this._filterStackIndex]);if(this._filterStackIndex++,0===n.length)o.skip=!0;else{var _,a=o.bounds,l=(t.renderables?em(t.renderables,a):t.filterEffect.filterArea?(a.clear(),a.addRect(t.filterEffect.filterArea),a.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,a),t.container&&(_=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform)&&a.applyMatrix(_),s.renderTarget.renderTarget.colorTexture.source);let u=1/0,c=0,d=!0,p=!1,f=!1,m=!0;for(let _=0;_(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))({});class Aa{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,n,o,a,l){var{name:u,items:c}=this;for(let d=0,p=c.length;dt in r?XS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,as=(r,t)=>{for(var e in t=t||{})jS.call(t,e)&&im(r,e,t[e]);if(rm)for(var e of rm(t))zS.call(t,e)&&im(r,e,t[e]);return r};const VS=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],sm=class Vy extends ft{constructor(t){super(),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,t=[...VS,...null!=(t=this.config.runners)?t:[]],this._addRunners(...t),this._unsafeEvalCheck()}async init(t={}){await Sa(!0===t.skipExtensionImports||!1===t.manageImports),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash){var s=this._systemsHash[i].constructor.defaultOptions;t=as(as({},s),t)}t=as(as({},Vy.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let i=0;i{this.runners[e]=new Aa(e)})}_addSystems(t){let e;for(e in t){var i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){var 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 s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){const i=e.reduce((s,n)=>(s[n.name]=n.value,s),{});t.forEach(s=>{var n=s.value,s=s.name,a=i[s];this.renderPipes[s]=new n(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!Ea())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()}};sm.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Ur=sm,Pa;function kr(r){return Pa=void 0===Pa?(()=>{var t,e={stencil:!0,failIfMajorPerformanceCaveat:null!=r?r:Ur.defaultOptions.failIfMajorPerformanceCaveat};try{if(!H.get().getWebGLRenderingContext())return!1;let i=H.get().createCanvas().getContext("webgl",e);var n,s=!(null==(t=null==i?void 0:i.getContextAttributes())||!t.stencil);return i&&(n=i.getExtension("WEBGL_lose_context"))&&n.loseContext(),i=null,s}catch(i){return!1}})():Pa}let wa;async function $r(r={}){return wa=void 0===wa?await(async()=>{var t=H.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})():wa}var WS=Object.defineProperty,nm=Object.getOwnPropertySymbols,YS=Object.prototype.hasOwnProperty,KS=Object.prototype.propertyIsEnumerable,om=(r,t,e)=>t in r?WS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lr=(r,t)=>{for(var e in t=t||{})YS.call(t,e)&&om(r,e,t[e]);if(nm)for(var e of nm(t))KS.call(t,e)&&om(r,e,t[e]);return r};const am=["webgl","webgpu","canvas"];async function lm(r){var n;let e=[];r.preference?(e.push(r.preference),am.forEach(o=>{o!==r.preference&&e.push(o)})):e=am.slice();let i,s={};for(let o=0;ot in r?ZS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bd=(($i=class Fu{constructor(){this.stage=new lt}async init(t){t=((r,t)=>{for(var e in t=t||{})QS.call(t,e)&&cm(r,e,t[e]);if(um)for(var e of um(t))JS.call(t,e)&&cm(r,e,t[e]);return r})({},t),this.renderer=await lm(t),Fu._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){var i=Fu._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}})._plugins=[],$i);B.handleByList(r.Application,Bd._plugins),B.add(Ra);class Ca extends sa{constructor(t,e){super();const{textures:s,data:n}=t;Object.keys(n.pages).forEach(o=>{o=n.pages[parseInt(o,10)],o=s[o.id],this.pages.push({texture:o})}),Object.keys(n.chars).forEach(o=>{var l=n.chars[o],{frame:u,source:c}=s[l.page],u=new z(l.x+u.x,l.y+u.y,l.width,l.height),c=new P({source:c,frame:u});this.chars[o]={id:o.codePointAt(0),xOffset:l.xOffset,yOffset:l.yOffset,xAdvance:l.xAdvance,kerning:null!=(u=l.kerning)?u:{},texture:c}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=null!=(t=n.distanceField)?t:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t"))&&Oa.test(H.get().parseXML(r))},parse(r){return Oa.parse(H.get().parseXML(r))}},e2=[".xml",".fnt"],pm={extension:{type:r.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof Ca,getCacheableAssets(r,t){const e={};return r.forEach(i=>{e[i]=t,e[i+"-bitmap"]=t}),e[t.fontFamily+"-bitmap"]=t,e}},fm={extension:{type:r.LoadParser,priority:xt.Normal},name:"loadBitmapFont",test(r){return e2.includes(mt.extname(r).toLowerCase())},async testParse(r){return ls.test(r)||Ga.test(r)},async parse(r,t,e){var r=(ls.test(r)?ls:Ga).parse(r),s=t.src,n=r.pages,o=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let c=0;cl[c.src]);return new Ca({data:r,textures:u},s)},async load(r,t){return(await H.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};class mm{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;var t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i{var e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{var t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}$i={extension:{type:r.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof P),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(0===n?"":n+1)]=s})}),e}};const _m={extension:{type:r.DetectionParser,priority:1},test:async()=>Ba("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>"avif"!==t)},bm=["png","jpg","jpeg"],vm={extension:{type:r.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...bm],remove:async r=>r.filter(t=>!bm.includes(t))},r2="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function us(r){return!r2&&""!==document.createElement("video").canPlayType(r)}var ym={extension:{type:r.DetectionParser,priority:0},test:async()=>us("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>"mp4"!==t&&"m4v"!==t)},xm={extension:{type:r.DetectionParser,priority:0},test:async()=>us("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>"ogv"!==t)},Tm={extension:{type:r.DetectionParser,priority:0},test:async()=>us("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>"webm"!==t)},Sm={extension:{type:r.DetectionParser,priority:0},test:async()=>Ba("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>"webp"!==t)},i2=Object.defineProperty,s2=Object.defineProperties,n2=Object.getOwnPropertyDescriptors,Em=Object.getOwnPropertySymbols,o2=Object.prototype.hasOwnProperty,a2=Object.prototype.propertyIsEnumerable,Am=(r,t,e)=>t in r?i2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class Pm{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var s,n;let o=null,a=null;if(!(a=e.loadParser?this._parserHash[e.loadParser]:a)){for(let l=0;l({alias:[u],src:u,data:{}})),a=o.length,l=o.map(async u=>{var c=mt.toAbsolute(u.src);if(!s[u.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,u)),s[u.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(d){throw delete this.promiseCache[c],delete s[u.src],new Error(`[Loader.load] Failed to load ${c}. +`+d)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){t=Ct(t,i=>({alias:[i],src:i})).map(async i=>{var l,o=mt.toAbsolute(i.src),a=this.promiseCache[o];a&&(l=await a.promise,delete this.promiseCache[o],await(null==(a=null==(o=a.parser)?void 0:o.unload)?void 0:a.call(o,l,i,this)))}),await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name&&t[e.name],((r,t)=>s2(r,n2(t)))(((r,t)=>{for(var e in t=t||{})o2.call(t,e)&&Am(r,e,t[e]);if(Em)for(var e of Em(t))a2.call(t,e)&&Am(r,e,t[e]);return r})({},t),{[e.name]:e})),{})}}function Pe(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith("data:"+e))return!0;return!1}return r.startsWith("data:"+t)}function Gt(r,t){return r=r.split("?")[0],r=mt.extname(r).toLowerCase(),Array.isArray(t)?t.includes(r):r===t}var wm={extension:{type:r.LoadParser,priority:xt.Low},name:"loadJson",test(r){return Pe(r,"application/json")||Gt(r,".json")},async load(r){return(await H.get().fetch(r)).json()}},Rm={name:"loadTxt",extension:{type:r.LoadParser,priority:xt.Low,name:"loadTxt"},test(r){return Pe(r,"text/plain")||Gt(r,".txt")},async load(r){return(await H.get().fetch(r)).text()}},f2=Object.defineProperty,m2=Object.defineProperties,g2=Object.getOwnPropertyDescriptors,Mm=Object.getOwnPropertySymbols,_2=Object.prototype.hasOwnProperty,b2=Object.prototype.propertyIsEnumerable,Cm=(r,t,e)=>t in r?f2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const x2=["normal","bold","100","200","300","400","500","600","700","800","900"],T2=[".ttf",".otf",".woff",".woff2"],S2=["font/ttf","font/otf","font/woff","font/woff2"],E2=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Om(r){var t=mt.extname(r);let i=0<(r=mt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1))).length;for(const n of r)if(!n.match(E2)){i=!1;break}let s=r.join(" ");return s=i?s:`"${s.replace(/[\\"]/g,"\\$&")}"`}const A2=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;var Gm={extension:{type:r.LoadParser,priority:xt.Low},name:"loadWebFont",test(r){return Pe(r,S2)||Gt(r,T2)},async load(r,t){var e,l=H.get().getFontFaceSet();if(l){var u=[],c=null!=(e=null==(e=t.data)?void 0:e.family)?e:Om(r),d=null!=(e=null==(e=null==(e=t.data)?void 0:e.weights)?void 0:e.filter(f=>x2.includes(f)))?e:["normal"],p=null!=(e=t.data)?e:{};for(let f=0;fm2(r,g2({weight:m})))(((r,t)=>{for(var e in t=p||{})_2.call(t,e)&&Cm(r,e,t[e]);if(Mm)for(var e of Mm(t))b2.call(t,e)&&Cm(r,e,t[e]);return r})({})))).load(),l.add(m),u.push(m)}return W.set(c+"-and-url",{url:r,fontFaces:u}),1===u.length?u[0]:u}return null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{W.remove(t.family+"-and-url"),H.get().getFontFaceSet().delete(t)})}};function cs(r,t=1){var e=null==(e=re.RETINA_PREFIX)?void 0:e.exec(r);return e?parseFloat(e[1]):t}function le(r,t,e){r.label=e,r._sourceOrigin=e;const i=new P({source:r,label:e}),s=()=>{delete t.promiseCache[e],W.has(e)&&W.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&s()}),i.once("destroy",()=>{r.destroyed||s()}),i}var w2=Object.defineProperty,hs=Object.getOwnPropertySymbols,Bm=Object.prototype.hasOwnProperty,Im=Object.prototype.propertyIsEnumerable,Fm=(r,t,e)=>t in r?w2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dm={extension:{type:r.LoadParser,priority:xt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return Pe(r,"image/svg+xml")||Gt(r,".svg")},async load(r,t,e){var i;return(null!=(i=null==(i=t.data)?void 0:i.parseAsGraphicsContext)?i:this.config.parseAsGraphicsContext)?async function(r){var r=await(await H.get().fetch(r)).text(),e=new dt;return e.svg(r),e}(r):async function(r,t,e,i){var c=await(await H.get().fetch(r)).blob(),c=URL.createObjectURL(c),p=new Image,c=(p.src=c,p.crossOrigin=i,await p.decode(),URL.revokeObjectURL(c),(i=document.createElement("canvas")).getContext("2d")),s=(null==(s=t.data)?void 0:s.resolution)||cs(r),n=null!=(n=null==(n=t.data)?void 0:n.width)?n:p.width,a=null!=(a=null==(a=t.data)?void 0:a.height)?a:p.height,{}=(i.width=n*s,i.height=a*s,c.drawImage(p,0,0,n*s,a*s),p=null!=(c=t.data)?c:{}),n=((r,t)=>{var e={};for(i in r)Bm.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&hs)for(var i of hs(r))t.indexOf(i)<0&&Im.call(r,i)&&(e[i]=r[i]);return e})(p,["parseAsGraphicsContext"]);return le(new ie(((r,t)=>{for(var e in t=n||{})Bm.call(t,e)&&Fm(r,e,t[e]);if(hs)for(var e of hs(t))Im.call(t,e)&&Fm(r,e,t[e]);return r})({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:s})),e,r)}(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};let Je=null,Ia=class{constructor(){Je=Je||URL.createObjectURL(new Blob([`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})(); +`],{type:"application/javascript"})),this.worker=new Worker(Je)}},tr=(Ia.revokeObjectURL=function(){Je&&(URL.revokeObjectURL(Je),Je=null)},null),Um=class{constructor(){tr=tr||URL.createObjectURL(new Blob(['(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n'],{type:"application/javascript"})),this.worker=new Worker(tr)}},km=(Um.revokeObjectURL=function(){tr&&(URL.revokeObjectURL(tr),tr=null)},0),Fa;const Da=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return void 0===this._isImageBitmapSupported&&(this._isImageBitmapSupported=new Promise(t=>{const e=(new Ia).worker;e.addEventListener("message",i=>{e.terminate(),Ia.revokeObjectURL(),t(i.data)})})),this._isImageBitmapSupported}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,null==(t=null==e?void 0:e.data)?void 0:t.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){void 0===Fa&&(Fa=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){void 0!==t.error?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();var i=new Promise((s,n)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:n})});return this._next(),i}_next(){var t,e,i;this._queue.length&&(t=this._getWorker())&&(i=(e=this._queue.pop()).id,this._resolveHash[km]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:km++,id:i}))}};var U2=Object.defineProperty,$m=Object.getOwnPropertySymbols,k2=Object.prototype.hasOwnProperty,$2=Object.prototype.propertyIsEnumerable,Lm=(r,t,e)=>t in r?U2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const N2=[".jpeg",".jpg",".png",".webp",".avif"],H2=["image/jpeg","image/png","image/webp","image/avif"];async function Nm(r,t){var s,i=await H.get().fetch(r);if(i.ok)return s=await i.blob(),"premultiplied-alpha"===(null==(t=null==t?void 0:t.data)?void 0:t.alphaMode)?createImageBitmap(s,{premultiplyAlpha:"none"}):createImageBitmap(s);throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${i.status} `+i.statusText)}var Ua={name:"loadTextures",extension:{type:r.LoadParser,priority:xt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Pe(r,H2)||Gt(r,N2)},async load(r,t,e){var i;let s=null;return s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Da.isImageBitmapSupported()?await Da.loadImageBitmap(r,t):await Nm(r,t):await new Promise((o,a)=>{(s=new Image).crossOrigin=this.config.crossOrigin,s.src=r,s.complete?o(s):(s.onload=()=>{o(s)},s.onerror=a)}),le(new ie(((r,t)=>{for(var e in t=t||{})k2.call(t,e)&&Lm(r,e,t[e]);if($m)for(var e of $m(t))$2.call(t,e)&&Lm(r,e,t[e]);return r})({resource:s,alphaMode:"premultiply-alpha-on-upload",resolution:(null==(i=t.data)?void 0:i.resolution)||cs(r)},t.data)),e,r)},unload(r){r.destroy(!0)}},X2=Object.defineProperty,j2=Object.defineProperties,z2=Object.getOwnPropertyDescriptors,Hm=Object.getOwnPropertySymbols,V2=Object.prototype.hasOwnProperty,W2=Object.prototype.propertyIsEnumerable,Xm=(r,t,e)=>t in r?X2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ka=(r,t)=>{for(var e in t=t||{})V2.call(t,e)&&Xm(r,e,t[e]);if(Hm)for(var e of Hm(t))W2.call(t,e)&&Xm(r,e,t[e]);return r},jm=(r,t)=>j2(r,z2(t));const zm=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Y2=zm.map(r=>"video/"+r.substring(1));function Vm(r,t,e){void 0!==e||t.startsWith("data:")?!1!==e&&(r.crossOrigin="string"==typeof e?e:"anonymous"):r.crossOrigin=Ym(t)}function Wm(r){return new Promise((t,e)=>{function i(){n(),t()}function s(o){n(),e(o)}function n(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load()})}function Ym(r,t=globalThis.location){return r.startsWith("data:")||(t=t||globalThis.location,(r=new URL(r,document.baseURI)).hostname===t.hostname&&r.port===t.port&&r.protocol===t.protocol)?"":"anonymous"}var Km={name:"loadVideo",extension:{type:r.LoadParser,name:"loadVideo"},test(r){var t=Pe(r,Y2),r=Gt(r,zm);return t||r},async load(r,t,e){var i;const n=ka(jm(ka({},vr.defaultOptions),{resolution:(null==(i=t.data)?void 0:i.resolution)||cs(r),alphaMode:(null==(i=t.data)?void 0:i.alphaMode)||await Hn()}),t.data),o=document.createElement("video"),a={preload:!1!==n.autoLoad?"auto":void 0,"webkit-playsinline":!1!==n.playsinline?"":void 0,playsinline:!1!==n.playsinline?"":void 0,muted:!0===n.muted?"":void 0,loop:!0===n.loop?"":void 0,autoplay:!1!==n.autoPlay?"":void 0},l=(Object.keys(a).forEach(c=>{var d=a[c];void 0!==d&&o.setAttribute(c,d)}),!0===n.muted&&(o.muted=!0),Vm(o,r,n.crossorigin),document.createElement("source"));let u;return r.startsWith("data:")?u=r.slice(5,r.indexOf(";")):r.startsWith("blob:")||(i=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase(),u=vr.MIME_TYPES[i]||"video/"+i),l.src=r,u&&(l.type=u),new Promise(c=>{const d=async()=>{var p=new vr(jm(ka({},n),{resource:o}));o.removeEventListener("canplay",d),t.data.preload&&await Wm(o),c(le(p,e,r))};o.addEventListener("canplay",d),o.appendChild(l)})},unload(r){r.destroy(!0)}},$a={extension:{type:r.ResolveParser,name:"resolveTexture"},test:Ua.test,parse:r=>{var t;return{resolution:parseFloat(null!=(t=null==(t=re.RETINA_PREFIX.exec(r))?void 0:t[1])?t:"1"),format:r.split(".").pop(),src:r}}},qm={extension:{type:r.ResolveParser,priority:-2,name:"resolveJson"},test:r=>re.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:$a.parse};class Zm{constructor(){this._detections=[],this._initialized=!1,this.resolver=new re,this.loader=new Pm,this.cache=W,this._backgroundLoader=new mm(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(!this._initialized){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 l=t.manifest;"string"==typeof l&&(l=await this.load(l)),this.resolver.addManifest(l)}var e="number"==typeof(e=null!=(e=null==(e=t.texturePreference)?void 0:e.resolution)?e:1)?[e]:e,s=await this._detectFormats({preferredFormats:null==(s=t.texturePreference)?void 0:s.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:e}}),t.preferences&&this.setPreferences(t.preferences)}}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();var i=br(t),t=Ct(t).map(a=>{var l;return"string"!=typeof a?((l=this.resolver.getAlias(a)).some(u=>!this.resolver.hasKey(u))&&this.add(a),Array.isArray(l)?l[0]:l):(this.resolver.hasKey(a)||this.add({alias:a,src:a}),a)}),n=this.resolver.resolve(t),n=await this._mapLoadToResolve(n,e);return i?n[t[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;"string"==typeof t&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,l=0;const u=()=>{null!=e&&e(++a/l)},c=o.map(d=>{var p=s[d];return l+=Object.keys(p).length,this._mapLoadToResolve(p,u).then(f=>{n[d]=f})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),t=this.resolver.resolve(t="string"==typeof t?[t]:t),this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(t){this._initialized||await this.init(),t=this.resolver.resolveBundle(t="string"==typeof t?[t]:t),Object.values(t).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if("string"==typeof t)return W.get(t);var e={};for(let i=0;i{const a=s[o.src],l=[o.src];o.alias&&l.push(...o.alias),l.forEach(u=>{n[u]=a}),W.set(l,a)}),n}async unload(t){this._initialized||await this.init(),t=Ct(t).map(s=>"string"!=typeof s?s.src:s),t=this.resolver.resolve(t),await this._unloadFromResolved(t)}async unloadBundle(t){this._initialized||await this.init(),t=Ct(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){(t=Object.values(t)).forEach(i=>{W.remove(i.src)}),await this.loader.unload(t)}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,s)=>e.indexOf(i)===s)}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]})})}}var Hr=new Zm;B.handleByList(r.LoadParser,Hr.loader.parsers).handleByList(r.ResolveParser,Hr.resolver.parsers).handleByList(r.CacheParser,Hr.cache.parsers).handleByList(r.DetectionParser,Hr.detections),B.add($i,vm,_m,Sm,ym,xm,Tm,wm,Rm,Gm,Dm,Ua,Km,fm,pm,$a,qm);const Qm={loader:r.LoadParser,resolver:r.ResolveParser,cache:r.CacheParser,detection:r.DetectionParser};B.handle(r.Asset,r=>{const t=r.ref;Object.entries(Qm).filter(([e])=>!!t[e]).forEach(([e,i])=>B.add(Object.assign(t[e],{extension:null!=(e=t[e].extension)?e:i})))},r=>{const t=r.ref;Object.keys(Qm).filter(e=>!!t[e]).forEach(e=>B.remove(t[e]))});var K2={extension:{type:r.DetectionParser,priority:3},test:async()=>!(!await $r()&&!kr()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>"basis"!==t)};class Xr extends Q{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let ds;function La(){var r;return ds||((r=document.createElement("canvas").getContext("webgl"))?ds=[...r.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...r.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...r.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...r.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]]:[])}let ps;async function Na(){var r;return ps||(r=await H.get().getNavigator().gpu.requestAdapter(),ps=[...r.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...r.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]]),ps}let Ha;async function Xa(){return Ha=void 0===Ha?await(async()=>{var r=await $r(),t=kr();if(r&&t){const e=await Na(),i=La();return e.filter(s=>i.includes(s))}return r?Na():t?La():[]})():Ha}const Jm=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let fs;async function jr(){var r;return void 0===fs&&(r=await Xa(),fs=[...Jm,...r]),fs}let er=null,tg=class{constructor(){er=er||URL.createObjectURL(new Blob(['(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)}})();\n'],{type:"application/javascript"})),this.worker=new Worker(er)}};tg.revokeObjectURL=function(){er&&(URL.revokeObjectURL(er),er=null)};const ms={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};let zr;const eg={};function rg(r,t){const e=function(r){return zr||((zr=(new tg).worker).onmessage=t=>{var{success:t,url:i,textureOptions:s}=t.data;t||console.warn("Failed to load Basis texture",i),eg[i](s)},zr.postMessage({type:"init",jsUrl:ms.jsUrl,wasmUrl:ms.wasmUrl,supportedTextures:r})),zr}(t);return new Promise(i=>{eg[r]=i,e.postMessage({type:"load",url:r})})}var J2={extension:{type:r.LoadParser,priority:xt.High,name:"loadBasis"},name:"loadBasis",test(r){return Gt(r,[".basis"])},async load(r,t,e){var s=await rg(r,await jr());return le(new Xr(s),e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};const eE={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};var ja=(r=>(r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",r))({}),za=(r=>(r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",r))({});function at(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var vt=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.R8G8B8=20]="R8G8B8",r[r.A8R8G8B8=21]="A8R8G8B8",r[r.X8R8G8B8=22]="X8R8G8B8",r[r.R5G6B5=23]="R5G6B5",r[r.X1R5G5B5=24]="X1R5G5B5",r[r.A1R5G5B5=25]="A1R5G5B5",r[r.A4R4G4B4=26]="A4R4G4B4",r[r.R3G3B2=27]="R3G3B2",r[r.A8=28]="A8",r[r.A8R3G3B2=29]="A8R3G3B2",r[r.X4R4G4B4=30]="X4R4G4B4",r[r.A2B10G10R10=31]="A2B10G10R10",r[r.A8B8G8R8=32]="A8B8G8R8",r[r.X8B8G8R8=33]="X8B8G8R8",r[r.G16R16=34]="G16R16",r[r.A2R10G10B10=35]="A2R10G10B10",r[r.A16B16G16R16=36]="A16B16G16R16",r[r.A8P8=40]="A8P8",r[r.P8=41]="P8",r[r.L8=50]="L8",r[r.A8L8=51]="A8L8",r[r.A4L4=52]="A4L4",r[r.V8U8=60]="V8U8",r[r.L6V5U5=61]="L6V5U5",r[r.X8L8V8U8=62]="X8L8V8U8",r[r.Q8W8V8U8=63]="Q8W8V8U8",r[r.V16U16=64]="V16U16",r[r.A2W10V10U10=67]="A2W10V10U10",r[r.Q16W16V16U16=110]="Q16W16V16U16",r[r.R16F=111]="R16F",r[r.G16R16F=112]="G16R16F",r[r.A16B16G16R16F=113]="A16B16G16R16F",r[r.R32F=114]="R32F",r[r.G32R32F=115]="G32R32F",r[r.A32B32G32R32F=116]="A32B32G32R32F",r[r.UYVY=at("UYVY")]="UYVY",r[r.R8G8_B8G8=at("RGBG")]="R8G8_B8G8",r[r.YUY2=at("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=at("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=at("DXT1")]="DXT1",r[r.DXT2=at("DXT2")]="DXT2",r[r.DXT3=at("DXT3")]="DXT3",r[r.DXT4=at("DXT4")]="DXT4",r[r.DXT5=at("DXT5")]="DXT5",r[r.ATI1=at("ATI1")]="ATI1",r[r.AT1N=at("AT1N")]="AT1N",r[r.ATI2=at("ATI2")]="ATI2",r[r.AT2N=at("AT2N")]="AT2N",r[r.BC4U=at("BC4U")]="BC4U",r[r.BC4S=at("BC4S")]="BC4S",r[r.BC5U=at("BC5U")]="BC5U",r[r.BC5S=at("BC5S")]="BC5S",r[r.DX10=at("DX10")]="DX10",r))({});const Va={[vt.DXT1]:"bc1-rgba-unorm",[vt.DXT2]:"bc2-rgba-unorm",[vt.DXT3]:"bc2-rgba-unorm",[vt.DXT4]:"bc3-rgba-unorm",[vt.DXT5]:"bc3-rgba-unorm",[vt.ATI1]:"bc4-r-unorm",[vt.BC4U]:"bc4-r-unorm",[vt.BC4S]:"bc4-r-snorm",[vt.ATI2]:"bc5-rg-unorm",[vt.BC5U]:"bc5-rg-unorm",[vt.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},yt={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},F={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:{MAGIC:0,SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19,PF_FLAGS:20,FOURCC:21,RGB_BITCOUNT:22,R_BIT_MASK:23,G_BIT_MASK:24,B_BIT_MASK:25,A_BIT_MASK:26},HEADER_DX10_FIELDS:{DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},DXGI_FORMAT:ja,D3D10_RESOURCE_DIMENSION:za,D3DFMT:vt},ig={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function sg(r,t){var{format:e,fourCC:i,width:s,height:n,dataOffset:o,mipmapCount:a}=function(r){var t=new Uint32Array(r,0,F.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[F.HEADER_FIELDS.MAGIC]!==F.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");var e=t[F.HEADER_FIELDS.HEIGHT],i=t[F.HEADER_FIELDS.WIDTH],s=Math.max(1,t[F.HEADER_FIELDS.MIPMAP_COUNT]),n=t[F.HEADER_FIELDS.PF_FLAGS],o=t[F.HEADER_FIELDS.FOURCC];return{format:function(r,t,e,i){if(t&F.PIXEL_FORMAT_FLAGS.FOURCC){if(e===F.D3DFMT.DX10){if((i=new Uint32Array(i,F.MAGIC_SIZE+F.HEADER_SIZE,F.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT))[F.HEADER_DX10_FIELDS.MISC_FLAG]===F.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(i[F.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===F.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");if((i=i[F.HEADER_DX10_FIELDS.DXGI_FORMAT])in yt)return yt[i];throw new Error("DDSParser cannot parse texture data with DXGI format "+i)}if(e in Va)return Va[e];throw new Error("DDSParser cannot parse texture data with fourCC format "+e)}if(t&F.PIXEL_FORMAT_FLAGS.RGB||t&F.PIXEL_FORMAT_FLAGS.RGBA)return function(r){var t=r[F.HEADER_FIELDS.RGB_BITCOUNT],e=r[F.HEADER_FIELDS.R_BIT_MASK],i=r[F.HEADER_FIELDS.G_BIT_MASK],s=r[F.HEADER_FIELDS.B_BIT_MASK],n=r[F.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(255===e&&65280===i&&16711680===s&&4278190080===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(16711680===e&&65280===i&&255===s&&4278190080===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(1072693248===e&&1047552===i&&1023===s&&3221225472===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(65535===e&&4294901760===i&&0===s&&0===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(4294967295===e&&0===i&&0===s&&0===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(31744===e&&992===i&&31===s&&32768===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(63488===e&&2016===i&&31===s&&0===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(3840===e&&240===i&&15===s&&61440===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(255===e&&0===i&&0===s&&65280===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(65535===e&&0===i&&0===s&&0===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(255===e&&0===i&&0===s&&0===n)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM]}throw new Error(`DDSParser does not support uncompressed texture with configuration: + bitCount = ${t}, rBitMask = ${e}, gBitMask = ${i}, aBitMask = `+n)}(r);throw t&F.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&F.PIXEL_FORMAT_FLAGS.LUMINANCE||t&F.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&F.PIXEL_FORMAT_FLAGS.ALPHA||t&F.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}(t,n,o,r),fourCC:o,width:i,height:e,dataOffset:F.MAGIC_SIZE+F.HEADER_SIZE+(o===F.D3DFMT.DX10?F.HEADER_DX10_SIZE:0),mipmapCount:s}}(r);if(t.includes(e))return a<=1?{format:e,width:s,height:n,resource:[new Uint8Array(r,o)],alphaMode:"no-premultiply-alpha"}:{format:e,width:s,height:n,resource:function(r,t,e,i,s,n){var o=[],a=ig[r];let l=t,u=e,c=i;for(let d=0;d>1,1),u=Math.max(u>>1,1)}return o}(e,s,n,o,a,r),alphaMode:"no-premultiply-alpha"};throw new Error(`Unsupported texture format: ${i} ${e}, supported: `+t)}var uE={extension:{type:r.LoadParser,priority:xt.High,name:"loadDDS"},name:"loadDDS",test(r){return Gt(r,[".dds"])},async load(r,t,e){var i=await jr(),i=sg(await(await fetch(r)).arrayBuffer(),i);return le(new Xr(i),e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},ng=(r=>(r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGBA=6408]="RGBA",r[r.RGBA8UI=36220]="RGBA8UI",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.RGBA8I=36238]="RGBA8I",r[r.RGBA8=32856]="RGBA8",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))({});const tt={FILE_HEADER_SIZE:64,FILE_IDENTIFIER:[171,75,84,88,32,49,49,187,13,10,26,10],FORMATS_TO_COMPONENTS:{6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:{33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},INTERNAL_FORMAT_TO_TEXTURE_FORMATS:{33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},FIELDS:{FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},TYPES_TO_BYTES_PER_COMPONENT:{5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},TYPES_TO_BYTES_PER_PIXEL:{32819:2,32820:2,33635:2},ENDIANNESS:67305985};function og(r,t){if(!function(r){for(let t=0;t>1||1,f=f>>1||1,m=p+4-1&-4,_=f+4-1&-4,d=m*_*e}return b}(r,s,function(r,t,e){if(e=tt.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e],void 0===(e=0!==r?tt.TYPES_TO_BYTES_PER_COMPONENT[r]?tt.TYPES_TO_BYTES_PER_COMPONENT[r]*tt.FORMATS_TO_COMPONENTS[t]:tt.TYPES_TO_BYTES_PER_PIXEL[r]:e))throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return e}(s,n,o),a,c,u,i),{format:d,width:a,height:l,resource:r,alphaMode:"no-premultiply-alpha"};throw new Error(`Unsupported texture format: ${d}, supportedFormats: `+t)}var gE={extension:{type:r.LoadParser,priority:xt.High,name:"loadKTX"},name:"loadKTX",test(r){return Gt(r,".ktx")},async load(r,t,e){var i=await jr(),i=og(await(await fetch(r)).arrayBuffer(),i);return le(new Xr(i),e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};let rr=null;class ag{constructor(){rr=rr||URL.createObjectURL(new Blob(['(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=y(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=async r=>{var t;const n=r.data,o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}})();\n'],{type:"application/javascript"})),this.worker=new Worker(rr)}}ag.revokeObjectURL=function(){rr&&(URL.revokeObjectURL(rr),rr=null)};const gs={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"https://files.pixijs.download/transcoders/ktx/libktx.wasm"};let Vr;const lg={};function ug(r,t){const e=function(r){return Vr||((Vr=(new ag).worker).onmessage=t=>{var{success:t,url:i,textureOptions:s}=t.data;t||console.warn("Failed to load KTX texture",i),lg[i](s)},Vr.postMessage({type:"init",jsUrl:gs.jsUrl,wasmUrl:gs.wasmUrl,supportedTextures:r})),Vr}(t);return new Promise(i=>{lg[r]=i,e.postMessage({type:"load",url:r})})}const yE={extension:{type:r.LoadParser,priority:xt.High,name:"loadKTX2"},name:"loadKTX2",test(r){return Gt(r,".ktx2")},async load(r,t,e){var s=await ug(r,await jr());return le(new Xr(s),e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},Wa={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:cg},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:cg}};function cg(r){var t=r.byteLength/3,e=new Uint32Array(t);for(let i=0;iGt(r,[".ktx",".ktx2",".dds"]),parse:r=>{let i;var n,s=r.split(".");return 2!(!await $r()&&!kr()),add:async r=>{var t=await Xa();return[...bs=function(r){const t=["basis"],e={};return r.forEach(i=>{(i=i.split("-")[0])&&!e[i]&&(e[i]=!0,t.push(i))}),t.sort((i,s)=>(i=_s.indexOf(i),s=_s.indexOf(s),-1===i?1:-1===s?-1:i-s)),t}(t),...r]},remove:async r=>bs?r.filter(t=>!(t in bs)):r};const OE=new nt,Ya=class{cull(t,e,i=!0){this._cullRecursive(t,e,i)}_cullRecursive(t,e,i=!0){var s;if(t.cullable&&t.measurable&&t.includeInBuild?(s=null!=(s=t.cullArea)?s:dr(t,i,OE),t.culled=s.x>=e.x+e.width||s.y>=e.y+e.height||s.x+s.width<=e.x||s.y+s.height<=e.y):t.culled=!1,t.cullableChildren&&!t.culled&&t.renderable&&t.measurable&&t.includeInBuild)for(let n=0;n{pg.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}fg.extension={priority:10,type:r.Application,name:"culler"};var GE={extension:{type:r.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(function(){return NS})}},BE=Object.defineProperty,vs=Object.getOwnPropertySymbols,mg=Object.prototype.hasOwnProperty,gg=Object.prototype.propertyIsEnumerable,_g=(r,t,e)=>t in r?BE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ka=(r,t)=>{for(var e in t=t||{})mg.call(t,e)&&_g(r,e,t[e]);if(vs)for(var e of vs(t))gg.call(t,e)&&_g(r,e,t[e]);return r},bg=class Du extends St{constructor(t){super(t=Ka(Ka({},Du.defaultOptions),t)),this.enabled=!0,this._state=Et.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,"boolean"==typeof t.antialias?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)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){var{gpu:i,gl:s}=t,t=((r,t)=>{var e={};for(i in r)mg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&vs)for(var i of vs(r))t.indexOf(i)<0&&gg.call(r,i)&&(e[i]=r[i]);return e})(t,["gpu","gl"]);let o,a;return i&&(o=gt.from(i)),s&&(a=Tt.from(s)),new Du(Ka({gpuProgram:o,glProgram:a},t))}},vg=(bg.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0},` +in vec2 vTextureCoord; +in vec4 vColor; + +out vec4 finalColor; + +uniform float uBlend; + +uniform sampler2D uTexture; +uniform sampler2D uBackTexture; + +{FUNCTIONS} + +void main() +{ + vec4 back = texture(uBackTexture, vTextureCoord); + vec4 front = texture(uTexture, vTextureCoord); + float blendedAlpha = front.a + back.a * (1.0 - front.a); + + {MAIN} +} +`),yg=`in vec2 aPosition; +out vec2 vTextureCoord; +out vec2 backgroundUv; + +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(); +} +`,xg=` +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct BlendUniforms { + uBlend:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; +@group(0) @binding(3) var uBackTexture: texture_2d; + +@group(1) @binding(0) var blendUniforms : BlendUniforms; + + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +{FUNCTIONS} + +@fragment +fn mainFragment( + @location(0) uv: vec2 +) -> @location(0) vec4 { + + + var back = textureSample(uBackTexture, uSampler, uv); + var front = textureSample(uTexture, uSampler, uv); + var blendedAlpha = front.a + back.a * (1.0 - front.a); + + var out = vec4(0.0,0.0,0.0,0.0); + + {MAIN} + + return out; +}`,FE=Object.defineProperty,Tg=Object.getOwnPropertySymbols,DE=Object.prototype.hasOwnProperty,UE=Object.prototype.propertyIsEnumerable,Sg=(r,t,e)=>t in r?FE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Eg=(r,t)=>{for(var e in t=t||{})DE.call(t,e)&&Sg(r,e,t[e]);if(Tg)for(var e of Tg(t))UE.call(t,e)&&Sg(r,e,t[e]);return r};function Ag(r){var{source:r,functions:e,main:i}=r;return r.replace("{FUNCTIONS}",e).replace("{MAIN}",i)}var ys=`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(); +} +`,Pg=` +in vec2 vTextureCoord; + +out vec4 finalColor; + +uniform float uAlpha; +uniform sampler2D uTexture; + +void main() +{ + finalColor = texture(uTexture, vTextureCoord) * uAlpha; +} +`,qa=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct AlphaUniforms { + uAlpha:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var alphaUniforms : AlphaUniforms; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var sample = textureSample(uTexture, uSampler, uv); + + return sample * alphaUniforms.uAlpha; +}`,NE=Object.defineProperty,HE=Object.defineProperties,XE=Object.getOwnPropertyDescriptors,xs=Object.getOwnPropertySymbols,wg=Object.prototype.hasOwnProperty,Rg=Object.prototype.propertyIsEnumerable,Mg=(r,t,e)=>t in r?NE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Za=(r,t)=>{for(var e in t=t||{})wg.call(t,e)&&Mg(r,e,t[e]);if(xs)for(var e of xs(t))Rg.call(t,e)&&Mg(r,e,t[e]);return r},Cg=class Wy extends bg{constructor(t){t=Za(Za({},Wy.defaultOptions),t);var e=gt.from({vertex:{source:qa,entryPoint:"mainVertex"},fragment:{source:qa,entryPoint:"mainFragment"}}),i=Tt.from({vertex:ys,fragment:Pg,name:"alpha-filter"}),n=t.alpha,t=((r,t)=>{var e={};for(i in r)wg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&xs)for(var i of xs(r))t.indexOf(i)<0&&Rg.call(r,i)&&(e[i]=r[i]);return e})(t,["alpha"]),n=new st({uAlpha:{value:n,type:"f32"}});super((t=Za({},t),HE(t,XE({gpuProgram:e,glProgram:i,resources:{alphaUniforms:n}}))))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};Cg.defaultOptions={alpha:1};const Qa={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},WE=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join(` +`);function Og(r){var t=Qa[r],e=t.length;let i=WE,s="",o;for(let a=0;a=e&&(o=r-a-1),l=l.replace("%value%",t[o].toString()),s=s+l+` +`}return i=(i=i.replace("%blur%",s)).replace("%size%",r.toString())}const YE=` + in vec2 aPosition; + + uniform float uStrength; + + out vec2 vBlurTexCoords[%size%]; + + 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(); + + float pixelStrength = uInputSize.%dimension% * uStrength; + + vec2 textureCoord = filterTextureCoord(); + %blur% + }`;function Gg(r,t){var e=Math.ceil(r/2);let i=YE,s="",n;n=t?"vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":"vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let o=0;o, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct BlurUniforms { + uStrength:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var blurUniforms : BlurUniforms; + + +struct VSOutput { + @builtin(position) position: vec4, + %blur-struct% + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + + let filteredCord = filterTextureCoord(aPosition); + + let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength; + + return VSOutput( + filterVertexPosition(aPosition), + %blur-vertex-out% + ); +} + +@fragment +fn mainFragment( + @builtin(position) position: vec4, + %blur-fragment-in% +) -> @location(0) vec4 { + + var finalColor = vec4(0.0); + + %blur-sampling% + + return finalColor; +}`;function Fg(r,t){var e=Qa[t],i=e.length,s=[],n=[],o=[];for(let d=0;d,`,n[d]=r?`filteredCord + vec2(${d-i+1} * pixelStrength, 0.0),`:`filteredCord + vec2(0.0, ${d-i+1} * pixelStrength),`;var f=e[dt in r?KE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ja=(r,t)=>{for(var e in t=t||{})qE.call(t,e)&&Ug(r,e,t[e]);if(Dg)for(var e of Dg(t))ZE.call(t,e)&&Ug(r,e,t[e]);return r},kg=class Yy extends bg{constructor(t){var e=Bg((t=Ja(Ja({},Yy.defaultOptions),t)).horizontal,t.kernelSize),i=Fg(t.horizontal,t.kernelSize);super(Ja({glProgram:e,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,i,s){if(this._uniforms.uStrength=this.strength/this.passes,1===this.passes)t.applyFilter(this,e,i,s);else{var n=it.getSameSizeTexture(e);let o=e,a=n;this._state.blend=!1;var l=t.renderer.type===_t.WEBGPU;for(let u=0;ut in r?QE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wr=(r,t)=>{for(var e in t=t||{})$g.call(t,e)&&Ng(r,e,t[e]);if(Ss)for(var e of Ss(t))Lg.call(t,e)&&Ng(r,e,t[e]);return r};class Hg extends bg{constructor(...t){let i=null!=(e=t[0])?e:{};"number"==typeof i&&(i={strength:i},void 0!==t[1]&&(i.quality=t[1]),void 0!==t[2]&&(i.resolution=t[2]||"inherit"),void 0!==t[3])&&(i.kernelSize=t[3]);var{strength:e,strengthX:t,strengthY:a,quality:l}=i=Wr(Wr({},Ts.defaultOptions),i),u=((r,t)=>{var e={};for(i in r)$g.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Ss)for(var i of Ss(r))t.indexOf(i)<0&&Lg.call(r,i)&&(e[i]=r[i]);return e})(i,["strength","strengthX","strengthY","quality"]);super(((r,t)=>JE(r,tA(t)))(Wr({},u),{compatibleRenderers:_t.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new Ts(Wr({horizontal:!0},i)),this.blurYFilter=new Ts(Wr({horizontal:!1},i)),this.quality=l,this.strengthX=null!=t?t:e,this.strengthY=null!=a?a:e,this.repeatEdgePixels=!1}apply(t,e,i,s){var n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);n&&o?(n=it.getSameSizeTexture(e),this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,n,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,n,i,s),it.returnTexture(n)):(o?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter)).apply(t,e,i,s)}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=2*Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}Hg.defaultOptions={strength:8,quality:4,kernelSize:5};var Xg=` +in vec2 vTextureCoord; +in vec4 vColor; + +out vec4 finalColor; + +uniform float uColorMatrix[20]; +uniform float uAlpha; + +uniform sampler2D uTexture; + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() +{ + vec4 color = texture(uTexture, vTextureCoord); + float randomValue = rand(gl_FragCoord.xy * 0.2); + float diff = (randomValue - 0.5) * 0.5; + + if (uAlpha == 0.0) { + finalColor = color; + return; + } + + if (color.a > 0.0) { + color.rgb /= color.a; + } + + vec4 result; + + result.r = (uColorMatrix[0] * color.r); + result.r += (uColorMatrix[1] * color.g); + result.r += (uColorMatrix[2] * color.b); + result.r += (uColorMatrix[3] * color.a); + result.r += uColorMatrix[4]; + + result.g = (uColorMatrix[5] * color.r); + result.g += (uColorMatrix[6] * color.g); + result.g += (uColorMatrix[7] * color.b); + result.g += (uColorMatrix[8] * color.a); + result.g += uColorMatrix[9]; + + result.b = (uColorMatrix[10] * color.r); + result.b += (uColorMatrix[11] * color.g); + result.b += (uColorMatrix[12] * color.b); + result.b += (uColorMatrix[13] * color.a); + result.b += uColorMatrix[14]; + + result.a = (uColorMatrix[15] * color.r); + result.a += (uColorMatrix[16] * color.g); + result.a += (uColorMatrix[17] * color.b); + result.a += (uColorMatrix[18] * color.a); + result.a += uColorMatrix[19]; + + vec3 rgb = mix(color.rgb, result.rgb, uAlpha); + + // Premultiply alpha again. + rgb *= result.a; + + finalColor = vec4(rgb, result.a); +} +`,tl=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct ColorMatrixUniforms { + uColorMatrix:array, 5>, + uAlpha:f32, +}; + + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; +@group(1) @binding(0) var colorMatrixUniforms : ColorMatrixUniforms; + + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + ); +} + + +@fragment +fn mainFragment( + @location(0) uv: vec2, +) -> @location(0) vec4 { + + + var c = textureSample(uTexture, uSampler, uv); + + if (colorMatrixUniforms.uAlpha == 0.0) { + return c; + } + + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (c.a > 0.0) { + c.r /= c.a; + c.g /= c.a; + c.b /= c.a; + } + + var cm = colorMatrixUniforms.uColorMatrix; + + + var result = vec4(0.); + + result.r = (cm[0][0] * c.r); + result.r += (cm[0][1] * c.g); + result.r += (cm[0][2] * c.b); + result.r += (cm[0][3] * c.a); + result.r += cm[1][0]; + + result.g = (cm[1][1] * c.r); + result.g += (cm[1][2] * c.g); + result.g += (cm[1][3] * c.b); + result.g += (cm[2][0] * c.a); + result.g += cm[2][1]; + + result.b = (cm[2][2] * c.r); + result.b += (cm[2][3] * c.g); + result.b += (cm[3][0] * c.b); + result.b += (cm[3][1] * c.a); + result.b += cm[3][2]; + + result.a = (cm[3][3] * c.r); + result.a += (cm[4][0] * c.g); + result.a += (cm[4][1] * c.b); + result.a += (cm[4][2] * c.a); + result.a += cm[4][3]; + + var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha); + + rgb.r *= result.a; + rgb.g *= result.a; + rgb.b *= result.a; + + return vec4(rgb, result.a); +}`,iA=Object.defineProperty,sA=Object.defineProperties,nA=Object.getOwnPropertyDescriptors,jg=Object.getOwnPropertySymbols,oA=Object.prototype.hasOwnProperty,aA=Object.prototype.propertyIsEnumerable,zg=(r,t,e)=>t in r?iA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vg=` +in vec2 vTextureCoord; +in vec2 vFilterUv; + +out vec4 finalColor; + +uniform sampler2D uTexture; +uniform sampler2D uMapTexture; + +uniform vec4 uInputClamp; +uniform highp vec4 uInputSize; +uniform mat2 uRotation; +uniform vec2 uScale; + +void main() +{ + vec4 map = texture(uMapTexture, vFilterUv); + + vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale; + + finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw)); +} +`,Wg=`in vec2 aPosition; +out vec2 vTextureCoord; +out vec2 vFilterUv; + + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; + +uniform mat3 uFilterMatrix; + +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); +} + +vec2 getFilterCoord( void ) +{ + return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy; +} + + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); + vFilterUv = getFilterCoord(); +} +`,el=` +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct DisplacementUniforms { + uFilterMatrix:mat3x3, + uScale:vec2, + uRotation:mat2x2 +}; + + + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var filterUniforms : DisplacementUniforms; +@group(1) @binding(1) var uMapTexture: texture_2d; +@group(1) @binding(2) var uMapSampler : sampler; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) filterUv : vec2, + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getFilterCoord(aPosition:vec2 ) -> vec2 +{ + return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +fn getSize() -> vec2 +{ + + + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + getFilterCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) filterUv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var map = textureSample(uMapTexture, uMapSampler, filterUv); + + var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale; + + return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw)); +}`,hA=Object.defineProperty,dA=Object.defineProperties,pA=Object.getOwnPropertyDescriptors,Es=Object.getOwnPropertySymbols,Yg=Object.prototype.hasOwnProperty,Kg=Object.prototype.propertyIsEnumerable,qg=(r,t,e)=>t in r?hA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zg=` +in vec2 vTextureCoord; +in vec4 vColor; + +out vec4 finalColor; + +uniform float uNoise; +uniform float uSeed; +uniform sampler2D uTexture; + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() +{ + vec4 color = texture(uTexture, vTextureCoord); + float randomValue = rand(gl_FragCoord.xy * uSeed); + float diff = (randomValue - 0.5) * uNoise; + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (color.a > 0.0) { + color.rgb /= color.a; + } + + color.r += diff; + color.g += diff; + color.b += diff; + + // Premultiply alpha again. + color.rgb *= color.a; + + finalColor = color; +} +`,rl=` + +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct NoiseUniforms { + uNoise:f32, + uSeed:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var noiseUniforms : NoiseUniforms; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +fn rand(co:vec2) -> f32 +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + + + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy); + + + var sample = textureSample(uTexture, uSampler, uv); + var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed); + var diff = (randomValue - 0.5) * noiseUniforms.uNoise; + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (sample.a > 0.0) { + sample.r /= sample.a; + sample.g /= sample.a; + sample.b /= sample.a; + } + + sample.r += diff; + sample.g += diff; + sample.b += diff; + + // Premultiply alpha again. + sample.r *= sample.a; + sample.g *= sample.a; + sample.b *= sample.a; + + return sample; +}`,bA=Object.defineProperty,vA=Object.defineProperties,yA=Object.getOwnPropertyDescriptors,As=Object.getOwnPropertySymbols,Qg=Object.prototype.hasOwnProperty,Jg=Object.prototype.propertyIsEnumerable,t_=(r,t,e)=>t in r?bA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,il=(r,t)=>{for(var e in t=t||{})Qg.call(t,e)&&t_(r,e,t[e]);if(As)for(var e of As(t))Jg.call(t,e)&&t_(r,e,t[e]);return r},r_=((kg=class Ky extends bg{constructor(t={}){t=il(il({},Ky.defaultOptions),t);var e=gt.from({vertex:{source:rl,entryPoint:"mainVertex"},fragment:{source:rl,entryPoint:"mainFragment"}}),i=Tt.from({vertex:ys,fragment:Zg,name:"noise-filter"}),{noise:n,seed:o}=t,t=((r,t)=>{var e={};for(i in r)Qg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&As)for(var i of As(r))t.indexOf(i)<0&&Jg.call(r,i)&&(e[i]=r[i]);return e})(t,["noise","seed"]);super(((r,t)=>vA(r,yA(t)))(il({},t),{gpuProgram:e,glProgram:i,resources:{noiseUniforms:new st({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=n,this.seed=null!=o?o:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}}).defaultOptions={noise:.5},`in vec2 vMaskCoord; +in vec2 vTextureCoord; + +uniform sampler2D uTexture; +uniform sampler2D uMaskTexture; + +uniform float uAlpha; +uniform vec4 uMaskClamp; +uniform float uInverse; + +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 alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); + + float a = alphaMul * masky.r * npmAlpha * clip; + + if (uInverse == 1.0) { + a = 1.0 - a; + } + + finalColor = original * a; +} +`),i_=`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); +} +`,sl=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct MaskUniforms { + uFilterMatrix:mat3x3, + uMaskClamp:vec4, + uAlpha:f32, + uInverse:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var filterUniforms : MaskUniforms; +@group(1) @binding(1) var uMaskTexture: texture_2d; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) filterUv : vec2, +}; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + 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 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getFilterCoord(aPosition:vec2 ) -> vec2 +{ + return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + getFilterCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) filterUv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + 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 alphaMul = 1.0 - uAlpha * (1.0 - mask.a); + + var a: f32 = alphaMul * mask.r * uAlpha * clip; + + if (filterUniforms.uInverse == 1.0) { + a = 1.0 - a; + } + + return source * a; +} +`,EA=Object.defineProperty,AA=Object.defineProperties,PA=Object.getOwnPropertyDescriptors,Ps=Object.getOwnPropertySymbols,s_=Object.prototype.hasOwnProperty,n_=Object.prototype.propertyIsEnumerable,o_=(r,t,e)=>t in r?EA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class a_ extends bg{constructor(t){var i=t.sprite,s=((r,t)=>{var e={};for(i in r)s_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Ps)for(var i of Ps(r))t.indexOf(i)<0&&n_.call(r,i)&&(e[i]=r[i]);return e})(t,["sprite"]),n=new Sn(i.texture),t=new st({uFilterMatrix:{value:new M,type:"mat3x3"},uMaskClamp:{value:n.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),a=gt.from({vertex:{source:sl,entryPoint:"mainVertex"},fragment:{source:sl,entryPoint:"mainFragment"}}),l=Tt.from({vertex:i_,fragment:r_,name:"mask-filter"});super(((r,t)=>AA(r,PA(t)))(((r,t)=>{for(var e in t=s||{})s_.call(t,e)&&o_(r,e,t[e]);if(Ps)for(var e of Ps(t))n_.call(t,e)&&o_(r,e,t[e]);return r})({}),{gpuProgram:a,glProgram:l,resources:{filterUniforms:t,uMaskTexture:i.texture.source}})),this.sprite=i,this._textureMatrix=n}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return 1===this.resources.filterUniforms.uniforms.uInverse}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}function nl(r,t,e,i,s,n,o,a){return o-=e,s-=e,r-=e,e=t-i,t=o*o+(a-=i)*a,i=o*s+a*(n-=i),o=o*r+a*e,a=s*s+n*n,e=(t*(s=s*r+n*e)-i*o)*(r=1/(t*a-i*i)),0<=(n=(a*o-i*s)*r)&&0<=e&&n+e<1}var l_=class qy{constructor(t){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{var e=this.queue;let i=0;for(;e.length&&i{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),ut.system.addOnce(this._tick,this,Yt.UTILITY)):e()})}dedupeQueue(){var t=Object.create(null);let e=0;for(let i=0;it in r?OA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class ir extends Lt{constructor(...t){let i=t[0];i instanceof ye&&(i={geometry:i,shader:t[1]},t[3])&&(i.geometry.topology=t[3]);var{geometry:t,shader:o,texture:a,roundPixels:l,state:u}=i;super(((r,t)=>{for(var e in t=t||{})c_.call(t,e)&&d_(r,e,t[e]);if(ws)for(var e of ws(t))h_.call(t,e)&&d_(r,e,t[e]);return r})({label:"Mesh"},((r,t)=>{var e={};for(i in r)c_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&ws)for(var i of ws(r))t.indexOf(i)<0&&h_.call(r,i)&&(e[i]=r[i]);return e})(i,["geometry","shader","texture","roundPixels","state"]))),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=null!=o?o:null,this.texture=null!=(a=null!=a?a:null==o?void 0:o.texture)?a:P.WHITE,this.state=null!=u?u:Et.for2d(),this._geometry=t,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=null!=l&&l}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&(null!=(e=this._geometry)&&e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t=t||P.EMPTY;var e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return!(this._shader||12&this.state.data)&&this._geometry instanceof oe&&("auto"===this._geometry.batchMode?this._geometry.positions.length/2<=100:"batch"===this._geometry.batchMode)}get bounds(){return this._geometry.bounds}updateBounds(){this._bounds=this._geometry.bounds}containsPoint(t){var{x:e,y:i}=t;if(this.bounds.containsPoint(e,i)){var s=this.geometry.getBuffer("aPosition").data,n="triangle-strip"===this.geometry.topology?3:1;if(this.geometry.getIndex()){var o=this.geometry.getIndex().data,a=o.length;for(let l=0;l+2t in r?IA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class Yr extends Ft{constructor(...t){var e=t[0],{animationSpeed:t=1,autoPlay:n=!1,autoUpdate:o=!0,loop:a=!0,onComplete:l=null,onFrameChange:u=null,onLoop:c=null,textures:d,updateAnchor:p=!1}=e=Array.isArray(t[0])?{textures:t[0],autoUpdate:t[1]}:e,[m]=d;super(((r,t)=>FA(r,DA(t)))(((r,t)=>{for(var e in t=t||{})p_.call(t,e)&&m_(r,e,t[e]);if(Rs)for(var e of Rs(t))f_.call(t,e)&&m_(r,e,t[e]);return r})({},((r,t)=>{var e={};for(i in r)p_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Rs)for(var i of Rs(r))t.indexOf(i)<0&&f_.call(r,i)&&(e[i]=r[i]);return e})(e,["animationSpeed","autoPlay","autoUpdate","loop","onComplete","onFrameChange","onLoop","textures","updateAnchor"])),{texture:m instanceof P?m:m.texture})),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=t,this.loop=a,this.updateAnchor=p,this.onComplete=l,this.onFrameChange=u,this.onLoop=c,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=d,n&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate)&&this._isConnectedToTicker&&(ut.shared.remove(this.update,this),this._isConnectedToTicker=!1)}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ut.shared.add(this.update,this,Yt.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(this._playing){var t=t.deltaTime,i=this.animationSpeed*t,s=this.currentFrame;if(null!==this._durations){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];var o=Math.sign(this.animationSpeed*t);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()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(0s)&&this.onLoop(),this._updateTexture())}}_updateTexture(){var 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(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){var e=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);var 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?(ut.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ut.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class g_{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=null!=t?t:new M,this.observer=e,this.position=new rt(this,0,0),this.scale=new rt(this,1,1),this.pivot=new rt(this,0,0),this.skew=new rt(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){var t=this._matrix;return this.dirty&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this.dirty=!1),t}_onUpdate(t){this.dirty=!0,t===this.skew&&this.updateSkew(),null!=(t=this.observer)&&t._onUpdate(this)}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this.dirty=!0}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}var LA=Object.defineProperty,Ms=Object.getOwnPropertySymbols,__=Object.prototype.hasOwnProperty,b_=Object.prototype.propertyIsEnumerable,v_=(r,t,e)=>t in r?LA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Kr=(r,t)=>{for(var e in t=t||{})__.call(t,e)&&v_(r,e,t[e]);if(Ms)for(var e of Ms(t))b_.call(t,e)&&v_(r,e,t[e]);return r},y_=class nn extends Lt{constructor(...t){let e=t[0]||{};e instanceof P&&(e={texture:e}),1{var e={};for(i in r)__.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Ms)for(var i of Ms(r))t.indexOf(i)<0&&b_.call(r,i)&&(e[i]=r[i]);return e})(t,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Kr({label:"TilingSprite"},t)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new rt({_onUpdate:()=>{this.onViewUpdate()}}),this.applyAnchorToTexture=d,this.texture=s,this._width=null!=u?u:s.width,this._height=null!=c?c:s.height,this._tileTransform=new g_({observer:{_onUpdate:()=>this.onViewUpdate()}}),n&&(this.anchor=n),this.tilePosition=o,this.tileScale=a,this.tileRotation=l,this.roundPixels=null!=p&&p}static from(t,e={}){return"string"==typeof t?new nn(Kr({texture:W.get(t)},e)):new nn(Kr({texture:t},e))}get uvRespectAnchor(){return Ot("uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture}set uvRespectAnchor(t){Ot("uvRespectAnchor is deprecated, please use applyAnchorToTexture instead"),this.applyAnchorToTexture=t}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){"number"==typeof t?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}set texture(t){t=t||P.EMPTY;var 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.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var i;"object"==typeof t&&(e=null!=(i=t.height)?i:t.width,t=t.width),this._width=t,this._height=null!=e?e:t,this.onViewUpdate()}getSize(t){return(t=t||{}).width=this._width,t.height=this._height,t}updateBounds(){var t=this._bounds,e=this._anchor,i=this._width,s=this._height;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*s,t.maxY=t.minY+s}containsPoint(t){var e=this._width,i=this._height,s=-e*this._anchor._x;return t.x>=s&&t.x<=s+e&&(s=-i*this._anchor._y,t.y>=s)&&t.y<=s+i}destroy(t=!1){super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,("boolean"==typeof t?t:null!=t&&t.texture)&&(t="boolean"==typeof t?t:null==t?void 0:t.textureSource,this._texture.destroy(t)),this._texture=null}};y_.defaultOptions={texture:P.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let x_=y_;var HA=Object.defineProperty,Cs=Object.getOwnPropertySymbols,T_=Object.prototype.hasOwnProperty,S_=Object.prototype.propertyIsEnumerable,E_=(r,t,e)=>t in r?HA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class Os extends Lt{constructor(t,e){var{text:s,resolution:n,style:o,anchor:a,width:l,height:u,roundPixels:c}=t;super(((r,t)=>{for(var e in t=t||{})T_.call(t,e)&&E_(r,e,t[e]);if(Cs)for(var e of Cs(t))S_.call(t,e)&&E_(r,e,t[e]);return r})({},((r,t)=>{var e={};for(i in r)T_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Cs)for(var i of Cs(r))t.indexOf(i)<0&&S_.call(r,i)&&(e[i]=r[i]);return e})(t,["text","resolution","style","anchor","width","height","roundPixels"]))),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=null!=s?s:"",this.style=o,this.resolution=null!=n?n:null,this.allowChildren=!1,this._anchor=new rt({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=null!=c&&c,void 0!==l&&(this.width=l),void 0!==u&&(this.height=u)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?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=null===t,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t=t||{},null!=(e=this._style)&&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||{}).width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){var i;"object"==typeof t?(e=null!=(i=t.height)?i:t.width,t=t.width):null==e&&(e=t),void 0!==t&&this._setWidth(t,this.bounds.width),void 0!==e&&this._setHeight(e,this.bounds.height)}containsPoint(t){var e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x;return t.x>=s&&t.x<=s+e&&(s=-i*this.anchor.y,t.y>=s)&&t.y<=s+i}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:`+this._resolution}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,("boolean"==typeof t?t:null!=t&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function Gs(r,t){var e=null!=(e=r[0])?e:{};return"string"==typeof e||r[1]?{text:e,style:r[1]}:e}class al extends Os{constructor(...t){super(Gs(t),Pt),this.renderPipeId="text"}updateBounds(){var t=this._bounds,e=this._anchor,{width:s,height:n}=jt.measureText(this._text,this._style);t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class A_ extends l_{resolveQueueItem(t,e){return t instanceof lt?this.resolveContainerQueueItem(t,e):t instanceof Q||t instanceof P?e.push(t.source):t instanceof dt&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof Ft||t instanceof x_||t instanceof ir?e.push(t.texture.source):t instanceof al?e.push(t):t instanceof Ze?e.push(t.context):t instanceof Yr&&t.textures.forEach(i=>{i.source?e.push(i.source):e.push(i.texture.source)})}resolveGraphicsContextQueueItem(t){var s;this.renderer.graphicsContext.getGpuContext(t);for(const i of t=t.instructions){if("texture"===i.action)return(s=i.data.image).source;if("fill"===i.action){const s=i.data.style.texture;return s.source}}return null}}class P_ extends Os{constructor(...t){var i;null==(t=Gs(t)).style&&(t.style=t.style||{}),null==(i=t.style).fill&&(i.fill=16777215),super(t,Pt),this.renderPipeId="bitmapText"}updateBounds(){var t=this._bounds,e=this._anchor,i=Ir.measureText(this.text,this._style),s=i.scale,n=i.offsetY*s;let o=i.width*s,a=i.height*s;(i=this._style._stroke)&&(o+=i.width,a+=i.width),t.minX=-e._x*o,t.maxX=t.minX+o,t.minY=-e._y*(a+n),t.maxY=t.minY+a}set resolution(t){}get resolution(){return this._resolution}}class w_ extends Os{constructor(...t){super(Gs(t),Ae),this.renderPipeId="htmlText"}updateBounds(){var t=this._bounds,e=this._anchor,{width:s,height:n}=ma(this.text,this._style);t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class R_ extends A_{uploadQueueItem(t){t instanceof Q?this.uploadTextureSource(t):t instanceof al?this.uploadText(t):t instanceof w_?this.uploadHTMLText(t):t instanceof P_?this.uploadBitmapText(t):t instanceof dt&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getGpuContext(t);for(const i of t=t.instructions)if("texture"===i.action){var s=i.data.image;this.uploadTextureSource(s.source)}else if("fill"===i.action){const s=i.data.style.texture;this.uploadTextureSource(s.source)}return null}}class M_ extends R_{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}M_.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:"prepare"};class ll{constructor(){this._tempState=Et.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,i){var t=t.renderer,n=this._didUploadHash[i.uid];t.shader.bind(i,n),n||(this._didUploadHash[i.uid]=!0),t.shader.updateUniformGroup(t.globalUniforms.uniformGroup),t.geometry.bind(e,i.glProgram)}execute(t,e){var i=t.renderer,s=(this._tempState.blendMode=e.blendMode,i.state.set(this._tempState),e.textures.textures);for(let n=0;n, + } + + @group(2) @binding(2) var textureUniforms : TextureUniforms; + `,main:` + uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + @group(2) @binding(0) var uTexture: texture_2d; + @group(2) @binding(1) var uSampler: sampler; + + + `,main:` + outColor = textureSample(uTexture, uSampler, vUV); + `}},O_={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); + `}},YA=new nt;let KA=class extends hr{constructor(){super(),this.filters=[new a_({sprite:new Ft(P.EMPTY),inverse:!1,resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}get inverse(){return this.filters[0].inverse}set inverse(t){this.filters[0].inverse=t}};class dl{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){var n,s=this._renderer;s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture&&((n=t.mask).includeInBuild=!0,n.collectRenderables(i,s,null),n.includeInBuild=!1),s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){var e=this._renderer,i=t.mask.renderMaskToTexture;if("pushMaskBegin"===t.action){var n,o,l,s=N.get(KA);s.inverse=t.inverse,i?(t.mask.mask.measurable=!0,n=dr(t.mask.mask,!0,YA),t.mask.mask.measurable=!1,n.ceil(),o=e.renderTarget.renderTarget.colorTexture.source,o=it.getOptimalTexture(n.width,n.height,o._resolution,o.antialias),e.renderTarget.push(o,!0),e.globalUniforms.push({offset:n,worldColor:4294967295}),(l=s.sprite).texture=o,l.worldTransform.tx=n.minX,l.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:o})):(s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer}))}else if("pushMaskEnd"===t.action){const s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===_t.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if("popMaskEnd"===t.action){e.filter.pop();const s=this._activeMaskStage.pop();i&&it.returnTexture(s.filterTexture),N.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}dl.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"alphaMask"};class pl{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,i){this._renderer.renderPipes.batch.break(i);var s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&t.mask,(s=this._colorStack[this._colorStackIndex])!==this._currentColor&&(this._currentColor=s,i.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);var s=this._colorStack;this._colorStackIndex--,(s=s[this._colorStackIndex-1])!==this._currentColor&&(this._currentColor=s,i.add({renderPipeId:"colorMask",colorMask:s,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}pl.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"colorMask"};class fl{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var o=t,a=this._renderer,l=(a.renderPipes.batch.break(i),a.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1}),(l=o.mask).includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0}),(o=this._maskHash.get(o)).instructionsStart=i.instructionSize,l.collectRenderables(i,a,null),l.includeInBuild=!1,a.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1}),i.instructionSize-o.instructionsStart-1),t=(o.instructionsLength=l,a.renderTarget.renderTarget.uid);null==(e=this._maskStackHash)[t]&&(e[t]=0)}pop(t,e,i){var s=t,n=this._renderer,o=(n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1}),this._maskHash.get(t));for(let a=0;a(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))({});class G_{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class ml{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._minBaseLocation=0,this._nextBindBaseIndex=this._minBaseLocation,this._bindCallId=0,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBuffers")}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){var t=this._gl=this._renderer.gl;this._gpuBuffers=Object.create(null),this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){var e=this._gl,t=this.getGlBuffer(t);e.bindBuffer(t.type,t.buffer)}bindBufferBase(t,e){var i=this._gl;this._boundBufferBases[e]!==t&&((this._boundBufferBases[e]=t)._lastBindBaseLocation=e,i.bindBufferBase(i.UNIFORM_BUFFER,e,t.buffer))}nextBindBase(t){this._bindCallId++,this._minBaseLocation=0,t&&(this._boundBufferBases[0]=null,this._minBaseLocation=1,this._nextBindBaseIndex<1)&&(this._nextBindBaseIndex=1)}freeLocationForBufferBase(t){var e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let i=0,s=this._nextBindBaseIndex;for(;i<2;){s>=this._maxBindings&&(s=this._minBaseLocation,i++);var n=this._boundBufferBases[s];if(!n||n._lastBindCallId!==this._bindCallId)break;s++}return e=s,this._nextBindBaseIndex=s+1,2<=i?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){var e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,i,s){var n=this._gl;i=i||0,this._boundBufferBases[e=e||0]=null,n.bindBufferRange(n.UNIFORM_BUFFER,e||0,t.buffer,256*i,s||256)}updateBuffer(t){var s,n,e=this._gl,i=this.getGlBuffer(t);return t._updateID!==i.updateID&&(i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer),s=t.data,n=t.descriptor.usage&L.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW,s?i.byteLength>=s.byteLength?e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(i.byteLength=s.byteLength,e.bufferData(i.type,s,n)):(i.byteLength=t.descriptor.size,e.bufferData(i.type,i.byteLength,n))),i}destroyAll(){var t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){var i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){var e=this._gl;let i=qr.ARRAY_BUFFER;return t.descriptor.usage&L.INDEX?i=qr.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&L.UNIFORM&&(i=qr.UNIFORM_BUFFER),e=new G_(e.createBuffer(),i),this._gpuBuffers[t.uid]=e,t.on("destroy",this.onBufferDestroy,this),e}resetState(){this._boundBufferBases=Object.create(null)}}ml.extension={type:[r.WebGLSystem],name:"buffer"};var ZA=Object.defineProperty,QA=Object.defineProperties,JA=Object.getOwnPropertyDescriptors,B_=Object.getOwnPropertySymbols,tP=Object.prototype.hasOwnProperty,eP=Object.prototype.propertyIsEnumerable,I_=(r,t,e)=>t in r?ZA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Is=(r,t)=>{for(var e in t=t||{})tP.call(t,e)&&I_(r,e,t[e]);if(B_)for(var e of B_(t))eP.call(t,e)&&I_(r,e,t[e]);return r},F_=(r,t)=>QA(r,JA(t)),gl=class Qy{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,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(t){this.gl=t,this._renderer.gl=t}init(t){var n,e,a;t=Is(Is({},Qy.defaultOptions),t);let s=this.multiView=t.multiView;t.context&&s&&(Ot("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),s=!1),s?this.canvas=H.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context?this.initFromContext(t.context):(n=this._renderer.background.alpha<1,e=null==(e=t.premultipliedAlpha)||e,a=t.antialias&&!this._renderer.backBuffer.useBackBuffer,this.createContext(t.preferWebGLVersion,{alpha:n,premultipliedAlpha:e,antialias:a,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:null!=(n=t.powerPreference)?n:"default"}))}ensureCanvasSize(t){var e;this.multiView?((e=this.canvas).width{var e;this.gl.isContextLost()&&null!=(e=this.extensions.loseContext)&&e.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){var e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),null!=(e=this.extensions.loseContext)&&e.loseContext()}forceContextLoss(){var t;null!=(t=this.extensions.loseContext)&&t.loseContext(),this._contextLossForced=!0}validateContext(t){(t=t.getContextAttributes())&&t.stencil;var t=this.supports,s=2===this.webGLVersion,n=this.extensions;t.uint32Indices=s||!!n.uint32ElementIndex,t.uniformBufferObject=s,t.vertexArrayObject=s||!!n.vertexArrayObject,t.srgbTextures=s||!!n.srgb,t.nonPowOf2wrapping=s,t.nonPowOf2mipmaps=s,t.msaa=s,t.uint32Indices}};function _l(r,t){for(const n in r.attributes){var o=r.attributes[n],a=t[n];a?(null==o.format&&(o.format=a.format),null==o.offset&&(o.offset=a.offset),null==o.instance&&(o.instance=a.instance)):Ot(`Attribute ${n} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}!function(r){var l,{buffers:i,attributes:s}=r,n={},o={};for(const a in i)n[(l=i[a]).uid]=0,o[l.uid]=0;for(const a in s)n[(l=s[a]).buffer.uid]+=qt(l.format).stride;for(const a in s)null==(l=s[a]).stride&&(l.stride=n[l.buffer.uid]),null==l.start&&(l.start=o[l.buffer.uid]),o[l.buffer.uid]+=qt(l.format).stride}(r)}gl.extension={type:[r.WebGLSystem],name:"context"},gl.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};var Fs=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))({}),bl=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))({}),U_=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))({}),j=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))({});const k_={uint8x2:j.UNSIGNED_BYTE,uint8x4:j.UNSIGNED_BYTE,sint8x2:j.BYTE,sint8x4:j.BYTE,unorm8x2:j.UNSIGNED_BYTE,unorm8x4:j.UNSIGNED_BYTE,snorm8x2:j.BYTE,snorm8x4:j.BYTE,uint16x2:j.UNSIGNED_SHORT,uint16x4:j.UNSIGNED_SHORT,sint16x2:j.SHORT,sint16x4:j.SHORT,unorm16x2:j.UNSIGNED_SHORT,unorm16x4:j.UNSIGNED_SHORT,snorm16x2:j.SHORT,snorm16x4:j.SHORT,float16x2:j.HALF_FLOAT,float16x4:j.HALF_FLOAT,float32:j.FLOAT,float32x2:j.FLOAT,float32x3:j.FLOAT,float32x4:j.FLOAT,uint32:j.UNSIGNED_INT,uint32x2:j.UNSIGNED_INT,uint32x3:j.UNSIGNED_INT,uint32x4:j.UNSIGNED_INT,sint32:j.INT,sint32x2:j.INT,sint32x3:j.INT,sint32x4:j.INT};function $_(r){return null!=(r=k_[r])?r:k_.float32}const iP={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class vl{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this._renderer.renderableGC.addManagedHash(this,"_geometryVaoHash")}contextChange(){var t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const e=this._renderer.context.extensions.vertexArrayObject,i=(e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s)),this._renderer.context.extensions.vertexAttribDivisorANGLE);i&&(t.drawArraysInstanced=(s,n,o,a)=>{i.drawArraysInstancedANGLE(s,n,o,a)},t.drawElementsInstanced=(s,n,o,a,l)=>{i.drawElementsInstancedANGLE(s,n,o,a,l)},t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){var i=this.gl,t=(this._activeGeometry=t,this.getVao(t,e));this._activeVao!==t&&(this._activeVao=t,i.bindVertexArray(t)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){var t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;it in r?sP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,H_=(r,t)=>{for(var e in t=t||{})nP.call(t,e)&&N_(r,e,t[e]);if(L_)for(var e of L_(t))oP.call(t,e)&&N_(r,e,t[e]);return r};const aP=new ye({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),yl=class Jy{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){var{useBackBuffer:t,antialias:i}=H_(H_({},Jy.defaultOptions),t),t=(this.useBackBuffer=t,this._antialias=i,this._renderer.context.supports.msaa||(Ot("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Et.for2d(),new Tt({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 St({glProgram:t,resources:{uTexture:P.WHITE.source}})}renderStart(t){var e=this._renderer.renderTarget.getRenderTarget(t.target);this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender&&(e=this._renderer.renderTarget.getRenderTarget(t.target),this._targetTexture=e.colorTexture,t.target=this._getBackBufferTexture(e.colorTexture))}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){var t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:aP,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new P({source:new Q({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};yl.extension={type:[r.WebGLSystem],name:"backBuffer",priority:1},yl.defaultOptions={useBackBuffer:!1};var X_=yl;class xl{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(8&t),!!(4&t),!!(2&t),!!(1&t)))}}xl.extension={type:[r.WebGLSystem],name:"colorMask"};class Tl{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){var e=this._renderer,{geometry:t,shader:s,state:n,skipSync:o,topology:a,size:l,start:u,instanceCount:c}=t;e.shader.bind(s,o),e.geometry.bind(t,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,l,u,null!=c?c:t.instanceCount)}destroy(){this._renderer=null}}Tl.extension={type:[r.WebGLSystem],name:"encoder"};class j_{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const te=[];te[J.NONE]=void 0,te[J.DISABLED]={stencilWriteMask:0,stencilReadMask:0},te[J.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},te[J.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},te[J.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}},te[J.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}};class Sl{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:J.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this.resetState()}onRenderTargetChange(t){this._activeRenderTarget!==t&&(this._activeRenderTarget=t,t=this._renderTargetStencilState[t.uid]||(this._renderTargetStencilState[t.uid]={stencilMode:J.DISABLED,stencilReference:0}),this.setStencilMode(t.stencilMode,t.stencilReference))}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=J.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){var i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,n=te[t],o=this._stencilCache;i.stencilMode=t,i.stencilReference=e,t===J.DISABLED?this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST)):(this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),t===o.stencilMode&&o.stencilReference===e||(o.stencilMode=t,o.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[n.stencilBack.passOp])))}}Sl.extension={type:[r.WebGLSystem],name:"stencil"};class El{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Ea())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){var e=this.getUniformGroupData(t);t.buffer||(t.buffer=new ht({data:new Float32Array(e.layout.size/4),usage:L.UNIFORM|L.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){var s,o,e=t._signature;return this._syncFunctionHash[e]||(s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),s=this._adaptor.createUboElements(s),o=this._generateUboSync(s.uboElements),this._syncFunctionHash[e]={layout:s,syncFunction:o}),this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){var s=this.getUniformGroupData(t);t.buffer||(t.buffer=new ht({data:new Float32Array(s.layout.size/4),usage:L.UNIFORM|L.COPY_DST}));let n=null;return e||(e=t.buffer.data,n=t.buffer.dataInt32),i=i||0,s.syncFunction(t.uniforms,e,n,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;var e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const Al={f32:4,i32:4,"vec2":8,"vec3":12,"vec4":16,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64};function z_(r){var t=r.map(n=>({data:n,offset:0,size:0}));let i,s=0;for(let n=0;n",test:r=>void 0!==r.value.a,ubo:` + var matrix = uv[name].toArray(true); + data[offset] = matrix[0]; + data[offset + 1] = matrix[1]; + data[offset + 2] = matrix[2]; + data[offset + 4] = matrix[3]; + data[offset + 5] = matrix[4]; + data[offset + 6] = matrix[5]; + data[offset + 8] = matrix[6]; + data[offset + 9] = matrix[7]; + data[offset + 10] = matrix[8]; + `,uniform:` + gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); + `},{type:"vec4",test:r=>"vec4"===r.type&&1===r.size&&void 0!==r.value.width,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + data[offset + 2] = v.width; + data[offset + 3] = v.height; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); + } + `},{type:"vec2",test:r=>"vec2"===r.type&&1===r.size&&void 0!==r.value.x,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y) { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud[name].location, v.x, v.y); + } + `},{type:"vec4",test:r=>"vec4"===r.type&&1===r.size&&void 0!==r.value.red,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + data[offset + 3] = v.alpha; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); + } + `},{type:"vec3",test:r=>"vec3"===r.type&&1===r.size&&void 0!==r.value.red,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + gl.uniform3f(ud[name].location, v.red, v.green, v.blue); + } + `}];function Pl(r,t,e,i){var s=[` + var v = null; + var v2 = null; + var t = 0; + var index = 0; + var name = null; + var arrayOffset = null; + `];let n=0;for(let a=0;at in r?lP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;function sr(r,t){return` + for (let i = 0; i < ${r*t}; i++) { + data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i]; + } + `}const wl={f32:` + data[offset] = v;`,i32:` + dataInt32[offset] = v;`,"vec2":` + data[offset] = v[0]; + data[offset + 1] = v[1];`,"vec3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2];`,"vec4":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3];`,"vec2":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1];`,"vec3":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1]; + dataInt32[offset + 2] = v[2];`,"vec4":` + dataInt32[offset] = v[0]; + dataInt32[offset + 1] = v[1]; + dataInt32[offset + 2] = v[2]; + dataInt32[offset + 3] = v[3];`,"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 4] = v[2]; + data[offset + 5] = v[3];`,"mat3x3":` + 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":` + for (let i = 0; i < 16; i++) { + data[offset + i] = v[i]; + }`,"mat3x2":sr(3,2),"mat4x2":sr(4,2),"mat2x3":sr(2,3),"mat4x3":sr(4,3),"mat2x4":sr(2,4),"mat3x4":sr(3,4)},Y_=(r=>uP(r,cP({"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3]; + `})))(((r,t)=>{for(var e in wl)hP.call(t,e)&&W_(r,e,t[e]);if(V_)for(var e of V_(t))dP.call(t,e)&&W_(r,e,t[e]);return r})({},wl));function K_(r,t){var e=Math.max(Al[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4,n=0<=r.data.type.indexOf("i32")?"dataInt32":"data";return` + v = uv.${r.data.name}; + offset += ${t}; + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${r.data.size*e}; i++) + { + for(var j = 0; j < ${i}; j++) + { + ${n}[arrayOffset++] = v[t++]; + } + ${0!=s?`arrayOffset += ${s};`:""} + } + `}function q_(r){return Pl(r,"uboStd40",K_,wl)}class Rl extends El{constructor(){super({createUboElements:z_,generateUboSync:q_})}}Rl.extension={type:[r.WebGLSystem],name:"ubo"};class Z_{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new z}copyToTexture(t,e,i,s,n){var o=this._renderTargetSystem,a=this._renderer,o=o.getGpuRenderTarget(t),u=a.gl;return this.finishRenderPass(t),u.bindFramebuffer(u.FRAMEBUFFER,o.resolveTargetFramebuffer),a.texture.bind(e,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,n.x,n.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){var n=this._renderTargetSystem,o=t.colorTexture,n=n.getGpuRenderTarget(t);let l=s.y;t.isRoot&&(l=o.pixelHeight-s.height),t.colorTextures.forEach(d=>{this._renderer.texture.unbind(d)}),(o=this._renderer.gl).bindFramebuffer(o.FRAMEBUFFER,n.framebuffer);var c=this._viewPortCache;c.x===s.x&&c.y===l&&c.width===s.width&&c.height===s.height||(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,o.viewport(s.x,l,s.width,s.height)),n.depthStencilRenderBuffer||!t.stencil&&!t.depth||this._initStencil(n),this.clear(t,e,i)}finishRenderPass(t){var i;(t=this._renderTargetSystem.getGpuRenderTarget(t)).msaa&&((i=this._renderer.gl).bindFramebuffer(i.FRAMEBUFFER,t.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,t.framebuffer),i.blitFramebuffer(0,0,t.width,t.height,0,0,t.width,t.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,t.framebuffer))}initGpuRenderTarget(t){var e=this._renderer.gl,i=new j_,s=t.colorTexture;return Nt.test(s.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),i.framebuffer=null):(this._initColor(t,i),e.bindFramebuffer(e.FRAMEBUFFER,null)),i}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){var n,s;e&&(s=this._renderTargetSystem,"boolean"==typeof e&&(e=e?bt.ALL:bt.NONE),n=this._renderer.gl,e&bt.COLOR&&(s=i=null==i?s.defaultClearColor:i,(i=this._clearColorCache)[0]===s[0]&&i[1]===s[1]&&i[2]===s[2]&&i[3]===s[3]||(i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],n.clearColor(s[0],s[1],s[2],s[3]))),n.clear(e))}resizeGpuRenderTarget(t){var e;!t.isRoot&&(e=this._renderTargetSystem.getGpuRenderTarget(t),this._resizeColor(t,e),t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const i=this._renderer,s=i.gl,n=s.createFramebuffer();var o;e.resolveTargetFramebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((o,a)=>{(o=o.source).antialias&&(i.context.supports.msaa?e.msaa=!0:Ot("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(o,0),o=i.texture.getGlSource(o).texture,s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,o,0)}),e.msaa?(o=s.createFramebuffer(),e.framebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),t.colorTextures.forEach((a,l)=>{var u=s.createRenderbuffer();e.msaaRenderBuffer[l]=u})):e.framebuffer=n,this._resizeColor(t,e)}_resizeColor(t,e){const i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,n)=>{0!==n&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){const s=this._renderer,n=s.gl,o=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,o),t.colorTextures.forEach((a,l)=>{var a=a.source,c=(s.texture.bindSource(a,0),s.texture.getGlSource(a).internalFormat),d=e.msaaRenderBuffer[l];n.bindRenderbuffer(n.RENDERBUFFER,d),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,c,a.pixelWidth,a.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+l,n.RENDERBUFFER,d)})}}_initStencil(t){var e,i;null!==t.framebuffer&&(i=(e=this._renderer.gl).createRenderbuffer(),t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t))}_resizeStencil(t){var e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,2===this._renderer.context.webGLVersion?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){t=t.colorTexture.resource,this._renderer.context.multiView&&Nt.test(t)&&this._renderer.context.ensureCanvasSize(t)}postrender(t){var e;this._renderer.context.multiView&&Nt.test(t.colorTexture.resource)&&(e=this._renderer.context.canvas,(t=t.colorTexture).context2D.drawImage(e,0,t.pixelHeight-e.height))}}function Q_(r,t,e,i,s,n){return n=n?1:-1,r.identity(),r.a=1/i*2,r.d=1/s*2*n,r.tx=-1-t*r.a,r.ty=-n-e*r.d,r}var mP=Object.defineProperty,J_=Object.getOwnPropertySymbols,gP=Object.prototype.hasOwnProperty,_P=Object.prototype.propertyIsEnumerable,tb=(r,t,e)=>t in r?mP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const nr=new Map;function Ml(r,t){if(!nr.has(r)){const e=new P({source:new Nt(((r,t)=>{for(var e in t=t||{})gP.call(t,e)&&tb(r,e,t[e]);if(J_)for(var e of J_(t))_P.call(t,e)&&tb(r,e,t[e]);return r})({resource:r},t))}),i=()=>{nr.get(r)===e&&nr.delete(r)};e.once("destroy",i),e.source.once("destroy",i),nr.set(r,e)}return nr.get(r)}function eb(r){return r=r.colorTexture.source.resource,globalThis.HTMLCanvasElement&&r instanceof HTMLCanvasElement&&document.body.contains(r)}var yP=Object.defineProperty,rb=Object.getOwnPropertySymbols,xP=Object.prototype.hasOwnProperty,TP=Object.prototype.propertyIsEnumerable,ib=(r,t,e)=>t in r?yP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,sb=(r,t)=>{for(var e in t=t||{})xP.call(t,e)&&ib(r,e,t[e]);if(rb)for(var e of rb(t))TP.call(t,e)&&ib(r,e,t[e]);return r},nb=class tx{constructor(t={}){if(this.uid=K("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=sb(sb({},tx.defaultOptions),t),this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,"number"==typeof t.colorTextures){this._managedColorTextures=!0;for(let e=0;ei.source)];var e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof P||t.depthStencilTexture instanceof Q?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){var t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}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(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new Q({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((n,o)=>{s&&0===o||n.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};nb.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let Ds=nb;class Cl{constructor(t){this.rootViewPort=new z,this.viewport=new z,this.onRenderTargetChange=new Aa("onRenderTargetChange"),this.projectionMatrix=new M,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],(this._renderer=t).renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=eb(this.rootRenderTarget),null!=(e=(t=this.adaptor).prerender)&&e.call(t,this.rootRenderTarget)}postrender(){var t,e;null!=(e=(t=this.adaptor).postrender)&&e.call(t,this.rootRenderTarget)}bind(t,e=!0,i,s){var n=this.getRenderTarget(t),o=this.renderTarget!==n,a=(this.renderTarget=n,this.renderSurface=t,this.getGpuRenderTarget(n)),a=(n.pixelWidth===a.width&&n.pixelHeight===a.height||(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight),n.colorTexture),u=this.viewport,c=a.pixelWidth,d=a.pixelHeight;return(s=!s&&t instanceof P?t.frame:s)?(t=a._resolution,u.x=s.x*t+.5|0,u.y=s.y*t+.5|0,u.width=s.width*t+.5|0,u.height=s.height*t+.5|0):(u.x=0,u.y=0,u.width=c,u.height=d),Q_(this.projectionMatrix,0,0,u.width/a.resolution,u.height/a.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,i,u),o&&this.onRenderTargetChange.emit(n),n}clear(t,e=bt.ALL,i){e&&(t=t&&this.getRenderTarget(t),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=bt.ALL,i,s){return t=this.bind(t,e,i,s),this._renderTargetStack.push({renderTarget:t,frame:s}),t}pop(){this._renderTargetStack.pop();var t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),null!=(e=this._renderSurfaceToRenderTargetHash.get(t))?e:this._initRenderTarget(t)}copyToTexture(t,e,i,s,n){i.x<0&&(s.width+=i.x,n.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,n.y-=i.y,i.y=0);var{pixelWidth:o,pixelHeight:a}=t;return s.width=Math.min(s.width,o-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,s,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return(t=Nt.test(t)?Ml(t).source:t)instanceof Ds?e=t:t instanceof Q&&(e=new Ds({colorTextures:[t]}),Nt.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);var i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}resetState(){this.renderTarget=null,this.renderSurface=null}}class Ol extends Cl{constructor(t){super(t),this.adaptor=new Z_,this.adaptor.init(t,this)}}Ol.extension={type:[r.WebGLSystem],name:"renderTarget"};class Us extends ft{constructor({buffer:t,offset:e,size:i}){super(),this.uid=K("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=K("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=0|e,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=K("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function ob(r,t){var e=[],i=[` + var g = s.groups; + var sS = r.shader; + var p = s.glProgram; + var ugS = r.uniformGroup; + var resources; + `];let s=!1,n=0;var o=t._getProgramData(r.glProgram);for(const l in r.groups){var u=r.groups[l];e.push(` + resources = g[${l}].resources; + `);for(const c in u.resources){var p,d=u.resources[c];if(d instanceof st)d.ubo?(p=r._uniformBindMap[l][Number(c)],e.push(` + sS.bindUniformBlock( + resources[${c}], + '${p}', + ${r.glProgram._uniformBlockData[p].index} + ); + `)):e.push(` + ugS.updateUniformGroup(resources[${c}], p, sD); + `);else if(d instanceof Us){const p=r._uniformBindMap[l][Number(c)];e.push(` + sS.bindUniformBlock( + resources[${c}], + '${p}', + ${r.glProgram._uniformBlockData[p].index} + ); + `)}else if(d instanceof Q){const p=r._uniformBindMap[l][c],f=o.uniformData[p];f&&(s||(s=!0,i.push(` + var tS = r.texture; + `)),t._gl.uniform1i(f.location,n),e.push(` + tS.bind(resources[${c}], ${n}); + `),n++)}}}var a=[...i,...e].join(` +`);return new Function("r","s","sD",a)}class ab{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function Gl(r,t,e){return t=r.createShader(t),r.shaderSource(t,e),r.compileShader(t),t}function Bl(r){var t=new Array(r);for(let e=0;eac+": "+u),i=r.getShaderInfoLog(t),s=i.split(` +`),n={},o=s.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>!(!u||n[u]||(n[u]=!0,0))),a=[""];o.forEach(u=>{e[u-1]=`%c${e[u-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")}),r=e.join(` +`),a[0]=r,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function fb(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||pb(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||pb(r,i),console.error("PixiJS Error: Could not initialize shader."),""!==r.getProgramInfoLog(t)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function mb(r,t){var e=Gl(r,r.VERTEX_SHADER,t.vertex),i=Gl(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram(),n=(r.attachShader(s,e),r.attachShader(s,i),t.transformFeedbackVaryings),o=(n&&"function"==typeof r.transformFeedbackVaryings&&r.transformFeedbackVaryings(s,n.names,"separate"===n.bufferMode?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||fb(r,s,e,i),t._attributeData=cb(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=db(s,r),t._uniformBlockData=hb(s,r),r.deleteShader(e),r.deleteShader(i),{});for(const a in t._uniformData){var l=t._uniformData[a];o[a]={location:r.getUniformLocation(s,a),value:Il(l.type,l.size)}}return new ab(s,o)}const $s={textureCount:0,blockIndex:0};class Dl{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_programDataHash")}contextChange(t){this._gl=t,this._programDataHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=be()}bind(t,e){this._setProgram(t.glProgram),e||($s.textureCount=0,$s.blockIndex=0,e=(e=this._shaderSyncFunctions[t.glProgram._key])||(this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),e(this._renderer,t,$s))}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,$s)}bindUniformBlock(t,e,i=0){var s=this._renderer.buffer,n=this._getProgramData(this._activeProgram),o=t._bufferResource,a=(o||this._renderer.ubo.updateUniformGroup(t),t.buffer),l=s.updateBuffer(a),u=s.freeLocationForBufferBase(l),t=(o?({offset:o,size:t}=t,0===o&&t===a.data.byteLength?s.bindBufferBase(l,u):s.bindBufferRange(l,u,o)):s.getLastBindBaseLocation(l)!==u&&s.bindBufferBase(l,u),this._activeProgram._uniformBlockData[e].index);n.uniformBlockBindings[i]!==u&&(n.uniformBlockBindings[i]=u,this._renderer.gl.uniformBlockBinding(n.program,t,u))}_setProgram(t){this._activeProgram!==t&&(this._activeProgram=t,t=this._getProgramData(t),this._gl.useProgram(t.program))}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){var e=t._key;return this._programDataHash[e]=mb(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return ob(t,e)}resetState(){this._activeProgram=null}}Dl.extension={type:[r.WebGLSystem],name:"shader"};const gb={f32:`if (cv !== v) { + cu.value = v; + gl.uniform1f(location, v); + }`,"vec2":`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":`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":`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":`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":`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":`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":`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":`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":`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":`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":`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":`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":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},_b={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"};function bb(r,t){var e=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + var name = null; + `];for(const i in r.uniforms)if(t[i]){var o,s=r.uniformStructures[i];let n=!1;for(let o=0;o>=1,i++;this.stateId=t.data}for(let e=0;e>1,1),s=Math.max(s>>1,1)}}},kl={id:"image",upload(r,t,e,i){var s=t.width,n=t.height,o=r.pixelWidth,a=r.pixelHeight,l=r.resourceWidth,u=r.resourceHeight;lt in r?FP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,we=(r,t)=>{for(var e in t=t||{})kP.call(t,e)&&Cb(r,e,t[e]);if(Mb)for(var e of Mb(t))$P.call(t,e)&&Cb(r,e,t[e]);return r};function Ob(r,t){let e={},i=r.RGBA;return r instanceof H.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),we(we(we(we(we(we(((r,t)=>DP(r,UP(t)))(we({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function Gb(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}class Nl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:kl,buffer:Sb,video:Ab,compressed:Eb},this._premultiplyAlpha=!1,this._useSeparateSamplers=!1,this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_glTextures"),this._renderer.renderableGC.addManagedHash(this,"_glSamplers")}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=Ob(t,this._renderer.context.extensions),this._mapFormatToType=Gb(t),this._mapFormatToFormat=Rb(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null),this._premultiplyAlpha=!1;for(let e=0;e<16;e++)this.bind(P.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){var i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){var i=this._gl;t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t&&(this._boundTextures[e]=t,this._activateLocation(e),t=t||P.EMPTY.source,e=this.getGlSource(t),i.bindTexture(e.target,e.texture))}_bindSampler(t,e=0){var i=this._gl;t?(t=this._getGlSampler(t),this._boundSamplers[e]!==t&&(this._boundSamplers[e]=t,i.bindSampler(e,t))):(this._boundSamplers[e]=null,i.bindSampler(e,null))}unbind(t){var o,e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;nthis.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(P.EMPTY.source),this._boundSamplers=Object.create(null);var t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}}Nl.extension={type:[r.WebGLSystem],name:"texture"};class Hl{init(){var t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new M,type:"mat3x3"},uRound:{value:0,type:"f32"}}),e=be(),i=Xe({name:"graphics",bits:[Ci,Gi(e),ss,ze]});this.shader=new St({glProgram:i,resources:{localUniforms:t,batchSamplers:Bi(e)}})}execute(t,e){var s=(e=e.context).customShader||this.shader,n=t.renderer,{batcher:e,instructions:l}=n.graphicsContext.getContextRenderData(e),u=(s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(e.geometry,s.glProgram),l.instructions);for(let c=0;c",value:new M}}}})}execute(t,e){var i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;var n=e.texture,o=n.source;s.resources.uTexture=o,s.resources.uSampler=o.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Xl.extension={type:[r.WebGLPipesAdaptor],name:"mesh"};class jl{constructor(t){this._renderer=t}updateRenderable(){}destroyRenderable(){}validateRenderable(){return!1}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}function Ns(r,t){var e=r.instructionSet,i=e.instructions;for(let s=0;st in r?VP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$b=(r,t)=>{for(var e in t=t||{})WP.call(t,e)&&kb(r,e,t[e]);if(Ub)for(var e of Ub(t))YP.call(t,e)&&kb(r,e,t[e]);return r};(yb=class ex{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new X(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=$b($b({},ex.defaultOptions),t),this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}}).extension={type:[r.WebGLSystem,r.WebGPUSystem,r.CanvasSystem],name:"background",priority:0},yb.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};const Zr={};B.handle(r.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Zr[r.name]=r.ref},r=>{delete Zr[r.name]});class Zl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t,this._renderer.runners.prerender.add(this)}prerender(){this._activeBlendMode="normal",this._isAdvanced=!1}setBlendMode(t,e,i){this._activeBlendMode===e?this._isAdvanced&&this._renderableList.push(t):(this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Zr[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t)))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);var e=this._activeBlendMode;if(Zr[e]){let i=this._filterHash[e];i||((i=this._filterHash[e]=new hr).filters=[new Zr[e]]),e={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1},this._renderableList=e.renderables,t.add(e)}}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Zl.extension={type:[r.WebGLPipes,r.WebGPUPipes,r.CanvasPipes],name:"blendMode"};var KP=Object.defineProperty,Nb=Object.getOwnPropertySymbols,qP=Object.prototype.hasOwnProperty,ZP=Object.prototype.propertyIsEnumerable,Hb=(r,t,e)=>t in r?KP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ql=(r,t)=>{for(var e in t=t||{})qP.call(t,e)&&Hb(r,e,t[e]);if(Nb)for(var e of Nb(t))ZP.call(t,e)&&Hb(r,e,t[e]);return r};const Jl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},tu=class rx{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof lt||t instanceof P?Ql({target:t},e):Ql(Ql({},e),t)}async image(t){var e=new Image;return e.src=await this.base64(t),e}async base64(t){const{format:e,quality:i}=t=this._normalizeOptions(t,rx.defaultImageOptions),s=this.canvas(t);if(void 0!==s.toBlob)return new Promise((n,o)=>{s.toBlob(a=>{if(a){const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)}else o(new Error("ICanvas.toBlob failed!"))},Jl[e],i)});if(void 0!==s.toDataURL)return s.toDataURL(Jl[e],i);if(void 0===s.convertToBlob)throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented");{const n=await s.convertToBlob({type:Jl[e],quality:i});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}}canvas(t){var e=(t=this._normalizeOptions(t)).target,i=this._renderer;return e instanceof P?i.texture.generateCanvas(e):(e=i.textureGenerator.generateTexture(t),t=i.texture.generateCanvas(e),e.destroy(!0),t)}pixels(t){var e=(t=this._normalizeOptions(t)).target,i=this._renderer,t=e instanceof P?e:i.textureGenerator.generateTexture(t),i=i.texture.getPixels(t);return e instanceof lt&&t.destroy(!0),i}texture(t){return(t=this._normalizeOptions(t)).target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);var i=this.canvas(t),s=document.createElement("a");s.download=null!=(t=t.filename)?t:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e=null!=(e=t.width)?e:200,n=(t=this._normalizeOptions(t),(t=this.canvas(t)).toDataURL()),t=(console.log(`[Pixi Texture] ${t.width}px ${t.height}px`),["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" "));console.log("%c ",t)}destroy(){this._renderer=null}};tu.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:"extract"},tu.defaultImageOptions={format:"png",quality:1};var Xb=tu;class Xs extends P{static create(t){return new Xs({source:new Q(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var QP=Object.defineProperty,JP=Object.defineProperties,tw=Object.getOwnPropertyDescriptors,jb=Object.getOwnPropertySymbols,ew=Object.prototype.hasOwnProperty,rw=Object.prototype.propertyIsEnumerable,zb=(r,t,e)=>t in r?QP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const nw=new z,ow=new nt,aw=[0,0,0,0];class eu{constructor(t){this._renderer=t}generateTexture(t){var i=(t=t instanceof lt?{target:t,frame:void 0,textureSourceOptions:{},resolution:void 0}:t).resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target,o=(o=t.clearColor)?Array.isArray(o)&&4===o.length?o:X.shared.setValue(o).toArray():aw,e=(null==(e=t.frame)?void 0:e.copyTo(nw))||hi(n,ow).rectangle,t=(e.width=0|Math.max(e.width,1/i),e.height=0|Math.max(e.height,1/i),Xs.create(((r,t)=>JP(r,tw(t)))(((r,t)=>{for(var e in t=t||{})ew.call(t,e)&&zb(r,e,t[e]);if(jb)for(var e of jb(t))rw.call(t,e)&&zb(r,e,t[e]);return r})({},t.textureSourceOptions),{width:e.width,height:e.height,resolution:i,antialias:s}))),i=M.shared.translate(-e.x,-e.y);return this._renderer.render({container:n,transform:i,target:t,clearColor:o}),t.source.updateMipmaps(),t}destroy(){this._renderer=null}}eu.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:"textureGenerator"};class ru{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){for(let t=this._stackIndex=0;t"},uWorldTransformMatrix:{value:new M,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}}ru.extension={type:[r.WebGLSystem,r.WebGPUSystem,r.CanvasSystem],name:"globalUniforms"};let lw=1;class iu{constructor(){this._tasks=[],this._offset=0}init(){ut.system.add(this._update,this)}repeat(t,e,i=!0){var s=lw++;let n=0;return i&&(this._offset+=1e3,n=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:n,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e=i.duration&&(s=t-i.start,i.func(s),i.last=t)}}destroy(){ut.system.remove(this._update,this),this._tasks.length=0}}let Vb=!(iu.extension={type:[r.WebGLSystem,r.WebGPUSystem,r.CanvasSystem],name:"scheduler",priority:0});function Wb(r){Vb||(-1t in r?uw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qb=(r,t)=>{for(var e in t=t||{})cw.call(t,e)&&Zb(r,e,t[e]);if(qb)for(var e of qb(t))hw.call(t,e)&&Zb(r,e,t[e]);return r};let dw=0;var su=class ix{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t=Qb(Qb({},ix.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?(this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency,!1),this._hashHandler=this._renderer.scheduler.repeat(()=>{for(const e of this._managedHashes)e.context[e.hash]=Yb(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(const e of this._managedArrays)Kb(e.context[e.hash])},this._frequency)):(this._renderer.scheduler.cancel(this._handler),this._renderer.scheduler.cancel(this._hashHandler),this._renderer.scheduler.cancel(this._arrayHandler)))}addManagedHash(t,e){this._managedHashes.push({context:t,hash:e})}addManagedArray(t,e){this._managedArrays.push({context:t,hash:e})}prerender({container:t}){this._now=performance.now(),t.renderGroup.gcTick=dw++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(-1===t._lastUsed&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){var n=this._now,o=this._managedRenderables,a=this._renderer.renderPipes;let l=0;for(let u=0;uthis.maxUnusedTime?(c.destroyed||(s=a,t&&(t.structureDidChange=!0),s[c.renderPipeId].destroyRenderable(c)),c._lastUsed=-1,l++,c.off("destroyed",this._removeRenderable,this)):o[u-l]=c)}o.length-=l}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){var e=this._managedRenderables.indexOf(t);0<=e&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(const i of t.renderGroupChildren)this._updateInstructionGCTick(i,e)}},pw=(su.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:"renderableGC",priority:0},su.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4},Object.defineProperty),tv=Object.getOwnPropertySymbols,fw=Object.prototype.hasOwnProperty,mw=Object.prototype.propertyIsEnumerable,ev=(r,t,e)=>t in r?pw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rv=(r,t)=>{for(var e in t=t||{})fw.call(t,e)&&ev(r,e,t[e]);if(tv)for(var e of tv(t))mw.call(t,e)&&ev(r,e,t[e]);return r},nu=class sx{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=rv(rv({},sx.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=null!=(e=t.textureGCAMaxIdle)?e:t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active)&&(this.checkCount++,this.checkCount>this.checkCountMax)&&(this.checkCount=0,this.run())}run(){var t=this._renderer.texture.managedTextures;for(let e=0;ethis.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}},gw=(nu.extension={type:[r.WebGLSystem,r.WebGPUSystem],name:"textureGC"},nu.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600},Object.defineProperty),sv=Object.getOwnPropertySymbols,_w=Object.prototype.hasOwnProperty,bw=Object.prototype.propertyIsEnumerable,nv=(r,t,e)=>t in r?gw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ov=(r,t)=>{for(var e in t=t||{})_w.call(t,e)&&nv(r,e,t[e]);if(sv)for(var e of sv(t))bw.call(t,e)&&nv(r,e,t[e]);return r},ou=class nx{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){(t=ov(ov({},nx.defaultOptions),t)).view&&(t.canvas=t.view),this.screen=new z(0,0,t.width,t.height),this.canvas=t.canvas||H.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Ml(this.canvas,t),this.renderTarget=new Ds({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){("boolean"==typeof t?t:null!=t&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};ou.extension={type:[r.WebGLSystem,r.WebGPUSystem,r.CanvasSystem],name:"view",priority:0},ou.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};const au=[yb,ru,js,ou,Yl,nu,eu,Xb,Ma,su,iu],lu=[Zl,y_,Kl,zl,dl,fl,pl,jl],vw=[...au,Rl,X_,gl,ml,Nl,Ol,vl,Ul,Dl,Tl,nb,Sl,xl],yw=[...lu],xw=[ll,Xl,Hl],lv=[],uv=[],cv=[];B.handleByNamedList(r.WebGLSystem,lv),B.handleByNamedList(r.WebGLPipes,uv),B.handleByNamedList(r.WebGLPipesAdaptor,cv),B.add(...vw,...yw,...xw);class hv extends Ur{constructor(){super({name:"webgl",type:_t.WEBGL,systems:lv,renderPipes:uv,renderPipeAdaptors:cv})}}var Tw={__proto__:null,WebGLRenderer:hv};class uu{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var n=this._gpu.device,o=e.layout[i],a=[],l=this._renderer;for(const d in o){var s=null!=(s=t.resources[d])?s:t.resources[o[d]];let f;if("uniformGroup"===s._resourceType){var m=s,m=(l.ubo.updateUniformGroup(m),m.buffer);f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if("buffer"===s._resourceType){const m=s;f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if("bufferResource"===s._resourceType){const m=s;f={buffer:l.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if("textureSampler"===s._resourceType){const m=s;f=l.texture.getGpuSampler(m)}else if("textureSource"===s._resourceType){const m=s;f=l.texture.getGpuSource(m).createView({})}a.push({binding:o[d],resource:f})}return e=l.shader.getProgramData(e).bindGroups[i],i=n.createBindGroup({layout:e,entries:a}),this._hash[t._key]=i}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}uu.extension={type:[r.WebGPUSystem],name:"bindGroup"};class cu{constructor(t){this._gpuBuffers=Object.create(null),this._managedBuffers=[],t.renderableGC.addManagedHash(this,"_gpuBuffers")}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){var e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));var e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Pi(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}cu.extension={type:[r.WebGPUSystem],name:"buffer"};class dv{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error("UniformBufferBatch: array is too large: "+4*t);var e=this.byteIndex,t=e+4*t;if((t=Math.ceil(t/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment)>4*this.data.length)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=t,e}addGroup(t){var e=this.addEmptyGroup(t.length);for(let i=0;i{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await H.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}}zs.extension={type:[r.WebGPUSystem],name:"device"},zs.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var Ew=Object.defineProperty,pv=Object.getOwnPropertySymbols,Aw=Object.prototype.hasOwnProperty,Pw=Object.prototype.propertyIsEnumerable,fv=(r,t,e)=>t in r?Ew(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mv=(r,t)=>{for(var e in t=t||{})Aw.call(t,e)&&fv(r,e,t[e]);if(pv)for(var e of pv(t))Pw.call(t,e)&&fv(r,e,t[e]);return r};class du{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){t=this._renderer.pipeline.getPipeline(t,e,i,s),this.setPipeline(t)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){var e;this._boundIndexBuffer!==t&&(e=2===(this._boundIndexBuffer=t).data.BYTES_PER_ELEMENT?"uint16":"uint32",this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e))}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){this._boundBindGroup[t]!==e&&((this._boundBindGroup[t]=e)._touch(this._renderer.textureGC.count),e=this._renderer.bindGroup.getBindGroup(e,i,t),this.renderPassEncoder.setBindGroup(t,e))}setGeometry(t,e){var i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){var s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){var i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){var{geometry:t,shader:i,state:s,topology:n,size:o,start:a,instanceCount:l,skipSync:u}=t;this.setPipelineFromGeometryProgramAndState(t,i.gpuProgram,s,n),this.setGeometry(t,i.gpuProgram),this._setShaderBindGroups(i,u),t.indexBuffer?this.renderPassEncoder.drawIndexed(o||t.indexBuffer.data.length,null!=l?l:t.instanceCount,a||0):this.renderPassEncoder.draw(o||t.getSize(),null!=l?l: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(){var t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]),t=(this.renderPassEncoder=this.commandEncoder.beginRenderPass(t),this._boundPipeline),i=mv({},this._boundVertexBuffer),s=this._boundIndexBuffer,n=mv({},this._boundBindGroup),o=(this._clearCache(),this._renderer.renderTarget.viewport);this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(t);for(const a in i)this._setVertexBuffer(a,i[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}du.extension={type:[r.WebGPUSystem],name:"encoder",priority:1};class pu{constructor(t){this._renderTargetStencilState=Object.create(null),(this._renderer=t).renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){var e=this._renderTargetStencilState[t.uid]||(this._renderTargetStencilState[t.uid]={stencilMode:J.DISABLED,stencilReference:0});this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){var i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e,(i=this._renderer).pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}pu.extension={type:[r.WebGPUSystem],name:"stencil"};const Qr={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}};function gv(r){var t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;it in r?ww(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;const Iw={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};class gu{constructor(t){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._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(J.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=te[t],this._updatePipeHash())}setPipeline(t,e,i,s){t=this.getPipeline(t,e,i),s.setPipeline(t)}getPipeline(t,e,i,s){t._layoutKey||(_l(t,e.attributeData),this._generateBufferKey(t)),s=s||t.topology;var n=t._layoutKey<<24|e._layoutKey<<16|i.data<<10|i._blendModeId<<5|Iw[s];return this._pipeCache[n]||(this._pipeCache[n]=this._createPipeline(t,e,i,s),this._pipeCache[n])}_createPipeline(t,e,i,s){var n=this._gpu.device,t=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i),l=(a[0].writeMask=this._stencilMode===J.RENDERING_MASK_ADD?0:this._colorMask,this._renderer.shader.getProgramData(e).pipeline),t={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:t},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(t.depthStencil=((r,t)=>Rw(r,Mw(t)))(((r,t)=>{for(var e in t=t||{})Cw.call(t,e)&&yv(r,e,t[e]);if(vv)for(var e of vv(t))Ow.call(t,e)&&yv(r,e,t[e]);return r})({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"})),n.createRenderPipeline(t)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){var e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){var e=[];let i=0;var s=Object.keys(t.attributes).sort();for(let o=0;o{var o,a={arrayStride:0,stepMode:"vertex",attributes:[]},l=a.attributes;for(const u in e.attributeData){var c=t.attributes[u];1!==(null!=(o=c.divisor)?o:1)&&Ot(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(a.arrayStride=c.stride,a.stepMode=c.instance?"instance":"vertex",l.push({shaderLocation:e.attributeData[u].location,offset:c.offset,format:c.format}))}l.length&&s.push(a)}),this._bufferLayoutsCache[i]=s}_updatePipeHash(){var t=function(r,t,e,i){return e<<6|r<<3|i<<1|t}(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}gu.extension={type:[r.WebGPUSystem],name:"pipeline"};class xv{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class Tv{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,n){var o=this._renderer,t=this._getGpuColorTexture(t),l=o.texture.getGpuSource(e.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:t,origin:i},{texture:l,origin:n},s),e}startRenderPass(t,e=!0,i,s){var n=this._renderTargetSystem.getGpuRenderTarget(t),t=this.getDescriptor(t,e,i);n.descriptor=t,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){var e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){"boolean"==typeof e&&(e=e?bt.ALL:bt.NONE);const s=this._renderTargetSystem,n=s.getGpuRenderTarget(t),o=t.colorTextures.map((l,u)=>{var c=n.contexts[u];let d,p;return d=c?c.getCurrentTexture().createView():this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),n.msaaTextures[u]&&(p=d,d=this._renderer.texture.getTextureView(n.msaaTextures[u])),c=e&bt.COLOR?"clear":"load",null==i&&(i=s.defaultClearColor),{view:d,resolveTarget:p,clearValue:i,storeOp:"store",loadOp:c}});let a;var l,u;return!t.stencil&&!t.depth||t.depthStencilTexture||(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture&&(l=e&bt.STENCIL?"clear":"load",u=e&bt.DEPTH?"clear":"load",a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}),{colorAttachments:o,depthStencilAttachment:a}}clear(t,e=!0,i,s){var n,o,u;e&&({gpu:n,encoder:o}=this._renderer,n=n.device,null===o.commandEncoder?(o=n.createCommandEncoder(),u=this.getDescriptor(t,e,i),(u=o.beginRenderPass(u)).setViewport(s.x,s.y,s.width,s.height,0,1),u.end(),u=o.finish(),n.queue.submit([u])):this.startRenderPass(t,e,i,s))}initGpuRenderTarget(t){t.isRoot=!0;const e=new xv;return t.colorTextures.forEach((i,s)=>{if(Nt.test(i.resource)){var n=i.resource.getContext("webgpu"),o=i.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:o})}catch(a){console.error(a)}e.contexts[s]=n}if(e.msaa=i.source.antialias,i.source.antialias){const n=new Q({width:0,height:0,sampleCount:4});e.msaaTextures[s]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture)&&(t.depthStencilTexture.source.sampleCount=4),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){var e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{null!=(s=e.msaaTextures[s])&&s.resize(i.source.width,i.source.height,i.source._resolution)})}}class _u extends Cl{constructor(t){super(t),this.adaptor=new Tv,this.adaptor.init(t,this)}}_u.extension={type:[r.WebGPUSystem],name:"renderTarget"};class bu{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,i=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}bu.extension={type:[r.WebGPUSystem],name:"shader"};const pt={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 vu{constructor(){this.defaultState=new Et,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:pt[t.blendMode]||pt.normal}]}destroy(){this.gpu=null}}vu.extension={type:[r.WebGPUSystem],name:"state"};const Sv={type:"image",upload(r,t,e){var i=r.resource,s=(0|r.pixelWidth)*(0|r.pixelHeight),s=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*s},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},yu={"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}},Uw={blockBytes:4,blockWidth:1,blockHeight:1},Ev={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight;var n=yu[r.format]||Uw;for(let o=0;o>1,1),s=Math.max(s>>1,1)}}},xu={type:"image",upload(r,t,e){var s,n,i=r.resource;i&&(s=Math.min(t.width,r.resourceWidth||r.pixelWidth),n=Math.min(t.height,r.resourceHeight||r.pixelHeight),r="premultiply-alpha-on-upload"===r.alphaMode,e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:r},{width:s,height:n}))}},Av={type:"video",upload(r,t,e){xu.upload(r,t,e)}};class Pv{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` + var pos : array, 3> = array, 3>( + vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); + + struct VertexOutput { + @builtin(position) position : vec4, + @location(0) texCoord : vec2, + }; + + @vertex + fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { + var output : VertexOutput; + output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); + output.position = vec4(pos[vertexIndex], 0.0, 1.0); + return output; + } + + @group(0) @binding(0) var imgSampler : sampler; + @group(0) @binding(1) var img : texture_2d; + + @fragment + fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { + return textureSample(img, imgSampler, texCoord); + } + `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){var e=this._getMipmapPipeline(t.format);if("3d"===t.dimension||"1d"===t.dimension)throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t;var l,s=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT,o=(n||(l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1},i=this.device.createTexture(l)),this.device.createCommandEncoder({})),a=e.getBindGroupLayout(0);for(let l=0;l",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e,t=t.source;return null!=(e=this._textureViewHash[t.uid])?e:this._createTextureView(t)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){var e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=H.get().createCanvas(),n=(s.width=t.source.pixelWidth,s.height=t.source.pixelHeight,s.getContext("webgpu"));return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:H.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){var t=this.generateCanvas(t),i=Xt.getOptimalCanvasAndContext(t.width,t.height),{width:t,height:o}=((s=i.context).drawImage(t,0,0),t),s=s.getImageData(0,0,t,o),s=new Uint8ClampedArray(s.data.buffer);return Xt.returnCanvasAndContext(i),{pixels:s,width:t,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){var e=Number(t),i=this._bindGroupHash[e];null!=i&&i.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}Tu.extension={type:[r.WebGPUSystem],name:"texture"};class Su{init(){var t=new st({uTransformMatrix:{value:new M,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),e=He({name:"graphics",bits:[Mi,Oi(be()),$f,je]});this.shader=new St({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){var s=(e=e.context).customShader||this.shader,n=t.renderer,{batcher:a,instructions:l}=n.graphicsContext.getContextRenderData(e),u=n.encoder,e=(u.setGeometry(a.geometry,s.gpuProgram),n.globalUniforms.bindGroup),e=(u.setBindGroup(0,e,s.gpuProgram),n.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0)),p=(u.setBindGroup(2,e,s.gpuProgram),l.instructions);let f=null;for(let m=0;m",value:new M}}}})}execute(t,e){var i=t.renderer;let s=e._shader;if(s){if(!s.gpuProgram)return}else(s=this._shader).groups[2]=i.texture.getTextureBindGroup(e.texture);var n=s.gpuProgram;n.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms&&(n=t.localUniforms,s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(n,!0)),i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Eu.extension={type:[r.WebGPUPipesAdaptor],name:"mesh"};const kw=[...au,fu,du,zs,cu,Tu,_u,bu,vu,gu,hu,pu,uu],$w=[...lu,mu],Lw=[ul,Eu,Su],wv=[],Rv=[],Mv=[];B.handleByNamedList(r.WebGPUSystem,wv),B.handleByNamedList(r.WebGPUPipes,Rv),B.handleByNamedList(r.WebGPUPipesAdaptor,Mv),B.add(...kw,...$w,...Lw);class Cv extends Ur{constructor(){super({name:"webgpu",type:_t.WEBGPU,systems:wv,renderPipes:Rv,renderPipeAdaptors:Mv})}}var Nw={__proto__:null,WebGPURenderer:Cv};const Xw=new Proxy({POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},{get(r,t){return r[t]}}),jw=new z(0,0,1,1);var Ov=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))({}),Au=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))({}),Vw=new Proxy(Au,{get(r,t){return r[t]}}),Pu=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))({}),Ww=new Proxy(Pu,{get(r,t){return r[t]}});let Kw=0;var Jw=Object.defineProperty,Vs=Object.getOwnPropertySymbols,Gv=Object.prototype.hasOwnProperty,Bv=Object.prototype.propertyIsEnumerable,Iv=(r,t,e)=>t in r?Jw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class rR extends Lt{constructor(t){var s=t="function"==typeof t?{render:t}:t,n=s.render;super(((r,t)=>{for(var e in t=t||{})Gv.call(t,e)&&Iv(r,e,t[e]);if(Vs)for(var e of Vs(t))Bv.call(t,e)&&Iv(r,e,t[e]);return r})({label:"RenderContainer"},((r,t)=>{var e={};for(i in r)Gv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Vs)for(var i of Vs(r))t.indexOf(i)<0&&Bv.call(r,i)&&(e[i]=r[i]);return e})(s,["render"]))),this.renderPipeId="customRender",this.batched=!1,n&&(this.render=n),this.containsPoint=null!=(s=t.containsPoint)?s:()=>!1,this.addBounds=null!=(n=t.addBounds)?n:()=>!1}updateBounds(){this._bounds.clear(),this.addBounds(this._bounds)}render(t){}}const aR={rectangle:bo,polygon:_o,triangle:vo,circle:Zt,ellipse:Zt,roundedRectangle:Zt};var uR=Object.defineProperty,Fv=Object.getOwnPropertySymbols,cR=Object.prototype.hasOwnProperty,hR=Object.prototype.propertyIsEnumerable,Dv=(r,t,e)=>t in r?uR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Uv=(r,t)=>{for(var e in t=t||{})cR.call(t,e)&&Dv(r,e,t[e]);if(Fv)for(var e of Fv(t))hR.call(t,e)&&Dv(r,e,t[e]);return r},kv=class ox extends lt{constructor(t={}){t=Uv(Uv({},ox.defaultOptions),t),super(),this.renderLayerChildren=[],this.sortableChildren=t.sortableChildren,this.sortFunction=t.sortFunction}attach(...t){for(let e=0;er.zIndex-t.zIndex},kv);function Lv(r,t,e,i){var s=e.buffers[0],n=s.data,{verticesX:o,verticesY:e}=e,l=r/(o-1),u=t/(e-1);let c=0;var d=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],b=i[6],x=i[7],y=i[8];for(let T=0;Tt in r?bR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wu=(r,t)=>{for(var e in t=t||{})Vv.call(t,e)&&Yv(r,e,t[e]);if(Ys)for(var e of Ys(t))Wv.call(t,e)&&Yv(r,e,t[e]);return r},Kv=class ax extends ir{constructor(t){var{texture:i,verticesX:s,verticesY:n}=t=wu(wu({},ax.defaultOptions),t),o=((r,t)=>{var e={};for(i in r)Vv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Ys)for(var i of Ys(r))t.indexOf(i)<0&&Wv.call(r,i)&&(e[i]=r[i]);return e})(t,["texture","verticesX","verticesY"]),s=new zv(Bt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Bt((n=wu({},o),vR(n,yR({geometry:s}))))),this._texture=i,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){var e,i,t=this.geometry;t&&({width:e,height:i}=this.texture,t.width===e&&t.height===i||(t.width=e,t.height=i,t.updateProjection()))}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,i,s,n,o,a,l){this.geometry.setCorners(t,e,i,s,n,o,a,l)}},ER=(Kv.defaultOptions={texture:P.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100},Object.defineProperty),AR=Object.defineProperties,PR=Object.getOwnPropertyDescriptors,Ks=Object.getOwnPropertySymbols,qv=Object.prototype.hasOwnProperty,Zv=Object.prototype.propertyIsEnumerable,Qv=(r,t,e)=>t in r?ER(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class CR extends ir{constructor(t){var{texture:i,verticesX:s,verticesY:n}=t,t=((r,t)=>{var e={};for(i in r)qv.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Ks)for(var i of Ks(r))t.indexOf(i)<0&&Zv.call(r,i)&&(e[i]=r[i]);return e})(t,["texture","verticesX","verticesY"]),s=new os(Bt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Bt((n=((r,t)=>{for(var e in t=t||{})qv.call(t,e)&&Qv(r,e,t[e]);if(Ks)for(var e of Ks(t))Zv.call(t,e)&&Qv(r,e,t[e]);return r})({},t),AR(n,PR({geometry:s,texture:i}))))),this.texture=i,this.autoResize=!0}textureUpdated(){var t=this.geometry,{width:e,height:i}=this.texture;!this.autoResize||t.width===e&&t.height===i||(t.width=e,t.height=i,t.build({}))}set texture(t){var e;null!=(e=this._texture)&&e.off("update",this.textureUpdated,this),(super.texture=t).on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var OR=Object.defineProperty,Jv=Object.getOwnPropertySymbols,GR=Object.prototype.hasOwnProperty,BR=Object.prototype.propertyIsEnumerable,ty=(r,t,e)=>t in r?OR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ey=(r,t)=>{for(var e in t=t||{})GR.call(t,e)&&ty(r,e,t[e]);if(Jv)for(var e of Jv(t))BR.call(t,e)&&ty(r,e,t[e]);return r},ry=class lx extends oe{constructor(t){var{width:t,points:i,textureScale:s}=ey(ey({},lx.defaultOptions),t);super({positions:new Float32Array(4*i.length),uvs:new Float32Array(4*i.length),indices:new Uint32Array(6*(i.length-1))}),this.points=i,this._width=t,this.textureScale=s,this._build()}get width(){return this._width}_build(){var t=this.points;if(t){var e=this.getBuffer("aPosition"),i=this.getBuffer("aUV"),s=this.getIndex();if(!(t.length<1)){e.data.length/4!==t.length&&(e.data=new Float32Array(4*t.length),i.data=new Float32Array(4*t.length),s.data=new Uint16Array(6*(t.length-1)));var n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,l=t[0];var u=this._width*this.textureScale,c=t.length;for(let p=0;pt in r?IR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ru=(r,t)=>{for(var e in t=t||{})sy.call(t,e)&&oy(r,e,t[e]);if(qs)for(var e of qs(t))ny.call(t,e)&&oy(r,e,t[e]);return r},LR=((ry=class ux extends ir{constructor(t){var{texture:i,points:s,textureScale:n}=t=Ru(Ru({},ux.defaultOptions),t),t=((r,t)=>{var e={};for(i in r)sy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&qs)for(var i of qs(r))t.indexOf(i)<0&&ny.call(r,i)&&(e[i]=r[i]);return e})(t,["texture","points","textureScale"]),s=new iy(Bt({width:i.height,points:s,textureScale:n}));0t in r?LR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;class VR extends ir{constructor(t){var{texture:i,vertices:s,uvs:n,indices:o,topology:a}=t,t=((r,t)=>{var e={};for(i in r)ly.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Zs)for(var i of Zs(r))t.indexOf(i)<0&&uy.call(r,i)&&(e[i]=r[i]);return e})(t,["texture","vertices","uvs","indices","topology"]),s=new oe(Bt({positions:s,uvs:n,indices:o,topology:a}));super(Bt((n=((r,t)=>{for(var e in t=t||{})ly.call(t,e)&&cy(r,e,t[e]);if(Zs)for(var e of Zs(t))uy.call(t,e)&&cy(r,e,t[e]);return r})({},t),NR(n,HR({texture:i,geometry:s}))))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}}var YR=Object.defineProperty,hy=Object.getOwnPropertySymbols,KR=Object.prototype.hasOwnProperty,qR=Object.prototype.propertyIsEnumerable,dy=(r,t,e)=>t in r?YR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,py=(r,t)=>{for(var e in t=t||{})KR.call(t,e)&&dy(r,e,t[e]);if(hy)for(var e of hy(t))qR.call(t,e)&&dy(r,e,t[e]);return r},fy=class ku{constructor(t){t instanceof P?(this.texture=t,fi(this,ku.defaultOptions,{})):fi(this,py(py({},ku.defaultOptions),t),{})}get alpha(){return this._alpha}set alpha(t){this._alpha=Math.min(Math.max(t,0),1),this._updateColor()}get tint(){return Be(this._tint)}set tint(t){this._tint="number"==typeof t?t:X.shared.setValue(null!=t?t:16777215).toBgrNumber(),this._updateColor()}_updateColor(){this.color=this._tint+((255*this._alpha|0)<<24)}};const Mu={vertex:{attributeName:"aVertex",format:"float32x2",code:` + const texture = p.texture; + const sx = p.scaleX; + const sy = p.scaleY; + const ax = p.anchorX; + const ay = p.anchorY; + const trim = texture.trim; + const orig = texture.orig; + + if (trim) + { + w1 = trim.x - (ax * orig.width); + w0 = w1 + trim.width; + + h1 = trim.y - (ay * orig.height); + h0 = h1 + trim.height; + } + else + { + w1 = -ax * (orig.width); + w0 = w1 + orig.width; + + h1 = -ay * (orig.height); + h0 = h1 + orig.height; + } + + f32v[offset] = w1 * sx; + f32v[offset + 1] = h1 * sy; + + f32v[offset + stride] = w0 * sx; + f32v[offset + stride + 1] = h1 * sy; + + f32v[offset + (stride * 2)] = w0 * sx; + f32v[offset + (stride * 2) + 1] = h0 * sy; + + f32v[offset + (stride * 3)] = w1 * sx; + f32v[offset + (stride * 3) + 1] = h0 * sy; + `,dynamic:!(fy.defaultOptions={anchorX:0,anchorY:0,x:0,y:0,scaleX:1,scaleY:1,rotation:0,tint:16777215,alpha:1})},position:{attributeName:"aPosition",format:"float32x2",code:` + var x = p.x; + var y = p.y; + + f32v[offset] = x; + f32v[offset + 1] = y; + + f32v[offset + stride] = x; + f32v[offset + stride + 1] = y; + + f32v[offset + (stride * 2)] = x; + f32v[offset + (stride * 2) + 1] = y; + + f32v[offset + (stride * 3)] = x; + f32v[offset + (stride * 3) + 1] = y; + `,dynamic:!0},rotation:{attributeName:"aRotation",format:"float32",code:` + var rotation = p.rotation; + + f32v[offset] = rotation; + f32v[offset + stride] = rotation; + f32v[offset + (stride * 2)] = rotation; + f32v[offset + (stride * 3)] = rotation; + `,dynamic:!1},uvs:{attributeName:"aUV",format:"float32x2",code:` + var uvs = p.texture.uvs; + + f32v[offset] = uvs.x0; + f32v[offset + 1] = uvs.y0; + + f32v[offset + stride] = uvs.x1; + f32v[offset + stride + 1] = uvs.y1; + + f32v[offset + (stride * 2)] = uvs.x2; + f32v[offset + (stride * 2) + 1] = uvs.y2; + + f32v[offset + (stride * 3)] = uvs.x3; + f32v[offset + (stride * 3) + 1] = uvs.y3; + `,dynamic:!1},color:{attributeName:"aColor",format:"unorm8x4",code:` + const c = p.color; + + u32v[offset] = c; + u32v[offset + stride] = c; + u32v[offset + (stride * 2)] = c; + u32v[offset + (stride * 3)] = c; + `,dynamic:!1}};var QR=Object.defineProperty,JR=Object.defineProperties,tM=Object.getOwnPropertyDescriptors,Qs=Object.getOwnPropertySymbols,my=Object.prototype.hasOwnProperty,gy=Object.prototype.propertyIsEnumerable,_y=(r,t,e)=>t in r?QR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,or=(r,t)=>{for(var e in t=t||{})my.call(t,e)&&_y(r,e,t[e]);if(Qs)for(var e of Qs(t))gy.call(t,e)&&_y(r,e,t[e]);return r},by=(r,t)=>JR(r,tM(t));const rM=new nt(0,0,0,0),vy=class $u extends Lt{constructor(t={}){var{dynamicProperties:i,shader:s,roundPixels:n,texture:o,particles:a}=t=by(or(or({},$u.defaultOptions),t),{dynamicProperties:or(or({},$u.defaultOptions.dynamicProperties),null==t?void 0:t.dynamicProperties)}),t=((r,t)=>{var e={};for(i in r)my.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Qs)for(var i of Qs(r))t.indexOf(i)<0&&gy.call(r,i)&&(e[i]=r[i]);return e})(t,["dynamicProperties","shader","roundPixels","texture","particles"]);super(or({label:"ParticleContainer"},t)),this.renderPipeId="particle",this.batched=!1,this._childrenDirty=!1,this.texture=o||null,this.shader=s,this._properties={};for(const u in Mu){var c=Mu[u],d=i[u];this._properties[u]=by(or({},c),{dynamic:d})}this.allowChildren=!0,this.roundPixels=null!=n&&n,this.particleChildren=null!=a?a:[]}addParticle(...t){for(let e=0;et in r?sM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sy=class cx extends Lt{constructor(t){var{width:f,height:m,anchor:_,leftWidth:g,rightWidth:b,topHeight:x,bottomHeight:y,texture:T,roundPixels:A}=t=t instanceof P?{texture:t}:t;super(((r,t)=>{for(var e in t=t||{})yy.call(t,e)&&Ty(r,e,t[e]);if(Js)for(var e of Js(t))xy.call(t,e)&&Ty(r,e,t[e]);return r})({label:"NineSliceSprite"},((r,t)=>{var e={};for(i in r)yy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Js)for(var i of Js(r))t.indexOf(i)<0&&xy.call(r,i)&&(e[i]=r[i]);return e})(t,["width","height","anchor","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]))),this.renderPipeId="nineSliceSprite",this.batched=!0,this._leftWidth=null!=(g=null!=g?g:null==(t=null==T?void 0:T.defaultBorders)?void 0:t.left)?g:ae.defaultOptions.leftWidth,this._topHeight=null!=(g=null!=x?x:null==(t=null==T?void 0:T.defaultBorders)?void 0:t.top)?g:ae.defaultOptions.topHeight,this._rightWidth=null!=(t=null!=b?b:null==(x=null==T?void 0:T.defaultBorders)?void 0:x.right)?t:ae.defaultOptions.rightWidth,this._bottomHeight=null!=(b=null!=y?y:null==(g=null==T?void 0:T.defaultBorders)?void 0:g.bottom)?b:ae.defaultOptions.bottomHeight,this._width=null!=(x=null!=f?f:T.width)?x:ae.defaultOptions.width,this._height=null!=(t=null!=m?m:T.height)?t:ae.defaultOptions.height,this.allowChildren=!1,this.texture=null!=T?T:cx.defaultOptions.texture,this.roundPixels=null!=A&&A,this._anchor=new rt({_onUpdate:()=>{this.onViewUpdate()}}),_?this.anchor=_:this.texture.defaultAnchor&&(this.anchor=this.texture.defaultAnchor)}get anchor(){return this._anchor}set anchor(t){"number"==typeof t?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return this._width}set width(t){this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this._height=t,this.onViewUpdate()}setSize(t,e){var i;"object"==typeof t&&(e=null!=(i=t.height)?i:t.width,t=t.width),this._width=t,this._height=null!=e?e:t,this.onViewUpdate()}getSize(t){return(t=t||{}).width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t=t||P.EMPTY;var 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.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}destroy(t){super.destroy(t),("boolean"==typeof t?t:null!=t&&t.texture)&&(t="boolean"==typeof t?t:null==t?void 0:t.textureSource,this._texture.destroy(t)),this._texture=null}updateBounds(){var t=this._bounds,e=this._anchor,i=this._width,s=this._height;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*s,t.maxY=t.minY+s}};Sy.defaultOptions={texture:P.EMPTY};const Ay={};var pM=Object.defineProperty,fM=Object.defineProperties,mM=Object.getOwnPropertyDescriptors,Py=Object.getOwnPropertySymbols,gM=Object.prototype.hasOwnProperty,_M=Object.prototype.propertyIsEnumerable,wy=(r,t,e)=>t in r?pM(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ry=(r,t)=>{for(var e in t=t||{})gM.call(t,e)&&wy(r,e,t[e]);if(Py)for(var e of Py(t))_M.call(t,e)&&wy(r,e,t[e]);return r};const vM=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let yM=0;return h.AbstractBitmapFont=sa,h.AbstractRenderer=Ur,h.AbstractText=Os,h.AccessibilitySystem=Cc,h.AlphaFilter=Cg,h.AlphaMask=kn,h.AlphaMaskPipe=dl,h.AnimatedSprite=Yr,h.Application=Bd,h.ApplicationInitHook=Ra,h.Assets=Hr,h.AssetsClass=Zm,h.BLEND_TO_NPM=Uh,h.BUFFER_TYPE=qr,h.BackgroundLoader=mm,h.BackgroundSystem=yb,h.Batch=Hh,h.BatchGeometry=Kh,h.BatchTextureArray=kh,h.BatchableGraphics=Ui,h.BatchableMesh=Vi,h.BatchableSprite=Pr,h.Batcher=Ei,h.BatcherPipe=y_,h.BigPool=N,h.BindGroup=Ht,h.BindGroupSystem=uu,h.BitmapFont=Ca,h.BitmapFontManager=Ir,h.BitmapText=P_,h.BitmapTextPipe=ua,h.BlendModeFilter=class extends bg{constructor(t){var e=t.gpu,e=Ag(Eg({source:xg},e)),e=gt.from({vertex:{source:e,entryPoint:"mainVertex"},fragment:{source:e,entryPoint:"mainFragment"}}),t=t.gl,t=Ag(Eg({source:vg},t));super({gpuProgram:e,glProgram:Tt.from({vertex:yg,fragment:t}),blendRequired:!0,resources:{blendUniforms:new st({uBlend:{value:1,type:"f32"}}),uBackTexture:P.EMPTY}})}},h.BlendModePipe=Zl,h.BlurFilter=Hg,h.BlurFilterPass=Ts,h.Bounds=nt,h.BrowserAdapter=bh,h.Buffer=ht,h.BufferImageSource=pi,h.BufferResource=Us,h.BufferUsage=L,h.CLEAR=bt,h.Cache=W,h.CanvasPool=Xt,h.CanvasPoolClass=pp,h.CanvasSource=Nt,h.CanvasTextMetrics=jt,h.CanvasTextPipe=Fo,h.CanvasTextSystem=ea,h.Circle=Yi,h.Color=X,h.ColorMask=$n,h.ColorMaskPipe=pl,h.ColorMatrixFilter=class extends bg{constructor(t={}){var e=new st({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),i=gt.from({vertex:{source:tl,entryPoint:"mainVertex"},fragment:{source:tl,entryPoint:"mainFragment"}}),s=Tt.from({vertex:ys,fragment:Xg,name:"color-matrix-filter"});super((t=((r,t)=>{for(var e in t=t||{})oA.call(t,e)&&zg(r,e,t[e]);if(jg)for(var e of jg(t))aA.call(t,e)&&zg(r,e,t[e]);return r})({},t),sA(t,nA({gpuProgram:i,glProgram:s,resources:{colorMatrixUniforms:e}})))),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.matrix,t),i=this._colorMatrix(i)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=i,this.resources.colorMatrixUniforms.update()}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){return(t=new Float32Array(t))[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t}brightness(t,e){this._loadMatrix([t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0],e)}tint(t,e){var[t,s,n]=X.shared.setValue(t).toArray();this._loadMatrix([t,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0],e)}greyscale(t,e){this._loadMatrix([t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0],e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)}hue(t,e){t=(t||0)/180*Math.PI;var i=Math.cos(t),t=Math.sin(t),o=1/3,a=(0,Math.sqrt)(o);this._loadMatrix([i+(1-i)*o,o*(1-i)-a*t,o*(1-i)+a*t,0,0,o*(1-i)+a*t,i+o*(1-i),o*(1-i)-a*t,0,0,o*(1-i)-a*t,o*(1-i)+a*t,i+o*(1-i),0,0,0,0,0,1,0],e)}contrast(t,e){var s=-.5*((t=(t||0)+1)-1);this._loadMatrix([t,0,0,0,s,0,t,0,0,s,0,0,t,0,s,0,0,0,1,0],e)}saturate(t=0,e){var s=-.5*((t=2*t/3+1)-1);this._loadMatrix([t,s,s,0,0,s,t,s,0,0,s,s,t,0,0,0,0,0,1,0],e)}desaturate(){this.saturate(-1)}negative(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)}sepia(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)}technicolor(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)}polaroid(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)}toBGR(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)}kodachrome(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)}browni(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)}vintage(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;var[i,l,u]=(o=X.shared).setValue(i).toArray(),[o,s,p]=o.setValue(s).toArray();this._loadMatrix([.3,.59,.11,0,0,i,l,u,t,0,o,s,p,e,0,i-o,l-s,u-p,0,0],n)}night(t,e){this._loadMatrix([-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0],e)}predator(t,e){this._loadMatrix([11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0],e)}lsd(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}},h.CompressedSource=Xr,h.Container=lt,h.Culler=pg,h.CullerPlugin=fg,h.CustomRenderPipe=jl,h.D3D10_RESOURCE_DIMENSION=za,h.D3DFMT=vt,h.DATA_URI=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,h.DDS=F,h.DEG_TO_RAD=nc,h.DEPRECATED_SCALE_MODES=Pu,h.DEPRECATED_WRAP_MODES=Au,h.DOMAdapter=H,h.DOMContainer=G0,h.DOMPipe=In,h.DRAW_MODES=Xw,h.DXGI_FORMAT=ja,h.DXGI_TO_TEXTURE_FORMAT=yt,h.DefaultBatcher=Fi,h.DefaultShader=kd,h.DisplacementFilter=class extends bg{constructor(...t){var e=t[0],{sprite:t,scale:n}=e=e instanceof Ft?{sprite:e,scale:t[1]}:e,o=((r,t)=>{var e={};for(i in r)Yg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(null!=r&&Es)for(var i of Es(r))t.indexOf(i)<0&&Kg.call(r,i)&&(e[i]=r[i]);return e})(e,["sprite","scale"]);let a=null!=n?n:20;"number"==typeof a&&(a=new V(a,a));var n=new st({uFilterMatrix:{value:new M,type:"mat3x3"},uScale:{value:a,type:"vec2"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2"}}),u=Tt.from({vertex:Wg,fragment:Vg,name:"displacement-filter"}),c=gt.from({vertex:{source:el,entryPoint:"mainVertex"},fragment:{source:el,entryPoint:"mainFragment"}}),t=t.texture.source;super(((r,t)=>dA(r,pA(t)))(((r,t)=>{for(var e in t=o||{})Yg.call(t,e)&&qg(r,e,t[e]);if(Es)for(var e of Es(t))Kg.call(t,e)&&qg(r,e,t[e]);return r})({}),{gpuProgram:c,glProgram:u,resources:{filterUniforms:n,uMapTexture:t,uMapSampler:t.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,i,s){var n=this.resources.filterUniforms.uniforms,o=(t.calculateSpriteMatrix(n.uFilterMatrix,this._sprite),this._sprite.worldTransform),a=Math.sqrt(o.a*o.a+o.b*o.b),l=Math.sqrt(o.c*o.c+o.d*o.d);0!==a&&0!==l&&(n.uRotation[0]=o.a/a,n.uRotation[1]=o.b/a,n.uRotation[2]=o.c/l,n.uRotation[3]=o.d/l),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,i,s)}get scale(){return this.resources.filterUniforms.uniforms.uScale}},h.DynamicBitmapFont=oa,h.Ellipse=Ki,h.EventBoundary=hh,h.EventEmitter=ft,h.EventSystem=Bn,h.EventsTicker=Kt,h.ExtensionType=r,h.ExtractSystem=Xb,h.FOURCC_TO_TEXTURE_FORMAT=Va,h.FederatedContainer=ch,h.FederatedEvent=Fe,h.FederatedMouseEvent=mr,h.FederatedPointerEvent=Mt,h.FederatedWheelEvent=_e,h.FillGradient=Qt,h.FillPattern=wr,h.Filter=bg,h.FilterEffect=hr,h.FilterPipe=ya,h.FilterSystem=xa,h.FontStylePromiseCache=Fr,h.GAUSSIAN_VALUES=Qa,h.GL_FORMATS=Fs,h.GL_INTERNAL_FORMAT=ng,h.GL_TARGETS=bl,h.GL_TYPES=j,h.GL_WRAP_MODES=U_,h.GenerateTextureSystem=eu,h.Geometry=ye,h.GlBackBufferSystem=X_,h.GlBatchAdaptor=ll,h.GlBuffer=G_,h.GlBufferSystem=ml,h.GlColorMaskSystem=xl,h.GlContextSystem=gl,h.GlEncoderSystem=Tl,h.GlGeometrySystem=vl,h.GlGraphicsAdaptor=Hl,h.GlMeshAdaptor=Xl,h.GlParticleContainerAdaptor=np,h.GlParticleContainerPipe=Bo,h.GlProgram=Tt,h.GlProgramData=ab,h.GlRenderTarget=j_,h.GlRenderTargetAdaptor=Z_,h.GlRenderTargetSystem=Ol,h.GlShaderSystem=Dl,h.GlStateSystem=nb,h.GlStencilSystem=Sl,h.GlTexture=Tb,h.GlTextureSystem=Nl,h.GlUboSystem=Rl,h.GlUniformGroupSystem=Ul,h.GlobalUniformSystem=ru,h.GpuBatchAdaptor=ul,h.GpuBlendModesToPixi=pt,h.GpuBufferSystem=cu,h.GpuColorMaskSystem=hu,h.GpuDeviceSystem=zs,h.GpuEncoderSystem=du,h.GpuGraphicsAdaptor=Su,h.GpuGraphicsContext=ip,h.GpuMeshAdapter=Eu,h.GpuMipmapGenerator=Pv,h.GpuParticleContainerAdaptor=dp,h.GpuParticleContainerPipe=Io,h.GpuProgram=gt,h.GpuReadBuffer=function(r,t){const e=r.descriptor.size,i=t.gpu.device,s=new ht({data:new Float32Array(24e5),usage:L.MAP_READ|L.COPY_DST}),n=t.buffer.createGPUBuffer(s),o=i.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),i.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})},h.GpuRenderTarget=xv,h.GpuRenderTargetAdaptor=Tv,h.GpuRenderTargetSystem=_u,h.GpuShaderSystem=bu,h.GpuStateSystem=vu,h.GpuStencilModesToPixi=te,h.GpuStencilSystem=pu,h.GpuTextureSystem=Tu,h.GpuUboSystem=fu,h.GpuUniformBatchPipe=mu,h.Graphics=Ze,h.GraphicsContext=dt,h.GraphicsContextRenderData=sp,h.GraphicsContextSystem=zi,h.GraphicsPath=se,h.GraphicsPipe=Ro,h.HTMLText=w_,h.HTMLTextPipe=ca,h.HTMLTextRenderData=pa,h.HTMLTextStyle=Ae,h.HTMLTextSystem=is,h.HelloSystem=js,h.IGLUniformData=class{},h.ImageSource=ie,h.InstructionSet=bn,h.KTX=tt,h.Loader=Pm,h.LoaderParserPriority=xt,h.MSAA_QUALITY=Ov,h.MaskEffectManager=li,h.MaskEffectManagerClass=cc,h.MaskFilter=a_,h.Matrix=M,h.Mesh=ir,h.MeshGeometry=oe,h.MeshPipe=Mo,h.MeshPlane=CR,h.MeshRope=ry,h.MeshSimple=VR,h.NOOP=Tn,h.NineSliceGeometry=ae,h.NineSlicePlane=class extends Sy{constructor(...t){var e=t[0];super(e instanceof P?{texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}:e)}},h.NineSliceSprite=Sy,h.NineSliceSpritePipe=va,h.NoiseFilter=kg,h.ObservablePoint=rt,h.PI_2=ic,h.Particle=fy,h.ParticleBuffer=lp,h.ParticleContainer=iM,h.ParticleContainerPipe=Go,h.ParticleShader=hp,h.PerspectiveMesh=Kv,h.PerspectivePlaneGeometry=zv,h.PipelineSystem=gu,h.PlaneGeometry=os,h.Point=V,h.Polygon=Ye,h.Pool=ai,h.PoolGroupClass=oc,h.PrepareBase=l_,h.PrepareQueue=A_,h.PrepareSystem=M_,h.PrepareUpload=R_,h.QuadGeometry=Xf,h.RAD_TO_DEG=sc,h.Rectangle=z,h.RenderContainer=rR,h.RenderGroup=Hc,h.RenderGroupPipe=zl,h.RenderGroupSystem=Yl,h.RenderLayer=dR,h.RenderLayerClass=kv,h.RenderTarget=Ds,h.RenderTargetSystem=Cl,h.RenderTexture=Xs,h.RenderableGCSystem=su,h.RendererInitHook=Ma,h.RendererType=_t,h.ResizePlugin=Cn,h.Resolver=re,h.RopeGeometry=iy,h.RoundedRectangle=Zi,h.SCALE_MODES=Ww,h.STENCIL_MODES=J,h.SVGParser=Up,h.SchedulerSystem=iu,h.ScissorMask=class{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){Ti(this.mask,t,e)}addLocalBounds(t,e){Si(this.mask,t,e)}containsPoint(t,e){return e(this.mask,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}},h.SdfShader=lf,h.Shader=St,h.ShaderStage=Ne,h.ShapePath=Gp,h.SharedRenderPipes=lu,h.SharedSystems=au,h.Sprite=Ft,h.SpritePipe=Kl,h.Spritesheet=Fn,h.State=Et,h.StencilMask=Ln,h.StencilMaskPipe=fl,h.SystemRunner=Aa,h.TEXTURE_FORMAT_BLOCK_SIZE=ig,h.Text=al,h.TextStyle=Pt,h.Texture=P,h.TextureGCSystem=nu,h.TextureMatrix=Sn,h.TexturePool=it,h.TexturePoolClass=Nc,h.TextureSource=Q,h.TextureStyle=yn,h.TextureUvs=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){var o,a,l,u,s=e.width,e=e.height;i?(o=t.width/2/s,a=t.height/2/e,l=t.x/s+o,u=t.y/e+a,i=$.add(i,$.NW),this.x0=l+o*$.uX(i),this.y0=u+a*$.uY(i),i=$.add(i,2),this.x1=l+o*$.uX(i),this.y1=u+a*$.uY(i),i=$.add(i,2),this.x2=l+o*$.uX(i),this.y2=u+a*$.uY(i),i=$.add(i,2),this.x3=l+o*$.uX(i),this.y3=u+a*$.uY(i)):(this.x0=t.x/s,this.y0=t.y/e,this.x1=(t.x+t.width)/s,this.y1=t.y/e,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/e,this.x3=t.x/s,this.y3=(t.y+t.height)/e),this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}},h.Ticker=ut,h.TickerListener=bi,h.TickerPlugin=On,h.TilingSprite=x_,h.TilingSpritePipe=ba,h.TilingSpriteShader=Hf,h.Transform=g_,h.Triangle=class ol{constructor(t=0,e=0,i=0,s=0,n=0,o=0){this.type="triangle",this.x=t,this.y=e,this.x2=i,this.y2=s,this.x3=n,this.y3=o}contains(t,e){var i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),s=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);return!(i<0!=s<0&&0!=i&&0!=s||0!=(e=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2))&&e<0!=i+s<=0)}strokeContains(t,e,i,s=0){var i=(i/=2)*i,{x:a,x2:l,x3:u,y:c,y2:d,y3:p}=this;return Rr(t,e,a,c,l,p)<=i||Rr(t,e,l,d,u,p)<=i||Rr(t,e,u,p,a,c)<=i}clone(){return new ol(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t=t||new z;var e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),s=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=s,t.width=i-e,t.height=n-s,t}},h.UNIFORM_TO_ARRAY_SETTERS=_b,h.UNIFORM_TO_SINGLE_SETTERS=gb,h.UNIFORM_TYPES_MAP=Rd,h.UNIFORM_TYPES_VALUES=ao,h.UPDATE_BLEND=mi,h.UPDATE_COLOR=fr,h.UPDATE_PRIORITY=Yt,h.UPDATE_TRANSFORM=8,h.UPDATE_VISIBLE=Ie,h.UboBatch=dv,h.UboSystem=El,h.UniformGroup=st,h.VERSION=Nr,h.VideoSource=vr,h.ViewContainer=Lt,h.ViewSystem=ou,h.ViewableBuffer=ve,h.WGSL_ALIGN_SIZE_DATA=Qr,h.WGSL_TO_STD40_SIZE=Al,h.WRAP_MODES=Vw,h.WebGLRenderer=hv,h.WebGPURenderer=Cv,h.WorkerManager=Da,h._getGlobalBounds=mn,h.accessibilityTarget=Mn,h.addBits=to,h.addMaskBounds=Ti,h.addMaskLocalBounds=Si,h.addProgramDefines=Qh,h.alphaFrag=Pg,h.alphaWgsl=qa,h.applyMatrix=zf,h.applyProjectiveTransformationToPlane=Lv,h.applyStyleParams=Ll,h.assignWithIgnore=fi,h.autoDetectEnvironment=async function(r){return Sa(!r)},h.autoDetectRenderer=lm,h.autoDetectSource=function(r={}){return zn(r)},h.basisTranscoderUrls=ms,h.bgr2rgb=Be,h.bitmapFontCachePlugin=pm,h.bitmapFontTextParser=ls,h.bitmapFontXMLParser=Oa,h.bitmapFontXMLStringParser=Ga,h.blendTemplateFrag=vg,h.blendTemplateVert=yg,h.blendTemplateWgsl=xg,h.blockDataMap=yu,h.blurTemplateWgsl=Ig,h.boundsPool=$t,h.browserExt=GE,h.buildAdaptiveBezier=$o,h.buildAdaptiveQuadratic=Pp,h.buildArc=Ho,h.buildArcTo=wp,h.buildArcToSvg=Mp,h.buildCircle=Zt,h.buildContextBatches=ep,h.buildEllipse=Xd,h.buildGeometryFromPath=function(r){r instanceof se&&(r={path:r,textureMatrix:null,out:null});const t=[],e=[],i=[],s=r.path.shapePath,n=r.textureMatrix;return s.shapePrimitives.forEach(({shape:a,transform:l})=>{var u=i.length,c=t.length/2,d=[],p=aR[a.type],a=(p.build(a,d),l&&Di(d,l),p.triangulate(d,t,2,c,i,u),e.length/2);n?(l&&n.append(l.clone().invert()),lo(t,2,c,e,a,2,t.length/2-c,n)):uo(e,a,2,t.length/2-c)}),(r=r.out)?(r.positions=new Float32Array(t),r.uvs=new Float32Array(e),r.indices=new Uint32Array(i),r):new oe({positions:new Float32Array(t),uvs:new Float32Array(e),indices:new Uint32Array(i)})},h.buildLine=Wd,h.buildPixelLine=Yd,h.buildPolygon=_o,h.buildRectangle=bo,h.buildRoundedRectangle=jd,h.buildSimpleUvs=uo,h.buildTriangle=vo,h.buildUvs=lo,h.cacheAsTextureMixin=ac,h.cacheTextureArray=$i,h.calculateProjection=Q_,h.checkChildrenDidChange=_n,h.checkDataUrl=Pe,h.checkExtension=Gt,h.checkMaxIfStatementsInShader=Fh,h.childrenHelperMixin=ln,h.cleanArray=Kb,h.cleanHash=Yb,h.clearList=Hs,h.closePointEps=co,h.collectAllRenderables=function(r,t,e){return e=e.renderPipes?e:e.batch.renderer,r.collectRenderables(t,e,null)},h.collectRenderablesMixin=uc,h.color32BitToUniform=We,h.colorBit=Mi,h.colorBitGl=Ci,h.colorMatrixFilterFrag=Xg,h.colorMatrixFilterWgsl=tl,h.colorToUniform=function(r,t,e,i){e[i++]=(r>>16&255)/255,e[i++]=(r>>8&255)/255,e[i++]=(255&r)/255,e[i++]=t},h.compareModeToGlCompare=wb,h.compileHighShader=gd,h.compileHighShaderGl=_d,h.compileHighShaderGlProgram=Xe,h.compileHighShaderGpuProgram=He,h.compileHooks=eo,h.compileInputs=ro,h.compileOutputs=md,h.compileShader=Gl,h.compute2DProjection=jv,h.convertFormatIfRequired=function(r){var t=r.format;if(Wa[t]){var e=Wa[t].convertFunction,i=r.resource;for(let s=0;si.trim()).filter(i=>i.length);let e="";return r.map(i=>{let s=e+i;return"{"===i?e+=" ":"}"===i&&(e=e.substr(0,e.length-4),s=e+i),s}).join(` +`)},h.fragmentGPUTemplate=xd,h.fragmentGlTemplate=Sd,h.generateArraySyncSTD40=K_,h.generateArraySyncWGSL=_v,h.generateBlurFragSource=Og,h.generateBlurGlProgram=Bg,h.generateBlurProgram=Fg,h.generateBlurVertSource=Gg,h.generateGPULayout=function(r){var t=[];let e=0;for(let i=0;i) -> f32 { + return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b; +} + +fn setLuminosity(c: vec3, lum: f32) -> vec3 { + let d: f32 = lum - getLuminosity(c); + let newColor: vec3 = c.rgb + vec3(d, d, d); + + // clip back into legal range + let newLum: f32 = getLuminosity(newColor); + let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b)); + let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b)); + + let t1: f32 = newLum / (newLum - cMin); + let t2: f32 = (1.0 - newLum) / (cMax - newLum); + + let finalColor = mix(vec3(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0)); + + return finalColor; +} + +fn getSaturation(c: vec3) -> f32 { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); +} + +// Set saturation if color components are sorted in ascending order. +fn setSaturationMinMidMax(cSorted: vec3, s: f32) -> vec3 { + var result: vec3; + if (cSorted.z > cSorted.x) { + let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x)); + result = vec3(0.0, newY, s); + } else { + result = vec3(0.0, 0.0, 0.0); + } + return vec3(result.x, result.y, result.z); +} + +fn setSaturation(c: vec3, s: f32) -> vec3 { + var result: vec3 = c; + + if (c.r <= c.g && c.r <= c.b) { + if (c.g <= c.b) { + result = setSaturationMinMidMax(result, s); + } else { + var temp: vec3 = vec3(result.r, result.b, result.g); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.r, temp.b, temp.g); + } + } else if (c.g <= c.r && c.g <= c.b) { + if (c.r <= c.b) { + var temp: vec3 = vec3(result.g, result.r, result.b); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.g, temp.r, temp.b); + } else { + var temp: vec3 = vec3(result.g, result.b, result.r); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.g, temp.b, temp.r); + } + } else { + if (c.r <= c.g) { + var temp: vec3 = vec3(result.b, result.r, result.g); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.b, temp.r, temp.g); + } else { + var temp: vec3 = vec3(result.b, result.g, result.r); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.b, temp.g, temp.r); + } + } + + return result; +}`,h.hslgl=` + float getLuminosity(vec3 c) { + return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b; + } + + vec3 setLuminosity(vec3 c, float lum) { + float modLum = lum - getLuminosity(c); + vec3 color = c.rgb + vec3(modLum); + + // clip back into legal range + modLum = getLuminosity(color); + vec3 modLumVec = vec3(modLum); + + float cMin = min(color.r, min(color.g, color.b)); + float cMax = max(color.r, max(color.g, color.b)); + + if(cMin < 0.0) { + color = mix(modLumVec, color, modLum / (modLum - cMin)); + } + + if(cMax > 1.0) { + color = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum)); + } + + return color; + } + + float getSaturation(vec3 c) { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); + } + + vec3 setSaturationMinMidMax(vec3 cSorted, float s) { + vec3 colorSorted = cSorted; + + if(colorSorted.z > colorSorted.x) { + colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x)); + colorSorted.z = s; + } + else { + colorSorted.y = 0.0; + colorSorted.z = 0.0; + } + + colorSorted.x = 0.0; + + return colorSorted; + } + + vec3 setSaturation(vec3 c, float s) { + vec3 color = c; + + if(color.r <= color.g && color.r <= color.b) { + if(color.g <= color.b) { + color = setSaturationMinMidMax(color.rgb, s).rgb; + } + else { + color = setSaturationMinMidMax(color.rbg, s).rbg; + } + } + else if(color.g <= color.r && color.g <= color.b) { + if(color.r <= color.b) { + color = setSaturationMinMidMax(color.grb, s).grb; + } + else { + color = setSaturationMinMidMax(color.gbr, s).gbr; + } + } + else { + // Using bgr for both fixes part of hue + if(color.r <= color.g) { + color = setSaturationMinMidMax(color.brg, s).brg; + } + else { + color = setSaturationMinMidMax(color.bgr, s).bgr; + } + } + + return color; + } + `,h.hslgpu=` + fn getLuminosity(c: vec3) -> f32 + { + return 0.3*c.r + 0.59*c.g + 0.11*c.b; + } + + fn setLuminosity(c: vec3, lum: f32) -> vec3 + { + var modLum: f32 = lum - getLuminosity(c); + var color: vec3 = c.rgb + modLum; + + // clip back into legal range + modLum = getLuminosity(color); + let modLumVec = vec3(modLum); + + let cMin: f32 = min(color.r, min(color.g, color.b)); + let cMax: f32 = max(color.r, max(color.g, color.b)); + + if(cMin < 0.0) + { + color = mix(modLumVec, color, modLum / (modLum - cMin)); + } + + if(cMax > 1.0) + { + color = mix(modLumVec, color, (1 - modLum) / (cMax - modLum)); + } + + return color; + } + + fn getSaturation(c: vec3) -> f32 + { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); + } + + fn setSaturationMinMidMax(cSorted: vec3, s: f32) -> vec3 + { + var colorSorted = cSorted; + + if(colorSorted.z > colorSorted.x) + { + colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x)); + colorSorted.z = s; + } + else + { + colorSorted.y = 0; + colorSorted.z = 0; + } + + colorSorted.x = 0; + + return colorSorted; + } + + fn setSaturation(c: vec3, s: f32) -> vec3 + { + var color = c; + + if (color.r <= color.g && color.r <= color.b) + { + if (color.g <= color.b) + { + color = vec3(setSaturationMinMidMax(color.rgb, s)).rgb; + } + else + { + color = vec3(setSaturationMinMidMax(color.rbg, s)).rbg; + } + } + else if (color.g <= color.r && color.g <= color.b) + { + if (color.r <= color.b) + { + color = vec3(setSaturationMinMidMax(color.grb, s)).grb; + } + else + { + color = vec3(setSaturationMinMidMax(color.gbr, s)).gbr; + } + } + else + { + // Using bgr for both fixes part of hue + if (color.r <= color.g) + { + color = vec3(setSaturationMinMidMax(color.brg, s)).brg; + } + else + { + color = vec3(setSaturationMinMidMax(color.bgr, s)).bgr; + } + } + + return color; + } + `,h.injectBits=io,h.insertVersion=td,h.isMobile=rh,h.isPow2=vn,h.isRenderingToScreen=eb,h.isSafari=gf,h.isSingleItem=br,h.isWebGLSupported=kr,h.isWebGPUSupported=$r,h.ktxTranscoderUrls=gs,h.loadBasis=J2,h.loadBasisOnWorker=rg,h.loadBitmapFont=fm,h.loadDDS=uE,h.loadEnvironmentExtensions=Sa,h.loadFontAsBase64=Af,h.loadFontCSS=fa,h.loadImageBitmap=Nm,h.loadJson=wm,h.loadKTX=gE,h.loadKTX2=yE,h.loadKTX2onWorker=ug,h.loadSVGImage=Mf,h.loadSvg=Dm,h.loadTextures=Ua,h.loadTxt=Rm,h.loadVideoTextures=Km,h.loadWebFont=Gm,h.localUniformBit=Qe,h.localUniformBitGl=ss,h.localUniformBitGroup2=$f,h.localUniformMSDFBit=sf,h.localUniformMSDFBitGl=nf,h.log2=function(r){var t=(65535>>=t)?1:0)<<3;return(t|=e)|(e=(15<(r>>>=e)?1:0)<<2)|(e=(3<(r>>>=e)?1:0)<<1)|r>>>e>>1},h.logDebugTexture=async function(r,t,e=200){var i=await t.extract.base64(r),t=(await t.encoder.commandFinished,e),e=(console.log(`logging texture ${r.source.width}px ${r.source.height}px`),["font-size: 1px;",`padding: ${t}px 300px;`,`background: url(${i}) no-repeat;`,"background-size: contain;"].join(" "));console.log("%c ",e)},h.logProgramError=fb,h.logRenderGroupScene=function Cy(r,t=0,e={index:0,color:"#000000"}){let i="";for(let n=0;nfM(r,mM(t)))(Ry({},e),{index:n}))},h.logScene=function My(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=vM[yM++]);let i="";for(let o=0;o>16&255,s=r>>8&255;return(i+((t>>16&255)-i)*e<<16)+(s+((t>>8&255)-s)*e<<8)+((r&=255)+((255&t)-r)*e)},h.multiplyColors=pr,h.multiplyHexColors=gn,h.nextPow2=de,h.noiseFrag=Zg,h.noiseWgsl=rl,h.nonCompressedFormats=Jm,h.normalizeExtensionPriority=lr,h.nssvg=ha,h.nsxhtml=da,h.onRenderMixin=Sc,h.parseAttribute=Ko,h.parseDDS=sg,h.parseFunctionBody=function(r){var e=(r=r.toString()).indexOf("{"),i=r.lastIndexOf("}");if(-1===e||-1===i)throw new Error("getFunctionBody: No body found in function definition");return r.slice(e+1,i).trim()},h.parseKTX=og,h.parseSVGDefinitions=Ip,h.parseSVGFloatAttribute=Z,h.parseSVGPath=Ep,h.parseSVGStyle=Yo,h.particleData=Mu,h.particlesFrag=up,h.particlesVert=cp,h.particlesWgsl=Oo,h.path=mt,h.pointInTriangle=nl,h.preloadVideo=Wm,h.removeItems=fn,h.removeStructAndGroupDuplicates=hd,h.resetUids=function(){for(const r in cr)delete cr[r]},h.resolveCharacters=na,h.resolveCompressedTextureUrl=RE,h.resolveJsonUrl=qm,h.resolveTextureUrl=$a,h.resourceToTexture=Bh,h.roundPixelsBit=je,h.roundPixelsBitGl=ze,h.roundedShapeArc=Cp,h.roundedShapeQuadraticCurve=Op,h.sayHello=Wb,h.scaleModeToGlFilter=$l,h.setBasisTranscoderPath=function(r){Object.assign(ms,r)},h.setKTXTranscoderPath=function(r){Object.assign(gs,r)},h.setPositions=jf,h.setProgramName=ed,h.setUvs=Vf,h.shapeBuilders=Ar,h.sortMixin=Ec,h.spritesheetAsset=wh,h.squaredDistanceToLineSegment=Rr,h.stripVersion=rd,h.styleAttributes=Wo,h.testImageFormat=Ba,h.testVideoFormat=us,h.textStyleToCSS=_f,h.textureBit=C_,h.textureBitGl=O_,h.textureFrom=Ih,h.tilingBit=Lf,h.tilingBitGl=Nf,h.toFillStyle=ne,h.toLocalGlobalMixin=Ac,h.toStrokeStyle=Or,h.transformVertices=Di,h.triangulateWithHoles=go,h.uboSyncFunctionsSTD40=wl,h.uboSyncFunctionsWGSL=Y_,h.uid=K,h.uniformParsers=ue,h.unpremultiplyAlpha=function(r){var t=(r=r instanceof Uint8ClampedArray?new Uint8Array(r.buffer):r).length;for(let e=0;e