route-graphics 0.0.2-rc8 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/RouteGraphics.js +581 -90
  2. package/package.json +3 -3
@@ -1,9 +1,9 @@
1
- var UT=Object.create;var Bc=Object.defineProperty;var DT=Object.getOwnPropertyDescriptor;var OT=Object.getOwnPropertyNames;var LT=Object.getPrototypeOf,NT=Object.prototype.hasOwnProperty;var p=(i,t)=>()=>(i&&(t=i(i=0)),t);var Rc=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ud=(i,t)=>{for(var e in t)Bc(i,e,{get:t[e],enumerable:!0})},HT=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of OT(t))!NT.call(i,s)&&s!==e&&Bc(i,s,{get:()=>t[s],enumerable:!(r=DT(t,s))||r.enumerable});return i};var Jo=(i,t,e)=>(e=i!=null?UT(LT(i)):{},HT(t||!i||!i.__esModule?Bc(e,"default",{value:i,enumerable:!0}):e,i));var x,Gc,Ji,I,P=p(()=>{"use strict";x=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(x||{}),Gc=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Ji=(i,t)=>Gc(i).priority??t,I={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Gc).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Gc).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>Ji(n.value,e)-Ji(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>Ji(o,e)-Ji(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var Od=Rc((AP,Ic)=>{"use strict";var WT=Object.prototype.hasOwnProperty,Ft="~";function ts(){}Object.create&&(ts.prototype=Object.create(null),new ts().__proto__||(Ft=!1));function zT(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Dd(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new zT(e,r||i,s),n=Ft?Ft+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function tn(i,t){--i._eventsCount===0?i._events=new ts:delete i._events[t]}function Gt(){this._events=new ts,this._eventsCount=0}Gt.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)WT.call(e,r)&&t.push(Ft?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};Gt.prototype.listeners=function(t){var e=Ft?Ft+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};Gt.prototype.listenerCount=function(t){var e=Ft?Ft+t:t,r=this._events[e];return r?r.fn?1:r.length:0};Gt.prototype.emit=function(t,e,r,s,o,n){var a=Ft?Ft+t:t;if(!this._events[a])return!1;var c=this._events[a],l=arguments.length,h,u;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,r),!0;case 4:return c.fn.call(c.context,e,r,s),!0;case 5:return c.fn.call(c.context,e,r,s,o),!0;case 6:return c.fn.call(c.context,e,r,s,o,n),!0}for(u=1,h=new Array(l-1);u<l;u++)h[u-1]=arguments[u];c.fn.apply(c.context,h)}else{var d=c.length,f;for(u=0;u<d;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),l){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,r);break;case 4:c[u].fn.call(c[u].context,e,r,s);break;default:if(!h)for(f=1,h=new Array(l-1);f<l;f++)h[f-1]=arguments[f];c[u].fn.apply(c[u].context,h)}}return!0};Gt.prototype.on=function(t,e,r){return Dd(this,t,e,r,!1)};Gt.prototype.once=function(t,e,r){return Dd(this,t,e,r,!0)};Gt.prototype.removeListener=function(t,e,r,s){var o=Ft?Ft+t:t;if(!this._events[o])return this;if(!e)return tn(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&tn(this,o);else{for(var a=0,c=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&c.push(n[a]);c.length?this._events[o]=c.length===1?c[0]:c:tn(this,o)}return this};Gt.prototype.removeAllListeners=function(t){var e;return t?(e=Ft?Ft+t:t,this._events[e]&&tn(this,e)):(this._events=new ts,this._eventsCount=0),this};Gt.prototype.off=Gt.prototype.removeListener;Gt.prototype.addListener=Gt.prototype.on;Gt.prefixed=Ft;Gt.EventEmitter=Gt;typeof Ic<"u"&&(Ic.exports=Gt)});var Ld,ot,It=p(()=>{Ld=Jo(Od(),1),ot=Ld.default});var VT,Oe,wt,oe,$d,Nd,kc,jT,en,Yd,Kd,Hd,Wd,zd,es,XT,$T,YT,KT,Dc,Vd,qT,Fc,Uc,jd,Oc,pe,Xd,qd,Zd=p(()=>{VT={grad:.9,turn:360,rad:360/(2*Math.PI)},Oe=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},wt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},oe=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},$d=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Nd=function(i){return{r:oe(i.r,0,255),g:oe(i.g,0,255),b:oe(i.b,0,255),a:oe(i.a)}},kc=function(i){return{r:wt(i.r),g:wt(i.g),b:wt(i.b),a:wt(i.a,3)}},jT=/^#([0-9a-f]{3,8})$/i,en=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Yd=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Kd=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),c=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,c,r][l],g:255*[c,r,r,a,n,n][l],b:255*[n,n,c,r,r,a][l],a:s}},Hd=function(i){return{h:$d(i.h),s:oe(i.s,0,100),l:oe(i.l,0,100),a:oe(i.a)}},Wd=function(i){return{h:wt(i.h),s:wt(i.s),l:wt(i.l),a:wt(i.a,3)}},zd=function(i){return Kd((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},es=function(i){return{h:(t=Yd(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},XT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$T=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,YT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,KT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dc={string:[[function(i){var t=jT.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?wt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?wt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=YT.exec(i)||KT.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:Nd({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=XT.exec(i)||$T.exec(i);if(!t)return null;var e,r,s=Hd({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(VT[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return zd(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Oe(t)&&Oe(e)&&Oe(r)?Nd({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Oe(t)||!Oe(e)||!Oe(r))return null;var n=Hd({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return zd(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Oe(t)||!Oe(e)||!Oe(r))return null;var n=function(a){return{h:$d(a.h),s:oe(a.s,0,100),v:oe(a.v,0,100),a:oe(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Kd(n)},"hsv"]]},Vd=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},qT=function(i){return typeof i=="string"?Vd(i.trim(),Dc.string):typeof i=="object"&&i!==null?Vd(i,Dc.object):[null,void 0]},Fc=function(i,t){var e=es(i);return{h:e.h,s:oe(e.s+100*t,0,100),l:e.l,a:e.a}},Uc=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},jd=function(i,t){var e=es(i);return{h:e.h,s:e.s,l:oe(e.l+100*t,0,100),a:e.a}},Oc=function(){function i(t){this.parsed=qT(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return wt(Uc(this.rgba),2)},i.prototype.isDark=function(){return Uc(this.rgba)<.5},i.prototype.isLight=function(){return Uc(this.rgba)>=.5},i.prototype.toHex=function(){return t=kc(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?en(wt(255*o)):"","#"+en(e)+en(r)+en(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return kc(this.rgba)},i.prototype.toRgbString=function(){return t=kc(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return Wd(es(this.rgba))},i.prototype.toHslString=function(){return t=Wd(es(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=Yd(this.rgba),{h:wt(t.h),s:wt(t.s),v:wt(t.v),a:wt(t.a,3)};var t},i.prototype.invert=function(){return pe({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),pe(Fc(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),pe(Fc(this.rgba,-t))},i.prototype.grayscale=function(){return pe(Fc(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),pe(jd(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),pe(jd(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?pe({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):wt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=es(this.rgba);return typeof t=="number"?pe({h:t,s:e.s,l:e.l,a:e.a}):wt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===pe(t).toHex()},i}(),pe=function(i){return i instanceof Oc?i:new Oc(i)},Xd=[],qd=function(i){i.forEach(function(t){Xd.indexOf(t)<0&&(t(Oc,Dc),Xd.push(t))})}});function Qd(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,c,l=r[this.toHex()];if(l)return l;if(n?.closest){var h=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var m in e){var g=(a=h,c=o[m],Math.pow(a.r-c.r,2)+Math.pow(a.g-c.g,2)+Math.pow(a.b-c.b,2));g<u&&(u=g,d=m)}return d}},t.string.push([function(n){var a=n.toLowerCase(),c=a==="transparent"?"#0000":e[a];return c?new i(c).toRgb():null},"name"])}var Jd=p(()=>{});var zr,V,Mt=p(()=>{Zd();Jd();qd([Qd]);zr=class rs{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof rs)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=rs._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=rs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=pe(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof rs||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};zr.shared=new zr;zr._temp=new zr;zr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;V=zr});var tf,ef=p(()=>{"use strict";tf={cullArea:null,cullable:!1,cullableChildren:!0}});var rf,sf,of,Lc=p(()=>{"use strict";rf=Math.PI*2,sf=180/Math.PI,of=Math.PI/180});var $,Nc,ne=p(()=>{"use strict";$=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Nc.x=0,Nc.y=0,Nc}},Nc=new $});var B,ZT,QT,K=p(()=>{Lc();ne();B=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new $;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new $;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,c=this.ty,l=1/(r*n+o*-s),h=t.x,u=t.y;return e.x=n*l*h+-o*l*u+(c*o-a*n)*l,e.y=r*l*u+-s*l*h+(-c*r+a*s)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,c=t.ty,l=e.a,h=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*h+s*d,this.c=o*l+n*u,this.d=o*h+n*d,this.tx=a*l+c*u+e.tx,this.ty=a*h+c*d+e.ty,this}setTransform(t,e,r,s,o,n,a,c,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-c)*n,this.d=Math.cos(a-c)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),c=Math.atan2(r,e),l=Math.abs(a+c);return l<1e-5||Math.abs(rf-l)<1e-5?(t.rotation=c,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=c),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return QT.identity()}static get shared(){return ZT.identity()}},ZT=new B,QT=new B});var Bt,rn=p(()=>{"use strict";Bt=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function X(i="default"){return Hc[i]===void 0&&(Hc[i]=-1),++Hc[i]}var Hc,Rt=p(()=>{"use strict";Hc={default:-1}});function U(i,t,e=3){if(nf[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1
+ var HP=Object.create;var qu=Object.defineProperty;var VP=Object.getOwnPropertyDescriptor;var WP=Object.getOwnPropertyNames;var zP=Object.getPrototypeOf,$P=Object.prototype.hasOwnProperty;var m=(i,t)=>()=>(i&&(t=i(i=0)),t);var Q=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),dx=(i,t)=>{for(var e in t)qu(i,e,{get:t[e],enumerable:!0})},XP=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of WP(t))!$P.call(i,s)&&s!==e&&qu(i,s,{get:()=>t[s],enumerable:!(r=VP(t,s))||r.enumerable});return i};var Fi=(i,t,e)=>(e=i!=null?HP(zP(i)):{},XP(t||!i||!i.__esModule?qu(e,"default",{value:i,enumerable:!0}):e,i));var y,Ku,nn,D,R=m(()=>{"use strict";y=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(y||{}),Ku=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},nn=(i,t)=>Ku(i).priority??t,D={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Ku).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Ku).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(i,t,e=-1){return this.handle(i,r=>{t.findIndex(o=>o.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((o,n)=>nn(n.value,e)-nn(o.value,e)))},r=>{let s=t.findIndex(o=>o.name===r.name);s!==-1&&t.splice(s,1)})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>nn(o,e)-nn(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})},mixin(i,...t){for(let e of t)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(e))}}});var px=Q((D2,Zu)=>{"use strict";var jP=Object.prototype.hasOwnProperty,be="~";function an(){}Object.create&&(an.prototype=Object.create(null),new an().__proto__||(be=!1));function YP(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function fx(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new YP(e,r||i,s),n=be?be+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function Wh(i,t){--i._eventsCount===0?i._events=new an:delete i._events[t]}function pe(){this._events=new an,this._eventsCount=0}pe.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)jP.call(e,r)&&t.push(be?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};pe.prototype.listeners=function(t){var e=be?be+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};pe.prototype.listenerCount=function(t){var e=be?be+t:t,r=this._events[e];return r?r.fn?1:r.length:0};pe.prototype.emit=function(t,e,r,s,o,n){var a=be?be+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};pe.prototype.on=function(t,e,r){return fx(this,t,e,r,!1)};pe.prototype.once=function(t,e,r){return fx(this,t,e,r,!0)};pe.prototype.removeListener=function(t,e,r,s){var o=be?be+t:t;if(!this._events[o])return this;if(!e)return Wh(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Wh(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Wh(this,o)}return this};pe.prototype.removeAllListeners=function(t){var e;return t?(e=be?be+t:t,this._events[e]&&Wh(this,e)):(this._events=new an,this._eventsCount=0),this};pe.prototype.off=pe.prototype.removeListener;pe.prototype.addListener=pe.prototype.on;pe.prefixed=be;pe.EventEmitter=pe;typeof Zu<"u"&&(Zu.exports=pe)});var mx,At,me=m(()=>{mx=Fi(px(),1),At=mx.default});var qP,Lr,ee,Ke,Sx,gx,Qu,KP,zh,Ax,Ex,xx,_x,yx,hn,ZP,QP,JP,tR,ed,bx,eR,Ju,td,vx,rd,De,Tx,$h,id=m(()=>{qP={grad:.9,turn:360,rad:360/(2*Math.PI)},Lr=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ee=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Ke=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Sx=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},gx=function(i){return{r:Ke(i.r,0,255),g:Ke(i.g,0,255),b:Ke(i.b,0,255),a:Ke(i.a)}},Qu=function(i){return{r:ee(i.r),g:ee(i.g),b:ee(i.b),a:ee(i.a,3)}},KP=/^#([0-9a-f]{3,8})$/i,zh=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Ax=function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=Math.max(t,e,r),n=o-Math.min(t,e,r),a=n?o===t?(e-r)/n:o===e?2+(r-t)/n:4+(t-e)/n:0;return{h:60*(a<0?a+6:a),s:o?n/o*100:0,v:o/255*100,a:s}},Ex=function(i){var t=i.h,e=i.s,r=i.v,s=i.a;t=t/360*6,e/=100,r/=100;var o=Math.floor(t),n=r*(1-e),a=r*(1-(t-o)*e),h=r*(1-(1-t+o)*e),l=o%6;return{r:255*[r,a,n,n,h,r][l],g:255*[h,r,r,a,n,n][l],b:255*[n,n,h,r,r,a][l],a:s}},xx=function(i){return{h:Sx(i.h),s:Ke(i.s,0,100),l:Ke(i.l,0,100),a:Ke(i.a)}},_x=function(i){return{h:ee(i.h),s:ee(i.s),l:ee(i.l),a:ee(i.a,3)}},yx=function(i){return Ex((e=(t=i).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},hn=function(i){return{h:(t=Ax(i)).h,s:(s=(200-(e=t.s))*(r=t.v)/100)>0&&s<200?e*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,r,s},ZP=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,QP=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,JP=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tR=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ed={string:[[function(i){var t=KP.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ee(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ee(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=JP.exec(i)||tR.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:gx({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=ZP.exec(i)||QP.exec(i);if(!t)return null;var e,r,s=xx({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(qP[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return yx(s)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,r=i.b,s=i.a,o=s===void 0?1:s;return Lr(t)&&Lr(e)&&Lr(r)?gx({r:Number(t),g:Number(e),b:Number(r),a:Number(o)}):null},"rgb"],[function(i){var t=i.h,e=i.s,r=i.l,s=i.a,o=s===void 0?1:s;if(!Lr(t)||!Lr(e)||!Lr(r))return null;var n=xx({h:Number(t),s:Number(e),l:Number(r),a:Number(o)});return yx(n)},"hsl"],[function(i){var t=i.h,e=i.s,r=i.v,s=i.a,o=s===void 0?1:s;if(!Lr(t)||!Lr(e)||!Lr(r))return null;var n=function(a){return{h:Sx(a.h),s:Ke(a.s,0,100),v:Ke(a.v,0,100),a:Ke(a.a)}}({h:Number(t),s:Number(e),v:Number(r),a:Number(o)});return Ex(n)},"hsv"]]},bx=function(i,t){for(var e=0;e<t.length;e++){var r=t[e][0](i);if(r)return[r,t[e][1]]}return[null,void 0]},eR=function(i){return typeof i=="string"?bx(i.trim(),ed.string):typeof i=="object"&&i!==null?bx(i,ed.object):[null,void 0]},Ju=function(i,t){var e=hn(i);return{h:e.h,s:Ke(e.s+100*t,0,100),l:e.l,a:e.a}},td=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},vx=function(i,t){var e=hn(i);return{h:e.h,s:e.s,l:Ke(e.l+100*t,0,100),a:e.a}},rd=function(){function i(t){this.parsed=eR(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return ee(td(this.rgba),2)},i.prototype.isDark=function(){return td(this.rgba)<.5},i.prototype.isLight=function(){return td(this.rgba)>=.5},i.prototype.toHex=function(){return t=Qu(this.rgba),e=t.r,r=t.g,s=t.b,n=(o=t.a)<1?zh(ee(255*o)):"","#"+zh(e)+zh(r)+zh(s)+n;var t,e,r,s,o,n},i.prototype.toRgb=function(){return Qu(this.rgba)},i.prototype.toRgbString=function(){return t=Qu(this.rgba),e=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+e+", "+r+", "+s+", "+o+")":"rgb("+e+", "+r+", "+s+")";var t,e,r,s,o},i.prototype.toHsl=function(){return _x(hn(this.rgba))},i.prototype.toHslString=function(){return t=_x(hn(this.rgba)),e=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+e+", "+r+"%, "+s+"%, "+o+")":"hsl("+e+", "+r+"%, "+s+"%)";var t,e,r,s,o},i.prototype.toHsv=function(){return t=Ax(this.rgba),{h:ee(t.h),s:ee(t.s),v:ee(t.v),a:ee(t.a,3)};var t},i.prototype.invert=function(){return De({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),De(Ju(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),De(Ju(this.rgba,-t))},i.prototype.grayscale=function(){return De(Ju(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),De(vx(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),De(vx(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?De({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ee(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=hn(this.rgba);return typeof t=="number"?De({h:t,s:e.s,l:e.l,a:e.a}):ee(e.h)},i.prototype.isEqual=function(t){return this.toHex()===De(t).toHex()},i}(),De=function(i){return i instanceof rd?i:new rd(i)},Tx=[],$h=function(i){i.forEach(function(t){Tx.indexOf(t)<0&&(t(rd,ed),Tx.push(t))})}});function Xh(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var s in e)r[e[s]]=s;var o={};i.prototype.toName=function(n){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=r[this.toHex()];if(l)return l;if(n?.closest){var c=this.toRgb(),u=1/0,d="black";if(!o.length)for(var f in e)o[f]=new i(e[f]).toRgb();for(var p in e){var g=(a=c,h=o[p],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));g<u&&(u=g,d=p)}return d}},t.string.push([function(n){var a=n.toLowerCase(),h=a==="transparent"?"#0000":e[a];return h?new i(h).toRgb():null},"name"])}var sd=m(()=>{});var Ss,it,le=m(()=>{id();sd();$h([Xh]);Ss=class ln{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof ln)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}_isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((o,n)=>o===e[n]);if(t!==null&&e!==null){let o=Object.keys(t),n=Object.keys(e);return o.length!==n.length?!1:o.every(a=>t[a]===e[a])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){let[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=ln._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=ln.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=De(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof ln||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ss.shared=new Ss;Ss._temp=new Ss;Ss.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;it=Ss});var wx,Cx=m(()=>{"use strict";wx={cullArea:null,cullable:!1,cullableChildren:!0}});var Px,Rx,Mx,od=m(()=>{"use strict";Px=Math.PI*2,Rx=180/Math.PI,Mx=Math.PI/180});var at,nd,Ze=m(()=>{"use strict";at=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return nd.x=0,nd.y=0,nd}},nd=new at});var U,rR,iR,dt=m(()=>{od();Ze();U=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new at;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new at;let r=this.a,s=this.b,o=this.c,n=this.d,a=this.tx,h=this.ty,l=1/(r*n+o*-s),c=t.x,u=t.y;return e.x=n*l*c+-o*l*u+(h*o-a*n)*l,e.y=r*l*u+-s*l*c+(-h*r+a*s)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}appendFrom(t,e){let r=t.a,s=t.b,o=t.c,n=t.d,a=t.tx,h=t.ty,l=e.a,c=e.b,u=e.c,d=e.d;return this.a=r*l+s*u,this.b=r*c+s*d,this.c=o*l+n*u,this.d=o*c+n*d,this.tx=a*l+h*u+e.tx,this.ty=a*c+h*d+e.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Px-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return iR.identity()}static get shared(){return rR.identity()}},rR=new U,iR=new U});var ce,jh=m(()=>{"use strict";ce=class i{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new i(t??this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=0 y=0 scope=${this._observer}]`}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}});function nt(i="default"){return ad[i]===void 0&&(ad[i]=-1),++ad[i]}var ad,ue=m(()=>{"use strict";ad={default:-1}});function X(i,t,e=3){if(Bx[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
2
2
  Deprecated since v${i}`):(r=r.split(`
3
3
  `).splice(e).join(`
4
4
  `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
5
5
  Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
6
- Deprecated since v${i}`),console.warn(r))),nf[t]=!0}var nf,H,af,dt=p(()=>{"use strict";nf={},H="8.0.0",af="8.3.4"});var xr,Wc=p(()=>{"use strict";xr=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var zc,W,Ut=p(()=>{Wc();zc=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new xr(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},W=new zc});var cf,lf=p(()=>{dt();cf={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){U("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function sn(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var Vc=p(()=>{"use strict"});var hf,uf=p(()=>{Vc();dt();hf={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}sn(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||U(H,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var df,ff=p(()=>{"use strict";df={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var Le,on=p(()=>{"use strict";Le=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var jc,nn,pf=p(()=>{P();Ut();jc=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return W.get(r.maskClass,t)}return t}returnMaskEffect(t){W.return(t)}},nn=new jc;I.handleByList(x.MaskEffect,nn._effectClasses)});var mf,gf=p(()=>{on();pf();mf={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),nn.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=nn.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Le);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Le),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var xf,_f=p(()=>{dt();xf={label:null,get name(){return U(H,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){U(H,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var an,z,vt=p(()=>{ne();an=[new $,new $,new $,new $],z=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,c=this.y,l=r*(1-s),h=r-l,u=a-l,d=a+o+l,f=c-l,m=c+n+l,g=a+h,_=a+o-h,b=c+h,y=c+n-h;return t>=u&&t<=d&&e>=f&&e<=m&&!(t>g&&t<_&&e>b&&e<y)}intersects(t,e){if(!e){let A=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=A)return!1;let C=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>C}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=an[0].set(t.left,t.top),c=an[1].set(t.left,t.bottom),l=an[2].set(t.right,t.top),h=an[3].set(t.right,t.bottom);if(l.x<=a.x||c.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(c,c),e.apply(l,l),e.apply(h,h),Math.max(a.x,c.x,l.x,h.x)<=r||Math.min(a.x,c.x,l.x,h.x)>=s||Math.max(a.y,c.y,l.y,h.y)<=o||Math.min(a.y,c.y,l.y,h.y)>=n))return!1;let d=u*(c.y-a.y),f=u*(a.x-c.x),m=d*r+f*o,g=d*s+f*o,_=d*r+f*n,b=d*s+f*n;if(Math.max(m,g,_,b)<=d*a.x+f*a.y||Math.min(m,g,_,b)>=d*h.x+f*h.y)return!1;let y=u*(a.y-l.y),v=u*(l.x-a.x),S=y*r+v*o,E=y*s+v*o,T=y*r+v*n,w=y*s+v*n;return!(Math.max(S,E,T,w)<=y*a.x+v*a.y||Math.min(S,E,T,w)>=y*h.x+v*h.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var yf,rt,$t=p(()=>{K();vt();yf=new B,rt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=yf,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new z);let 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=yf,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,c=o.c,l=o.d,h=o.tx,u=o.ty,d=this.minX,f=this.minY,m=this.maxX,g=this.maxY,_=n*t+c*e+h,b=a*t+l*e+u;_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),_=n*r+c*e+h,b=a*r+l*e+u,_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),_=n*t+c*s+h,b=a*t+l*s+u,_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),_=n*r+c*s+h,b=a*r+l*s+u,_<d&&(d=_),b<f&&(f=b),_>m&&(m=_),b>g&&(g=b),this.minX=d,this.minY=f,this.maxX=m,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c,d:l,tx:h,ty:u}=t,d=n*e+c*r+h,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+c*r+h,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+c*o+h,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+c*o+h,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(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 i(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){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,c=this.maxY;s||(s=this.matrix);let l=s.a,h=s.b,u=s.c,d=s.d,f=s.tx,m=s.ty;for(let g=e;g<r;g+=2){let _=t[g],b=t[g+1],y=l*_+u*b+f,v=h*_+d*b+m;o=y<o?y:o,n=v<n?v:n,a=y>a?y:a,c=v>c?v:c}this.minX=o,this.minY=n,this.maxX=a,this.maxY=c}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var yt,re,_r=p(()=>{K();Wc();$t();yt=new xr(B),re=new xr(rt)});var JT,bf,vf=p(()=>{K();$t();_r();JT=new B,bf={getFastGlobalBounds(i,t){t||(t=new rt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=re.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(JT).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),re.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),re.return(r))}}});function Vr(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=yt.get().identity(),r=cn(i,s)):r=B.IDENTITY,Tf(i,e,r,t),s&&yt.return(s),e.isValid||e.set(0,0,0,0),e}function Tf(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=yt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=re.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)Tf(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,B.IDENTITY),re.return(t)}r||yt.return(s)}function cn(i,t){let e=i.parent;return e&&(cn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var is=p(()=>{K();_r()});function ln(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,c=e*o/255|0,l=r*n/255|0,h=s*a/255|0;return(c<<16)+(l<<8)+h}var Xc=p(()=>{"use strict"});function jr(i,t){return i===Sf?t:t===Sf?i:ln(i,t)}var Sf,$c=p(()=>{Xc();Sf=16777215});function ss(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var wf,Ef=p(()=>{is();_r();$c();wf={getGlobalAlpha(i){if(i)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(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=cn(this,yt.get().identity());return i.appendFrom(this.localTransform,e),yt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?ss(this.renderGroup.worldColor):this.parentRenderGroup?ss(jr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=jr(t,e.localColor),e=e.parent;return ss(t)}}});function k(...i){Yc!==Pf&&(Yc++,Yc===Pf?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var Yc,Pf,it=p(()=>{"use strict";Yc=0,Pf=500});function Xr(i,t,e){return t.clear(),e||(e=B.IDENTITY),Af(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Af(i,t,e,r,s){let o;if(s)o=yt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let c=i.localTransform;o=yt.get(),o.appendFrom(c,e)}let n=t,a=!!i.effects.length;if(a&&(t=re.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let c=i.children;for(let l=0;l<c.length;l++)Af(c[l],t,o,r,!1)}if(a){for(let c=0;c<i.effects.length;c++)i.effects[c].addLocalBounds?.(t,r);n.addBounds(t,B.IDENTITY),re.return(t)}yt.return(o)}var hn=p(()=>{K();_r()});function Kc(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&Kc(s,t)}return t.didChange}var Cf=p(()=>{"use strict"});var tS,Mf,Bf=p(()=>{K();$t();is();hn();Cf();tS=new B,Mf={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new rt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),Kc(this,i),i.didChange&&Xr(this,i.localBounds,tS),i.localBounds},getBounds(i,t){return Vr(this,i,t||new rt)}}});var Rf,Gf=p(()=>{"use strict";Rf={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function eS(i,t){return i._zIndex-t._zIndex}var If,kf=p(()=>{"use strict";If={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(eS))}}});var Ff,Uf=p(()=>{ne();_r();Ff={getGlobalPosition(i=new $,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(yt.get(),e);return t=r.apply(i,t),yt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(yt.get(),r);return e=s.applyInverse(i,e),yt.return(s),e}}});var $r,qc=p(()=>{Rt();$r=class{constructor(){this.uid=X("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Ne(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Zc(i){return!(i&i-1)&&!!i}var os=p(()=>{"use strict"});function un(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var Qc=p(()=>{"use strict"});function rS(i){let t=Df[i];return t===void 0&&(Df[i]=X("resource")),t}var Df,Of,dn,Jc=p(()=>{It();Rt();dt();Df=Object.create(null);Of=class Lf extends ot{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Lf.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){U(H,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=rS(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Of.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};dn=Of});var Nf,J,Yt=p(()=>{It();os();Qc();Rt();Jc();Nf=class Hf extends ot{constructor(t={}){super(),this.options=t,this.uid=X("textureSource"),this._resourceType="textureSource",this._resourceId=X("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={...Hf.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new dn(un(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.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){let 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=X("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=X("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Zc(this.pixelWidth)&&Zc(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Nf.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};J=Nf});function iS(){for(let i=0;i<16;i++){let t=[];tl.push(t);for(let e=0;e<16;e++){let r=fn(yr[i]*yr[e]+vr[i]*br[e]),s=fn(br[i]*yr[e]+Tr[i]*br[e]),o=fn(yr[i]*vr[e]+vr[i]*Tr[e]),n=fn(br[i]*vr[e]+Tr[i]*Tr[e]);for(let a=0;a<16;a++)if(yr[a]===r&&br[a]===s&&vr[a]===o&&Tr[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new B;t.set(yr[i],br[i],vr[i],Tr[i],0,0),Wf.push(t)}}var yr,br,vr,Tr,tl,Wf,fn,ht,zf=p(()=>{K();yr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],br=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],vr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Tr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],tl=[],Wf=[],fn=Math.sign;iS();ht={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>yr[i],uY:i=>br[i],vX:i=>vr[i],vY:i=>Tr[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>tl[i][t],sub:(i,t)=>tl[i][ht.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?ht.S:ht.N:Math.abs(t)*2<=Math.abs(i)?i>0?ht.E:ht.W:t>0?i>0?ht.SE:ht.SW:i>0?ht.NE:ht.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=Wf[ht.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var el,Vf=p(()=>{"use strict";el=()=>{}});var Sr,rl=p(()=>{P();Yt();Sr=class extends J{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}};Sr.extension=x.TextureSource});var jf,Yr,il=p(()=>{K();jf=new B,Yr=class{constructor(t,e){this.mapCoord=new B,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(jf.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(jf));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,c=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+c)/o.width,n[1]=(t.frame.y+a+c)/o.height,n[2]=(t.frame.x+t.frame.width-a+c)/o.width,n[3]=(t.frame.y+t.frame.height-a+c)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var M,tt=p(()=>{It();zf();vt();Rt();dt();Vf();rl();Yt();il();M=class extends ot{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:c,dynamic:l}={}){if(super(),this.uid=X("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new z,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new J,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=c??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Yr(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,c=e.height/s,l=this.rotate;if(l){let h=a/2,u=c/2,d=o+h,f=n+u;l=ht.add(l,ht.NW),t.x0=d+h*ht.uX(l),t.y0=f+u*ht.uY(l),l=ht.add(l,2),t.x1=d+h*ht.uX(l),t.y1=f+u*ht.uY(l),l=ht.add(l,2),t.x2=d+h*ht.uX(l),t.y2=f+u*ht.uY(l),l=ht.add(l,2),t.x3=d+h*ht.uX(l),t.y3=f+u*ht.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+c,t.x3=o,t.y3=n+c}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return U(H,"Texture.baseTexture is now Texture.source"),this._source}};M.EMPTY=new M({label:"EMPTY",source:new J({label:"EMPTY"})});M.EMPTY.destroy=el;M.WHITE=new M({source:new Sr({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});M.WHITE.destroy=el});var sS,sl,ft,qe=p(()=>{os();Yt();tt();sS=0,sl=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new J({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new M({source:s,label:`texturePool_${sS++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Ne(o),n=Ne(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let c=this._texturePool[a].pop();return c||(c=this.createTexture(o,n,s)),c.source._resolution=r,c.source.width=o/r,c.source.height=n/r,c.source.pixelWidth=o,c.source.pixelHeight=n,c.frame.x=0,c.frame.y=0,c.frame.width=t,c.frame.height=e,c.updateUvs(),this._poolKeyHash[c.uid]=a,c}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},ft=new sl});var pn,Xf=p(()=>{K();qc();qe();pn=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new $r,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(ft.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new B),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new B),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new B),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function $f(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var Yf=p(()=>{"use strict"});var ol,nl,al,Kr,ns,wr,nt,me=p(()=>{It();Mt();ef();P();K();Lc();rn();Rt();dt();Ut();lf();uf();ff();gf();_f();vf();Ef();Bf();Gf();kf();Uf();Xf();Yf();ol=new Bt(null),nl=new Bt(null),al=new Bt(null,1,1),Kr=1,ns=2,wr=4,nt=class i extends ot{constructor(t={}){super(),this.uid=X("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Bt(this,0,0),this._scale=al,this._pivot=nl,this._skew=ol,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],$f(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){U("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),I.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||U(H,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=W.get(pn,this),this.groupTransform=B.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),W.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new B),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*sf}set angle(t){this.rotation=t*of}get pivot(){return this._pivot===nl&&(this._pivot=new Bt(this,0,0)),this._pivot}set pivot(t){this._pivot===nl&&(this._pivot=new Bt(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===ol&&(this._skew=new Bt(this,0,0)),this._skew}set skew(t){this._skew===ol&&(this._skew=new Bt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===al&&(this._scale=new Bt(this,1,1)),this._scale}set scale(t){this._scale===al&&(this._scale=new Bt(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,c=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(c*e.a+l*e.c),e.ty=o._y-(c*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Kr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=V.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Kr,this._onUpdate())}get tint(){return ss(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ns,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=wr,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=wr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=wr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};I.mixin(nt,hf,bf,Ff,Rf,Mf,mf,xf,If,tf,cf,wf,df)});var Ze,mn=p(()=>{ne();Ze=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new $,this.page=new $,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function oS(i){return function(t){return t.test(i)}}function as(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=oS(e),o={apple:{phone:s(cl)&&!s(He),ipod:s(Kf),tablet:!s(cl)&&(s(qf)||op(t))&&!s(He),universal:s(Zf),device:(s(cl)||s(Kf)||s(qf)||s(Zf)||op(t))&&!s(He)},amazon:{phone:s(qr),tablet:!s(qr)&&s(gn),device:s(qr)||s(gn)},android:{phone:!s(He)&&s(qr)||!s(He)&&s(ll),tablet:!s(He)&&!s(qr)&&!s(ll)&&(s(gn)||s(Qf)),device:!s(He)&&(s(qr)||s(gn)||s(ll)||s(Qf))||s(/\bokhttp\b/i)},windows:{phone:s(He),tablet:s(Jf),device:s(He)||s(Jf)},other:{blackberry:s(tp),blackberry10:s(ep),opera:s(rp),firefox:s(sp),chrome:s(ip),device:s(tp)||s(ep)||s(rp)||s(sp)||s(ip)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var cl,Kf,qf,Zf,ll,Qf,qr,gn,He,Jf,tp,ep,rp,ip,sp,op,hl=p(()=>{cl=/iPhone/i,Kf=/iPod/i,qf=/iPad/i,Zf=/\biOS-universal(?:.+)Mac\b/i,ll=/\bAndroid(?:.+)Mobile\b/i,Qf=/Android/i,qr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,gn=/Silk/i,He=/Windows Phone/i,Jf=/\bWindows(?:.+)ARM\b/i,tp=/BlackBerry/i,ep=/BB10/i,rp=/Opera Mini/i,ip=/\b(CriOS|Chrome)(?:.+)Mobile/i,sp=/Mobile(?:.+)Firefox\b/i,op=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var np=p(()=>{hl();hl()});var nS,ap,cp=p(()=>{np();nS=as.default??as,ap=nS(globalThis.navigator)});var aS,xn,cS,lS,lp,hp,hS,uS,dS,ul,dp,fp=p(()=>{mn();P();cp();Vc();aS=9,xn=100,cS=0,lS=0,lp=2,hp=1,hS=-1e3,uS=-1e3,dS=2,ul=class up{constructor(t,e=ap){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(){let t=document.createElement("button");t.style.width=`${hp}px`,t.style.height=`${hp}px`,t.style.position="absolute",t.style.top=`${hS}px`,t.style.left=`${uS}px`,t.style.zIndex=dS.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)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${xn}px`,this._div.style.height=`${xn}px`,this._div.style.position="absolute",this._div.style.top=`${cS}px`,this._div.style.left=`${lS}px`,this._div.style.zIndex=lp.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));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let 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(let 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)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...up.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,sn(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,c=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*c}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*c}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,c=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*c}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*c}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
6
+ Deprecated since v${i}`),console.warn(r))),Bx[t]=!0}var Bx,tt,Ix,Ft=m(()=>{"use strict";Bx={},tt="8.0.0",Ix="8.3.4"});var Gi,hd=m(()=>{"use strict";Gi=class{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){let e;return this._index>0?e=this._pool[--this._index]:e=new this._classType,e.init?.(t),e}return(t){t.reset?.(),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}});var ld,et,ve=m(()=>{hd();ld=class{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new Gi(t)),this._poolsByClass.get(t)}stats(){let t={};return this._poolsByClass.forEach(e=>{let r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}},et=new ld});var Fx,Gx=m(()=>{Ft();Fx={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){X("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}}});function Yh(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var cd=m(()=>{"use strict"});var Ux,kx=m(()=>{cd();Ft();Ux={allowChildren:!0,removeChildren(i=0,t){let e=t??this.children.length,r=e-i,s=[];if(r>0&&r<=e){for(let n=e-1;n>=i;n--){let a=this.children[n];a&&(s.push(a),a.parent=null)}Yh(this.children,i,e);let o=this.renderGroup||this.parentRenderGroup;o&&o.removeChildren(s);for(let n=0;n<s.length;++n){let a=s[n];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,n),s[n].emit("removed",this)}return s.length>0&&this._didViewChangeTick++,s}else if(r===0&&this.children.length===0)return s;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){let t=this.getChildAt(i);return this.removeChild(t)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,t)},getChildIndex(i){let t=this.children.indexOf(i);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(i,t){this.allowChildren||X(tt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");let{children:e}=this;if(t<0||t>e.length)throw new Error(`${i}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(i.parent){let s=i.parent.children.indexOf(i);if(i.parent===this&&s===t)return i;s!==-1&&i.parent.children.splice(s,1)}t===e.length?e.push(i):e.splice(t,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;let r=this.renderGroup||this.parentRenderGroup;return r&&r.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,t),i.emit("added",this),i},swapChildren(i,t){if(i===t)return;let e=this.getChildIndex(i),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=i;let s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(t=>this.reparentChildAt(t,this.children.length)),i[0])},reparentChildAt(i,t){if(i.parent===this)return this.setChildIndex(i,t),i;let e=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,t);let r=this.worldTransform.clone();return r.invert(),e.prepend(r),i.setFromMatrix(e),i}}});var Ox,Nx=m(()=>{"use strict";Ox={collectRenderables(i,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,t,e))},collectRenderablesSimple(i,t,e){let r=this.children,s=r.length;for(let o=0;o<s;o++)r[o].collectRenderables(i,t,e)},collectRenderablesWithEffects(i,t,e){let{renderPipes:r}=t;for(let s=0;s<this.effects.length;s++){let o=this.effects[s];r[o.pipe].push(o,this,i)}this.collectRenderablesSimple(i,t,e);for(let s=this.effects.length-1;s>=0;s--){let o=this.effects[s];r[o.pipe].pop(o,this,i)}}}});var Hr,qh=m(()=>{"use strict";Hr=class{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}});var ud,Kh,Dx=m(()=>{R();ve();ud=class{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){let r=this._tests[e];if(r.test(t))return et.get(r.maskClass,t)}return t}returnMaskEffect(t){et.return(t)}},Kh=new ud;D.handleByList(y.MaskEffect,Kh._effectClasses)});var Lx,Hx=m(()=>{qh();Dx();Lx={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){let i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){let t=this.effects.indexOf(i);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){let t=this._maskEffect;t?.mask!==i&&(t&&(this.removeEffect(t),Kh.returnMaskEffect(t),this._maskEffect=null),i!=null&&(this._maskEffect=Kh.getMaskEffect(i),this.addEffect(this._maskEffect)))},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},get mask(){return this._maskEffect?.mask},set filters(i){!Array.isArray(i)&&i&&(i=[i]);let t=this._filterEffect||(this._filterEffect=new Hr);i=i;let e=i?.length>0,r=t.filters?.length>0,s=e!==r;i=Array.isArray(i)?i.slice(0):i,t.filters=Object.freeze(i),s&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Hr),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}}});var Vx,Wx=m(()=>{Ft();Vx={label:null,get name(){return X(tt,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){X(tt,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,t=!1){return this.getChildByLabel(i,t)},getChildByLabel(i,t=!1){let e=this.children;for(let r=0;r<e.length;r++){let s=e[r];if(s.label===i||i instanceof RegExp&&i.test(s.label))return s}if(t)for(let r=0;r<e.length;r++){let o=e[r].getChildByLabel(i,!0);if(o)return o}return null},getChildrenByLabel(i,t=!1,e=[]){let r=this.children;for(let s=0;s<r.length;s++){let o=r[s];(o.label===i||i instanceof RegExp&&i.test(o.label))&&e.push(o)}if(t)for(let s=0;s<r.length;s++)r[s].getChildrenByLabel(i,!0,e);return e}}});var Zh,rt,Yt=m(()=>{Ze();Zh=[new at,new at,new at,new at],rt=class i{constructor(t=0,e=0,r=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,r,s=.5){let{width:o,height:n}=this;if(o<=0||n<=0)return!1;let a=this.x,h=this.y,l=r*(1-s),c=r-l,u=a-l,d=a+o+l,f=h-l,p=h+n+l,g=a+c,x=a+o-c,v=h+c,_=h+n-c;return t>=u&&t<=d&&e>=f&&e<=p&&!(t>g&&t<x&&e>v&&e<_)}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let S=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>S}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=Zh[0].set(t.left,t.top),h=Zh[1].set(t.left,t.bottom),l=Zh[2].set(t.right,t.top),c=Zh[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,g=d*s+f*o,x=d*r+f*n,v=d*s+f*n;if(Math.max(p,g,x,v)<=d*a.x+f*a.y||Math.min(p,g,x,v)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),b=u*(l.x-a.x),T=_*r+b*o,E=_*s+b*o,A=_*r+b*n,C=_*s+b*n;return!(Math.max(T,E,A,C)<=_*a.x+b*a.y||Math.min(T,E,A,C)>=_*c.x+b*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}getBounds(t){return t||(t=new i),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;let e=t.x,r=t.y,s=t.x+t.width,o=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&s>=this.x&&s<this.x+this.width&&o>=this.y&&o<this.y+this.height}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}});var zx,bt,Me=m(()=>{dt();Yt();zx=new U,bt=class i{constructor(t=1/0,e=1/0,r=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=zx,this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new rt);let 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=zx,this}set(t,e,r,s){this.minX=t,this.minY=e,this.maxX=r,this.maxY=s}addFrame(t,e,r,s,o){o||(o=this.matrix);let n=o.a,a=o.b,h=o.c,l=o.d,c=o.tx,u=o.ty,d=this.minX,f=this.minY,p=this.maxX,g=this.maxY,x=n*t+h*e+c,v=a*t+l*e+u;x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),x=n*r+h*e+c,v=a*r+l*e+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),x=n*t+h*s+c,v=a*t+l*s+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),x=n*r+h*s+c,v=a*r+l*s+u,x<d&&(d=x),v<f&&(f=v),x>p&&(p=x),v>g&&(g=v),this.minX=d,this.minY=f,this.maxX=p,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){let e=this.minX,r=this.minY,s=this.maxX,o=this.maxY,{a:n,b:a,c:h,d:l,tx:c,ty:u}=t,d=n*e+h*r+c,f=a*e+l*r+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=n*s+h*r+c,f=a*s+l*r+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*e+h*o+c,f=a*e+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=n*s+h*o+c,f=a*s+l*o+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,r,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>s&&(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 i(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){let e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){let e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,r,s){let o=this.minX,n=this.minY,a=this.maxX,h=this.maxY;s||(s=this.matrix);let l=s.a,c=s.b,u=s.c,d=s.d,f=s.tx,p=s.ty;for(let g=e;g<r;g+=2){let x=t[g],v=t[g+1],_=l*x+u*v+f,b=c*x+d*v+p;o=_<o?_:o,n=b<n?b:n,a=_>a?_:a,h=b>h?b:h}this.minX=o,this.minY=n,this.maxX=a,this.maxY=h}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}});var Wt,Le,Ui=m(()=>{dt();hd();Me();Wt=new Gi(U),Le=new Gi(bt)});var sR,$x,Xx=m(()=>{dt();Me();Ui();sR=new U,$x={getFastGlobalBounds(i,t){t||(t=new bt),t.clear(),this._getGlobalBoundsRecursive(!!i,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);let e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(i,t,e){let r=t;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;let s=!!this.effects.length;if((this.renderGroup||s)&&(r=Le.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){let n=this.bounds;r.addFrame(n.minX,n.minY,n.maxX,n.maxY,this.groupTransform)}let o=this.children;for(let n=0;n<o.length;n++)o[n]._getGlobalBoundsRecursive(i,r,e)}if(s){let o=!1,n=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(o||(o=!0,r.applyMatrix(n.worldTransform)),this.effects[a].addBounds(r,!0));o&&(r.applyMatrix(n.worldTransform.copyTo(sR).invert()),t.addBounds(r,this.relativeGroupTransform)),t.addBounds(r),Le.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),Le.return(r))}}});function As(i,t,e){e.clear();let r,s;return i.parent?t?r=i.parent.worldTransform:(s=Wt.get().identity(),r=Qh(i,s)):r=U.IDENTITY,jx(i,e,r,t),s&&Wt.return(s),e.isValid||e.set(0,0,0,0),e}function jx(i,t,e,r){if(!i.visible||!i.measurable)return;let s;r?s=i.worldTransform:(i.updateLocalTransform(),s=Wt.get(),s.appendFrom(i.localTransform,e));let o=t,n=!!i.effects.length;if(n&&(t=Le.get().clear()),i.boundsArea)t.addRect(i.boundsArea,s);else{i.bounds&&(t.matrix=s,t.addBounds(i.bounds));for(let a=0;a<i.children.length;a++)jx(i.children[a],t,s,r)}if(n){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(t);o.addBounds(t,U.IDENTITY),Le.return(t)}r||Wt.return(s)}function Qh(i,t){let e=i.parent;return e&&(Qh(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}var cn=m(()=>{dt();Ui()});function Jh(i,t){if(i===16777215||!t)return t;if(t===16777215||!i)return i;let e=i>>16&255,r=i>>8&255,s=i&255,o=t>>16&255,n=t>>8&255,a=t&255,h=e*o/255|0,l=r*n/255|0,c=s*a/255|0;return(h<<16)+(l<<8)+c}var dd=m(()=>{"use strict"});function Es(i,t){return i===Yx?t:t===Yx?i:Jh(i,t)}var Yx,fd=m(()=>{dd();Yx=16777215});function un(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}var qx,Kx=m(()=>{cn();Ui();fd();qx={getGlobalAlpha(i){if(i)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(i,t){if(t)return i.copyFrom(this.worldTransform);this.updateLocalTransform();let e=Qh(this,Wt.get().identity());return i.appendFrom(this.localTransform,e),Wt.return(e),i},getGlobalTint(i){if(i)return this.renderGroup?un(this.renderGroup.worldColor):this.parentRenderGroup?un(Es(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=Es(t,e.localColor),e=e.parent;return un(t)}}});function H(...i){pd!==Zx&&(pd++,pd===Zx?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}var pd,Zx,vt=m(()=>{"use strict";pd=0,Zx=500});function ws(i,t,e){return t.clear(),e||(e=U.IDENTITY),Qx(i,t,e,i,!0),t.isValid||t.set(0,0,0,0),t}function Qx(i,t,e,r,s){let o;if(s)o=Wt.get(),o=e.copyTo(o);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();let h=i.localTransform;o=Wt.get(),o.appendFrom(h,e)}let n=t,a=!!i.effects.length;if(a&&(t=Le.get().clear()),i.boundsArea)t.addRect(i.boundsArea,o);else{i.renderPipeId&&(t.matrix=o,t.addBounds(i.bounds));let h=i.children;for(let l=0;l<h.length;l++)Qx(h[l],t,o,r,!1)}if(a){for(let h=0;h<i.effects.length;h++)i.effects[h].addLocalBounds?.(t,r);n.addBounds(t,U.IDENTITY),Le.return(t)}Wt.return(o)}var tl=m(()=>{dt();Ui()});function md(i,t){let e=i.children;for(let r=0;r<e.length;r++){let s=e[r],o=s.uid,n=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,a=t.index;(t.data[a]!==o||t.data[a+1]!==n)&&(t.data[t.index]=o,t.data[t.index+1]=n,t.didChange=!0),t.index=a+2,s.children.length&&md(s,t)}return t.didChange}var Jx=m(()=>{"use strict"});var oR,t_,e_=m(()=>{dt();Me();cn();tl();Jx();oR=new U,t_={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,t){let e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=i/t*e:this.scale.x=e},_setHeight(i,t){let e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=i/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new bt});let i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),md(this,i),i.didChange&&ws(this,i.localBounds,oR),i.localBounds},getBounds(i,t){return As(this,i,t||new bt)}}});var r_,i_=m(()=>{"use strict";r_={_onRender:null,set onRender(i){let t=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&t?.removeOnRender(this),this._onRender=null;return}this._onRender||t?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}}});function nR(i,t){return i._zIndex-t._zIndex}var s_,o_=m(()=>{"use strict";s_={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(nR))}}});var n_,a_=m(()=>{Ze();Ui();n_={getGlobalPosition(i=new at,t=!1){return this.parent?this.parent.toGlobal(this._position,i,t):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,t,e=!1){let r=this.getGlobalTransform(Wt.get(),e);return t=r.apply(i,t),Wt.return(r),t},toLocal(i,t,e,r){t&&(i=t.toGlobal(i,e,r));let s=this.getGlobalTransform(Wt.get(),r);return e=s.applyInverse(i,e),Wt.return(s),e}}});var Cs,gd=m(()=>{ue();Cs=class{constructor(){this.uid=nt("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}});function Vr(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function xd(i){return!(i&i-1)&&!!i}var dn=m(()=>{"use strict"});function el(i){let t={};for(let e in i)i[e]!==void 0&&(t[e]=i[e]);return t}var _d=m(()=>{"use strict"});function aR(i){let t=h_[i];return t===void 0&&(h_[i]=nt("resource")),t}var h_,l_,rl,yd=m(()=>{me();ue();Ft();h_=Object.create(null);l_=class c_ extends At{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...c_.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){X(tt,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){let t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=aR(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};l_.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};rl=l_});var u_,gt,Be=m(()=>{me();dn();_d();ue();yd();u_=class d_ extends At{constructor(t={}){super(),this.options=t,this.uid=nt("textureSource"),this._resourceType="textureSource",this._resourceId=nt("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={...d_.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new rl(el(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){this.style!==t&&(this._style?.off("change",this._onStyleChange,this),this._style=t,this._style?.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){let 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=nt("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){let{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){let{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);let s=Math.round(t*r),o=Math.round(e*r);return this.width=s/r,this.height=o/r,this._resolution=r,this.pixelWidth===s&&this.pixelHeight===o?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=o,this.emit("resize",this),this._resourceId=nt("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=xd(this.pixelWidth)&&xd(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};u_.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};gt=u_});function hR(){for(let i=0;i<16;i++){let t=[];bd.push(t);for(let e=0;e<16;e++){let r=il(ki[i]*ki[e]+Ni[i]*Oi[e]),s=il(Oi[i]*ki[e]+Di[i]*Oi[e]),o=il(ki[i]*Ni[e]+Ni[i]*Di[e]),n=il(Oi[i]*Ni[e]+Di[i]*Di[e]);for(let a=0;a<16;a++)if(ki[a]===r&&Oi[a]===s&&Ni[a]===o&&Di[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new U;t.set(ki[i],Oi[i],Ni[i],Di[i],0,0),f_.push(t)}}var ki,Oi,Ni,Di,bd,f_,il,Mt,p_=m(()=>{dt();ki=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Oi=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ni=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Di=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],bd=[],f_=[],il=Math.sign;hR();Mt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>ki[i],uY:i=>Oi[i],vX:i=>Ni[i],vY:i=>Di[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>bd[i][t],sub:(i,t)=>bd[i][Mt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Mt.S:Mt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Mt.E:Mt.W:t>0?i>0?Mt.SE:Mt.SW:i>0?Mt.NE:Mt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=f_[Mt.inv(t)];s.tx=e,s.ty=r,i.append(s)}}});var vd,m_=m(()=>{"use strict";vd=()=>{}});var Li,Td=m(()=>{R();Be();Li=class extends gt{constructor(t){let e=t.resource||new Float32Array(t.width*t.height*4),r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}};Li.extension=y.TextureSource});var g_,Ps,Sd=m(()=>{dt();g_=new U,Ps=class{constructor(t,e){this.mapCoord=new U,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){this.texture!==t&&(this._texture?.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(){let t=this._texture;this._updateID++;let e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);let r=t.orig,s=t.trim;s&&(g_.set(r.width/s.width,0,0,r.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(g_));let o=t.source,n=this.uClampFrame,a=this.clampMargin/o._resolution,h=this.clampOffset/o._resolution;return n[0]=(t.frame.x+a+h)/o.width,n[1]=(t.frame.y+a+h)/o.height,n[2]=(t.frame.x+t.frame.width-a+h)/o.width,n[3]=(t.frame.y+t.frame.height-a+h)/o.height,this.uClampOffset[0]=this.clampOffset/o.pixelWidth,this.uClampOffset[1]=this.clampOffset/o.pixelHeight,this.isSimple=t.frame.width===o.width&&t.frame.height===o.height&&t.rotate===0,!0}}});var I,xt=m(()=>{me();p_();Yt();ue();Ft();m_();Td();Be();Sd();I=class extends At{constructor({source:t,label:e,frame:r,orig:s,trim:o,defaultAnchor:n,defaultBorders:a,rotate:h,dynamic:l}={}){if(super(),this.uid=nt("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new rt,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=t?.source??new gt,this.noFrame=!r,r)this.frame.copyFrom(r);else{let{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=s||this.frame,this.trim=o,this.rotate=h??0,this.defaultAnchor=n,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Ps(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){let{uvs:t,frame:e}=this,{width:r,height:s}=this._source,o=e.x/r,n=e.y/s,a=e.width/r,h=e.height/s,l=this.rotate;if(l){let c=a/2,u=h/2,d=o+c,f=n+u;l=Mt.add(l,Mt.NW),t.x0=d+c*Mt.uX(l),t.y0=f+u*Mt.uY(l),l=Mt.add(l,2),t.x1=d+c*Mt.uX(l),t.y1=f+u*Mt.uY(l),l=Mt.add(l,2),t.x2=d+c*Mt.uX(l),t.y2=f+u*Mt.uY(l),l=Mt.add(l,2),t.x3=d+c*Mt.uX(l),t.y3=f+u*Mt.uY(l)}else t.x0=o,t.y0=n,t.x1=o+a,t.y1=n,t.x2=o+a,t.y2=n+h,t.x3=o,t.y3=n+h}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return X(tt,"Texture.baseTexture is now Texture.source"),this._source}};I.EMPTY=new I({label:"EMPTY",source:new gt({label:"EMPTY"})});I.EMPTY.destroy=vd;I.WHITE=new I({source:new Li({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});I.WHITE.destroy=vd});var lR,Ad,Gt,li=m(()=>{dn();Be();xt();lR=0,Ad=class{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,r){let s=new gt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1});return new I({source:s,label:`texturePool_${lR++}`})}getOptimalTexture(t,e,r=1,s){let o=Math.ceil(t*r-1e-6),n=Math.ceil(e*r-1e-6);o=Vr(o),n=Vr(n);let a=(o<<17)+(n<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let h=this._texturePool[a].pop();return h||(h=this.createTexture(o,n,s)),h.source._resolution=r,h.source.width=o/r,h.source.height=n/r,h.source.pixelWidth=o,h.source.pixelHeight=n,h.frame.x=0,h.frame.y=0,h.frame.width=t,h.frame.height=e,h.updateUvs(),this._poolKeyHash[h.uid]=a,h}getSameSizeTexture(t,e=!1){let r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t){let e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(let e in this._texturePool){let r=this._texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this._texturePool={}}},Gt=new Ad});var sl,x_=m(()=>{dt();gd();li();sl=class{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new U,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Cs,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;let e=t.children;for(let r=0;r<e.length;r++){let s=e[r];s._updateFlags=15,this.addChild(s)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Gt.returnTexture(this.texture),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0}reset(){this.renderGroupChildren.length=0;for(let t in this.childrenToUpdate){let e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){let e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);let e=t.children;for(let r=0;r<e.length;r++)this.addChild(e[r])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}let e=t.children;for(let r=0;r<e.length;r++)this.removeChild(e[r])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){let e=this.root.children;for(let r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;let r=t.children;for(let s=0;s<r.length;s++)this._getChildren(r[s],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new U),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new U),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;let t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new U),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}});function __(i,t,e={}){for(let r in t)!e[r]&&t[r]!==void 0&&(i[r]=t[r])}var y_=m(()=>{"use strict"});var Ed,wd,Cd,Rs,fn,Hi,Et,cr=m(()=>{me();le();Cx();R();dt();od();jh();ue();Ft();ve();Gx();kx();Nx();Hx();Wx();Xx();Kx();e_();i_();o_();a_();x_();y_();Ed=new ce(null),wd=new ce(null),Cd=new ce(null,1,1),Rs=1,fn=2,Hi=4,Et=class i extends At{constructor(t={}){super(),this.uid=nt("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new U,this.relativeGroupTransform=new U,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ce(this,0,0),this._scale=Cd,this._pivot=wd,this._skew=Ed,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],__(this,t,{children:!0,parent:!0,effects:!0}),t.children?.forEach(e=>this.addChild(e)),t.parent?.addChild(this)}static mixin(t){X("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),D.mixin(i,t)}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(this.allowChildren||X(tt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let s=0;s<t.length;s++)this.addChild(t[s]);return t[0]}let e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.structureDidChange=!0),e):(e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}let e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),this.renderGroup=et.get(sl,this),this.groupTransform=U.IDENTITY,t?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;let t=this.parentRenderGroup;t?.removeChild(this),et.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new U),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Rx}set angle(t){this.rotation=t*Mx}get pivot(){return this._pivot===wd&&(this._pivot=new ce(this,0,0)),this._pivot}set pivot(t){this._pivot===wd&&(this._pivot=new ce(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Ed&&(this._skew=new ce(this,0,0)),this._skew}set skew(t){this._skew===Ed&&(this._skew=new ce(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Cd&&(this._scale=new ce(this,1,1)),this._scale}set scale(t){this._scale===Cd&&(this._scale=new ce(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){let e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){let e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});let e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){let r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.height)}_updateSkew(){let t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){let t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;let e=this.localTransform,r=this._scale,s=this._pivot,o=this._position,n=r._x,a=r._y,h=s._x,l=s._y;e.a=this._cx*n,e.b=this._sx*n,e.c=this._cy*a,e.d=this._sy*a,e.tx=o._x-(h*e.a+l*e.c),e.ty=o._y-(h*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Rs,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){let r=it.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=Rs,this._onUpdate())}get tint(){return un(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=fn,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){let e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Hi,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){let e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Hi,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){let e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Hi,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t?.children)&&e)for(let s=0;s<e.length;++s)e[s].destroy(t);this.renderGroup?.destroy(),this.renderGroup=null}};D.mixin(Et,Ux,$x,n_,r_,t_,Lx,Vx,s_,wx,Fx,qx,Ox)});var ci,ol=m(()=>{Ze();ci=class i{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=i.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new at,this.page=new at,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(t,e,r){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(t,e,r,s,o){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}});function cR(i){return function(t){return t.test(i)}}function ui(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,r=e.split("[FBAN");typeof r[1]<"u"&&(e=r[0]),r=e.split("Twitter"),typeof r[1]<"u"&&(e=r[0]);var s=cR(e),o={apple:{phone:s(Pd)&&!s(Wr),ipod:s(b_),tablet:!s(Pd)&&(s(v_)||M_(t))&&!s(Wr),universal:s(T_),device:(s(Pd)||s(b_)||s(v_)||s(T_)||M_(t))&&!s(Wr)},amazon:{phone:s(Ms),tablet:!s(Ms)&&s(nl),device:s(Ms)||s(nl)},android:{phone:!s(Wr)&&s(Ms)||!s(Wr)&&s(Rd),tablet:!s(Wr)&&!s(Ms)&&!s(Rd)&&(s(nl)||s(S_)),device:!s(Wr)&&(s(Ms)||s(nl)||s(Rd)||s(S_))||s(/\bokhttp\b/i)},windows:{phone:s(Wr),tablet:s(A_),device:s(Wr)||s(A_)},other:{blackberry:s(E_),blackberry10:s(w_),opera:s(C_),firefox:s(R_),chrome:s(P_),device:s(E_)||s(w_)||s(C_)||s(R_)||s(P_)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var Pd,b_,v_,T_,Rd,S_,Ms,nl,Wr,A_,E_,w_,C_,P_,R_,M_,Md=m(()=>{Pd=/iPhone/i,b_=/iPod/i,v_=/iPad/i,T_=/\biOS-universal(?:.+)Mac\b/i,Rd=/\bAndroid(?:.+)Mobile\b/i,S_=/Android/i,Ms=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,nl=/Silk/i,Wr=/Windows Phone/i,A_=/\bWindows(?:.+)ARM\b/i,E_=/BlackBerry/i,w_=/BB10/i,C_=/Opera Mini/i,P_=/\b(CriOS|Chrome)(?:.+)Mobile/i,R_=/Mobile(?:.+)Firefox\b/i,M_=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"}});var Bd=m(()=>{Md();Md()});var uR,B_,I_=m(()=>{Bd();uR=ui.default??ui,B_=uR(globalThis.navigator)});var dR,al,fR,pR,F_,G_,mR,gR,xR,Id,k_,O_=m(()=>{ol();R();I_();cd();dR=9,al=100,fR=0,pR=0,F_=2,G_=1,mR=-1e3,gR=-1e3,xR=2,Id=class U_{constructor(t,e=B_){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(){let t=document.createElement("button");t.style.width=`${G_}px`,t.style.height=`${G_}px`,t.style.position="absolute",t.style.top=`${mR}px`,t.style.left=`${gR}px`,t.style.zIndex=xR.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)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.width=`${al}px`,this._div.style.height=`${al}px`,this._div.style.position="absolute",this._div.style.top=`${fR}px`,this._div.style.left=`${pR}px`,this._div.style.zIndex=F_.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));let t=this._renderer.view.canvas;if(t.parentNode)t.parentNode.appendChild(this._div),this._initAccessibilitySetup();else{let 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(let 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)return;t.accessible&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);let e=t.children;if(e)for(let r=0;r<e.length;r++)this._updateAccessibleObjects(e[r])}init(t){let r={accessibilityOptions:{...U_.defaultOptions,...t?.accessibilityOptions||{}}};this.debug=r.accessibilityOptions.debug,this._activateOnTab=r.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=r.accessibilityOptions.deactivateOnMouseMove,r.accessibilityOptions.enabledByDefault?this._activate():this._activateOnTab&&(this._onKeyDown=this._onKeyDown.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)),this._renderer.runners.postrender.remove(this)}postrender(){let t=performance.now();if(this._mobileInfo.android.device&&t<this._androidUpdateCount||(this._androidUpdateCount=t+this._androidUpdateFrequency,!this._renderer.renderingToScreen||!this._renderer.view.canvas))return;let e=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(let r of this._children)r._renderId===this._renderId&&e.add(this._children.indexOf(r))}for(let r=this._children.length-1;r>=0;r--){let s=this._children[r];e.has(r)||(s._accessibleDiv&&s._accessibleDiv.parentNode&&(s._accessibleDiv.parentNode.removeChild(s._accessibleDiv),this._pool.push(s._accessibleDiv),s._accessibleDiv=null),s._accessibleActive=!1,Yh(this._children,r,1))}if(this._renderer.renderingToScreen){let{x:r,y:s,width:o,height:n}=this._renderer.screen,a=this._div;a.style.left=`${r}px`,a.style.top=`${s}px`,a.style.width=`${o}px`,a.style.height=`${n}px`}for(let r=0;r<this._children.length;r++){let s=this._children[r];if(!s._accessibleActive||!s._accessibleDiv)continue;let o=s._accessibleDiv,n=s.hitArea||s.getBounds().rectangle;if(s.hitArea){let a=s.worldTransform,h=this._renderer.resolution,l=this._renderer.resolution;o.style.left=`${(a.tx+n.x*a.a)*h}px`,o.style.top=`${(a.ty+n.y*a.d)*l}px`,o.style.width=`${n.width*a.a*h}px`,o.style.height=`${n.height*a.d*l}px`}else{this._capHitArea(n);let a=this._renderer.resolution,h=this._renderer.resolution;o.style.left=`${n.x*a}px`,o.style.top=`${n.y*h}px`,o.style.width=`${n.width*a}px`,o.style.height=`${n.height*h}px`}}this._renderId++}_updateDebugHTML(t){t.innerHTML=`type: ${t.type}</br> title : ${t.title}</br> tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);let{width:e,height:r}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>r&&(t.height=r-t.y)}_addChild(t){let e=this._pool.pop();e||(t.accessibleType==="button"?e=document.createElement("button"):(e=document.createElement(t.accessibleType),e.style.cssText=`
7
7
  color: transparent;
8
8
  pointer-events: none;
9
9
  padding: 0;
@@ -16,9 +16,9 @@ Deprecated since v${i}`),console.warn(r))),nf[t]=!0}var nf,H,af,dt=p(()=>{"use s
16
16
  -webkit-user-select: none;
17
17
  -moz-user-select: none;
18
18
  -ms-user-select: none;
19
- `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${xn}px`,e.style.height=`${xn}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=lp.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new Ze(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_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){t.keyCode!==aS||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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()}};ul.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};ul.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};dp=ul});var pp,mp=p(()=>{"use strict";pp={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var gp=p(()=>{P();me();fp();mp();I.add(dp);I.mixin(nt,pp)});var cs,xp=p(()=>{P();cs=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),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}};cs.extension=x.Application});var Qe,_n=p(()=>{"use strict";Qe=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Qe||{})});var Zr,_p=p(()=>{"use strict";Zr=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var yp,Kt,ls=p(()=>{_n();_p();yp=class ie{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 Zr(null,null,1/0),this.deltaMS=1/ie.targetFPMS,this.elapsedMS=1/ie.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=Qe.NORMAL){return this._addListener(new Zr(t,e,r))}addOnce(t,e,r=Qe.NORMAL){return this._addListener(new Zr(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*ie.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,ie.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!ie._shared){let t=ie._shared=new ie;t.autoStart=!0,t._protected=!0}return ie._shared}static get system(){if(!ie._system){let t=ie._system=new ie;t.autoStart=!0,t._protected=!0}return ie._system}};yp.targetFPMS=.06;Kt=yp});var hs,bp=p(()=>{P();_n();ls();hs=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Qe.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Kt.shared:new Kt,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};hs.extension=x.Application});var dl=p(()=>{P();xp();bp();I.add(cs);I.add(hs)});var fl,Se,pl=p(()=>{_n();ls();fl=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||(Kt.system.add(this._tickerUpdate,this,Qe.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Kt.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},Se=new fl});var We,yn=p(()=>{ne();mn();We=class extends Ze{constructor(){super(...arguments),this.client=new $,this.movement=new $,this.offset=new $,this.global=new $,this.screen=new $}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,c,l,h,u,d,f,m,g){throw new Error("Method not implemented.")}}});var Dt,ml=p(()=>{yn();Dt=class extends We{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var we,gl=p(()=>{yn();we=class extends We{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};we.DOM_DELTA_PIXEL=0;we.DOM_DELTA_LINE=1;we.DOM_DELTA_PAGE=2});var fS,pS,us,bn,vp=p(()=>{It();ne();it();pl();yn();ml();gl();fS=2048,pS=new $,us=new $,bn=class{constructor(t){this.dispatch=new ot,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.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)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else k(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){Se.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,pS.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<fS&&t!==this.rootTarget&&t.parent;r++){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,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Se.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children;for(let u=h.length-1;u>=0;u--){let d=h[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let c=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:c&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Se.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children,l=r;for(let h=c.length-1;h>=0;h--){let u=c[h],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,us),!t.hitArea.contains(us.x,us.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,us),t.containsPoint(us)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let c=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,c,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let h=this.createPointerEvent(t,"pointerleave",o);for(h.eventPhase=h.AT_TARGET;h.target&&!e.composedPath().includes(h.target);)h.currentTarget=h.target,this.notifyTarget(h),r&&this.notifyTarget(h,"mouseleave"),h.target=h.target.parent;this.freeEvent(h)}this.freeEvent(l)}if(o!==e.target){let c=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,c);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let h=o?.parent;for(;h&&h!==this.rootTarget.parent&&h!==e.target;)h=h.parent;if(!h||h===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let c=r.button===2;this.notifyTarget(r,c?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let c=s.clicksByButton[t.button];if(c.target===a.target&&e-c.timeStamp<200?++c.clickCount:c.clickCount=1,c.target=a.target,c.timeStamp=e,a.detail=c.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Dt)){k("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof we)){k("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Dt);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(we);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Dt);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Dt&&e instanceof Dt&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof We&&e instanceof We&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var mS,gS,_l,vn,yl=p(()=>{P();vp();pl();ml();gl();mS=1,gS={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},_l=class xl{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new bn(null),Se.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Dt(null),this._rootWheelEvent=new we(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...xl.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=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){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,xl._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),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)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Se.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,Se.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;Se.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;Se.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=mS),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=gS[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};_l.extension={name:"events",type:[x.WebGLSystem,x.CanvasSystem,x.WebGPUSystem],priority:-1};_l.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};vn=_l});var Tp,Sp=p(()=>{yl();mn();Tp={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??vn.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,c=this;s&&s.addEventListener("abort",()=>{c.off(i,a,n)}),o?c.once(i,a,n):c.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof Ze))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var wp=p(()=>{P();me();yl();Sp();I.add(vn);I.mixin(nt,Tp)});var ds,Ep=p(()=>{P();ds=class{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){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,c=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${c}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-c}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};ds.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"dom"}});var Je,Tn=p(()=>{$t();me();Je=class extends nt{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new rt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,c=a.length;for(let l=0;l<c;l++)a[l].collectRenderables(t,e,r)}}});var Pp=p(()=>{P();Ep();I.add(ds)});var Et,ze=p(()=>{"use strict";Et=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Et||{})});var Ap,Cp=p(()=>{"use strict";Ap={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var Mp,D,ct=p(()=>{Cp();Mp=Ap,D={get(){return Mp},set(i){Mp=i}}});function ge(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function fs(i){return i.split("?")[0].split("#")[0]}function xS(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _S(i,t,e){return i.replace(new RegExp(xS(t),"g"),e)}function yS(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let c=e.lastIndexOf("/");if(c!==e.length-1){c===-1?(e="",r=0):(e=e.slice(0,c),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var Tt,Er=p(()=>{ct();Tt={toPosix(i){return _S(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){ge(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(ge(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=fs(this.toPosix(t??D.get().getBaseUrl())),s=fs(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?Tt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ge(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=yS(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ge(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(ge(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(ge(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){ge(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){ge(i),t&&ge(t),i=fs(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let c=i.charCodeAt(o);if(c===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(c===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){ge(i),i=fs(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){ge(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=fs(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,c=-1,l=!0,h=i.length-1,u=0;for(;h>=s;--h){if(e=i.charCodeAt(h),e===47){if(!l){a=h+1;break}continue}c===-1&&(l=!1,c=h+1),e===46?n===-1?n=h:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||c===-1||u===0||u===1&&n===c-1&&n===a+1?c!==-1&&(a===0&&r?t.base=t.name=i.slice(1,c):t.base=t.name=i.slice(a,c)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,c)):(t.name=i.slice(a,n),t.base=i.slice(a,c)),t.ext=i.slice(n,c)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Ot,ps=p(()=>{"use strict";Ot=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function Bp(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?Bp(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function Rp(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),Bp(i,s,0,e,r)}else r.push(i);return r}var Gp=p(()=>{"use strict"});var Pr,Sn=p(()=>{"use strict";Pr=i=>!Array.isArray(i)});function bS(i){return i.split(".").pop().split("?").shift().split("#").shift()}var se,Qr=p(()=>{it();Er();ps();Gp();Sn();se=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Ot(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&k("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,c;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),c=[a,l]}else{let l=a.map(h=>this._createBundleAssetId(t,h));r.push(...l),c=[...a,...l]}this.add({...o,alias:c,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&k(`[Resolver] already has key: ${o} overwriting`)},Ot(e).forEach(o=>{let{src:n}=o,{data:a,format:c,loadParser:l}=o,h=Ot(n).map(f=>typeof f=="string"?Rp(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];h.forEach(f=>{f.forEach(m=>{let g={};if(typeof m!="object"){g.src=m;for(let _=0;_<this._parsers.length;_++){let b=this._parsers[_];if(b.test(m)){g=b.parse(m);break}}}else a=m.data??a,c=m.format??c,l=m.loadParser??l,g={...g,...m};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:c,loadParser:l}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=Pr(t);t=Ot(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let c in n){let l=n[c];a[this._extractAssetIdFromBundle(s,c)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Pr(t);t=Ot(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(c=>{let l=o.filter(h=>h[a]?h[a]===c:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=Tt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??bS(t.src),t}};se.RETINA_PREFIX=/@([0-9\.]+)x/});var ms,bl=p(()=>{"use strict";ms=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var Ip,vl,kp=p(()=>{vt();tt();Ip=class gs{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof M?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,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<=gs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=gs.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,c=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,h=new z(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new z(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(c=new z(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new M({source:this.textureSource,frame:a,orig:h,trim:c,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*gs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*gs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Ip.BATCH_SIZE=1e3;vl=Ip});function Fp(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=Tt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=Fp([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var vS,Up,Dp=p(()=>{ze();Qr();bl();P();tt();Er();kp();vS=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];Up={extension:x.Asset,cache:{test:i=>i instanceof vl,getCacheableAssets:(i,t)=>Fp(i,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&vS.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:Et.Normal,name:"spritesheetLoader"},async testParse(i,t){return Tt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=Tt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof M)a=r;else{let h=ms(n+(s??i.meta.image),t.src);a=(await e.load([{src:h,data:o}]))[h]}let c=new vl(a.source,i);await c.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let h=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=ms(f,t.src),h.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(h);c.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[c].concat(c.linkedSheets.filter(f=>f!==d))})}return c},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var wn=p(()=>{P();Dp();I.add(Up)});function En(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Tl=p(()=>{"use strict"});var Lt,Pn=p(()=>{rn();tt();Tl();dt();Tn();Lt=class i extends Je{constructor(t=M.EMPTY){t instanceof M&&(t={texture:t});let{texture:e=M.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof M?new i(t):new i(M.from(t,e))}set texture(t){t||(t=M.EMPTY);let 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 En(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return U("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function An(i,t,e){let r=TS;i.measurable=!0,Vr(i,e,r),t.addBoundsMask(r),i.measurable=!1}var TS,Sl=p(()=>{$t();is();TS=new rt});function Cn(i,t,e){let r=re.get();i.measurable=!0;let s=yt.get().identity(),o=Op(i,e,s);Xr(i,r,o),i.measurable=!1,t.addBoundsMask(r),yt.return(s),re.return(r)}function Op(i,t,e){return i?(i!==t&&(Op(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(k("Mask bounds, renderable is not inside the root container"),e)}var wl=p(()=>{hn();_r();it()});var xs,Lp=p(()=>{P();Pn();Sl();wl();xs=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Lt),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||An(this.mask,t,e)}addLocalBounds(t,e){Cn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Lt}};xs.extension=x.MaskEffect});var _s,Np=p(()=>{P();_s=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};_s.extension=x.MaskEffect});var ys,Hp=p(()=>{P();me();Sl();wl();ys=class{constructor(t){this.priority=0,this.pipe="stencilMask",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){An(this.mask,t,e)}addLocalBounds(t,e){Cn(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof nt}};ys.extension=x.MaskEffect});var kt,Jr=p(()=>{ct();P();Yt();kt=class extends J{constructor(t){t.resource||(t.resource=D.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,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}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"))}};kt.extension=x.TextureSource});var qt,ti=p(()=>{ct();P();it();Yt();qt=class extends J{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=D.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,k("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};qt.extension=x.TextureSource});async function Mn(){return El??(El=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,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);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),El}var El,Pl=p(()=>{"use strict"});var Bn,ei,Al=p(()=>{P();ls();Pl();Yt();Bn=class Wp extends J{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...Wp.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Kt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Mn(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Kt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Kt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Kt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Bn.extension=x.TextureSource;Bn.defaultOptions={...J.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Bn.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ei=Bn});var Cl,Q,tr=p(()=>{it();ps();Cl=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){let e=this._cache.get(t);return e||k(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Ot(t),s;for(let c=0;c<this.parsers.length;c++){let l=this.parsers[c];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(c=>{o.set(c,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(c=>{this._cacheMap.set(c,a)}),n.forEach(c=>{let l=s?s[c]:e;this._cache.has(c)&&this._cache.get(c)!==l&&k("[Cache] already has key:",c),this._cache.set(c,o.get(c))})}remove(t){if(!this._cacheMap.has(t)){k(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},Q=new Cl});function zp(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Ml.length;s++){let o=Ml[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function Vp(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&Q.has(r))return Q.get(r);let o=new M({source:zp(s)});return o.on("destroy",()=>{Q.has(r)&&Q.remove(r)}),t||Q.set(r,o),o}function jp(i,t=!1){return typeof i=="string"?Q.get(i):i instanceof J?new M({source:i}):Vp(i,t)}var Ml,Bl=p(()=>{tr();P();Yt();tt();Ml=[];I.handleByList(x.TextureSource,Ml);M.from=jp;J.from=zp});var Rn=p(()=>{P();Lp();Np();Hp();rl();Jr();ti();Al();Bl();I.add(xs,_s,ys,ei,qt,kt,Sr)});var Pt,er=p(()=>{"use strict";Pt=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function In(){return(!Gn||Gn?.isContextLost())&&(Gn=D.get().createCanvas().getContext("webgl",{})),Gn}var Gn,Rl=p(()=>{ct()});function wS(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
- else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Xp(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=SS.replace(/%forloop%/gi,wS(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e)}return i}var SS,$p=p(()=>{"use strict";SS=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
- `)});function ae(){if(ri)return ri;let i=In();return ri=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ri=Xp(ri,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ri}var ri,Ar=p(()=>{Rl();$p();ri=null});function ii(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return Yp[e]||ES(i,t,e)}function ES(i,t,e){let r={},s=0;Gl||(Gl=ae());for(let n=0;n<Gl;n++){let a=n<t?i[n]:M.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new Pt(r);return Yp[e]=o,o}var Yp,Gl,kn=p(()=>{er();tt();Ar();Yp={};Gl=0});var Ee,Il=p(()=>{"use strict";Ee=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function bs(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var kl=p(()=>{"use strict"});var Kp,lt,Cr=p(()=>{"use strict";Kp={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},lt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(lt||{})});function Ve(i,t){return t.alphaMode==="no-premultiply-alpha"&&Kp[i]||i}var vs=p(()=>{Cr()});var Fn,qp=p(()=>{"use strict";Fn=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function Zp(){return Ul>0?Jp[--Ul]:new Fl}function Qp(i){Jp[Ul++]=i}var Fl,Jp,Ul,Ts,tm,em,rm=p(()=>{Rt();Il();kl();vs();Ar();qp();Fl=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Fn,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Jp=[],Ul=0;Ts=0,tm=class Un{constructor(t={}){this.uid=X("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],Un.defaultOptions.maxTextures=Un.defaultOptions.maxTextures??ae(),t={...Un.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Ee(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Qp(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=Zp(),s=r.textures;s.clear();let o=e[this.elementStart],n=Ve(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let c=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,h=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",m=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let _=e[g];e[g]=null;let y=_.texture._source,v=Ve(_.blendMode,y),S=n!==v||a!==_.topology;if(y._batchTick===Ts&&!S){_._textureId=y._textureBindLocation,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,c,l,_._attributeStart,_._textureId),this.packQuadIndex(h,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,c,l,_._attributeStart,_._textureId),this.packIndex(_,h,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=r;continue}y._batchTick=Ts,(s.count>=m||S)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=v,a=_.topology,r=Zp(),s=r.textures,s.clear(),++Ts),_._textureId=y._textureBindLocation=s.count,s.ids[y.uid]=s.count,s.textures[s.count++]=y,_._batch=r,u+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,c,l,_._attributeStart,_._textureId),this.packQuadIndex(h,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,c,l,_._attributeStart,_._textureId),this.packIndex(_,h,_._indexStart,_._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Ts),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,c){t.gpuBindGroup=null,t.bindGroup=null,t.action=c,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Ts,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Ee(e);bs(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else bs(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,c=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-c}destroy(){for(let t=0;t<this.batches.length;t++)Qp(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};tm.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};em=tm});var j,je=p(()=>{"use strict";j=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(j||{})});var gt,rr=p(()=>{It();Rt();je();gt=class extends ot{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=X("buffer"),this._resourceType="buffer",this._resourceId=X("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,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&j.STATIC)}set static(t){t?this.descriptor.usage|=j.STATIC:this.descriptor.usage&=~j.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=X("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function Dl(i,t){if(!(i instanceof gt)){let e=t?j.INDEX:j.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=j.INDEX|j.COPY_DST):(i=new Float32Array(i),e=j.VERTEX|j.COPY_DST)),i=new gt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var im=p(()=>{rr();je()});function sm(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,c=-1/0,l=s.BYTES_PER_ELEMENT,h=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=h;d<s.length;d+=u){let f=s[d],m=s[d+1];f>a&&(a=f),m>c&&(c=m),f<o&&(o=f),m<n&&(n=m)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=c,e}var om=p(()=>{"use strict"});function PS(i){return(i instanceof gt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=Dl(i.buffer,!1),i}var ce,si=p(()=>{It();$t();Rt();rr();im();om();ce=class extends ot{constructor(t={}){super(),this.uid=X("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new rt,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=PS(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=Dl(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,sm(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var AS,CS,Dn,nm=p(()=>{rr();je();si();AS=new Float32Array(1),CS=new Uint32Array(1),Dn=class extends ce{constructor(){let e=new gt({data:AS,label:"attribute-batch-buffer",usage:j.VERTEX|j.COPY_DST,shrinkToFit:!1}),r=new gt({data:CS,label:"index-batch-buffer",usage:j.INDEX|j.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Xe(i,t){let e=am[i];return e===void 0&&(Ol[t]===void 0&&(Ol[t]=1),am[i]=e=Ol[t]++),e}var Ol,am,Ss=p(()=>{"use strict";Ol=Object.create(null),am=Object.create(null)});function cm(){if(!On){On="mediump";let i=In();i&&i.getShaderPrecisionFormat&&(On=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return On}var On,lm=p(()=>{Rl()});function hm(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
19
+ `,t.accessibleText&&(e.innerText=t.accessibleText)),e.style.width=`${al}px`,e.style.height=`${al}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=F_.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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t.interactive&&(t._accessibleDiv.tabIndex=t.tabIndex)}_dispatchEvent(t,e){let{container:r}=t.target,s=this._renderer.events.rootBoundary,o=Object.assign(new ci(s),{target:r});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(n=>s.dispatchEvent(o,n))}_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){t.keyCode!==dR||!this._activateOnTab||this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||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()}};Id.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"accessibility"};Id.defaultOptions={enabledByDefault:!1,debug:!1,activateOnTab:!0,deactivateOnMouseMove:!0};k_=Id});var N_,D_=m(()=>{"use strict";N_={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessibleText:null,accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1}});var L_=m(()=>{R();cr();O_();D_();D.add(k_);D.mixin(Et,N_)});var pn,H_=m(()=>{R();pn=class{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,r;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,r=globalThis.innerHeight;else{let{clientWidth:s,clientHeight:o}=this._resizeTo;e=s,r=o}this.renderer.resize(e,r),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}};pn.extension=y.Application});var di,hl=m(()=>{"use strict";di=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(di||{})});var Bs,V_=m(()=>{"use strict";Bs=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));let e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}}});var W_,Ie,mn=m(()=>{hl();V_();W_=class He{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 Bs(null,null,1/0),this.deltaMS=1/He.targetFPMS,this.elapsedMS=1/He.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=di.NORMAL){return this._addListener(new Bs(t,e,r))}addOnce(t,e,r=di.NORMAL){return this._addListener(new Bs(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*He.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,He.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!He._shared){let t=He._shared=new He;t.autoStart=!0,t._protected=!0}return He._shared}static get system(){if(!He._system){let t=He._system=new He;t.autoStart=!0,t._protected=!0}return He._system}};W_.targetFPMS=.06;Ie=W_});var gn,z_=m(()=>{R();hl();mn();gn=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,di.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?Ie.shared:new Ie,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};gn.extension=y.Application});var Fd=m(()=>{R();H_();z_();D.add(pn);D.add(gn)});var Gd,br,Ud=m(()=>{hl();mn();Gd=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||(Ie.system.add(this._tickerUpdate,this,di.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(Ie.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||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._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this._update())}},br=new Gd});var zr,ll=m(()=>{Ze();ol();zr=class extends ci{constructor(){super(...arguments),this.client=new at,this.movement=new at,this.offset=new at,this.global=new at,this.screen=new at}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)}getModifierState(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}initMouseEvent(t,e,r,s,o,n,a,h,l,c,u,d,f,p,g){throw new Error("Method not implemented.")}}});var Te,kd=m(()=>{ll();Te=class extends zr{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}getPredictedEvents(){throw new Error("getPredictedEvents is not supported!")}}});var vr,Od=m(()=>{ll();vr=class extends zr{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};vr.DOM_DELTA_PIXEL=0;vr.DOM_DELTA_LINE=1;vr.DOM_DELTA_PAGE=2});var _R,yR,xn,cl,$_=m(()=>{me();Ze();vt();Ud();ll();kd();Od();_R=2048,yR=new at,xn=new at,cl=class{constructor(t){this.dispatch=new At,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=t,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping("pointerdown",this.mapPointerDown),this.addEventMapping("pointermove",this.mapPointerMove),this.addEventMapping("pointerout",this.mapPointerOut),this.addEventMapping("pointerleave",this.mapPointerOut),this.addEventMapping("pointerover",this.mapPointerOver),this.addEventMapping("pointerup",this.mapPointerUp),this.addEventMapping("pointerupoutside",this.mapPointerUpOutside),this.addEventMapping("wheel",this.mapWheel)}addEventMapping(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((r,s)=>r.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)return;let e=this.mappingTable[t.type];if(e)for(let r=0,s=e.length;r<s;r++)e[r].fn(t);else H(`[EventBoundary]: Event mapping not defined for ${t.type}`)}hitTest(t,e){br.pauseUpdate=!0;let s=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?"hitTestMoveRecursive":"hitTestRecursive",o=this[s](this.rootTarget,this.rootTarget.eventMode,yR.set(t,e),this.hitTestFn,this.hitPruneFn);return o&&o[0]}propagate(t,e){if(!t.target)return;let r=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(let s=0,o=r.length-1;s<o;s++)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!(t.propagationStopped||t.propagationImmediatelyStopped)){t.eventPhase=t.BUBBLING_PHASE;for(let s=r.length-2;s>=0;s--)if(t.currentTarget=r[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,r=this._allInteractiveElements){if(r.length===0)return;t.eventPhase=t.BUBBLING_PHASE;let s=Array.isArray(e)?e:[e];for(let o=r.length-1;o>=0;o--)s.forEach(n=>{t.currentTarget=r[o],this.notifyTarget(t,n)})}propagationPath(t){let e=[t];for(let r=0;r<_R&&t!==this.rootTarget&&t.parent;r++){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,r,s,o,n=!1){let a=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(br.pauseUpdate=!1),t.interactiveChildren&&t.children){let c=t.children;for(let u=c.length-1;u>=0;u--){let d=c[u],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,r,s,o,n||o(t,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;let p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}let h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),n||this._hitElements.length>0?null:a?this._hitElements:h&&!o(t,r)&&s(t,r)?l?[t]:[]:null}hitTestRecursive(t,e,r,s,o){if(this._interactivePrune(t)||o(t,r))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(br.pauseUpdate=!1),t.interactiveChildren&&t.children){let h=t.children,l=r;for(let c=h.length-1;c>=0;c--){let u=h[c],d=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,l,s,o);if(d){if(d.length>0&&!d[d.length-1].parent)continue;let f=t.isInteractive();return(d.length>0||f)&&d.push(t),d}}}let n=this._isInteractive(e),a=t.isInteractive();return n&&s(t,r)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,xn),!t.hitArea.contains(xn.x,xn.y)))return!0;if(t.effects&&t.effects.length)for(let r=0;r<t.effects.length;r++){let s=t.effects[r];if(s.containsPoint&&!s.containsPoint(e,this.hitTestFn))return!0}return!1}hitTestFn(t,e){return t.hitArea?!0:t?.containsPoint?(t.worldTransform.applyInverse(e,xn),t.containsPoint(xn)):!1}notifyTarget(t,e){if(!t.currentTarget.isInteractive())return;e??(e=t.type);let r=`on${e}`;t.currentTarget[r]?.(t);let s=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this._notifyListeners(t,s),t.eventPhase===t.AT_TARGET&&this._notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof Te)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){let s=e.button===2;this.dispatchEvent(e,s?"rightdown":"mousedown")}let r=this.trackingData(t.pointerId);r.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){if(!(t instanceof Te)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let e=this.createPointerEvent(t);this._isPointerMoveEvent=!1;let r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&o!==e.target){let h=t.type==="mousemove"?"mouseout":"pointerout",l=this.createPointerEvent(t,h,o);if(this.dispatchEvent(l,"pointerout"),r&&this.dispatchEvent(l,"mouseout"),!e.composedPath().includes(o)){let c=this.createPointerEvent(t,"pointerleave",o);for(c.eventPhase=c.AT_TARGET;c.target&&!e.composedPath().includes(c.target);)c.currentTarget=c.target,this.notifyTarget(c),r&&this.notifyTarget(c,"mouseleave"),c.target=c.target.parent;this.freeEvent(c)}this.freeEvent(l)}if(o!==e.target){let h=t.type==="mousemove"?"mouseover":"pointerover",l=this.clonePointerEvent(e,h);this.dispatchEvent(l,"pointerover"),r&&this.dispatchEvent(l,"mouseover");let c=o?.parent;for(;c&&c!==this.rootTarget.parent&&c!==e.target;)c=c.parent;if(!c||c===this.rootTarget.parent){let d=this.clonePointerEvent(e,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==o&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(l)}let n=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?n.push("pointermove"):this.dispatchEvent(e,"pointermove"),a&&n.push("globalpointermove"),e.pointerType==="touch"&&(this.moveOnAll?n.splice(1,0,"touchmove"):this.dispatchEvent(e,"touchmove"),a&&n.push("globaltouchmove")),r&&(this.moveOnAll?n.splice(1,0,"mousemove"):this.dispatchEvent(e,"mousemove"),a&&n.push("globalmousemove"),this.cursor=e.target?.cursor),n.length>0&&this.all(e,n),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=e.composedPath(),this.freeEvent(e)}mapPointerOver(t){if(!(t instanceof Te)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.createPointerEvent(t),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);let o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;e.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Te)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId);if(e.overTargets){let r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),o=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(o),r&&this.dispatchEvent(o,"mouseout");let n=this.createPointerEvent(t,"pointerleave",s);for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),r&&this.notifyTarget(n,"mouseleave"),n.target=n.target.parent;e.overTargets=null,this.freeEvent(o),this.freeEvent(n)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Te)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=performance.now(),r=this.createPointerEvent(t);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let a=r.button===2;this.dispatchEvent(r,a?"rightup":"mouseup")}let s=this.trackingData(t.pointerId),o=this.findMountedTarget(s.pressTargetsByButton[t.button]),n=o;if(o&&!r.composedPath().includes(o)){let a=o;for(;a&&!r.composedPath().includes(a);){if(r.currentTarget=a,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){let h=r.button===2;this.notifyTarget(r,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],n=a}if(n){let a=this.clonePointerEvent(r,"click");a.target=n,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});let h=s.clicksByButton[t.button];if(h.target===a.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=e,a.detail=h.clickCount,a.pointerType==="mouse"){let l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(r)}mapPointerUpOutside(t){if(!(t instanceof Te)){H("EventBoundary cannot map a non-pointer event as a pointer event");return}let e=this.trackingData(t.pointerId),r=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(r){let o=r;for(;o;)s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),o=o.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof vr)){H("EventBoundary cannot map a non-wheel event as a wheel event");return}let e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let r=1;r<t.length&&t[r].parent===e;r++)e=t[r];return e}createPointerEvent(t,e,r){let s=this.allocateEvent(Te);return this.copyPointerData(t,s),this.copyMouseData(t,s),this.copyData(t,s),s.nativeEvent=t.nativeEvent,s.originalEvent=t,s.target=r??this.hitTest(s.global.x,s.global.y)??this._hitElements[0],typeof e=="string"&&(s.type=e),s}createWheelEvent(t){let e=this.allocateEvent(vr);return this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t,e.target=this.hitTest(e.global.x,e.global.y),e}clonePointerEvent(t,e){let r=this.allocateEvent(Te);return r.nativeEvent=t.nativeEvent,r.originalEvent=t.originalEvent,this.copyPointerData(t,r),this.copyMouseData(t,r),this.copyData(t,r),r.target=t.target,r.path=t.composedPath().slice(),r.type=e??r.type,r}copyWheelData(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}copyPointerData(t,e){t instanceof Te&&e instanceof Te&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}copyMouseData(t,e){t instanceof zr&&e instanceof zr&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.copyFrom(t.client),e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.copyFrom(t.movement),e.screen.copyFrom(t.screen),e.shiftKey=t.shiftKey,e.global.copyFrom(t.global))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.copyFrom(t.layer),e.page.copyFrom(t.page)}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){this.eventPool.has(t)||this.eventPool.set(t,[]);let e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.defaultPrevented=!1,e.path=null,e.target=null,e}freeEvent(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");let e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}_notifyListeners(t,e){let r=t.currentTarget._events[e];if(r)if("fn"in r)r.once&&t.currentTarget.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(let s=0,o=r.length;s<o&&!t.propagationImmediatelyStopped;s++)r[s].once&&t.currentTarget.removeListener(e,r[s].fn,void 0,!0),r[s].fn.call(r[s].context,t)}}});var bR,vR,Dd,ul,Ld=m(()=>{R();$_();Ud();kd();Od();bR=1,vR={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Dd=class Nd{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new cl(null),br.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Te(null),this._rootWheelEvent=new vr(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy({...Nd.defaultEventFeatures},{set:(e,r,s)=>(r==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[r]=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){let{canvas:e,resolution:r}=this.renderer;this.setTargetElement(e),this.resolution=r,Nd._defaultEventMode=t.eventMode??"passive",Object.assign(this.features,t.eventFeatures??{}),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)return;this._currentCursor=t;let r=this.cursorStyles[t];if(r)switch(typeof r){case"string":e&&(this.domElement.style.cursor=r);break;case"function":r(t);break;case"object":e&&Object.assign(this.domElement.style,r);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let r=0,s=e.length;r<s;r++){let o=e[r],n=this._bootstrapEvent(this._rootPointerEvent,o);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}_onPointerMove(t){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,br.pointerMoved();let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}_onPointerUp(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=t.target;t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]);let r=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let o=0,n=s.length;o<n;o++){let a=this._bootstrapEvent(this._rootPointerEvent,s[o]);a.type+=r,this.rootBoundary.mapEvent(a)}this.setCursor(this.rootBoundary.cursor)}_onPointerOverOut(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let e=this._normalizeToPointerData(t);for(let r=0,s=e.length;r<s;r++){let o=this._bootstrapEvent(this._rootPointerEvent,e[r]);this.rootBoundary.mapEvent(o)}this.setCursor(this.rootBoundary.cursor)}onWheel(t){if(!this.features.wheel)return;let e=this.normalizeWheelEvent(t);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(e)}setTargetElement(t){this._removeEvents(),this.domElement=t,br.domElement=t,this._addEvents()}_addEvents(){if(this._eventsAdded||!this.domElement)return;br.addTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none")),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this._onPointerMove,!0),this.domElement.addEventListener("pointerdown",this._onPointerDown,!0),this.domElement.addEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.addEventListener("pointerover",this._onPointerOverOut,!0),globalThis.addEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.addEventListener("mousemove",this._onPointerMove,!0),this.domElement.addEventListener("mousedown",this._onPointerDown,!0),this.domElement.addEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.addEventListener("mouseover",this._onPointerOverOut,!0),globalThis.addEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener("touchstart",this._onPointerDown,!0),this.domElement.addEventListener("touchend",this._onPointerUp,!0),this.domElement.addEventListener("touchmove",this._onPointerMove,!0))),this.domElement.addEventListener("wheel",this.onWheel,{passive:!0,capture:!0}),this._eventsAdded=!0}_removeEvents(){if(!this._eventsAdded||!this.domElement)return;br.removeTickerListener();let t=this.domElement.style;t&&(globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction="")),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this._onPointerMove,!0),this.domElement.removeEventListener("pointerdown",this._onPointerDown,!0),this.domElement.removeEventListener("pointerleave",this._onPointerOverOut,!0),this.domElement.removeEventListener("pointerover",this._onPointerOverOut,!0),globalThis.removeEventListener("pointerup",this._onPointerUp,!0)):(globalThis.document.removeEventListener("mousemove",this._onPointerMove,!0),this.domElement.removeEventListener("mousedown",this._onPointerDown,!0),this.domElement.removeEventListener("mouseout",this._onPointerOverOut,!0),this.domElement.removeEventListener("mouseover",this._onPointerOverOut,!0),globalThis.removeEventListener("mouseup",this._onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener("touchstart",this._onPointerDown,!0),this.domElement.removeEventListener("touchend",this._onPointerUp,!0),this.domElement.removeEventListener("touchmove",this._onPointerMove,!0))),this.domElement.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this._eventsAdded=!1}mapPositionToPoint(t,e,r){let s=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},o=1/this.resolution;t.x=(e-s.left)*(this.domElement.width/s.width)*o,t.y=(r-s.top)*(this.domElement.height/s.height)*o}_normalizeToPointerData(t){let e=[];if(this.supportsTouchEvents&&t instanceof TouchEvent)for(let r=0,s=t.changedTouches.length;r<s;r++){let o=t.changedTouches[r];typeof o.button>"u"&&(o.button=0),typeof o.buttons>"u"&&(o.buttons=1),typeof o.isPrimary>"u"&&(o.isPrimary=t.touches.length===1&&t.type==="touchstart"),typeof o.width>"u"&&(o.width=o.radiusX||1),typeof o.height>"u"&&(o.height=o.radiusY||1),typeof o.tiltX>"u"&&(o.tiltX=0),typeof o.tiltY>"u"&&(o.tiltY=0),typeof o.pointerType>"u"&&(o.pointerType="touch"),typeof o.pointerId>"u"&&(o.pointerId=o.identifier||0),typeof o.pressure>"u"&&(o.pressure=o.force||.5),typeof o.twist>"u"&&(o.twist=0),typeof o.tangentialPressure>"u"&&(o.tangentialPressure=0),typeof o.layerX>"u"&&(o.layerX=o.offsetX=o.clientX),typeof o.layerY>"u"&&(o.layerY=o.offsetY=o.clientY),o.isNormalized=!0,o.type=t.type,e.push(o)}else if(!globalThis.MouseEvent||t instanceof MouseEvent&&(!this.supportsPointerEvents||!(t instanceof globalThis.PointerEvent))){let r=t;typeof r.isPrimary>"u"&&(r.isPrimary=!0),typeof r.width>"u"&&(r.width=1),typeof r.height>"u"&&(r.height=1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="mouse"),typeof r.pointerId>"u"&&(r.pointerId=bR),typeof r.pressure>"u"&&(r.pressure=.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),r.isNormalized=!0,e.push(r)}else e.push(t);return e}normalizeWheelEvent(t){let e=this._rootWheelEvent;return this._transferMouseData(e,t),e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ,e.deltaMode=t.deltaMode,this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=t,e.type=t.type,e}_bootstrapEvent(t,e){return t.originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this._transferMouseData(t,e),this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.isTrusted=e.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=vR[t.type]||t.type),t}_transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.relatedTarget=null,t.shiftKey=e.shiftKey}};Dd.extension={name:"events",type:[y.WebGLSystem,y.CanvasSystem,y.WebGPUSystem],priority:-1};Dd.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};ul=Dd});var X_,j_=m(()=>{Ld();ol();X_={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,get interactive(){return this.eventMode==="dynamic"||this.eventMode==="static"},set interactive(i){this.eventMode=i?"static":"passive"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??ul.defaultEventMode},set eventMode(i){this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof e=="object"?e.signal:void 0,o=typeof e=="object"?e.once===!0:!1,n=typeof t=="function"?void 0:t;i=r?`${i}capture`:i;let a=typeof t=="function"?t:t.handleEvent,h=this;s&&s.addEventListener("abort",()=>{h.off(i,a,n)}),o?h.once(i,a,n):h.on(i,a,n)},removeEventListener(i,t,e){let r=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;i=r?`${i}capture`:i,t=typeof t=="function"?t:t.handleEvent,this.off(i,t,s)},dispatchEvent(i){if(!(i instanceof ci))throw new Error("Container cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}}});var Y_=m(()=>{R();cr();Ld();j_();D.add(ul);D.mixin(Et,X_)});var _n,q_=m(()=>{R();_n=class{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){let e=this._attachedDomElements.indexOf(t);e!==-1&&this._attachedDomElements.splice(e,1),t.off("destroyed",this._destroyRenderableBound)}postrender(){let t=this._attachedDomElements;if(t.length===0){this._domElement.remove();return}let e=this._renderer.view.canvas;this._domElement.parentNode!==e.parentNode&&e.parentNode?.appendChild(this._domElement),this._domElement.style.transform=`translate(${e.offsetLeft}px, ${e.offsetTop}px)`;for(let r=0;r<t.length;r++){let s=t[r],o=s.element;if(!s.parent||s.globalDisplayStatus<7)o.remove(),t.splice(r,1),r--;else{this._domElement.contains(o)||(o.style.position="absolute",o.style.pointerEvents="auto",this._domElement.appendChild(o));let n=s.worldTransform,a=s._anchor,h=s.width*a.x,l=s.height*a.y;o.style.transformOrigin=`${h}px ${l}px`,o.style.transform=`matrix(${n.a}, ${n.b}, ${n.c}, ${n.d}, ${n.tx-h}, ${n.ty-l})`,o.style.opacity=s.groupAlpha.toString()}}}destroy(){this._renderer.runners.postrender.remove(this);for(let t=0;t<this._attachedDomElements.length;t++){let e=this._attachedDomElements[t];e.off("destroyed",this._destroyRenderableBound),e.element.remove()}this._attachedDomElements.length=0,this._domElement.remove(),this._renderer=null}};_n.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"dom"}});var fi,dl=m(()=>{Me();cr();fi=class extends Et{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._bounds=new bt(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){let e=this.bounds,{x:r,y:s}=t;return r>=e.minX&&r<=e.maxX&&s>=e.minY&&s<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;let t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){let{renderPipes:s,renderableGC:o}=e;s.blendMode.setBlendMode(this,this.groupBlendMode,t),s[this.renderPipeId].addRenderable(this,t),o.addRenderable(this),this.didViewUpdate=!1;let a=this.children,h=a.length;for(let l=0;l<h;l++)a[l].collectRenderables(t,e,r)}}});var K_=m(()=>{R();q_();D.add(_n)});var re,$r=m(()=>{"use strict";re=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(re||{})});var Z_,Q_=m(()=>{"use strict";Z_={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")}});var J_,j,wt=m(()=>{Q_();J_=Z_,j={get(){return J_},set(i){J_=i}}});function ur(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function yn(i){return i.split("?")[0].split("#")[0]}function TR(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function SR(i,t,e){return i.replace(new RegExp(TR(t),"g"),e)}function AR(i,t){let e="",r=0,s=-1,o=0,n=-1;for(let a=0;a<=i.length;++a){if(a<i.length)n=i.charCodeAt(a);else{if(n===47)break;n=47}if(n===47){if(!(s===a-1||o===1))if(s!==a-1&&o===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){let h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",r=0):(e=e.slice(0,h),r=e.length-1-e.lastIndexOf("/")),s=a,o=0;continue}}else if(e.length===2||e.length===1){e="",r=0,s=a,o=0;continue}}t&&(e.length>0?e+="/..":e="..",r=2)}else e.length>0?e+=`/${i.slice(s+1,a)}`:e=i.slice(s+1,a),r=a-s-1;s=a,o=0}else n===46&&o!==-1?++o:o=-1}return e}var qt,Vi=m(()=>{wt();qt={toPosix(i){return SR(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){ur(i),i=this.toPosix(i);let t=/^file:\/\/\//.exec(i);if(t)return t[0];let e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(ur(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;let r=yn(this.toPosix(t??j.get().getBaseUrl())),s=yn(this.toPosix(e??this.rootname(r)));return i=this.toPosix(i),i.startsWith("/")?qt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(ur(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="",e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));let r=i.endsWith("/");return i=AR(i,!1),i.length>0&&r&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return ur(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let t;for(let e=0;e<i.length;++e){let r=i[e];if(ur(r),r.length>0)if(t===void 0)t=r;else{let s=i[e-1]??"";this.joinExtensions.includes(this.extname(s).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(i){if(ur(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0),e=t===47,r=-1,s=!0,o=this.getProtocol(i),n=i;i=i.slice(o.length);for(let a=i.length-1;a>=1;--a)if(t=i.charCodeAt(a),t===47){if(!s){r=a;break}}else s=!1;return r===-1?e?"/":this.isUrl(n)?o+i:o:e&&r===1?"//":o+i.slice(0,r)},rootname(i){ur(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){let e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){ur(i),t&&ur(t),i=yn(this.toPosix(i));let e=0,r=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let n=t.length-1,a=-1;for(o=i.length-1;o>=0;--o){let h=i.charCodeAt(o);if(h===47){if(!s){e=o+1;break}}else a===-1&&(s=!1,a=o+1),n>=0&&(h===t.charCodeAt(n)?--n===-1&&(r=o):(n=-1,r=a))}return e===r?r=a:r===-1&&(r=i.length),i.slice(e,r)}for(o=i.length-1;o>=0;--o)if(i.charCodeAt(o)===47){if(!s){e=o+1;break}}else r===-1&&(s=!1,r=o+1);return r===-1?"":i.slice(e,r)},extname(i){ur(i),i=yn(this.toPosix(i));let t=-1,e=0,r=-1,s=!0,o=0;for(let n=i.length-1;n>=0;--n){let a=i.charCodeAt(n);if(a===47){if(!s){e=n+1;break}continue}r===-1&&(s=!1,r=n+1),a===46?t===-1?t=n:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||r===-1||o===0||o===1&&t===r-1&&t===e+1?"":i.slice(t,r)},parse(i){ur(i);let t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=yn(this.toPosix(i));let e=i.charCodeAt(0),r=this.isAbsolute(i),s,o="";t.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,h=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(e=i.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}h===-1&&(l=!1,h=c+1),e===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||h===-1||u===0||u===1&&n===h-1&&n===a+1?h!==-1&&(a===0&&r?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(a,h)):(a===0&&r?(t.name=i.slice(1,n),t.base=i.slice(1,h)):(t.name=i.slice(a,n),t.base=i.slice(a,h)),t.ext=i.slice(n,h)),t.dir=this.dirname(i),o&&(t.dir=o+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]}});var Se,bn=m(()=>{"use strict";Se=(i,t,e=!1)=>(Array.isArray(i)||(i=[i]),t?i.map(r=>typeof r=="string"||e?t(r):r):i)});function ty(i,t,e,r,s){let o=t[e];for(let n=0;n<o.length;n++){let a=o[n];e<t.length-1?ty(i.replace(r[e],a),t,e+1,r,s):s.push(i.replace(r[e],a))}}function ey(i){let t=/\{(.*?)\}/g,e=i.match(t),r=[];if(e){let s=[];e.forEach(o=>{let n=o.substring(1,o.length-1).split(",");s.push(n)}),ty(i,s,0,e,r)}else r.push(i);return r}var ry=m(()=>{"use strict"});var Wi,fl=m(()=>{"use strict";Wi=i=>!Array.isArray(i)});function ER(i){return i.split(".").pop().split("?").shift().split("#").shift()}var Ve,Is=m(()=>{vt();Vi();bn();ry();fl();Ve=class{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{let e=t;this._defaultSearchParams=Object.keys(e).map(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){let{alias:e,src:r}=t;return Se(e||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(n=>n?.src??n):o?.src?o.src:o,!0)}addManifest(t){this._manifest&&H("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){let r=[],s=e;Array.isArray(e)||(s=Object.entries(e).map(([o,n])=>typeof n=="string"||Array.isArray(n)?{alias:o,src:n}:{alias:o,...n})),s.forEach(o=>{let n=o.src,a=o.alias,h;if(typeof a=="string"){let l=this._createBundleAssetId(t,a);r.push(l),h=[a,l]}else{let l=a.map(c=>this._createBundleAssetId(t,c));r.push(...l),h=[...a,...l]}this.add({...o,alias:h,src:n})}),this._bundles[t]=r}add(t){let e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=o=>{this.hasKey(o)&&H(`[Resolver] already has key: ${o} overwriting`)},Se(e).forEach(o=>{let{src:n}=o,{data:a,format:h,loadParser:l}=o,c=Se(n).map(f=>typeof f=="string"?ey(f):Array.isArray(f)?f:[f]),u=this.getAlias(o);Array.isArray(u)?u.forEach(r):r(u);let d=[];c.forEach(f=>{f.forEach(p=>{let g={};if(typeof p!="object"){g.src=p;for(let x=0;x<this._parsers.length;x++){let v=this._parsers[x];if(v.test(p)){g=v.parse(p);break}}}else a=p.data??a,h=p.format??h,l=p.loadParser??l,g={...g,...p};if(!u)throw new Error(`[Resolver] alias is undefined for this asset: ${g.src}`);g=this._buildResolvedAsset(g,{aliases:u,data:a,format:h,loadParser:l}),d.push(g)})}),u.forEach(f=>{this._assetMap[f]=d})})}resolveBundle(t){let e=Wi(t);t=Se(t);let r={};return t.forEach(s=>{let o=this._bundles[s];if(o){let n=this.resolve(o),a={};for(let h in n){let l=n[h];a[this._extractAssetIdFromBundle(s,h)]=l}r[s]=a}}),e?r[t[0]]:r}resolveUrl(t){let e=this.resolve(t);if(typeof t!="string"){let r={};for(let s in e)r[s]=e[s].src;return r}return e.src}resolve(t){let e=Wi(t);t=Se(t);let r={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let o=this._assetMap[s],n=this._getPreferredOrder(o);n?.priority.forEach(a=>{n.params[a].forEach(h=>{let l=o.filter(c=>c[a]?c[a]===h:!1);l.length&&(o=l)})}),this._resolverHash[s]=o[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});r[s]=this._resolverHash[s]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){let r=t[e],s=this._preferredOrder.find(o=>o.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;let e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){let{aliases:r,data:s,loadParser:o,format:n}=e;return(this._basePath||this._rootPath)&&(t.src=qt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...s||{},...t.data},t.loadParser=o??t.loadParser,t.format=n??t.format??ER(t.src),t}};Ve.RETINA_PREFIX=/@([0-9\.]+)x/});var vn,Hd=m(()=>{"use strict";vn=(i,t)=>{let e=t.split("?")[1];return e&&(i+=`?${e}`),i}});var iy,Vd,sy=m(()=>{Yt();xt();iy=class Tn{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof I?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;let r=parseFloat(e.meta.scale);r?(this.resolution=r,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<=Tn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t,r=Tn.BATCH_SIZE;for(;e-t<r&&e<this._frameKeys.length;){let s=this._frameKeys[e],o=this._frames[s],n=o.frame;if(n){let a=null,h=null,l=o.trimmed!==!1&&o.sourceSize?o.sourceSize:o.frame,c=new rt(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);o.rotated?a=new rt(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.h)/this.resolution,Math.floor(n.w)/this.resolution):a=new rt(Math.floor(n.x)/this.resolution,Math.floor(n.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution),o.trimmed!==!1&&o.spriteSourceSize&&(h=new rt(Math.floor(o.spriteSourceSize.x)/this.resolution,Math.floor(o.spriteSourceSize.y)/this.resolution,Math.floor(n.w)/this.resolution,Math.floor(n.h)/this.resolution)),this.textures[s]=new I({source:this.textureSource,frame:a,orig:c,trim:h,rotate:o.rotated?2:0,defaultAnchor:o.anchor,defaultBorders:o.borders,label:s.toString()})}e++}}_processAnimations(){let t=this.data.animations||{};for(let e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){let s=t[e][r];this.animations[e].push(this.textures[s])}}}_parseComplete(){let t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Tn.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Tn.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};iy.BATCH_SIZE=1e3;Vd=iy});function oy(i,t,e){let r={};if(i.forEach(s=>{r[s]=t}),Object.keys(t.textures).forEach(s=>{r[s]=t.textures[s]}),!e){let s=qt.dirname(i[0]);t.linkedSheets.forEach((o,n)=>{let a=oy([`${s}/${t.data.meta.related_multi_packs[n]}`],o,!0);Object.assign(r,a)})}return r}var wR,ny,ay=m(()=>{$r();Is();Hd();R();xt();Vi();sy();wR=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];ny={extension:y.Asset,cache:{test:i=>i instanceof Vd,getCacheableAssets:(i,t)=>oy(i,t,!1)},resolver:{extension:{type:y.ResolveParser,name:"resolveSpritesheet"},test:i=>{let e=i.split("?")[0].split("."),r=e.pop(),s=e.pop();return r==="json"&&wR.includes(s)},parse:i=>{let t=i.split(".");return{resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:t[t.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:y.LoadParser,priority:re.Normal,name:"spritesheetLoader"},async testParse(i,t){return qt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){let{texture:r,imageFilename:s,textureOptions:o}=t?.data??{},n=qt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a;if(r instanceof I)a=r;else{let c=vn(n+(s??i.meta.image),t.src);a=(await e.load([{src:c,data:o}]))[c]}let h=new Vd(a.source,i);await h.parse();let l=i?.meta?.related_multi_packs;if(Array.isArray(l)){let c=[];for(let d of l){if(typeof d!="string")continue;let f=n+d;t.data?.ignoreMultiPack||(f=vn(f,t.src),c.push(e.load({src:f,data:{textureOptions:o,ignoreMultiPack:!0}})))}let u=await Promise.all(c);h.linkedSheets=u,u.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},async unload(i,t,e){await e.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}}});var pl=m(()=>{R();ay();D.add(ny)});function ml(i,t,e){let{width:r,height:s}=e.orig,o=e.trim;if(o){let n=o.width,a=o.height;i.minX=o.x-t._x*r,i.maxX=i.minX+n,i.minY=o.y-t._y*s,i.maxY=i.minY+a}else i.minX=-t._x*r,i.maxX=i.minX+r,i.minY=-t._y*s,i.maxY=i.minY+s}var Wd=m(()=>{"use strict"});var de,gl=m(()=>{jh();xt();Wd();Ft();dl();de=class i extends fi{constructor(t=I.EMPTY){t instanceof I&&(t={texture:t});let{texture:e=I.EMPTY,anchor:r,roundPixels:s,width:o,height:n,...a}=t;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new ce({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=s??!1,o!==void 0&&(this.width=o),n!==void 0&&(this.height=n)}static from(t,e=!1){return t instanceof I?new i(t):new i(I.from(t,e))}set texture(t){t||(t=I.EMPTY);let 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 ml(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return X("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){let t=this._anchor,e=this._texture,r=this._bounds,{width:s,height:o}=e.orig;r.minX=-t._x*s,r.maxX=r.minX+s,r.minY=-t._y*o,r.maxY=r.minY+o}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}});function xl(i,t,e){let r=CR;i.measurable=!0,As(i,e,r),t.addBoundsMask(r),i.measurable=!1}var CR,zd=m(()=>{Me();cn();CR=new bt});function _l(i,t,e){let r=Le.get();i.measurable=!0;let s=Wt.get().identity(),o=hy(i,e,s);ws(i,r,o),i.measurable=!1,t.addBoundsMask(r),Wt.return(s),Le.return(r)}function hy(i,t,e){return i?(i!==t&&(hy(i.parent,t,e),i.updateLocalTransform(),e.append(i.localTransform)),e):(H("Mask bounds, renderable is not inside the root container"),e)}var $d=m(()=>{tl();Ui();vt()});var Sn,ly=m(()=>{R();gl();zd();$d();Sn=class{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof de),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||xl(this.mask,t,e)}addLocalBounds(t,e){_l(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof de}};Sn.extension=y.MaskEffect});var An,cy=m(()=>{R();An=class{constructor(t){this.priority=0,this.pipe="colorMask",t?.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}};An.extension=y.MaskEffect});var En,uy=m(()=>{R();cr();zd();$d();En=class{constructor(t){this.priority=0,this.pipe="stencilMask",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){xl(this.mask,t,e)}addLocalBounds(t,e){_l(this.mask,t,e)}containsPoint(t,e){let r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Et}};En.extension=y.MaskEffect});var ge,Fs=m(()=>{wt();R();Be();ge=class extends gt{constructor(t){t.resource||(t.resource=j.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,r=this._resolution){let s=super.resize(t,e,r);return s&&this.resizeCanvas(),s}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"))}};ge.extension=y.TextureSource});var Fe,Gs=m(()=>{wt();R();vt();Be();Fe=class extends gt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){let e=j.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e,H("ImageSource: Image element passed, converting to canvas. Use CanvasSource instead.")}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}};Fe.extension=y.TextureSource});async function yl(){return Xd??(Xd=(async()=>{let t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";let e=await new Promise(n=>{let a=document.createElement("video");a.onloadeddata=()=>n(a),a.onerror=()=>n(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";let r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);let s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,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);let o=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,o),t.deleteFramebuffer(s),t.deleteTexture(r),t.getExtension("WEBGL_lose_context")?.loseContext(),o[0]<=o[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Xd}var Xd,jd=m(()=>{"use strict"});var bl,Us,Yd=m(()=>{R();mn();jd();Be();bl=class dy extends gt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...dy.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){let t=Ie.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;let t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await yl(),this._load=new Promise((r,s)=>{this.isValid?r(this):(this._resolve=r,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){let t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();let t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ie.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ie.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ie.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};bl.extension=y.TextureSource;bl.defaultOptions={...gt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};bl.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};Us=bl});var qd,mt,pi=m(()=>{vt();bn();qd=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){let e=this._cache.get(t);return e||H(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){let r=Se(t),s;for(let h=0;h<this.parsers.length;h++){let l=this.parsers[h];if(l.test(e)){s=l.getCacheableAssets(r,e);break}}let o=new Map(Object.entries(s||{}));s||r.forEach(h=>{o.set(h,e)});let n=[...o.keys()],a={cacheKeys:n,keys:r};r.forEach(h=>{this._cacheMap.set(h,a)}),n.forEach(h=>{let l=s?s[h]:e;this._cache.has(h)&&this._cache.get(h)!==l&&H("[Cache] already has key:",h),this._cache.set(h,o.get(h))})}remove(t){if(!this._cacheMap.has(t)){H(`[Assets] Asset id ${t} was not found in the Cache`);return}let e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}},mt=new qd});function fy(i={}){let t=i&&i.resource,e=t?i.resource:i,r=t?i:{resource:i};for(let s=0;s<Kd.length;s++){let o=Kd[s];if(o.test(e))return new o(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function py(i={},t=!1){let e=i&&i.resource,r=e?i.resource:i,s=e?i:{resource:i};if(!t&&mt.has(r))return mt.get(r);let o=new I({source:fy(s)});return o.on("destroy",()=>{mt.has(r)&&mt.remove(r)}),t||mt.set(r,o),o}function my(i,t=!1){return typeof i=="string"?mt.get(i):i instanceof gt?new I({source:i}):py(i,t)}var Kd,Zd=m(()=>{pi();R();Be();xt();Kd=[];D.handleByList(y.TextureSource,Kd);I.from=my;gt.from=fy});var vl=m(()=>{R();ly();cy();uy();Td();Fs();Gs();Yd();Zd();D.add(Sn,An,En,Us,Fe,ge,Li)});var ie,mi=m(()=>{"use strict";ie=class{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(let r in t){let s=t[r];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;let t=[],e=0;for(let r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){let r=this.resources[e];t!==r&&(r&&t.off?.("change",this.onResourceChange,this),t.on?.("change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){let e=this.resources;for(let r in e)e[r]._touched=t}destroy(){let t=this.resources;for(let e in t)t[e].off?.("change",this.onResourceChange,this);this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){let e=this.resources;for(let r in e)e[r]===t&&(e[r]=null)}else this._updateKey()}}});function Sl(){return(!Tl||Tl?.isContextLost())&&(Tl=j.get().createCanvas().getContext("webgl",{})),Tl}var Tl,Qd=m(()=>{wt()});function RR(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
20
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function gy(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){let r=PR.replace(/%forloop%/gi,RR(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}}finally{t.deleteShader(e)}return i}var PR,xy=m(()=>{"use strict";PR=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
21
+ `)});function Qe(){if(ks)return ks;let i=Sl();return ks=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),ks=gy(ks,i),i.getExtension("WEBGL_lose_context")?.loseContext(),ks}var ks,zi=m(()=>{Qd();xy();ks=null});function Os(i,t){let e=2166136261;for(let r=0;r<t;r++)e^=i[r].uid,e=Math.imul(e,16777619),e>>>=0;return _y[e]||MR(i,t,e)}function MR(i,t,e){let r={},s=0;Jd||(Jd=Qe());for(let n=0;n<Jd;n++){let a=n<t?i[n]:I.EMPTY.source;r[s++]=a.source,r[s++]=a.style}let o=new ie(r);return _y[e]=o,o}var _y,Jd,Al=m(()=>{mi();xt();zi();_y={};Jd=0});var Tr,tf=m(()=>{"use strict";Tr=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this.uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}});function wn(i,t){let e=i.byteLength/8|0,r=new Float64Array(i,0,e);new Float64Array(t,0,e).set(r);let o=i.byteLength-e*8;if(o>0){let n=new Uint8Array(i,e*8,o);new Uint8Array(t,e*8,o).set(n)}}var ef=m(()=>{"use strict"});var yy,Pt,$i=m(()=>{"use strict";yy={normal:"normal-npm",add:"add-npm",screen:"screen-npm"},Pt=(i=>(i[i.DISABLED=0]="DISABLED",i[i.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",i[i.MASK_ACTIVE=2]="MASK_ACTIVE",i[i.INVERSE_MASK_ACTIVE=3]="INVERSE_MASK_ACTIVE",i[i.RENDERING_MASK_REMOVE=4]="RENDERING_MASK_REMOVE",i[i.NONE=5]="NONE",i))(Pt||{})});function Xr(i,t){return t.alphaMode==="no-premultiply-alpha"&&yy[i]||i}var Cn=m(()=>{$i()});var El,by=m(()=>{"use strict";El=class{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){let e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}});function vy(){return sf>0?Sy[--sf]:new rf}function Ty(i){Sy[sf++]=i}var rf,Sy,sf,Pn,Ay,Ey,wy=m(()=>{ue();tf();ef();Cn();zi();by();rf=class{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new El,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}},Sy=[],sf=0;Pn=0,Ay=class wl{constructor(t={}){this.uid=nt("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],wl.defaultOptions.maxTextures=wl.defaultOptions.maxTextures??Qe(),t={...wl.defaultOptions,...t};let{maxTextures:e,attributesInitialSize:r,indicesInitialSize:s}=t;this.attributeBuffer=new Tr(r*4),this.indexBuffer=new Uint16Array(s),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Ty(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){let r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,t.texture=e,!0)}updateElement(t){this.dirty=!0;let e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){let e=this._elements;if(!e[this.elementStart])return;let r=vy(),s=r.textures;s.clear();let o=e[this.elementStart],n=Xr(o.blendMode,o.texture._source),a=o.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);let h=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,c=this.indexBuffer,u=this._batchIndexSize,d=this._batchIndexStart,f="startBatch",p=this.maxTextures;for(let g=this.elementStart;g<this.elementSize;++g){let x=e[g];e[g]=null;let _=x.texture._source,b=Xr(x.blendMode,_),T=n!==b||a!==x.topology;if(_._batchTick===Pn&&!T){x._textureId=_._textureBindLocation,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize)),x._batch=r;continue}_._batchTick=Pn,(s.count>=p||T)&&(this._finishBatch(r,d,u-d,s,n,a,t,f),f="renderBatch",d=u,n=b,a=x.topology,r=vy(),s=r.textures,s.clear(),++Pn),x._textureId=_._textureBindLocation=s.count,s.ids[_.uid]=s.count,s.textures[s.count++]=_,x._batch=r,u+=x.indexSize,x.packAsQuad?(this.packQuadAttributes(x,h,l,x._attributeStart,x._textureId),this.packQuadIndex(c,x._indexStart,x._attributeStart/this.vertexSize)):(this.packAttributes(x,h,l,x._attributeStart,x._textureId),this.packIndex(x,c,x._indexStart,x._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(r,d,u-d,s,n,a,t,f),d=u,++Pn),this.elementStart=this.elementSize,this._batchIndexStart=d,this._batchIndexSize=u}_finishBatch(t,e,r,s,o,n,a,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=h,t.batcher=this,t.textures=s,t.blendMode=o,t.topology=n,t.start=e,t.size=r,++Pn,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){let e=Math.max(t,this.attributeBuffer.size*2),r=new Tr(e);wn(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){let e=this.indexBuffer,r=Math.max(t,e.length*1.5);r+=r%2;let s=r>65535?new Uint32Array(r):new Uint16Array(r);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let o=0;o<e.length;o++)s[o]=e[o];else wn(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,s){let o=t.indices,n=t.indexSize,a=t.indexOffset,h=t.attributeOffset;for(let l=0;l<n;l++)e[r++]=s+o[l+a]-h}destroy(){for(let t=0;t<this.batches.length;t++)Ty(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};Ay.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};Ey=Ay});var ot,jr=m(()=>{"use strict";ot=(i=>(i[i.MAP_READ=1]="MAP_READ",i[i.MAP_WRITE=2]="MAP_WRITE",i[i.COPY_SRC=4]="COPY_SRC",i[i.COPY_DST=8]="COPY_DST",i[i.INDEX=16]="INDEX",i[i.VERTEX=32]="VERTEX",i[i.UNIFORM=64]="UNIFORM",i[i.STORAGE=128]="STORAGE",i[i.INDIRECT=256]="INDIRECT",i[i.QUERY_RESOLVE=512]="QUERY_RESOLVE",i[i.STATIC=1024]="STATIC",i))(ot||{})});var kt,gi=m(()=>{me();ue();jr();kt=class extends At{constructor(t){let{data:e,size:r}=t,{usage:s,label:o,shrinkToFit:n}=t;super(),this.uid=nt("buffer"),this._resourceType="buffer",this._resourceId=nt("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,r??(r=e?.byteLength);let a=!!e;this.descriptor={size:r,usage:s,mappedAtCreation:a,label:o},this.shrinkToFit=n??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&ot.STATIC)}set static(t){t?this.descriptor.usage|=ot.STATIC:this.descriptor.usage&=~ot.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}let s=this._data;if(this._data=t,this._dataInt32=null,!s||s.length!==t.length){!this.shrinkToFit&&s&&t.byteLength<s.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=nt("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}});function of(i,t){if(!(i instanceof kt)){let e=t?ot.INDEX:ot.VERTEX;i instanceof Array&&(t?(i=new Uint32Array(i),e=ot.INDEX|ot.COPY_DST):(i=new Float32Array(i),e=ot.VERTEX|ot.COPY_DST)),i=new kt({data:i,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return i}var Cy=m(()=>{gi();jr()});function Py(i,t,e){let r=i.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;let s=r.buffer.data,o=1/0,n=1/0,a=-1/0,h=-1/0,l=s.BYTES_PER_ELEMENT,c=(r.offset||0)/l,u=(r.stride||2*4)/l;for(let d=c;d<s.length;d+=u){let f=s[d],p=s[d+1];f>a&&(a=f),p>h&&(h=p),f<o&&(o=f),p<n&&(n=p)}return e.minX=o,e.minY=n,e.maxX=a,e.maxY=h,e}var Ry=m(()=>{"use strict"});function BR(i){return(i instanceof kt||Array.isArray(i)||i.BYTES_PER_ELEMENT)&&(i={buffer:i}),i.buffer=of(i.buffer,!1),i}var Je,Ns=m(()=>{me();Me();ue();gi();Cy();Ry();Je=class extends At{constructor(t={}){super(),this.uid=nt("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new bt,this._boundsDirty=!0;let{attributes:e,indexBuffer:r,topology:s}=t;if(this.buffers=[],this.attributes={},e)for(let o in e)this.addAttribute(o,e[o]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=s||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(let t in this.attributes){let e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){let r=BR(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=of(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Py(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}});var IR,FR,Cl,My=m(()=>{gi();jr();Ns();IR=new Float32Array(1),FR=new Uint32Array(1),Cl=class extends Je{constructor(){let e=new kt({data:IR,label:"attribute-batch-buffer",usage:ot.VERTEX|ot.COPY_DST,shrinkToFit:!1}),r=new kt({data:FR,label:"index-batch-buffer",usage:ot.INDEX|ot.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:s,offset:0},aUV:{buffer:e,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:e,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:r})}}});function Yr(i,t){let e=By[i];return e===void 0&&(nf[t]===void 0&&(nf[t]=1),By[i]=e=nf[t]++),e}var nf,By,Rn=m(()=>{"use strict";nf=Object.create(null),By=Object.create(null)});function Iy(){if(!Pl){Pl="mediump";let i=Sl();i&&i.getShaderPrecisionFormat&&(Pl=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?"highp":"mediump")}return Pl}var Pl,Fy=m(()=>{Qd()});function Gy(i,t,e){return t?i:e?(i=i.replace("out vec4 finalColor;",""),`
22
22
 
23
23
  #ifdef GL_ES // This checks if it is WebGL1
24
24
  #define in varying
@@ -33,27 +33,27 @@ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function Xp(i,t){if(i===0)th
33
33
  #define out varying
34
34
  #endif
35
35
  ${i}
36
- `}var um=p(()=>{"use strict"});function dm(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
37
- ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var fm=p(()=>{"use strict"});function pm(i,t){return t?`#version 300 es
38
- ${i}`:i}var mm=p(()=>{"use strict"});function gm(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?MS:BS;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
39
- ${i}`}var MS,BS,xm=p(()=>{"use strict";MS={},BS={}});function _m(i,t){return t?i.replace("#version 300 es",""):i}var ym=p(()=>{"use strict"});var Ll,Nl,bm,le,Mr=p(()=>{Ss();lm();um();fm();mm();xm();ym();Ll={stripVersion:_m,ensurePrecision:dm,addProgramDefines:hm,setProgramName:gm,insertVersion:pm},Nl=Object.create(null),bm=class Hl{constructor(t){t={...Hl.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:cm()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(Ll).forEach(n=>{let a=r[n];s=Ll[n](s,a,!0),o=Ll[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Xe(`${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){let e=`${t.vertex}:${t.fragment}`;return Nl[e]||(Nl[e]=new Hl(t)),Nl[e]}};bm.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};le=bm});function Zt(i){return vm[i]??vm.float32}var vm,Br=p(()=>{"use strict";vm={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 Tm({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let c=RS[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:c,stride:Zt(c).stride,offset:0,instance:!1,start:0}}}}return e}var RS,Sm=p(()=>{Br();RS={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"}});function Ln(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,c=/struct\s+(\w+)/,l=i.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!l)return{groups:[],structs:[]};let h=i.match(n)?.map(u=>{let d=u.match(c)[1],f=u.match(a).reduce((m,g)=>{let[_,b]=g.split(":");return m[_.trim()]=b.trim(),m},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u))??[];return{groups:l,structs:h}}var wm=p(()=>{"use strict"});var oi,Em=p(()=>{"use strict";oi=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(oi||{})});function Pm({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:oi.VERTEX|oi.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:oi.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:oi.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Am=p(()=>{Em()});function Cm({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}var Mm=p(()=>{"use strict"});function Bm(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var Rm=p(()=>{"use strict"});var Wl,he,ni=p(()=>{Ss();Sm();wm();Am();Mm();Rm();Wl=Object.create(null),he=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Ln(e.source);this.structsAndGroups=a}else{let a=Ln(r.source),c=Ln(e.source);this.structsAndGroups=Bm(a,c)}this.layout=s??Cm(this.structsAndGroups),this.gpuLayout=o??Pm(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Xe(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Tm(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Wl[e]||(Wl[e]=new i(t)),Wl[e]}}});function zl(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else k(`${r} placement hook does not exist in shader`)}}var Gm=p(()=>{it()});function Vl(i){let t={};return(i.match(GS)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var GS,Im=p(()=>{"use strict";GS=/\{\{(.*?)\}\}/g});function km(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function jl(i,t,e=!1){let r=[];km(t,r),i.forEach(a=>{a.header&&km(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,c)=>` @location(${c}) ${a},`).join(`
36
+ `}var Uy=m(()=>{"use strict"});function ky(i,t,e){let r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(i.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&r!=="highp"&&(s="mediump"),`precision ${s} float;
37
+ ${i}`}else if(r!=="highp"&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var Oy=m(()=>{"use strict"});function Ny(i,t){return t?`#version 300 es
38
+ ${i}`:i}var Dy=m(()=>{"use strict"});function Ly(i,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";let r=e?GR:UR;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,i.indexOf("#define SHADER_NAME")!==-1?i:`${`#define SHADER_NAME ${t}`}
39
+ ${i}`}var GR,UR,Hy=m(()=>{"use strict";GR={},UR={}});function Vy(i,t){return t?i.replace("#version 300 es",""):i}var Wy=m(()=>{"use strict"});var af,hf,zy,tr,Xi=m(()=>{Rn();Fy();Uy();Oy();Dy();Hy();Wy();af={stripVersion:Vy,ensurePrecision:ky,addProgramDefines:Gy,setProgramName:Ly,insertVersion:Ny},hf=Object.create(null),zy=class lf{constructor(t){t={...lf.defaultOptions,...t};let e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Iy()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e},s=t.fragment,o=t.vertex;Object.keys(af).forEach(n=>{let a=r[n];s=af[n](s,a,!0),o=af[n](o,a,!1)}),this.fragment=s,this.vertex=o,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=Yr(`${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){let e=`${t.vertex}:${t.fragment}`;return hf[e]||(hf[e]=new lf(t)),hf[e]}};zy.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};tr=zy});function Ge(i){return $y[i]??$y.float32}var $y,ji=m(()=>{"use strict";$y={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 Xy({source:i,entryPoint:t}){let e={},r=i.indexOf(`fn ${t}`);if(r!==-1){let s=i.indexOf("->",r);if(s!==-1){let o=i.substring(r,s),n=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g,a;for(;(a=n.exec(o))!==null;){let h=kR[a[3]]??"float32";e[a[2]]={location:parseInt(a[1],10),format:h,stride:Ge(h).stride,offset:0,instance:!1,start:0}}}}return e}var kR,jy=m(()=>{ji();kR={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"}});function Rl(i){let t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,s=/var(<[^>]+>)? (\w+)/,o=/:\s*(\w+)/,n=/struct\s+(\w+)\s*{([^}]+)}/g,a=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,l=i.match(t)?.map(u=>({group:parseInt(u.match(e)[1],10),binding:parseInt(u.match(r)[1],10),name:u.match(s)[2],isUniform:u.match(s)[1]==="<uniform>",type:u.match(o)[1]}));if(!l)return{groups:[],structs:[]};let c=i.match(n)?.map(u=>{let d=u.match(h)[1],f=u.match(a).reduce((p,g)=>{let[x,v]=g.split(":");return p[x.trim()]=v.trim(),p},{});return f?{name:d,members:f}:null}).filter(({name:u})=>l.some(d=>d.type===u))??[];return{groups:l,structs:c}}var Yy=m(()=>{"use strict"});var Ds,qy=m(()=>{"use strict";Ds=(i=>(i[i.VERTEX=1]="VERTEX",i[i.FRAGMENT=2]="FRAGMENT",i[i.COMPUTE=4]="COMPUTE",i))(Ds||{})});function Ky({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:Ds.VERTEX|Ds.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Ds.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"&&t[r.group].push({binding:r.binding,visibility:Ds.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}var Zy=m(()=>{qy()});function Qy({groups:i}){let t=[];for(let e=0;e<i.length;e++){let r=i[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}var Jy=m(()=>{"use strict"});function tb(i,t){let e=new Set,r=new Set,s=[...i.structs,...t.structs].filter(n=>e.has(n.name)?!1:(e.add(n.name),!0)),o=[...i.groups,...t.groups].filter(n=>{let a=`${n.name}-${n.binding}`;return r.has(a)?!1:(r.add(a),!0)});return{structs:s,groups:o}}var eb=m(()=>{"use strict"});var cf,er,Ls=m(()=>{Rn();jy();Yy();Zy();Jy();eb();cf=Object.create(null),er=class i{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;let{fragment:e,vertex:r,layout:s,gpuLayout:o,name:n}=t;if(this.name=n,this.fragment=e,this.vertex=r,e.source===r.source){let a=Rl(e.source);this.structsAndGroups=a}else{let a=Rl(r.source),h=Rl(e.source);this.structsAndGroups=tb(a,h)}this.layout=s??Qy(this.structsAndGroups),this.gpuLayout=o??Ky(this.structsAndGroups),this.autoAssignGlobalUniforms=this.layout[0]?.globalUniforms!==void 0,this.autoAssignLocalUniforms=this.layout[1]?.localUniforms!==void 0,this._generateProgramKey()}_generateProgramKey(){let{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Yr(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=Xy(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){let e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return cf[e]||(cf[e]=new i(t)),cf[e]}}});function uf(i,t,e){if(i)for(let r in i){let s=r.toLocaleLowerCase(),o=t[s];if(o){let n=i[r];r==="header"&&(n=n.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&o.push(`//----${e}----//`),o.push(n)}else H(`${r} placement hook does not exist in shader`)}}var rb=m(()=>{vt()});function df(i){let t={};return(i.match(OR)?.map(r=>r.replace(/[{()}]/g,""))??[]).forEach(r=>{t[r]=[]}),t}var OR,ib=m(()=>{"use strict";OR=/\{\{(.*?)\}\}/g});function sb(i,t){let e,r=/@in\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function ff(i,t,e=!1){let r=[];sb(t,r),i.forEach(a=>{a.header&&sb(a.header,r)});let s=r;e&&s.sort();let o=s.map((a,h)=>` @location(${h}) ${a},`).join(`
40
40
  `),n=t.replace(/@in\s+[^;]+;\s*/g,"");return n=n.replace("{{in}}",`
41
41
  ${o}
42
- `),n}var Fm=p(()=>{"use strict"});function Um(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function IS(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function kS(i){let t=/@.*?\s+/g;return i.replace(t,"")}function Dm(i,t){let e=[];Um(t,e),i.forEach(c=>{c.header&&Um(c.header,e)});let r=0,s=e.sort().map(c=>c.indexOf("builtin")>-1?c:`@location(${r++}) ${c}`).join(`,
43
- `),o=e.sort().map(c=>` var ${kS(c)};`).join(`
42
+ `),n}var ob=m(()=>{"use strict"});function nb(i,t){let e,r=/@out\s+([^;]+);/g;for(;(e=r.exec(i))!==null;)t.push(e[1])}function NR(i){let e=/\b(\w+)\s*:/g.exec(i);return e?e[1]:""}function DR(i){let t=/@.*?\s+/g;return i.replace(t,"")}function ab(i,t){let e=[];nb(t,e),i.forEach(h=>{h.header&&nb(h.header,e)});let r=0,s=e.sort().map(h=>h.indexOf("builtin")>-1?h:`@location(${r++}) ${h}`).join(`,
43
+ `),o=e.sort().map(h=>` var ${DR(h)};`).join(`
44
44
  `),n=`return VSOutput(
45
- ${e.sort().map(c=>` ${IS(c)}`).join(`,
45
+ ${e.sort().map(h=>` ${NR(h)}`).join(`,
46
46
  `)});`,a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
47
47
  ${s}
48
48
  `),a=a.replace("{{start}}",`
49
49
  ${o}
50
50
  `),a=a.replace("{{return}}",`
51
51
  ${n}
52
- `),a}var Om=p(()=>{"use strict"});function Xl(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
52
+ `),a}var hb=m(()=>{"use strict"});function pf(i,t){let e=i;for(let r in t){let s=t[r];s.join(`
53
53
  `).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
54
54
  ${s.join(`
55
55
  `)}
56
- //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var Lm=p(()=>{"use strict"});function Nm({template:i,bits:t}){let e=Wm(i,t);if(ir[e])return ir[e];let{vertex:r,fragment:s}=US(i,t);return ir[e]=zm(r,s,t),ir[e]}function Hm({template:i,bits:t}){let e=Wm(i,t);return ir[e]||(ir[e]=zm(i.vertex,i.fragment,t)),ir[e]}function US(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=jl(e,i.vertex,!0);s=Dm(e,s);let o=jl(r,i.fragment,!0);return{vertex:s,fragment:o}}function Wm(i,t){return t.map(e=>($l.has(e)||$l.set(e,FS++),$l.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function zm(i,t,e){let r=Vl(i),s=Vl(t);return e.forEach(o=>{zl(o.vertex,r,o.name),zl(o.fragment,s,o.name)}),{vertex:Xl(i,r),fragment:Xl(t,s)}}var ir,$l,FS,Vm=p(()=>{Gm();Im();Fm();Om();Lm();ir=Object.create(null),$l=new Map,FS=0});var jm,Xm,$m,Ym,Km=p(()=>{"use strict";jm=`
56
+ //----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}var lb=m(()=>{"use strict"});function cb({template:i,bits:t}){let e=db(i,t);if(xi[e])return xi[e];let{vertex:r,fragment:s}=HR(i,t);return xi[e]=fb(r,s,t),xi[e]}function ub({template:i,bits:t}){let e=db(i,t);return xi[e]||(xi[e]=fb(i.vertex,i.fragment,t)),xi[e]}function HR(i,t){let e=t.map(n=>n.vertex).filter(n=>!!n),r=t.map(n=>n.fragment).filter(n=>!!n),s=ff(e,i.vertex,!0);s=ab(e,s);let o=ff(r,i.fragment,!0);return{vertex:s,fragment:o}}function db(i,t){return t.map(e=>(mf.has(e)||mf.set(e,LR++),mf.get(e))).sort((e,r)=>e-r).join("-")+i.vertex+i.fragment}function fb(i,t,e){let r=df(i),s=df(t);return e.forEach(o=>{uf(o.vertex,r,o.name),uf(o.fragment,s,o.name)}),{vertex:pf(i,r),fragment:pf(t,s)}}var xi,mf,LR,pb=m(()=>{rb();ib();ob();hb();lb();xi=Object.create(null),mf=new Map,LR=0});var mb,gb,xb,_b,yb=m(()=>{"use strict";mb=`
57
57
  @in aPosition: vec2<f32>;
58
58
  @in aUV: vec2<f32>;
59
59
 
@@ -97,7 +97,7 @@ ${s.join(`
97
97
 
98
98
  {{return}}
99
99
  };
100
- `,Xm=`
100
+ `,gb=`
101
101
  @in vUV : vec2<f32>;
102
102
  @in vColor : vec4<f32>;
103
103
 
@@ -120,7 +120,7 @@ ${s.join(`
120
120
 
121
121
  return finalColor;
122
122
  };
123
- `,$m=`
123
+ `,xb=`
124
124
  in vec2 aPosition;
125
125
  in vec2 aUV;
126
126
 
@@ -156,7 +156,7 @@ ${s.join(`
156
156
 
157
157
  {{end}}
158
158
  }
159
- `,Ym=`
159
+ `,_b=`
160
160
 
161
161
  in vec4 vColor;
162
162
  in vec2 vUV;
@@ -177,7 +177,7 @@ ${s.join(`
177
177
 
178
178
  {{end}}
179
179
  }
180
- `});var qm,Zm,Qm=p(()=>{"use strict";qm={name:"global-uniforms-bit",vertex:{header:`
180
+ `});var bb,vb,Tb=m(()=>{"use strict";bb={name:"global-uniforms-bit",vertex:{header:`
181
181
  struct GlobalUniforms {
182
182
  uProjectionMatrix:mat3x3<f32>,
183
183
  uWorldTransformMatrix:mat3x3<f32>,
@@ -186,22 +186,22 @@ ${s.join(`
186
186
  }
187
187
 
188
188
  @group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
189
- `}},Zm={name:"global-uniforms-bit",vertex:{header:`
189
+ `}},vb={name:"global-uniforms-bit",vertex:{header:`
190
190
  uniform mat3 uProjectionMatrix;
191
191
  uniform mat3 uWorldTransformMatrix;
192
192
  uniform vec4 uWorldColorAlpha;
193
193
  uniform vec2 uResolution;
194
- `}}});function Pe({bits:i,name:t}){let e=Nm({template:{fragment:Xm,vertex:jm},bits:[qm,...i]});return he.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Ae({bits:i,name:t}){return new le({name:t,...Hm({template:{vertex:$m,fragment:Ym},bits:[Zm,...i]})})}var sr=p(()=>{Mr();ni();Vm();Km();Qm()});var ai,ci,ws=p(()=>{"use strict";ai={name:"color-bit",vertex:{header:`
194
+ `}}});function Sr({bits:i,name:t}){let e=cb({template:{fragment:gb,vertex:mb},bits:[bb,...i]});return er.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Ar({bits:i,name:t}){return new tr({name:t,...ub({template:{vertex:xb,fragment:_b},bits:[vb,...i]})})}var _i=m(()=>{Xi();Ls();pb();yb();Tb()});var Hs,Vs,Mn=m(()=>{"use strict";Hs={name:"color-bit",vertex:{header:`
195
195
  @in aColor: vec4<f32>;
196
196
  `,main:`
197
197
  vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
198
- `}},ci={name:"color-bit",vertex:{header:`
198
+ `}},Vs={name:"color-bit",vertex:{header:`
199
199
  in vec4 aColor;
200
200
  `,main:`
201
201
  vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
202
- `}}});function DS(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
203
- `)}function OS(i){let t=[];if(i===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<i;e++)e===i-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
204
- `)}function li(i){return Yl[i]||(Yl[i]={name:"texture-batch-bit",vertex:{header:`
202
+ `}}});function VR(i){let t=[];if(i===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let r=0;r<i;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
203
+ `)}function WR(i){let t=[];if(i===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<i;e++)e===i-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
204
+ `)}function Ws(i){return gf[i]||(gf[i]={name:"texture-batch-bit",vertex:{header:`
205
205
  @in aTextureIdAndRound: vec2<u32>;
206
206
  @out @interpolate(flat) vTextureId : u32;
207
207
  `,main:`
@@ -214,14 +214,14 @@ ${s.join(`
214
214
  `},fragment:{header:`
215
215
  @in @interpolate(flat) vTextureId: u32;
216
216
 
217
- ${DS(i)}
217
+ ${VR(i)}
218
218
  `,main:`
219
219
  var uvDx = dpdx(vUV);
220
220
  var uvDy = dpdy(vUV);
221
221
 
222
- ${OS(i)}
223
- `}}),Yl[i]}function LS(i){let t=[];for(let e=0;e<i;e++)e>0&&t.push("else"),e<i-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
224
- `)}function hi(i){return Kl[i]||(Kl[i]={name:"texture-batch-bit",vertex:{header:`
222
+ ${WR(i)}
223
+ `}}),gf[i]}function zR(i){let t=[];for(let e=0;e<i;e++)e>0&&t.push("else"),e<i-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
224
+ `)}function zs(i){return xf[i]||(xf[i]={name:"texture-batch-bit",vertex:{header:`
225
225
  in vec2 aTextureIdAndRound;
226
226
  out float vTextureId;
227
227
 
@@ -239,18 +239,18 @@ ${s.join(`
239
239
 
240
240
  `,main:`
241
241
 
242
- ${LS(i)}
243
- `}}),Kl[i]}var Yl,Kl,Es=p(()=>{"use strict";Yl={};Kl={}});var Ce,Me,or=p(()=>{"use strict";Ce={name:"round-pixels-bit",vertex:{header:`
242
+ ${zR(i)}
243
+ `}}),xf[i]}var gf,xf,Bn=m(()=>{"use strict";gf={};xf={}});var Er,wr,yi=m(()=>{"use strict";Er={name:"round-pixels-bit",vertex:{header:`
244
244
  fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
245
245
  {
246
246
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
247
247
  }
248
- `}},Me={name:"round-pixels-bit",vertex:{header:`
248
+ `}},wr={name:"round-pixels-bit",vertex:{header:`
249
249
  vec2 roundPixels(vec2 position, vec2 targetSize)
250
250
  {
251
251
  return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
252
252
  }
253
- `}}});var ql,Jm,tg=p(()=>{"use strict";ql=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Jm=ql.reduce((i,t)=>(i[t]=!0,i),{})});function eg(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var rg=p(()=>{"use strict"});var ig,st,Nt=p(()=>{Rt();Ss();tg();rg();ig=class sg{constructor(t,e){this._touched=0,this.uid=X("uniform"),this._resourceType="uniformGroup",this._resourceId=X("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...sg.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Jm[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${ql.join(", ")}`);o.value??(o.value=eg(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Xe(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};ig.defaultOptions={ubo:!1,isStatic:!1};st=ig});function ui(i){let t=og[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=og[i]=new st({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var og,Nn=p(()=>{Nt();og={}});var bt,Be=p(()=>{"use strict";bt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(bt||{})});var xt,xe=p(()=>{It();Rt();Mr();er();ni();Be();Nt();xt=class i extends ot{constructor(t){super(),this.uid=X("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=bt.WEBGPU),r&&(n|=bt.WEBGL)),this.compatibleRenderers=n;let c={};if(!o&&!s&&(o={}),o&&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(let l in a)for(let h in a[l]){let u=a[l][h];c[u]={group:l,binding:h,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(h=>{a[h.group]=a[h.group]||{},a[h.group][h.binding]=h.name,c[h.name]=h})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,c[u.name]=u});let l=0;for(let h in o)c[h]||(s[99]||(s[99]=new Pt,this._ownedBindGroups.push(s[99])),c[h]={group:99,binding:l,name:h},a[99]=a[99]||{},a[99][l]=h,l++);for(let h in o){let u=h,d=o[h];!d.source&&!d._resourceType&&(d=new st(d));let f=c[u];f&&(s[f.group]||(s[f.group]=new Pt,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,c)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new Pt,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=he.from(e)),r&&(n=le.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Hn,ng=p(()=>{sr();ws();Es();or();Nn();xe();Hn=class extends xt{constructor(t){let e=Ae({name:"batch",bits:[ci,hi(t),Me]}),r=Pe({name:"batch",bits:[ai,li(t),Ce]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:ui(t)}})}}});var ag,cg,Ps,Zl=p(()=>{P();rm();nm();ng();ag=null,cg=class lg extends em{constructor(){super(...arguments),this.geometry=new Dn,this.shader=ag||(ag=new Hn(this.maxTextures)),this.name=lg.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,{positions:m,uvs:g}=t,_=t.color,b=t.attributeOffset,y=b+t.attributeSize;for(let v=b;v<y;v++){let S=v*2,E=m[S],T=m[S+1];e[s++]=c*E+h*T+d,e[s++]=u*T+l*E+f,e[s++]=g[S],e[s++]=g[S+1],r[s++]=_,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,c=a.a,l=a.b,h=a.c,u=a.d,d=a.tx,f=a.ty,m=t.bounds,g=m.maxX,_=m.minX,b=m.maxY,y=m.minY,v=n.uvs,S=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=c*_+h*y+d,e[s+1]=u*y+l*_+f,e[s+2]=v.x0,e[s+3]=v.y0,r[s+4]=S,r[s+5]=E,e[s+6]=c*g+h*y+d,e[s+7]=u*y+l*g+f,e[s+8]=v.x1,e[s+9]=v.y1,r[s+10]=S,r[s+11]=E,e[s+12]=c*g+h*b+d,e[s+13]=u*b+l*g+f,e[s+14]=v.x2,e[s+15]=v.y2,r[s+16]=S,r[s+17]=E,e[s+18]=c*_+h*b+d,e[s+19]=u*b+l*_+f,e[s+20]=v.x3,e[s+21]=v.y3,r[s+22]=S,r[s+23]=E}};cg.extension={type:[x.Batcher],name:"default"};Ps=cg});function hg(i,t,e,r,s,o,n,a=null){let c=0;e*=t,s*=o;let l=a.a,h=a.b,u=a.c,d=a.d,f=a.tx,m=a.ty;for(;c<n;){let g=i[e],_=i[e+1];r[s]=l*g+u*_+f,r[s+1]=h*g+d*_+m,s+=o,e+=t,c++}}function ug(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var dg=p(()=>{"use strict"});function Ql(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,c=t.d,l=t.tx,h=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],m=i[u+1];i[u]=o*f+a*m+l,i[u+1]=n*f+c*m+h,u+=r}}var fg=p(()=>{"use strict"});var NS,Rr,Jl=p(()=>{K();Xc();NS=new B,Rr=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?ln(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||NS}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 di,pg,mg,gg=p(()=>{P();di={extension:{type:x.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let S=i;e=S.x,r=S.y,n=a=S.radius,s=o=0}else if(i.type==="ellipse"){let S=i;e=S.x,r=S.y,n=S.halfWidth,a=S.halfHeight,s=o=0}else{let S=i,E=S.width/2,T=S.height/2;e=S.x+E,r=S.y+T,n=a=Math.max(0,Math.min(S.radius,Math.min(E,T))),s=E-n,o=T-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let c=Math.ceil(2.3*Math.sqrt(n+a)),l=c*8+(s?4:0)+(o?4:0);if(l===0)return t;if(c===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let h=0,u=c*4+(s?2:0)+2,d=u,f=l,m=s+n,g=o,_=e+m,b=e-m,y=r+g;if(t[h++]=_,t[h++]=y,t[--u]=y,t[--u]=b,o){let S=r-g;t[d++]=b,t[d++]=S,t[--f]=S,t[--f]=_}for(let S=1;S<c;S++){let E=Math.PI/2*(S/c),T=s+Math.cos(E)*n,w=o+Math.sin(E)*a,A=e+T,R=e-T,C=r+w,G=r-w;t[h++]=A,t[h++]=C,t[--u]=C,t[--u]=R,t[d++]=R,t[d++]=G,t[--f]=G,t[--f]=A}m=s,g=o+a,_=e+m,b=e-m,y=r+g;let v=r-g;return t[h++]=_,t[h++]=y,t[--f]=v,t[--f]=_,s&&(t[h++]=b,t[h++]=y,t[--f]=v,t[--f]=b),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let h=0;h<i.length;h+=2)n+=i[h],a+=i[h+1];n/=i.length/2,a/=i.length/2;let c=r;t[c*e]=n,t[c*e+1]=a;let l=c++;for(let h=0;h<i.length;h+=2)t[c*e]=i[h],t[c*e+1]=i[h+1],h>0&&(s[o++]=c,s[o++]=l,s[o++]=c-1),c++;s[o++]=l+1,s[o++]=l,s[o++]=c-1}},pg={...di,extension:{...di.extension,name:"ellipse"}},mg={...di,extension:{...di.extension,name:"roundedRectangle"}}});function xg(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var _g=p(()=>{"use strict"});function yg(i,t,e,r,s,o,n,a){let c=i-e*s,l=t-r*s,h=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let m=c+d,g=l+f,_=h+d,b=u+f;return a.push(m,g),a.push(_,b),2}function Gr(i,t,e,r,s,o,n,a){let c=e-i,l=r-t,h=Math.atan2(c,l),u=Math.atan2(s-i,o-t);a&&h<u?h+=Math.PI*2:!a&&h>u&&(u+=Math.PI*2);let d=h,f=u-h,m=Math.abs(f),g=Math.sqrt(c*c+l*l),_=(15*m*Math.sqrt(g)/Math.PI>>0)+1,b=f/_;if(d+=b,a){n.push(i,t),n.push(e,r);for(let y=1,v=d;y<_;y++,v+=b)n.push(i,t),n.push(i+Math.sin(v)*g,t+Math.cos(v)*g);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let y=1,v=d;y<_;y++,v+=b)n.push(i+Math.sin(v)*g,t+Math.cos(v)*g),n.push(i,t);n.push(s,o),n.push(i,t)}return _*2}function bg(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,c=a.alignment;if(t.alignment!==.5){let q=xg(i);e&&(q*=-1),c=(c-.5)*q+.5}let l=new $(i[0],i[1]),h=new $(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-h.x)<n&&Math.abs(l.y-h.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),h.set(i[i.length-2],i[i.length-1]));let q=(l.x+h.x)*.5,ee=(h.y+l.y)*.5;i.unshift(q,ee),i.push(q,ee)}let f=s,m=i.length/2,g=i.length,_=f.length/2,b=a.width/2,y=b*b,v=a.miterLimit*a.miterLimit,S=i[0],E=i[1],T=i[2],w=i[3],A=0,R=0,C=-(E-w),G=S-T,L=0,Y=0,mt=Math.sqrt(C*C+G*G);C/=mt,G/=mt,C*=b,G*=b;let Xt=c,N=(1-Xt)*2,F=Xt*2;u||(a.cap==="round"?g+=Gr(S-C*(N-F)*.5,E-G*(N-F)*.5,S-C*N,E-G*N,S+C*F,E+G*F,f,!0)+2:a.cap==="square"&&(g+=yg(S,E,C,G,N,F,!0,f))),f.push(S-C*N,E-G*N),f.push(S+C*F,E+G*F);for(let q=1;q<m-1;++q){S=i[(q-1)*2],E=i[(q-1)*2+1],T=i[q*2],w=i[q*2+1],A=i[(q+1)*2],R=i[(q+1)*2+1],C=-(E-w),G=S-T,mt=Math.sqrt(C*C+G*G),C/=mt,G/=mt,C*=b,G*=b,L=-(w-R),Y=T-A,mt=Math.sqrt(L*L+Y*Y),L/=mt,Y/=mt,L*=b,Y*=b;let ee=T-S,De=E-w,qi=T-A,Zi=R-w,Gd=ee*qi+De*Zi,qo=De*qi-Zi*ee,Qi=qo<0;if(Math.abs(qo)<.001*Math.abs(Gd)){f.push(T-C*N,w-G*N),f.push(T+C*F,w+G*F),Gd>=0&&(a.join==="round"?g+=Gr(T,w,T-C*N,w-G*N,T-L*N,w-Y*N,f,!1)+4:g+=2,f.push(T-L*F,w-Y*F),f.push(T+L*N,w+Y*N));continue}let Id=(-C+S)*(-G+w)-(-C+T)*(-G+E),kd=(-L+A)*(-Y+w)-(-L+T)*(-Y+R),Zo=(ee*kd-qi*Id)/qo,Qo=(Zi*Id-De*kd)/qo,Mc=(Zo-T)*(Zo-T)+(Qo-w)*(Qo-w),fr=T+(Zo-T)*N,pr=w+(Qo-w)*N,mr=T-(Zo-T)*F,gr=w-(Qo-w)*F,kT=Math.min(ee*ee+De*De,qi*qi+Zi*Zi),Fd=Qi?N:F,FT=kT+Fd*Fd*y;Mc<=FT?a.join==="bevel"||Mc/y>v?(Qi?(f.push(fr,pr),f.push(T+C*F,w+G*F),f.push(fr,pr),f.push(T+L*F,w+Y*F)):(f.push(T-C*N,w-G*N),f.push(mr,gr),f.push(T-L*N,w-Y*N),f.push(mr,gr)),g+=2):a.join==="round"?Qi?(f.push(fr,pr),f.push(T+C*F,w+G*F),g+=Gr(T,w,T+C*F,w+G*F,T+L*F,w+Y*F,f,!0)+4,f.push(fr,pr),f.push(T+L*F,w+Y*F)):(f.push(T-C*N,w-G*N),f.push(mr,gr),g+=Gr(T,w,T-C*N,w-G*N,T-L*N,w-Y*N,f,!1)+4,f.push(T-L*N,w-Y*N),f.push(mr,gr)):(f.push(fr,pr),f.push(mr,gr)):(f.push(T-C*N,w-G*N),f.push(T+C*F,w+G*F),a.join==="round"?Qi?g+=Gr(T,w,T+C*F,w+G*F,T+L*F,w+Y*F,f,!0)+2:g+=Gr(T,w,T-C*N,w-G*N,T-L*N,w-Y*N,f,!1)+2:a.join==="miter"&&Mc/y<=v&&(Qi?(f.push(mr,gr),f.push(mr,gr)):(f.push(fr,pr),f.push(fr,pr)),g+=2),f.push(T-L*N,w-Y*N),f.push(T+L*F,w+Y*F),g+=2)}S=i[(m-2)*2],E=i[(m-2)*2+1],T=i[(m-1)*2],w=i[(m-1)*2+1],C=-(E-w),G=S-T,mt=Math.sqrt(C*C+G*G),C/=mt,G/=mt,C*=b,G*=b,f.push(T-C*N,w-G*N),f.push(T+C*F,w+G*F),u||(a.cap==="round"?g+=Gr(T-C*(N-F)*.5,w-G*(N-F)*.5,T-C*N,w-G*N,T+C*F,w+G*F,f,!1)+2:a.cap==="square"&&(g+=yg(T,w,C,G,N,F,!1,f)));let Te=1e-4*1e-4;for(let q=_;q<g+_-2;++q)S=f[q*2],E=f[q*2+1],T=f[(q+1)*2],w=f[(q+1)*2+1],A=f[(q+2)*2],R=f[(q+2)*2+1],!(Math.abs(S*(w-R)+T*(R-E)+A*(E-w))<Te)&&o.push(q,q+1,q+2)}var vg=p(()=>{ne();_g()});function Tg(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],c=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-c)<s,h=e,u=i.length/2,d=h.length/2;for(let f=0;f<u;f++)h.push(i[f*2]),h.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var Sg=p(()=>{});var sh=Rc((IG,ih)=>{"use strict";ih.exports=Vn;ih.exports.default=Vn;function Vn(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=Eg(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,c,l,h,u,d,f;if(r&&(o=$S(i,t,o,e)),i.length>80*e){a=l=i[0],c=h=i[1];for(var m=e;m<s;m+=e)u=i[m],d=i[m+1],u<a&&(a=u),d<c&&(c=d),u>l&&(l=u),d>h&&(h=d);f=Math.max(l-a,h-c),f=f!==0?32767/f:0}return As(o,n,e,a,c,f,0),n}function Eg(i,t,e,r,s){var o,n;if(s===rh(i,t,e,r)>0)for(o=t;o<e;o+=r)n=wg(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=wg(o,i[o],i[o+1],n);return n&&jn(n,n.next)&&(Ms(n),n=n.next),n}function Ir(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(jn(e,e.next)||pt(e.prev,e,e.next)===0)){if(Ms(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function As(i,t,e,r,s,o,n){if(i){!n&&o&&QS(i,r,s,o);for(var a=i,c,l;i.prev!==i.next;){if(c=i.prev,l=i.next,o?VS(i,r,s,o):zS(i)){t.push(c.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Ms(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=jS(Ir(i),t,e),As(i,t,e,r,s,o,2)):n===2&&XS(i,t,e,r,s,o):As(Ir(i),t,e,r,s,o,1);break}}}}function zS(i){var t=i.prev,e=i,r=i.next;if(pt(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,c=e.y,l=r.y,h=s<o?s<n?s:n:o<n?o:n,u=a<c?a<l?a:l:c<l?c:l,d=s>o?s>n?s:n:o>n?o:n,f=a>c?a>l?a:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=f&&fi(s,a,o,c,n,l,m.x,m.y)&&pt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function VS(i,t,e,r){var s=i.prev,o=i,n=i.next;if(pt(s,o,n)>=0)return!1;for(var a=s.x,c=o.x,l=n.x,h=s.y,u=o.y,d=n.y,f=a<c?a<l?a:l:c<l?c:l,m=h<u?h<d?h:d:u<d?u:d,g=a>c?a>l?a:l:c>l?c:l,_=h>u?h>d?h:d:u>d?u:d,b=th(f,m,t,e,r),y=th(g,_,t,e,r),v=i.prevZ,S=i.nextZ;v&&v.z>=b&&S&&S.z<=y;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&fi(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0||(v=v.prevZ,S.x>=f&&S.x<=g&&S.y>=m&&S.y<=_&&S!==s&&S!==n&&fi(a,h,c,u,l,d,S.x,S.y)&&pt(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;v&&v.z>=b;){if(v.x>=f&&v.x<=g&&v.y>=m&&v.y<=_&&v!==s&&v!==n&&fi(a,h,c,u,l,d,v.x,v.y)&&pt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;S&&S.z<=y;){if(S.x>=f&&S.x<=g&&S.y>=m&&S.y<=_&&S!==s&&S!==n&&fi(a,h,c,u,l,d,S.x,S.y)&&pt(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function jS(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!jn(s,o)&&Pg(s,r,r.next,o)&&Cs(s,o)&&Cs(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Ms(r),Ms(r.next),r=i=o),r=r.next}while(r!==i);return Ir(r)}function XS(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&ew(n,a)){var c=Ag(n,a);n=Ir(n,n.next),c=Ir(c,c.next),As(n,t,e,r,s,o,0),As(c,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function $S(i,t,e,r){var s=[],o,n,a,c,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,c=o<n-1?t[o+1]*r:i.length,l=Eg(i,a,c,r,!1),l===l.next&&(l.steiner=!0),s.push(tw(l));for(s.sort(YS),o=0;o<s.length;o++)e=KS(s[o],e);return e}function YS(i,t){return i.x-t.x}function KS(i,t){var e=qS(i,t);if(!e)return t;var r=Ag(e,i);return Ir(r,r.next),Ir(e,e.next)}function qS(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=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<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var c=n,l=n.x,h=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&fi(s<h?r:o,s,l,h,s<h?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),Cs(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&ZS(n,e)))&&(n=e,u=d)),e=e.next;while(e!==c);return n}function ZS(i,t){return pt(i.prev,i,t.prev)<0&&pt(t.next,i,i.next)<0}function QS(i,t,e,r){var s=i;do s.z===0&&(s.z=th(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,JS(s)}function JS(i){var t,e,r,s,o,n,a,c,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(c=l;a>0||c>0&&r;)a!==0&&(c===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,c--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function th(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function tw(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function fi(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function ew(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!rw(i,t)&&(Cs(i,t)&&Cs(t,i)&&iw(i,t)&&(pt(i.prev,i,t.prev)||pt(i,t.prev,t))||jn(i,t)&&pt(i.prev,i,i.next)>0&&pt(t.prev,t,t.next)>0)}function pt(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function jn(i,t){return i.x===t.x&&i.y===t.y}function Pg(i,t,e,r){var s=zn(pt(i,t,e)),o=zn(pt(i,t,r)),n=zn(pt(e,r,i)),a=zn(pt(e,r,t));return!!(s!==o&&n!==a||s===0&&Wn(i,e,t)||o===0&&Wn(i,r,t)||n===0&&Wn(e,i,r)||a===0&&Wn(e,t,r))}function Wn(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function zn(i){return i>0?1:i<0?-1:0}function rw(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Pg(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Cs(i,t){return pt(i.prev,i,i.next)<0?pt(i,t,i.next)>=0&&pt(i,i.prev,t)>=0:pt(i,t,i.prev)<0||pt(i,i.next,t)<0}function iw(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Ag(i,t){var e=new eh(i.i,i.x,i.y),r=new eh(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function wg(i,t,e,r){var s=new eh(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Ms(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function eh(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Vn.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(rh(i,0,o,e));if(s)for(var a=0,c=t.length;a<c;a++){var l=t[a]*e,h=a<c-1?t[a+1]*e:i.length;n-=Math.abs(rh(i,l,h,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,m=r[a+2]*e;u+=Math.abs((i[d]-i[m])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[m+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function rh(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Vn.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function Xn(i,t,e,r,s,o,n){let a=(0,Cg.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let c=s*r;for(let l=0;l<i.length;l+=2)e[c]=i[l],e[c+1]=i[l+1],c+=r}var Cg,oh=p(()=>{Cg=Jo(sh(),1)});var sw,Mg,Bg=p(()=>{P();oh();sw=[],Mg={extension:{type:x.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Xn(i,sw,t,e,r,s,o)}}});var Rg,Gg=p(()=>{P();Rg={extension:{type:x.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var Ig,kg=p(()=>{P();Ig={extension:{type:x.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function Ug(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function Dg(i,t){let e=D.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function ow(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(U("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Qt.defaultLinearOptions.textureSize}),t}var Fg,ah,Qt,pi=p(()=>{Mt();ct();K();ti();tt();Rt();dt();Qc();Fg=[{offset:0,color:"white"},{offset:1,color:"black"}],ah=class nh{constructor(...t){this.uid=X("fillGradient"),this.type="linear",this.colorStops=[];let e=ow(t);e={...e.type==="radial"?nh.defaultRadialOptions:nh.defaultLinearOptions,...un(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:V.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let _=t;t=r,r=_,o*=-1}if(n<0){let _=e;e=s,s=_,n*=-1}}let c=this.colorStops.length?this.colorStops:Fg,l=this._textureSize,{canvas:h,context:u}=Dg(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);Ug(d,c),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new M({source:new qt({resource:h,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),m=Math.atan2(n,o),g=new B;g.scale(f/l,1),g.rotate(m),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:Fg,e=this._textureSize,{canvas:r,context:s}=Dg(e,e),{x:o,y:n}=this.center,{x:a,y:c}=this.outerCenter,l=this.innerRadius,h=this.outerRadius,u=a-h,d=c-h,f=e/(h*2),m=(o-u)*f,g=(n-d)*f,_=s.createRadialGradient(m,g,l*f,(a-u)*f,(c-d)*f,h*f);Ug(_,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=_,s.translate(m,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-m,-g),s.fillRect(0,0,e,e),this.texture=new M({source:new qt({resource:r,addressMode:this._wrapMode})});let b=new B;b.scale(1/f,1/f),b.translate(u,d),this.textureSpace==="local"&&b.scale(e,e),this.transform=b}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};ah.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};ah.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Qt=ah});function Og(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(aw);t.width&&n.pad(t.width);let{x:a,y:c}=n,l=1/n.width,h=1/n.height,u=-a*l,d=-c*h,f=s.a,m=s.b,g=s.c,_=s.d;s.a*=l,s.b*=l,s.c*=h,s.d*=h,s.tx=u*f+d*g+s.tx,s.ty=u*m+d*_+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Qt)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(nw.copyFrom(r).invert()),s}var nw,aw,Lg=p(()=>{K();vt();pi();nw=new B,aw=new z});function Hg(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")hw(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,c=o.data.style,l=o.data.hole;n&&l&&Ng(l.shapePath,c,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Ng(a,c,n,r,e)}}}function hw(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,c=[],l=$n.rectangle,h=cw,u=i.image;h.x=i.dx,h.y=i.dy,h.width=i.dw,h.height=i.dh;let d=i.transform;l.build(h,c),d&&Ql(c,d),l.triangulate(c,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let m=W.get(Rr);m.indexOffset=n,m.indexSize=o.length-n,m.attributeOffset=a,m.attributeSize=r.length/2-a,m.baseColor=i.style,m.alpha=i.alpha,m.texture=u,m.geometryData=e,t.push(m)}function Ng(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:c,transform:l,holes:h})=>{let u=a.length,d=o.length/2,f=[],m=$n[c.type],g="triangle-list";if(m.build(c,f),l&&Ql(f,l),e){let v=c.closePath??!0,S=t;S.pixelLine?(Tg(f,v,o,a),g="line-list"):bg(f,S,!1,v,o,a)}else if(h){let v=[],S=f.slice();uw(h).forEach(T=>{v.push(S.length/2),S.push(...T)}),Xn(S,v,o,2,d,a,u)}else m.triangulate(f,o,2,d,a,u);let _=n.length/2,b=t.texture;if(b!==M.WHITE){let v=Og(lw,t,c,l);hg(o,2,d,n,_,2,o.length/2-d,v)}else ug(n,_,2,o.length/2-d);let y=W.get(Rr);y.indexOffset=u,y.indexSize=a.length-u,y.attributeOffset=d,y.attributeSize=o.length/2-d,y.baseColor=t.color,y.alpha=t.alpha,y.texture=b,y.geometryData=s,y.topology=g,r.push(y)})}function uw(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];$n[r.type].build(r,s),t.push(s)}return t}var $n,cw,lw,Wg=p(()=>{P();K();vt();dg();fg();tt();Ut();Jl();gg();vg();Sg();Bg();Gg();kg();Lg();oh();$n={};I.handleByMap(x.ShapeBuilder,$n);I.add(Rg,Mg,Ig,di,pg,mg);cw=new z,lw=new B});var ch,lh,uh,mi,Yn=p(()=>{P();kn();Zl();qc();dt();Ut();Wg();ch=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},lh=class{constructor(){this.batcher=new Ps,this.instructions=new $r}init(){this.instructions.reset()}get geometry(){return U(af,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},uh=class hh{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){hh.defaultOptions.bezierSmoothness=t?.bezierSmoothness??hh.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),Hg(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=W.get(lh),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let h=0;h<r.length;h++)r[h].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let h=0;h<r.length;h++){let u=r[h];a.add(u)}a.finish(e.instructions);let c=a.geometry;c.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),c.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let h=0;h<l.length;h++){let u=l[h];u.bindGroup=ii(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new ch;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(W.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{W.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};uh.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"};uh.defaultOptions={bezierSmoothness:.5};mi=uh});var dw,dh,fh,ph,mh,gh,xh,_h,_t,_e=p(()=>{"use strict";dw={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},dh=0,fh=1,ph=2,mh=3,gh=4,xh=5,_h=class zg{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<dh)}set blend(t){!!(this.data&1<<dh)!==t&&(this.data^=1<<dh)}get offsets(){return!!(this.data&1<<fh)}set offsets(t){!!(this.data&1<<fh)!==t&&(this.data^=1<<fh)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<ph)}set culling(t){!!(this.data&1<<ph)!==t&&(this.data^=1<<ph)}get depthTest(){return!!(this.data&1<<mh)}set depthTest(t){!!(this.data&1<<mh)!==t&&(this.data^=1<<mh)}get depthMask(){return!!(this.data&1<<xh)}set depthMask(t){!!(this.data&1<<xh)!==t&&(this.data^=1<<xh)}get clockwiseFrontFace(){return!!(this.data&1<<gh)}set clockwiseFrontFace(t){!!(this.data&1<<gh)!==t&&(this.data^=1<<gh)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=dw[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new zg;return t.depthTest=!1,t.blend=!0,t}};_h.default2d=_h.for2d();_t=_h});function Re(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var gi=p(()=>{"use strict"});var Bs,Vg=p(()=>{P();_e();Ut();gi();Jl();Bs=class{constructor(t,e){this.state=_t.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){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Re(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=W.get(Rr);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{W.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};Bs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"}});var yh=p(()=>{P();Yn();Vg();I.add(Bs);I.add(mi)});var nr,Kn=p(()=>{"use strict";nr=class{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(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var Rs,jg=p(()=>{P();K();er();Nt();vs();Ut();gi();Kn();Rs=class{constructor(t,e){this.localUniforms=new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Pt({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){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(W.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Ve(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Re(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=W.get(nr);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&W.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}};Rs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"}});var bh=p(()=>{P();jg();I.add(Rs)});var qn,Xg=p(()=>{"use strict";qn=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function vh(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var $g=p(()=>{"use strict"});function Kg(i){return{dynamicUpdate:Yg(i,!0),staticUpdate:Yg(i,!1)}}function Yg(i,t){let e=[];e.push(`
253
+ `}}});var _f,Sb,Ab=m(()=>{"use strict";_f=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>","vec2<i32>","vec3<i32>","vec4<i32>"],Sb=_f.reduce((i,t)=>(i[t]=!0,i),{})});function Eb(i,t){switch(i){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var wb=m(()=>{"use strict"});var Cb,Tt,Ae=m(()=>{ue();Rn();Ab();wb();Cb=class Pb{constructor(t,e){this._touched=0,this.uid=nt("uniform"),this._resourceType="uniformGroup",this._resourceId=nt("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={...Pb.defaultOptions,...e},this.uniformStructures=t;let r={};for(let s in t){let o=t[s];if(o.name=s,o.size=o.size??1,!Sb[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${_f.join(", ")}`);o.value??(o.value=Eb(o.type,o.size)),r[s]=o.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Yr(Object.keys(r).map(s=>`${s}-${t[s].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Cb.defaultOptions={ubo:!1,isStatic:!1};Tt=Cb});function $s(i){let t=Rb[i];if(t)return t;let e=new Int32Array(i);for(let r=0;r<i;r++)e[r]=r;return t=Rb[i]=new Tt({uTextures:{value:e,type:"i32",size:i}},{isStatic:!0}),t}var Rb,Ml=m(()=>{Ae();Rb={}});var zt,Cr=m(()=>{"use strict";zt=(i=>(i[i.WEBGL=1]="WEBGL",i[i.WEBGPU=2]="WEBGPU",i[i.BOTH=3]="BOTH",i))(zt||{})});var Ot,dr=m(()=>{me();ue();Xi();mi();Ls();Cr();Ae();Ot=class i extends At{constructor(t){super(),this.uid=nt("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:r,groups:s,resources:o,compatibleRenderers:n,groupMap:a}=t;this.gpuProgram=e,this.glProgram=r,n===void 0&&(n=0,e&&(n|=zt.WEBGPU),r&&(n|=zt.WEBGL)),this.compatibleRenderers=n;let h={};if(!o&&!s&&(o={}),o&&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(let l in a)for(let c in a[l]){let u=a[l][c];h[u]={group:l,binding:c,name:u}}else if(e&&s&&!a){let l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,h[c.name]=c})}else if(o){s={},a={},e&&e.structsAndGroups.groups.forEach(u=>{a[u.group]=a[u.group]||{},a[u.group][u.binding]=u.name,h[u.name]=u});let l=0;for(let c in o)h[c]||(s[99]||(s[99]=new ie,this._ownedBindGroups.push(s[99])),h[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(let c in o){let u=c,d=o[c];!d.source&&!d._resourceType&&(d=new Tt(d));let f=h[u];f&&(s[f.group]||(s[f.group]=new ie,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(d,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,h)}addResource(t,e,r){var s,o;(s=this._uniformBindMap)[e]||(s[e]={}),(o=this._uniformBindMap[e])[r]||(o[r]=t),this.groups[e]||(this.groups[e]=new ie,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){let r={};for(let s in e){let o=e[s];Object.defineProperty(r,o.name,{get(){return t[o.group].getResource(o.binding)},set(n){t[o.group].setResource(n,o.binding)}})}return r}destroy(t=!1){this.emit("destroy",this),t&&(this.gpuProgram?.destroy(),this.glProgram?.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(e=>{e.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=er.from(e)),r&&(n=tr.from(r)),new i({gpuProgram:o,glProgram:n,...s})}}});var Bl,Mb=m(()=>{_i();Mn();Bn();yi();Ml();dr();Bl=class extends Ot{constructor(t){let e=Ar({name:"batch",bits:[Vs,zs(t),wr]}),r=Sr({name:"batch",bits:[Hs,Ws(t),Er]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:$s(t)}})}}});var Bb,Ib,In,yf=m(()=>{R();wy();My();Mb();Bb=null,Ib=class Fb extends Ey{constructor(){super(...arguments),this.geometry=new Cl,this.shader=Bb||(Bb=new Bl(this.maxTextures)),this.name=Fb.extension.name,this.vertexSize=6}packAttributes(t,e,r,s,o){let n=o<<16|t.roundPixels&65535,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,{positions:p,uvs:g}=t,x=t.color,v=t.attributeOffset,_=v+t.attributeSize;for(let b=v;b<_;b++){let T=b*2,E=p[T],A=p[T+1];e[s++]=h*E+c*A+d,e[s++]=u*A+l*E+f,e[s++]=g[T],e[s++]=g[T+1],r[s++]=x,r[s++]=n}}packQuadAttributes(t,e,r,s,o){let n=t.texture,a=t.transform,h=a.a,l=a.b,c=a.c,u=a.d,d=a.tx,f=a.ty,p=t.bounds,g=p.maxX,x=p.minX,v=p.maxY,_=p.minY,b=n.uvs,T=t.color,E=o<<16|t.roundPixels&65535;e[s+0]=h*x+c*_+d,e[s+1]=u*_+l*x+f,e[s+2]=b.x0,e[s+3]=b.y0,r[s+4]=T,r[s+5]=E,e[s+6]=h*g+c*_+d,e[s+7]=u*_+l*g+f,e[s+8]=b.x1,e[s+9]=b.y1,r[s+10]=T,r[s+11]=E,e[s+12]=h*g+c*v+d,e[s+13]=u*v+l*g+f,e[s+14]=b.x2,e[s+15]=b.y2,r[s+16]=T,r[s+17]=E,e[s+18]=h*x+c*v+d,e[s+19]=u*v+l*x+f,e[s+20]=b.x3,e[s+21]=b.y3,r[s+22]=T,r[s+23]=E}};Ib.extension={type:[y.Batcher],name:"default"};In=Ib});function Gb(i,t,e,r,s,o,n,a=null){let h=0;e*=t,s*=o;let l=a.a,c=a.b,u=a.c,d=a.d,f=a.tx,p=a.ty;for(;h<n;){let g=i[e],x=i[e+1];r[s]=l*g+u*x+f,r[s+1]=c*g+d*x+p,s+=o,e+=t,h++}}function Ub(i,t,e,r){let s=0;for(t*=e;s<r;)i[t]=0,i[t+1]=0,t+=e,s++}var kb=m(()=>{"use strict"});function bf(i,t,e,r,s){let o=t.a,n=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),r||(r=2),s||(s=i.length/r-e);let u=e*r;for(let d=0;d<s;d++){let f=i[u],p=i[u+1];i[u]=o*f+a*p+l,i[u+1]=n*f+h*p+c,u+=r}}var Ob=m(()=>{"use strict"});var $R,Yi,vf=m(()=>{dt();dd();$R=new U,Yi=class{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){let t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?Jh(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||$R}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 Xs,Nb,Db,Lb=m(()=>{R();Xs={extension:{type:y.ShapeBuilder,name:"circle"},build(i,t){let e,r,s,o,n,a;if(i.type==="circle"){let T=i;e=T.x,r=T.y,n=a=T.radius,s=o=0}else if(i.type==="ellipse"){let T=i;e=T.x,r=T.y,n=T.halfWidth,a=T.halfHeight,s=o=0}else{let T=i,E=T.width/2,A=T.height/2;e=T.x+E,r=T.y+A,n=a=Math.max(0,Math.min(T.radius,Math.min(E,A))),s=E-n,o=A-a}if(!(n>=0&&a>=0&&s>=0&&o>=0))return t;let h=Math.ceil(2.3*Math.sqrt(n+a)),l=h*8+(s?4:0)+(o?4:0);if(l===0)return t;if(h===0)return t[0]=t[6]=e+s,t[1]=t[3]=r+o,t[2]=t[4]=e-s,t[5]=t[7]=r-o,t;let c=0,u=h*4+(s?2:0)+2,d=u,f=l,p=s+n,g=o,x=e+p,v=e-p,_=r+g;if(t[c++]=x,t[c++]=_,t[--u]=_,t[--u]=v,o){let T=r-g;t[d++]=v,t[d++]=T,t[--f]=T,t[--f]=x}for(let T=1;T<h;T++){let E=Math.PI/2*(T/h),A=s+Math.cos(E)*n,C=o+Math.sin(E)*a,M=e+A,P=e-A,S=r+C,w=r-C;t[c++]=M,t[c++]=S,t[--u]=S,t[--u]=P,t[d++]=P,t[d++]=w,t[--f]=w,t[--f]=M}p=s,g=o+a,x=e+p,v=e-p,_=r+g;let b=r-g;return t[c++]=x,t[c++]=_,t[--f]=b,t[--f]=x,s&&(t[c++]=v,t[c++]=_,t[--f]=b,t[--f]=v),t},triangulate(i,t,e,r,s,o){if(i.length===0)return;let n=0,a=0;for(let c=0;c<i.length;c+=2)n+=i[c],a+=i[c+1];n/=i.length/2,a/=i.length/2;let h=r;t[h*e]=n,t[h*e+1]=a;let l=h++;for(let c=0;c<i.length;c+=2)t[h*e]=i[c],t[h*e+1]=i[c+1],c>0&&(s[o++]=h,s[o++]=l,s[o++]=h-1),h++;s[o++]=l+1,s[o++]=l,s[o++]=h-1}},Nb={...Xs,extension:{...Xs.extension,name:"ellipse"}},Db={...Xs,extension:{...Xs.extension,name:"roundedRectangle"}}});function Hb(i){let t=i.length;if(t<6)return 1;let e=0;for(let r=0,s=i[t-2],o=i[t-1];r<t;r+=2){let n=i[r],a=i[r+1];e+=(n-s)*(a+o),s=n,o=a}return e<0?-1:1}var Vb=m(()=>{"use strict"});function Wb(i,t,e,r,s,o,n,a){let h=i-e*s,l=t-r*s,c=i+e*o,u=t+r*o,d,f;n?(d=r,f=-e):(d=-r,f=e);let p=h+d,g=l+f,x=c+d,v=u+f;return a.push(p,g),a.push(x,v),2}function qi(i,t,e,r,s,o,n,a){let h=e-i,l=r-t,c=Math.atan2(h,l),u=Math.atan2(s-i,o-t);a&&c<u?c+=Math.PI*2:!a&&c>u&&(u+=Math.PI*2);let d=c,f=u-c,p=Math.abs(f),g=Math.sqrt(h*h+l*l),x=(15*p*Math.sqrt(g)/Math.PI>>0)+1,v=f/x;if(d+=v,a){n.push(i,t),n.push(e,r);for(let _=1,b=d;_<x;_++,b+=v)n.push(i,t),n.push(i+Math.sin(b)*g,t+Math.cos(b)*g);n.push(i,t),n.push(s,o)}else{n.push(e,r),n.push(i,t);for(let _=1,b=d;_<x;_++,b+=v)n.push(i+Math.sin(b)*g,t+Math.cos(b)*g),n.push(i,t);n.push(s,o),n.push(i,t)}return x*2}function zb(i,t,e,r,s,o){let n=1e-4;if(i.length===0)return;let a=t,h=a.alignment;if(t.alignment!==.5){let O=Hb(i);e&&(O*=-1),h=(h-.5)*O+.5}let l=new at(i[0],i[1]),c=new at(i[i.length-2],i[i.length-1]),u=r,d=Math.abs(l.x-c.x)<n&&Math.abs(l.y-c.y)<n;if(u){i=i.slice(),d&&(i.pop(),i.pop(),c.set(i[i.length-2],i[i.length-1]));let O=(l.x+c.x)*.5,Y=(c.y+l.y)*.5;i.unshift(O,Y),i.push(O,Y)}let f=s,p=i.length/2,g=i.length,x=f.length/2,v=a.width/2,_=v*v,b=a.miterLimit*a.miterLimit,T=i[0],E=i[1],A=i[2],C=i[3],M=0,P=0,S=-(E-C),w=T-A,B=0,F=0,W=Math.sqrt(S*S+w*w);S/=W,w/=W,S*=v,w*=v;let z=h,k=(1-z)*2,G=z*2;u||(a.cap==="round"?g+=qi(T-S*(k-G)*.5,E-w*(k-G)*.5,T-S*k,E-w*k,T+S*G,E+w*G,f,!0)+2:a.cap==="square"&&(g+=Wb(T,E,S,w,k,G,!0,f))),f.push(T-S*k,E-w*k),f.push(T+S*G,E+w*G);for(let O=1;O<p-1;++O){T=i[(O-1)*2],E=i[(O-1)*2+1],A=i[O*2],C=i[O*2+1],M=i[(O+1)*2],P=i[(O+1)*2+1],S=-(E-C),w=T-A,W=Math.sqrt(S*S+w*w),S/=W,w/=W,S*=v,w*=v,B=-(C-P),F=A-M,W=Math.sqrt(B*B+F*F),B/=W,F/=W,B*=v,F*=v;let Y=A-T,lt=E-C,yt=A-M,It=P-C,Vt=Y*yt+lt*It,te=lt*yt-It*Y,ae=te<0;if(Math.abs(te)<.001*Math.abs(Vt)){f.push(A-S*k,C-w*k),f.push(A+S*G,C+w*G),Vt>=0&&(a.join==="round"?g+=qi(A,C,A-S*k,C-w*k,A-B*k,C-F*k,f,!1)+4:g+=2,f.push(A-B*G,C-F*G),f.push(A+B*k,C+F*k));continue}let Ne=(-S+T)*(-w+C)-(-S+A)*(-w+E),qe=(-B+M)*(-F+C)-(-B+A)*(-F+P),Dt=(Y*qe-yt*Ne)/te,he=(It*Ne-lt*qe)/te,_e=(Dt-A)*(Dt-A)+(he-C)*(he-C),fe=A+(Dt-A)*k,ye=C+(he-C)*k,lr=A-(Dt-A)*G,Ii=C-(he-C)*G,DP=Math.min(Y*Y+lt*lt,yt*yt+It*It),ux=ae?k:G,LP=DP+ux*ux*_;_e<=LP?a.join==="bevel"||_e/_>b?(ae?(f.push(fe,ye),f.push(A+S*G,C+w*G),f.push(fe,ye),f.push(A+B*G,C+F*G)):(f.push(A-S*k,C-w*k),f.push(lr,Ii),f.push(A-B*k,C-F*k),f.push(lr,Ii)),g+=2):a.join==="round"?ae?(f.push(fe,ye),f.push(A+S*G,C+w*G),g+=qi(A,C,A+S*G,C+w*G,A+B*G,C+F*G,f,!0)+4,f.push(fe,ye),f.push(A+B*G,C+F*G)):(f.push(A-S*k,C-w*k),f.push(lr,Ii),g+=qi(A,C,A-S*k,C-w*k,A-B*k,C-F*k,f,!1)+4,f.push(A-B*k,C-F*k),f.push(lr,Ii)):(f.push(fe,ye),f.push(lr,Ii)):(f.push(A-S*k,C-w*k),f.push(A+S*G,C+w*G),a.join==="round"?ae?g+=qi(A,C,A+S*G,C+w*G,A+B*G,C+F*G,f,!0)+2:g+=qi(A,C,A-S*k,C-w*k,A-B*k,C-F*k,f,!1)+2:a.join==="miter"&&_e/_<=b&&(ae?(f.push(lr,Ii),f.push(lr,Ii)):(f.push(fe,ye),f.push(fe,ye)),g+=2),f.push(A-B*k,C-F*k),f.push(A+B*G,C+F*G),g+=2)}T=i[(p-2)*2],E=i[(p-2)*2+1],A=i[(p-1)*2],C=i[(p-1)*2+1],S=-(E-C),w=T-A,W=Math.sqrt(S*S+w*w),S/=W,w/=W,S*=v,w*=v,f.push(A-S*k,C-w*k),f.push(A+S*G,C+w*G),u||(a.cap==="round"?g+=qi(A-S*(k-G)*.5,C-w*(k-G)*.5,A-S*k,C-w*k,A+S*G,C+w*G,f,!1)+2:a.cap==="square"&&(g+=Wb(A,C,S,w,k,G,!1,f)));let N=1e-4*1e-4;for(let O=x;O<g+x-2;++O)T=f[O*2],E=f[O*2+1],A=f[(O+1)*2],C=f[(O+1)*2+1],M=f[(O+2)*2],P=f[(O+2)*2+1],!(Math.abs(T*(C-P)+A*(P-E)+M*(E-C))<N)&&o.push(O,O+1,O+2)}var $b=m(()=>{Ze();Vb()});function Xb(i,t,e,r){let s=1e-4;if(i.length===0)return;let o=i[0],n=i[1],a=i[i.length-2],h=i[i.length-1],l=t||Math.abs(o-a)<s&&Math.abs(n-h)<s,c=e,u=i.length/2,d=c.length/2;for(let f=0;f<u;f++)c.push(i[f*2]),c.push(i[f*2+1]);for(let f=0;f<u-1;f++)r.push(d+f,d+f+1);l&&r.push(d+u-1,d)}var jb=m(()=>{});var kl=Q(($H,Ef)=>{"use strict";Ef.exports=Gl;Ef.exports.default=Gl;function Gl(i,t,e){e=e||2;var r=t&&t.length,s=r?t[0]*e:i.length,o=qb(i,0,s,e,!0),n=[];if(!o||o.next===o.prev)return n;var a,h,l,c,u,d,f;if(r&&(o=QR(i,t,o,e)),i.length>80*e){a=l=i[0],h=c=i[1];for(var p=e;p<s;p+=e)u=i[p],d=i[p+1],u<a&&(a=u),d<h&&(h=d),u>l&&(l=u),d>c&&(c=d);f=Math.max(l-a,c-h),f=f!==0?32767/f:0}return Fn(o,n,e,a,h,f,0),n}function qb(i,t,e,r,s){var o,n;if(s===Af(i,t,e,r)>0)for(o=t;o<e;o+=r)n=Yb(o,i[o],i[o+1],n);else for(o=e-r;o>=t;o-=r)n=Yb(o,i[o],i[o+1],n);return n&&Ul(n,n.next)&&(Un(n),n=n.next),n}function Ki(i,t){if(!i)return i;t||(t=i);var e=i,r;do if(r=!1,!e.steiner&&(Ul(e,e.next)||Ut(e.prev,e,e.next)===0)){if(Un(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Fn(i,t,e,r,s,o,n){if(i){!n&&o&&iM(i,r,s,o);for(var a=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,o?qR(i,r,s,o):YR(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),Un(i),i=l.next,a=l.next;continue}if(i=l,i===a){n?n===1?(i=KR(Ki(i),t,e),Fn(i,t,e,r,s,o,2)):n===2&&ZR(i,t,e,r,s,o):Fn(Ki(i),t,e,r,s,o,1);break}}}}function YR(i){var t=i.prev,e=i,r=i.next;if(Ut(t,e,r)>=0)return!1;for(var s=t.x,o=e.x,n=r.x,a=t.y,h=e.y,l=r.y,c=s<o?s<n?s:n:o<n?o:n,u=a<h?a<l?a:l:h<l?h:l,d=s>o?s>n?s:n:o>n?o:n,f=a>h?a>l?a:l:h>l?h:l,p=r.next;p!==t;){if(p.x>=c&&p.x<=d&&p.y>=u&&p.y<=f&&js(s,a,o,h,n,l,p.x,p.y)&&Ut(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function qR(i,t,e,r){var s=i.prev,o=i,n=i.next;if(Ut(s,o,n)>=0)return!1;for(var a=s.x,h=o.x,l=n.x,c=s.y,u=o.y,d=n.y,f=a<h?a<l?a:l:h<l?h:l,p=c<u?c<d?c:d:u<d?u:d,g=a>h?a>l?a:l:h>l?h:l,x=c>u?c>d?c:d:u>d?u:d,v=Tf(f,p,t,e,r),_=Tf(g,x,t,e,r),b=i.prevZ,T=i.nextZ;b&&b.z>=v&&T&&T.z<=_;){if(b.x>=f&&b.x<=g&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&js(a,c,h,u,l,d,b.x,b.y)&&Ut(b.prev,b,b.next)>=0||(b=b.prevZ,T.x>=f&&T.x<=g&&T.y>=p&&T.y<=x&&T!==s&&T!==n&&js(a,c,h,u,l,d,T.x,T.y)&&Ut(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;b&&b.z>=v;){if(b.x>=f&&b.x<=g&&b.y>=p&&b.y<=x&&b!==s&&b!==n&&js(a,c,h,u,l,d,b.x,b.y)&&Ut(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;T&&T.z<=_;){if(T.x>=f&&T.x<=g&&T.y>=p&&T.y<=x&&T!==s&&T!==n&&js(a,c,h,u,l,d,T.x,T.y)&&Ut(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function KR(i,t,e){var r=i;do{var s=r.prev,o=r.next.next;!Ul(s,o)&&Kb(s,r,r.next,o)&&Gn(s,o)&&Gn(o,s)&&(t.push(s.i/e|0),t.push(r.i/e|0),t.push(o.i/e|0),Un(r),Un(r.next),r=i=o),r=r.next}while(r!==i);return Ki(r)}function ZR(i,t,e,r,s,o){var n=i;do{for(var a=n.next.next;a!==n.prev;){if(n.i!==a.i&&nM(n,a)){var h=Zb(n,a);n=Ki(n,n.next),h=Ki(h,h.next),Fn(n,t,e,r,s,o,0),Fn(h,t,e,r,s,o,0);return}a=a.next}n=n.next}while(n!==i)}function QR(i,t,e,r){var s=[],o,n,a,h,l;for(o=0,n=t.length;o<n;o++)a=t[o]*r,h=o<n-1?t[o+1]*r:i.length,l=qb(i,a,h,r,!1),l===l.next&&(l.steiner=!0),s.push(oM(l));for(s.sort(JR),o=0;o<s.length;o++)e=tM(s[o],e);return e}function JR(i,t){return i.x-t.x}function tM(i,t){var e=eM(i,t);if(!e)return t;var r=Zb(e,i);return Ki(r,r.next),Ki(e,e.next)}function eM(i,t){var e=t,r=i.x,s=i.y,o=-1/0,n;do{if(s<=e.y&&s>=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<=r&&a>o&&(o=a,n=e.x<e.next.x?e:e.next,a===r))return n}e=e.next}while(e!==t);if(!n)return null;var h=n,l=n.x,c=n.y,u=1/0,d;e=n;do r>=e.x&&e.x>=l&&r!==e.x&&js(s<c?r:o,s,l,c,s<c?o:r,s,e.x,e.y)&&(d=Math.abs(s-e.y)/(r-e.x),Gn(e,i)&&(d<u||d===u&&(e.x>n.x||e.x===n.x&&rM(n,e)))&&(n=e,u=d)),e=e.next;while(e!==h);return n}function rM(i,t){return Ut(i.prev,i,t.prev)<0&&Ut(t.next,i,i.next)<0}function iM(i,t,e,r){var s=i;do s.z===0&&(s.z=Tf(s.x,s.y,t,e,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,sM(s)}function sM(i){var t,e,r,s,o,n,a,h,l=1;do{for(e=i,i=null,o=null,n=0;e;){for(n++,r=e,a=0,t=0;t<l&&(a++,r=r.nextZ,!!r);t++);for(h=l;a>0||h>0&&r;)a!==0&&(h===0||!r||e.z<=r.z)?(s=e,e=e.nextZ,a--):(s=r,r=r.nextZ,h--),o?o.nextZ=s:i=s,s.prevZ=o,o=s;e=r}o.nextZ=null,l*=2}while(n>1);return i}function Tf(i,t,e,r,s){return i=(i-e)*s|0,t=(t-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function oM(i){var t=i,e=i;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==i);return e}function js(i,t,e,r,s,o,n,a){return(s-n)*(t-a)>=(i-n)*(o-a)&&(i-n)*(r-a)>=(e-n)*(t-a)&&(e-n)*(o-a)>=(s-n)*(r-a)}function nM(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!aM(i,t)&&(Gn(i,t)&&Gn(t,i)&&hM(i,t)&&(Ut(i.prev,i,t.prev)||Ut(i,t.prev,t))||Ul(i,t)&&Ut(i.prev,i,i.next)>0&&Ut(t.prev,t,t.next)>0)}function Ut(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function Ul(i,t){return i.x===t.x&&i.y===t.y}function Kb(i,t,e,r){var s=Fl(Ut(i,t,e)),o=Fl(Ut(i,t,r)),n=Fl(Ut(e,r,i)),a=Fl(Ut(e,r,t));return!!(s!==o&&n!==a||s===0&&Il(i,e,t)||o===0&&Il(i,r,t)||n===0&&Il(e,i,r)||a===0&&Il(e,t,r))}function Il(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function Fl(i){return i>0?1:i<0?-1:0}function aM(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&Kb(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function Gn(i,t){return Ut(i.prev,i,i.next)<0?Ut(i,t,i.next)>=0&&Ut(i,i.prev,t)>=0:Ut(i,t,i.prev)<0||Ut(i,i.next,t)<0}function hM(i,t){var e=i,r=!1,s=(i.x+t.x)/2,o=(i.y+t.y)/2;do e.y>o!=e.next.y>o&&e.next.y!==e.y&&s<(e.next.x-e.x)*(o-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==i);return r}function Zb(i,t){var e=new Sf(i.i,i.x,i.y),r=new Sf(t.i,t.x,t.y),s=i.next,o=t.prev;return i.next=t,t.prev=i,e.next=s,s.prev=e,r.next=e,e.prev=r,o.next=r,r.prev=o,r}function Yb(i,t,e,r){var s=new Sf(i,t,e);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Un(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Sf(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Gl.deviation=function(i,t,e,r){var s=t&&t.length,o=s?t[0]*e:i.length,n=Math.abs(Af(i,0,o,e));if(s)for(var a=0,h=t.length;a<h;a++){var l=t[a]*e,c=a<h-1?t[a+1]*e:i.length;n-=Math.abs(Af(i,l,c,e))}var u=0;for(a=0;a<r.length;a+=3){var d=r[a]*e,f=r[a+1]*e,p=r[a+2]*e;u+=Math.abs((i[d]-i[p])*(i[f+1]-i[d+1])-(i[d]-i[f])*(i[p+1]-i[d+1]))}return n===0&&u===0?0:Math.abs((u-n)/n)};function Af(i,t,e,r){for(var s=0,o=t,n=e-r;o<e;o+=r)s+=(i[n]-i[o])*(i[o+1]+i[n+1]),n=o;return s}Gl.flatten=function(i){for(var t=i[0][0].length,e={vertices:[],holes:[],dimensions:t},r=0,s=0;s<i.length;s++){for(var o=0;o<i[s].length;o++)for(var n=0;n<t;n++)e.vertices.push(i[s][o][n]);s>0&&(r+=i[s-1].length,e.holes.push(r))}return e}});function Ol(i,t,e,r,s,o,n){let a=(0,Qb.default)(i,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)o[n++]=a[l]+s,o[n++]=a[l+1]+s,o[n++]=a[l+2]+s;let h=s*r;for(let l=0;l<i.length;l+=2)e[h]=i[l],e[h+1]=i[l+1],h+=r}var Qb,wf=m(()=>{Qb=Fi(kl(),1)});var lM,Jb,tv=m(()=>{R();wf();lM=[],Jb={extension:{type:y.ShapeBuilder,name:"polygon"},build(i,t){for(let e=0;e<i.points.length;e++)t[e]=i.points[e];return t},triangulate(i,t,e,r,s,o){Ol(i,lM,t,e,r,s,o)}}});var ev,rv=m(()=>{R();ev={extension:{type:y.ShapeBuilder,name:"rectangle"},build(i,t){let e=i,r=e.x,s=e.y,o=e.width,n=e.height;return o>=0&&n>=0&&(t[0]=r,t[1]=s,t[2]=r+o,t[3]=s,t[4]=r+o,t[5]=s+n,t[6]=r,t[7]=s+n),t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[6],t[r+n+1]=i[7],n+=e,t[r+n]=i[4],t[r+n+1]=i[5],n+=e;let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2,s[o++]=a+1,s[o++]=a+3,s[o++]=a+2}}});var iv,sv=m(()=>{R();iv={extension:{type:y.ShapeBuilder,name:"triangle"},build(i,t){return t[0]=i.x,t[1]=i.y,t[2]=i.x2,t[3]=i.y2,t[4]=i.x3,t[5]=i.y3,t},triangulate(i,t,e,r,s,o){let n=0;r*=e,t[r+n]=i[0],t[r+n+1]=i[1],n+=e,t[r+n]=i[2],t[r+n+1]=i[3],n+=e,t[r+n]=i[4],t[r+n+1]=i[5];let a=r/e;s[o++]=a,s[o++]=a+1,s[o++]=a+2}}});function nv(i,t){for(let e=0;e<t.length;e++){let r=t[e];i.addColorStop(r.offset,r.color)}}function av(i,t){let e=j.get().createCanvas(i,t),r=e.getContext("2d");return{canvas:e,context:r}}function cM(i){let t=i[0]??{};return(typeof t=="number"||i[1])&&(X("8.5.2","use options object instead"),t={type:"linear",start:{x:i[0],y:i[1]},end:{x:i[2],y:i[3]},textureSpace:i[4],textureSize:i[5]??Ue.defaultLinearOptions.textureSize}),t}var ov,Pf,Ue,Ys=m(()=>{le();wt();dt();Gs();xt();ue();Ft();_d();ov=[{offset:0,color:"white"},{offset:1,color:"black"}],Pf=class Cf{constructor(...t){this.uid=nt("fillGradient"),this.type="linear",this.colorStops=[];let e=cM(t);e={...e.type==="radial"?Cf.defaultRadialOptions:Cf.defaultLinearOptions,...el(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(s=>{this.addColorStop(s.offset,s.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:it.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:s}=this.end,o=r-t,n=s-e,a=o<0||n<0;if(this._wrapMode==="clamp-to-edge"){if(o<0){let x=t;t=r,r=x,o*=-1}if(n<0){let x=e;e=s,s=x,n*=-1}}let h=this.colorStops.length?this.colorStops:ov,l=this._textureSize,{canvas:c,context:u}=av(l,1),d=a?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);nv(d,h),u.fillStyle=d,u.fillRect(0,0,l,1),this.texture=new I({source:new Fe({resource:c,addressMode:this._wrapMode})});let f=Math.sqrt(o*o+n*n),p=Math.atan2(n,o),g=new U;g.scale(f/l,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(l,l),this.transform=g}buildGradient(){this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;let t=this.colorStops.length?this.colorStops:ov,e=this._textureSize,{canvas:r,context:s}=av(e,e),{x:o,y:n}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,u=a-c,d=h-c,f=e/(c*2),p=(o-u)*f,g=(n-d)*f,x=s.createRadialGradient(p,g,l*f,(a-u)*f,(h-d)*f,c*f);nv(x,t),s.fillStyle=t[t.length-1].color,s.fillRect(0,0,e,e),s.fillStyle=x,s.translate(p,g),s.rotate(this.rotation),s.scale(1,this.scale),s.translate(-p,-g),s.fillRect(0,0,e,e),this.texture=new I({source:new Fe({resource:r,addressMode:this._wrapMode})});let v=new U;v.scale(1/f,1/f),v.translate(u,d),this.textureSpace==="local"&&v.scale(e,e),this.transform=v}get styleKey(){return this.uid}destroy(){this.texture?.destroy(!0),this.texture=null}};Pf.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};Pf.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};Ue=Pf});function hv(i,t,e,r){let s=t.matrix?i.copyFrom(t.matrix).invert():i.identity();if(t.textureSpace==="local"){let n=e.getBounds(dM);t.width&&n.pad(t.width);let{x:a,y:h}=n,l=1/n.width,c=1/n.height,u=-a*l,d=-h*c,f=s.a,p=s.b,g=s.c,x=s.d;s.a*=l,s.b*=l,s.c*=c,s.d*=c,s.tx=u*f+d*g+s.tx,s.ty=u*p+d*x+s.ty}else s.translate(t.texture.frame.x,t.texture.frame.y),s.scale(1/t.texture.source.width,1/t.texture.source.height);let o=t.texture.source.style;return!(t.fill instanceof Ue)&&o.addressMode==="clamp-to-edge"&&(o.addressMode="repeat",o.update()),r&&s.append(uM.copyFrom(r).invert()),s}var uM,dM,lv=m(()=>{dt();Yt();Ys();uM=new U,dM=new rt});function uv(i,t){let{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<i.instructions.length;s++){let o=i.instructions[s];if(o.action==="texture")mM(o.data,r,e);else if(o.action==="fill"||o.action==="stroke"){let n=o.action==="stroke",a=o.data.path.shapePath,h=o.data.style,l=o.data.hole;n&&l&&cv(l.shapePath,h,!0,r,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),cv(a,h,n,r,e)}}}function mM(i,t,e){let{vertices:r,uvs:s,indices:o}=e,n=o.length,a=r.length/2,h=[],l=Nl.rectangle,c=fM,u=i.image;c.x=i.dx,c.y=i.dy,c.width=i.dw,c.height=i.dh;let d=i.transform;l.build(c,h),d&&bf(h,d),l.triangulate(h,r,2,a,o,n);let f=u.uvs;s.push(f.x0,f.y0,f.x1,f.y1,f.x3,f.y3,f.x2,f.y2);let p=et.get(Yi);p.indexOffset=n,p.indexSize=o.length-n,p.attributeOffset=a,p.attributeSize=r.length/2-a,p.baseColor=i.style,p.alpha=i.alpha,p.texture=u,p.geometryData=e,t.push(p)}function cv(i,t,e,r,s){let{vertices:o,uvs:n,indices:a}=s;i.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{let u=a.length,d=o.length/2,f=[],p=Nl[h.type],g="triangle-list";if(p.build(h,f),l&&bf(f,l),e){let b=h.closePath??!0,T=t;T.pixelLine?(Xb(f,b,o,a),g="line-list"):zb(f,T,!1,b,o,a)}else if(c){let b=[],T=f.slice();gM(c).forEach(A=>{b.push(T.length/2),T.push(...A)}),Ol(T,b,o,2,d,a,u)}else p.triangulate(f,o,2,d,a,u);let x=n.length/2,v=t.texture;if(v!==I.WHITE){let b=hv(pM,t,h,l);Gb(o,2,d,n,x,2,o.length/2-d,b)}else Ub(n,x,2,o.length/2-d);let _=et.get(Yi);_.indexOffset=u,_.indexSize=a.length-u,_.attributeOffset=d,_.attributeSize=o.length/2-d,_.baseColor=t.color,_.alpha=t.alpha,_.texture=v,_.geometryData=s,_.topology=g,r.push(_)})}function gM(i){let t=[];for(let e=0;e<i.length;e++){let r=i[e].shape,s=[];Nl[r.type].build(r,s),t.push(s)}return t}var Nl,fM,pM,dv=m(()=>{R();dt();Yt();kb();Ob();xt();ve();vf();Lb();$b();jb();tv();rv();sv();lv();wf();Nl={};D.handleByMap(y.ShapeBuilder,Nl);D.add(ev,Jb,iv,Xs,Nb,Db);fM=new rt,pM=new U});var Rf,Mf,If,qs,Dl=m(()=>{R();Al();yf();gd();Ft();ve();dv();Rf=class{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}},Mf=class{constructor(){this.batcher=new In,this.instructions=new Cs}init(){this.instructions.reset()}get geometry(){return X(Ix,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}},If=class Bf{constructor(t){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null),t.renderableGC.addManagedHash(this,"_gpuContextHash"),t.renderableGC.addManagedHash(this,"_graphicsDataContextHash")}init(t){Bf.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Bf.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),uv(t,e);let r=t.batchMode;t.customShader||r==="no-batch"?e.isBatchable=!1:r==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){let e=et.get(Mf),{batches:r,geometryData:s}=this._gpuContextHash[t.uid],o=s.vertices.length,n=s.indices.length;for(let c=0;c<r.length;c++)r[c].applyTransform=!1;let a=e.batcher;a.ensureAttributeBuffer(o),a.ensureIndexBuffer(n),a.begin();for(let c=0;c<r.length;c++){let u=r[c];a.add(u)}a.finish(e.instructions);let h=a.geometry;h.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),h.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);let l=a.batches;for(let c=0;c<l.length;c++){let u=l[c];u.bindGroup=Os(u.textures.textures,u.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){let e=new Rf;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){let e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(et.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(r=>{et.return(r)})}destroy(){for(let t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};If.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"graphicsContext"};If.defaultOptions={bezierSmoothness:.5};qs=If});var xM,Ff,Gf,Uf,kf,Of,Nf,Df,Lt,fr=m(()=>{"use strict";xM={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},Ff=0,Gf=1,Uf=2,kf=3,Of=4,Nf=5,Df=class fv{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Ff)}set blend(t){!!(this.data&1<<Ff)!==t&&(this.data^=1<<Ff)}get offsets(){return!!(this.data&1<<Gf)}set offsets(t){!!(this.data&1<<Gf)!==t&&(this.data^=1<<Gf)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<Uf)}set culling(t){!!(this.data&1<<Uf)!==t&&(this.data^=1<<Uf)}get depthTest(){return!!(this.data&1<<kf)}set depthTest(t){!!(this.data&1<<kf)!==t&&(this.data^=1<<kf)}get depthMask(){return!!(this.data&1<<Nf)}set depthMask(t){!!(this.data&1<<Nf)!==t&&(this.data^=1<<Nf)}get clockwiseFrontFace(){return!!(this.data&1<<Of)}set clockwiseFrontFace(t){!!(this.data&1<<Of)!==t&&(this.data^=1<<Of)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=xM[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){let t=new fv;return t.depthTest=!1,t.blend=!0,t}};Df.default2d=Df.for2d();Lt=Df});function Pr(i,t,e){let r=(i>>24&255)/255;t[e++]=(i&255)/255*r,t[e++]=(i>>8&255)/255*r,t[e++]=(i>>16&255)/255*r,t[e++]=r}var Ks=m(()=>{"use strict"});var kn,pv=m(()=>{R();fr();ve();Ks();vf();kn=class{constructor(t,e){this.state=Lt.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){let e=t.context,r=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||r!==s.isBatchable)}addRenderable(t,e){let r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){let e=this._graphicsBatchesHash[t.uid];if(e)for(let r=0;r<e.length;r++){let s=e[r];s._batcher.updateElement(s)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;let e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;let o=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;let n=o.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,Pr(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){let e=!!this._graphicsBatchesHash[t.uid],r=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),r.isBatchable&&this._initBatchesForRenderable(t),t.batched=r.isBatchable}_addToBatcher(t,e){let r=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let o=0;o<s.length;o++){let n=s[o];r.addToBatch(n,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){let e=t.context,r=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,o=r.batches.map(n=>{let a=et.get(Yi);return n.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=o,o}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{et.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(let t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}};kn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"graphics"}});var Lf=m(()=>{R();Dl();pv();D.add(kn);D.add(qs)});var bi,Ll=m(()=>{"use strict";bi=class{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(){let e=this.geometry.getBuffer("aUV"),r=e.data,s=r,o=this.texture.textureMatrix;return o.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==o._updateID||this._uvUpdateId!==e._updateID)&&((!s||s.length<r.length)&&(s=this._transformedUvs=new Float32Array(r.length)),this._textureMatrixUpdateId=o._updateID,this._uvUpdateId=e._updateID,o.multiplyUvs(r,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}});var On,mv=m(()=>{R();dt();mi();Ae();Cn();ve();Ks();Ll();On=class{constructor(t,e){this.localUniforms=new Tt({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new ie({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){let e=this._getMeshData(t),r=e.batched,s=t.batched;if(e.batched=s,r!==s)return!0;if(s){let o=t._geometry;if(o.indices.length!==e.indexSize||o.positions.length!==e.vertexSize)return e.indexSize=o.indices.length,e.vertexSize=o.positions.length,!0;let n=this._getBatchableMesh(t);return n.texture.uid!==t._texture.uid&&(n._textureMatrixUpdateId=-1),!n._batcher.checkAndUpdateTexture(n,t._texture)}return!1}addRenderable(t,e){let r=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){let o=this._getBatchableMesh(t);o.setTexture(t._texture),o.geometry=t._geometry,r.addToBatch(o,e)}else r.break(e),e.add(t)}updateRenderable(t){if(t.batched){let e=this._gpuBatchableMeshHash[t.uid];e.setTexture(t._texture),e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;let e=this._gpuBatchableMeshHash[t.uid];e&&(et.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Xr(t.groupBlendMode,t.texture._source);let e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Pr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){return this._meshDataHash[t.uid]={batched:t.batched,indexSize:t._geometry.indices?.length,vertexSize:t._geometry.positions?.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){let e=et.get(bi);return e.renderable=t,e.setTexture(t._texture),e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(let t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&et.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}};On.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"mesh"}});var Hf=m(()=>{R();mv();D.add(On)});var Hl,gv=m(()=>{"use strict";Hl=class{execute(t,e){let r=t.state,s=t.renderer,o=e.shader||t.defaultShader;o.resources.uTexture=e.texture._source,o.resources.uniforms=t.localUniforms;let n=s.gl,a=t.getBuffers(e);s.shader.bind(o),s.state.set(r),s.geometry.bind(a.geometry,o.glProgram);let l=a.geometry.indexBuffer.data.BYTES_PER_ELEMENT===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;n.drawElements(n.TRIANGLES,e.particleChildren.length*6,l,0)}}});function Vf(i,t=null){let e=i*6;if(e>65535?t||(t=new Uint32Array(e)):t||(t=new Uint16Array(e)),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let r=0,s=0;r<e;r+=6,s+=4)t[r+0]=s+0,t[r+1]=s+1,t[r+2]=s+2,t[r+3]=s+0,t[r+4]=s+2,t[r+5]=s+3;return t}var xv=m(()=>{"use strict"});function yv(i){return{dynamicUpdate:_v(i,!0),staticUpdate:_v(i,!1)}}function _v(i,t){let e=[];e.push(`
254
254
 
255
255
  var index = 0;
256
256
 
@@ -258,13 +258,13 @@ ${s.join(`
258
258
  {
259
259
  const p = ps[i];
260
260
 
261
- `);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=Zt(n.format);r+=a.stride/4}e.push(`
261
+ `);let r=0;for(let o in i){let n=i[o];if(t!==n.dynamic)continue;e.push(`offset = index + ${r}`),e.push(n.code);let a=Ge(n.format);r+=a.stride/4}e.push(`
262
262
  index += stride * 4;
263
263
  }
264
264
  `),e.unshift(`
265
265
  var stride = ${r};
266
266
  `);let s=e.join(`
267
- `);return new Function("ps","f32v","u32v",s)}var qg=p(()=>{Br()});function fw(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var Zn,Zg=p(()=>{rr();je();si();Br();Il();$g();qg();Zn=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let h in r){let u=r[h],d=Zt(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Ee(e*4*s),this.dynamicAttributeBuffer=new Ee(e*4*o),this.indexBuffer=vh(e);let n=new ce,a=0,c=0;this._staticBuffer=new gt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:j.VERTEX|j.COPY_DST}),this._dynamicBuffer=new gt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:j.VERTEX|j.COPY_DST});for(let h in r){let u=r[h],d=Zt(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:c*4,format:u.format}),c+=d.size)}n.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=fw(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return Kg(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Ee(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Ee(this._size*this._dynamicStride*4*4),this.indexBuffer=vh(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var Qg,Jg=p(()=>{Qg=`varying vec2 vUV;
267
+ `);return new Function("ps","f32v","u32v",s)}var bv=m(()=>{ji()});function _M(i){let t=[];for(let e in i){let r=i[e];t.push(e,r.code,r.dynamic?"d":"s")}return t.join("_")}var Vl,vv=m(()=>{gi();jr();Ns();ji();tf();xv();bv();Vl=class{constructor(t){this._size=0,this._generateParticleUpdateCache={};let e=this._size=t.size??1e3,r=t.properties,s=0,o=0;for(let c in r){let u=r[c],d=Ge(u.format);u.dynamic?o+=d.stride:s+=d.stride}this._dynamicStride=o/4,this._staticStride=s/4,this.staticAttributeBuffer=new Tr(e*4*s),this.dynamicAttributeBuffer=new Tr(e*4*o),this.indexBuffer=Vf(e);let n=new Je,a=0,h=0;this._staticBuffer=new kt({data:new Float32Array(1),label:"static-particle-buffer",shrinkToFit:!1,usage:ot.VERTEX|ot.COPY_DST}),this._dynamicBuffer=new kt({data:new Float32Array(1),label:"dynamic-particle-buffer",shrinkToFit:!1,usage:ot.VERTEX|ot.COPY_DST});for(let c in r){let u=r[c],d=Ge(u.format);u.dynamic?(n.addAttribute(u.attributeName,{buffer:this._dynamicBuffer,stride:this._dynamicStride*4,offset:a*4,format:u.format}),a+=d.size):(n.addAttribute(u.attributeName,{buffer:this._staticBuffer,stride:this._staticStride*4,offset:h*4,format:u.format}),h+=d.size)}n.addIndex(this.indexBuffer);let l=this.getParticleUpdate(r);this._dynamicUpload=l.dynamicUpdate,this._staticUpload=l.staticUpdate,this.geometry=n}getParticleUpdate(t){let e=_M(t);return this._generateParticleUpdateCache[e]?this._generateParticleUpdateCache[e]:(this._generateParticleUpdateCache[e]=this.generateParticleUpdate(t),this._generateParticleUpdateCache[e])}generateParticleUpdate(t){return yv(t)}update(t,e){t.length>this._size&&(e=!0,this._size=Math.max(t.length,this._size*1.5|0),this.staticAttributeBuffer=new Tr(this._size*this._staticStride*4*4),this.dynamicAttributeBuffer=new Tr(this._size*this._dynamicStride*4*4),this.indexBuffer=Vf(this._size),this.geometry.indexBuffer.setDataWithSize(this.indexBuffer,this.indexBuffer.byteLength,!0));let r=this.dynamicAttributeBuffer;if(this._dynamicUpload(t,r.float32View,r.uint32View),this._dynamicBuffer.setDataWithSize(this.dynamicAttributeBuffer.float32View,t.length*this._dynamicStride*4,!0),e){let s=this.staticAttributeBuffer;this._staticUpload(t,s.float32View,s.uint32View),this._staticBuffer.setDataWithSize(s.float32View,t.length*this._staticStride*4,!0)}}destroy(){this._staticBuffer.destroy(),this._dynamicBuffer.destroy(),this.geometry.destroy()}}});var Tv,Sv=m(()=>{Tv=`varying vec2 vUV;
268
268
  varying vec4 vColor;
269
269
 
270
270
  uniform sampler2D uTexture;
@@ -272,7 +272,7 @@ uniform sampler2D uTexture;
272
272
  void main(void){
273
273
  vec4 color = texture2D(uTexture, vUV) * vColor;
274
274
  gl_FragColor = color;
275
- }`});var tx,ex=p(()=>{tx=`attribute vec2 aVertex;
275
+ }`});var Av,Ev=m(()=>{Av=`attribute vec2 aVertex;
276
276
  attribute vec2 aUV;
277
277
  attribute vec4 aColor;
278
278
 
@@ -311,7 +311,7 @@ void main(void){
311
311
  vUV = aUV;
312
312
  vColor = vec4(aColor.rgb * aColor.a, aColor.a) * uColor;
313
313
  }
314
- `});var Th,rx=p(()=>{Th=`
314
+ `});var Wf,wv=m(()=>{Wf=`
315
315
  struct ParticleUniforms {
316
316
  uProjectionMatrix:mat3x3<f32>,
317
317
  uColor:vec4<f32>,
@@ -364,8 +364,8 @@ fn mainFragment(
364
364
  var sample = textureSample(uTexture, uSampler, uv) * color;
365
365
 
366
366
  return sample;
367
- }`});var Qn,ix=p(()=>{Mt();K();Mr();ni();xe();tt();Jc();Jg();ex();rx();Qn=class extends xt{constructor(){let t=le.from({vertex:tx,fragment:Qg}),e=he.from({fragment:{source:Th,entryPoint:"mainFragment"},vertex:{source:Th,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:M.WHITE.source,uSampler:new dn({}),uniforms:{uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new V(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var xi,Sh=p(()=>{K();Nt();vs();_e();gi();Zg();ix();xi=class{constructor(t,e){this.state=_t.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new st({uTranslationMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Qn,this.state=_t.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 Zn({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){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=Ve(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Re(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Gs,sx=p(()=>{P();Xg();Sh();Gs=class extends xi{constructor(t){super(t,new qn)}};Gs.extension={type:[x.WebGLPipes],name:"particle"}});var Jn,ox=p(()=>{"use strict";Jn=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Is,nx=p(()=>{P();ox();Sh();Is=class extends xi{constructor(t){super(t,new Jn)}};Is.extension={type:[x.WebGPUPipes],name:"particle"}});var wh=p(()=>{P();sx();nx();I.add(Gs);I.add(Is)});var Ge,ks=p(()=>{"use strict";Ge=class{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 Fs(i,t){let{texture:e,bounds:r}=i;En(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Eh=p(()=>{Tl()});var Us,ax=p(()=>{P();Ut();ks();Eh();Us=class{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(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Fs(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:W.get(Ge)};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.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Us.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"}});var Ph,Jt,_i=p(()=>{ct();os();Ph=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=D.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Ne(t),e=Ne(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},Jt=new Ph});function cx(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function lx(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function hx(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,c=0,l=e-1,h=r-1;for(;c<r&&cx(n,e,c);)++c;if(c===r)return z.EMPTY;for(;cx(n,e,h);)--h;for(;lx(n,e,a,c,h);)++a;for(;lx(n,e,l,c,h);)--l;return++l,++h,new z(a/t,c/t,(l-a)/t,(h-c)/t)}var ux=p(()=>{vt()});var dx,$e,ta=p(()=>{K();Rt();dx={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},$e=class{constructor(t,e){this.uid=X("fillPattern"),this.transform=new B,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=dx[e].addressModeU,t.source.style.addressModeV=dx[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var px=Rc((iF,fx)=>{fx.exports=mw;var Ah={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},pw=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function mw(i){var t=[];return i.replace(pw,function(e,r,s){var o=r.toLowerCase();for(s=xw(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Ah[o])return s.unshift(r),t.push(s);if(s.length<Ah[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Ah[o])))}}),t}var gw=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function xw(i){var t=i.match(gw);return t?t.map(Number):[]}});function gx(i,t){let e=(0,mx.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let c=e[a],l=c[0],h=c;switch(l){case"M":o=h[1],n=h[2],t.moveTo(o,n);break;case"m":o+=h[1],n+=h[2],t.moveTo(o,n);break;case"H":o=h[1],t.lineTo(o,n);break;case"h":o+=h[1],t.lineTo(o,n);break;case"V":n=h[1],t.lineTo(o,n);break;case"v":n+=h[1],t.lineTo(o,n);break;case"L":o=h[1],n=h[2],t.lineTo(o,n);break;case"l":o+=h[1],n+=h[2],t.lineTo(o,n);break;case"C":o=h[5],n=h[6],t.bezierCurveTo(h[1],h[2],h[3],h[4],o,n);break;case"c":t.bezierCurveTo(o+h[1],n+h[2],o+h[3],n+h[4],o+h[5],n+h[6]),o+=h[5],n+=h[6];break;case"S":o=h[3],n=h[4],t.bezierCurveToShort(h[1],h[2],o,n);break;case"s":t.bezierCurveToShort(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"Q":o=h[3],n=h[4],t.quadraticCurveTo(h[1],h[2],o,n);break;case"q":t.quadraticCurveTo(o+h[1],n+h[2],o+h[3],n+h[4]),o+=h[3],n+=h[4];break;case"T":o=h[1],n=h[2],t.quadraticCurveToShort(o,n);break;case"t":o+=h[1],n+=h[2],t.quadraticCurveToShort(o,n);break;case"A":o=h[6],n=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"a":o+=h[6],n+=h[7],t.arcToSvg(h[1],h[2],h[3],h[4],h[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:k(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var mx,xx=p(()=>{mx=Jo(px(),1);it()});var ea,_x=p(()=>{vt();ea=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,c=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+c&&l>a-(r-c)}getBounds(t){return t||(t=new z),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var ra,yx=p(()=>{vt();ra=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),c=r-a,l=o-c,h=n-c,u=o+a,d=n+a,f=t-this.x,m=e-this.y,g=f*f/(l*l)+m*m/(h*h),_=f*f/(u*u)+m*m/(d*d);return g>1&&_<=1}getBounds(t){return t||(t=new z),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function bx(i,t,e,r,s,o){let n=i-e,a=t-r,c=s-e,l=o-r,h=n*c+a*l,u=c*c+l*l,d=-1;u!==0&&(d=h/u);let f,m;d<0?(f=e,m=r):d>1?(f=s,m=o):(f=e+d*c,m=r+d*l);let g=i-f,_=t-m;return g*g+_*_}var vx=p(()=>{"use strict"});var _w,yw,yi,Tx=p(()=>{vx();vt();yi=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],c=e[(s+3)%r];t+=(a-o)*(c+n)}return t<0}containsPolygon(t){let e=this.getBounds(_w),r=t.getBounds(yw);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],c=this.points[o*2+1],l=this.points[n*2],h=this.points[n*2+1];c>e!=h>e&&t<(l-a)*((e-c)/(h-c))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:c}=this,l=c.length-(this.closePath?0:2);for(let h=0;h<l;h+=2){let u=c[h],d=c[h+1],f=c[(h+2)%c.length],m=c[(h+3)%c.length],g=bx(t,e,u,d,f,m),_=Math.sign((f-u)*(e-d)-(m-d)*(t-u));if(g<=(_<0?a:n))return!0}return!1}getBounds(t){t||(t=new z);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,c=e.length;a<c;a+=2){let l=e[a],h=e[a+1];r=l<r?l:r,s=l>s?l:s,o=h<o?h:o,n=h>n?h:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var ia,sa,Sx=p(()=>{vt();ia=(i,t,e,r,s,o,n)=>{let a=i-e,c=t-r,l=Math.sqrt(a*a+c*c);return l>=s-o&&l<=s+n},sa=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new z),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:c,radius:l}=this,h=r*(1-s),u=r-h,d=o+l,f=n+l,m=a-l*2,g=c-l*2,_=o+a,b=n+c;return(t>=o-h&&t<=o+u||t>=_-u&&t<=_+h)&&e>=f&&e<=f+g||(e>=n-h&&e<=n+u||e>=b-u&&e<=b+h)&&t>=d&&t<=d+m?!0:t<d&&e<f&&ia(t,e,d,f,l,u,h)||t>_-l&&e<f&&ia(t,e,_-l,f,l,u,h)||t>_-l&&e>b-l&&ia(t,e,_-l,b-l,l,u,h)||t<d&&e>b-l&&ia(t,e,d,b-l,l,u,h)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function na(i,t,e,r,s,o,n,a,c,l){let u=Math.min(.99,Math.max(0,l??mi.defaultOptions.bezierSmoothness)),d=(vw-u)/1;return d*=d,Tw(t,e,r,s,o,n,a,c,i,d),i}function Tw(i,t,e,r,s,o,n,a,c,l){Mh(i,t,e,r,s,o,n,a,c,l,0),c.push(n,a)}function Mh(i,t,e,r,s,o,n,a,c,l,h){if(h>bw)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,m=(e+s)/2,g=(r+o)/2,_=(s+n)/2,b=(o+a)/2,y=(d+m)/2,v=(f+g)/2,S=(m+_)/2,E=(g+b)/2,T=(y+S)/2,w=(v+E)/2;if(h>0){let A=n-i,R=a-t,C=Math.abs((e-n)*R-(r-a)*A),G=Math.abs((s-n)*R-(o-a)*A),L,Y;if(C>oa&&G>oa){if((C+G)*(C+G)<=l*(A*A+R*R)){if(bi<Ch){c.push(T,w);return}let mt=Math.atan2(o-r,s-e);if(L=Math.abs(mt-Math.atan2(r-t,e-i)),Y=Math.abs(Math.atan2(a-o,n-s)-mt),L>=u&&(L=2*u-L),Y>=u&&(Y=2*u-Y),L+Y<bi){c.push(T,w);return}if(kr!==0){if(L>kr){c.push(e,r);return}if(Y>kr){c.push(s,o);return}}}}else if(C>oa){if(C*C<=l*(A*A+R*R)){if(bi<Ch){c.push(T,w);return}if(L=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),L>=u&&(L=2*u-L),L<bi){c.push(e,r),c.push(s,o);return}if(kr!==0&&L>kr){c.push(e,r);return}}}else if(G>oa){if(G*G<=l*(A*A+R*R)){if(bi<Ch){c.push(T,w);return}if(L=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),L>=u&&(L=2*u-L),L<bi){c.push(e,r),c.push(s,o);return}if(kr!==0&&L>kr){c.push(s,o);return}}}else if(A=T-(i+n)/2,R=w-(t+a)/2,A*A+R*R<=l){c.push(T,w);return}}Mh(i,t,d,f,y,v,T,w,c,l,h+1),Mh(T,w,S,E,_,b,n,a,c,l,h+1)}var bw,oa,vw,Ch,bi,kr,Bh=p(()=>{Yn();bw=8,oa=11920929e-14,vw=1,Ch=.01,bi=0,kr=0});function Ex(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??mi.defaultOptions.bezierSmoothness)),h=(Ew-l)/1;return h*=h,Aw(t,e,r,s,o,n,i,h),i}function Aw(i,t,e,r,s,o,n,a){Rh(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Rh(i,t,e,r,s,o,n,a,c){if(c>Sw)return;let l=Math.PI,h=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,m=(h+d)/2,g=(u+f)/2,_=o-t,b=n-e,y=Math.abs((r-o)*b-(s-n)*_);if(y>ww){if(y*y<=a*(_*_+b*b)){if(wx<Pw){i.push(m,g);return}let v=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(v>=l&&(v=2*l-v),v<wx){i.push(m,g);return}}}else if(_=m-(t+o)/2,b=g-(e+n)/2,_*_+b*b<=a){i.push(m,g);return}Rh(i,t,e,h,u,m,g,a,c+1),Rh(i,m,g,d,f,o,n,a,c+1)}var Sw,ww,Ew,Pw,wx,Px=p(()=>{Yn();Sw=8,ww=11920929e-14,Ew=1,Pw=.01,wx=0});function aa(i,t,e,r,s,o,n,a){let c=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(c=2*Math.PI-c),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(c/Math.PI)))),a=Math.max(a,3);let l=c/a,h=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(h),f=Math.sin(h),m=t+d*r,g=e+f*r;i.push(m,g),h+=l}}var Gh=p(()=>{"use strict"});function Ax(i,t,e,r,s,o){let n=i[i.length-2],c=i[i.length-1]-e,l=n-t,h=s-e,u=r-t,d=Math.abs(c*u-l*h);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=c*c+l*l,m=h*h+u*u,g=c*h+l*u,_=o*Math.sqrt(f)/d,b=o*Math.sqrt(m)/d,y=_*g/f,v=b*g/m,S=_*u+b*l,E=_*h+b*c,T=l*(b+y),w=c*(b+y),A=u*(_+v),R=h*(_+v),C=Math.atan2(w-E,T-S),G=Math.atan2(R-E,A-S);aa(i,S+t,E+e,o,C,G,l*h>u*c)}var Cx=p(()=>{Gh()});function Cw(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function Bx(i,t,e,r,s,o,n,a=0,c=0,l=0){if(o===0||n===0)return;let h=Math.sin(a*Ds/360),u=Math.cos(a*Ds/360),d=u*(t-r)/2+h*(e-s)/2,f=-h*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let m=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);m>1&&(o*=Math.sqrt(m),n*=Math.sqrt(m)),Mw(t,e,r,s,o,n,c,l,h,u,d,f,Ih);let{ang1:g,ang2:_}=Ih,{centerX:b,centerY:y}=Ih,v=Math.abs(_)/(Ds/4);Math.abs(1-v)<1e-7&&(v=1);let S=Math.max(Math.ceil(v),1);_/=S;let E=i[i.length-2],T=i[i.length-1],w={x:0,y:0};for(let A=0;A<S;A++){let R=Cw(g,_),{x:C,y:G}=kh(R[0],o,n,u,h,b,y,w),{x:L,y:Y}=kh(R[1],o,n,u,h,b,y,w),{x:mt,y:Xt}=kh(R[2],o,n,u,h,b,y,w);na(i,E,T,C,G,L,Y,mt,Xt),E=mt,T=Xt,g+=_}}var Ds,Ih,kh,Mx,Mw,Rx=p(()=>{Bh();Ds=Math.PI*2,Ih={centerX:0,centerY:0,ang1:0,ang2:0},kh=({x:i,y:t},e,r,s,o,n,a,c)=>{i*=e,t*=r;let l=s*i-o*t,h=o*i+s*t;return c.x=l+n,c.y=h+a,c};Mx=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},Mw=(i,t,e,r,s,o,n,a,c,l,h,u,d)=>{let f=Math.pow(s,2),m=Math.pow(o,2),g=Math.pow(h,2),_=Math.pow(u,2),b=f*m-f*_-m*g;b<0&&(b=0),b/=f*_+m*g,b=Math.sqrt(b)*(n===a?-1:1);let y=b*s/o*u,v=b*-o/s*h,S=l*y-c*v+(i+e)/2,E=c*y+l*v+(t+r)/2,T=(h-y)/s,w=(u-v)/o,A=(-h-y)/s,R=(-u-v)/o,C=Mx(1,0,T,w),G=Mx(T,w,A,R);a===0&&G>0&&(G-=Ds),a===1&&G<0&&(G+=Ds),d.centerX=S,d.centerY=E,d.ang1=C,d.ang2=G}});function Gx(i,t,e){let r=(n,a)=>{let c=a.x-n.x,l=a.y-n.y,h=Math.sqrt(c*c+l*l),u=c/h,d=l/h;return{len:h,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],c=a.radius??e;if(c<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],h=r(a,o),u=r(a,l);if(h.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(h.nx*u.ny-h.ny*u.nx),f=1,m=!1;h.nx*u.nx-h.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,m=!0):d>0&&(f=-1,m=!0);let g=d/2,_,b=Math.abs(Math.cos(g)*c/Math.sin(g));b>Math.min(h.len/2,u.len/2)?(b=Math.min(h.len/2,u.len/2),_=Math.abs(b*Math.sin(g)/Math.cos(g))):_=c;let y=a.x+u.nx*b+-u.ny*_*f,v=a.y+u.ny*b+u.nx*_*f,S=Math.atan2(h.ny,h.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(y+Math.cos(S)*_,v+Math.sin(S)*_),i.arc(y,v,_,S,E,m),o=a}}function Ix(i,t,e,r){let s=(a,c)=>Math.sqrt((a.x-c.x)**2+(a.y-c.y)**2),o=(a,c,l)=>({x:a.x+(c.x-a.x)*l,y:a.y+(c.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let c=t[(a+1)%n],l=c.radius??e;if(l<=0){a===0?i.moveTo(c.x,c.y):i.lineTo(c.x,c.y);continue}let h=t[a],u=t[(a+2)%n],d=s(h,c),f;if(d<1e-4)f=c;else{let _=Math.min(d/2,l);f=o(c,h,_/d)}let m=s(u,c),g;if(m<1e-4)g=c;else{let _=Math.min(m/2,l);g=o(c,u,_/m)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(c.x,c.y,g.x,g.y,r)}}var kx=p(()=>{"use strict"});var Bw,ca,Fx=p(()=>{_x();yx();Tx();vt();Sx();$t();Bh();Px();Gh();Cx();Rx();kx();Bw=new z,ca=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new rt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return aa(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Ax(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let c=this._currentPoly.points;return Bx(c,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let c=this._currentPoly;return na(this._currentPoly.points,c.lastX,c.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return Ex(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let c=a.shape,l=o?.shape;l&&l.containsPolygon(c)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new z(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new ea(t,e,r),s),this}poly(t,e,r){let s=new yi(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,c=Math.PI*2/s,l=[];for(let h=0;h<s;h++){let u=a-h*c;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let c=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,c);let l=-1*Math.PI/2+n,h=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*h+l,m=t+r*Math.cos(f),g=e+r*Math.sin(f),_=f+Math.PI+u,b=f-Math.PI-u,y=m+o*Math.cos(_),v=g+o*Math.sin(_),S=m+o*Math.cos(b),E=g+o*Math.sin(b);d===0?this.moveTo(y,v):this.lineTo(y,v),this.quadraticCurveTo(m,g,S,E,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?Ix(this,t,e,s):Gx(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),c=t+r,l=e+s,h=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+h,e+h,t+u,e,u).lineTo(c-u,e).arcTo(c-h,e+h,c,e+u,u).lineTo(c,l-u).arcTo(c-h,l-h,t+r-u,l,u).lineTo(t+u,l).arcTo(t+h,l-h,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),c=t+r,l=e+s,h=[t+a,e,c-a,e,c,e+a,c,l-a,c-a,l,t+a,l,t,l-a,t,e+a];for(let u=h.length-1;u>=2;u-=2)h[u]===h[u-2]&&h[u-1]===h[u-3]&&h.splice(u-1,2);return this.poly(h,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new ra(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new sa(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new yi,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new yi,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(Bw);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function Os(i,t){return i?i.prepend(t):t.clone()}var ar,Fh=p(()=>{ne();Rt();it();xx();Fx();ar=class i{constructor(t,e=!1){this.instructions=[],this.uid=X("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?gx(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new ca(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint($.shared),c=0,l=0;if(!n||n.action!=="bezierCurveTo")c=a.x,l=a.y;else{c=n.data[2],l=n.data[3];let h=a.x,u=a.y;c=h+(h-c),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[c,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint($.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let c=o.x,l=o.y;n=c+(c-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let c=-1*Math.PI/2+n,l=r*2,h=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,m=d*h+c;u.push(t+f*Math.cos(m),e+f*Math.sin(m))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,c=0,l=0,h=0,u=0,d=0,f=0,m=0,g=0;for(let _=0;_<this.instructions.length;_++){let b=this.instructions[_],y=b.data;switch(b.action){case"moveTo":case"lineTo":c=y[0],l=y[1],y[0]=e*c+s*l+n,y[1]=r*c+o*l+a;break;case"bezierCurveTo":h=y[0],u=y[1],d=y[2],f=y[3],c=y[4],l=y[5],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*d+s*f+n,y[3]=r*d+o*f+a,y[4]=e*c+s*l+n,y[5]=r*c+o*l+a;break;case"quadraticCurveTo":h=y[0],u=y[1],c=y[2],l=y[3],y[0]=e*h+s*u+n,y[1]=r*h+o*u+a,y[2]=e*c+s*l+n,y[3]=r*c+o*l+a;break;case"arcToSvg":c=y[5],l=y[6],m=y[0],g=y[1],y[0]=e*m+s*g,y[1]=r*m+o*g,y[5]=e*c+s*l+n,y[6]=r*c+o*l+a;break;case"circle":y[4]=Os(y[3],t);break;case"rect":y[4]=Os(y[4],t);break;case"ellipse":y[8]=Os(y[8],t);break;case"roundRect":y[5]=Os(y[5],t);break;case"addPath":y[0].transform(t);break;case"poly":y[2]=Os(y[2],t);break;default:k("unknown transform action",b.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function ut(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var Uh=p(()=>{"use strict"});function Ux(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=Rw(n);break;case"radialgradient":t.defs[n.id]=Gw(n);break;default:break}}}}function Rw(i){let t=ut(i,"x1",0),e=ut(i,"y1",0),r=ut(i,"x2",1),s=ut(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Qt(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let c=i.children[a],l=ut(c,"offset",0),h=V.shared.setValue(c.getAttribute("stop-color")).toNumber();n.addColorStop(l,h)}return n}function Gw(i){return k("[SVG Parser] Radial gradients are not yet supported"),new Qt(0,0,1,0)}var Dx=p(()=>{Mt();it();pi();Uh()});function Dh(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var Ox=p(()=>{"use strict"});function Oh(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in Lx){let a=i.getAttribute(n);a&&Nx(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let c=n[a].trim(),[l,h]=c.split(":");Lx[l]&&Nx(t,o,l,h.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function Nx(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=Dh(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=V.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=Dh(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=V.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var Lx,Hx=p(()=>{Mt();Ox();Lx={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function Wx(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new ar};Ux(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=Oh(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&zx(a,e,s,o)}return t}function zx(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=Oh(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let c,l,h,u,d,f,m,g,_,b,y,v,S,E,T,w,A;switch(i.nodeName.toLowerCase()){case"path":E=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&k("SVG Evenodd fill rule not supported, your svg may render incorrectly"),T=new ar(E,!0),t.context.path(T),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":m=ut(i,"cx",0),g=ut(i,"cy",0),_=ut(i,"r",0),t.context.ellipse(m,g,_,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":c=ut(i,"x",0),l=ut(i,"y",0),w=ut(i,"width",0),A=ut(i,"height",0),b=ut(i,"rx",0),y=ut(i,"ry",0),b||y?t.context.roundRect(c,l,w,A,b||y):t.context.rect(c,l,w,A),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":m=ut(i,"cx",0),g=ut(i,"cy",0),b=ut(i,"rx",0),y=ut(i,"ry",0),t.context.beginPath(),t.context.ellipse(m,g,b,y),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":h=ut(i,"x1",0),u=ut(i,"y1",0),d=ut(i,"x2",0),f=ut(i,"y2",0),t.context.beginPath(),t.context.moveTo(h,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":S=i.getAttribute("points"),v=S.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(v,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":S=i.getAttribute("points"),v=S.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(v,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{k(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let R=0;R<s.length;R++)zx(s[R],t,e,r)}var Vx=p(()=>{it();Fh();Dx();Uh();Hx()});function Iw(i){return V.isColorLike(i)}function jx(i){return i instanceof $e}function Xx(i){return i instanceof Qt}function kw(i){return i instanceof M}function Fw(i,t,e){let r=V.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=M.WHITE,{...e,...i}}function Uw(i,t,e){return i.texture=t,{...e,...i}}function $x(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function Yx(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function Dw(i,t){let e={...t,...i},r=V.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Ye(i,t){if(i==null)return null;let e={},r=i;return Iw(i)?Fw(e,i,t):kw(i)?Uw(e,i,t):jx(i)?$x(e,i,t):Xx(i)?Yx(e,i,t):r.fill&&jx(r.fill)?$x(r,r.fill,t):r.fill&&Xx(r.fill)?Yx(r,r.fill,t):Dw(r,t)}function vi(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...c}=t,l=Ye(i,c);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var Lh=p(()=>{Mt();tt();pi();ta()});var Ow,Kx,Nh,Ht,la=p(()=>{It();Mt();K();ne();tt();Rt();dt();$t();Fh();Vx();Lh();Ow=new $,Kx=new B,Nh=class Ie extends ot{constructor(){super(...arguments),this.uid=X("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new ar,this._transform=new B,this._fillStyle={...Ie.defaultFillStyle},this._strokeStyle={...Ie.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new rt,this._boundsDirty=!0}clone(){let t=new Ie;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Ye(t,Ie.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=vi(t,Ie.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Ye(t,Ie.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Ye(t,Ie.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ar,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(U(H,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Ye(t,Ie.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint($.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=vi(t,Ie.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,c.a*n+c.c*a+c.tx,c.b*n+c.d*a+c.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let c=this._transform;return this._activePath.bezierCurveTo(c.a*t+c.c*e+c.tx,c.b*t+c.d*e+c.ty,c.a*r+c.c*s+c.tx,c.b*r+c.d*s+c.ty,c.a*o+c.c*n+c.tx,c.b*o+c.d*n+c.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,Wx(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof B?(this._transform.append(t),this):(Kx.set(t,e,r,s,o,n),this._transform.append(Kx),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;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),c=o.path.bounds;t.addFrame(c.minX-a,c.minY-a,c.maxX+a,c.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let c=n.style,l=a.shapePath.shapePrimitives;for(let h=0;h<l.length;h++){let u=l[h].shape;if(!c||!u)continue;let d=l[h].transform,f=d?d.applyInverse(t,Ow):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let g=c;r=u.strokeContains(f.x,f.y,g.width,g.alignment)}let m=n.hole;if(m){let g=m.shapePath?.shapePrimitives;if(g)for(let _=0;_<g.length;_++)g[_].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};Nh.defaultFillStyle={color:16777215,alpha:1,texture:M.WHITE,matrix:null,fill:null,textureSpace:"local"};Nh.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:M.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Ht=Nh});function ha(i){let t=[],e=0;for(let r=0;r<qx.length;r++){let s=`_${qx[r]}`;t[e++]=i[s]}return e=Zx(i._fill,t,e),e=Lw(i._stroke,t,e),e=Nw(i.dropShadow,t,e),t.join("-")}function Zx(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function Lw(i,t,e){return i&&(e=Zx(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function Nw(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=V.shared.setValue(i.color).toNumber()),e}var qx,Hh=p(()=>{Mt();qx=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function Hw(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=St.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){U(H,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(V.isColorLike(e))r.color=e;else if(e instanceof Qt||e instanceof $e)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){U(H,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=St.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Qt({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>V.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var Wh,St,Fr=p(()=>{It();Mt();dt();pi();ta();la();Lh();Hh();Wh=class Ti extends ot{constructor(t={}){super(),Hw(t);let e={...Ti.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}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){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...Ti.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...Ti.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){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=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({...Ht.defaultFillStyle,...t},()=>{this._fill=Ye({...this._originalFill},Ht.defaultFillStyle)})),this._fill=Ye(t===0?"black":t,Ht.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ht.defaultStrokeStyle,...t},()=>{this._stroke=vi({...this._originalStroke},Ht.defaultStrokeStyle)})),this._stroke=vi(t,Ht.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ha(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=Ti.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Ti({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...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){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(V.isColorLike(t)||t instanceof Qt||t instanceof $e)}};Wh.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};Wh.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};St=Wh});function ua(i,t,e,r){let s=Ww;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=ft.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var Ww,zh=p(()=>{qe();$t();Ww=new rt});function Ur(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!zw.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var zw,da=p(()=>{"use strict";zw=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var Vh,ye,At,Ls=p(()=>{ct();da();Vh={willReadFrequently:!0},ye=class O{static get experimentalLetterSpacingSupported(){let t=O._experimentalLetterSpacingSupported;if(t!==void 0){let e=D.get().getCanvasRenderingContext2D().prototype;t=O._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,c,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=c,this.fontProperties=l}static measureText(t=" ",e,r=O._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(O._measurementCache[o])return O._measurementCache[o];let n=Ur(e),a=O.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let c=O.__context;c.font=n;let h=(s?O._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(h.length),d=0;for(let y=0;y<h.length;y++){let v=O._measureText(h[y],e.letterSpacing,c);u[y]=v,d=Math.max(d,v)}let f=e._stroke?.width||0,m=d+f;e.dropShadow&&(m+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,_=Math.max(g,a.fontSize+f)+(h.length-1)*(g+e.leading);return e.dropShadow&&(_+=e.dropShadow.distance),new O(t,e,m,_,h,u,g+e.leading,d,a)}static _measureText(t,e,r){let s=!1;O.experimentalLetterSpacingSupported&&(O.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let h=(O.graphemeSegmenter(t).length-1)*e;n+=h,l+=h}return Math.max(n,l)}static _wordWrap(t,e,r=O._canvas){let s=r.getContext("2d",Vh),o=0,n="",a="",c=Object.create(null),{letterSpacing:l,whiteSpace:h}=e,u=O._collapseSpaces(h),d=O._collapseNewlines(h),f=!u,m=e.wordWrapWidth+l,g=O._tokenize(t);for(let _=0;_<g.length;_++){let b=g[_];if(O._isNewline(b)){if(!d){a+=O._addLine(n),f=!u,n="",o=0;continue}b=" "}if(u){let v=O.isBreakingSpace(b),S=O.isBreakingSpace(n[n.length-1]);if(v&&S)continue}let y=O._getFromCache(b,l,c,s);if(y>m)if(n!==""&&(a+=O._addLine(n),n="",o=0),O.canBreakWords(b,e.breakWords)){let v=O.wordWrapSplit(b);for(let S=0;S<v.length;S++){let E=v[S],T=E,w=1;for(;v[S+w];){let R=v[S+w];if(!O.canBreakChars(T,R,b,S,e.breakWords))E+=R;else break;T=R,w++}S+=w-1;let A=O._getFromCache(E,l,c,s);A+o>m&&(a+=O._addLine(n),f=!1,n="",o=0),n+=E,o+=A}}else{n.length>0&&(a+=O._addLine(n),n="",o=0);let v=_===g.length-1;a+=O._addLine(b,!v),f=!1,n="",o=0}else y+o>m&&(f=!1,a+=O._addLine(n),n="",o=0),(n.length>0||!O.isBreakingSpace(b)||f)&&(n+=b,o+=y)}return a+=O._addLine(n,!1),a}static _addLine(t,e=!0){return t=O._trimRight(t),t=e?`${t}
368
- `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=O._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!O.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:O._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:O._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(O.isBreakingSpace(o,n)||O._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return O.graphemeSegmenter(t)}static measureFont(t){if(O._fonts[t])return O._fonts[t];let e=O._context;e.font=t;let r=e.measureText(O.METRICS_STRING+O.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return O._fonts[t]=s,s}static clearMetrics(t=""){t?delete O._fonts[t]:O._fonts={}}static get _canvas(){if(!O.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",Vh)?.measureText)return O.__canvas=e,e;t=D.get().createCanvas()}catch{t=D.get().createCanvas()}t.width=t.height=10,O.__canvas=t}return O.__canvas}static get _context(){return O.__context||(O.__context=O._canvas.getContext("2d",Vh)),O.__context}};ye.METRICS_STRING="|\xC9q\xC5";ye.BASELINE_SYMBOL="M";ye.BASELINE_MULTIPLIER=1.4;ye.HEIGHT_MULTIPLIER=2;ye.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();ye.experimentalLetterSpacing=!1;ye._fonts={};ye._newlines=[10,13];ye._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];ye._measurementCache={};At=ye});function Si(i,t,e,r=0){if(i.texture===M.WHITE&&!i.fill)return V.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof $e){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Qt){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,c=1;n&&e&&(a=e.width+r,c=e.height+r);let l,h=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*c,d.x*a,d.y*c),h=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:m}=s;l=t.createRadialGradient(u.x*a,u.y*c,d*a,f.x*a,f.y*c,m*a)}if(h&&n&&e){let u=e.lineHeight/c;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/c;s.colorStops.forEach(m=>{let g=f+m.offset*u;l.addColorStop(Math.floor(g*Qx)/Qx,V.shared.setValue(m.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,V.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(B.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return k("FillStyle not recognised",i),"red"}var Qx,jh=p(()=>{Mt();K();tt();it();pi();ta();Qx=1e5});var Ns,Jx=p(()=>{Mt();P();os();_i();qe();ux();dt();Fr();zh();Ls();da();jh();Ns=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=At.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Ne(o),n=Ne(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(U("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof St||(t.style=new St(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),Jt.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=At.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),c=Jt.getOptimalCanvasAndContext(n,a),{canvas:l}=c;this.renderTextToCanvas(e,r,s,c);let h=ua(l,n,a,s);if(r.trim){let u=hx(l,s);h.frame.copyFrom(u),h.updateUvs()}return{texture:h,canvasAndContext:c}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",ft.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(Jt.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=Ur(e),c=At.measureText(t||" ",e),l=c.lines,h=c.lineHeight,u=c.lineWidths,d=c.maxLineWidth,f=c.fontProperties,m=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let y=e._stroke;n.lineWidth=y.width,n.miterLimit=y.miterLimit,n.lineJoin=y.join,n.lineCap=y.cap}n.font=a;let g,_,b=e.dropShadow?2:1;for(let y=0;y<b;++y){let v=e.dropShadow&&y===0,S=v?Math.ceil(Math.max(1,m)+e.padding*2):0,E=S*r;if(v){n.fillStyle="black",n.strokeStyle="black";let A=e.dropShadow,R=A.color,C=A.alpha;n.shadowColor=V.shared.setValue(R).setAlpha(C).toRgbaString();let G=A.blur*r,L=A.distance*r;n.shadowBlur=G,n.shadowOffsetX=Math.cos(A.angle)*L,n.shadowOffsetY=Math.sin(A.angle)*L+E}else{if(n.fillStyle=e._fill?Si(e._fill,n,c):null,e._stroke?.width){let A=e._stroke.width*e._stroke.alignment;n.strokeStyle=Si(e._stroke,n,c,A)}n.shadowColor="black"}let T=(h-f.fontSize)/2;h-f.fontSize<0&&(T=0);let w=e._stroke?.width??0;for(let A=0;A<l.length;A++)g=w/2,_=w/2+A*h+f.ascent+T,e.align==="right"?g+=d-u[A]:e.align==="center"&&(g+=(d-u[A])/2),e._stroke?.width&&this._drawLetterSpacing(l[A],e,s,g+e.padding,_+e.padding-S,!0),e._fill!==void 0&&this._drawLetterSpacing(l[A],e,s,g+e.padding,_+e.padding-S)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,c=e.letterSpacing,l=!1;if(At.experimentalLetterSpacingSupported&&(At.experimentalLetterSpacing?(a.letterSpacing=`${c}px`,a.textLetterSpacing=`${c}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),c===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let h=s,u=At.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let m=0;m<u.length;++m){let g=u[m];n?a.strokeText(g,h,o):a.fillText(g,h,o);let _="";for(let b=m+1;b<u.length;++b)_+=u[b];f=a.measureText(_).width,h+=d-f+c,d=f}}destroy(){this._activeTextures=null}};Ns.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"canvasText"}});var Xh=p(()=>{P();ax();Jx();I.add(Ns);I.add(Us)});var Wt,$h=p(()=>{dt();Tn();la();Wt=class i extends Je{constructor(t){t instanceof Ht&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Ht,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}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):(t===!0||t?.context===!0)&&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 i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){U(H,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){U(H,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){U(H,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ht.defaultStrokeStyle.width||t.color!==Ht.defaultStrokeStyle.color||t.alpha!==Ht.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return U(H,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return U(H,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return U(H,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return U(H,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return U(H,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return U(H,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var t_,e_,r_=p(()=>{"use strict";t_={name:"local-uniform-msdf-bit",vertex:{header:`
367
+ }`});var Wl,Cv=m(()=>{le();dt();Xi();Ls();dr();xt();yd();Sv();Ev();wv();Wl=class extends Ot{constructor(){let t=tr.from({vertex:Av,fragment:Tv}),e=er.from({fragment:{source:Wf,entryPoint:"mainFragment"},vertex:{source:Wf,entryPoint:"mainVertex"}});super({glProgram:t,gpuProgram:e,resources:{uTexture:I.WHITE.source,uSampler:new rl({}),uniforms:{uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new it(16777215),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}}})}}});var Zs,zf=m(()=>{dt();Ae();Cn();fr();Ks();vv();Cv();Zs=class{constructor(t,e){this.state=Lt.for2d(),this._gpuBufferHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.localUniforms=new Tt({uTranslationMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array(4),type:"vec4<f32>"},uRound:{value:1,type:"f32"},uResolution:{value:[0,0],type:"vec2<f32>"}}),this.renderer=t,this.adaptor=e,this.defaultShader=new Wl,this.state=Lt.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 Vl({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){let e=t.particleChildren;if(e.length===0)return;let r=this.renderer,s=this.getBuffers(t);t.texture||(t.texture=e[0].texture);let o=this.state;s.update(e,t._childrenDirty),t._childrenDirty=!1,o.blendMode=Xr(t.blendMode,t.texture._source);let n=this.localUniforms.uniforms,a=n.uTranslationMatrix;t.worldTransform.copyTo(a),a.prepend(r.globalUniforms.globalUniformData.projectionMatrix),n.uResolution=r.globalUniforms.globalUniformData.resolution,n.uRound=r._roundPixels|t._roundPixels,Pr(t.groupColorAlpha,n.uColor,0),this.adaptor.execute(this,t)}destroy(){this.defaultShader&&(this.defaultShader.destroy(),this.defaultShader=null)}}});var Nn,Pv=m(()=>{R();gv();zf();Nn=class extends Zs{constructor(t){super(t,new Hl)}};Nn.extension={type:[y.WebGLPipes],name:"particle"}});var zl,Rv=m(()=>{"use strict";zl=class{execute(t,e){let r=t.renderer,s=e.shader||t.defaultShader;s.groups[0]=r.renderPipes.uniformBatch.getUniformBindGroup(t.localUniforms,!0),s.groups[1]=r.texture.getTextureBindGroup(e.texture);let o=t.state,n=t.getBuffers(e);r.encoder.draw({geometry:n.geometry,shader:e.shader||t.defaultShader,state:o,size:e.particleChildren.length*6})}}});var Dn,Mv=m(()=>{R();Rv();zf();Dn=class extends Zs{constructor(t){super(t,new zl)}};Dn.extension={type:[y.WebGPUPipes],name:"particle"}});var $f=m(()=>{R();Pv();Mv();D.add(Nn);D.add(Dn)});var Rr,Ln=m(()=>{"use strict";Rr=class{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 Hn(i,t){let{texture:e,bounds:r}=i;ml(r,t._anchor,e);let s=t._style.padding;r.minX-=s,r.minY-=s,r.maxX-=s,r.maxY-=s}var Xf=m(()=>{Wd()});var Vn,Bv=m(()=>{R();ve();Ln();Xf();Vn=class{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(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1,Hn(s,t)}_updateGpuText(t){let e=this._getGpuText(t),r=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=r.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),r.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:null,currentKey:"--",batchableSprite:et.get(Rr)};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.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};Vn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"text"}});var jf,ke,Qs=m(()=>{wt();dn();jf=class{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){let r=j.get().createCanvas();r.width=t,r.height=e;let s=r.getContext("2d");return{canvas:r,context:s}}getOptimalCanvasAndContext(t,e,r=1){t=Math.ceil(t*r-1e-6),e=Math.ceil(e*r-1e-6),t=Vr(t),e=Vr(e);let s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let o=this._canvasPool[s].pop();return o||(o=this._createCanvasAndContext(t,e)),o}returnCanvasAndContext(t){let e=t.canvas,{width:r,height:s}=e,o=(r<<17)+(s<<1);t.context.clearRect(0,0,r,s),this._canvasPool[o].push(t)}clear(){this._canvasPool={}}},ke=new jf});function Iv(i,t,e){for(let r=0,s=4*e*t;r<t;++r,s+=4)if(i[s+3]!==0)return!1;return!0}function Fv(i,t,e,r,s){let o=4*t;for(let n=r,a=r*o+4*e;n<=s;++n,a+=o)if(i[a+3]!==0)return!1;return!0}function Gv(i,t=1){let{width:e,height:r}=i,s=i.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");let n=s.getImageData(0,0,e,r).data,a=0,h=0,l=e-1,c=r-1;for(;h<r&&Iv(n,e,h);)++h;if(h===r)return rt.EMPTY;for(;Iv(n,e,c);)--c;for(;Fv(n,e,a,h,c);)++a;for(;Fv(n,e,l,h,c);)--l;return++l,++c,new rt(a/t,h/t,(l-a)/t,(c-h)/t)}var Uv=m(()=>{Yt()});var kv,qr,$l=m(()=>{dt();ue();kv={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},qr=class{constructor(t,e){this.uid=nt("fillPattern"),this.transform=new U,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=kv[e].addressModeU,t.source.style.addressModeV=kv[e].addressModeV)}setTransform(t){let e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}});var Nv=Q((mW,Ov)=>{Ov.exports=bM;var Yf={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},yM=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function bM(i){var t=[];return i.replace(yM,function(e,r,s){var o=r.toLowerCase();for(s=TM(s),o=="m"&&s.length>2&&(t.push([r].concat(s.splice(0,2))),o="l",r=r=="m"?"l":"L");;){if(s.length==Yf[o])return s.unshift(r),t.push(s);if(s.length<Yf[o])throw new Error("malformed path data");t.push([r].concat(s.splice(0,Yf[o])))}}),t}var vM=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function TM(i){var t=i.match(vM);return t?t.map(Number):[]}});function Lv(i,t){let e=(0,Dv.default)(i),r=[],s=null,o=0,n=0;for(let a=0;a<e.length;a++){let h=e[a],l=h[0],c=h;switch(l){case"M":o=c[1],n=c[2],t.moveTo(o,n);break;case"m":o+=c[1],n+=c[2],t.moveTo(o,n);break;case"H":o=c[1],t.lineTo(o,n);break;case"h":o+=c[1],t.lineTo(o,n);break;case"V":n=c[1],t.lineTo(o,n);break;case"v":n+=c[1],t.lineTo(o,n);break;case"L":o=c[1],n=c[2],t.lineTo(o,n);break;case"l":o+=c[1],n+=c[2],t.lineTo(o,n);break;case"C":o=c[5],n=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],o,n);break;case"c":t.bezierCurveTo(o+c[1],n+c[2],o+c[3],n+c[4],o+c[5],n+c[6]),o+=c[5],n+=c[6];break;case"S":o=c[3],n=c[4],t.bezierCurveToShort(c[1],c[2],o,n);break;case"s":t.bezierCurveToShort(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"Q":o=c[3],n=c[4],t.quadraticCurveTo(c[1],c[2],o,n);break;case"q":t.quadraticCurveTo(o+c[1],n+c[2],o+c[3],n+c[4]),o+=c[3],n+=c[4];break;case"T":o=c[1],n=c[2],t.quadraticCurveToShort(o,n);break;case"t":o+=c[1],n+=c[2],t.quadraticCurveToShort(o,n);break;case"A":o=c[6],n=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"a":o+=c[6],n+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],o,n);break;case"Z":case"z":t.closePath(),r.length>0&&(s=r.pop(),s?(o=s.startX,n=s.startY):(o=0,n=0)),s=null;break;default:H(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&s===null&&(s={startX:o,startY:n},r.push(s))}return t}var Dv,Hv=m(()=>{Dv=Fi(Nv(),1);vt()});var Xl,Vv=m(()=>{Yt();Xl=class i{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}strokeContains(t,e,r,s=.5){if(this.radius===0)return!1;let o=this.x-t,n=this.y-e,a=this.radius,h=(1-s)*r,l=Math.sqrt(o*o+n*n);return l<=a+h&&l>a-(r-h)}getBounds(t){return t||(t=new rt),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}});var jl,Wv=m(()=>{Yt();jl=class i{constructor(t=0,e=0,r=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=s}clone(){return new i(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return r*=r,s*=s,r+s<=1}strokeContains(t,e,r,s=.5){let{halfWidth:o,halfHeight:n}=this;if(o<=0||n<=0)return!1;let a=r*(1-s),h=r-a,l=o-h,c=n-h,u=o+a,d=n+a,f=t-this.x,p=e-this.y,g=f*f/(l*l)+p*p/(c*c),x=f*f/(u*u)+p*p/(d*d);return g>1&&x<=1}getBounds(t){return t||(t=new rt),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}});function zv(i,t,e,r,s,o){let n=i-e,a=t-r,h=s-e,l=o-r,c=n*h+a*l,u=h*h+l*l,d=-1;u!==0&&(d=c/u);let f,p;d<0?(f=e,p=r):d>1?(f=s,p=o):(f=e+d*h,p=r+d*l);let g=i-f,x=t-p;return g*g+x*x}var $v=m(()=>{"use strict"});var SM,AM,Js,Xv=m(()=>{$v();Yt();Js=class i{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0,e=this.points,r=e.length;for(let s=0;s<r;s+=2){let o=e[s],n=e[s+1],a=e[(s+2)%r],h=e[(s+3)%r];t+=(a-o)*(h+n)}return t<0}containsPolygon(t){let e=this.getBounds(SM),r=t.getBounds(AM);if(!e.containsRect(r))return!1;let s=t.points;for(let o=0;o<s.length;o+=2){let n=s[o],a=s[o+1];if(!this.contains(n,a))return!1}return!0}clone(){let t=this.points.slice(),e=new i(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}strokeContains(t,e,r,s=.5){let o=r*r,n=o*(1-s),a=o-n,{points:h}=this,l=h.length-(this.closePath?0:2);for(let c=0;c<l;c+=2){let u=h[c],d=h[c+1],f=h[(c+2)%h.length],p=h[(c+3)%h.length],g=zv(t,e,u,d,f,p),x=Math.sign((f-u)*(e-d)-(p-d)*(t-u));if(g<=(x<0?a:n))return!0}return!1}getBounds(t){t||(t=new rt);let e=this.points,r=1/0,s=-1/0,o=1/0,n=-1/0;for(let a=0,h=e.length;a<h;a+=2){let l=e[a],c=e[a+1];r=l<r?l:r,s=l>s?l:s,o=c<o?c:o,n=c>n?c:n}return t.x=r,t.width=s-r,t.y=o,t.height=n-o,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}});var Yl,ql,jv=m(()=>{Yt();Yl=(i,t,e,r,s,o,n)=>{let a=i-e,h=t-r,l=Math.sqrt(a*a+h*h);return l>=s-o&&l<=s+n},ql=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o}getBounds(t){return t||(t=new rt),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}strokeContains(t,e,r,s=.5){let{x:o,y:n,width:a,height:h,radius:l}=this,c=r*(1-s),u=r-c,d=o+l,f=n+l,p=a-l*2,g=h-l*2,x=o+a,v=n+h;return(t>=o-c&&t<=o+u||t>=x-u&&t<=x+c)&&e>=f&&e<=f+g||(e>=n-c&&e<=n+u||e>=v-u&&e<=v+c)&&t>=d&&t<=d+p?!0:t<d&&e<f&&Yl(t,e,d,f,l,u,c)||t>x-l&&e<f&&Yl(t,e,x-l,f,l,u,c)||t>x-l&&e>v-l&&Yl(t,e,x-l,v-l,l,u,c)||t<d&&e>v-l&&Yl(t,e,d,v-l,l,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}});function Zl(i,t,e,r,s,o,n,a,h,l){let u=Math.min(.99,Math.max(0,l??qs.defaultOptions.bezierSmoothness)),d=(wM-u)/1;return d*=d,CM(t,e,r,s,o,n,a,h,i,d),i}function CM(i,t,e,r,s,o,n,a,h,l){Kf(i,t,e,r,s,o,n,a,h,l,0),h.push(n,a)}function Kf(i,t,e,r,s,o,n,a,h,l,c){if(c>EM)return;let u=Math.PI,d=(i+e)/2,f=(t+r)/2,p=(e+s)/2,g=(r+o)/2,x=(s+n)/2,v=(o+a)/2,_=(d+p)/2,b=(f+g)/2,T=(p+x)/2,E=(g+v)/2,A=(_+T)/2,C=(b+E)/2;if(c>0){let M=n-i,P=a-t,S=Math.abs((e-n)*P-(r-a)*M),w=Math.abs((s-n)*P-(o-a)*M),B,F;if(S>Kl&&w>Kl){if((S+w)*(S+w)<=l*(M*M+P*P)){if(to<qf){h.push(A,C);return}let W=Math.atan2(o-r,s-e);if(B=Math.abs(W-Math.atan2(r-t,e-i)),F=Math.abs(Math.atan2(a-o,n-s)-W),B>=u&&(B=2*u-B),F>=u&&(F=2*u-F),B+F<to){h.push(A,C);return}if(Zi!==0){if(B>Zi){h.push(e,r);return}if(F>Zi){h.push(s,o);return}}}}else if(S>Kl){if(S*S<=l*(M*M+P*P)){if(to<qf){h.push(A,C);return}if(B=Math.abs(Math.atan2(o-r,s-e)-Math.atan2(r-t,e-i)),B>=u&&(B=2*u-B),B<to){h.push(e,r),h.push(s,o);return}if(Zi!==0&&B>Zi){h.push(e,r);return}}}else if(w>Kl){if(w*w<=l*(M*M+P*P)){if(to<qf){h.push(A,C);return}if(B=Math.abs(Math.atan2(a-o,n-s)-Math.atan2(o-r,s-e)),B>=u&&(B=2*u-B),B<to){h.push(e,r),h.push(s,o);return}if(Zi!==0&&B>Zi){h.push(s,o);return}}}else if(M=A-(i+n)/2,P=C-(t+a)/2,M*M+P*P<=l){h.push(A,C);return}}Kf(i,t,d,f,_,b,A,C,h,l,c+1),Kf(A,C,T,E,x,v,n,a,h,l,c+1)}var EM,Kl,wM,qf,to,Zi,Zf=m(()=>{Dl();EM=8,Kl=11920929e-14,wM=1,qf=.01,to=0,Zi=0});function qv(i,t,e,r,s,o,n,a){let l=Math.min(.99,Math.max(0,a??qs.defaultOptions.bezierSmoothness)),c=(MM-l)/1;return c*=c,IM(t,e,r,s,o,n,i,c),i}function IM(i,t,e,r,s,o,n,a){Qf(n,i,t,e,r,s,o,a,0),n.push(s,o)}function Qf(i,t,e,r,s,o,n,a,h){if(h>PM)return;let l=Math.PI,c=(t+r)/2,u=(e+s)/2,d=(r+o)/2,f=(s+n)/2,p=(c+d)/2,g=(u+f)/2,x=o-t,v=n-e,_=Math.abs((r-o)*v-(s-n)*x);if(_>RM){if(_*_<=a*(x*x+v*v)){if(Yv<BM){i.push(p,g);return}let b=Math.abs(Math.atan2(n-s,o-r)-Math.atan2(s-e,r-t));if(b>=l&&(b=2*l-b),b<Yv){i.push(p,g);return}}}else if(x=p-(t+o)/2,v=g-(e+n)/2,x*x+v*v<=a){i.push(p,g);return}Qf(i,t,e,c,u,p,g,a,h+1),Qf(i,p,g,d,f,o,n,a,h+1)}var PM,RM,MM,BM,Yv,Kv=m(()=>{Dl();PM=8,RM=11920929e-14,MM=1,BM=.01,Yv=0});function Ql(i,t,e,r,s,o,n,a){let h=Math.abs(s-o);(!n&&s>o||n&&o>s)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=s;l*=n?-1:1;for(let u=0;u<a+1;u++){let d=Math.cos(c),f=Math.sin(c),p=t+d*r,g=e+f*r;i.push(p,g),c+=l}}var Jf=m(()=>{"use strict"});function Zv(i,t,e,r,s,o){let n=i[i.length-2],h=i[i.length-1]-e,l=n-t,c=s-e,u=r-t,d=Math.abs(h*u-l*c);if(d<1e-8||o===0){(i[i.length-2]!==t||i[i.length-1]!==e)&&i.push(t,e);return}let f=h*h+l*l,p=c*c+u*u,g=h*c+l*u,x=o*Math.sqrt(f)/d,v=o*Math.sqrt(p)/d,_=x*g/f,b=v*g/p,T=x*u+v*l,E=x*c+v*h,A=l*(v+_),C=h*(v+_),M=u*(x+b),P=c*(x+b),S=Math.atan2(C-E,A-T),w=Math.atan2(P-E,M-T);Ql(i,T+t,E+e,o,S,w,l*c>u*h)}var Qv=m(()=>{Jf()});function FM(i,t){let e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,s=Math.cos(i),o=Math.sin(i),n=Math.cos(i+t),a=Math.sin(i+t);return[{x:s-o*r,y:o+s*r},{x:n+a*r,y:a-n*r},{x:n,y:a}]}function t0(i,t,e,r,s,o,n,a=0,h=0,l=0){if(o===0||n===0)return;let c=Math.sin(a*Wn/360),u=Math.cos(a*Wn/360),d=u*(t-r)/2+c*(e-s)/2,f=-c*(t-r)/2+u*(e-s)/2;if(d===0&&f===0)return;o=Math.abs(o),n=Math.abs(n);let p=Math.pow(d,2)/Math.pow(o,2)+Math.pow(f,2)/Math.pow(n,2);p>1&&(o*=Math.sqrt(p),n*=Math.sqrt(p)),GM(t,e,r,s,o,n,h,l,c,u,d,f,tp);let{ang1:g,ang2:x}=tp,{centerX:v,centerY:_}=tp,b=Math.abs(x)/(Wn/4);Math.abs(1-b)<1e-7&&(b=1);let T=Math.max(Math.ceil(b),1);x/=T;let E=i[i.length-2],A=i[i.length-1],C={x:0,y:0};for(let M=0;M<T;M++){let P=FM(g,x),{x:S,y:w}=ep(P[0],o,n,u,c,v,_,C),{x:B,y:F}=ep(P[1],o,n,u,c,v,_,C),{x:W,y:z}=ep(P[2],o,n,u,c,v,_,C);Zl(i,E,A,S,w,B,F,W,z),E=W,A=z,g+=x}}var Wn,tp,ep,Jv,GM,e0=m(()=>{Zf();Wn=Math.PI*2,tp={centerX:0,centerY:0,ang1:0,ang2:0},ep=({x:i,y:t},e,r,s,o,n,a,h)=>{i*=e,t*=r;let l=s*i-o*t,c=o*i+s*t;return h.x=l+n,h.y=c+a,h};Jv=(i,t,e,r)=>{let s=i*r-t*e<0?-1:1,o=i*e+t*r;return o>1&&(o=1),o<-1&&(o=-1),s*Math.acos(o)},GM=(i,t,e,r,s,o,n,a,h,l,c,u,d)=>{let f=Math.pow(s,2),p=Math.pow(o,2),g=Math.pow(c,2),x=Math.pow(u,2),v=f*p-f*x-p*g;v<0&&(v=0),v/=f*x+p*g,v=Math.sqrt(v)*(n===a?-1:1);let _=v*s/o*u,b=v*-o/s*c,T=l*_-h*b+(i+e)/2,E=h*_+l*b+(t+r)/2,A=(c-_)/s,C=(u-b)/o,M=(-c-_)/s,P=(-u-b)/o,S=Jv(1,0,A,C),w=Jv(A,C,M,P);a===0&&w>0&&(w-=Wn),a===1&&w<0&&(w+=Wn),d.centerX=T,d.centerY=E,d.ang1=S,d.ang2=w}});function r0(i,t,e){let r=(n,a)=>{let h=a.x-n.x,l=a.y-n.y,c=Math.sqrt(h*h+l*l),u=h/c,d=l/c;return{len:c,nx:u,ny:d}},s=(n,a)=>{n===0?i.moveTo(a.x,a.y):i.lineTo(a.x,a.y)},o=t[t.length-1];for(let n=0;n<t.length;n++){let a=t[n%t.length],h=a.radius??e;if(h<=0){s(n,a),o=a;continue}let l=t[(n+1)%t.length],c=r(a,o),u=r(a,l);if(c.len<1e-4||u.len<1e-4){s(n,a),o=a;continue}let d=Math.asin(c.nx*u.ny-c.ny*u.nx),f=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?d<0?d=Math.PI+d:(d=Math.PI-d,f=-1,p=!0):d>0&&(f=-1,p=!0);let g=d/2,x,v=Math.abs(Math.cos(g)*h/Math.sin(g));v>Math.min(c.len/2,u.len/2)?(v=Math.min(c.len/2,u.len/2),x=Math.abs(v*Math.sin(g)/Math.cos(g))):x=h;let _=a.x+u.nx*v+-u.ny*x*f,b=a.y+u.ny*v+u.nx*x*f,T=Math.atan2(c.ny,c.nx)+Math.PI/2*f,E=Math.atan2(u.ny,u.nx)-Math.PI/2*f;n===0&&i.moveTo(_+Math.cos(T)*x,b+Math.sin(T)*x),i.arc(_,b,x,T,E,p),o=a}}function i0(i,t,e,r){let s=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),o=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),n=t.length;for(let a=0;a<n;a++){let h=t[(a+1)%n],l=h.radius??e;if(l<=0){a===0?i.moveTo(h.x,h.y):i.lineTo(h.x,h.y);continue}let c=t[a],u=t[(a+2)%n],d=s(c,h),f;if(d<1e-4)f=h;else{let x=Math.min(d/2,l);f=o(h,c,x/d)}let p=s(u,h),g;if(p<1e-4)g=h;else{let x=Math.min(p/2,l);g=o(h,u,x/p)}a===0?i.moveTo(f.x,f.y):i.lineTo(f.x,f.y),i.quadraticCurveTo(h.x,h.y,g.x,g.y,r)}}var s0=m(()=>{"use strict"});var UM,Jl,o0=m(()=>{Vv();Wv();Xv();Yt();jv();Me();Zf();Kv();Jf();Qv();e0();s0();UM=new rt,Jl=class{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new bt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();let r=this._currentPoly.points,s=r[r.length-2],o=r[r.length-1];return(s!==t||o!==e)&&r.push(t,e),this}arc(t,e,r,s,o,n){this._ensurePoly(!1);let a=this._currentPoly.points;return Ql(a,t,e,r,s,o,n),this}arcTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly.points;return Zv(n,t,e,r,s,o),this}arcToSvg(t,e,r,s,o,n,a){let h=this._currentPoly.points;return t0(h,this._currentPoly.lastX,this._currentPoly.lastY,n,a,t,e,r,s,o),this}bezierCurveTo(t,e,r,s,o,n,a){this._ensurePoly();let h=this._currentPoly;return Zl(this._currentPoly.points,h.lastX,h.lastY,t,e,r,s,o,n,a),this}quadraticCurveTo(t,e,r,s,o){this._ensurePoly();let n=this._currentPoly;return qv(this._currentPoly.points,n.lastX,n.lastY,t,e,r,s,o),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));let r=this.shapePrimitives,s=r.length;for(let o=0;o<t.instructions.length;o++){let n=t.instructions[o];this[n.action](...n.data)}if(t.checkForHoles&&r.length-s>1){let o=null;for(let n=s;n<r.length;n++){let a=r[n];if(a.shape.type==="polygon"){let h=a.shape,l=o?.shape;l&&l.containsPolygon(h)?(o.holes||(o.holes=[]),o.holes.push(a),r.copyWithin(n,n+1),r.length--,n--):o=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,s,o){return this.drawShape(new rt(t,e,r,s),o),this}circle(t,e,r,s){return this.drawShape(new Xl(t,e,r),s),this}poly(t,e,r){let s=new Js(t);return s.closePath=e,this.drawShape(s,r),this}regularPoly(t,e,r,s,o=0,n){s=Math.max(s|0,3);let a=-1*Math.PI/2+o,h=Math.PI*2/s,l=[];for(let c=0;c<s;c++){let u=a-c*h;l.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(l,!0,n),this}roundPoly(t,e,r,s,o,n=0,a){if(s=Math.max(s|0,3),o<=0)return this.regularPoly(t,e,r,s,n);let h=r*Math.sin(Math.PI/s)-.001;o=Math.min(o,h);let l=-1*Math.PI/2+n,c=Math.PI*2/s,u=(s-2)*Math.PI/s/2;for(let d=0;d<s;d++){let f=d*c+l,p=t+r*Math.cos(f),g=e+r*Math.sin(f),x=f+Math.PI+u,v=f-Math.PI-u,_=p+o*Math.cos(x),b=g+o*Math.sin(x),T=p+o*Math.cos(v),E=g+o*Math.sin(v);d===0?this.moveTo(_,b):this.lineTo(_,b),this.quadraticCurveTo(p,g,T,E,a)}return this.closePath()}roundShape(t,e,r=!1,s){return t.length<3?this:(r?i0(this,t,e,s):r0(this,t,e),this.closePath())}filletRect(t,e,r,s,o){if(o===0)return this.rect(t,e,r,s);let n=Math.min(r,s)/2,a=Math.min(n,Math.max(-n,o)),h=t+r,l=e+s,c=a<0?-a:0,u=Math.abs(a);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(h-u,e).arcTo(h-c,e+c,h,e+u,u).lineTo(h,l-u).arcTo(h-c,l-c,t+r-u,l,u).lineTo(t+u,l).arcTo(t+c,l-c,t,l-u,u).closePath()}chamferRect(t,e,r,s,o,n){if(o<=0)return this.rect(t,e,r,s);let a=Math.min(o,Math.min(r,s)/2),h=t+r,l=e+s,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,n)}ellipse(t,e,r,s,o){return this.drawShape(new jl(t,e,r,s),o),this}roundRect(t,e,r,s,o,n){return this.drawShape(new ql(t,e,r,s,o),n),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Js,r.points.push(t,e),this._currentPoly=r,this}endPoly(t=!1){let e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Js,t)){let e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){let o=e.transform,n=r;r=o.a*r+o.c*s+o.tx,s=o.b*n+o.d*s+o.ty}this._currentPoly.points.push(r,s)}else this._currentPoly.points.push(0,0)}}buildPath(){let t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){let r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){let t=this._bounds;t.clear();let e=this.shapePrimitives;for(let r=0;r<e.length;r++){let s=e[r],o=s.shape.getBounds(UM);s.transform?t.addRect(o,s.transform):t.addRect(o)}return t}}});function zn(i,t){return i?i.prepend(t):t.clone()}var vi,rp=m(()=>{Ze();ue();vt();Hv();o0();vi=class i{constructor(t,e=!1){this.instructions=[],this.uid=nt("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?Lv(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Jl(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,r,s,o){let n=this.instructions[this.instructions.length-1],a=this.getLastPoint(at.shared),h=0,l=0;if(!n||n.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=n.data[2],l=n.data[3];let c=a.x,u=a.y;h=c+(c-h),l=u+(u-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,r,s,o]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){let s=this.instructions[this.instructions.length-1],o=this.getLastPoint(at.shared),n=0,a=0;if(!s||s.action!=="quadraticCurveTo")n=o.x,a=o.y;else{n=s.data[0],a=s.data[1];let h=o.x,l=o.y;n=h+(h-n),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[n,a,t,e,r]}),this._dirty=!0,this}rect(t,e,r,s,o){return this.instructions.push({action:"rect",data:[t,e,r,s,o]}),this._dirty=!0,this}circle(t,e,r,s){return this.instructions.push({action:"circle",data:[t,e,r,s]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,s,o,n,a){o||(o=s/2);let h=-1*Math.PI/2+n,l=r*2,c=Math.PI*2/l,u=[];for(let d=0;d<l;d++){let f=d%2?o:s,p=d*c+h;u.push(t+f*Math.cos(p),e+f*Math.sin(p))}return this.poly(u,!0,a),this}clone(t=!1){let e=new i;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){let s=this.instructions[r];e.instructions.push({action:s.action,data:s.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;let e=t.a,r=t.b,s=t.c,o=t.d,n=t.tx,a=t.ty,h=0,l=0,c=0,u=0,d=0,f=0,p=0,g=0;for(let x=0;x<this.instructions.length;x++){let v=this.instructions[x],_=v.data;switch(v.action){case"moveTo":case"lineTo":h=_[0],l=_[1],_[0]=e*h+s*l+n,_[1]=r*h+o*l+a;break;case"bezierCurveTo":c=_[0],u=_[1],d=_[2],f=_[3],h=_[4],l=_[5],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*d+s*f+n,_[3]=r*d+o*f+a,_[4]=e*h+s*l+n,_[5]=r*h+o*l+a;break;case"quadraticCurveTo":c=_[0],u=_[1],h=_[2],l=_[3],_[0]=e*c+s*u+n,_[1]=r*c+o*u+a,_[2]=e*h+s*l+n,_[3]=r*h+o*l+a;break;case"arcToSvg":h=_[5],l=_[6],p=_[0],g=_[1],_[0]=e*p+s*g,_[1]=r*p+o*g,_[5]=e*h+s*l+n,_[6]=r*h+o*l+a;break;case"circle":_[4]=zn(_[3],t);break;case"rect":_[4]=zn(_[4],t);break;case"ellipse":_[8]=zn(_[8],t);break;case"roundRect":_[5]=zn(_[5],t);break;case"addPath":_[0].transform(t);break;case"poly":_[2]=zn(_[2],t);break;default:H("unknown transform action",v.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}});function Bt(i,t,e){let r=i.getAttribute(t);return r?Number(r):e}var ip=m(()=>{"use strict"});function n0(i,t){let e=i.querySelectorAll("defs");for(let r=0;r<e.length;r++){let s=e[r];for(let o=0;o<s.children.length;o++){let n=s.children[o];switch(n.nodeName.toLowerCase()){case"lineargradient":t.defs[n.id]=kM(n);break;case"radialgradient":t.defs[n.id]=OM(n);break;default:break}}}}function kM(i){let t=Bt(i,"x1",0),e=Bt(i,"y1",0),r=Bt(i,"x2",1),s=Bt(i,"y2",0),o=i.getAttribute("gradientUnits")||"objectBoundingBox",n=new Ue(t,e,r,s,o==="objectBoundingBox"?"local":"global");for(let a=0;a<i.children.length;a++){let h=i.children[a],l=Bt(h,"offset",0),c=it.shared.setValue(h.getAttribute("stop-color")).toNumber();n.addColorStop(l,c)}return n}function OM(i){return H("[SVG Parser] Radial gradients are not yet supported"),new Ue(0,0,1,0)}var a0=m(()=>{le();vt();Ys();ip()});function sp(i){let t=i.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}var h0=m(()=>{"use strict"});function op(i,t){let e=i.getAttribute("style"),r={},s={},o={strokeStyle:r,fillStyle:s,useFill:!1,useStroke:!1};for(let n in l0){let a=i.getAttribute(n);a&&c0(t,o,n,a.trim())}if(e){let n=e.split(";");for(let a=0;a<n.length;a++){let h=n[a].trim(),[l,c]=h.split(":");l0[l]&&c0(t,o,l,c.trim())}}return{strokeStyle:o.useStroke?r:null,fillStyle:o.useFill?s:null,useFill:o.useFill,useStroke:o.useStroke}}function c0(i,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){let s=sp(r);t.strokeStyle.fill=i.defs[s]}else t.strokeStyle.color=it.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){let s=sp(r);t.fillStyle.fill=i.defs[s]}else t.fillStyle.color=it.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}var l0,u0=m(()=>{le();h0();l0={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}}});function d0(i,t){if(typeof i=="string"){let n=document.createElement("div");n.innerHTML=i.trim(),i=n.querySelector("svg")}let e={context:t,defs:{},path:new vi};n0(i,e);let r=i.children,{fillStyle:s,strokeStyle:o}=op(i,e);for(let n=0;n<r.length;n++){let a=r[n];a.nodeName.toLowerCase()!=="defs"&&f0(a,e,s,o)}return t}function f0(i,t,e,r){let s=i.children,{fillStyle:o,strokeStyle:n}=op(i,t);o&&e?e={...e,...o}:o&&(e=o),n&&r?r={...r,...n}:n&&(r=n);let a=!e&&!r;a&&(e={color:0});let h,l,c,u,d,f,p,g,x,v,_,b,T,E,A,C,M;switch(i.nodeName.toLowerCase()){case"path":E=i.getAttribute("d"),i.getAttribute("fill-rule")==="evenodd"&&H("SVG Evenodd fill rule not supported, your svg may render incorrectly"),A=new vi(E,!0),t.context.path(A),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"circle":p=Bt(i,"cx",0),g=Bt(i,"cy",0),x=Bt(i,"r",0),t.context.ellipse(p,g,x,x),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":h=Bt(i,"x",0),l=Bt(i,"y",0),C=Bt(i,"width",0),M=Bt(i,"height",0),v=Bt(i,"rx",0),_=Bt(i,"ry",0),v||_?t.context.roundRect(h,l,C,M,v||_):t.context.rect(h,l,C,M),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=Bt(i,"cx",0),g=Bt(i,"cy",0),v=Bt(i,"rx",0),_=Bt(i,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,v,_),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":c=Bt(i,"x1",0),u=Bt(i,"y1",0),d=Bt(i,"x2",0),f=Bt(i,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(d,f),r&&t.context.stroke(r);break;case"polygon":T=i.getAttribute("points"),b=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(b,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":T=i.getAttribute("points"),b=T.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(b,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{H(`[SVG parser] <${i.nodeName}> elements unsupported`);break}}a&&(e=null);for(let P=0;P<s.length;P++)f0(s[P],t,e,r)}var p0=m(()=>{vt();rp();a0();ip();u0()});function NM(i){return it.isColorLike(i)}function m0(i){return i instanceof qr}function g0(i){return i instanceof Ue}function DM(i){return i instanceof I}function LM(i,t,e){let r=it.shared.setValue(t??0);return i.color=r.toNumber(),i.alpha=r.alpha===1?e.alpha:r.alpha,i.texture=I.WHITE,{...e,...i}}function HM(i,t,e){return i.texture=t,{...e,...i}}function x0(i,t,e){return i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,{...e,...i}}function _0(i,t,e){return t.buildGradient(),i.fill=t,i.color=16777215,i.texture=t.texture,i.matrix=t.transform,i.textureSpace=t.textureSpace,{...e,...i}}function VM(i,t){let e={...t,...i},r=it.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function Kr(i,t){if(i==null)return null;let e={},r=i;return NM(i)?LM(e,i,t):DM(i)?HM(e,i,t):m0(i)?x0(e,i,t):g0(i)?_0(e,i,t):r.fill&&m0(r.fill)?x0(r,r.fill,t):r.fill&&g0(r.fill)?_0(r,r.fill,t):VM(r,t)}function eo(i,t){let{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...h}=t,l=Kr(i,h);return l?{width:e,alignment:r,miterLimit:s,cap:o,join:n,pixelLine:a,...l}:null}var np=m(()=>{le();xt();Ys();$l()});var WM,y0,ap,Ee,tc=m(()=>{me();le();dt();Ze();xt();ue();Ft();Me();rp();p0();np();WM=new at,y0=new U,ap=class Mr extends At{constructor(){super(...arguments),this.uid=nt("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new vi,this._transform=new U,this._fillStyle={...Mr.defaultFillStyle},this._strokeStyle={...Mr.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new bt,this._boundsDirty=!0}clone(){let t=new Mr;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=Kr(t,Mr.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=eo(t,Mr.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=Kr(t,Mr.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=Kr(t,Mr.defaultStrokeStyle),this}texture(t,e,r,s,o,n){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:s||0,dw:o||t.frame.width,dh:n||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?it.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new vi,this}fill(t,e){let r,s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?r=s.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(X(tt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=Kr(t,Mr.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){let{x:t,y:e}=this._activePath.getLastPoint(at.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e,r=this.instructions[this.instructions.length-1];return this._tick===0&&r&&r.action==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=eo(t,Mr.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){let e=this.instructions[this.instructions.length-1-t],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,s,o,n){this._tick++;let a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,r,s,o,n),this}arcTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.arcTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}arcToSvg(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.arcToSvg(t,e,r,s,o,h.a*n+h.c*a+h.tx,h.b*n+h.d*a+h.ty),this}bezierCurveTo(t,e,r,s,o,n,a){this._tick++;let h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*r+h.c*s+h.tx,h.b*r+h.d*s+h.ty,h.a*o+h.c*n+h.tx,h.b*o+h.d*n+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,r,s){return this._tick++,this._activePath.ellipse(t,e,r,s,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;let r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;let r=this._transform,s=this._activePath.instructions,o=r.a*t+r.c*e+r.tx,n=r.b*t+r.d*e+r.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=o,s[0].data[1]=n,this):(this._activePath.moveTo(o,n),this)}quadraticCurveTo(t,e,r,s,o){this._tick++;let n=this._transform;return this._activePath.quadraticCurveTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty,n.a*r+n.c*s+n.tx,n.b*r+n.d*s+n.ty,o),this}rect(t,e,r,s){return this._tick++,this._activePath.rect(t,e,r,s,this._transform.clone()),this}roundRect(t,e,r,s,o){return this._tick++,this._activePath.roundRect(t,e,r,s,o,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,s,o=0,n){return this._tick++,this._activePath.regularPoly(t,e,r,s,o,n),this}roundPoly(t,e,r,s,o,n){return this._tick++,this._activePath.roundPoly(t,e,r,s,o,n),this}roundShape(t,e,r,s){return this._tick++,this._activePath.roundShape(t,e,r,s),this}filletRect(t,e,r,s,o){return this._tick++,this._activePath.filletRect(t,e,r,s,o),this}chamferRect(t,e,r,s,o,n){return this._tick++,this._activePath.chamferRect(t,e,r,s,o,n),this}star(t,e,r,s,o=0,n=0){return this._tick++,this._activePath.star(t,e,r,s,o,n,this._transform.clone()),this}svg(t){return this._tick++,d0(t,this),this}restore(){let t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,r,s,o,n){return t instanceof U?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,s,o,n),this)}transform(t,e,r,s,o,n){return t instanceof U?(this._transform.append(t),this):(y0.set(t,e,r,s,o,n),this._transform.append(y0),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;let t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){let r=this.instructions[e],s=r.action;if(s==="fill"){let o=r.data;t.addBounds(o.path.bounds)}else if(s==="texture"){let o=r.data;t.addFrame(o.dx,o.dy,o.dx+o.dw,o.dy+o.dh,o.transform)}if(s==="stroke"){let o=r.data,n=o.style.alignment,a=o.style.width*(1-n),h=o.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;let e=this.instructions,r=!1;for(let s=0;s<e.length;s++){let o=e[s],n=o.data,a=n.path;if(!o.action||!a)continue;let h=n.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){let u=l[c].shape;if(!h||!u)continue;let d=l[c].transform,f=d?d.applyInverse(t,WM):t;if(o.action==="fill")r=u.contains(f.x,f.y);else{let g=h;r=u.strokeContains(f.x,f.y,g.width,g.alignment)}let p=n.hole;if(p){let g=p.shapePath?.shapePrimitives;if(g)for(let x=0;x<g.length;x++)g[x].shape.contains(f.x,f.y)&&(r=!1)}if(r)return!0}}return r}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(r),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(r)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};ap.defaultFillStyle={color:16777215,alpha:1,texture:I.WHITE,matrix:null,fill:null,textureSpace:"local"};ap.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:I.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};Ee=ap});function ec(i){let t=[],e=0;for(let r=0;r<b0.length;r++){let s=`_${b0[r]}`;t[e++]=i[s]}return e=v0(i._fill,t,e),e=zM(i._stroke,t,e),e=$M(i.dropShadow,t,e),t.join("-")}function v0(i,t,e){return i&&(t[e++]=i.color,t[e++]=i.alpha,t[e++]=i.fill?.styleKey),e}function zM(i,t,e){return i&&(e=v0(i,t,e),t[e++]=i.width,t[e++]=i.alignment,t[e++]=i.cap,t[e++]=i.join,t[e++]=i.miterLimit),e}function $M(i,t,e){return i&&(t[e++]=i.alpha,t[e++]=i.angle,t[e++]=i.blur,t[e++]=i.distance,t[e++]=it.shared.setValue(i.color).toNumber()),e}var b0,hp=m(()=>{le();b0=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"]});function XM(i){let t=i;if(typeof t.dropShadow=="boolean"&&t.dropShadow){let e=Kt.defaultDropShadow;i.dropShadow={alpha:t.dropShadowAlpha??e.alpha,angle:t.dropShadowAngle??e.angle,blur:t.dropShadowBlur??e.blur,color:t.dropShadowColor??e.color,distance:t.dropShadowDistance??e.distance}}if(t.strokeThickness!==void 0){X(tt,"strokeThickness is now a part of stroke");let e=t.stroke,r={};if(it.isColorLike(e))r.color=e;else if(e instanceof Ue||e instanceof qr)r.fill=e;else if(Object.hasOwnProperty.call(e,"color")||Object.hasOwnProperty.call(e,"fill"))r=e;else throw new Error("Invalid stroke value.");i.stroke={...r,width:t.strokeThickness}}if(Array.isArray(t.fillGradientStops)){X(tt,"gradient fill is now a fill pattern: `new FillGradient(...)`");let e;i.fontSize==null?i.fontSize=Kt.defaultTextStyle.fontSize:typeof i.fontSize=="string"?e=parseInt(i.fontSize,10):e=i.fontSize;let r=new Ue({start:{x:0,y:0},end:{x:0,y:(e||0)*1.7}}),s=t.fillGradientStops.map(o=>it.shared.setValue(o).toNumber());s.forEach((o,n)=>{let a=n/(s.length-1);r.addColorStop(a,o)}),i.fill={fill:r}}}var lp,Kt,Qi=m(()=>{me();le();Ft();Ys();$l();tc();np();hp();lp=class ro extends At{constructor(t={}){super(),XM(t);let e={...ro.defaultTextStyle,...t};for(let r in e){let s=r;this[s]=e[r]}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){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy({...ro.defaultDropShadow,...t}):this._dropShadow=t?this._createProxy({...ro.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){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=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({...Ee.defaultFillStyle,...t},()=>{this._fill=Kr({...this._originalFill},Ee.defaultFillStyle)})),this._fill=Kr(t===0?"black":t,Ee.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy({...Ee.defaultStrokeStyle,...t},()=>{this._stroke=eo({...this._originalStroke},Ee.defaultStrokeStyle)})),this._stroke=eo(t,Ee.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=ec(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){let t=ro.defaultTextStyle;for(let e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new ro({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?{...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){if(this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){let r=typeof t=="boolean"?t:t?.textureSource;this._fill?.texture&&this._fill.texture.destroy(r),this._originalFill?.texture&&this._originalFill.texture.destroy(r),this._stroke?.texture&&this._stroke.texture.destroy(r),this._originalStroke?.texture&&this._originalStroke.texture.destroy(r)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(r,s,o)=>(r[s]=o,e?.(s,o),this.update(),!0)})}_isFillStyle(t){return(t??null)!==null&&!(it.isColorLike(t)||t instanceof Ue||t instanceof qr)}};lp.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5};lp.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};Kt=lp});function rc(i,t,e,r){let s=jM;s.minX=0,s.minY=0,s.maxX=i.width/r|0,s.maxY=i.height/r|0;let o=Gt.getOptimalTexture(s.width,s.height,r,!1);return o.source.uploadMethodId="image",o.source.resource=i,o.source.alphaMode="premultiply-alpha-on-upload",o.frame.width=t/r,o.frame.height=e/r,o.source.emit("update",o.source),o.updateUvs(),o}var jM,cp=m(()=>{li();Me();jM=new bt});function Ji(i){let t=typeof i.fontSize=="number"?`${i.fontSize}px`:i.fontSize,e=i.fontFamily;Array.isArray(i.fontFamily)||(e=i.fontFamily.split(","));for(let r=e.length-1;r>=0;r--){let s=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!YM.includes(s)&&(s=`"${s}"`),e[r]=s}return`${i.fontStyle} ${i.fontVariant} ${i.fontWeight} ${t} ${e.join(",")}`}var YM,ic=m(()=>{"use strict";YM=["serif","sans-serif","monospace","cursive","fantasy","system-ui"]});var up,pr,_t,$n=m(()=>{wt();ic();up={willReadFrequently:!0},pr=class q{static get experimentalLetterSpacingSupported(){let t=q._experimentalLetterSpacingSupported;if(t!==void 0){let e=j.get().getCanvasRenderingContext2D().prototype;t=q._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,r,s,o,n,a,h,l){this.text=t,this.style=e,this.width=r,this.height=s,this.lines=o,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(t=" ",e,r=q._canvas,s=e.wordWrap){let o=`${t}:${e.styleKey}`;if(q._measurementCache[o])return q._measurementCache[o];let n=Ji(e),a=q.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);let h=q.__context;h.font=n;let c=(s?q._wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),u=new Array(c.length),d=0;for(let _=0;_<c.length;_++){let b=q._measureText(c[_],e.letterSpacing,h);u[_]=b,d=Math.max(d,b)}let f=e._stroke?.width||0,p=d+f;e.dropShadow&&(p+=e.dropShadow.distance);let g=e.lineHeight||a.fontSize,x=Math.max(g,a.fontSize+f)+(c.length-1)*(g+e.leading);return e.dropShadow&&(x+=e.dropShadow.distance),new q(t,e,p,x,c,u,g+e.leading,d,a)}static _measureText(t,e,r){let s=!1;q.experimentalLetterSpacingSupported&&(q.experimentalLetterSpacing?(r.letterSpacing=`${e}px`,r.textLetterSpacing=`${e}px`,s=!0):(r.letterSpacing="0px",r.textLetterSpacing="0px"));let o=r.measureText(t),n=o.width,a=-o.actualBoundingBoxLeft,l=o.actualBoundingBoxRight-a;if(n>0)if(s)n-=e,l-=e;else{let c=(q.graphemeSegmenter(t).length-1)*e;n+=c,l+=c}return Math.max(n,l)}static _wordWrap(t,e,r=q._canvas){let s=r.getContext("2d",up),o=0,n="",a="",h=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=q._collapseSpaces(c),d=q._collapseNewlines(c),f=!u,p=e.wordWrapWidth+l,g=q._tokenize(t);for(let x=0;x<g.length;x++){let v=g[x];if(q._isNewline(v)){if(!d){a+=q._addLine(n),f=!u,n="",o=0;continue}v=" "}if(u){let b=q.isBreakingSpace(v),T=q.isBreakingSpace(n[n.length-1]);if(b&&T)continue}let _=q._getFromCache(v,l,h,s);if(_>p)if(n!==""&&(a+=q._addLine(n),n="",o=0),q.canBreakWords(v,e.breakWords)){let b=q.wordWrapSplit(v);for(let T=0;T<b.length;T++){let E=b[T],A=E,C=1;for(;b[T+C];){let P=b[T+C];if(!q.canBreakChars(A,P,v,T,e.breakWords))E+=P;else break;A=P,C++}T+=C-1;let M=q._getFromCache(E,l,h,s);M+o>p&&(a+=q._addLine(n),f=!1,n="",o=0),n+=E,o+=M}}else{n.length>0&&(a+=q._addLine(n),n="",o=0);let b=x===g.length-1;a+=q._addLine(v,!b),f=!1,n="",o=0}else _+o>p&&(f=!1,a+=q._addLine(n),n="",o=0),(n.length>0||!q.isBreakingSpace(v)||f)&&(n+=v,o+=_)}return a+=q._addLine(n,!1),a}static _addLine(t,e=!0){return t=q._trimRight(t),t=e?`${t}
368
+ `:t,t}static _getFromCache(t,e,r,s){let o=r[t];return typeof o!="number"&&(o=q._measureText(t,e,s)+e,r[t]=o),o}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){let r=t[e];if(!q.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:q._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:q._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){let e=[],r="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){let o=t[s],n=t[s+1];if(q.isBreakingSpace(o,n)||q._isNewline(o)){r!==""&&(e.push(r),r=""),e.push(o);continue}r+=o}return r!==""&&e.push(r),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,r,s,o){return!0}static wordWrapSplit(t){return q.graphemeSegmenter(t)}static measureFont(t){if(q._fonts[t])return q._fonts[t];let e=q._context;e.font=t;let r=e.measureText(q.METRICS_STRING+q.BASELINE_SYMBOL),s={ascent:r.actualBoundingBoxAscent,descent:r.actualBoundingBoxDescent,fontSize:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent};return q._fonts[t]=s,s}static clearMetrics(t=""){t?delete q._fonts[t]:q._fonts={}}static get _canvas(){if(!q.__canvas){let t;try{let e=new OffscreenCanvas(0,0);if(e.getContext("2d",up)?.measureText)return q.__canvas=e,e;t=j.get().createCanvas()}catch{t=j.get().createCanvas()}t.width=t.height=10,q.__canvas=t}return q.__canvas}static get _context(){return q.__context||(q.__context=q._canvas.getContext("2d",up)),q.__context}};pr.METRICS_STRING="|\xC9q\xC5";pr.BASELINE_SYMBOL="M";pr.BASELINE_MULTIPLIER=1.4;pr.HEIGHT_MULTIPLIER=2;pr.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter=="function"){let i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})();pr.experimentalLetterSpacing=!1;pr._fonts={};pr._newlines=[10,13];pr._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];pr._measurementCache={};_t=pr});function io(i,t,e,r=0){if(i.texture===I.WHITE&&!i.fill)return it.shared.setValue(i.color).setAlpha(i.alpha??1).toHexa();if(i.fill){if(i.fill instanceof qr){let s=i.fill,o=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(U.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),o.setTransform(n),o}else if(i.fill instanceof Ue){let s=i.fill,o=s.type==="linear",n=s.textureSpace==="local",a=1,h=1;n&&e&&(a=e.width+r,h=e.height+r);let l,c=!1;if(o){let{start:u,end:d}=s;l=t.createLinearGradient(u.x*a,u.y*h,d.x*a,d.y*h),c=Math.abs(d.x-u.x)<Math.abs((d.y-u.y)*.1)}else{let{center:u,innerRadius:d,outerCenter:f,outerRadius:p}=s;l=t.createRadialGradient(u.x*a,u.y*h,d*a,f.x*a,f.y*h,p*a)}if(c&&n&&e){let u=e.lineHeight/h;for(let d=0;d<e.lines.length;d++){let f=(d*e.lineHeight+r/2)/h;s.colorStops.forEach(p=>{let g=f+p.offset*u;l.addColorStop(Math.floor(g*T0)/T0,it.shared.setValue(p.color).toHex())})}}else s.colorStops.forEach(u=>{l.addColorStop(u.offset,it.shared.setValue(u.color).toHex())});return l}}else{let s=t.createPattern(i.texture.source.resource,"repeat"),o=i.matrix.copyTo(U.shared);return o.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(o),s}return H("FillStyle not recognised",i),"red"}var T0,dp=m(()=>{le();dt();xt();vt();Ys();$l();T0=1e5});var Xn,S0=m(()=>{le();R();dn();Qs();li();Uv();Ft();Qi();cp();$n();ic();dp();Xn=class{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,r){let s=_t.measureText(t||" ",r),o=Math.ceil(Math.ceil(Math.max(1,s.width)+r.padding*2)*e),n=Math.ceil(Math.ceil(Math.max(1,s.height)+r.padding*2)*e);return o=Math.ceil(o-1e-6),n=Math.ceil(n-1e-6),o=Vr(o),n=Vr(n),{width:o,height:n}}getTexture(t,e,r,s){typeof t=="string"&&(X("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:r,resolution:e}),t.style instanceof Kt||(t.style=new Kt(t.style));let{texture:o,canvasAndContext:n}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(o._source),ke.returnCanvasAndContext(n),o}createTextureAndCanvas(t){let{text:e,style:r}=t,s=t.resolution??this._renderer.resolution,o=_t.measureText(e||" ",r),n=Math.ceil(Math.ceil(Math.max(1,o.width)+r.padding*2)*s),a=Math.ceil(Math.ceil(Math.max(1,o.height)+r.padding*2)*s),h=ke.getOptimalCanvasAndContext(n,a),{canvas:l}=h;this.renderTextToCanvas(e,r,s,h);let c=rc(l,n,a,s);if(r.trim){let u=Gv(l,s);c.frame.copyFrom(u),c.updateUvs()}return{texture:c,canvasAndContext:h}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;let e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;let{texture:r,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:r,usageCount:1},r}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}returnTexture(t){let e=t.source;e.resource=null,e.uploadMethodId="unknown",e.alphaMode="no-premultiply-alpha",Gt.returnTexture(t)}decreaseReferenceCount(t){let e=this._activeTextures[t];e.usageCount--,e.usageCount===0&&(ke.returnCanvasAndContext(e.canvasAndContext),this.returnTexture(e.texture),this._activeTextures[t]=null)}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,r,s){let{canvas:o,context:n}=s,a=Ji(e),h=_t.measureText(t||" ",e),l=h.lines,c=h.lineHeight,u=h.lineWidths,d=h.maxLineWidth,f=h.fontProperties,p=o.height;if(n.resetTransform(),n.scale(r,r),n.textBaseline=e.textBaseline,e._stroke?.width){let _=e._stroke;n.lineWidth=_.width,n.miterLimit=_.miterLimit,n.lineJoin=_.join,n.lineCap=_.cap}n.font=a;let g,x,v=e.dropShadow?2:1;for(let _=0;_<v;++_){let b=e.dropShadow&&_===0,T=b?Math.ceil(Math.max(1,p)+e.padding*2):0,E=T*r;if(b){n.fillStyle="black",n.strokeStyle="black";let M=e.dropShadow,P=M.color,S=M.alpha;n.shadowColor=it.shared.setValue(P).setAlpha(S).toRgbaString();let w=M.blur*r,B=M.distance*r;n.shadowBlur=w,n.shadowOffsetX=Math.cos(M.angle)*B,n.shadowOffsetY=Math.sin(M.angle)*B+E}else{if(n.fillStyle=e._fill?io(e._fill,n,h):null,e._stroke?.width){let M=e._stroke.width*e._stroke.alignment;n.strokeStyle=io(e._stroke,n,h,M)}n.shadowColor="black"}let A=(c-f.fontSize)/2;c-f.fontSize<0&&(A=0);let C=e._stroke?.width??0;for(let M=0;M<l.length;M++)g=C/2,x=C/2+M*c+f.ascent+A,e.align==="right"?g+=d-u[M]:e.align==="center"&&(g+=(d-u[M])/2),e._stroke?.width&&this._drawLetterSpacing(l[M],e,s,g+e.padding,x+e.padding-T,!0),e._fill!==void 0&&this._drawLetterSpacing(l[M],e,s,g+e.padding,x+e.padding-T)}}_drawLetterSpacing(t,e,r,s,o,n=!1){let{context:a}=r,h=e.letterSpacing,l=!1;if(_t.experimentalLetterSpacingSupported&&(_t.experimentalLetterSpacing?(a.letterSpacing=`${h}px`,a.textLetterSpacing=`${h}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),h===0||l){n?a.strokeText(t,s,o):a.fillText(t,s,o);return}let c=s,u=_t.graphemeSegmenter(t),d=a.measureText(t).width,f=0;for(let p=0;p<u.length;++p){let g=u[p];n?a.strokeText(g,c,o):a.fillText(g,c,o);let x="";for(let v=p+1;v<u.length;++v)x+=u[v];f=a.measureText(x).width,c+=d-f+h,d=f}}destroy(){this._activeTextures=null}};Xn.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"canvasText"}});var fp=m(()=>{R();Bv();S0();D.add(Xn);D.add(Vn)});var we,pp=m(()=>{Ft();dl();tc();we=class i extends fi{constructor(t){t instanceof Ee&&(t={context:t});let{context:e,roundPixels:r,...s}=t||{};super({label:"Graphics",...s}),this.renderPipeId="graphics",e?this._context=e:this._context=this._ownedContext=new Ee,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=r??!1}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):(t===!0||t?.context===!0)&&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 i(this._context.clone()):(this._ownedContext=null,new i(this._context))}lineStyle(t,e,r){X(tt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");let s={};return t&&(s.width=t),e&&(s.color=e),r&&(s.alpha=r),this.context.strokeStyle=s,this}beginFill(t,e){X(tt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");let r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){X(tt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();let t=this.context.strokeStyle;return(t.width!==Ee.defaultStrokeStyle.width||t.color!==Ee.defaultStrokeStyle.color||t.alpha!==Ee.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return X(tt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return X(tt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return X(tt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return X(tt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return X(tt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return X(tt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}});var A0,E0,w0=m(()=>{"use strict";A0={name:"local-uniform-msdf-bit",vertex:{header:`
369
369
  struct LocalUniforms {
370
370
  uColor:vec4<f32>,
371
371
  uTransformMatrix:mat3x3<f32>,
@@ -392,7 +392,7 @@ fn mainFragment(
392
392
  @group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
393
393
  `,main:`
394
394
  outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
395
- `}},e_={name:"local-uniform-msdf-bit",vertex:{header:`
395
+ `}},E0={name:"local-uniform-msdf-bit",vertex:{header:`
396
396
  uniform mat3 uTransformMatrix;
397
397
  uniform vec4 uColor;
398
398
  uniform float uRound;
@@ -408,7 +408,7 @@ fn mainFragment(
408
408
  uniform float uDistance;
409
409
  `,main:`
410
410
  outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
411
- `}}});var i_,s_,o_=p(()=>{"use strict";i_={name:"msdf-bit",fragment:{header:`
411
+ `}}});var C0,P0,R0=m(()=>{"use strict";C0={name:"msdf-bit",fragment:{header:`
412
412
  fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
413
413
 
414
414
  // MSDF
@@ -435,7 +435,7 @@ fn mainFragment(
435
435
  return coverage;
436
436
 
437
437
  }
438
- `}},s_={name:"msdf-bit",fragment:{header:`
438
+ `}},P0={name:"msdf-bit",fragment:{header:`
439
439
  float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
440
440
 
441
441
  // MSDF
@@ -462,16 +462,16 @@ fn mainFragment(
462
462
 
463
463
  return coverage;
464
464
  }
465
- `}}});var Yh,Kh,fa,n_=p(()=>{K();Ar();sr();ws();Es();or();Nn();xe();Nt();r_();o_();fa=class extends xt{constructor(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=ae();Yh??(Yh=Pe({name:"sdf-shader",bits:[ai,li(e),t_,i_,Ce]})),Kh??(Kh=Ae({name:"sdf-shader",bits:[ci,hi(e),e_,s_,Me]})),super({glProgram:Kh,gpuProgram:Yh,resources:{localUniforms:t,batchSamplers:ui(e)}})}}});var wi,qh=p(()=>{It();dt();wi=class extends ot{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 U(H,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return U(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return U(H,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return U(H,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return U(H,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function pa(i){if(i==="")return[];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,c=n;a<=c;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var Zh=p(()=>{"use strict"});var a_,Qh,l_=p(()=>{Mt();vt();_i();ti();tt();dt();Ls();da();jh();Fr();qh();Zh();a_=class c_ extends wi{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;let e={...c_.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=M.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Ur(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=At.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=pa(t).filter(_=>!this._currentChars.includes(_)).filter((_,b,y)=>y.indexOf(_)===b);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,c=this._currentX,l=this._currentY,h=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*h,d=0,f=!1,m=s.width/this.resolution,g=s.height/this.resolution;for(let _=0;_<e.length;_++){let b=e[_],y=At.measureText(b,a,s,!1);y.lineHeight=y.height;let v=y.width*h,S=Math.ceil((a.fontStyle==="italic"?2:1)*v),E=y.height*h,T=S+u*2,w=E+u*2;if(f=!1,b!==`
466
- `&&b!=="\r"&&b!==" "&&b!==" "&&(f=!0,d=Math.ceil(Math.max(w,d))),c+T>m&&(l+=d,d=w,c=0,l+d>g)){n.update();let R=this._nextPage();s=R.canvasAndContext.canvas,o=R.canvasAndContext.context,n=R.texture.source,l=0}let A=v/h-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[b]={id:b.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:A,kerning:{}},f){this._drawGlyph(o,y,c+u,l+u,h,a);let R=n.width*h,C=n.height*h,G=new z(c/R*n.width,l/C*n.height,T/R*n.width,w/C*n.height);this.chars[b].texture=new M({source:n,frame:G}),c+=Math.ceil(T)}}n.update(),this._currentX=c,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return U(H,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],c=r[o];c||(c=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let h=e.measureText(o+a).width,u=h-(c+l);u&&(this.chars[o].kerning[a]=u),h=e.measureText(o+a).width,u=h-(c+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=Jt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new M({source:new qt({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Ur(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=Si(s,t)),e._fill&&(t.fillStyle=Si(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=V.shared.setValue(n.color).toArray(),c=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=c,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,s,o,n){let a=e.text,c=e.fontProperties,h=(n._stroke?.width??0)*o,u=r+h/2,d=s-h/2,f=c.descent*o,m=e.lineHeight*o;n.stroke&&h&&t.strokeText(a,u,d+m-f),n._fill&&t.fillText(a,u,d+m-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];Jt.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};a_.defaultOptions={textureSize:512,style:new St,mipmap:!0};Qh=a_});function ma(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,c={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=m=>{let g=o.width;for(let _=0;_<c.index;_++){let b=m.positions[_];o.chars.push(m.chars[_]),o.charPositions.push(b+g)}o.width+=m.width,a=!1,c.width=0,c.index=0,c.chars.length=0},h=()=>{let m=o.chars.length-1;if(r){let g=o.chars[m];for(;g===" ";)o.width-=e.chars[g].xAdvance,g=o.chars[--m]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let m=0;m<i.length+1;m++){let g,_=m===i.length;_||(g=i[m]);let b=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
467
- `||_){if(!a&&t.wordWrap&&o.width+c.width-d>f?(h(),l(c),_||o.charPositions.push(0)):(c.start=o.width,l(c),_||o.charPositions.push(0)),g==="\r"||g===`
468
- `)o.width!==0&&h();else if(!_){let E=b.xAdvance+(b.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let S=b.kerning[n]||0,E=b.xAdvance+S+d;c.positions[c.index++]=c.width+S,c.chars.push(g),c.width+=E}n=g}return h(),t.align==="center"?Vw(s):t.align==="right"?jw(s):t.align==="justify"&&Xw(s),s}function Vw(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function jw(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function Xw(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let h=0;h<r.charPositions.length;h++)h===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[h]+=n}}var Jh=p(()=>{"use strict"});var ga,tu,Hs,eu=p(()=>{tr();dt();it();Fr();l_();Jh();Zh();ga=0,tu=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){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!Q.has(r)){let n=new Qh({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});ga++,ga>50&&k("BitmapText",`You have dynamically created ${ga} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{ga--,Q.remove(r)}),Q.set(r,n)}let o=Q.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return ma([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},U(H,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof St?s:new St(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new Qh({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),c=pa(e.chars);return a.ensureCharacters(c.join("")),Q.set(`${r}-bitmap`,a),a.once("destroy",()=>Q.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=Q.get(e);r&&r.destroy()}},Hs=new tu});function h_(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var Ws,u_=p(()=>{tr();P();Ut();$h();n_();eu();Jh();Ws=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);h_(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(W.return(e.customShader),e.customShader=null),W.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);h_(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=Hs.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=W.get(fa)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,c=ma(o,n,s,!0),l=0,h=n.padding,u=c.scale,d=c.width,f=c.height+c.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-h,-t._anchor._y*f-h).scale(u,u);let m=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<c.lines.length;g++){let _=c.lines[g];for(let b=0;b<_.charPositions.length;b++){let y=o[l++],v=s.chars[y];v?.texture&&r.texture(v.texture,m||"black",Math.round(_.charPositions[b]+v.xOffset),Math.round(a+v.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=W.get(Wt);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=Q.get(`${r}-bitmap`),{a:o,b:n,c:a,d:c}=t.groupTransform,l=Math.sqrt(o*o+n*n),h=Math.sqrt(a*a+c*c),u=(Math.abs(l)+Math.abs(h))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};Ws.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"bitmapText"}});var ru=p(()=>{P();u_();I.add(Ws)});var zs,d_=p(()=>{P();tt();Ut();ks();Eh();zs=class{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(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),W.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Fs(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),Fs(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:M.EMPTY,currentKey:"--",batchableSprite:W.get(Ge),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=M.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};zs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"}});function f_(){let{userAgent:i}=D.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var p_=p(()=>{ct()});var m_,g_,Ei,iu=p(()=>{"use strict";m_="http://www.w3.org/2000/svg",g_="http://www.w3.org/1999/xhtml",Ei=class{constructor(){this.svgRoot=document.createElementNS(m_,"svg"),this.foreignObject=document.createElementNS(m_,"foreignObject"),this.domElement=document.createElementNS(g_,"div"),this.styleElement=document.createElementNS(g_,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function y_(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[v_(t)]:[],...i.dropShadow?[b_(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return $w(i.tagStyles,s),s.join(" ")}function b_(i){let t=V.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function v_(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${V.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function $w(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)__[o]?s.push(__[o](r[o])):x_[o]&&s.push(x_[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var x_,__,T_=p(()=>{Mt();x_={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},__={fill:i=>`color: ${V.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:v_,dropShadow:b_}});var xa,S_=p(()=>{it();Fr();Hh();T_();xa=class i extends St{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=ha(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...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=y_(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&k("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&k("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function w_(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(c){s[c]||(r.push(c),s[c]=!0)}if(Array.isArray(e))for(let c=0;c<e.length;c++)a(e[c]);else a(e);n&&n.forEach(c=>{let l=c.split(":")[1].trim();a(l)});for(let c in t.tagStyles){let l=t.tagStyles[c].fontFamily;a(l)}return r}var E_=p(()=>{"use strict"});async function P_(i){let e=await(await D.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var A_=p(()=>{ct()});async function su(i,t){let e=await P_(t);return`@font-face {
465
+ `}}});var mp,gp,sc,M0=m(()=>{dt();zi();_i();Mn();Bn();yi();Ml();dr();Ae();w0();R0();sc=class extends Ot{constructor(){let t=new Tt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Qe();mp??(mp=Sr({name:"sdf-shader",bits:[Hs,Ws(e),A0,C0,Er]})),gp??(gp=Ar({name:"sdf-shader",bits:[Vs,zs(e),E0,P0,wr]})),super({glProgram:gp,gpuProgram:mp,resources:{localUniforms:t,batchSamplers:$s(e)}})}}});var so,xp=m(()=>{me();Ft();so=class extends At{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 X(tt,"BitmapFont.font is deprecated, please use BitmapFont.fontFamily instead."),this.fontFamily}get pageTextures(){return X(tt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}get size(){return X(tt,"BitmapFont.size is deprecated, please use BitmapFont.fontMetrics.fontSize instead."),this.fontMetrics.fontSize}get distanceFieldRange(){return X(tt,"BitmapFont.distanceFieldRange is deprecated, please use BitmapFont.distanceField.range instead."),this.distanceField.range}get distanceFieldType(){return X(tt,"BitmapFont.distanceFieldType is deprecated, please use BitmapFont.distanceField.type instead."),this.distanceField.type}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners();for(let e in this.chars)this.chars[e].texture?.destroy();this.chars=null,t&&(this.pages.forEach(e=>e.texture.destroy(!0)),this.pages=null)}}});function oc(i){if(i==="")return[];typeof i=="string"&&(i=[i]);let t=[];for(let e=0,r=i.length;e<r;e++){let s=i[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");let o=s[0].charCodeAt(0),n=s[1].charCodeAt(0);if(n<o)throw new Error("[BitmapFont]: Invalid character range.");for(let a=o,h=n;a<=h;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var _p=m(()=>{"use strict"});var B0,yp,F0=m(()=>{le();Yt();Qs();Gs();xt();Ft();$n();ic();dp();Qi();xp();_p();B0=class I0 extends so{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;let e={...I0.defaultOptions,...t};this._textureSize=e.textureSize,this._mipmap=e.mipmap;let r=e.style.clone();e.overrideFill&&(r._fill.color=16777215,r._fill.alpha=1,r._fill.texture=I.WHITE,r._fill.fill=null),this.applyFillAsTint=e.overrideFill;let s=r.fontSize;r.fontSize=this.baseMeasurementFontSize;let o=Ji(r);e.overrideSize?r._stroke&&(r._stroke.width*=this.baseRenderedFontSize/s):r.fontSize=this.baseRenderedFontSize=s,this._style=r,this._skipKerning=e.skipKerning??!1,this.resolution=e.resolution??1,this._padding=e.padding??4,this.fontMetrics=_t.measureFont(o),this.lineHeight=r.lineHeight||this.fontMetrics.fontSize||r.fontSize}ensureCharacters(t){let e=oc(t).filter(x=>!this._currentChars.includes(x)).filter((x,v,_)=>_.indexOf(x)===v);if(!e.length)return;this._currentChars=[...this._currentChars,...e];let r;this._currentPageIndex===-1?r=this._nextPage():r=this.pages[this._currentPageIndex];let{canvas:s,context:o}=r.canvasAndContext,n=r.texture.source,a=this._style,h=this._currentX,l=this._currentY,c=this.baseRenderedFontSize/this.baseMeasurementFontSize,u=this._padding*c,d=0,f=!1,p=s.width/this.resolution,g=s.height/this.resolution;for(let x=0;x<e.length;x++){let v=e[x],_=_t.measureText(v,a,s,!1);_.lineHeight=_.height;let b=_.width*c,T=Math.ceil((a.fontStyle==="italic"?2:1)*b),E=_.height*c,A=T+u*2,C=E+u*2;if(f=!1,v!==`
466
+ `&&v!=="\r"&&v!==" "&&v!==" "&&(f=!0,d=Math.ceil(Math.max(C,d))),h+A>p&&(l+=d,d=C,h=0,l+d>g)){n.update();let P=this._nextPage();s=P.canvasAndContext.canvas,o=P.canvasAndContext.context,n=P.texture.source,l=0}let M=b/c-(a.dropShadow?.distance??0)-(a._stroke?.width??0);if(this.chars[v]={id:v.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:M,kerning:{}},f){this._drawGlyph(o,_,h+u,l+u,c,a);let P=n.width*c,S=n.height*c,w=new rt(h/P*n.width,l/S*n.height,A/P*n.width,C/S*n.height);this.chars[v].texture=new I({source:n,frame:w}),h+=Math.ceil(A)}}n.update(),this._currentX=h,this._currentY=l,this._skipKerning&&this._applyKerning(e,o)}get pageTextures(){return X(tt,"BitmapFont.pageTextures is deprecated, please use BitmapFont.pages instead."),this.pages}_applyKerning(t,e){let r=this._measureCache;for(let s=0;s<t.length;s++){let o=t[s];for(let n=0;n<this._currentChars.length;n++){let a=this._currentChars[n],h=r[o];h||(h=r[o]=e.measureText(o).width);let l=r[a];l||(l=r[a]=e.measureText(a).width);let c=e.measureText(o+a).width,u=c-(h+l);u&&(this.chars[o].kerning[a]=u),c=e.measureText(o+a).width,u=c-(h+l),u&&(this.chars[a].kerning[o]=u)}}}_nextPage(){this._currentPageIndex++;let t=this.resolution,e=ke.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);let r=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new I({source:new Fe({resource:e.canvas,resolution:r,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),o={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=o,o}_setupContext(t,e,r){e.fontSize=this.baseRenderedFontSize,t.scale(r,r),t.font=Ji(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;let s=e._stroke,o=s?.width??0;if(s&&(t.lineWidth=o,t.lineJoin=s.join,t.miterLimit=s.miterLimit,t.strokeStyle=io(s,t)),e._fill&&(t.fillStyle=io(e._fill,t)),e.dropShadow){let n=e.dropShadow,a=it.shared.setValue(n.color).toArray(),h=n.blur*r,l=n.distance*r;t.shadowColor=`rgba(${a[0]*255},${a[1]*255},${a[2]*255},${n.alpha})`,t.shadowBlur=h,t.shadowOffsetX=Math.cos(n.angle)*l,t.shadowOffsetY=Math.sin(n.angle)*l}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,r,s,o,n){let a=e.text,h=e.fontProperties,c=(n._stroke?.width??0)*o,u=r+c/2,d=s-c/2,f=h.descent*o,p=e.lineHeight*o;n.stroke&&c&&t.strokeText(a,u,d+p-f),n._fill&&t.fillText(a,u,d+p-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{canvasAndContext:e,texture:r}=this.pages[t];ke.returnCanvasAndContext(e),r.destroy(!0)}this.pages=null}};B0.defaultOptions={textureSize:512,style:new Kt,mipmap:!0};yp=B0});function nc(i,t,e,r){let s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let o=s.lines[0],n=null,a=!0,h={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=p=>{let g=o.width;for(let x=0;x<h.index;x++){let v=p.positions[x];o.chars.push(p.chars[x]),o.charPositions.push(v+g)}o.width+=p.width,a=!1,h.width=0,h.index=0,h.chars.length=0},c=()=>{let p=o.chars.length-1;if(r){let g=o.chars[p];for(;g===" ";)o.width-=e.chars[g].xAdvance,g=o.chars[--p]}s.width=Math.max(s.width,o.width),o={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(o),s.height+=e.lineHeight},u=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*u,f=t.wordWrapWidth*u;for(let p=0;p<i.length+1;p++){let g,x=p===i.length;x||(g=i[p]);let v=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
467
+ `||x){if(!a&&t.wordWrap&&o.width+h.width-d>f?(c(),l(h),x||o.charPositions.push(0)):(h.start=o.width,l(h),x||o.charPositions.push(0)),g==="\r"||g===`
468
+ `)o.width!==0&&c();else if(!x){let E=v.xAdvance+(v.kerning[n]||0)+d;o.width+=E,o.spaceWidth=E,o.spacesIndex.push(o.charPositions.length),o.chars.push(g)}}else{let T=v.kerning[n]||0,E=v.xAdvance+T+d;h.positions[h.index++]=h.width+T,h.chars.push(g),h.width+=E}n=g}return c(),t.align==="center"?qM(s):t.align==="right"?KM(s):t.align==="justify"&&ZM(s),s}function qM(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function KM(i){for(let t=0;t<i.lines.length;t++){let e=i.lines[t],r=i.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=r}}function ZM(i){let t=i.width;for(let e=0;e<i.lines.length;e++){let r=i.lines[e],s=0,o=r.spacesIndex[s++],n=0,a=r.spacesIndex.length,l=(t-r.width)/a;for(let c=0;c<r.charPositions.length;c++)c===o&&(o=r.spacesIndex[s++],n+=l),r.charPositions[c]+=n}}var bp=m(()=>{"use strict"});var ac,vp,jn,Tp=m(()=>{pi();Ft();vt();Qi();F0();bp();_p();ac=0,vp=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){let r=`${e.fontFamily}-bitmap`,s=!0;if(e._fill.fill&&!e._stroke)r+=e._fill.fill.styleKey,s=!1;else if(e._stroke||e.dropShadow){let n=e.styleKey;n=n.substring(0,n.lastIndexOf("-")),r=`${n}-bitmap`,s=!1}if(!mt.has(r)){let n=new yp({style:e,overrideFill:s,overrideSize:!0,...this.defaultOptions});ac++,ac>50&&H("BitmapText",`You have dynamically created ${ac} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),n.once("destroy",()=>{ac--,mt.remove(r)}),mt.set(r,n)}let o=mt.get(r);return o.ensureCharacters?.(t),o}getLayout(t,e,r=!0){let s=this.getFont(t,e);return nc([...t],e,s,r)}measureText(t,e,r=!0){return this.getLayout(t,e,r)}install(...t){let e=t[0];typeof e=="string"&&(e={name:e,style:t[1],chars:t[2]?.chars,resolution:t[2]?.resolution,padding:t[2]?.padding,skipKerning:t[2]?.skipKerning},X(tt,"BitmapFontManager.install(name, style, options) is deprecated, use BitmapFontManager.install({name, style, ...options})"));let r=e?.name;if(!r)throw new Error("[BitmapFontManager] Property `name` is required.");e={...this.defaultOptions,...e};let s=e.style,o=s instanceof Kt?s:new Kt(s),n=o._fill.fill!==null&&o._fill.fill!==void 0,a=new yp({style:o,overrideFill:n,skipKerning:e.skipKerning,padding:e.padding,resolution:e.resolution,overrideSize:!1}),h=oc(e.chars);return a.ensureCharacters(h.join("")),mt.set(`${r}-bitmap`,a),a.once("destroy",()=>mt.remove(`${r}-bitmap`)),a}uninstall(t){let e=`${t}-bitmap`,r=mt.get(e);r&&r.destroy()}},jn=new vp});function G0(i,t){t.groupTransform=i.groupTransform,t.groupColorAlpha=i.groupColorAlpha,t.groupColor=i.groupColor,t.groupBlendMode=i.groupBlendMode,t.globalDisplayStatus=i.globalDisplayStatus,t.groupTransform=i.groupTransform,t.localDisplayStatus=i.localDisplayStatus,t.groupAlpha=i.groupAlpha,t._roundPixels=i._roundPixels}var Yn,U0=m(()=>{pi();R();ve();pp();M0();Tp();bp();Yn=class{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuBitmapText")}validateRenderable(t){let e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){let r=this._getGpuBitmapText(t);G0(t,r),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,r)),this._renderer.renderPipes.graphics.addRenderable(r,e),r.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){let e=this._gpuBitmapText[t].context;e.customShader&&(et.return(e.customShader),e.customShader=null),et.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){let e=this._getGpuBitmapText(t);G0(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){let{context:r}=e,s=jn.getFont(t.text,t._style);r.clear(),s.distanceField.type!=="none"&&(r.customShader||(r.customShader=et.get(sc)));let o=Array.from(t.text),n=t._style,a=s.baseLineOffset,h=nc(o,n,s,!0),l=0,c=n.padding,u=h.scale,d=h.width,f=h.height+h.offsetY;n._stroke&&(d+=n._stroke.width/u,f+=n._stroke.width/u),r.translate(-t._anchor._x*d-c,-t._anchor._y*f-c).scale(u,u);let p=s.applyFillAsTint?n._fill.color:16777215;for(let g=0;g<h.lines.length;g++){let x=h.lines[g];for(let v=0;v<x.charPositions.length;v++){let _=o[l++],b=s.chars[_];b?.texture&&r.texture(b.texture,p||"black",Math.round(x.charPositions[v]+b.xOffset),Math.round(a+b.yOffset))}a+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){let e=et.get(we);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){let e=this._getGpuBitmapText(t).context,r=t._style.fontFamily,s=mt.get(`${r}-bitmap`),{a:o,b:n,c:a,d:h}=t.groupTransform,l=Math.sqrt(o*o+n*n),c=Math.sqrt(a*a+h*h),u=(Math.abs(l)+Math.abs(c))/2,d=s.baseRenderedFontSize/t._style.fontSize,f=u*s.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=f}destroy(){for(let t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}};Yn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"bitmapText"}});var Sp=m(()=>{R();U0();D.add(Yn)});var qn,k0=m(()=>{R();xt();ve();Ln();Xf();qn=class{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(let t in this._gpuText){let e=this._gpuText[t];if(!e)continue;let r=e.batchableSprite.renderable;r._autoResolution&&(r._resolution=this._renderer.resolution,r.onViewUpdate())}}validateRenderable(t){let e=this._getGpuText(t),r=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==r}addRenderable(t,e){let s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){let r=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),r._batcher.updateElement(r)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){let e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),et.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){let e=t._getKey(),r=this._getGpuText(t),s=r.batchableSprite;r.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1,Hn(s,t)}async _updateGpuText(t){t._didTextUpdate=!1;let e=this._getGpuText(t);if(e.generatingTexture)return;let r=t._getKey();this._renderer.htmlText.decreaseReferenceCount(e.currentKey),e.generatingTexture=!0,e.currentKey=r;let s=t.resolution??this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,s,t._style,t._getKey()),n=e.batchableSprite;n.texture=e.texture=o,e.generatingTexture=!1,e.textureNeedsUploading=!0,t.onViewUpdate(),Hn(n,t)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){let e={texture:I.EMPTY,currentKey:"--",batchableSprite:et.get(Rr),textureNeedsUploading:!1,generatingTexture:!1},r=e.batchableSprite;return r.renderable=t,r.transform=t.groupTransform,r.texture=I.EMPTY,r.bounds={minX:0,maxX:1,minY:0,maxY:0},r.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}};qn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"htmlText"}});function O0(){let{userAgent:i}=j.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}var N0=m(()=>{wt()});var D0,L0,oo,Ap=m(()=>{"use strict";D0="http://www.w3.org/2000/svg",L0="http://www.w3.org/1999/xhtml",oo=class{constructor(){this.svgRoot=document.createElementNS(D0,"svg"),this.foreignObject=document.createElementNS(D0,"foreignObject"),this.domElement=document.createElementNS(L0,"div"),this.styleElement=document.createElementNS(L0,"style"),this.image=new Image;let{foreignObject:t,svgRoot:e,styleElement:r,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(r),t.appendChild(s)}}});function W0(i){let t=i._stroke,e=i._fill,s=[`div { ${[`color: ${it.shared.setValue(e.color).toHex()}`,`font-size: ${i.fontSize}px`,`font-family: ${i.fontFamily}`,`font-weight: ${i.fontWeight}`,`font-style: ${i.fontStyle}`,`font-variant: ${i.fontVariant}`,`letter-spacing: ${i.letterSpacing}px`,`text-align: ${i.align}`,`padding: ${i.padding}px`,`white-space: ${i.whiteSpace==="pre"&&i.wordWrap?"pre-wrap":i.whiteSpace}`,...i.lineHeight?[`line-height: ${i.lineHeight}px`]:[],...i.wordWrap?[`word-wrap: ${i.breakWords?"break-all":"break-word"}`,`max-width: ${i.wordWrapWidth}px`]:[],...t?[$0(t)]:[],...i.dropShadow?[z0(i.dropShadow)]:[],...i.cssOverrides].join(";")} }`];return QM(i.tagStyles,s),s.join(" ")}function z0(i){let t=it.shared.setValue(i.color).setAlpha(i.alpha).toHexa(),e=Math.round(Math.cos(i.angle)*i.distance),r=Math.round(Math.sin(i.angle)*i.distance),s=`${e}px ${r}px`;return i.blur>0?`text-shadow: ${s} ${i.blur}px ${t}`:`text-shadow: ${s} ${t}`}function $0(i){return[`-webkit-text-stroke-width: ${i.width}px`,`-webkit-text-stroke-color: ${it.shared.setValue(i.color).toHex()}`,`text-stroke-width: ${i.width}px`,`text-stroke-color: ${it.shared.setValue(i.color).toHex()}`,"paint-order: stroke"].join(";")}function QM(i,t){for(let e in i){let r=i[e],s=[];for(let o in r)V0[o]?s.push(V0[o](r[o])):H0[o]&&s.push(H0[o].replace("{{VALUE}}",r[o]));t.push(`${e} { ${s.join(";")} }`)}}var H0,V0,X0=m(()=>{le();H0={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},V0={fill:i=>`color: ${it.shared.setValue(i).toHex()}`,breakWords:i=>`word-wrap: ${i?"break-all":"break-word"}`,stroke:$0,dropShadow:z0}});var hc,j0=m(()=>{vt();Qi();hp();X0();hc=class i extends Kt{constructor(t={}){super(t),this._cssOverrides=[],this.cssOverrides??(this.cssOverrides=t.cssOverrides),this.tagStyles=t.tagStyles??{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=ec(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new i({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?{...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=W0(this)),this._cssStyle}addOverride(...t){let e=t.filter(r=>!this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){let e=t.filter(r=>this.cssOverrides.includes(r));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(r=>!e.includes(r)),this.update())}set fill(t){typeof t!="string"&&typeof t!="number"&&H("[HTMLTextStyle] only color fill is not supported by HTMLText"),super.fill=t}set stroke(t){t&&typeof t!="string"&&typeof t!="number"&&H("[HTMLTextStyle] only color stroke is not supported by HTMLText"),super.stroke=t}}});function Y0(i,t){let e=t.fontFamily,r=[],s={},o=/font-family:([^;"\s]+)/g,n=i.match(o);function a(h){s[h]||(r.push(h),s[h]=!0)}if(Array.isArray(e))for(let h=0;h<e.length;h++)a(e[h]);else a(e);n&&n.forEach(h=>{let l=h.split(":")[1].trim();a(l)});for(let h in t.tagStyles){let l=t.tagStyles[h].fontFamily;a(l)}return r}var q0=m(()=>{"use strict"});async function K0(i){let e=await(await j.get().fetch(i)).blob(),r=new FileReader;return await new Promise((o,n)=>{r.onloadend=()=>o(r.result),r.onerror=n,r.readAsDataURL(e)})}var Z0=m(()=>{wt()});async function Ep(i,t){let e=await K0(t);return`@font-face {
469
469
  font-family: "${i.fontFamily}";
470
470
  src: url('${e}');
471
471
  font-weight: ${i.fontWeight};
472
472
  font-style: ${i.fontStyle};
473
- }`}var C_=p(()=>{A_()});async function M_(i,t,e){let r=i.filter(s=>Q.has(`${s}-and-url`)).map((s,o)=>{if(!_a.has(s)){let{url:n}=Q.get(`${s}-and-url`);o===0?_a.set(s,su({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):_a.set(s,su({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return _a.get(s)});return(await Promise.all(r)).join(`
474
- `)}var _a,B_=p(()=>{tr();C_();_a=new Map});function R_(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:c,height:l}=s.image;return a.setAttribute("width",c.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var G_=p(()=>{"use strict"});function I_(i,t){let e=Jt.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var k_=p(()=>{_i()});function F_(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var U_=p(()=>{"use strict"});function O_(i,t,e,r){r||(r=D_||(D_=new Ei));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let c=t.padding*2;return{width:a.width-c,height:a.height-c}}var D_,L_=p(()=>{iu()});var Pi,N_=p(()=>{P();_i();qe();Be();p_();it();Ut();zh();iu();S_();E_();B_();G_();k_();U_();L_();Pi=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===bt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=W.get(Ei),o=w_(t,r),n=await M_(o,r,xa.defaultTextStyle),a=O_(t,r,n,s),c=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),h=s.image,u=2;h.width=(c|0)+u,h.height=(l|0)+u;let d=R_(t,r,e,n,s);await F_(h,d,f_()&&o.length>0);let f=h,m;this._createCanvas&&(m=I_(h,e));let g=ua(m?m.canvas:f,h.width-u,h.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),Jt.returnCanvasAndContext(m)),W.return(s),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{k("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){ft.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};Pi.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"};Pi.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var ou=p(()=>{P();d_();N_();I.add(Pi);I.add(zs)});var H_,Ai,ya=p(()=>{rr();je();si();dt();H_=class W_ extends ce{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(U(H,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...W_.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new gt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:j.VERTEX|j.COPY_DST}),c=new gt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:j.VERTEX|j.COPY_DST}),l=new gt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:j.INDEX|j.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:c,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.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}};H_.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};Ai=H_});var Dr,z_,Ci,Mi=p(()=>{"use strict";Dr={name:"local-uniform-bit",vertex:{header:`
473
+ }`}var Q0=m(()=>{Z0()});async function J0(i,t,e){let r=i.filter(s=>mt.has(`${s}-and-url`)).map((s,o)=>{if(!lc.has(s)){let{url:n}=mt.get(`${s}-and-url`);o===0?lc.set(s,Ep({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},n)):lc.set(s,Ep({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},n))}return lc.get(s)});return(await Promise.all(r)).join(`
474
+ `)}var lc,tT=m(()=>{pi();Q0();lc=new Map});function eT(i,t,e,r,s){let{domElement:o,styleElement:n,svgRoot:a}=s;o.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${i}</div>`,o.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),n.textContent=r;let{width:h,height:l}=s.image;return a.setAttribute("width",h.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}var rT=m(()=>{"use strict"});function iT(i,t){let e=ke.getOptimalCanvasAndContext(i.width,i.height,t),{context:r}=e;return r.clearRect(0,0,i.width,i.height),r.drawImage(i,0,0),e}var sT=m(()=>{Qs()});function oT(i,t,e){return new Promise(async r=>{e&&await new Promise(s=>setTimeout(s,100)),i.onload=()=>{r()},i.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,i.crossOrigin="anonymous"})}var nT=m(()=>{"use strict"});function hT(i,t,e,r){r||(r=aT||(aT=new oo));let{domElement:s,styleElement:o,svgRoot:n}=r;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${i}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(o.textContent=e),document.body.appendChild(n);let a=s.getBoundingClientRect();n.remove();let h=t.padding*2;return{width:a.width-h,height:a.height-h}}var aT,lT=m(()=>{Ap()});var no,cT=m(()=>{R();Qs();li();Cr();N0();vt();ve();cp();Ap();j0();q0();tT();rT();sT();nT();lT();no=class{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===zt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,r,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;let o=this._buildTexturePromise(t,e,r).then(n=>(this._activeTextures[s].texture=n,n));return this._activeTextures[s]={texture:null,promise:o,usageCount:1},o}async _buildTexturePromise(t,e,r){let s=et.get(oo),o=Y0(t,r),n=await J0(o,r,hc.defaultTextStyle),a=hT(t,r,n,s),h=Math.ceil(Math.ceil(Math.max(1,a.width)+r.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+r.padding*2)*e),c=s.image,u=2;c.width=(h|0)+u,c.height=(l|0)+u;let d=eT(t,r,e,n,s);await oT(c,d,O0()&&o.length>0);let f=c,p;this._createCanvas&&(p=iT(c,e));let g=rc(p?p.canvas:f,c.width-u,c.height-u,e);return this._createCanvas&&(this._renderer.texture.initSource(g.source),ke.returnCanvasAndContext(p)),et.return(s),g}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){let e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(r=>{e.texture=r,this._cleanUp(e)}).catch(()=>{H("HTMLTextSystem: Failed to clean texture")}),this._activeTextures[t]=null))}_cleanUp(t){Gt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}};no.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"htmlText"};no.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"}});var wp=m(()=>{R();k0();cT();D.add(no);D.add(qn)});var uT,ao,cc=m(()=>{gi();jr();Ns();Ft();uT=class dT extends Je{constructor(...t){let e=t[0]??{};e instanceof Float32Array&&(X(tt,"use new MeshGeometry({ positions, uvs, indices }) instead"),e={positions:e,uvs:t[1],indices:t[2]}),e={...dT.defaultOptions,...e};let r=e.positions||new Float32Array([0,0,1,0,1,1,0,1]),s=e.uvs;s||(e.positions?s=new Float32Array(r.length):s=new Float32Array([0,0,1,0,1,1,0,1]));let o=e.indices||new Uint32Array([0,1,2,0,2,3]),n=e.shrinkBuffersToFit,a=new kt({data:r,label:"attribute-mesh-positions",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),h=new kt({data:s,label:"attribute-mesh-uvs",shrinkToFit:n,usage:ot.VERTEX|ot.COPY_DST}),l=new kt({data:o,label:"index-mesh-buffer",shrinkToFit:n,usage:ot.INDEX|ot.COPY_DST});super({attributes:{aPosition:{buffer:a,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:h,format:"float32x2",stride:2*4,offset:0}},indexBuffer:l,topology:e.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}};uT.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};ao=uT});var ts,fT,ho,lo=m(()=>{"use strict";ts={name:"local-uniform-bit",vertex:{header:`
475
475
 
476
476
  struct LocalUniforms {
477
477
  uTransformMatrix:mat3x3<f32>,
@@ -488,7 +488,7 @@ fn mainFragment(
488
488
  {
489
489
  vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
490
490
  }
491
- `}},z_={...Dr,vertex:{...Dr.vertex,header:Dr.vertex.header.replace("group(1)","group(2)")}},Ci={name:"local-uniform-bit",vertex:{header:`
491
+ `}},fT={...ts,vertex:{...ts.vertex,header:ts.vertex.header.replace("group(1)","group(2)")}},ho={name:"local-uniform-bit",vertex:{header:`
492
492
 
493
493
  uniform mat3 uTransformMatrix;
494
494
  uniform vec4 uColor;
@@ -501,7 +501,7 @@ fn mainFragment(
501
501
  {
502
502
  gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
503
503
  }
504
- `}}});var V_,j_,X_=p(()=>{"use strict";V_={name:"tiling-bit",vertex:{header:`
504
+ `}}});var pT,mT,gT=m(()=>{"use strict";pT={name:"tiling-bit",vertex:{header:`
505
505
  struct TilingUniforms {
506
506
  uMapCoord:mat3x3<f32>,
507
507
  uClampFrame:vec4<f32>,
@@ -544,7 +544,7 @@ fn mainFragment(
544
544
  }
545
545
 
546
546
  outColor = textureSampleBias(uTexture, uSampler, coord, bias);
547
- `}},j_={name:"tiling-bit",vertex:{header:`
547
+ `}},mT={name:"tiling-bit",vertex:{header:`
548
548
  uniform mat3 uTextureTransform;
549
549
  uniform vec4 uSizeAnchor;
550
550
 
@@ -566,7 +566,7 @@ fn mainFragment(
566
566
 
567
567
  outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
568
568
 
569
- `}}});var nu,au,ba,$_=p(()=>{K();sr();Mi();or();xe();Nt();tt();X_();ba=class extends xt{constructor(){nu??(nu=Pe({name:"tiling-sprite-shader",bits:[Dr,V_,Ce]})),au??(au=Ae({name:"tiling-sprite-shader",bits:[Ci,j_,Me]}));let t=new st({uMapCoord:{value:new B,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:au,gpuProgram:nu,resources:{localUniforms:new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:M.EMPTY.source,uSampler:M.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,c=n.width,l=n.height,h=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*c/t,r.b*c/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=h.mapCoord,a.uniforms.uClampFrame=h.uClampFrame,a.uniforms.uClampOffset=h.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var va,Y_=p(()=>{ya();va=class extends Ai{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 K_(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var q_=p(()=>{"use strict"});function Z_(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,c=r.c,l=r.d,h=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+c*f+h,i[e+1]=a*d+l*f+u,e+=t,s++}}var Q_=p(()=>{"use strict"});function J_(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=B.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),Z_(t,2,0,a)}var ty=p(()=>{K();Q_()});var Ta,Vs,ey=p(()=>{P();vs();_e();Be();gi();Kn();ya();$_();Y_();q_();ty();Ta=new va,Vs=class{constructor(t){this._state=_t.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new nr);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new ba),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Re(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Ve(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Ta,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new Ai({indices:Ta.indices,positions:Ta.positions.slice(),uvs:Ta.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),J_(t,r.uvs),K_(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===bt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Vs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"tilingSprite"}});var cu=p(()=>{P();ey();I.add(Vs)});var ry,sy,oy=p(()=>{dt();ya();ry=class iy extends Ai{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(U(H,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...iy.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,c=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*c,f*l),s.push(d/n,f/a)}let h=n*a;for(let u=0;u<h;u++){let d=u%n,f=u/n|0,m=f*this.verticesX+d,g=f*this.verticesX+d+1,_=(f+1)*this.verticesX+d,b=(f+1)*this.verticesX+d+1;o.push(m,g,_,g,b,_)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};ry.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};sy=ry});var ny,cy,ly=p(()=>{oy();ny=class ay extends sy{constructor(t={}){t={...ay.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:c,_anchorY:l}=this,h=s+o,u=e>h?1:e/h,d=n+a,f=r>d?1:r/d,m=Math.min(u,f),g=c*e,_=l*r;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*m-g,t[4]=t[12]=t[20]=t[28]=e-o*m-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-_,t[9]=t[11]=t[13]=t[15]=n*m-_,t[17]=t[19]=t[21]=t[23]=r-a*m-_,t[25]=t[27]=t[29]=t[31]=r-_,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};ny.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};cy=ny});var js,hy=p(()=>{P();Ut();Kn();ly();js=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e.geometry),W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(nr);return e.geometry=W.get(cy),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"}});var lu=p(()=>{P();hy();I.add(js)});var Xs,uy=p(()=>{P();Xs=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Xs.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"}});function dy(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var fy=p(()=>{"use strict"});var Yw,$s,py=p(()=>{P();K();ne();er();si();Nt();tt();qe();Be();$t();fy();it();Yw=new ce({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),$s=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new st({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Pt({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?dy(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let m=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;m&&o.applyMatrix(m)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,c=0,l=!0,h=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let m=r[f];if(a=Math.min(a,m.resolution==="inherit"?n._resolution:m.resolution),c+=m.padding,m.antialias==="off"?l=!1:m.antialias==="inherit"&&l&&(l=n.antialias),m.clipToViewport||(d=!1),!!!(m.compatibleRenderers&e.type)){u=!1;break}if(m.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){k("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=m.enabled||u,h||(h=m.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,m=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/m,0,f.height/m)}if(o.scale(a).ceil().scale(1/a).pad(c|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=h,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=ft.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=M.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,c=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(c,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),ft.returnTexture(r);else{let a=e.inputTexture,c=ft.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,c,!0);let u=a;a=c,c=u}n[l].apply(this,a,e.previousRenderSurface,!1),ft.returnTexture(a),ft.returnTexture(c)}e.blendRequired&&ft.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=ft.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let c=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:c,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,c=$.shared,h=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,m=f.uniforms,g=m.uOutputFrame,_=m.uInputSize,b=m.uInputPixel,y=m.uInputClamp,v=m.uGlobalFrame,S=m.uOutputTexture;if(h){let w=this._filterStackIndex;for(;w>0;){w--;let A=this._filterStack[this._filterStackIndex-1];if(!A.skip){c.x=A.bounds.minX,c.y=A.bounds.minY;break}}g[0]=a.minX-c.x,g[1]=a.minY-c.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,_[0]=e.source.width,_[1]=e.source.height,_[2]=1/_[0],_[3]=1/_[1],b[0]=e.source.pixelWidth,b[1]=e.source.pixelHeight,b[2]=1/b[0],b[3]=1/b[1],y[0]=.5*b[2],y[1]=.5*b[3],y[2]=e.frame.width*_[2]-.5*b[2],y[3]=e.frame.height*_[3]-.5*b[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=c.x*u,v[1]=c.y*u,v[2]=E.source.width*u,v[3]=E.source.height*u;let T=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof M?(S[0]=r.frame.width,S[1]=r.frame.height):(S[0]=T.width,S[1]=T.height),S[2]=T.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let w=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(w,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:Yw,shader:t,state:t._state,topology:"triangle-list"}),o.type===bt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new rt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(B.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};$s.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"}});var hu=p(()=>{P();uy();py();I.add($s);I.add(Xs)});var Kw={};var my=p(()=>{gp();dl();wp();Pp();wn();Rn();yh();bh();wh();Xh();ru();ou();cu();lu();hu()});var qw={};var xy=p(()=>{dl();wn();Rn();yh();bh();wh();Xh();ru();ou();cu();lu();hu()});var yy,by,vy=p(()=>{Mr();ni();xe();_e();yy=class uu extends xt{constructor(t){t={...uu.defaultOptions,...t},super(t),this.enabled=!0,this._state=_t.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=he.from(e)),r&&(n=le.from(r)),new uu({gpuProgram:o,glProgram:n,...s})}};yy.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};by=yy});async function Ty(i){if(!i)for(let t=0;t<du.length;t++){let e=du[t];if(e.value.test()){await e.value.load();return}}}var du,Sy=p(()=>{P();du=[];I.handleByNamedList(x.Environment,du)});function Sa(){if(typeof Ys=="boolean")return Ys;try{Ys=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{Ys=!1}return Ys}var Ys,fu=p(()=>{"use strict"});var Ct,Bi=p(()=>{"use strict";Ct=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(Ct||{})});var Ri,pu=p(()=>{"use strict";Ri=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,c){let{name:l,items:h}=this;for(let u=0,d=h.length;u<d;u++)h[u][l](t,e,r,s,o,n,a,c);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var Zw,wy,cr,Ks=p(()=>{Mt();Sy();me();fu();dt();Bi();pu();It();Zw=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],wy=class Ey extends ot{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;let e=[...Zw,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await Ty(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...Ey.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof nt&&(r={container:r},e&&(U(H,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:V.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=Ct.ALL);let{clear:r,clearColor:s,target:o}=t;V.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,V.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new Ri(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(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(!Sa())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()}};wy.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};cr=wy});var qs,Cy=p(()=>{P();K();Ar();kn();sr();ws();Es();Mi();or();xe();Nt();qs=class{init(){let t=new st({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Pe({name:"graphics",bits:[ai,li(ae()),z_,Ce]});this.shader=new xt({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let h=o.globalUniforms.bindGroup;l.setBindGroup(0,h,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=c.instructions,f=null;for(let m=0;m<c.instructionSize;m++){let g=d[m];if(g.topology!==f&&(f=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let _=g.textures;g.bindGroup=ii(_.textures,_.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};qs.extension={type:[x.WebGPUPipesAdaptor],name:"graphics"}});var My,By,mu=p(()=>{"use strict";My={name:"texture-bit",vertex:{header:`
569
+ `}}});var Cp,Pp,uc,xT=m(()=>{dt();_i();lo();yi();dr();Ae();xt();gT();uc=class extends Ot{constructor(){Cp??(Cp=Sr({name:"tiling-sprite-shader",bits:[ts,pT,Er]})),Pp??(Pp=Ar({name:"tiling-sprite-shader",bits:[ho,mT,wr]}));let t=new Tt({uMapCoord:{value:new U,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new U,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Pp,gpuProgram:Cp,resources:{localUniforms:new Tt({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:I.EMPTY.source,uSampler:I.EMPTY.source.style}})}updateUniforms(t,e,r,s,o,n){let a=this.resources.tilingUniforms,h=n.width,l=n.height,c=n.textureMatrix,u=a.uniforms.uTextureTransform;u.set(r.a*h/t,r.b*h/e,r.c*l/t,r.d*l/e,r.tx/t,r.ty/e),u.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=u,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=o,n&&(this.resources.uTexture=n.source,this.resources.uSampler=n.source.style)}}});var dc,_T=m(()=>{cc();dc=class extends ao{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 yT(i,t){let e=i.anchor.x,r=i.anchor.y;t[0]=-e*i.width,t[1]=-r*i.height,t[2]=(1-e)*i.width,t[3]=-r*i.height,t[4]=(1-e)*i.width,t[5]=(1-r)*i.height,t[6]=-e*i.width,t[7]=(1-r)*i.height}var bT=m(()=>{"use strict"});function vT(i,t,e,r){let s=0,o=i.length/(t||2),n=r.a,a=r.b,h=r.c,l=r.d,c=r.tx,u=r.ty;for(e*=t;s<o;){let d=i[e],f=i[e+1];i[e]=n*d+h*f+c,i[e+1]=a*d+l*f+u,e+=t,s++}}var TT=m(()=>{"use strict"});function ST(i,t){let e=i.texture,r=e.frame.width,s=e.frame.height,o=0,n=0;i.applyAnchorToTexture&&(o=i.anchor.x,n=i.anchor.y),t[0]=t[6]=-o,t[2]=t[4]=1-o,t[1]=t[3]=-n,t[5]=t[7]=1-n;let a=U.shared;a.copyFrom(i._tileTransform.matrix),a.tx/=i.width,a.ty/=i.height,a.invert(),a.scale(i.width/r,i.height/s),vT(t,2,0,a)}var AT=m(()=>{dt();TT()});var fc,Kn,ET=m(()=>{R();Cn();fr();Cr();Ks();Ll();cc();xT();_T();bT();AT();fc=new dc,Kn=class{constructor(t){this._state=Lt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_tilingSpriteDataHash")}validateRenderable(t){let e=this._getTilingSpriteData(t),r=e.canBatch;this._updateCanBatch(t);let s=e.canBatch;if(s&&s===r){let{batchableMesh:o}=e;return!o._batcher.checkAndUpdateTexture(o,t.texture)}return r!==s}addRenderable(t,e){let r=this._renderer.renderPipes.batch;this._updateCanBatch(t);let s=this._getTilingSpriteData(t),{geometry:o,canBatch:n}=s;if(n){s.batchableMesh||(s.batchableMesh=new bi);let a=s.batchableMesh;t.didViewUpdate&&(this._updateBatchableMesh(t),a.geometry=o,a.renderable=t,a.transform=t.groupTransform,a.setTexture(t._texture)),a.roundPixels=this._renderer._roundPixels|t._roundPixels,r.addToBatch(a,e)}else r.break(e),s.shader||(s.shader=new uc),this.updateRenderable(t),e.add(t)}execute(t){let{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;let r=e.resources.localUniforms.uniforms;r.uTransformMatrix=t.groupTransform,r.uRound=this._renderer._roundPixels|t._roundPixels,Pr(t.groupColorAlpha,r.uColor,0),this._state.blendMode=Xr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:fc,shader:e,state:this._state})}updateRenderable(t){let e=this._getTilingSpriteData(t),{canBatch:r}=e;if(r){let{batchableMesh:s}=e;t.didViewUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t.didViewUpdate){let{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}}destroyRenderable(t){let e=this._getTilingSpriteData(t);e.batchableMesh=null,e.shader?.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){let e=new ao({indices:fc.indices,positions:fc.positions.slice(),uvs:fc.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){let e=this._getTilingSpriteData(t),{geometry:r}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),ST(t,r.uvs),yT(t,r.positions)}destroy(){for(let t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){let e=this._getTilingSpriteData(t),r=t.texture,s=!0;return this._renderer.type===zt.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=r.textureMatrix.isSimple&&(s||r.source.isPowerOfTwo),e.canBatch}};Kn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"tilingSprite"}});var Rp=m(()=>{R();ET();D.add(Kn)});var wT,PT,RT=m(()=>{Ft();cc();wT=class CT extends ao{constructor(...t){super({});let e=t[0]??{};typeof e=="number"&&(X(tt,"PlaneGeometry constructor changed please use { width, height, verticesX, verticesY } instead"),e={width:e,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(e)}build(t){t={...CT.defaultOptions,...t},this.verticesX=this.verticesX??t.verticesX,this.verticesY=this.verticesY??t.verticesY,this.width=this.width??t.width,this.height=this.height??t.height;let e=this.verticesX*this.verticesY,r=[],s=[],o=[],n=this.verticesX-1,a=this.verticesY-1,h=this.width/n,l=this.height/a;for(let u=0;u<e;u++){let d=u%this.verticesX,f=u/this.verticesX|0;r.push(d*h,f*l),s.push(d/n,f/a)}let c=n*a;for(let u=0;u<c;u++){let d=u%n,f=u/n|0,p=f*this.verticesX+d,g=f*this.verticesX+d+1,x=(f+1)*this.verticesX+d,v=(f+1)*this.verticesX+d+1;o.push(p,g,x,g,v,x)}this.buffers[0].data=new Float32Array(r),this.buffers[1].data=new Float32Array(s),this.indexBuffer.data=new Uint32Array(o),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};wT.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};PT=wT});var MT,IT,FT=m(()=>{RT();MT=class BT extends PT{constructor(t={}){t={...BT.defaultOptions,...t},super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){this.width=t.width??this.width,this.height=t.height??this.height,this._originalWidth=t.originalWidth??this._originalWidth,this._originalHeight=t.originalHeight??this._originalHeight,this._leftWidth=t.leftWidth??this._leftWidth,this._rightWidth=t.rightWidth??this._rightWidth,this._topHeight=t.topHeight??this._topHeight,this._bottomHeight=t.bottomHeight??this._bottomHeight,this._anchorX=t.anchor?.x,this._anchorY=t.anchor?.y,this.updateUvs(),this.updatePositions()}updatePositions(){let t=this.positions,{width:e,height:r,_leftWidth:s,_rightWidth:o,_topHeight:n,_bottomHeight:a,_anchorX:h,_anchorY:l}=this,c=s+o,u=e>c?1:e/c,d=n+a,f=r>d?1:r/d,p=Math.min(u,f),g=h*e,x=l*r;t[0]=t[8]=t[16]=t[24]=-g,t[2]=t[10]=t[18]=t[26]=s*p-g,t[4]=t[12]=t[20]=t[28]=e-o*p-g,t[6]=t[14]=t[22]=t[30]=e-g,t[1]=t[3]=t[5]=t[7]=-x,t[9]=t[11]=t[13]=t[15]=n*p-x,t[17]=t[19]=t[21]=t[23]=r-a*p-x,t[25]=t[27]=t[29]=t[31]=r-x,this.getBuffer("aPosition").update()}updateUvs(){let t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;let e=1/this._originalWidth,r=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.getBuffer("aUV").update()}};MT.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};IT=MT});var Zn,GT=m(()=>{R();ve();Ll();FT();Zn=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];et.return(e.geometry),et.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.geometry.update(t),e.setTexture(t._texture)}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=et.get(bi);return e.geometry=et.get(IT),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.didViewUpdate||this._updateBatchableSprite(t,e),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}};Zn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"nineSliceSprite"}});var Mp=m(()=>{R();GT();D.add(Zn)});var Qn,UT=m(()=>{R();Qn=class{constructor(t){this._renderer=t}push(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}};Qn.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"filter"}});function kT(i,t){t.clear();let e=t.matrix;for(let r=0;r<i.length;r++){let s=i[r];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,t.addBounds(s.bounds))}return t.matrix=e,t}var OT=m(()=>{"use strict"});var JM,Jn,NT=m(()=>{R();dt();Ze();mi();Ns();Ae();xt();li();Cr();Me();OT();vt();JM=new Je({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])}),Jn=class{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new Tt({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new ie({}),this.renderer=t}get activeBackTexture(){return this._activeFilterData?.backTexture}push(t){let e=this.renderer,r=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());let s=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,r.length===0){s.skip=!0;return}let o=s.bounds;if(t.renderables?kT(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):t.container.getFastGlobalBounds(!0,o),t.container){let p=(t.container.renderGroup||t.container.parentRenderGroup).cacheToLocalTransform;p&&o.applyMatrix(p)}let n=e.renderTarget.renderTarget.colorTexture.source,a=1/0,h=0,l=!0,c=!1,u=!1,d=!0;for(let f=0;f<r.length;f++){let p=r[f];if(a=Math.min(a,p.resolution==="inherit"?n._resolution:p.resolution),h+=p.padding,p.antialias==="off"?l=!1:p.antialias==="inherit"&&l&&(l=n.antialias),p.clipToViewport||(d=!1),!!!(p.compatibleRenderers&e.type)){u=!1;break}if(p.blendRequired&&!(e.backBuffer?.useBackBuffer??!0)){H("Blend filter requires backBuffer on WebGL renderer to be enabled. Set `useBackBuffer: true` in the renderer options."),u=!1;break}u=p.enabled||u,c||(c=p.blendRequired)}if(!u){s.skip=!0;return}if(d){let f=e.renderTarget.rootViewPort,p=e.renderTarget.renderTarget.resolution;o.fitBounds(0,f.width/p,0,f.height/p)}if(o.scale(a).ceil().scale(1/a).pad(h|0),!o.isPositive){s.skip=!0;return}s.skip=!1,s.bounds=o,s.blendRequired=c,s.container=t.container,s.filterEffect=t.filterEffect,s.previousRenderSurface=e.renderTarget.renderSurface,s.inputTexture=Gt.getOptimalTexture(o.width,o.height,a,l),e.renderTarget.bind(s.inputTexture,!0),e.globalUniforms.push({offset:o})}pop(){let t=this.renderer;this._filterStackIndex--;let e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;let r=e.inputTexture,s=e.bounds,o=I.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){let a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,h=t.renderTarget.getRenderTarget(e.previousRenderSurface);o=this.getBackTexture(h,s,a)}e.backTexture=o;let n=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(r.source.style,2),this._globalFilterBindGroup.setResource(o.source,3),t.globalUniforms.pop(),n.length===1)n[0].apply(this,r,e.previousRenderSurface,!1),Gt.returnTexture(r);else{let a=e.inputTexture,h=Gt.getOptimalTexture(s.width,s.height,a.source._resolution,!1),l=0;for(l=0;l<n.length-1;++l){n[l].apply(this,a,h,!0);let u=a;a=h,h=u}n[l].apply(this,a,e.previousRenderSurface,!1),Gt.returnTexture(a),Gt.returnTexture(h)}e.blendRequired&&Gt.returnTexture(o)}getBackTexture(t,e,r){let s=t.colorTexture.source._resolution,o=Gt.getOptimalTexture(e.width,e.height,s,!1),n=e.minX,a=e.minY;r&&(n-=r.minX,a-=r.minY),n=Math.floor(n*s),a=Math.floor(a*s);let h=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,o,{x:n,y:a},{width:h,height:l},{x:0,y:0}),o}applyFilter(t,e,r,s){let o=this.renderer,n=this._filterStack[this._filterStackIndex],a=n.bounds,h=at.shared,c=n.previousRenderSurface===r,u=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,d=this._filterStackIndex-1;for(;d>0&&this._filterStack[d].skip;)--d;d>0&&(u=this._filterStack[d].inputTexture.source._resolution);let f=this._filterGlobalUniforms,p=f.uniforms,g=p.uOutputFrame,x=p.uInputSize,v=p.uInputPixel,_=p.uInputClamp,b=p.uGlobalFrame,T=p.uOutputTexture;if(c){let C=this._filterStackIndex;for(;C>0;){C--;let M=this._filterStack[this._filterStackIndex-1];if(!M.skip){h.x=M.bounds.minX,h.y=M.bounds.minY;break}}g[0]=a.minX-h.x,g[1]=a.minY-h.y}else g[0]=0,g[1]=0;g[2]=e.frame.width,g[3]=e.frame.height,x[0]=e.source.width,x[1]=e.source.height,x[2]=1/x[0],x[3]=1/x[1],v[0]=e.source.pixelWidth,v[1]=e.source.pixelHeight,v[2]=1/v[0],v[3]=1/v[1],_[0]=.5*v[2],_[1]=.5*v[3],_[2]=e.frame.width*x[2]-.5*v[2],_[3]=e.frame.height*x[3]-.5*v[3];let E=this.renderer.renderTarget.rootRenderTarget.colorTexture;b[0]=h.x*u,b[1]=h.y*u,b[2]=E.source.width*u,b[3]=E.source.height*u;let A=this.renderer.renderTarget.getRenderTarget(r);if(o.renderTarget.bind(r,!!s),r instanceof I?(T[0]=r.frame.width,T[1]=r.frame.height):(T[0]=A.width,T[1]=A.height),T[2]=A.isRoot?-1:1,f.update(),o.renderPipes.uniformBatch){let C=o.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(C,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,o.encoder.draw({geometry:JM,shader:t,state:t._state,topology:"triangle-list"}),o.type===zt.WEBGL&&o.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new bt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){let r=this._activeFilterData,s=t.set(r.inputTexture._source.width,0,0,r.inputTexture._source.height,r.bounds.minX,r.bounds.minY),o=e.worldTransform.copyTo(U.shared),n=e.renderGroup||e.parentRenderGroup;return n&&n.cacheToLocalTransform&&o.prepend(n.cacheToLocalTransform),o.invert(),s.prepend(o),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}};Jn.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"filter"}});var Bp=m(()=>{R();UT();NT();D.add(Jn);D.add(Qn)});var tB={};var DT=m(()=>{L_();Fd();Y_();K_();pl();vl();Lf();Hf();$f();fp();Sp();wp();Rp();Mp();Bp()});var eB={};var HT=m(()=>{Fd();pl();vl();Lf();Hf();$f();fp();Sp();wp();Rp();Mp();Bp()});var WT,zT,$T=m(()=>{Xi();Ls();dr();fr();WT=class Ip extends Ot{constructor(t){t={...Ip.defaultOptions,...t},super(t),this.enabled=!0,this._state=Lt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.clipToViewport=t.clipToViewport,this.addResource("uTexture",0,1)}apply(t,e,r,s){t.applyFilter(this,e,r,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){let{gpu:e,gl:r,...s}=t,o,n;return e&&(o=er.from(e)),r&&(n=tr.from(r)),new Ip({gpuProgram:o,glProgram:n,...s})}};WT.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1,clipToViewport:!0};zT=WT});async function XT(i){if(!i)for(let t=0;t<Fp.length;t++){let e=Fp[t];if(e.value.test()){await e.value.load();return}}}var Fp,jT=m(()=>{R();Fp=[];D.handleByNamedList(y.Environment,Fp)});function pc(){if(typeof ta=="boolean")return ta;try{ta=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{ta=!1}return ta}var ta,Gp=m(()=>{"use strict"});var se,co=m(()=>{"use strict";se=(i=>(i[i.NONE=0]="NONE",i[i.COLOR=16384]="COLOR",i[i.STENCIL=1024]="STENCIL",i[i.DEPTH=256]="DEPTH",i[i.COLOR_DEPTH=16640]="COLOR_DEPTH",i[i.COLOR_STENCIL=17408]="COLOR_STENCIL",i[i.DEPTH_STENCIL=1280]="DEPTH_STENCIL",i[i.ALL=17664]="ALL",i))(se||{})});var uo,Up=m(()=>{"use strict";uo=class{constructor(t){this.items=[],this._name=t}emit(t,e,r,s,o,n,a,h){let{name:l,items:c}=this;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}});var rB,YT,Ti,ea=m(()=>{le();jT();cr();Gp();Ft();co();Up();me();rB=["init","destroy","contextChange","resolutionChange","resetState","renderEnd","renderStart","render","update","postrender","prerender"],YT=class qT extends At{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;let e=[...rB,...this.config.runners??[]];this._addRunners(...e),this._unsafeEvalCheck()}async init(t={}){let e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await XT(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(let r in this._systemsHash)t={...this._systemsHash[r].constructor.defaultOptions,...t};t={...qT.defaultOptions,...t},this._roundPixels=t.roundPixels?1:0;for(let r=0;r<this.runners.init.items.length;r++)await this.runners.init.items[r].init(t);this._initOptions=t}render(t,e){let r=t;if(r instanceof Et&&(r={container:r},e&&(X(tt,"passing a second argument is deprecated, please use render options instead"),r.target=e.renderTexture)),r.target||(r.target=this.view.renderTarget),r.target===this.view.renderTarget&&(this._lastObjectRendered=r.container,r.clearColor??(r.clearColor=this.background.colorRgba),r.clear??(r.clear=this.background.clearBeforeRender)),r.clearColor){let s=Array.isArray(r.clearColor)&&r.clearColor.length===4;r.clearColor=s?r.clearColor:it.shared.setValue(r.clearColor).toArray()}r.transform||(r.container.updateLocalTransform(),r.transform=r.container.localTransform),r.container.enableRenderGroup(),this.runners.prerender.emit(r),this.runners.renderStart.emit(r),this.runners.render.emit(r),this.runners.renderEnd.emit(r),this.runners.postrender.emit(r)}resize(t,e,r){let s=this.view.resolution;this.view.resize(t,e,r),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),r!==void 0&&r!==s&&this.runners.resolutionChange.emit(r)}clear(t={}){let e=this;t.target||(t.target=e.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),t.clear??(t.clear=se.ALL);let{clear:r,clearColor:s,target:o}=t;it.shared.setValue(s??this.background.colorRgba),e.renderTarget.clear(o,r,it.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new uo(e)})}_addSystems(t){let e;for(e in t){let r=t[e];this._addSystem(r.value,r.name)}}_addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}_addPipes(t,e){let r=e.reduce((s,o)=>(s[o.name]=o.value,s),{});t.forEach(s=>{let o=s.value,n=s.name,a=r[n];this.renderPipes[n]=new o(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(!pc())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()}};YT.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};Ti=YT});var ra,QT=m(()=>{R();dt();zi();Al();_i();Mn();Bn();lo();yi();dr();Ae();ra=class{init(){let t=new Tt({uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=Sr({name:"graphics",bits:[Hs,Ws(Qe()),fT,Er]});this.shader=new Ot({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r),l=o.encoder;l.setGeometry(a.geometry,s.gpuProgram);let c=o.globalUniforms.bindGroup;l.setBindGroup(0,c,s.gpuProgram);let u=o.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,u,s.gpuProgram);let d=h.instructions,f=null;for(let p=0;p<h.instructionSize;p++){let g=d[p];if(g.topology!==f&&(f=g.topology,l.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state,g.topology)),s.groups[1]=g.bindGroup,!g.gpuBindGroup){let x=g.textures;g.bindGroup=Os(x.textures,x.count),g.gpuBindGroup=o.bindGroup.getBindGroup(g.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,g.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(g.size,1,g.start)}}destroy(){this.shader.destroy(!0),this.shader=null}};ra.extension={type:[y.WebGPUPipesAdaptor],name:"graphics"}});var JT,tS,kp=m(()=>{"use strict";JT={name:"texture-bit",vertex:{header:`
570
570
 
571
571
  struct TextureUniforms {
572
572
  uTextureMatrix:mat3x3<f32>,
@@ -582,7 +582,7 @@ fn mainFragment(
582
582
 
583
583
  `,main:`
584
584
  outColor = textureSample(uTexture, uSampler, vUV);
585
- `}},By={name:"texture-bit",vertex:{header:`
585
+ `}},tS={name:"texture-bit",vertex:{header:`
586
586
  uniform mat3 uTextureMatrix;
587
587
  `,main:`
588
588
  uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
@@ -592,7 +592,7 @@ fn mainFragment(
592
592
 
593
593
  `,main:`
594
594
  outColor = texture(uTexture, vUV);
595
- `}}});var Zs,Ry=p(()=>{P();K();sr();Mi();or();mu();xe();tt();it();Zs=class{init(){let t=Pe({name:"mesh",bits:[Dr,My,Ce]});this._shader=new xt({gpuProgram:t,resources:{uTexture:M.EMPTY._source,uSampler:M.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){k("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Zs.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"}});var Pa,Qs,Gy=p(()=>{P();_e();kn();Pa=_t.for2d(),Qs=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),Pa.blendMode="normal",s.pipeline.getPipeline(e,n,Pa);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let c=e.textures;e.bindGroup=ii(c.textures,c.count)}Pa.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,Pa,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};Qs.extension={type:[x.WebGPUPipesAdaptor],name:"batch"}});var Js,Iy=p(()=>{P();Js=class{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}};Js.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"}});function to(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var gu=p(()=>{"use strict"});var Qw,eo,ky=p(()=>{P();K();Ut();ks();gu();Qw=new B,eo=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(W.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=W.get(Ge));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=Qw.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),to(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),to(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};eo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"renderGroup"}});function ro(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var xu=p(()=>{"use strict"});function _u(i,t=!1){tE(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,c=n.index;for(let l=0;l<c;l++){let h=a[l];h.parentRenderGroup===i&&h.relativeRenderGroupDepth===o&&Dy(h,r,0)}ro(a,c),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)_u(i.renderGroupChildren[s],t)}function tE(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=jr(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function Dy(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&Fy&&Uy(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&Fy&&Uy(i,Jw,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)Dy(o[l],t,e);let a=i.parentRenderGroup,c=i;c.renderPipeId&&!a.structureDidChange&&a.updateRenderable(c)}}function Uy(i,t,e){if(e&Kr){i.groupColor=jr(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&ns&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&wr&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var Jw,Fy,Oy=p(()=>{me();xu();$c();Jw=new nt,Fy=wr|Kr|ns});function Ly(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var Ny=p(()=>{"use strict"});var eE,io,Hy=p(()=>{P();K();qe();$t();xu();gu();Oy();Ny();eE=new B,io=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=eE;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),to(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&ft.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=ft.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new rt),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(ft.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ro(t.childrenRenderablesToUpdate.list,0):Ly(t,r),_u(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}ro(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};io.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"renderGroup"}});var so,Wy=p(()=>{P();Ut();ks();so=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];W.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=W.get(Ge);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)W.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};so.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"sprite"}});var Gi,yu=p(()=>{It();Gi="8.9.2"});var oo,no,bu=p(()=>{P();yu();oo=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,Gi)}static destroy(){}};oo.extension=x.Application;no=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,Gi)}destroy(){this._renderer=null}};no.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"initHook",priority:-10}});var vu,Tu,Vy=p(()=>{P();_e();Zl();vu=class zy{constructor(t,e){this.state=_t.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new Ps)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=zy.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};vu.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"batch"};vu._availableBatchers=Object.create(null);Tu=vu;I.handleByMap(x.Batcher,Tu._availableBatchers);I.add(Ps)});var jy,Xy=p(()=>{jy=`in vec2 vMaskCoord;
595
+ `}}});var ia,eS=m(()=>{R();dt();_i();lo();yi();kp();dr();xt();vt();ia=class{init(){let t=Sr({name:"mesh",bits:[ts,JT,Er]});this._shader=new Ot({gpuProgram:t,resources:{uTexture:I.EMPTY._source,uSampler:I.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new U}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(!s)s=this._shader,s.groups[2]=r.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram){H("Mesh shader has no gpuProgram",e.shader);return}let o=s.gpuProgram;if(o.autoAssignGlobalUniforms&&(s.groups[0]=r.globalUniforms.bindGroup),o.autoAssignLocalUniforms){let n=t.localUniforms;s.groups[1]=r.renderPipes.uniformBatch.getUniformBindGroup(n,!0)}r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};ia.extension={type:[y.WebGPUPipesAdaptor],name:"mesh"}});var xc,sa,rS=m(()=>{R();fr();Al();xc=Lt.for2d(),sa=class{start(t,e,r){let s=t.renderer,o=s.encoder,n=r.gpuProgram;this._shader=r,this._geometry=e,o.setGeometry(e,n),xc.blendMode="normal",s.pipeline.getPipeline(e,n,xc);let a=s.globalUniforms.bindGroup;o.resetBindGroup(1),o.setBindGroup(0,a,n)}execute(t,e){let r=this._shader.gpuProgram,s=t.renderer,o=s.encoder;if(!e.bindGroup){let h=e.textures;e.bindGroup=Os(h.textures,h.count)}xc.blendMode=e.blendMode;let n=s.bindGroup.getBindGroup(e.bindGroup,r,1),a=s.pipeline.getPipeline(this._geometry,r,xc,e.topology);e.bindGroup._touch(s.textureGC.count),o.setPipeline(a),o.renderPassEncoder.setBindGroup(1,n),o.renderPassEncoder.drawIndexed(e.size,1,e.start)}};sa.extension={type:[y.WebGPUPipesAdaptor],name:"batch"}});var oa,iS=m(()=>{R();oa=class{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}};oa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"}});function na(i,t){let e=i.instructionSet,r=e.instructions;for(let s=0;s<e.instructionSize;s++){let o=r[s];t[o.renderPipeId].execute(o)}}var Op=m(()=>{"use strict"});var iB,aa,sS=m(()=>{R();dt();ve();Ln();Op();iB=new U,aa=class{constructor(t){this._renderer=t}addRenderGroup(t,e){t.isCachedAsTexture?this._addRenderableCacheAsTexture(t,e):this._addRenderableDirect(t,e)}execute(t){t.isRenderable&&(t.isCachedAsTexture?this._executeCacheAsTexture(t):this._executeDirect(t))}destroy(){this._renderer=null}_addRenderableDirect(t,e){this._renderer.renderPipes.batch.break(e),t._batchableRenderGroup&&(et.return(t._batchableRenderGroup),t._batchableRenderGroup=null),e.add(t)}_addRenderableCacheAsTexture(t,e){let r=t._batchableRenderGroup??(t._batchableRenderGroup=et.get(Rr));r.renderable=t.root,r.transform=t.root.relativeGroupTransform,r.texture=t.texture,r.bounds=t._textureBounds,e.add(t),this._renderer.renderPipes.batch.addToBatch(r,e)}_executeCacheAsTexture(t){if(t.textureNeedsUpdate){t.textureNeedsUpdate=!1;let e=iB.identity().translate(-t._textureBounds.x,-t._textureBounds.y);this._renderer.renderTarget.push(t.texture,!0,null,t.texture.frame),this._renderer.globalUniforms.push({worldTransformMatrix:e,worldColor:4294967295}),na(t,this._renderer.renderPipes),this._renderer.renderTarget.finishRenderPass(),this._renderer.renderTarget.pop(),this._renderer.globalUniforms.pop()}t._batchableRenderGroup._batcher.updateElement(t._batchableRenderGroup),t._batchableRenderGroup._batcher.geometry.buffers[0].update()}_executeDirect(t){this._renderer.globalUniforms.push({worldTransformMatrix:t.inverseParentTextureTransform,worldColor:t.worldColorAlpha}),na(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop()}};aa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"}});function ha(i,t){t||(t=0);for(let e=t;e<i.length&&i[e];e++)i[e]=null}var Np=m(()=>{"use strict"});function Dp(i,t=!1){oB(i);let e=i.childrenToUpdate,r=i.updateTick++;for(let s in e){let o=Number(s),n=e[s],a=n.list,h=n.index;for(let l=0;l<h;l++){let c=a[l];c.parentRenderGroup===i&&c.relativeRenderGroupDepth===o&&aS(c,r,0)}ha(a,h),n.index=0}if(t)for(let s=0;s<i.renderGroupChildren.length;s++)Dp(i.renderGroupChildren[s],t)}function oB(i){let t=i.root,e;if(i.renderGroupParent){let r=i.renderGroupParent;i.worldTransform.appendFrom(t.relativeGroupTransform,r.worldTransform),i.worldColor=Es(t.groupColor,r.worldColor),e=t.groupAlpha*r.worldAlpha}else i.worldTransform.copyFrom(t.localTransform),i.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,i.worldAlpha=e,i.worldColorAlpha=i.worldColor+((e*255|0)<<24)}function aS(i,t,e){if(t===i.updateTick)return;i.updateTick=t,i.didChange=!1;let r=i.localTransform;i.updateLocalTransform();let s=i.parent;if(s&&!s.renderGroup?(e|=i._updateFlags,i.relativeGroupTransform.appendFrom(r,s.relativeGroupTransform),e&oS&&nS(i,s,e)):(e=i._updateFlags,i.relativeGroupTransform.copyFrom(r),e&oS&&nS(i,sB,e)),!i.renderGroup){let o=i.children,n=o.length;for(let l=0;l<n;l++)aS(o[l],t,e);let a=i.parentRenderGroup,h=i;h.renderPipeId&&!a.structureDidChange&&a.updateRenderable(h)}}function nS(i,t,e){if(e&Rs){i.groupColor=Es(i.localColor,t.groupColor);let r=i.localAlpha*t.groupAlpha;r=r<0?0:r>1?1:r,i.groupAlpha=r,i.groupColorAlpha=i.groupColor+((r*255|0)<<24)}e&fn&&(i.groupBlendMode=i.localBlendMode==="inherit"?t.groupBlendMode:i.localBlendMode),e&Hi&&(i.globalDisplayStatus=i.localDisplayStatus&t.globalDisplayStatus),i._updateFlags=0}var sB,oS,hS=m(()=>{cr();Np();fd();sB=new Et,oS=Hi|Rs|fn});function lS(i,t){let{list:e,index:r}=i.childrenRenderablesToUpdate,s=!1;for(let o=0;o<r;o++){let n=e[o];if(s=t[n.renderPipeId].validateRenderable(n),s)break}return i.structureDidChange=s,s}var cS=m(()=>{"use strict"});var nB,la,uS=m(()=>{R();dt();li();Me();Np();Op();hS();cS();nB=new U,la=class{constructor(t){this._renderer=t}render({container:t,transform:e}){let r=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;let o=this._renderer,n=nB;e&&(n=n.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));let a=o.renderPipes;this._updateCachedRenderGroups(t.renderGroup,null),this._updateRenderGroups(t.renderGroup),o.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),na(t.renderGroup,a),a.uniformBatch&&a.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(n),t.parent=r,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}_updateCachedRenderGroups(t,e){if(t.isCachedAsTexture){if(!t.updateCacheTexture)return;e=t}t._parentCacheAsTextureRenderGroup=e;for(let r=t.renderGroupChildren.length-1;r>=0;r--)this._updateCachedRenderGroups(t.renderGroupChildren[r],e);if(t.invalidateMatrices(),t.isCachedAsTexture){if(t.textureNeedsUpdate){let r=t.root.getLocalBounds();r.ceil();let s=t.texture;t.texture&&Gt.returnTexture(t.texture);let o=this._renderer,n=t.textureOptions.resolution||o.view.resolution,a=t.textureOptions.antialias??o.view.antialias;t.texture=Gt.getOptimalTexture(r.width,r.height,n,a),t._textureBounds||(t._textureBounds=new bt),t._textureBounds.copyFrom(r),s!==t.texture&&t.renderGroupParent&&(t.renderGroupParent.structureDidChange=!0)}}else t.texture&&(Gt.returnTexture(t.texture),t.texture=null)}_updateRenderGroups(t){let e=this._renderer,r=e.renderPipes;if(t.runOnRender(e),t.instructionSet.renderPipes=r,t.structureDidChange?ha(t.childrenRenderablesToUpdate.list,0):lS(t,r),Dp(t),t.structureDidChange?(t.structureDidChange=!1,this._buildInstructions(t,e)):this._updateRenderables(t),t.childrenRenderablesToUpdate.index=0,e.renderPipes.batch.upload(t.instructionSet),!(t.isCachedAsTexture&&!t.textureNeedsUpdate))for(let s=0;s<t.renderGroupChildren.length;s++)this._updateRenderGroups(t.renderGroupChildren[s])}_updateRenderables(t){let{list:e,index:r}=t.childrenRenderablesToUpdate;for(let s=0;s<r;s++){let o=e[s];o.didViewUpdate&&t.updateRenderable(o)}ha(e,r)}_buildInstructions(t,e){let r=t.root,s=t.instructionSet;s.reset();let o=e.renderPipes?e:e.batch.renderer,n=o.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),r.sortableChildren&&r.sortChildren(),r.collectRenderablesWithEffects(s,o,null),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}};la.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"}});var ca,dS=m(()=>{R();ve();Ln();ca=class{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_gpuSpriteHash")}addRenderable(t,e){let r=this._getGpuSprite(t);t.didViewUpdate&&this._updateBatchableSprite(t,r),this._renderer.renderPipes.batch.addToBatch(r,e)}updateRenderable(t){let e=this._gpuSpriteHash[t.uid];t.didViewUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){let e=this._getGpuSprite(t);return!e._batcher.checkAndUpdateTexture(e,t._texture)}destroyRenderable(t){let e=this._gpuSpriteHash[t.uid];et.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){e.bounds=t.visualBounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){let e=et.get(Rr);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.visualBounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(let t in this._gpuSpriteHash)et.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}};ca.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"}});var fo,Lp=m(()=>{me();fo="8.9.2"});var ua,da,Hp=m(()=>{R();Lp();ua=class{static init(){globalThis.__PIXI_APP_INIT__?.(this,fo)}static destroy(){}};ua.extension=y.Application;da=class{constructor(t){this._renderer=t}init(){globalThis.__PIXI_RENDERER_INIT__?.(this._renderer,fo)}destroy(){this._renderer=null}};da.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"initHook",priority:-10}});var Vp,Wp,pS=m(()=>{R();fr();yf();Vp=class fS{constructor(t,e){this.state=Lt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null),this.renderer=t,this._adaptor=e,this._adaptor.init?.(this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new In)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(let r in this._activeBatches)this._activeBatches[r].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let r=this._activeBatches[t.batcherName];r||(r=this._activeBatches[t.batcherName]=fS.getBatcher(t.batcherName),r.begin()),this._activeBatch=r}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);let e=this._activeBatches;for(let r in e){let s=e[r],o=s.geometry;o.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),o.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){let e=this._batchersByInstructionSet[t.uid];for(let r in e){let s=e[r],o=s.geometry;s.dirty&&(s.dirty=!1,o.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){let e=t.batcher,r=e.geometry,s=e.shader;this._adaptor.start(this,r,s)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(let t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};Vp.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"batch"};Vp._availableBatchers=Object.create(null);Wp=Vp;D.handleByMap(y.Batcher,Wp._availableBatchers);D.add(In)});var mS,gS=m(()=>{mS=`in vec2 vMaskCoord;
596
596
  in vec2 vTextureCoord;
597
597
 
598
598
  uniform sampler2D uTexture;
@@ -626,7 +626,7 @@ void main(void)
626
626
 
627
627
  finalColor = original * a;
628
628
  }
629
- `});var $y,Yy=p(()=>{$y=`in vec2 aPosition;
629
+ `});var xS,_S=m(()=>{xS=`in vec2 aPosition;
630
630
 
631
631
  out vec2 vTextureCoord;
632
632
  out vec2 vMaskCoord;
@@ -663,7 +663,7 @@ void main(void)
663
663
  vTextureCoord = filterTextureCoord(aPosition);
664
664
  vMaskCoord = getFilterCoord(aPosition);
665
665
  }
666
- `});var Su,Ky=p(()=>{Su=`struct GlobalFilterUniforms {
666
+ `});var zp,yS=m(()=>{zp=`struct GlobalFilterUniforms {
667
667
  uInputSize:vec4<f32>,
668
668
  uInputPixel:vec4<f32>,
669
669
  uInputClamp:vec4<f32>,
@@ -761,9 +761,9 @@ fn mainFragment(
761
761
 
762
762
  return source * a;
763
763
  }
764
- `});var Aa,qy=p(()=>{K();Mr();ni();Nt();il();vy();Xy();Yy();Ky();Aa=class extends by{constructor(t){let{sprite:e,...r}=t,s=new Yr(e.texture),o=new st({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=he.from({vertex:{source:Su,entryPoint:"mainVertex"},fragment:{source:Su,entryPoint:"mainFragment"}}),a=le.from({vertex:$y,fragment:jy,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,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,r,s)}}});var rE,wu,ao,Zy=p(()=>{P();on();qy();$t();is();Pn();Ut();tt();qe();Be();rE=new rt,wu=class extends Le{constructor(){super(),this.filters=[new Aa({sprite:new Lt(M.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}},ao=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=W.get(wu);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=Vr(t.mask.mask,!0,rE);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=ft.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let c=s.sprite;c.texture=a,c.worldTransform.tx=o.minX,c.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===bt.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(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&ft.returnTexture(s.filterTexture),W.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};ao.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"}});var co,Qy=p(()=>{P();co=class{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,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};co.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"}});var lo,Jy=p(()=>{P();Bi();Cr();lo=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let c=this._maskHash.get(o);c.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-c.instructionsStart-1;c.instructionsLength=l;let h=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[h]??(s[h]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(lt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(lt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,Ct.STENCIL),r.stencil.setStencilMode(lt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(lt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(lt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};lo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"stencilMask"}});var Eu,eb,rb=p(()=>{Mt();P();Eu=class tb{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...tb.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(){}};Eu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0};Eu.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};eb=Eu});var ho,uo,ib=p(()=>{P();on();it();ho={};I.handle(x.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ho[i.name]=i.ref},i=>{delete ho[i.name]});uo=class{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,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ho[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ho[e]){k(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Le,r.filters=[new ho[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};uo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"}});var Pu,Au,ob,nb=p(()=>{P();me();tt();Pu={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Au=class sb{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof nt||t instanceof M?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,sb.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let c=new FileReader;c.onload=()=>o(c.result),c.onerror=n,c.readAsDataURL(a)},Pu[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(Pu[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:Pu[e],quality:r});return new Promise((n,a)=>{let c=new FileReader;c.onload=()=>n(c.result),c.onerror=a,c.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof M)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof M?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof nt&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof M?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Au.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"};Au.defaultImageOptions={format:"png",quality:1};ob=Au});var Ca,ab=p(()=>{Yt();tt();Ca=class i extends M{static create(t){return new i({source:new J(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var iE,sE,oE,fo,cb=p(()=>{Mt();P();K();vt();$t();hn();me();ab();iE=new z,sE=new rt,oE=[0,0,0,0],fo=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof nt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:V.shared.setValue(o).toArray():o=oE;let n=t.frame?.copyTo(iE)||Xr(s,sE).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=Ca.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),c=B.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:c,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};fo.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"}});var po,lb=p(()=>{P();K();ne();gi();er();Be();Nt();po=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new B,worldColor:4294967295,offset:new $},c={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let h=l.uniforms;h.uProjectionMatrix=c.projectionMatrix,h.uResolution=c.resolution,h.uWorldTransformMatrix.copyFrom(c.worldTransformMatrix),h.uWorldTransformMatrix.tx-=c.offset.x,h.uWorldTransformMatrix.ty-=c.offset.y,Re(c.worldColor,h.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new Pt,this._activeBindGroups.push(u),u.setResource(l,0)),c.bindGroup=u,this._currentGlobalUniformData=c}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===bt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new st({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};po.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"}});var nE,mo,hb=p(()=>{P();ls();nE=1,mo=class{constructor(){this._tasks=[],this._offset=0}init(){Kt.system.add(this._update,this)}repeat(t,e,r=!0){let s=nE++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Kt.system.remove(this._update,this),this._tasks.length=0}};mo.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0}});function db(i){if(!ub){if(D.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${Gi} (${i}) http://www.pixijs.com/
764
+ `});var _c,bS=m(()=>{dt();Xi();Ls();Ae();Sd();$T();gS();_S();yS();_c=class extends zT{constructor(t){let{sprite:e,...r}=t,s=new Ps(e.texture),o=new Tt({uFilterMatrix:{value:new U,type:"mat3x3<f32>"},uMaskClamp:{value:s.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"},uInverse:{value:t.inverse?1:0,type:"f32"}}),n=er.from({vertex:{source:zp,entryPoint:"mainVertex"},fragment:{source:zp,entryPoint:"mainFragment"}}),a=tr.from({vertex:xS,fragment:mS,name:"mask-filter"});super({...r,gpuProgram:n,glProgram:a,resources:{filterUniforms:o,uMaskTexture:e.texture.source}}),this.sprite=e,this._textureMatrix=s}set inverse(t){this.resources.filterUniforms.uniforms.uInverse=t?1:0}get inverse(){return this.resources.filterUniforms.uniforms.uInverse===1}apply(t,e,r,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,r,s)}}});var aB,$p,fa,vS=m(()=>{R();qh();bS();Me();cn();gl();ve();xt();li();Cr();aB=new bt,$p=class extends Hr{constructor(){super(),this.filters=[new _c({sprite:new de(I.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}},fa=class{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,r){let s=this._renderer;if(s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1,maskedContainer:e}),t.inverse=e._maskOptions.inverse,t.renderMaskToTexture){let o=t.mask;o.includeInBuild=!0,o.collectRenderables(r,s,null),o.includeInBuild=!1}s.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,inverse:e._maskOptions.inverse,canBundle:!1})}pop(t,e,r){this._renderer.renderPipes.batch.break(r),r.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1})}execute(t){let e=this._renderer,r=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){let s=et.get($p);if(s.inverse=t.inverse,r){t.mask.mask.measurable=!0;let o=As(t.mask.mask,!0,aB);t.mask.mask.measurable=!1,o.ceil();let n=e.renderTarget.renderTarget.colorTexture.source,a=Gt.getOptimalTexture(o.width,o.height,n._resolution,n.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:o,worldColor:4294967295});let h=s.sprite;h.texture=a,h.worldTransform.tx=o.minX,h.worldTransform.ty=o.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){let s=this._activeMaskStage[this._activeMaskStage.length-1];r&&(e.type===zt.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(t.action==="popMaskEnd"){e.filter.pop();let s=this._activeMaskStage.pop();r&&Gt.returnTexture(s.filterTexture),et.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}};fa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"alphaMask"}});var pa,TS=m(()=>{R();pa=class{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,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;o[this._colorStackIndex]=o[this._colorStackIndex-1]&t.mask;let n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,r){this._renderer.renderPipes.batch.break(r);let o=this._colorStack;this._colorStackIndex--;let n=o[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,r.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}};pa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"colorMask"}});var ma,SS=m(()=>{R();co();$i();ma=class{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,r){var s;let o=t,n=this._renderer;n.renderPipes.batch.break(r),n.renderPipes.blendMode.setBlendMode(o.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let a=o.mask;a.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});let h=this._maskHash.get(o);h.instructionsStart=r.instructionSize,a.collectRenderables(r,n,null),a.includeInBuild=!1,n.renderPipes.batch.break(r),r.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,inverse:e._maskOptions.inverse,canBundle:!1});let l=r.instructionSize-h.instructionsStart-1;h.instructionsLength=l;let c=n.renderTarget.renderTarget.uid;(s=this._maskStackHash)[c]??(s[c]=0)}pop(t,e,r){let s=t,o=this._renderer;o.renderPipes.batch.break(r),o.renderPipes.blendMode.setBlendMode(s.mask,"none",r),r.add({renderPipeId:"stencilMask",action:"popMaskBegin",inverse:e._maskOptions.inverse,canBundle:!1});let n=this._maskHash.get(t);for(let a=0;a<n.instructionsLength;a++)r.instructions[r.instructionSize++]=r.instructions[n.instructionsStart++];r.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e;let r=this._renderer,s=r.renderTarget.renderTarget.uid,o=(e=this._maskStackHash)[s]??(e[s]=0);t.action==="pushMaskBegin"?(r.renderTarget.ensureDepthStencil(),r.stencil.setStencilMode(Pt.RENDERING_MASK_ADD,o),o++,r.colorMask.setMask(0)):t.action==="pushMaskEnd"?(t.inverse?r.stencil.setStencilMode(Pt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(Pt.MASK_ACTIVE,o),r.colorMask.setMask(15)):t.action==="popMaskBegin"?(r.colorMask.setMask(0),o!==0?r.stencil.setStencilMode(Pt.RENDERING_MASK_REMOVE,o):(r.renderTarget.clear(null,se.STENCIL),r.stencil.setStencilMode(Pt.DISABLED,o)),o--):t.action==="popMaskEnd"&&(t.inverse?r.stencil.setStencilMode(Pt.INVERSE_MASK_ACTIVE,o):r.stencil.setStencilMode(Pt.MASK_ACTIVE,o),r.colorMask.setMask(15)),this._maskStackHash[s]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}};ma.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"stencilMask"}});var Xp,ES,wS=m(()=>{le();R();Xp=class AS{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new it(0),this.color=this._backgroundColor,this.alpha=1}init(t){t={...AS.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(){}};Xp.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0};Xp.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};ES=Xp});var ga,xa,CS=m(()=>{R();qh();vt();ga={};D.handle(y.BlendMode,i=>{if(!i.name)throw new Error("BlendMode extension must have a name property");ga[i.name]=i.ref},i=>{delete ga[i.name]});xa=class{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,r){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(r),this._isAdvanced=!!ga[e],this._isAdvanced&&(this._beginAdvancedBlendMode(r),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);let e=this._activeBlendMode;if(!ga[e]){H(`Unable to assign BlendMode: '${e}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);return}let r=this._filterHash[e];r||(r=this._filterHash[e]=new Hr,r.filters=[new ga[e]]);let s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:r,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(let t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}};xa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"}});var jp,Yp,RS,MS=m(()=>{R();cr();xt();jp={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Yp=class PS{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof Et||t instanceof I?{target:t,...e}:{...e,...t}}async image(t){let e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,PS.defaultImageOptions);let{format:e,quality:r}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((o,n)=>{s.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}let h=new FileReader;h.onload=()=>o(h.result),h.onerror=n,h.readAsDataURL(a)},jp[e],r)});if(s.toDataURL!==void 0)return s.toDataURL(jp[e],r);if(s.convertToBlob!==void 0){let o=await s.convertToBlob({type:jp[e],quality:r});return new Promise((n,a)=>{let h=new FileReader;h.onload=()=>n(h.result),h.onerror=a,h.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer;if(e instanceof I)return r.texture.generateCanvas(e);let s=r.textureGenerator.generateTexture(t),o=r.texture.generateCanvas(s);return s.destroy(!0),o}pixels(t){t=this._normalizeOptions(t);let e=t.target,r=this._renderer,s=e instanceof I?e:r.textureGenerator.generateTexture(t),o=r.texture.getPixels(s);return e instanceof Et&&s.destroy(!0),o}texture(t){return t=this._normalizeOptions(t),t.target instanceof I?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){t=this._normalizeOptions(t);let e=this.canvas(t),r=document.createElement("a");r.download=t.filename??"image.png",r.href=e.toDataURL("image/png"),document.body.appendChild(r),r.click(),document.body.removeChild(r)}log(t){let e=t.width??200;t=this._normalizeOptions(t);let r=this.canvas(t),s=r.toDataURL();console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);let o=["font-size: 1px;",`padding: ${e}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Yp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"};Yp.defaultImageOptions={format:"png",quality:1};RS=Yp});var yc,BS=m(()=>{Be();xt();yc=class i extends I{static create(t){return new i({source:new gt(t)})}resize(t,e,r){return this.source.resize(t,e,r),this}}});var hB,lB,cB,_a,IS=m(()=>{le();R();dt();Yt();Me();tl();cr();BS();hB=new rt,lB=new bt,cB=[0,0,0,0],_a=class{constructor(t){this._renderer=t}generateTexture(t){t instanceof Et&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});let e=t.resolution||this._renderer.resolution,r=t.antialias||this._renderer.view.antialias,s=t.target,o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:it.shared.setValue(o).toArray():o=cB;let n=t.frame?.copyTo(hB)||ws(s,lB).rectangle;n.width=Math.max(n.width,1/e)|0,n.height=Math.max(n.height,1/e)|0;let a=yc.create({...t.textureSourceOptions,width:n.width,height:n.height,resolution:e,antialias:r}),h=U.shared.translate(-n.x,-n.y);return this._renderer.render({container:s,transform:h,target:a,clearColor:o}),a.source.updateMipmaps(),a}destroy(){this._renderer=null}};_a.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"}});var ya,FS=m(()=>{R();dt();Ze();Ks();mi();Cr();Ae();ya=class{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:r,worldColor:s,offset:o}){let n=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:n,worldTransformMatrix:new U,worldColor:4294967295,offset:new at},h={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||n.size,worldTransformMatrix:r||a.worldTransformMatrix,worldColor:s||a.worldColor,offset:o||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);let c=l.uniforms;c.uProjectionMatrix=h.projectionMatrix,c.uResolution=h.resolution,c.uWorldTransformMatrix.copyFrom(h.worldTransformMatrix),c.uWorldTransformMatrix.tx-=h.offset.x,c.uWorldTransformMatrix.ty-=h.offset.y,Pr(h.worldColor,c.uWorldColorAlpha,0),l.update();let u;this._renderer.renderPipes.uniformBatch?u=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(u=this._bindGroupPool.pop()||new ie,this._activeBindGroups.push(u),u.setResource(l,0)),h.bindGroup=u,this._currentGlobalUniformData=h}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===zt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get globalUniformData(){return this._currentGlobalUniformData}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new Tt({uProjectionMatrix:{value:new U,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new U,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}};ya.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"}});var uB,ba,GS=m(()=>{R();mn();uB=1,ba=class{constructor(){this._tasks=[],this._offset=0}init(){Ie.system.add(this._update,this)}repeat(t,e,r=!0){let s=uB++,o=0;return r&&(this._offset+=1e3,o=this._offset),this._tasks.push({func:t,duration:e,start:performance.now(),offset:o,last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){let t=performance.now();for(let e=0;e<this._tasks.length;e++){let r=this._tasks[e];if(t-r.offset-r.last>=r.duration){let s=t-r.start;r.func(s),r.last=t}}}destroy(){Ie.system.remove(this._update,this),this._tasks.length=0}};ba.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0}});function kS(i){if(!US){if(j.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){let t=[`%c %c %c %c %c PixiJS %c v${fo} (${i}) http://www.pixijs.com/
765
765
 
766
- `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Gi} - ${i} - http://www.pixijs.com/`);ub=!0}}var ub,fb=p(()=>{ct();yu();ub=!1});var Ii,pb=p(()=>{P();fb();Be();Ii=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===bt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),db(e)}}};Ii.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2};Ii.defaultOptions={hello:!1}});function mb(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function gb(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var xb=p(()=>{"use strict"});var aE,Cu,yb,bb=p(()=>{P();xb();aE=0,Cu=class _b{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={..._b.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(let e of this._managedHashes)e.context[e.hash]=mb(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)gb(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=aE++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,c=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===c&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};Cu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC",priority:0};Cu.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};yb=Cu});var Mu,Tb,Sb=p(()=>{P();Mu=class vb{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...vb.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??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(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Mu.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"};Mu.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};Tb=Mu});var wb,go,Bu=p(()=>{Rt();Yt();tt();wb=class Eb{constructor(t={}){if(this.uid=X("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...Eb.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new J({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let 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 M||t.depthStencilTexture instanceof J?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let 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 J({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}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)}};wb.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};go=wb});function Ma(i,t){if(!xo.has(i)){let e=new M({source:new kt({resource:i,...t})}),r=()=>{xo.get(i)===e&&xo.delete(i)};e.once("destroy",r),e.source.once("destroy",r),xo.set(i,e)}return xo.get(i)}var xo,Ru=p(()=>{Jr();tt();xo=new Map});var Gu,Ab,Cb=p(()=>{ct();P();vt();dt();Bu();Ru();Gu=class Pb{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={...Pb.defaultOptions,...t},t.view&&(U(H,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new z(0,0,t.width,t.height),this.canvas=t.canvas||D.get().createCanvas(),this.antialias=!!t.antialias,this.texture=Ma(this.canvas,t),this.renderTarget=new go({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Gu.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0};Gu.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};Ab=Gu});var Ba,Ra,Iu=p(()=>{Iy();ky();Hy();Wy();bu();Vy();Zy();Qy();Jy();rb();ib();nb();cb();lb();hb();pb();bb();Sb();Cb();Ba=[eb,po,Ii,Ab,io,Tb,fo,ob,no,yb,mo],Ra=[uo,Tu,so,eo,ao,lo,co,Js]});var _o,Mb=p(()=>{P();_o=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let h in o){let u=t.resources[h]??t.resources[o[h]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let m=f.buffer;d={buffer:a.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[h],resource:d})}let c=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:c,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};_o.extension={type:[x.WebGPUSystem],name:"bindGroup"}});var yo,Bb=p(()=>{P();kl();yo=class{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){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let 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));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(bs(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};yo.extension={type:[x.WebGPUSystem],name:"buffer"}});var bo,Rb=p(()=>{P();bo=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};bo.extension={type:[x.WebGPUSystem],name:"colorMask"}});var ki,Gb=p(()=>{ct();P();ki=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await D.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};ki.extension={type:[x.WebGPUSystem],name:"device"};ki.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var vo,Ib=p(()=>{P();vo=class{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,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:c,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,c??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),c??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[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}};vo.extension={type:[x.WebGPUSystem],name:"encoder",priority:1}});var To,kb=p(()=>{P();Cr();To=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:lt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};To.extension={type:[x.WebGPUSystem],name:"stencil"}});var Fi,ku=p(()=>{fu();rr();je();Fi=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!Sa())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new gt({data:new Float32Array(e.layout.size/4),usage:j.UNIFORM|j.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new gt({data:new Float32Array(s.layout.size/4),usage:j.UNIFORM|j.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function Fb(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=So[s.data.type].size,n=So[s.data.type].align;if(!So[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var So,Fu=p(()=>{"use strict";So={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var Ke,Uu=p(()=>{"use strict";Ke=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
766
+ `,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${fo} - ${i} - http://www.pixijs.com/`);US=!0}}var US,OS=m(()=>{wt();Lp();US=!1});var po,NS=m(()=>{R();OS();Cr();po=class{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===zt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),kS(e)}}};po.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"hello",priority:-2};po.defaultOptions={hello:!1}});function DS(i){let t=!1;for(let r in i)if(i[r]==null){t=!0;break}if(!t)return i;let e=Object.create(null);for(let r in i){let s=i[r];s&&(e[r]=s)}return e}function LS(i){let t=0;for(let e=0;e<i.length;e++)i[e]==null?t++:i[e-t]=i[e];return i.length-=t,i}var HS=m(()=>{"use strict"});var dB,qp,WS,zS=m(()=>{R();HS();dB=0,qp=class VS{constructor(t){this._managedRenderables=[],this._managedHashes=[],this._managedArrays=[],this._renderer=t}init(t){t={...VS.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(let e of this._managedHashes)e.context[e.hash]=DS(e.context[e.hash])},this._frequency),this._arrayHandler=this._renderer.scheduler.repeat(()=>{for(let e of this._managedArrays)LS(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=dB++,this._updateInstructionGCTick(t.renderGroup,t.renderGroup.gcTick)}addRenderable(t){this.enabled&&(t._lastUsed===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastUsed=this._now)}run(){let t=this._now,e=this._managedRenderables,r=this._renderer.renderPipes,s=0;for(let o=0;o<e.length;o++){let n=e[o];if(n===null){s++;continue}let a=n.renderGroup??n.parentRenderGroup,h=a?.instructionSet?.gcTick??-1;if((a?.gcTick??0)===h&&(n._lastUsed=t),t-n._lastUsed>this.maxUnusedTime){if(!n.destroyed){let l=r;a&&(a.structureDidChange=!0),l[n.renderPipeId].destroyRenderable(n)}n._lastUsed=-1,s++,n.off("destroyed",this._removeRenderable,this)}else e[o-s]=n}e.length-=s}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0,this._managedHashes.length=0,this._managedArrays.length=0}_removeRenderable(t){let e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}_updateInstructionGCTick(t,e){t.instructionSet.gcTick=e;for(let r of t.renderGroupChildren)this._updateInstructionGCTick(r,e)}};qp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"renderableGC",priority:0};qp.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};WS=qp});var Kp,XS,jS=m(()=>{R();Kp=class $S{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){t={...$S.defaultOptions,...t},this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=t.textureGCAMaxIdle??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(){let t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){let r=t[e];r.autoGarbageCollect&&r.resource&&r._touched>-1&&this.count-r._touched>this.maxIdle&&(r._touched=-1,r.unload())}}destroy(){this._renderer=null}};Kp.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGC"};Kp.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};XS=Kp});var YS,va,Zp=m(()=>{ue();Be();xt();YS=class qS{constructor(t={}){if(this.uid=nt("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t={...qS.defaultOptions,...t},this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new gt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(r=>r.source)];let 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 I||t.depthStencilTexture instanceof gt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){let 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 gt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,r=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((o,n)=>{s&&n===0||o.source.resize(t,e,r)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,r)}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)}};YS.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};va=YS});function bc(i,t){if(!Ta.has(i)){let e=new I({source:new ge({resource:i,...t})}),r=()=>{Ta.get(i)===e&&Ta.delete(i)};e.once("destroy",r),e.source.once("destroy",r),Ta.set(i,e)}return Ta.get(i)}var Ta,Qp=m(()=>{Fs();xt();Ta=new Map});var Jp,ZS,QS=m(()=>{wt();R();Yt();Ft();Zp();Qp();Jp=class KS{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={...KS.defaultOptions,...t},t.view&&(X(tt,"ViewSystem.view has been renamed to ViewSystem.canvas"),t.canvas=t.view),this.screen=new rt(0,0,t.width,t.height),this.canvas=t.canvas||j.get().createCanvas(),this.antialias=!!t.antialias,this.texture=bc(this.canvas,t),this.renderTarget=new va({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,r){this.texture.source.resize(t,e,r),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:!!t?.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Jp.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"view",priority:0};Jp.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};ZS=Jp});var vc,Tc,tm=m(()=>{iS();sS();uS();dS();Hp();pS();vS();TS();SS();wS();CS();MS();IS();FS();GS();NS();zS();jS();QS();vc=[ES,ya,po,ZS,la,XS,_a,RS,da,WS,ba],Tc=[xa,Wp,ca,aa,fa,ma,pa,oa]});var Sa,JS=m(()=>{R();Sa=class{constructor(t){this._hash=Object.create(null),this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_hash")}contextChange(t){this._gpu=t}getBindGroup(t,e,r){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,r)}_createBindGroup(t,e,r){let s=this._gpu.device,o=e.layout[r],n=[],a=this._renderer;for(let c in o){let u=t.resources[c]??t.resources[o[c]],d;if(u._resourceType==="uniformGroup"){let f=u;a.ubo.updateUniformGroup(f);let p=f.buffer;d={buffer:a.buffer.getGPUBuffer(p),offset:0,size:p.descriptor.size}}else if(u._resourceType==="buffer"){let f=u;d={buffer:a.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(u._resourceType==="bufferResource"){let f=u;d={buffer:a.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(u._resourceType==="textureSampler"){let f=u;d=a.texture.getGpuSampler(f)}else if(u._resourceType==="textureSource"){let f=u;d=a.texture.getGpuSource(f).createView({})}n.push({binding:o[c],resource:d})}let h=a.shader.getProgramData(e).bindGroups[r],l=s.createBindGroup({layout:h,entries:n});return this._hash[t._key]=l,l}destroy(){for(let t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}};Sa.extension={type:[y.WebGPUSystem],name:"bindGroup"}});var Aa,tA=m(()=>{R();ef();Aa=class{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){let e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),r=t.data;return t._updateID&&r&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,r.buffer,0,(t._updateSize||r.byteLength)+3&-4)),e}destroyAll(){for(let 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));let e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(wn(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}};Aa.extension={type:[y.WebGPUSystem],name:"buffer"}});var Ea,eA=m(()=>{R();Ea=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}};Ea.extension={type:[y.WebGPUSystem],name:"colorMask"}});var mo,rA=m(()=>{wt();R();mo=class{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){let e=await j.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),r=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(o=>e.features.has(o)),s=await e.requestDevice({requiredFeatures:r});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}};mo.extension={type:[y.WebGPUSystem],name:"device"};mo.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1}});var wa,iA=m(()=>{R();wa=class{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,r,s){let o=this._renderer.pipeline.getPipeline(t,e,r,s);this.setPipeline(o)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;let e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,r){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);let s=this._renderer.bindGroup.getBindGroup(e,r,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){let r=this._renderer.pipeline.getBufferNamesToBind(t,e);for(let s in r)this._setVertexBuffer(s,t.attributes[r[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(let r in t.groups){let s=t.groups[r];e||this._syncBindGroup(s),this.setBindGroup(r,s,t.gpuProgram)}}_syncBindGroup(t){for(let e in t.resources){let r=t.resources[e];r.isUniformGroup&&this._renderer.ubo.updateUniformGroup(r)}}draw(t){let{geometry:e,shader:r,state:s,topology:o,size:n,start:a,instanceCount:h,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,r.gpuProgram,s,o),this.setGeometry(e,r.gpuProgram),this._setShaderBindGroups(r,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(n||e.indexBuffer.data.length,h??e.instanceCount,a||0):this.renderPassEncoder.draw(n||e.getSize(),h??e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){let t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);let e=this._boundPipeline,r={...this._boundVertexBuffer},s=this._boundIndexBuffer,o={...this._boundBindGroup};this._clearCache();let n=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(n.x,n.y,n.width,n.height,0,1),this.setPipeline(e);for(let a in r)this._setVertexBuffer(a,r[a]);for(let a in o)this.setBindGroup(a,o[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}};wa.extension={type:[y.WebGPUSystem],name:"encoder",priority:1}});var Ca,sA=m(()=>{R();$i();Ca=class{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Pt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid];r.stencilMode=t,r.stencilReference=e;let s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}};Ca.extension={type:[y.WebGPUSystem],name:"stencil"}});var go,em=m(()=>{Gp();gi();jr();go=class{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!pc())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){let e=this.getUniformGroupData(t);t.buffer||(t.buffer=new kt({data:new Float32Array(e.layout.size/4),usage:ot.UNIFORM|ot.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){let e=t._signature,r=this._syncFunctionHash[e];if(!r){let s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),o=this._adaptor.createUboElements(s),n=this._generateUboSync(o.uboElements);r=this._syncFunctionHash[e]={layout:o,syncFunction:n}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,r){let s=this.getUniformGroupData(t);t.buffer||(t.buffer=new kt({data:new Float32Array(s.layout.size/4),usage:ot.UNIFORM|ot.COPY_DST}));let o=null;return e||(e=t.buffer.data,o=t.buffer.dataInt32),r||(r=0),s.syncFunction(t.uniforms,e,o,r),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;let e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}});function oA(i){let t=i.map(r=>({data:r,offset:0,size:0})),e=0;for(let r=0;r<t.length;r++){let s=t[r],o=Pa[s.data.type].size,n=Pa[s.data.type].align;if(!Pa[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(o=Math.max(o,n)*s.data.size),e=Math.ceil(e/n)*n,s.size=o,s.offset=e,e+=o}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}var Pa,rm=m(()=>{"use strict";Pa={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}}});var Zr,im=m(()=>{"use strict";Zr=[{type:"mat3x3<f32>",test:i=>i.value.a!==void 0,ubo:`
767
767
  var matrix = uv[name].toArray(true);
768
768
  data[offset] = matrix[0];
769
769
  data[offset + 1] = matrix[1];
@@ -834,23 +834,23 @@ fn mainFragment(
834
834
  cv[2] = v.blue;
835
835
  gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
836
836
  }
837
- `}]});function Ga(i,t,e,r){let s=[`
837
+ `}]});function Sc(i,t,e,r){let s=[`
838
838
  var v = null;
839
839
  var v2 = null;
840
840
  var t = 0;
841
841
  var index = 0;
842
842
  var name = null;
843
843
  var arrayOffset = null;
844
- `],o=0;for(let a=0;a<i.length;a++){let c=i[a],l=c.data.name,h=!1,u=0;for(let d=0;d<Ke.length;d++)if(Ke[d].test(c.data)){u=c.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,Ke[d][t]||Ke[d].ubo),h=!0;break}if(!h)if(c.data.size>1)u=c.offset/4,s.push(e(c,u-o));else{let d=r[c.data.type];u=c.offset/4,s.push(`
844
+ `],o=0;for(let a=0;a<i.length;a++){let h=i[a],l=h.data.name,c=!1,u=0;for(let d=0;d<Zr.length;d++)if(Zr[d].test(h.data)){u=h.offset/4,s.push(`name = "${l}";`,`offset += ${u-o};`,Zr[d][t]||Zr[d].ubo),c=!0;break}if(!c)if(h.data.size>1)u=h.offset/4,s.push(e(h,u-o));else{let d=r[h.data.type];u=h.offset/4,s.push(`
845
845
  v = uv.${l};
846
846
  offset += ${u-o};
847
847
  ${d};
848
848
  `)}o=u}let n=s.join(`
849
- `);return new Function("uv","data","dataInt32","offset",n)}var Du=p(()=>{Uu()});function Ui(i,t){return`
849
+ `);return new Function("uv","data","dataInt32","offset",n)}var sm=m(()=>{im()});function xo(i,t){return`
850
850
  for (let i = 0; i < ${i*t}; i++) {
851
851
  data[offset + (((i / ${i})|0) * 4) + (i % ${i})] = v[i];
852
852
  }
853
- `}var Ou,Ub,Lu=p(()=>{"use strict";Ou={f32:`
853
+ `}var om,nA,nm=m(()=>{"use strict";om={f32:`
854
854
  data[offset] = v;`,i32:`
855
855
  dataInt32[offset] = v;`,"vec2<f32>":`
856
856
  data[offset] = v[0];
@@ -886,12 +886,12 @@ fn mainFragment(
886
886
  data[offset + 10] = v[8];`,"mat4x4<f32>":`
887
887
  for (let i = 0; i < 16; i++) {
888
888
  data[offset + i] = v[i];
889
- }`,"mat3x2<f32>":Ui(3,2),"mat4x2<f32>":Ui(4,2),"mat2x3<f32>":Ui(2,3),"mat4x3<f32>":Ui(4,3),"mat2x4<f32>":Ui(2,4),"mat3x4<f32>":Ui(3,4)},Ub={...Ou,"mat2x2<f32>":`
889
+ }`,"mat3x2<f32>":xo(3,2),"mat4x2<f32>":xo(4,2),"mat2x3<f32>":xo(2,3),"mat4x3<f32>":xo(4,3),"mat2x4<f32>":xo(2,4),"mat3x4<f32>":xo(3,4)},nA={...om,"mat2x2<f32>":`
890
890
  data[offset] = v[0];
891
891
  data[offset + 1] = v[1];
892
892
  data[offset + 2] = v[2];
893
893
  data[offset + 3] = v[3];
894
- `}});function Db(i,t){let{size:e,align:r}=So[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
894
+ `}});function aA(i,t){let{size:e,align:r}=Pa[i.data.type],s=(r-e)/4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
895
895
  v = uv.${i.data.name};
896
896
  ${t!==0?`offset += ${t};`:""}
897
897
 
@@ -907,7 +907,7 @@ fn mainFragment(
907
907
  }
908
908
  ${s!==0?`arrayOffset += ${s};`:""}
909
909
  }
910
- `}var Ob=p(()=>{Fu()});function Lb(i){return Ga(i,"uboWgsl",Db,Ub)}var Nb=p(()=>{Du();Lu();Ob()});var wo,Hb=p(()=>{P();ku();Fu();Nb();wo=class extends Fi{constructor(){super({createUboElements:Fb,generateUboSync:Lb})}};wo.extension={type:[x.WebGPUSystem],name:"ubo"}});var lr,Ia=p(()=>{It();Rt();lr=class extends ot{constructor({buffer:t,offset:e,size:r}){super(),this.uid=X("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=X("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=X("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var ka,Wb=p(()=>{"use strict";ka=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var hr,Eo,zb=p(()=>{P();rr();Ia();je();Wb();er();hr=128,Eo=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new ka({minUniformOffsetAlignment:hr});let e=256/hr;for(let r=0;r<e;r++){let s=j.UNIFORM|j.COPY_DST;r===0&&(s|=j.COPY_SRC),this._buffers.push(new gt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/hr),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/hr)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/hr)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/hr;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new lr({buffer:e,offset:(t/2|0)*256,size:hr})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new Pt({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),hr,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Eo.extension={type:[x.WebGPUPipes],name:"uniformBatch"}});function Fa(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):k(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}cE(i)}function cE(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Zt(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Zt(n.format).stride}}var Nu=p(()=>{it();Br()});var ke,Hu=p(()=>{Cr();ke=[];ke[lt.NONE]=void 0;ke[lt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};ke[lt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};ke[lt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};ke[lt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};ke[lt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function hE(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function uE(i,t,e,r){return e<<6|i<<3|r<<1|t}var lE,Po,Vb=p(()=>{P();it();Nu();Cr();Ss();Hu();lE={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Po=class{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(lt.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=ke[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(Fa(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=hE(t._layoutKey,e._layoutKey,r.data,r._blendModeId,lE[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===lt.RENDERING_MASK_ADD?0:this._colorMask;let c=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:c,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Xe(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Xe(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let h in n)if(n[h].location===l){o[a]=h;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let c in e.attributeData){let l=t.attributes[c];(l.divisor??1)!==1&&k(`Attribute ${c} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[c].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=uE(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}};Po.extension={type:[x.WebGPUSystem],name:"pipeline"}});function jb(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var Xb=p(()=>{"use strict"});function $b(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Yb=p(()=>{"use strict"});var Di,Wu=p(()=>{K();vt();Bi();Xb();pu();Jr();Yt();tt();Ru();Yb();Bu();Di=class{constructor(t){this.rootViewPort=new z,this.viewport=new z,this.onRenderTargetChange=new Ri("onRenderTargetChange"),this.projectionMatrix=new B,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=$b(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let c=o.colorTexture,l=this.viewport,h=c.pixelWidth,u=c.pixelHeight;if(!s&&t instanceof M&&(s=t.frame),s){let d=c._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=h,l.height=u;return jb(this.projectionMatrix,0,0,l.width/c.resolution,l.height/c.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=Ct.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=Ct.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}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 kt.test(t)&&(t=Ma(t).source),t instanceof go?e=t:t instanceof J&&(e=new go({colorTextures:[t]}),kt.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),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}}});var Ua,Kb=p(()=>{"use strict";Ua=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Da,qb=p(()=>{Bi();Jr();Yt();Kb();Da=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),c=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:c,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?Ct.ALL:Ct.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,h)=>{let u=o.contexts[h],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[h]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[h]));let m=e&Ct.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:m}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&Ct.STENCIL?"clear":"load",h=e&Ct.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:h,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),h=this.getDescriptor(t,e,r),u=l.beginRenderPass(h);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Ua;return t.colorTextures.forEach((r,s)=>{if(kt.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new J({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),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){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Ao,Zb=p(()=>{P();Wu();qb();Ao=class extends Di{constructor(t){super(t),this.adaptor=new Da,this.adaptor.init(t,this)}};Ao.extension={type:[x.WebGPUSystem],name:"renderTarget"}});var Co,Qb=p(()=>{P();Co=class{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){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Co.extension={type:[x.WebGPUSystem],name:"shader"}});var zt,Jb=p(()=>{"use strict";zt={};zt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};zt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};zt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};zt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};zt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};zt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};zt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};zt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};zt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};zt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};zt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};zt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Mo,tv=p(()=>{P();_e();Jb();Mo=class{constructor(){this.defaultState=new _t,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:zt[t.blendMode]||zt.normal}]}destroy(){this.gpu=null}};Mo.extension={type:[x.WebGPUSystem],name:"state"}});var ev,rv=p(()=>{"use strict";ev={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var zu,dE,iv,sv=p(()=>{"use strict";zu={"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}},dE={blockBytes:4,blockWidth:1,blockHeight:1},iv={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=zu[i.format]||dE;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],c=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:c},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Oa,Vu=p(()=>{"use strict";Oa={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var ov,nv=p(()=>{Vu();ov={type:"video",upload(i,t,e){Oa.upload(i,t,e)}}});var La,av=p(()=>{"use strict";La=class{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:`
910
+ `}var hA=m(()=>{rm()});function lA(i){return Sc(i,"uboWgsl",aA,nA)}var cA=m(()=>{sm();nm();hA()});var Ra,uA=m(()=>{R();em();rm();cA();Ra=class extends go{constructor(){super({createUboElements:oA,generateUboSync:lA})}};Ra.extension={type:[y.WebGPUSystem],name:"ubo"}});var Si,Ac=m(()=>{me();ue();Si=class extends At{constructor({buffer:t,offset:e,size:r}){super(),this.uid=nt("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=nt("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=r,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=nt("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}});var Ec,dA=m(()=>{"use strict";Ec=class{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);let e=this.byteIndex,r=e+t*4;if(r=Math.ceil(r/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,r>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=r,e}addGroup(t){let e=this.addEmptyGroup(t.length);for(let r=0;r<t.length;r++)this.data[e/4+r]=t[r];return e}destroy(){this.data=null}}});var Ai,Ma,fA=m(()=>{R();gi();Ac();jr();dA();mi();Ai=128,Ma=class{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._renderer.renderableGC.addManagedHash(this,"_bindGroupHash"),this._batchBuffer=new Ec({minUniformOffsetAlignment:Ai});let e=256/Ai;for(let r=0;r<e;r++){let s=ot.UNIFORM|ot.COPY_DST;r===0&&(s|=ot.COPY_SRC),this._buffers.push(new kt({data:this._batchBuffer.data,usage:s}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(let t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);let r=t.buffer.data,s=this._batchBuffer.addEmptyGroup(r.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Ai),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);let e=t.buffer.data,r=this._batchBuffer.addGroup(e);return this._getBufferResource(r/Ai)}getArrayBindGroup(t){let e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Ai)}getArrayBufferResource(t){let r=this._batchBuffer.addGroup(t)/Ai;return this._getBufferResource(r)}_getBufferResource(t){if(!this._bufferResources[t]){let e=this._buffers[t%2];this._bufferResources[t]=new Si({buffer:e,offset:(t/2|0)*256,size:Ai})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){let e=new ie({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){let t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);let r=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){let o=this._buffers[s];r.copyBufferToBuffer(t.getGPUBuffer(e),Ai,t.getGPUBuffer(o),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([r.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}};Ma.extension={type:[y.WebGPUPipes],name:"uniformBatch"}});function wc(i,t){for(let e in i.attributes){let r=i.attributes[e],s=t[e];s?(r.format??(r.format=s.format),r.offset??(r.offset=s.offset),r.instance??(r.instance=s.instance)):H(`Attribute ${e} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}fB(i)}function fB(i){let{buffers:t,attributes:e}=i,r={},s={};for(let o in t){let n=t[o];r[n.uid]=0,s[n.uid]=0}for(let o in e){let n=e[o];r[n.buffer.uid]+=Ge(n.format).stride}for(let o in e){let n=e[o];n.stride??(n.stride=r[n.buffer.uid]),n.start??(n.start=s[n.buffer.uid]),s[n.buffer.uid]+=Ge(n.format).stride}}var am=m(()=>{vt();ji()});var Br,hm=m(()=>{$i();Br=[];Br[Pt.NONE]=void 0;Br[Pt.DISABLED]={stencilWriteMask:0,stencilReadMask:0};Br[Pt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}};Br[Pt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}};Br[Pt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};Br[Pt.INVERSE_MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"not-equal",passOp:"replace"},stencilBack:{compare:"not-equal",passOp:"replace"}}});function mB(i,t,e,r,s){return i<<24|t<<16|e<<10|r<<5|s}function gB(i,t,e,r){return e<<6|i<<3|r<<1|t}var pB,Ba,pA=m(()=>{R();vt();am();$i();Rn();hm();pB={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};Ba=class{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(Pt.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=Br[t],this._updatePipeHash())}setPipeline(t,e,r,s){let o=this.getPipeline(t,e,r);s.setPipeline(o)}getPipeline(t,e,r,s){t._layoutKey||(wc(t,e.attributeData),this._generateBufferKey(t)),s||(s=t.topology);let o=mB(t._layoutKey,e._layoutKey,r.data,r._blendModeId,pB[s]);return this._pipeCache[o]?this._pipeCache[o]:(this._pipeCache[o]=this._createPipeline(t,e,r,s),this._pipeCache[o])}_createPipeline(t,e,r,s){let o=this._gpu.device,n=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(r);a[0].writeMask=this._stencilMode===Pt.RENDERING_MASK_ADD?0:this._colorMask;let h=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:n},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:r.cullMode},layout:h,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil={...this._stencilState,format:"depth24plus-stencil8",depthWriteEnabled:r.depthTest,depthCompare:r.depthTest?"less":"always"}),o.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){let e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){let e=[],r=0,s=Object.keys(t.attributes).sort();for(let n=0;n<s.length;n++){let a=t.attributes[s[n]];e[r++]=a.offset,e[r++]=a.format,e[r++]=a.stride,e[r++]=a.instance}let o=e.join("|");return t._layoutKey=Yr(o,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){let e=[],r=0,s=Object.keys(t.attributeData).sort();for(let n=0;n<s.length;n++){let a=t.attributeData[s[n]];e[r++]=a.location}let o=e.join("|");return t._attributeLocationsKey=Yr(o,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[r])return this._bindingNamesCache[r];let s=this._createVertexBufferLayouts(t,e),o=Object.create(null),n=e.attributeData;for(let a=0;a<s.length;a++){let l=Object.values(s[a].attributes)[0].shaderLocation;for(let c in n)if(n[c].location===l){o[a]=c;break}}return this._bindingNamesCache[r]=o,o}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);let r=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[r])return this._bufferLayoutsCache[r];let s=[];return t.buffers.forEach(o=>{let n={arrayStride:0,stepMode:"vertex",attributes:[]},a=n.attributes;for(let h in e.attributeData){let l=t.attributes[h];(l.divisor??1)!==1&&H(`Attribute ${h} has an invalid divisor value of '${l.divisor}'. WebGPU only supports a divisor value of 1`),l.buffer===o&&(n.arrayStride=l.stride,n.stepMode=l.instance?"instance":"vertex",a.push({shaderLocation:e.attributeData[h].location,offset:l.offset,format:l.format}))}a.length&&s.push(n)}),this._bufferLayoutsCache[r]=s,s}_updatePipeHash(){let t=gB(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}};Ba.extension={type:[y.WebGPUSystem],name:"pipeline"}});function mA(i,t,e,r,s,o){let n=o?1:-1;return i.identity(),i.a=1/r*2,i.d=n*(1/s*2),i.tx=-1-t*i.a,i.ty=-n-e*i.d,i}var gA=m(()=>{"use strict"});function xA(i){let t=i.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var _A=m(()=>{"use strict"});var _o,lm=m(()=>{dt();Yt();co();gA();Up();Fs();Be();xt();Qp();_A();Zp();_o=class{constructor(t){this.rootViewPort=new rt,this.viewport=new rt,this.onRenderTargetChange=new uo("onRenderTargetChange"),this.projectionMatrix=new U,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuRenderTargetHash")}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:r,frame:s}){this._renderTargetStack.length=0,this.push(t,e,r,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=xA(this.rootRenderTarget),this.adaptor.prerender?.(this.rootRenderTarget)}postrender(){this.adaptor.postrender?.(this.rootRenderTarget)}bind(t,e=!0,r,s){let o=this.getRenderTarget(t),n=this.renderTarget!==o;this.renderTarget=o,this.renderSurface=t;let a=this.getGpuRenderTarget(o);(o.pixelWidth!==a.width||o.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(o),a.width=o.pixelWidth,a.height=o.pixelHeight);let h=o.colorTexture,l=this.viewport,c=h.pixelWidth,u=h.pixelHeight;if(!s&&t instanceof I&&(s=t.frame),s){let d=h._resolution;l.x=s.x*d+.5|0,l.y=s.y*d+.5|0,l.width=s.width*d+.5|0,l.height=s.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=u;return mA(this.projectionMatrix,0,0,l.width/h.resolution,l.height/h.resolution,!o.isRoot),this.adaptor.startRenderPass(o,e,r,l),n&&this.onRenderTargetChange.emit(o),o}clear(t,e=se.ALL,r){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,r,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=se.ALL,r,s){let o=this.bind(t,e,r,s);return this._renderTargetStack.push({renderTarget:o,frame:s}),o}pop(){this._renderTargetStack.pop();let t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){return t.isTexture&&(t=t.source),this._renderSurfaceToRenderTargetHash.get(t)??this._initRenderTarget(t)}copyToTexture(t,e,r,s,o){r.x<0&&(s.width+=r.x,o.x-=r.x,r.x=0),r.y<0&&(s.height+=r.y,o.y-=r.y,r.y=0);let{pixelWidth:n,pixelHeight:a}=t;return s.width=Math.min(s.width,n-r.x),s.height=Math.min(s.height,a-r.y),this.adaptor.copyToTexture(t,e,r,s,o)}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 ge.test(t)&&(t=bc(t).source),t instanceof va?e=t:t instanceof gt&&(e=new va({colorTextures:[t]}),ge.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);let r=this._gpuRenderTargetHash[e.uid];r&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(r))})),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}}});var Cc,yA=m(()=>{"use strict";Cc=class{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}});var Pc,bA=m(()=>{co();Fs();Be();yA();Pc=class{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,r,s,o){let n=this._renderer,a=this._getGpuColorTexture(t),h=n.texture.getGpuSource(e.source);return n.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:r},{texture:h,origin:o},s),e}startRenderPass(t,e=!0,r,s){let n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,r);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,r){typeof e=="boolean"&&(e=e?se.ALL:se.NONE);let s=this._renderTargetSystem,o=s.getGpuRenderTarget(t),n=t.colorTextures.map((l,c)=>{let u=o.contexts[c],d,f;u?d=u.getCurrentTexture().createView():d=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),o.msaaTextures[c]&&(f=d,d=this._renderer.texture.getTextureView(o.msaaTextures[c]));let p=e&se.COLOR?"clear":"load";return r??(r=s.defaultClearColor),{view:d,resolveTarget:f,clearValue:r,storeOp:"store",loadOp:p}}),a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=o.msaa?4:1),t.depthStencilTexture){let l=e&se.STENCIL?"clear":"load",c=e&se.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:c,depthStoreOp:"store"}}return{colorAttachments:n,depthStencilAttachment:a}}clear(t,e=!0,r,s){if(!e)return;let{gpu:o,encoder:n}=this._renderer,a=o.device;if(n.commandEncoder===null){let l=a.createCommandEncoder(),c=this.getDescriptor(t,e,r),u=l.beginRenderPass(c);u.setViewport(s.x,s.y,s.width,s.height,0,1),u.end();let d=l.finish();a.queue.submit([d])}else this.startRenderPass(t,e,r,s)}initGpuRenderTarget(t){t.isRoot=!0;let e=new Cc;return t.colorTextures.forEach((r,s)=>{if(ge.test(r.resource)){let o=r.resource.getContext("webgpu"),n=r.transparent?"premultiplied":"opaque";try{o.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:n})}catch(a){console.error(a)}e.contexts[s]=o}if(e.msaa=r.source.antialias,r.source.antialias){let o=new gt({width:0,height:0,sampleCount:4});e.msaaTextures[s]=o}}),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){let e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){let e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((r,s)=>{e.msaaTextures[s]?.resize(r.source.width,r.source.height,r.source._resolution)})}}});var Ia,vA=m(()=>{R();lm();bA();Ia=class extends _o{constructor(t){super(t),this.adaptor=new Pc,this.adaptor.init(t,this)}};Ia.extension={type:[y.WebGPUSystem],name:"renderTarget"}});var Fa,TA=m(()=>{R();Fa=class{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){let e=this._gpu.device,r=t.gpuLayout.map(o=>e.createBindGroupLayout({entries:o})),s={bindGroupLayouts:r};return this._gpuProgramData[t._layoutKey]={bindGroups:r,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}};Fa.extension={type:[y.WebGPUSystem],name:"shader"}});var Ce,SA=m(()=>{"use strict";Ce={};Ce.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}};Ce.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}};Ce.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}};Ce["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}};Ce["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}};Ce["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}};Ce.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}};Ce.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}};Ce.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}}});var Ga,AA=m(()=>{R();fr();SA();Ga=class{constructor(){this.defaultState=new Lt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:Ce[t.blendMode]||Ce.normal}]}destroy(){this.gpu=null}};Ga.extension={type:[y.WebGPUSystem],name:"state"}});var EA,wA=m(()=>{"use strict";EA={type:"image",upload(i,t,e){let r=i.resource,s=(i.pixelWidth|0)*(i.pixelHeight|0),o=r.byteLength/s;e.device.queue.writeTexture({texture:t},r,{offset:0,rowsPerImage:i.pixelHeight,bytesPerRow:i.pixelHeight*o},{width:i.pixelWidth,height:i.pixelHeight,depthOrArrayLayers:1})}}});var cm,xB,CA,PA=m(()=>{"use strict";cm={"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}},xB={blockBytes:4,blockWidth:1,blockHeight:1},CA={type:"compressed",upload(i,t,e){let r=i.pixelWidth,s=i.pixelHeight,o=cm[i.format]||xB;for(let n=0;n<i.resource.length;n++){let a=i.resource[n],h=Math.ceil(r/o.blockWidth)*o.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:n},a,{offset:0,bytesPerRow:h},{width:Math.ceil(r/o.blockWidth)*o.blockWidth,height:Math.ceil(s/o.blockHeight)*o.blockHeight,depthOrArrayLayers:1}),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Rc,um=m(()=>{"use strict";Rc={type:"image",upload(i,t,e){let r=i.resource;if(!r)return;let s=Math.min(t.width,i.resourceWidth||i.pixelWidth),o=Math.min(t.height,i.resourceHeight||i.pixelHeight),n=i.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:r},{texture:t,premultipliedAlpha:n},{width:s,height:o})}}});var RA,MA=m(()=>{um();RA={type:"video",upload(i,t,e){Rc.upload(i,t,e)}}});var Mc,BA=m(()=>{"use strict";Mc=class{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:`
911
911
  var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
912
912
  vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
913
913
 
@@ -931,7 +931,7 @@ fn mainFragment(
931
931
  fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
932
932
  return textureSample(img, imgSampler, texCoord);
933
933
  }
934
- `})),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){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let c={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};r=this.device.createTexture(c)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let c=0;c<s;++c){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),h=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:h++,mipLevelCount:1,dimension:"2d",baseArrayLayer:c,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,m),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let c={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},c),c.width=Math.ceil(c.width/2),c.height=Math.ceil(c.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var Bo,cv=p(()=>{ct();P();Nt();_i();er();rv();sv();Vu();nv();av();Bo=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:Oa,buffer:ev,video:ov,compressed:iv},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let c=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(c))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=zu[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new La(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new Pt({0:e,1:e.style,2:new st({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=D.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:D.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=Jt.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),c=new Uint8ClampedArray(a.data.buffer);return Jt.returnCanvasAndContext(r),{pixels:c,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Bo.extension={type:[x.WebGPUSystem],name:"texture"}});var dv={};Ud(dv,{WebGPURenderer:()=>ju});var fE,pE,mE,lv,hv,uv,ju,fv=p(()=>{P();Cy();Ry();Gy();Ks();Iu();Be();Mb();Bb();Rb();Gb();Ib();kb();Hb();zb();Vb();Zb();Qb();tv();cv();fE=[...Ba,wo,vo,ki,yo,Bo,Ao,Co,Mo,Po,bo,To,_o],pE=[...Ra,Eo],mE=[Qs,Zs,qs],lv=[],hv=[],uv=[];I.handleByNamedList(x.WebGPUSystem,lv);I.handleByNamedList(x.WebGPUPipes,hv);I.handleByNamedList(x.WebGPUPipesAdaptor,uv);I.add(...fE,...pE,...mE);ju=class extends cr{constructor(){let t={name:"webgpu",type:bt.WEBGPU,systems:lv,renderPipes:hv,renderPipeAdaptors:uv};super(t)}}});var Ro,pv=p(()=>{P();K();Ar();sr();ws();Es();Mi();or();Nn();xe();Nt();Ro=class{init(){let t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=ae(),r=Ae({name:"graphics",bits:[ci,hi(e),Ci,Me]});this.shader=new xt({glProgram:r,resources:{localUniforms:t,batchSamplers:ui(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:c}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=c.instructions;for(let h=0;h<c.instructionSize;h++){let u=l[h];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};Ro.extension={type:[x.WebGLPipesAdaptor],name:"graphics"}});var Go,mv=p(()=>{P();K();sr();Mi();or();mu();xe();tt();it();Go=class{init(){let t=Ae({name:"mesh",bits:[Ci,By,Me]});this._shader=new xt({glProgram:t,resources:{uTexture:M.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){k("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Go.extension={type:[x.WebGLPipesAdaptor],name:"mesh"}});var Io,gv=p(()=>{P();_e();Io=class{constructor(){this._tempState=_t.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Io.extension={type:[x.WebGLPipesAdaptor],name:"batch"}});var ko,xv=p(()=>{"use strict";ko=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(ko||{})});var Na,_v=p(()=>{"use strict";Na=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var Fo,yv=p(()=>{P();je();xv();_v();Fo=class{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(){let 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){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.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){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&j.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=ko.ARRAY_BUFFER;t.descriptor.usage&j.INDEX?r=ko.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&j.UNIFORM&&(r=ko.UNIFORM_BUFFER);let s=new Na(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};Fo.extension={type:[x.WebGLSystem],name:"buffer"}});var Xu,vv,Tv=p(()=>{ct();P();it();Xu=class bv{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){t={...bv.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(k("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=D.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&k("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof D.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&k("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||k("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};Xu.extension={type:[x.WebGLSystem],name:"context"};Xu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};vv=Xu});var Ha,$u,Z,Yu=p(()=>{"use strict";Ha=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Ha||{}),$u=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))($u||{}),Z=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(Z||{})});function wv(i){return Sv[i]??Sv.float32}var Sv,Ev=p(()=>{Yu();Sv={uint8x2:Z.UNSIGNED_BYTE,uint8x4:Z.UNSIGNED_BYTE,sint8x2:Z.BYTE,sint8x4:Z.BYTE,unorm8x2:Z.UNSIGNED_BYTE,unorm8x4:Z.UNSIGNED_BYTE,snorm8x2:Z.BYTE,snorm8x4:Z.BYTE,uint16x2:Z.UNSIGNED_SHORT,uint16x4:Z.UNSIGNED_SHORT,sint16x2:Z.SHORT,sint16x4:Z.SHORT,unorm16x2:Z.UNSIGNED_SHORT,unorm16x4:Z.UNSIGNED_SHORT,snorm16x2:Z.SHORT,snorm16x4:Z.SHORT,float16x2:Z.HALF_FLOAT,float16x4:Z.HALF_FLOAT,float32:Z.FLOAT,float32x2:Z.FLOAT,float32x3:Z.FLOAT,float32x4:Z.FLOAT,uint32:Z.UNSIGNED_INT,uint32x2:Z.UNSIGNED_INT,uint32x3:Z.UNSIGNED_INT,uint32x4:Z.UNSIGNED_INT,sint32:Z.INT,sint32x2:Z.INT,sint32x3:Z.INT,sint32x4:Z.INT}});var gE,Uo,Pv=p(()=>{P();Br();Nu();Ev();gE={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Uo=class{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(){let 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");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,c)=>{r.drawElementsInstancedANGLE(s,o,n,a,c)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],c=a[n];if(c)return a[e._key]=c,c;Fa(t,e._attributeData);let l=t.buffers;c=s.createVertexArray(),s.bindVertexArray(c);for(let h=0;h<l.length;h++){let u=l[h];o.bind(u)}return this.activateVao(t,e),a[e._key]=c,a[n]=c,s.bindVertexArray(null),c}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let c=o[a],l=c.buffer,h=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==h&&(s.bind(l),n=h);let d=u.location;r.enableVertexAttribArray(d);let f=Zt(c.format),m=wv(c.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,m,c.stride,c.offset):r.vertexAttribPointer(d,f.size,m,f.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){let g=c.divisor??1;r.vertexAttribDivisor(d,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=gE[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let c=n.indexBuffer.data.BYTES_PER_ELEMENT,l=c===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*c,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*c)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};Uo.extension={type:[x.WebGLSystem],name:"geometry"}});var xE,Ku,Cv,Mv=p(()=>{P();it();si();xe();_e();Yt();tt();Mr();xE=new ce({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Ku=class Av{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...Av.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(k("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=_t.for2d();let s=new le({vertex:`
934
+ `})),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){let e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let r=t,s=t.depthOrArrayLayers||1,o=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!o){let h={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};r=this.device.createTexture(h)}let n=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let h=0;h<s;++h){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),c=o?1:0;for(let u=1;u<t.mipLevelCount;++u){let d=r.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:h,arrayLayerCount:1}),f=n.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),p=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});f.setPipeline(e),f.setBindGroup(0,p),f.draw(3,1,0,0),f.end(),l=d}}if(!o){let h={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)n.copyTextureToTexture({texture:r,mipLevel:l-1},{texture:t,mipLevel:l},h),h.width=Math.ceil(h.width/2),h.height=Math.ceil(h.height/2)}return this.device.queue.submit([n.finish()]),o||r.destroy(),t}}});var Ua,IA=m(()=>{wt();R();Ae();Qs();mi();wA();PA();um();MA();BA();Ua=class{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:Rc,buffer:EA,video:RA,compressed:CA},this._renderer=t,t.renderableGC.addManagedHash(this,"_gpuSources"),t.renderableGC.addManagedHash(this,"_gpuSamplers"),t.renderableGC.addManagedHash(this,"_bindGroupHash"),t.renderableGC.addManagedHash(this,"_textureViewHash")}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){let h=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(h))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);let r=cm[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/r.blockWidth)*r.blockWidth,o=Math.ceil(t.pixelHeight/r.blockHeight)*r.blockHeight,n={label:t.label,size:{width:s,height:o},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(n);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){let e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){let e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Mc(this._gpu.device));let e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){let e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){return this._bindGroupHash[t.uid]??this._createTextureBindGroup(t)}_createTextureBindGroup(t){let e=t.source;return this._bindGroupHash[t.uid]=new ie({0:e,1:e.style,2:new Tt({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){let e=t.source;return this._textureViewHash[e.uid]??this._createTextureView(e)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){let e=this._renderer,r=e.gpu.device.createCommandEncoder(),s=j.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;let o=s.getContext("webgpu");return o.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:j.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),r.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:o.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([r.finish()]),s}getPixels(t){let e=this.generateCanvas(t),r=ke.getOptimalCanvasAndContext(e.width,e.height),s=r.context;s.drawImage(e,0,0);let{width:o,height:n}=e,a=s.getImageData(0,0,o,n),h=new Uint8ClampedArray(a.data.buffer);return ke.returnCanvasAndContext(r),{pixels:h,width:o,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(let t of Object.keys(this._bindGroupHash)){let e=Number(t);this._bindGroupHash[e]?.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}};Ua.extension={type:[y.WebGPUSystem],name:"texture"}});var kA={};dx(kA,{WebGPURenderer:()=>dm});var _B,yB,bB,FA,GA,UA,dm,OA=m(()=>{R();QT();eS();rS();ea();tm();Cr();JS();tA();eA();rA();iA();sA();uA();fA();pA();vA();TA();AA();IA();_B=[...vc,Ra,wa,mo,Aa,Ua,Ia,Fa,Ga,Ba,Ea,Ca,Sa],yB=[...Tc,Ma],bB=[sa,ia,ra],FA=[],GA=[],UA=[];D.handleByNamedList(y.WebGPUSystem,FA);D.handleByNamedList(y.WebGPUPipes,GA);D.handleByNamedList(y.WebGPUPipesAdaptor,UA);D.add(..._B,...yB,...bB);dm=class extends Ti{constructor(){let t={name:"webgpu",type:zt.WEBGPU,systems:FA,renderPipes:GA,renderPipeAdaptors:UA};super(t)}}});var ka,NA=m(()=>{R();dt();zi();_i();Mn();Bn();lo();yi();Ml();dr();Ae();ka=class{init(){let t=new Tt({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new U,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Qe(),r=Ar({name:"graphics",bits:[Vs,zs(e),ho,wr]});this.shader=new Ot({glProgram:r,resources:{localUniforms:t,batchSamplers:$s(e)}})}execute(t,e){let r=e.context,s=r.customShader||this.shader,o=t.renderer,n=o.graphicsContext,{batcher:a,instructions:h}=n.getContextRenderData(r);s.groups[0]=o.globalUniforms.bindGroup,o.state.set(t.state),o.shader.bind(s),o.geometry.bind(a.geometry,s.glProgram);let l=h.instructions;for(let c=0;c<h.instructionSize;c++){let u=l[c];if(u.size){for(let d=0;d<u.textures.count;d++)o.texture.bind(u.textures.textures[d],d);o.geometry.draw(u.topology,u.size,u.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}};ka.extension={type:[y.WebGLPipesAdaptor],name:"graphics"}});var Oa,DA=m(()=>{R();dt();_i();lo();yi();kp();dr();xt();vt();Oa=class{init(){let t=Ar({name:"mesh",bits:[ho,tS,wr]});this._shader=new Ot({glProgram:t,resources:{uTexture:I.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new U}}}})}execute(t,e){let r=t.renderer,s=e._shader;if(s){if(!s.glProgram){H("Mesh shader has no glProgram",e.shader);return}}else{s=this._shader;let o=e.texture,n=o.source;s.resources.uTexture=n,s.resources.uSampler=n.style,s.resources.textureUniforms.uniforms.uTextureMatrix=o.textureMatrix.mapCoord}s.groups[100]=r.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,r.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}};Oa.extension={type:[y.WebGLPipesAdaptor],name:"mesh"}});var Na,LA=m(()=>{R();fr();Na=class{constructor(){this._tempState=Lt.for2d(),this._didUploadHash={}}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUploadHash={}}start(t,e,r){let s=t.renderer,o=this._didUploadHash[r.uid];s.shader.bind(r,o),o||(this._didUploadHash[r.uid]=!0),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,r.glProgram)}execute(t,e){let r=t.renderer;this._tempState.blendMode=e.blendMode,r.state.set(this._tempState);let s=e.textures.textures;for(let o=0;o<e.textures.count;o++)r.texture.bind(s[o],o);r.geometry.draw(e.topology,e.size,e.start)}};Na.extension={type:[y.WebGLPipesAdaptor],name:"batch"}});var Da,HA=m(()=>{"use strict";Da=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Da||{})});var Bc,VA=m(()=>{"use strict";Bc=class{constructor(t,e){this._lastBindBaseLocation=-1,this._lastBindCallId=-1,this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}});var La,WA=m(()=>{R();jr();HA();VA();La=class{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(){let 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){let{_gl:e}=this,r=this.getGlBuffer(t);e.bindBuffer(r.type,r.buffer)}bindBufferBase(t,e){let{_gl:r}=this;this._boundBufferBases[e]!==t&&(this._boundBufferBases[e]=t,t._lastBindBaseLocation=e,r.bindBufferBase(r.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){let e=this.getLastBindBaseLocation(t);if(e>=this._minBaseLocation)return t._lastBindCallId=this._bindCallId,e;let r=0,s=this._nextBindBaseIndex;for(;r<2;){s>=this._maxBindings&&(s=this._minBaseLocation,r++);let o=this._boundBufferBases[s];if(o&&o._lastBindCallId===this._bindCallId){s++;continue}break}return e=s,this._nextBindBaseIndex=s+1,r>=2?-1:(t._lastBindCallId=this._bindCallId,this._boundBufferBases[e]=null,e)}getLastBindBaseLocation(t){let e=t._lastBindBaseLocation;return this._boundBufferBases[e]===t?e:-1}bindBufferRange(t,e,r,s){let{_gl:o}=this;r||(r=0),e||(e=0),this._boundBufferBases[e]=null,o.bindBufferRange(o.UNIFORM_BUFFER,e||0,t.buffer,r*256,s||256)}updateBuffer(t){let{_gl:e}=this,r=this.getGlBuffer(t);if(t._updateID===r.updateID)return r;r.updateID=t._updateID,e.bindBuffer(r.type,r.buffer);let s=t.data,o=t.descriptor.usage&ot.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;return s?r.byteLength>=s.byteLength?e.bufferSubData(r.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT):(r.byteLength=s.byteLength,e.bufferData(r.type,s,o)):(r.byteLength=t.descriptor.size,e.bufferData(r.type,r.byteLength,o)),r}destroyAll(){let t=this._gl;for(let e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){let r=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(r.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){let{_gl:e}=this,r=Da.ARRAY_BUFFER;t.descriptor.usage&ot.INDEX?r=Da.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&ot.UNIFORM&&(r=Da.UNIFORM_BUFFER);let s=new Bc(e.createBuffer(),r);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}resetState(){this._boundBufferBases=Object.create(null)}};La.extension={type:[y.WebGLSystem],name:"buffer"}});var fm,$A,XA=m(()=>{wt();R();vt();fm=class zA{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){t={...zA.defaultOptions,...t};let e=this.multiView=t.multiView;if(t.context&&e&&(H("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),e=!1),e?this.canvas=j.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{let r=this._renderer.background.alpha<1,s=t.premultipliedAlpha??!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:r,premultipliedAlpha:s,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference??"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&H("multiView is disabled, but targetCanvas is not the main canvas");return}let{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof j.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);let e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let r,s=this.canvas;if(t===2&&(r=s.getContext("webgl2",e)),!r&&(r=s.getContext("webgl",e),!r))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=r,this.initFromContext(this.gl)}getExtensions(){let{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions={...e,drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")};else{this.extensions={...e,colorBufferFloat:t.getExtension("EXT_color_buffer_float")};let r=t.getExtension("WEBGL_provoking_vertex");r&&r.provokingVertexWEBGL(r.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext?.restoreContext()},0))}handleContextRestored(){this.getExtensions(),this._renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this._renderer.view.canvas;this._renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext?.loseContext()}forceContextLoss(){this.extensions.loseContext?.loseContext(),this._contextLossForced=!0}validateContext(t){let e=t.getContextAttributes();e&&!e.stencil&&H("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let r=this.supports,s=this.webGLVersion===2,o=this.extensions;r.uint32Indices=s||!!o.uint32ElementIndex,r.uniformBufferObject=s,r.vertexArrayObject=s||!!o.vertexArrayObject,r.srgbTextures=s||!!o.srgb,r.nonPowOf2wrapping=s,r.nonPowOf2mipmaps=s,r.msaa=s,r.uint32Indices||H("Provided WebGL context does not support 32 index buffer, large scenes may not render correctly")}};fm.extension={type:[y.WebGLSystem],name:"context"};fm.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};$A=fm});var Ic,pm,ft,mm=m(()=>{"use strict";Ic=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Ic||{}),pm=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(pm||{}),ft=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(ft||{})});function YA(i){return jA[i]??jA.float32}var jA,qA=m(()=>{mm();jA={uint8x2:ft.UNSIGNED_BYTE,uint8x4:ft.UNSIGNED_BYTE,sint8x2:ft.BYTE,sint8x4:ft.BYTE,unorm8x2:ft.UNSIGNED_BYTE,unorm8x4:ft.UNSIGNED_BYTE,snorm8x2:ft.BYTE,snorm8x4:ft.BYTE,uint16x2:ft.UNSIGNED_SHORT,uint16x4:ft.UNSIGNED_SHORT,sint16x2:ft.SHORT,sint16x4:ft.SHORT,unorm16x2:ft.UNSIGNED_SHORT,unorm16x4:ft.UNSIGNED_SHORT,snorm16x2:ft.SHORT,snorm16x4:ft.SHORT,float16x2:ft.HALF_FLOAT,float16x4:ft.HALF_FLOAT,float32:ft.FLOAT,float32x2:ft.FLOAT,float32x3:ft.FLOAT,float32x4:ft.FLOAT,uint32:ft.UNSIGNED_INT,uint32x2:ft.UNSIGNED_INT,uint32x3:ft.UNSIGNED_INT,uint32x4:ft.UNSIGNED_INT,sint32:ft.INT,sint32x2:ft.INT,sint32x3:ft.INT,sint32x4:ft.INT}});var vB,Ha,KA=m(()=>{R();ji();am();qA();vB={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5},Ha=class{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(){let 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");let e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));let r=this._renderer.context.extensions.vertexAttribDivisorANGLE;r&&(t.drawArraysInstanced=(s,o,n,a)=>{r.drawArraysInstancedANGLE(s,o,n,a)},t.drawElementsInstanced=(s,o,n,a,h)=>{r.drawElementsInstancedANGLE(s,o,n,a,h)},t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){let r=this.gl;this._activeGeometry=t;let s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,r.bindVertexArray(s)),this.updateBuffers()}resetState(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this._renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.updateBuffer(s)}}checkCompatibility(t,e){let r=t.attributes,s=e._attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e._attributeData,o=["g",t.uid];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}getVao(t,e){return this._geometryVaoHash[t.uid]?.[e._key]||this.initGeometryVao(t,e)}initGeometryVao(t,e,r=!0){let s=this._renderer.gl,o=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);let n=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));let a=this._geometryVaoHash[t.uid],h=a[n];if(h)return a[e._key]=h,h;wc(t,e._attributeData);let l=t.buffers;h=s.createVertexArray(),s.bindVertexArray(h);for(let c=0;c<l.length;c++){let u=l[c];o.bind(u)}return this.activateVao(t,e),a[e._key]=h,a[n]=h,s.bindVertexArray(null),h}onGeometryDestroy(t,e){let r=this._geometryVaoHash[t.uid],s=this.gl;if(r){if(e)for(let o in r)this._activeVao!==r[o]&&this.unbind(),s.deleteVertexArray(r[o]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){let e=this.gl;for(let r in this._geometryVaoHash){if(t)for(let s in this._geometryVaoHash[r]){let o=this._geometryVaoHash[r];this._activeVao!==o&&this.unbind(),e.deleteVertexArray(o[s])}this._geometryVaoHash[r]=null}}activateVao(t,e){let r=this._renderer.gl,s=this._renderer.buffer,o=t.attributes;t.indexBuffer&&s.bind(t.indexBuffer);let n=null;for(let a in o){let h=o[a],l=h.buffer,c=s.getGlBuffer(l),u=e._attributeData[a];if(u){n!==c&&(s.bind(l),n=c);let d=u.location;r.enableVertexAttribArray(d);let f=Ge(h.format),p=YA(h.format);if(u.format?.substring(1,4)==="int"?r.vertexAttribIPointer(d,f.size,p,h.stride,h.offset):r.vertexAttribPointer(d,f.size,p,f.normalised,h.stride,h.offset),h.instance)if(this.hasInstance){let g=h.divisor??1;r.vertexAttribDivisor(d,g)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this._renderer,n=this._activeGeometry,a=vB[t||n.topology];if(s??(s=n.instanceCount),n.indexBuffer){let h=n.indexBuffer.data.BYTES_PER_ELEMENT,l=h===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;s>1?o.drawElementsInstanced(a,e||n.indexBuffer.data.length,l,(r||0)*h,s):o.drawElements(a,e||n.indexBuffer.data.length,l,(r||0)*h)}else s>1?o.drawArraysInstanced(a,r||0,e||n.getSize(),s):o.drawArrays(a,r||0,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}};Ha.extension={type:[y.WebGLSystem],name:"geometry"}});var TB,gm,QA,JA=m(()=>{R();vt();Ns();dr();fr();Be();xt();Xi();TB=new Je({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),gm=class ZA{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){let{useBackBuffer:e,antialias:r}={...ZA.defaultOptions,...t};this.useBackBuffer=e,this._antialias=r,this._renderer.context.supports.msaa||(H("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Lt.for2d();let s=new tr({vertex:`
935
935
  attribute vec2 aPosition;
936
936
  out vec2 vUv;
937
937
 
@@ -950,7 +950,7 @@ fn mainFragment(
950
950
 
951
951
  void main() {
952
952
  finalColor = texture(uTexture, vUv);
953
- }`,name:"big-triangle"});this._bigTriangleShader=new xt({glProgram:s,resources:{uTexture:M.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let 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:xE,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new M({source:new J({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)}};Ku.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1};Ku.defaultOptions={useBackBuffer:!1};Cv=Ku});var Do,Bv=p(()=>{P();Do=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};Do.extension={type:[x.WebGLSystem],name:"colorMask"}});var Oo,Rv=p(()=>{P();Oo=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:s,state:o,skipSync:n,topology:a,size:c,start:l,instanceCount:h}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,c,l,h??r.instanceCount)}destroy(){this._renderer=null}};Oo.extension={type:[x.WebGLSystem],name:"encoder"}});var Lo,Gv=p(()=>{P();Hu();Cr();Lo=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:lt.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){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:lt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=lt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=ke[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===lt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};Lo.extension={type:[x.WebGLSystem],name:"stencil"}});function Iv(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=qu[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let c=s%e;c>0&&e-c<a?s+=(e-c)%16:s+=(r-c%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var qu,Zu=p(()=>{"use strict";qu={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function kv(i,t){let e=Math.max(qu[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
953
+ }`,name:"big-triangle"});this._bigTriangleShader=new Ot({glProgram:s,resources:{uTexture:I.WHITE.source}})}renderStart(t){let e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){let r=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=r.colorTexture,t.target=this._getBackBufferTexture(r.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){let 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:TB,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new I({source:new gt({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)}};gm.extension={type:[y.WebGLSystem],name:"backBuffer",priority:1};gm.defaultOptions={useBackBuffer:!1};QA=gm});var Va,tE=m(()=>{R();Va=class{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}};Va.extension={type:[y.WebGLSystem],name:"colorMask"}});var Wa,eE=m(()=>{R();Wa=class{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){let e=this._renderer,{geometry:r,shader:s,state:o,skipSync:n,topology:a,size:h,start:l,instanceCount:c}=t;e.shader.bind(s,n),e.geometry.bind(r,e.shader._activeProgram),o&&e.state.set(o),e.geometry.draw(a,h,l,c??r.instanceCount)}destroy(){this._renderer=null}};Wa.extension={type:[y.WebGLSystem],name:"encoder"}});var za,rE=m(()=>{R();hm();$i();za=class{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:Pt.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){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:Pt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}resetState(){this._stencilCache.enabled=!1,this._stencilCache.stencilMode=Pt.NONE,this._stencilCache.stencilReference=0}setStencilMode(t,e){let r=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,o=Br[t],n=this._stencilCache;if(r.stencilMode=t,r.stencilReference=e,t===Pt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==n.stencilMode||n.stencilReference!==e)&&(n.stencilMode=t,n.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[o.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[o.stencilBack.passOp]))}};za.extension={type:[y.WebGLSystem],name:"stencil"}});function iE(i){let t=i.map(o=>({data:o,offset:0,size:0})),e=16,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(r=xm[n.data.type],!r)throw new Error(`Unknown type ${n.data.type}`);n.data.size>1&&(r=Math.max(r,e)*n.data.size);let a=r===12?16:r;n.size=r;let h=s%e;h>0&&e-h<a?s+=(e-h)%16:s+=(r-h%r)%r,n.offset=s,s+=r}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}var xm,_m=m(()=>{"use strict";xm={f32:4,i32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"vec2<i32>":8,"vec3<i32>":12,"vec4<i32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64}});function sE(i,t){let e=Math.max(xm[i.data.type]/16,1),r=i.data.value.length/i.data.size,s=(4-r%4)%4,o=i.data.type.indexOf("i32")>=0?"dataInt32":"data";return`
954
954
  v = uv.${i.data.name};
955
955
  offset += ${t};
956
956
 
@@ -966,37 +966,37 @@ fn mainFragment(
966
966
  }
967
967
  ${s!==0?`arrayOffset += ${s};`:""}
968
968
  }
969
- `}var Fv=p(()=>{Zu()});function Uv(i){return Ga(i,"uboStd40",kv,Ou)}var Dv=p(()=>{Du();Lu();Fv()});var No,Ov=p(()=>{P();ku();Zu();Dv();No=class extends Fi{constructor(){super({createUboElements:Iv,generateUboSync:Uv})}};No.extension={type:[x.WebGLSystem],name:"ubo"}});var Wa,Lv=p(()=>{"use strict";Wa=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var za,Nv=p(()=>{vt();it();Jr();Bi();Lv();za=class{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,r,s,o){let n=this._renderTargetSystem,a=this._renderer,c=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,c.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),c=s.y;t.isRoot&&(c=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let h=this._viewPortCache;(h.x!==s.x||h.y!==c||h.width!==s.width||h.height!==s.height)&&(h.x=s.x,h.y=c,h.width=s.width,h.height=s.height,l.viewport(s.x,c,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Wa,o=t.colorTexture;return kt.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let 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(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?Ct.ALL:Ct.NONE);let o=this._renderer.gl;if(e&Ct.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let c=n.source;c.antialias&&(r.context.supports.msaa?e.msaa=!0:k("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(c,0);let h=r.texture.getGlSource(c).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,h,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[c]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,c)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,d=e.msaaRenderBuffer[c];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+c,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let 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,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&kt.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&kt.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var Ho,Hv=p(()=>{P();Wu();Nv();Ho=class extends Di{constructor(t){super(t),this.adaptor=new za,this.adaptor.init(t,this)}};Ho.extension={type:[x.WebGLSystem],name:"renderTarget"}});function Wv(i,t){let e=[],r=[`
969
+ `}var oE=m(()=>{_m()});function nE(i){return Sc(i,"uboStd40",sE,om)}var aE=m(()=>{sm();nm();oE()});var $a,hE=m(()=>{R();em();_m();aE();$a=class extends go{constructor(){super({createUboElements:iE,generateUboSync:nE})}};$a.extension={type:[y.WebGLSystem],name:"ubo"}});var Fc,lE=m(()=>{"use strict";Fc=class{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}});var Gc,cE=m(()=>{Yt();vt();Fs();co();lE();Gc=class{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new rt}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new rt}copyToTexture(t,e,r,s,o){let n=this._renderTargetSystem,a=this._renderer,h=n.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,h.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,o.x,o.y,r.x,r.y,s.width,s.height),e}startRenderPass(t,e=!0,r,s){let o=this._renderTargetSystem,n=t.colorTexture,a=o.getGpuRenderTarget(t),h=s.y;t.isRoot&&(h=n.pixelHeight-s.height),t.colorTextures.forEach(u=>{this._renderer.texture.unbind(u)});let l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);let c=this._viewPortCache;(c.x!==s.x||c.y!==h||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=h,c.width=s.width,c.height=s.height,l.viewport(s.x,h,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,r)}finishRenderPass(t){let r=this._renderTargetSystem.getGpuRenderTarget(t);if(!r.msaa)return;let s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,r.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,r.framebuffer),s.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,r.framebuffer)}initGpuRenderTarget(t){let r=this._renderer.gl,s=new Fc,o=t.colorTexture;return ge.test(o.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),r.bindFramebuffer(r.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){let 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(r=>{e.deleteRenderbuffer(r)}),t.msaaRenderBuffer=null}clear(t,e,r){if(!e)return;let s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?se.ALL:se.NONE);let o=this._renderer.gl;if(e&se.COLOR){r??(r=s.defaultClearColor);let n=this._clearColorCache,a=r;(n[0]!==a[0]||n[1]!==a[1]||n[2]!==a[2]||n[3]!==a[3])&&(n[0]=a[0],n[1]=a[1],n[2]=a[2],n[3]=a[3],o.clearColor(a[0],a[1],a[2],a[3]))}o.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;let r=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,r),(t.stencil||t.depth)&&this._resizeStencil(r)}_initColor(t,e){let r=this._renderer,s=r.gl,o=s.createFramebuffer();if(e.resolveTargetFramebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((n,a)=>{let h=n.source;h.antialias&&(r.context.supports.msaa?e.msaa=!0:H("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),r.texture.bindSource(h,0);let c=r.texture.getGlSource(h).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,c,0)}),e.msaa){let n=s.createFramebuffer();e.framebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),t.colorTextures.forEach((a,h)=>{let l=s.createRenderbuffer();e.msaaRenderBuffer[h]=l})}else e.framebuffer=o;this._resizeColor(t,e)}_resizeColor(t,e){let r=t.colorTexture.source;if(e.width=r.pixelWidth,e.height=r.pixelHeight,t.colorTextures.forEach((s,o)=>{o!==0&&s.source.resize(r.width,r.height,r._resolution)}),e.msaa){let s=this._renderer,o=s.gl,n=e.framebuffer;o.bindFramebuffer(o.FRAMEBUFFER,n),t.colorTextures.forEach((a,h)=>{let l=a.source;s.texture.bindSource(l,0);let u=s.texture.getGlSource(l).internalFormat,d=e.msaaRenderBuffer[h];o.bindRenderbuffer(o.RENDERBUFFER,d),o.renderbufferStorageMultisample(o.RENDERBUFFER,4,u,l.pixelWidth,l.pixelHeight),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0+h,o.RENDERBUFFER,d)})}}_initStencil(t){if(t.framebuffer===null)return;let e=this._renderer.gl,r=e.createRenderbuffer();t.depthStencilRenderBuffer=r,e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,r),this._resizeStencil(t)}_resizeStencil(t){let 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,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}prerender(t){let e=t.colorTexture.resource;this._renderer.context.multiView&&ge.test(e)&&this._renderer.context.ensureCanvasSize(e)}postrender(t){if(this._renderer.context.multiView&&ge.test(t.colorTexture.resource)){let e=this._renderer.context.canvas,r=t.colorTexture;r.context2D.drawImage(e,0,r.pixelHeight-e.height)}}}});var Xa,uE=m(()=>{R();lm();cE();Xa=class extends _o{constructor(t){super(t),this.adaptor=new Gc,this.adaptor.init(t,this)}};Xa.extension={type:[y.WebGLSystem],name:"renderTarget"}});function dE(i,t){let e=[],r=[`
970
970
  var g = s.groups;
971
971
  var sS = r.shader;
972
972
  var p = s.glProgram;
973
973
  var ugS = r.uniformGroup;
974
974
  var resources;
975
- `],s=!1,o=0,n=t._getProgramData(i.glProgram);for(let c in i.groups){let l=i.groups[c];e.push(`
976
- resources = g[${c}].resources;
977
- `);for(let h in l.resources){let u=l.resources[h];if(u instanceof st)if(u.ubo){let d=i._uniformBindMap[c][Number(h)];e.push(`
975
+ `],s=!1,o=0,n=t._getProgramData(i.glProgram);for(let h in i.groups){let l=i.groups[h];e.push(`
976
+ resources = g[${h}].resources;
977
+ `);for(let c in l.resources){let u=l.resources[c];if(u instanceof Tt)if(u.ubo){let d=i._uniformBindMap[h][Number(c)];e.push(`
978
978
  sS.bindUniformBlock(
979
- resources[${h}],
979
+ resources[${c}],
980
980
  '${d}',
981
981
  ${i.glProgram._uniformBlockData[d].index}
982
982
  );
983
983
  `)}else e.push(`
984
- ugS.updateUniformGroup(resources[${h}], p, sD);
985
- `);else if(u instanceof lr){let d=i._uniformBindMap[c][Number(h)];e.push(`
984
+ ugS.updateUniformGroup(resources[${c}], p, sD);
985
+ `);else if(u instanceof Si){let d=i._uniformBindMap[h][Number(c)];e.push(`
986
986
  sS.bindUniformBlock(
987
- resources[${h}],
987
+ resources[${c}],
988
988
  '${d}',
989
989
  ${i.glProgram._uniformBlockData[d].index}
990
990
  );
991
- `)}else if(u instanceof J){let d=i._uniformBindMap[c][h],f=n.uniformData[d];f&&(s||(s=!0,r.push(`
991
+ `)}else if(u instanceof gt){let d=i._uniformBindMap[h][c],f=n.uniformData[d];f&&(s||(s=!0,r.push(`
992
992
  var tS = r.texture;
993
993
  `)),t._gl.uniform1i(f.location,o),e.push(`
994
- tS.bind(resources[${h}], ${o});
994
+ tS.bind(resources[${c}], ${o});
995
995
  `),o++)}}}let a=[...r,...e].join(`
996
- `);return new Function("r","s","sD",a)}var zv=p(()=>{Ia();Nt();Yt()});var Va,Vv=p(()=>{"use strict";Va=class{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 Qu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var jv=p(()=>{"use strict"});function Ju(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function ja(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Ju(2*t);case"bvec3":return Ju(3*t);case"bvec4":return Ju(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var td=p(()=>{"use strict"});function ed(i,t){if(!Xa){let e=Object.keys(Xv);Xa={};for(let r=0;r<e.length;++r){let s=e[r];Xa[i[s]]=Xv[s]}}return Xa[t]}function $v(i,t){let e=ed(i,t);return _E[e]||"float32"}var Xa,Xv,_E,rd=p(()=>{"use strict";Xa=null,Xv={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},_E={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function Yv(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let c=$v(t,a.type);r[a.name]={location:0,format:c,stride:Zt(c).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var Kv=p(()=>{Br();rd()});function qv(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var Zv=p(()=>{"use strict"});function Qv(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),c=ed(t,o.type);e[n]={name:n,index:s,type:c,size:o.size,isArray:a,value:ja(c,o.size)}}return e}var Jv=p(()=>{td();rd()});function t0(i,t){let e=i.getShaderSource(t).split(`
997
- `).map((l,h)=>`${h}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
998
- `),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let c=e.join(`
999
- `);a[0]=c,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function e0(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||t0(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||t0(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var r0=p(()=>{"use strict"});function i0(i,t){let e=Qu(i,i.VERTEX_SHADER,t.vertex),r=Qu(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?k("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||e0(i,s,e,r),t._attributeData=Yv(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=Qv(s,i),t._uniformBlockData=qv(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let c in t._uniformData){let l=t._uniformData[c];n[c]={location:i.getUniformLocation(s,c),value:ja(l.type,l.size)}}return new Va(s,n)}var s0=p(()=>{it();Vv();jv();td();Kv();Zv();Jv();r0()});var $a,Wo,o0=p(()=>{P();Ar();zv();s0();$a={textureCount:0,blockIndex:0},Wo=class{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=ae()}bind(t,e){if(this._setProgram(t.glProgram),e)return;$a.textureCount=0,$a.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,$a)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,$a)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,c=s.updateBuffer(a),l=s.freeLocationForBufferBase(c);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(c,l):s.bindBufferRange(c,l,u)}else s.getLastBindBaseLocation(c)!==l&&s.bindBufferBase(c,l);let h=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==l&&(o.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(o.program,h,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=i0(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return Wv(t,e)}resetState(){this._activeProgram=null}};Wo.extension={type:[x.WebGLSystem],name:"shader"}});var n0,a0,c0=p(()=>{"use strict";n0={f32:`if (cv !== v) {
996
+ `);return new Function("r","s","sD",a)}var fE=m(()=>{Ac();Ae();Be()});var Uc,pE=m(()=>{"use strict";Uc=class{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 ym(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}var mE=m(()=>{"use strict"});function bm(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function kc(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return bm(2*t);case"bvec3":return bm(3*t);case"bvec4":return bm(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var vm=m(()=>{"use strict"});function Tm(i,t){if(!Oc){let e=Object.keys(gE);Oc={};for(let r=0;r<e.length;++r){let s=e[r];Oc[i[s]]=gE[s]}}return Oc[t]}function xE(i,t){let e=Tm(i,t);return SB[e]||"float32"}var Oc,gE,SB,Sm=m(()=>{"use strict";Oc=null,gE={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"},SB={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"}});function _E(i,t,e=!1){let r={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let n=0;n<s;n++){let a=t.getActiveAttrib(i,n);if(a.name.startsWith("gl_"))continue;let h=xE(t,a.type);r[a.name]={location:0,format:h,stride:Ge(h).stride,offset:0,instance:!1,start:0}}let o=Object.keys(r);if(e){o.sort((n,a)=>n>a?1:-1);for(let n=0;n<o.length;n++)r[o[n]].location=n,t.bindAttribLocation(i,n,o[n]);t.linkProgram(i)}else for(let n=0;n<o.length;n++)r[o[n]].location=t.getAttribLocation(i,o[n]);return r}var yE=m(()=>{ji();Sm()});function bE(i,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<r;s++){let o=t.getActiveUniformBlockName(i,s),n=t.getUniformBlockIndex(i,o),a=t.getActiveUniformBlockParameter(i,s,t.UNIFORM_BLOCK_DATA_SIZE);e[o]={name:o,index:n,size:a}}return e}var vE=m(()=>{"use strict"});function TE(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=Tm(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:kc(h,o.size)}}return e}var SE=m(()=>{vm();Sm()});function AE(i,t){let e=i.getShaderSource(t).split(`
997
+ `).map((l,c)=>`${c}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
998
+ `),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=e.join(`
999
+ `);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function EE(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||AE(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||AE(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var wE=m(()=>{"use strict"});function CE(i,t){let e=ym(i,i.VERTEX_SHADER,t.vertex),r=ym(i,i.FRAGMENT_SHADER,t.fragment),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.transformFeedbackVaryings;o&&(typeof i.transformFeedbackVaryings!="function"?H("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||EE(i,s,e,r),t._attributeData=_E(s,i,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=TE(s,i),t._uniformBlockData=bE(s,i),i.deleteShader(e),i.deleteShader(r);let n={};for(let h in t._uniformData){let l=t._uniformData[h];n[h]={location:i.getUniformLocation(s,h),value:kc(l.type,l.size)}}return new Uc(s,n)}var PE=m(()=>{vt();pE();mE();vm();yE();vE();SE();wE()});var Nc,ja,RE=m(()=>{R();zi();fE();PE();Nc={textureCount:0,blockIndex:0},ja=class{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=Qe()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Nc.textureCount=0,Nc.blockIndex=0;let r=this._shaderSyncFunctions[t.glProgram._key];r||(r=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),this._renderer.buffer.nextBindBase(!!t.glProgram.transformFeedbackVaryings),r(this._renderer,t,Nc)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Nc)}bindUniformBlock(t,e,r=0){let s=this._renderer.buffer,o=this._getProgramData(this._activeProgram),n=t._bufferResource;n||this._renderer.ubo.updateUniformGroup(t);let a=t.buffer,h=s.updateBuffer(a),l=s.freeLocationForBufferBase(h);if(n){let{offset:u,size:d}=t;u===0&&d===a.data.byteLength?s.bindBufferBase(h,l):s.bindBufferRange(h,l,u)}else s.getLastBindBaseLocation(h)!==l&&s.bindBufferBase(h,l);let c=this._activeProgram._uniformBlockData[e].index;o.uniformBlockBindings[r]!==l&&(o.uniformBlockBindings[r]=l,this._renderer.gl.uniformBlockBinding(o.program,c,l))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;let e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){let e=t._key;return this._programDataHash[e]=CE(this._gl,t),this._programDataHash[e]}destroy(){for(let t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null}_generateShaderSync(t,e){return dE(t,e)}resetState(){this._activeProgram=null}};ja.extension={type:[y.WebGLSystem],name:"shader"}});var ME,BE,IE=m(()=>{"use strict";ME={f32:`if (cv !== v) {
1000
1000
  cu.value = v;
1001
1001
  gl.uniform1f(location, v);
1002
1002
  }`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
@@ -1068,26 +1068,30 @@ fn mainFragment(
1068
1068
  cv[2] = v[2];
1069
1069
  cv[3] = v[3];
1070
1070
  gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1071
- }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},a0={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function l0(i,t){let e=[`
1071
+ }`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},BE={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"}});function FE(i,t){let e=[`
1072
1072
  var v = null;
1073
1073
  var cv = null;
1074
1074
  var cu = null;
1075
1075
  var t = 0;
1076
1076
  var gl = renderer.gl;
1077
1077
  var name = null;
1078
- `];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof st?i.uniforms[r].ubo?e.push(`
1078
+ `];for(let r in i.uniforms){if(!t[r]){i.uniforms[r]instanceof Tt?i.uniforms[r].ubo?e.push(`
1079
1079
  renderer.shader.bindUniformBlock(uv.${r}, "${r}");
1080
1080
  `):e.push(`
1081
1081
  renderer.shader.updateUniformGroup(uv.${r});
1082
- `):i.uniforms[r]instanceof lr&&e.push(`
1082
+ `):i.uniforms[r]instanceof Si&&e.push(`
1083
1083
  renderer.shader.bindBufferResource(uv.${r}, "${r}");
1084
- `);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<Ke.length;n++){let a=Ke[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,Ke[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?n0:a0)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1084
+ `);continue}let s=i.uniformStructures[r],o=!1;for(let n=0;n<Zr.length;n++){let a=Zr[n];if(s.type===a.type&&a.test(s)){e.push(`name = "${r}";`,Zr[n].uniform),o=!0;break}}if(!o){let a=(s.size===1?ME:BE)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1085
1085
  cu = ud["${r}"];
1086
1086
  cv = cu.value;
1087
1087
  v = uv["${r}"];
1088
1088
  ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1089
- `))}var h0=p(()=>{Ia();Nt();Uu();c0()});var zo,u0=p(()=>{P();h0();zo=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return l0(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};zo.extension={type:[x.WebGLSystem],name:"uniformGroup"}});function d0(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof D.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var f0=p(()=>{ct()});var yE,bE,vE,TE,SE,wE,p0,m0,g0=p(()=>{P();_e();f0();yE=0,bE=1,vE=2,TE=3,SE=4,wE=5,p0=class id{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[yE]=this.setBlend,this.map[bE]=this.setOffset,this.map[vE]=this.setCullFace,this.map[TE]=this.setDepthTest,this.map[SE]=this.setFrontFace,this.map[wE]=this.setDepthMask,this.checks=[],this.defaultState=_t.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=d0(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(id._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(id._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};p0.extension={type:[x.WebGLSystem],name:"state"};m0=p0});var Ya,x0=p(()=>{Yu();Ya=class{constructor(t){this.target=$u.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=Z.UNSIGNED_BYTE,this.internalFormat=Ha.RGBA,this.format=Ha.RGBA,this.samplerType=0}}});var _0,y0=p(()=>{"use strict";_0={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var EE,b0,v0=p(()=>{"use strict";EE={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},b0={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!EE[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Ka,sd=p(()=>{"use strict";Ka={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,c=i.resourceWidth,l=i.resourceHeight;c<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,c,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var T0,S0=p(()=>{sd();T0={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Ka.upload(i,t,e,r)}}});var od,w0,qa,E0,P0=p(()=>{"use strict";od={linear:9729,nearest:9728},w0={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},qa={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},E0={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function nd(i,t,e,r,s,o,n,a){let c=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=qa[n?"clamp-to-edge":i.addressModeU],h=qa[n?"clamp-to-edge":i.addressModeV],u=qa[n?"clamp-to-edge":i.addressModeW];t[s](c,t.TEXTURE_WRAP_S,l),t[s](c,t.TEXTURE_WRAP_T,h),t.TEXTURE_WRAP_R&&t[s](c,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](c,t.TEXTURE_MAG_FILTER,od[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=w0[i.minFilter][i.mipmapFilter];t[s](c,t.TEXTURE_MIN_FILTER,l)}}else t[s](c,t.TEXTURE_MIN_FILTER,od[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](c,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](c,t.TEXTURE_COMPARE_FUNC,E0[i.compare])}var A0=p(()=>{P0()});function C0(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var M0=p(()=>{"use strict"});function B0(i,t){let e={},r=i.RGBA;return i instanceof D.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var R0=p(()=>{ct()});function G0(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var I0=p(()=>{"use strict"});var PE,Vo,k0=p(()=>{ct();P();tt();x0();y0();v0();sd();S0();A0();M0();R0();I0();PE=4,Vo=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Ka,buffer:_0,video:T0,compressed:b0},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=B0(t,this._renderer.context.extensions),this._mapFormatToType=G0(t),this._mapFormatToFormat=C0(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(M.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=M.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Ya(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,nd(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,nd(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=D.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(PE*s*o),a=this._renderer,c=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(c),h=a.gl;return h.bindFramebuffer(h.FRAMEBUFFER,l.resolveTargetFramebuffer),h.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,h.RGBA,h.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(M.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};Vo.extension={type:[x.WebGLSystem],name:"texture"}});var O0={};Ud(O0,{WebGLRenderer:()=>ad});var AE,CE,ME,F0,U0,D0,ad,L0=p(()=>{P();pv();mv();gv();Ks();Iu();Be();yv();Tv();Pv();Mv();Bv();Rv();Gv();Ov();Hv();o0();u0();g0();k0();AE=[...Ba,No,Cv,vv,Fo,Vo,Ho,Uo,zo,Wo,Oo,m0,Lo,Do],CE=[...Ra],ME=[Io,Go,Ro],F0=[],U0=[],D0=[];I.handleByNamedList(x.WebGLSystem,F0);I.handleByNamedList(x.WebGLPipes,U0);I.handleByNamedList(x.WebGLPipesAdaptor,D0);I.add(...AE,...CE,...ME);ad=class extends cr{constructor(){let t={name:"webgl",type:bt.WEBGL,systems:F0,renderPipes:U0,renderPipeAdaptors:D0};super(t)}}});P();var gy={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(my(),Kw))}};P();var _y={extension:{type:x.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(xy(),qw))}};P();P();Rn();wn();P();ct();Ks();var wa;function Py(i){return wa!==void 0||(wa=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??cr.defaultOptions.failIfMajorPerformanceCaveat};try{if(!D.get().getWebGLRenderingContext())return!1;let r=D.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),wa}ct();var Ea;async function Ay(i={}){return Ea!==void 0||(Ea=await(async()=>{let t=D.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),Ea}Ks();var N0=["webgl","webgpu","canvas"];async function H0(i){let t=[];i.preference?(t.push(i.preference),N0.forEach(o=>{o!==i.preference&&t.push(o)})):t=N0.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await Ay()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(fv(),dv));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&Py(i.failIfMajorPerformanceCaveat??cr.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(L0(),O0));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}me();bu();dt();var W0=class cd{constructor(...t){this.stage=new nt,t[0]!==void 0&&U(H,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await H0(t),cd._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return U(H,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=cd._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};W0._plugins=[];var Za=W0;I.handleByList(x.Application,Za._plugins);I.add(oo);P();ze();bl();ct();P();Er();vt();tt();qh();eu();var jo=class extends wi{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:c}=r[n.page],l=new z(n.x+a.x,n.y+a.y,n.width,n.height),h=new M({source:c,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:h}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){Hs.install(t)}static uninstall(t){Hs.uninstall(t)}};var Qa={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),m={};for(let g in f){let _=f[g].split("="),b=_[0],y=_[1].replace(/"/gm,""),v=parseFloat(y),S=isNaN(v)?y:v;m[b]=S}e[d].push(m)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let c={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),m=d.letter??d.char??String.fromCharCode(f);m==="space"&&(m=" "),c[f]=m,r.chars[m]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let h=e.kerning||[];for(let u=0;u<h.length;u++){let d=parseInt(h[u].first,10),f=parseInt(h[u].second,10),m=parseInt(h[u].amount,10);r.chars[c[f]].kerning[c[d]]=m}return r}};ct();var ld={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let c={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let h=n[l],u=parseInt(h.getAttribute("id"),10),d=h.getAttribute("letter")??h.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),c[u]=d,t.chars[d]={id:u,page:parseInt(h.getAttribute("page"),10)||0,x:parseInt(h.getAttribute("x"),10),y:parseInt(h.getAttribute("y"),10),width:parseInt(h.getAttribute("width"),10),height:parseInt(h.getAttribute("height"),10),xOffset:parseInt(h.getAttribute("xoffset"),10),yOffset:parseInt(h.getAttribute("yoffset"),10),xAdvance:parseInt(h.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let h=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[c[u]].kerning[c[h]]=d}return t}};var hd={test(i){return typeof i=="string"&&i.includes("<font>")?ld.test(D.get().parseXML(i)):!1},parse(i){return ld.parse(D.get().parseXML(i))}};var BE=[".xml",".fnt"],z0={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof jo,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},V0={extension:{type:x.LoadParser,priority:Et.Normal},name:"loadBitmapFont",test(i){return BE.includes(Tt.extname(i).toLowerCase())},async testParse(i){return Qa.test(i)||hd.test(i)},async parse(i,t,e){let r=Qa.test(i)?Qa.parse(i):hd.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=Tt.join(Tt.dirname(s),d);f=ms(f,s),n.push({src:f,data:a})}let c=await e.load(n),l=n.map(u=>c[u.src]);return new jo({data:r,textures:l},s)},async load(i,t){return await(await D.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};it();var Ja=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};tr();P();tt();var j0={extension:{type:x.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof M),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};P();async function tc(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var X0={extension:{type:x.DetectionParser,priority:1},test:async()=>tc("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};P();var $0=["png","jpg","jpeg"],Y0={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...$0],remove:async i=>i.filter(t=>!$0.includes(t))};P();var RE="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function Oi(i){return RE?!1:document.createElement("video").canPlayType(i)!==""}var K0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};P();var q0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};P();var Z0={extension:{type:x.DetectionParser,priority:0},test:async()=>Oi("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};P();var Q0={extension:{type:x.DetectionParser,priority:0},test:async()=>tc("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};it();Er();ps();Sn();var ec=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||k(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return k(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=Pr(t),n=Ot(t,l=>({alias:[l],src:l,data:{}})),a=n.length,c=n.map(async l=>{let h=Tt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[h]||(this.promiseCache[h]=this._getLoadPromiseAndParser(h,l)),s[l.src]=await this.promiseCache[h].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[h],delete s[l.src],new Error(`[Loader.load] Failed to load ${h}.
1090
- ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Ot(t,s=>({alias:[s],src:s})).map(async s=>{let o=Tt.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&k(`[Assets] loadParser name conflict "${e.name}"`):k("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};ct();P();function ue(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}Er();function de(i,t){let e=i.split("?")[0],r=Tt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}ze();var GE=".json",IE="application/json",J0={extension:{type:x.LoadParser,priority:Et.Low},name:"loadJson",test(i){return ue(i,IE)||de(i,GE)},async load(i){return await(await D.get().fetch(i)).json()}};ct();P();ze();var kE=".txt",FE="text/plain",tT={name:"loadTxt",extension:{type:x.LoadParser,priority:Et.Low,name:"loadTxt"},test(i){return ue(i,FE)||de(i,kE)},async load(i){return await(await D.get().fetch(i)).text()}};ct();P();it();Er();tr();ze();var UE=["normal","bold","100","200","300","400","500","600","700","800","900"],DE=[".ttf",".otf",".woff",".woff2"],OE=["font/ttf","font/otf","font/woff","font/woff2"],LE=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function NE(i){let t=Tt.extname(i),s=Tt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(LE)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var HE=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function WE(i){return HE.test(i)?i:encodeURI(i)}var eT={extension:{type:x.LoadParser,priority:Et.Low},name:"loadWebFont",test(i){return ue(i,OE)||de(i,DE)},async load(i,t){let e=D.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??NE(i),o=t.data?.weights?.filter(a=>UE.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let c=o[a],l=new FontFace(s,`url(${WE(i)})`,{...n,weight:c});await l.load(),e.add(l),r.push(l)}return Q.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return k("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{Q.remove(`${t.family}-and-url`),D.get().getFontFaceSet().delete(t)})}};ct();P();ti();la();Qr();function Li(i,t=1){let e=se.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}ze();tt();it();tr();function Ni(i,t,e){i.label=e,i._sourceOrigin=e;let r=new M({source:i,label:e}),s=()=>{delete t.promiseCache[e],Q.has(e)&&Q.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(k("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(k("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var zE=".svg",VE="image/svg+xml",rT={extension:{type:x.LoadParser,priority:Et.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return ue(i,VE)||de(i,zE)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?XE(i):jE(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function jE(i,t,e,r){let o=await(await D.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let c=document.createElement("canvas"),l=c.getContext("2d"),h=t.data?.resolution||Li(i),u=t.data?.width??a.width,d=t.data?.height??a.height;c.width=u*h,c.height=d*h,l.drawImage(a,0,0,u*h,d*h);let{parseAsGraphicsContext:f,...m}=t.data??{},g=new qt({resource:c,alphaMode:"premultiply-alpha-on-upload",resolution:h,...m});return Ni(g,e,i)}async function XE(i){let e=await(await D.get().fetch(i)).text(),r=new Ht;return r.svg(e),r}ct();P();ti();var $E=`(function () {
1089
+ `))}var GE=m(()=>{Ac();Ae();im();IE()});var Ya,UE=m(()=>{R();GE();Ya=class{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,r){let s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,r))}_getUniformSyncFunction(t,e){return this._uniformGroupSyncHash[t._signature]?.[e._key]||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){let r=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),r[e._key]=this._cache[s],r[e._key]}_generateUniformsSync(t,e){return FE(t,e)}_getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}destroy(){this._renderer=null,this._cache=null}};Ya.extension={type:[y.WebGLSystem],name:"uniformGroup"}});function kE(i){let t={};if(t.normal=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t.add=[i.ONE,i.ONE],t.multiply=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.screen=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t["screen-npm"]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t.erase=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],!(i instanceof j.get().getWebGLRenderingContext()))t.min=[i.ONE,i.ONE,i.ONE,i.ONE,i.MIN,i.MIN],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,i.MAX,i.MAX];else{let r=i.getExtension("EXT_blend_minmax");r&&(t.min=[i.ONE,i.ONE,i.ONE,i.ONE,r.MIN_EXT,r.MIN_EXT],t.max=[i.ONE,i.ONE,i.ONE,i.ONE,r.MAX_EXT,r.MAX_EXT])}return t}var OE=m(()=>{wt()});var AB,EB,wB,CB,PB,RB,NE,DE,LE=m(()=>{R();fr();OE();AB=0,EB=1,wB=2,CB=3,PB=4,RB=5,NE=class Am{constructor(t){this._invertFrontFace=!1,this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[AB]=this.setBlend,this.map[EB]=this.setOffset,this.map[wB]=this.setCullFace,this.map[CB]=this.setDepthTest,this.map[PB]=this.setFrontFace,this.map[RB]=this.setDepthMask,this.checks=[],this.defaultState=Lt.for2d(),t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){this._invertFrontFace=!t.isRoot,this._cullFace?this.setFrontFace(this._frontFace):this._frontFaceDirty=!0}contextChange(t){this.gl=t,this.blendModesMap=kE(t),this.resetState()}set(t){if(t||(t=this.defaultState),this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e>>=1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t||(t=this.defaultState);for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(Am._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(Am._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this._cullFace=t,this.gl[t?"enable":"disable"](this.gl.CULL_FACE),this._cullFace&&this._frontFaceDirty&&this.setFrontFace(this._frontFace)}setFrontFace(t){this._frontFace=t,this._frontFaceDirty=!1;let e=this._invertFrontFace?!t:t;this._glFrontFace!==e&&(this._glFrontFace=e,this.gl.frontFace(this.gl[e?"CW":"CCW"]))}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;let e=this.blendModesMap[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}resetState(){this._glFrontFace=!1,this._frontFace=!1,this._cullFace=!1,this._frontFaceDirty=!1,this._invertFrontFace=!1,this.gl.frontFace(this.gl.CCW),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};NE.extension={type:[y.WebGLSystem],name:"state"};DE=NE});var Dc,HE=m(()=>{mm();Dc=class{constructor(t){this.target=pm.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=ft.UNSIGNED_BYTE,this.internalFormat=Ic.RGBA,this.format=Ic.RGBA,this.samplerType=0}}});var VE,WE=m(()=>{"use strict";VE={id:"buffer",upload(i,t,e){t.width===i.width||t.height===i.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,i.width,i.height,0,t.format,t.type,i.resource),t.width=i.width,t.height=i.height}}});var MB,zE,$E=m(()=>{"use strict";MB={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},zE={id:"compressed",upload(i,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let r=i.pixelWidth,s=i.pixelHeight,o=!!MB[i.format];for(let n=0;n<i.resource.length;n++){let a=i.resource[n];o?e.compressedTexImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,a):e.texImage2D(e.TEXTURE_2D,n,t.internalFormat,r,s,0,t.format,t.type,a),r=Math.max(r>>1,1),s=Math.max(s>>1,1)}}}});var Lc,Em=m(()=>{"use strict";Lc={id:"image",upload(i,t,e,r){let s=t.width,o=t.height,n=i.pixelWidth,a=i.pixelHeight,h=i.resourceWidth,l=i.resourceHeight;h<n||l<a?((s!==n||o!==a)&&e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,null),r===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,h,l,t.format,t.type,i.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource)):s===n&&o===a?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,i.resource):r===2?e.texImage2D(t.target,0,t.internalFormat,n,a,0,t.format,t.type,i.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,i.resource),t.width=n,t.height=a}}});var XE,jE=m(()=>{Em();XE={id:"video",upload(i,t,e,r){if(!i.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}Lc.upload(i,t,e,r)}}});var wm,YE,Hc,qE,KE=m(()=>{"use strict";wm={linear:9729,nearest:9728},YE={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Hc={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},qE={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519}});function Cm(i,t,e,r,s,o,n,a){let h=o;if(!a||i.addressModeU!=="repeat"||i.addressModeV!=="repeat"||i.addressModeW!=="repeat"){let l=Hc[n?"clamp-to-edge":i.addressModeU],c=Hc[n?"clamp-to-edge":i.addressModeV],u=Hc[n?"clamp-to-edge":i.addressModeW];t[s](h,t.TEXTURE_WRAP_S,l),t[s](h,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](h,t.TEXTURE_WRAP_R,u)}if((!a||i.magFilter!=="linear")&&t[s](h,t.TEXTURE_MAG_FILTER,wm[i.magFilter]),e){if(!a||i.mipmapFilter!=="linear"){let l=YE[i.minFilter][i.mipmapFilter];t[s](h,t.TEXTURE_MIN_FILTER,l)}}else t[s](h,t.TEXTURE_MIN_FILTER,wm[i.minFilter]);if(r&&i.maxAnisotropy>1){let l=Math.min(i.maxAnisotropy,t.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](h,r.TEXTURE_MAX_ANISOTROPY_EXT,l)}i.compare&&t[s](h,t.TEXTURE_COMPARE_FUNC,qE[i.compare])}var ZE=m(()=>{KE()});function QE(i){return{r8unorm:i.RED,r8snorm:i.RED,r8uint:i.RED,r8sint:i.RED,r16uint:i.RED,r16sint:i.RED,r16float:i.RED,rg8unorm:i.RG,rg8snorm:i.RG,rg8uint:i.RG,rg8sint:i.RG,r32uint:i.RED,r32sint:i.RED,r32float:i.RED,rg16uint:i.RG,rg16sint:i.RG,rg16float:i.RG,rgba8unorm:i.RGBA,"rgba8unorm-srgb":i.RGBA,rgba8snorm:i.RGBA,rgba8uint:i.RGBA,rgba8sint:i.RGBA,bgra8unorm:i.RGBA,"bgra8unorm-srgb":i.RGBA,rgb9e5ufloat:i.RGB,rgb10a2unorm:i.RGBA,rg11b10ufloat:i.RGB,rg32uint:i.RG,rg32sint:i.RG,rg32float:i.RG,rgba16uint:i.RGBA,rgba16sint:i.RGBA,rgba16float:i.RGBA,rgba32uint:i.RGBA,rgba32sint:i.RGBA,rgba32float:i.RGBA,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT,depth24plus:i.DEPTH_COMPONENT,"depth24plus-stencil8":i.DEPTH_STENCIL,depth32float:i.DEPTH_COMPONENT,"depth32float-stencil8":i.DEPTH_STENCIL}}var JE=m(()=>{"use strict"});function tw(i,t){let e={},r=i.RGBA;return i instanceof j.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":i.SRGB8_ALPHA8,"bgra8unorm-srgb":i.SRGB8_ALPHA8},r=i.RGBA8),{r8unorm:i.R8,r8snorm:i.R8_SNORM,r8uint:i.R8UI,r8sint:i.R8I,r16uint:i.R16UI,r16sint:i.R16I,r16float:i.R16F,rg8unorm:i.RG8,rg8snorm:i.RG8_SNORM,rg8uint:i.RG8UI,rg8sint:i.RG8I,r32uint:i.R32UI,r32sint:i.R32I,r32float:i.R32F,rg16uint:i.RG16UI,rg16sint:i.RG16I,rg16float:i.RG16F,rgba8unorm:i.RGBA,...e,rgba8snorm:i.RGBA8_SNORM,rgba8uint:i.RGBA8UI,rgba8sint:i.RGBA8I,bgra8unorm:r,rgb9e5ufloat:i.RGB9_E5,rgb10a2unorm:i.RGB10_A2,rg11b10ufloat:i.R11F_G11F_B10F,rg32uint:i.RG32UI,rg32sint:i.RG32I,rg32float:i.RG32F,rgba16uint:i.RGBA16UI,rgba16sint:i.RGBA16I,rgba16float:i.RGBA16F,rgba32uint:i.RGBA32UI,rgba32sint:i.RGBA32I,rgba32float:i.RGBA32F,stencil8:i.STENCIL_INDEX8,depth16unorm:i.DEPTH_COMPONENT16,depth24plus:i.DEPTH_COMPONENT24,"depth24plus-stencil8":i.DEPTH24_STENCIL8,depth32float:i.DEPTH_COMPONENT32F,"depth32float-stencil8":i.DEPTH32F_STENCIL8,...t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{},...t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{},...t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{},...t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{},...t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{},...t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{}}}var ew=m(()=>{wt()});function rw(i){return{r8unorm:i.UNSIGNED_BYTE,r8snorm:i.BYTE,r8uint:i.UNSIGNED_BYTE,r8sint:i.BYTE,r16uint:i.UNSIGNED_SHORT,r16sint:i.SHORT,r16float:i.HALF_FLOAT,rg8unorm:i.UNSIGNED_BYTE,rg8snorm:i.BYTE,rg8uint:i.UNSIGNED_BYTE,rg8sint:i.BYTE,r32uint:i.UNSIGNED_INT,r32sint:i.INT,r32float:i.FLOAT,rg16uint:i.UNSIGNED_SHORT,rg16sint:i.SHORT,rg16float:i.HALF_FLOAT,rgba8unorm:i.UNSIGNED_BYTE,"rgba8unorm-srgb":i.UNSIGNED_BYTE,rgba8snorm:i.BYTE,rgba8uint:i.UNSIGNED_BYTE,rgba8sint:i.BYTE,bgra8unorm:i.UNSIGNED_BYTE,"bgra8unorm-srgb":i.UNSIGNED_BYTE,rgb9e5ufloat:i.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:i.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:i.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:i.UNSIGNED_INT,rg32sint:i.INT,rg32float:i.FLOAT,rgba16uint:i.UNSIGNED_SHORT,rgba16sint:i.SHORT,rgba16float:i.HALF_FLOAT,rgba32uint:i.UNSIGNED_INT,rgba32sint:i.INT,rgba32float:i.FLOAT,stencil8:i.UNSIGNED_BYTE,depth16unorm:i.UNSIGNED_SHORT,depth24plus:i.UNSIGNED_INT,"depth24plus-stencil8":i.UNSIGNED_INT_24_8,depth32float:i.FLOAT,"depth32float-stencil8":i.FLOAT_32_UNSIGNED_INT_24_8_REV}}var iw=m(()=>{"use strict"});var BB,qa,sw=m(()=>{wt();R();xt();HE();WE();$E();Em();jE();ZE();JE();ew();iw();BB=4,qa=class{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:Lc,buffer:VE,video:XE,compressed:zE},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=tw(t,this._renderer.context.extensions),this._mapFormatToType=rw(t),this._mapFormatToFormat=QE(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(I.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){let r=t.source;t?(this.bindSource(r,e),this._useSeparateSamplers&&this._bindSampler(r.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){let r=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t||(t=I.EMPTY.source);let s=this.getGlSource(t);r.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){let r=this._gl;if(!t){this._boundSamplers[e]=null,r.bindSampler(e,null);return}let s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,r.bindSampler(e,s))}unbind(t){let e=t.source,r=this._boundTextures,s=this._gl;for(let o=0;o<r.length;o++)if(r[o]===e){this._activateLocation(o);let n=this.getGlSource(e);s.bindTexture(n.target,null),r[o]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){let e=this._gl,r=new Dc(e.createTexture());if(r.type=this._mapFormatToType[t.format],r.internalFormat=this._mapFormatToInternalFormat[t.format],r.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){let s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=r,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),r}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){let r=this._gl,s=this.getGlSource(t);r.bindTexture(r.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,Cm(t.style,r,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",r.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){let e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){let e=this._gl,r=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,r.texture),this._boundTextures[this._activeTextureLocation]=t;let s=t.alphaMode==="premultiply-alpha-on-upload";this._premultiplyAlpha!==s&&(this._premultiplyAlpha=s,e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s)),this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,r,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);let r=this.getGlSource(t);this._gl.generateMipmap(r.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){let e=this._gl,r=this._gl.createSampler();return this._glSamplers[t._resourceId]=r,Cm(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",r,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){let{pixels:e,width:r,height:s}=this.getPixels(t),o=j.get().createCanvas();o.width=r,o.height=s;let n=o.getContext("2d");if(n){let a=n.createImageData(r,s);a.data.set(e),n.putImageData(a,0,0)}return o}getPixels(t){let e=t.source.resolution,r=t.frame,s=Math.max(Math.round(r.width*e),1),o=Math.max(Math.round(r.height*e),1),n=new Uint8Array(BB*s*o),a=this._renderer,h=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(h),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(r.x*e),Math.round(r.y*e),s,o,c.RGBA,c.UNSIGNED_BYTE,n),{pixels:new Uint8ClampedArray(n.buffer),width:s,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}resetState(){this._activeTextureLocation=-1,this._boundTextures.fill(I.EMPTY.source),this._boundSamplers=Object.create(null);let t=this._gl;this._premultiplyAlpha=!1,t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this._premultiplyAlpha)}};qa.extension={type:[y.WebGLSystem],name:"texture"}});var hw={};dx(hw,{WebGLRenderer:()=>Pm});var IB,FB,GB,ow,nw,aw,Pm,lw=m(()=>{R();NA();DA();LA();ea();tm();Cr();WA();XA();KA();JA();tE();eE();rE();hE();uE();RE();UE();LE();sw();IB=[...vc,$a,QA,$A,La,qa,Xa,Ha,Ya,ja,Wa,DE,za,Va],FB=[...Tc],GB=[Na,Oa,ka],ow=[],nw=[],aw=[];D.handleByNamedList(y.WebGLSystem,ow);D.handleByNamedList(y.WebGLPipes,nw);D.handleByNamedList(y.WebGLPipesAdaptor,aw);D.add(...IB,...FB,...GB);Pm=class extends Ti{constructor(){let t={name:"webgl",type:zt.WEBGL,systems:ow,renderPipes:nw,renderPipeAdaptors:aw};super(t)}}});var Gw=Q((ait,Om)=>{"use strict";var lI=Object.prototype.hasOwnProperty,Re="~";function Ja(){}Object.create&&(Ja.prototype=Object.create(null),new Ja().__proto__||(Re=!1));function cI(i,t,e){this.fn=i,this.context=t,this.once=e||!1}function Fw(i,t,e,r,s){if(typeof e!="function")throw new TypeError("The listener must be a function");var o=new cI(e,r||i,s),n=Re?Re+t:t;return i._events[n]?i._events[n].fn?i._events[n]=[i._events[n],o]:i._events[n].push(o):(i._events[n]=o,i._eventsCount++),i}function Jc(i,t){--i._eventsCount===0?i._events=new Ja:delete i._events[t]}function xe(){this._events=new Ja,this._eventsCount=0}xe.prototype.eventNames=function(){var t=[],e,r;if(this._eventsCount===0)return t;for(r in e=this._events)lI.call(e,r)&&t.push(Re?r.slice(1):r);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t};xe.prototype.listeners=function(t){var e=Re?Re+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,o=r.length,n=new Array(o);s<o;s++)n[s]=r[s].fn;return n};xe.prototype.listenerCount=function(t){var e=Re?Re+t:t,r=this._events[e];return r?r.fn?1:r.length:0};xe.prototype.emit=function(t,e,r,s,o,n){var a=Re?Re+t:t;if(!this._events[a])return!1;var h=this._events[a],l=arguments.length,c,u;if(h.fn){switch(h.once&&this.removeListener(t,h.fn,void 0,!0),l){case 1:return h.fn.call(h.context),!0;case 2:return h.fn.call(h.context,e),!0;case 3:return h.fn.call(h.context,e,r),!0;case 4:return h.fn.call(h.context,e,r,s),!0;case 5:return h.fn.call(h.context,e,r,s,o),!0;case 6:return h.fn.call(h.context,e,r,s,o,n),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];h.fn.apply(h.context,c)}else{var d=h.length,f;for(u=0;u<d;u++)switch(h[u].once&&this.removeListener(t,h[u].fn,void 0,!0),l){case 1:h[u].fn.call(h[u].context);break;case 2:h[u].fn.call(h[u].context,e);break;case 3:h[u].fn.call(h[u].context,e,r);break;case 4:h[u].fn.call(h[u].context,e,r,s);break;default:if(!c)for(f=1,c=new Array(l-1);f<l;f++)c[f-1]=arguments[f];h[u].fn.apply(h[u].context,c)}}return!0};xe.prototype.on=function(t,e,r){return Fw(this,t,e,r,!1)};xe.prototype.once=function(t,e,r){return Fw(this,t,e,r,!0)};xe.prototype.removeListener=function(t,e,r,s){var o=Re?Re+t:t;if(!this._events[o])return this;if(!e)return Jc(this,o),this;var n=this._events[o];if(n.fn)n.fn===e&&(!s||n.once)&&(!r||n.context===r)&&Jc(this,o);else{for(var a=0,h=[],l=n.length;a<l;a++)(n[a].fn!==e||s&&!n[a].once||r&&n[a].context!==r)&&h.push(n[a]);h.length?this._events[o]=h.length===1?h[0]:h:Jc(this,o)}return this};xe.prototype.removeAllListeners=function(t){var e;return t?(e=Re?Re+t:t,this._events[e]&&Jc(this,e)):(this._events=new Ja,this._eventsCount=0),this};xe.prototype.off=xe.prototype.removeListener;xe.prototype.addListener=xe.prototype.on;xe.prefixed=Re;xe.EventEmitter=xe;typeof Om<"u"&&(Om.exports=xe)});var Uw=Q((wo,Co)=>{(function(i){var t=typeof wo=="object"&&wo&&!wo.nodeType&&wo,e=typeof Co=="object"&&Co&&!Co.nodeType&&Co,r=typeof global=="object"&&global;(r.global===r||r.window===r||r.self===r)&&(i=r);var s,o=2147483647,n=36,a=1,h=26,l=38,c=700,u=72,d=128,f="-",p=/^xn--/,g=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_=n-a,b=Math.floor,T=String.fromCharCode,E;function A(N){throw new RangeError(v[N])}function C(N,O){for(var Y=N.length,lt=[];Y--;)lt[Y]=O(N[Y]);return lt}function M(N,O){var Y=N.split("@"),lt="";Y.length>1&&(lt=Y[0]+"@",N=Y[1]),N=N.replace(x,".");var yt=N.split("."),It=C(yt,O).join(".");return lt+It}function P(N){for(var O=[],Y=0,lt=N.length,yt,It;Y<lt;)yt=N.charCodeAt(Y++),yt>=55296&&yt<=56319&&Y<lt?(It=N.charCodeAt(Y++),(It&64512)==56320?O.push(((yt&1023)<<10)+(It&1023)+65536):(O.push(yt),Y--)):O.push(yt);return O}function S(N){return C(N,function(O){var Y="";return O>65535&&(O-=65536,Y+=T(O>>>10&1023|55296),O=56320|O&1023),Y+=T(O),Y}).join("")}function w(N){return N-48<10?N-22:N-65<26?N-65:N-97<26?N-97:n}function B(N,O){return N+22+75*(N<26)-((O!=0)<<5)}function F(N,O,Y){var lt=0;for(N=Y?b(N/c):N>>1,N+=b(N/O);N>_*h>>1;lt+=n)N=b(N/_);return b(lt+(_+1)*N/(N+l))}function W(N){var O=[],Y=N.length,lt,yt=0,It=d,Vt=u,te,ae,Ne,qe,Dt,he,_e,fe,ye;for(te=N.lastIndexOf(f),te<0&&(te=0),ae=0;ae<te;++ae)N.charCodeAt(ae)>=128&&A("not-basic"),O.push(N.charCodeAt(ae));for(Ne=te>0?te+1:0;Ne<Y;){for(qe=yt,Dt=1,he=n;Ne>=Y&&A("invalid-input"),_e=w(N.charCodeAt(Ne++)),(_e>=n||_e>b((o-yt)/Dt))&&A("overflow"),yt+=_e*Dt,fe=he<=Vt?a:he>=Vt+h?h:he-Vt,!(_e<fe);he+=n)ye=n-fe,Dt>b(o/ye)&&A("overflow"),Dt*=ye;lt=O.length+1,Vt=F(yt-qe,lt,qe==0),b(yt/lt)>o-It&&A("overflow"),It+=b(yt/lt),yt%=lt,O.splice(yt++,0,It)}return S(O)}function z(N){var O,Y,lt,yt,It,Vt,te,ae,Ne,qe,Dt,he=[],_e,fe,ye,lr;for(N=P(N),_e=N.length,O=d,Y=0,It=u,Vt=0;Vt<_e;++Vt)Dt=N[Vt],Dt<128&&he.push(T(Dt));for(lt=yt=he.length,yt&&he.push(f);lt<_e;){for(te=o,Vt=0;Vt<_e;++Vt)Dt=N[Vt],Dt>=O&&Dt<te&&(te=Dt);for(fe=lt+1,te-O>b((o-Y)/fe)&&A("overflow"),Y+=(te-O)*fe,O=te,Vt=0;Vt<_e;++Vt)if(Dt=N[Vt],Dt<O&&++Y>o&&A("overflow"),Dt==O){for(ae=Y,Ne=n;qe=Ne<=It?a:Ne>=It+h?h:Ne-It,!(ae<qe);Ne+=n)lr=ae-qe,ye=n-qe,he.push(T(B(qe+lr%ye,0))),ae=b(lr/ye);he.push(T(B(ae,0))),It=F(Y,fe,lt==yt),Y=0,++lt}++Y,++O}return he.join("")}function k(N){return M(N,function(O){return p.test(O)?W(O.slice(4).toLowerCase()):O})}function G(N){return M(N,function(O){return g.test(O)?"xn--"+z(O):O})}if(s={version:"1.4.1",ucs2:{decode:P,encode:S},decode:W,encode:z,toASCII:G,toUnicode:k},typeof define=="function"&&typeof define.amd=="object"&&define.amd)define("punycode",function(){return s});else if(t&&e)if(Co.exports==t)e.exports=s;else for(E in s)s.hasOwnProperty(E)&&(t[E]=s[E]);else i.punycode=s})(wo)});var es=Q((hit,kw)=>{"use strict";kw.exports=TypeError});var Ow=Q(()=>{});var sh=Q((uit,i1)=>{var jm=typeof Map=="function"&&Map.prototype,Nm=Object.getOwnPropertyDescriptor&&jm?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,eu=jm&&Nm&&typeof Nm.get=="function"?Nm.get:null,Nw=jm&&Map.prototype.forEach,Ym=typeof Set=="function"&&Set.prototype,Dm=Object.getOwnPropertyDescriptor&&Ym?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,ru=Ym&&Dm&&typeof Dm.get=="function"?Dm.get:null,Dw=Ym&&Set.prototype.forEach,uI=typeof WeakMap=="function"&&WeakMap.prototype,eh=uI?WeakMap.prototype.has:null,dI=typeof WeakSet=="function"&&WeakSet.prototype,rh=dI?WeakSet.prototype.has:null,fI=typeof WeakRef=="function"&&WeakRef.prototype,Lw=fI?WeakRef.prototype.deref:null,pI=Boolean.prototype.valueOf,mI=Object.prototype.toString,gI=Function.prototype.toString,xI=String.prototype.match,qm=String.prototype.slice,wi=String.prototype.replace,_I=String.prototype.toUpperCase,Hw=String.prototype.toLowerCase,Kw=RegExp.prototype.test,Vw=Array.prototype.concat,Ir=Array.prototype.join,yI=Array.prototype.slice,Ww=Math.floor,Vm=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Lm=Object.getOwnPropertySymbols,Wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Po=typeof Symbol=="function"&&typeof Symbol.iterator=="object",ih=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Po||!0)?Symbol.toStringTag:null,Zw=Object.prototype.propertyIsEnumerable,zw=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function $w(i,t){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||Kw.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-Ww(-i):Ww(i);if(r!==i){var s=String(r),o=qm.call(t,s.length+1);return wi.call(s,e,"$&_")+"."+wi.call(wi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return wi.call(t,e,"$&_")}var zm=Ow(),Xw=zm.custom,jw=t1(Xw)?Xw:null,Qw={__proto__:null,double:'"',single:"'"},bI={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};i1.exports=function i(t,e,r,s){var o=e||{};if(ti(o,"quoteStyle")&&!ti(Qw,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ti(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var n=ti(o,"customInspect")?o.customInspect:!0;if(typeof n!="boolean"&&n!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ti(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ti(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var a=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return r1(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var h=String(t);return a?$w(t,h):h}if(typeof t=="bigint"){var l=String(t)+"n";return a?$w(t,l):l}var c=typeof o.depth>"u"?5:o.depth;if(typeof r>"u"&&(r=0),r>=c&&c>0&&typeof t=="object")return $m(t)?"[Array]":"[Object]";var u=NI(o,r);if(typeof s>"u")s=[];else if(e1(s,t)>=0)return"[Circular]";function d(F,W,z){if(W&&(s=yI.call(s),s.push(W)),z){var k={depth:o.depth};return ti(o,"quoteStyle")&&(k.quoteStyle=o.quoteStyle),i(F,k,r+1,s)}return i(F,o,r+1,s)}if(typeof t=="function"&&!Yw(t)){var f=RI(t),p=tu(t,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Ir.call(p,", ")+" }":"")}if(t1(t)){var g=Po?wi.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Wm.call(t);return typeof t=="object"&&!Po?th(g):g}if(UI(t)){for(var x="<"+Hw.call(String(t.nodeName)),v=t.attributes||[],_=0;_<v.length;_++)x+=" "+v[_].name+"="+Jw(vI(v[_].value),"double",o);return x+=">",t.childNodes&&t.childNodes.length&&(x+="..."),x+="</"+Hw.call(String(t.nodeName))+">",x}if($m(t)){if(t.length===0)return"[]";var b=tu(t,d);return u&&!OI(b)?"["+Xm(b,u)+"]":"[ "+Ir.call(b,", ")+" ]"}if(SI(t)){var T=tu(t,d);return!("cause"in Error.prototype)&&"cause"in t&&!Zw.call(t,"cause")?"{ ["+String(t)+"] "+Ir.call(Vw.call("[cause]: "+d(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ir.call(T,", ")+" }"}if(typeof t=="object"&&n){if(jw&&typeof t[jw]=="function"&&zm)return zm(t,{depth:c-r});if(n!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(MI(t)){var E=[];return Nw&&Nw.call(t,function(F,W){E.push(d(W,t,!0)+" => "+d(F,t))}),qw("Map",eu.call(t),E,u)}if(FI(t)){var A=[];return Dw&&Dw.call(t,function(F){A.push(d(F,t))}),qw("Set",ru.call(t),A,u)}if(BI(t))return Hm("WeakMap");if(GI(t))return Hm("WeakSet");if(II(t))return Hm("WeakRef");if(EI(t))return th(d(Number(t)));if(CI(t))return th(d(Vm.call(t)));if(wI(t))return th(pI.call(t));if(AI(t))return th(d(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(typeof globalThis<"u"&&t===globalThis||typeof global<"u"&&t===global)return"{ [object globalThis] }";if(!TI(t)&&!Yw(t)){var C=tu(t,d),M=zw?zw(t)===Object.prototype:t instanceof Object||t.constructor===Object,P=t instanceof Object?"":"null prototype",S=!M&&ih&&Object(t)===t&&ih in t?qm.call(Ci(t),8,-1):P?"Object":"",w=M||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",B=w+(S||P?"["+Ir.call(Vw.call([],S||[],P||[]),": ")+"] ":"");return C.length===0?B+"{}":u?B+"{"+Xm(C,u)+"}":B+"{ "+Ir.call(C,", ")+" }"}return String(t)};function Jw(i,t,e){var r=e.quoteStyle||t,s=Qw[r];return s+i+s}function vI(i){return wi.call(String(i),/"/g,"&quot;")}function rs(i){return!ih||!(typeof i=="object"&&(ih in i||typeof i[ih]<"u"))}function $m(i){return Ci(i)==="[object Array]"&&rs(i)}function TI(i){return Ci(i)==="[object Date]"&&rs(i)}function Yw(i){return Ci(i)==="[object RegExp]"&&rs(i)}function SI(i){return Ci(i)==="[object Error]"&&rs(i)}function AI(i){return Ci(i)==="[object String]"&&rs(i)}function EI(i){return Ci(i)==="[object Number]"&&rs(i)}function wI(i){return Ci(i)==="[object Boolean]"&&rs(i)}function t1(i){if(Po)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Wm)return!1;try{return Wm.call(i),!0}catch{}return!1}function CI(i){if(!i||typeof i!="object"||!Vm)return!1;try{return Vm.call(i),!0}catch{}return!1}var PI=Object.prototype.hasOwnProperty||function(i){return i in this};function ti(i,t){return PI.call(i,t)}function Ci(i){return mI.call(i)}function RI(i){if(i.name)return i.name;var t=xI.call(gI.call(i),/^function\s*([\w$]+)/);return t?t[1]:null}function e1(i,t){if(i.indexOf)return i.indexOf(t);for(var e=0,r=i.length;e<r;e++)if(i[e]===t)return e;return-1}function MI(i){if(!eu||!i||typeof i!="object")return!1;try{eu.call(i);try{ru.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function BI(i){if(!eh||!i||typeof i!="object")return!1;try{eh.call(i,eh);try{rh.call(i,rh)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function II(i){if(!Lw||!i||typeof i!="object")return!1;try{return Lw.call(i),!0}catch{}return!1}function FI(i){if(!ru||!i||typeof i!="object")return!1;try{ru.call(i);try{eu.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function GI(i){if(!rh||!i||typeof i!="object")return!1;try{rh.call(i,rh);try{eh.call(i,eh)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function UI(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function r1(i,t){if(i.length>t.maxStringLength){var e=i.length-t.maxStringLength,r="... "+e+" more character"+(e>1?"s":"");return r1(qm.call(i,0,t.maxStringLength),t)+r}var s=bI[t.quoteStyle||"single"];s.lastIndex=0;var o=wi.call(wi.call(i,s,"\\$1"),/[\x00-\x1f]/g,kI);return Jw(o,"single",t)}function kI(i){var t=i.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+_I.call(t.toString(16))}function th(i){return"Object("+i+")"}function Hm(i){return i+" { ? }"}function qw(i,t,e,r){var s=r?Xm(e,r):Ir.call(e,", ");return i+" ("+t+") {"+s+"}"}function OI(i){for(var t=0;t<i.length;t++)if(e1(i[t],`
1090
+ `)>=0)return!1;return!0}function NI(i,t){var e;if(i.indent===" ")e=" ";else if(typeof i.indent=="number"&&i.indent>0)e=Ir.call(Array(i.indent+1)," ");else return null;return{base:e,prev:Ir.call(Array(t+1),e)}}function Xm(i,t){if(i.length===0)return"";var e=`
1091
+ `+t.prev+t.base;return e+Ir.call(i,","+e)+`
1092
+ `+t.prev}function tu(i,t){var e=$m(i),r=[];if(e){r.length=i.length;for(var s=0;s<i.length;s++)r[s]=ti(i,s)?t(i[s],i):""}var o=typeof Lm=="function"?Lm(i):[],n;if(Po){n={};for(var a=0;a<o.length;a++)n["$"+o[a]]=o[a]}for(var h in i)ti(i,h)&&(e&&String(Number(h))===h&&h<i.length||Po&&n["$"+h]instanceof Symbol||(Kw.call(/[^\w$]/,h)?r.push(t(h,i)+": "+t(i[h],i)):r.push(h+": "+t(i[h],i))));if(typeof Lm=="function")for(var l=0;l<o.length;l++)Zw.call(i,o[l])&&r.push("["+t(o[l])+"]: "+t(i[o[l]],i));return r}});var o1=Q((dit,s1)=>{"use strict";var DI=sh(),LI=es(),iu=function(i,t,e){for(var r=i,s;(s=r.next)!=null;r=s)if(s.key===t)return r.next=s.next,e||(s.next=i.next,i.next=s),s},HI=function(i,t){if(i){var e=iu(i,t);return e&&e.value}},VI=function(i,t,e){var r=iu(i,t);r?r.value=e:i.next={key:t,next:i.next,value:e}},WI=function(i,t){return i?!!iu(i,t):!1},zI=function(i,t){if(i)return iu(i,t,!0)};s1.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new LI("Side channel does not contain "+DI(r))},delete:function(r){var s=t&&t.next,o=zI(t,r);return o&&s&&s===o&&(t=void 0),!!o},get:function(r){return HI(t,r)},has:function(r){return WI(t,r)},set:function(r,s){t||(t={next:void 0}),VI(t,r,s)}};return e}});var Km=Q((fit,n1)=>{"use strict";n1.exports=Object});var h1=Q((pit,a1)=>{"use strict";a1.exports=Error});var c1=Q((mit,l1)=>{"use strict";l1.exports=EvalError});var d1=Q((git,u1)=>{"use strict";u1.exports=RangeError});var p1=Q((xit,f1)=>{"use strict";f1.exports=ReferenceError});var g1=Q((_it,m1)=>{"use strict";m1.exports=SyntaxError});var _1=Q((yit,x1)=>{"use strict";x1.exports=URIError});var b1=Q((bit,y1)=>{"use strict";y1.exports=Math.abs});var T1=Q((vit,v1)=>{"use strict";v1.exports=Math.floor});var A1=Q((Tit,S1)=>{"use strict";S1.exports=Math.max});var w1=Q((Sit,E1)=>{"use strict";E1.exports=Math.min});var P1=Q((Ait,C1)=>{"use strict";C1.exports=Math.pow});var M1=Q((Eit,R1)=>{"use strict";R1.exports=Math.round});var I1=Q((wit,B1)=>{"use strict";B1.exports=Number.isNaN||function(t){return t!==t}});var G1=Q((Cit,F1)=>{"use strict";var $I=I1();F1.exports=function(t){return $I(t)||t===0?t:t<0?-1:1}});var k1=Q((Pit,U1)=>{"use strict";U1.exports=Object.getOwnPropertyDescriptor});var Zm=Q((Rit,O1)=>{"use strict";var su=k1();if(su)try{su([],"length")}catch{su=null}O1.exports=su});var D1=Q((Mit,N1)=>{"use strict";var ou=Object.defineProperty||!1;if(ou)try{ou({},"a",{value:1})}catch{ou=!1}N1.exports=ou});var H1=Q((Bit,L1)=>{"use strict";L1.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),r=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(var o in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var n=Object.getOwnPropertySymbols(t);if(n.length!==1||n[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==s||a.enumerable!==!0)return!1}return!0}});var z1=Q((Iit,W1)=>{"use strict";var V1=typeof Symbol<"u"&&Symbol,XI=H1();W1.exports=function(){return typeof V1!="function"||typeof Symbol!="function"||typeof V1("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:XI()}});var Qm=Q((Fit,$1)=>{"use strict";$1.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null});var Jm=Q((Git,X1)=>{"use strict";var jI=Km();X1.exports=jI.getPrototypeOf||null});var q1=Q((Uit,Y1)=>{"use strict";var YI="Function.prototype.bind called on incompatible ",qI=Object.prototype.toString,KI=Math.max,ZI="[object Function]",j1=function(t,e){for(var r=[],s=0;s<t.length;s+=1)r[s]=t[s];for(var o=0;o<e.length;o+=1)r[o+t.length]=e[o];return r},QI=function(t,e){for(var r=[],s=e||0,o=0;s<t.length;s+=1,o+=1)r[o]=t[s];return r},JI=function(i,t){for(var e="",r=0;r<i.length;r+=1)e+=i[r],r+1<i.length&&(e+=t);return e};Y1.exports=function(t){var e=this;if(typeof e!="function"||qI.apply(e)!==ZI)throw new TypeError(YI+e);for(var r=QI(arguments,1),s,o=function(){if(this instanceof s){var c=e.apply(this,j1(r,arguments));return Object(c)===c?c:this}return e.apply(t,j1(r,arguments))},n=KI(0,e.length-r.length),a=[],h=0;h<n;h++)a[h]="$"+h;if(s=Function("binder","return function ("+JI(a,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var l=function(){};l.prototype=e.prototype,s.prototype=new l,l.prototype=null}return s}});var oh=Q((kit,K1)=>{"use strict";var tF=q1();K1.exports=Function.prototype.bind||tF});var nu=Q((Oit,Z1)=>{"use strict";Z1.exports=Function.prototype.call});var tg=Q((Nit,Q1)=>{"use strict";Q1.exports=Function.prototype.apply});var tC=Q((Dit,J1)=>{"use strict";J1.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply});var rC=Q((Lit,eC)=>{"use strict";var eF=oh(),rF=tg(),iF=nu(),sF=tC();eC.exports=sF||eF.call(iF,rF)});var eg=Q((Hit,iC)=>{"use strict";var oF=oh(),nF=es(),aF=nu(),hF=rC();iC.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new nF("a function is required");return hF(oF,aF,t)}});var lC=Q((Vit,hC)=>{"use strict";var lF=eg(),sC=Zm(),nC;try{nC=[].__proto__===Array.prototype}catch(i){if(!i||typeof i!="object"||!("code"in i)||i.code!=="ERR_PROTO_ACCESS")throw i}var rg=!!nC&&sC&&sC(Object.prototype,"__proto__"),aC=Object,oC=aC.getPrototypeOf;hC.exports=rg&&typeof rg.get=="function"?lF([rg.get]):typeof oC=="function"?function(t){return oC(t==null?t:aC(t))}:!1});var pC=Q((Wit,fC)=>{"use strict";var cC=Qm(),uC=Jm(),dC=lC();fC.exports=cC?function(t){return cC(t)}:uC?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return uC(t)}:dC?function(t){return dC(t)}:null});var gC=Q((zit,mC)=>{"use strict";var cF=Function.prototype.call,uF=Object.prototype.hasOwnProperty,dF=oh();mC.exports=dF.call(cF,uF)});var lu=Q(($it,TC)=>{"use strict";var ct,fF=Km(),pF=h1(),mF=c1(),gF=d1(),xF=p1(),Io=g1(),Bo=es(),_F=_1(),yF=b1(),bF=T1(),vF=A1(),TF=w1(),SF=P1(),AF=M1(),EF=G1(),bC=Function,ig=function(i){try{return bC('"use strict"; return ('+i+").constructor;")()}catch{}},nh=Zm(),wF=D1(),sg=function(){throw new Bo},CF=nh?function(){try{return arguments.callee,sg}catch{try{return nh(arguments,"callee").get}catch{return sg}}}():sg,Ro=z1()(),oe=pC(),PF=Jm(),RF=Qm(),vC=tg(),ah=nu(),Mo={},MF=typeof Uint8Array>"u"||!oe?ct:oe(Uint8Array),is={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?ct:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?ct:ArrayBuffer,"%ArrayIteratorPrototype%":Ro&&oe?oe([][Symbol.iterator]()):ct,"%AsyncFromSyncIteratorPrototype%":ct,"%AsyncFunction%":Mo,"%AsyncGenerator%":Mo,"%AsyncGeneratorFunction%":Mo,"%AsyncIteratorPrototype%":Mo,"%Atomics%":typeof Atomics>"u"?ct:Atomics,"%BigInt%":typeof BigInt>"u"?ct:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?ct:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?ct:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?ct:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":pF,"%eval%":eval,"%EvalError%":mF,"%Float16Array%":typeof Float16Array>"u"?ct:Float16Array,"%Float32Array%":typeof Float32Array>"u"?ct:Float32Array,"%Float64Array%":typeof Float64Array>"u"?ct:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?ct:FinalizationRegistry,"%Function%":bC,"%GeneratorFunction%":Mo,"%Int8Array%":typeof Int8Array>"u"?ct:Int8Array,"%Int16Array%":typeof Int16Array>"u"?ct:Int16Array,"%Int32Array%":typeof Int32Array>"u"?ct:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ro&&oe?oe(oe([][Symbol.iterator]())):ct,"%JSON%":typeof JSON=="object"?JSON:ct,"%Map%":typeof Map>"u"?ct:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ro||!oe?ct:oe(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":fF,"%Object.getOwnPropertyDescriptor%":nh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?ct:Promise,"%Proxy%":typeof Proxy>"u"?ct:Proxy,"%RangeError%":gF,"%ReferenceError%":xF,"%Reflect%":typeof Reflect>"u"?ct:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?ct:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Ro||!oe?ct:oe(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?ct:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ro&&oe?oe(""[Symbol.iterator]()):ct,"%Symbol%":Ro?Symbol:ct,"%SyntaxError%":Io,"%ThrowTypeError%":CF,"%TypedArray%":MF,"%TypeError%":Bo,"%Uint8Array%":typeof Uint8Array>"u"?ct:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?ct:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?ct:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?ct:Uint32Array,"%URIError%":_F,"%WeakMap%":typeof WeakMap>"u"?ct:WeakMap,"%WeakRef%":typeof WeakRef>"u"?ct:WeakRef,"%WeakSet%":typeof WeakSet>"u"?ct:WeakSet,"%Function.prototype.call%":ah,"%Function.prototype.apply%":vC,"%Object.defineProperty%":wF,"%Object.getPrototypeOf%":PF,"%Math.abs%":yF,"%Math.floor%":bF,"%Math.max%":vF,"%Math.min%":TF,"%Math.pow%":SF,"%Math.round%":AF,"%Math.sign%":EF,"%Reflect.getPrototypeOf%":RF};if(oe)try{null.error}catch(i){xC=oe(oe(i)),is["%Error.prototype%"]=xC}var xC,BF=function i(t){var e;if(t==="%AsyncFunction%")e=ig("async function () {}");else if(t==="%GeneratorFunction%")e=ig("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ig("async function* () {}");else if(t==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(e=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&oe&&(e=oe(s.prototype))}return is[t]=e,e},_C={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},hh=oh(),au=gC(),IF=hh.call(ah,Array.prototype.concat),FF=hh.call(vC,Array.prototype.splice),yC=hh.call(ah,String.prototype.replace),hu=hh.call(ah,String.prototype.slice),GF=hh.call(ah,RegExp.prototype.exec),UF=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kF=/\\(\\)?/g,OF=function(t){var e=hu(t,0,1),r=hu(t,-1);if(e==="%"&&r!=="%")throw new Io("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&e!=="%")throw new Io("invalid intrinsic syntax, expected opening `%`");var s=[];return yC(t,UF,function(o,n,a,h){s[s.length]=a?yC(h,kF,"$1"):n||o}),s},NF=function(t,e){var r=t,s;if(au(_C,r)&&(s=_C[r],r="%"+s[0]+"%"),au(is,r)){var o=is[r];if(o===Mo&&(o=BF(r)),typeof o>"u"&&!e)throw new Bo("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:o}}throw new Io("intrinsic "+t+" does not exist!")};TC.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Bo("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Bo('"allowMissing" argument must be a boolean');if(GF(/^%?[^%]*%?$/,t)===null)throw new Io("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=OF(t),s=r.length>0?r[0]:"",o=NF("%"+s+"%",e),n=o.name,a=o.value,h=!1,l=o.alias;l&&(s=l[0],FF(r,IF([0,1],l)));for(var c=1,u=!0;c<r.length;c+=1){var d=r[c],f=hu(d,0,1),p=hu(d,-1);if((f==='"'||f==="'"||f==="`"||p==='"'||p==="'"||p==="`")&&f!==p)throw new Io("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(h=!0),s+="."+d,n="%"+s+"%",au(is,n))a=is[n];else if(a!=null){if(!(d in a)){if(!e)throw new Bo("base intrinsic for "+t+" exists, but the property is not available.");return}if(nh&&c+1>=r.length){var g=nh(a,d);u=!!g,u&&"get"in g&&!("originalValue"in g.get)?a=g.get:a=a[d]}else u=au(a,d),a=a[d];u&&!h&&(is[n]=a)}}return a}});var og=Q((Xit,EC)=>{"use strict";var SC=lu(),AC=eg(),DF=AC([SC("%String.prototype.indexOf%")]);EC.exports=function(t,e){var r=SC(t,!!e);return typeof r=="function"&&DF(t,".prototype.")>-1?AC([r]):r}});var ng=Q((jit,CC)=>{"use strict";var LF=lu(),lh=og(),HF=sh(),VF=es(),wC=LF("%Map%",!0),WF=lh("Map.prototype.get",!0),zF=lh("Map.prototype.set",!0),$F=lh("Map.prototype.has",!0),XF=lh("Map.prototype.delete",!0),jF=lh("Map.prototype.size",!0);CC.exports=!!wC&&function(){var t,e={assert:function(r){if(!e.has(r))throw new VF("Side channel does not contain "+HF(r))},delete:function(r){if(t){var s=XF(t,r);return jF(t)===0&&(t=void 0),s}return!1},get:function(r){if(t)return WF(t,r)},has:function(r){return t?$F(t,r):!1},set:function(r,s){t||(t=new wC),zF(t,r,s)}};return e}});var RC=Q((Yit,PC)=>{"use strict";var YF=lu(),uu=og(),qF=sh(),cu=ng(),KF=es(),Fo=YF("%WeakMap%",!0),ZF=uu("WeakMap.prototype.get",!0),QF=uu("WeakMap.prototype.set",!0),JF=uu("WeakMap.prototype.has",!0),tG=uu("WeakMap.prototype.delete",!0);PC.exports=Fo?function(){var t,e,r={assert:function(s){if(!r.has(s))throw new KF("Side channel does not contain "+qF(s))},delete:function(s){if(Fo&&s&&(typeof s=="object"||typeof s=="function")){if(t)return tG(t,s)}else if(cu&&e)return e.delete(s);return!1},get:function(s){return Fo&&s&&(typeof s=="object"||typeof s=="function")&&t?ZF(t,s):e&&e.get(s)},has:function(s){return Fo&&s&&(typeof s=="object"||typeof s=="function")&&t?JF(t,s):!!e&&e.has(s)},set:function(s,o){Fo&&s&&(typeof s=="object"||typeof s=="function")?(t||(t=new Fo),QF(t,s,o)):cu&&(e||(e=cu()),e.set(s,o))}};return r}:cu});var BC=Q((qit,MC)=>{"use strict";var eG=es(),rG=sh(),iG=o1(),sG=ng(),oG=RC(),nG=oG||sG||iG;MC.exports=function(){var t,e={assert:function(r){if(!e.has(r))throw new eG("Side channel does not contain "+rG(r))},delete:function(r){return!!t&&t.delete(r)},get:function(r){return t&&t.get(r)},has:function(r){return!!t&&t.has(r)},set:function(r,s){t||(t=nG()),t.set(r,s)}};return e}});var du=Q((Kit,IC)=>{"use strict";var aG=String.prototype.replace,hG=/%20/g,ag={RFC1738:"RFC1738",RFC3986:"RFC3986"};IC.exports={default:ag.RFC3986,formatters:{RFC1738:function(i){return aG.call(i,hG,"+")},RFC3986:function(i){return String(i)}},RFC1738:ag.RFC1738,RFC3986:ag.RFC3986}});var cg=Q((Zit,GC)=>{"use strict";var lG=du(),hg=Object.prototype.hasOwnProperty,ss=Array.isArray,Fr=function(){for(var i=[],t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),cG=function(t){for(;t.length>1;){var e=t.pop(),r=e.obj[e.prop];if(ss(r)){for(var s=[],o=0;o<r.length;++o)typeof r[o]<"u"&&s.push(r[o]);e.obj[e.prop]=s}}},FC=function(t,e){for(var r=e&&e.plainObjects?{__proto__:null}:{},s=0;s<t.length;++s)typeof t[s]<"u"&&(r[s]=t[s]);return r},uG=function i(t,e,r){if(!e)return t;if(typeof e!="object"&&typeof e!="function"){if(ss(t))t.push(e);else if(t&&typeof t=="object")(r&&(r.plainObjects||r.allowPrototypes)||!hg.call(Object.prototype,e))&&(t[e]=!0);else return[t,e];return t}if(!t||typeof t!="object")return[t].concat(e);var s=t;return ss(t)&&!ss(e)&&(s=FC(t,r)),ss(t)&&ss(e)?(e.forEach(function(o,n){if(hg.call(t,n)){var a=t[n];a&&typeof a=="object"&&o&&typeof o=="object"?t[n]=i(a,o,r):t.push(o)}else t[n]=o}),t):Object.keys(e).reduce(function(o,n){var a=e[n];return hg.call(o,n)?o[n]=i(o[n],a,r):o[n]=a,o},s)},dG=function(t,e){return Object.keys(e).reduce(function(r,s){return r[s]=e[s],r},t)},fG=function(i,t,e){var r=i.replace(/\+/g," ");if(e==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},lg=1024,pG=function(t,e,r,s,o){if(t.length===0)return t;var n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),r==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(f){return"%26%23"+parseInt(f.slice(2),16)+"%3B"});for(var a="",h=0;h<n.length;h+=lg){for(var l=n.length>=lg?n.slice(h,h+lg):n,c=[],u=0;u<l.length;++u){var d=l.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===lG.RFC1738&&(d===40||d===41)){c[c.length]=l.charAt(u);continue}if(d<128){c[c.length]=Fr[d];continue}if(d<2048){c[c.length]=Fr[192|d>>6]+Fr[128|d&63];continue}if(d<55296||d>=57344){c[c.length]=Fr[224|d>>12]+Fr[128|d>>6&63]+Fr[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|l.charCodeAt(u)&1023),c[c.length]=Fr[240|d>>18]+Fr[128|d>>12&63]+Fr[128|d>>6&63]+Fr[128|d&63]}a+=c.join("")}return a},mG=function(t){for(var e=[{obj:{o:t},prop:"o"}],r=[],s=0;s<e.length;++s)for(var o=e[s],n=o.obj[o.prop],a=Object.keys(n),h=0;h<a.length;++h){var l=a[h],c=n[l];typeof c=="object"&&c!==null&&r.indexOf(c)===-1&&(e.push({obj:n,prop:l}),r.push(c))}return cG(e),t},gG=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},xG=function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},_G=function(t,e){return[].concat(t,e)},yG=function(t,e){if(ss(t)){for(var r=[],s=0;s<t.length;s+=1)r.push(e(t[s]));return r}return e(t)};GC.exports={arrayToObject:FC,assign:dG,combine:_G,compact:mG,decode:fG,encode:pG,isBuffer:xG,isRegExp:gG,maybeMap:yG,merge:uG}});var LC=Q((Qit,DC)=>{"use strict";var kC=BC(),fu=cg(),ch=du(),bG=Object.prototype.hasOwnProperty,OC={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Gr=Array.isArray,vG=Array.prototype.push,NC=function(i,t){vG.apply(i,Gr(t)?t:[t])},TG=Date.prototype.toISOString,UC=ch.default,Zt={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:fu.encode,encodeValuesOnly:!1,filter:void 0,format:UC,formatter:ch.formatters[UC],indices:!1,serializeDate:function(t){return TG.call(t)},skipNulls:!1,strictNullHandling:!1},SG=function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},ug={},AG=function i(t,e,r,s,o,n,a,h,l,c,u,d,f,p,g,x,v,_){for(var b=t,T=_,E=0,A=!1;(T=T.get(ug))!==void 0&&!A;){var C=T.get(t);if(E+=1,typeof C<"u"){if(C===E)throw new RangeError("Cyclic object value");A=!0}typeof T.get(ug)>"u"&&(E=0)}if(typeof c=="function"?b=c(e,b):b instanceof Date?b=f(b):r==="comma"&&Gr(b)&&(b=fu.maybeMap(b,function(Y){return Y instanceof Date?f(Y):Y})),b===null){if(n)return l&&!x?l(e,Zt.encoder,v,"key",p):e;b=""}if(SG(b)||fu.isBuffer(b)){if(l){var M=x?e:l(e,Zt.encoder,v,"key",p);return[g(M)+"="+g(l(b,Zt.encoder,v,"value",p))]}return[g(e)+"="+g(String(b))]}var P=[];if(typeof b>"u")return P;var S;if(r==="comma"&&Gr(b))x&&l&&(b=fu.maybeMap(b,l)),S=[{value:b.length>0?b.join(",")||null:void 0}];else if(Gr(c))S=c;else{var w=Object.keys(b);S=u?w.sort(u):w}var B=h?String(e).replace(/\./g,"%2E"):String(e),F=s&&Gr(b)&&b.length===1?B+"[]":B;if(o&&Gr(b)&&b.length===0)return F+"[]";for(var W=0;W<S.length;++W){var z=S[W],k=typeof z=="object"&&z&&typeof z.value<"u"?z.value:b[z];if(!(a&&k===null)){var G=d&&h?String(z).replace(/\./g,"%2E"):String(z),N=Gr(b)?typeof r=="function"?r(F,G):F:F+(d?"."+G:"["+G+"]");_.set(t,E);var O=kC();O.set(ug,_),NC(P,i(k,N,r,s,o,n,a,h,r==="comma"&&x&&Gr(b)?null:l,c,u,d,f,p,g,x,v,O))}}return P},EG=function(t){if(!t)return Zt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");var e=t.charset||Zt.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var r=ch.default;if(typeof t.format<"u"){if(!bG.call(ch.formatters,t.format))throw new TypeError("Unknown format option provided.");r=t.format}var s=ch.formatters[r],o=Zt.filter;(typeof t.filter=="function"||Gr(t.filter))&&(o=t.filter);var n;if(t.arrayFormat in OC?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=Zt.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var a=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:Zt.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Zt.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Zt.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Zt.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Zt.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Zt.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Zt.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Zt.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Zt.encodeValuesOnly,filter:o,format:r,formatter:s,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Zt.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Zt.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Zt.strictNullHandling}};DC.exports=function(i,t){var e=i,r=EG(t),s,o;typeof r.filter=="function"?(o=r.filter,e=o("",e)):Gr(r.filter)&&(o=r.filter,s=o);var n=[];if(typeof e!="object"||e===null)return"";var a=OC[r.arrayFormat],h=a==="comma"&&r.commaRoundTrip;s||(s=Object.keys(e)),r.sort&&s.sort(r.sort);for(var l=kC(),c=0;c<s.length;++c){var u=s[c],d=e[u];r.skipNulls&&d===null||NC(n,AG(d,u,a,h,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}var f=n.join(r.delimiter),p=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),f.length>0?p+f:""}});var zC=Q((Jit,WC)=>{"use strict";var os=cg(),dg=Object.prototype.hasOwnProperty,HC=Array.isArray,Nt={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:os.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},wG=function(i){return i.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},VC=function(i,t,e){if(i&&typeof i=="string"&&t.comma&&i.indexOf(",")>-1)return i.split(",");if(t.throwOnLimitExceeded&&e>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");return i},CG="utf8=%26%2310003%3B",PG="utf8=%E2%9C%93",RG=function(t,e){var r={__proto__:null},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=e.parameterLimit===1/0?void 0:e.parameterLimit,n=s.split(e.delimiter,e.throwOnLimitExceeded?o+1:o);if(e.throwOnLimitExceeded&&n.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var a=-1,h,l=e.charset;if(e.charsetSentinel)for(h=0;h<n.length;++h)n[h].indexOf("utf8=")===0&&(n[h]===PG?l="utf-8":n[h]===CG&&(l="iso-8859-1"),a=h,h=n.length);for(h=0;h<n.length;++h)if(h!==a){var c=n[h],u=c.indexOf("]="),d=u===-1?c.indexOf("="):u+1,f,p;d===-1?(f=e.decoder(c,Nt.decoder,l,"key"),p=e.strictNullHandling?null:""):(f=e.decoder(c.slice(0,d),Nt.decoder,l,"key"),p=os.maybeMap(VC(c.slice(d+1),e,HC(r[f])?r[f].length:0),function(x){return e.decoder(x,Nt.decoder,l,"value")})),p&&e.interpretNumericEntities&&l==="iso-8859-1"&&(p=wG(String(p))),c.indexOf("[]=")>-1&&(p=HC(p)?[p]:p);var g=dg.call(r,f);g&&e.duplicates==="combine"?r[f]=os.combine(r[f],p):(!g||e.duplicates==="last")&&(r[f]=p)}return r},MG=function(i,t,e,r){var s=0;if(i.length>0&&i[i.length-1]==="[]"){var o=i.slice(0,-1).join("");s=Array.isArray(t)&&t[o]?t[o].length:0}for(var n=r?t:VC(t,e,s),a=i.length-1;a>=0;--a){var h,l=i[a];if(l==="[]"&&e.parseArrays)h=e.allowEmptyArrays&&(n===""||e.strictNullHandling&&n===null)?[]:os.combine([],n);else{h=e.plainObjects?{__proto__:null}:{};var c=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=e.decodeDotInKeys?c.replace(/%2E/g,"."):c,d=parseInt(u,10);!e.parseArrays&&u===""?h={0:n}:!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&e.parseArrays&&d<=e.arrayLimit?(h=[],h[d]=n):u!=="__proto__"&&(h[u]=n)}n=h}return n},BG=function(t,e,r,s){if(t){var o=r.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,n=/(\[[^[\]]*])/,a=/(\[[^[\]]*])/g,h=r.depth>0&&n.exec(o),l=h?o.slice(0,h.index):o,c=[];if(l){if(!r.plainObjects&&dg.call(Object.prototype,l)&&!r.allowPrototypes)return;c.push(l)}for(var u=0;r.depth>0&&(h=a.exec(o))!==null&&u<r.depth;){if(u+=1,!r.plainObjects&&dg.call(Object.prototype,h[1].slice(1,-1))&&!r.allowPrototypes)return;c.push(h[1])}if(h){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");c.push("["+o.slice(h.index)+"]")}return MG(c,e,r,s)}},IG=function(t){if(!t)return Nt;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.decodeDotInKeys<"u"&&typeof t.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(t.decoder!==null&&typeof t.decoder<"u"&&typeof t.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof t.throwOnLimitExceeded<"u"&&typeof t.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var e=typeof t.charset>"u"?Nt.charset:t.charset,r=typeof t.duplicates>"u"?Nt.duplicates:t.duplicates;if(r!=="combine"&&r!=="first"&&r!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof t.allowDots>"u"?t.decodeDotInKeys===!0?!0:Nt.allowDots:!!t.allowDots;return{allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Nt.allowEmptyArrays,allowPrototypes:typeof t.allowPrototypes=="boolean"?t.allowPrototypes:Nt.allowPrototypes,allowSparse:typeof t.allowSparse=="boolean"?t.allowSparse:Nt.allowSparse,arrayLimit:typeof t.arrayLimit=="number"?t.arrayLimit:Nt.arrayLimit,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Nt.charsetSentinel,comma:typeof t.comma=="boolean"?t.comma:Nt.comma,decodeDotInKeys:typeof t.decodeDotInKeys=="boolean"?t.decodeDotInKeys:Nt.decodeDotInKeys,decoder:typeof t.decoder=="function"?t.decoder:Nt.decoder,delimiter:typeof t.delimiter=="string"||os.isRegExp(t.delimiter)?t.delimiter:Nt.delimiter,depth:typeof t.depth=="number"||t.depth===!1?+t.depth:Nt.depth,duplicates:r,ignoreQueryPrefix:t.ignoreQueryPrefix===!0,interpretNumericEntities:typeof t.interpretNumericEntities=="boolean"?t.interpretNumericEntities:Nt.interpretNumericEntities,parameterLimit:typeof t.parameterLimit=="number"?t.parameterLimit:Nt.parameterLimit,parseArrays:t.parseArrays!==!1,plainObjects:typeof t.plainObjects=="boolean"?t.plainObjects:Nt.plainObjects,strictDepth:typeof t.strictDepth=="boolean"?!!t.strictDepth:Nt.strictDepth,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Nt.strictNullHandling,throwOnLimitExceeded:typeof t.throwOnLimitExceeded=="boolean"?t.throwOnLimitExceeded:!1}};WC.exports=function(i,t){var e=IG(t);if(i===""||i===null||typeof i>"u")return e.plainObjects?{__proto__:null}:{};for(var r=typeof i=="string"?RG(i,e):i,s=e.plainObjects?{__proto__:null}:{},o=Object.keys(r),n=0;n<o.length;++n){var a=o[n],h=BG(a,r[a],e,typeof i=="string");s=os.merge(s,h,e)}return e.allowSparse===!0?s:os.compact(s)}});var XC=Q((tst,$C)=>{"use strict";var FG=LC(),GG=zC(),UG=du();$C.exports={formats:UG,parse:GG,stringify:FG}});var KC=Q(Uo=>{"use strict";var kG=Uw();function or(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var OG=/^([a-z0-9.+-]+:)/i,NG=/:[0-9]*$/,DG=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,LG=["<",">",'"',"`"," ","\r",`
1093
+ `," "],HG=["{","}","|","\\","^","`"].concat(LG),fg=["'"].concat(HG),jC=["%","/","?",";","#"].concat(fg),YC=["/","?","#"],VG=255,qC=/^[+a-z0-9A-Z_-]{0,63}$/,WG=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,zG={javascript:!0,"javascript:":!0},pg={javascript:!0,"javascript:":!0},Go={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},mg=XC();function uh(i,t,e){if(i&&typeof i=="object"&&i instanceof or)return i;var r=new or;return r.parse(i,t,e),r}or.prototype.parse=function(i,t,e){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r<i.indexOf("#")?"?":"#",o=i.split(s),n=/\\/g;o[0]=o[0].replace(n,"/"),i=o.join(s);var a=i;if(a=a.trim(),!e&&i.split("#").length===1){var h=DG.exec(a);if(h)return this.path=a,this.href=a,this.pathname=h[1],h[2]?(this.search=h[2],t?this.query=mg.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var l=OG.exec(a);if(l){l=l[0];var c=l.toLowerCase();this.protocol=c,a=a.substr(l.length)}if(e||l||a.match(/^\/\/[^@/]+@[^@/]+/)){var u=a.substr(0,2)==="//";u&&!(l&&pg[l])&&(a=a.substr(2),this.slashes=!0)}if(!pg[l]&&(u||l&&!Go[l])){for(var d=-1,f=0;f<YC.length;f++){var p=a.indexOf(YC[f]);p!==-1&&(d===-1||p<d)&&(d=p)}var g,x;d===-1?x=a.lastIndexOf("@"):x=a.lastIndexOf("@",d),x!==-1&&(g=a.slice(0,x),a=a.slice(x+1),this.auth=decodeURIComponent(g)),d=-1;for(var f=0;f<jC.length;f++){var p=a.indexOf(jC[f]);p!==-1&&(d===-1||p<d)&&(d=p)}d===-1&&(d=a.length),this.host=a.slice(0,d),a=a.slice(d),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var _=this.hostname.split(/\./),f=0,b=_.length;f<b;f++){var T=_[f];if(T&&!T.match(qC)){for(var E="",A=0,C=T.length;A<C;A++)T.charCodeAt(A)>127?E+="x":E+=T[A];if(!E.match(qC)){var M=_.slice(0,f),P=_.slice(f+1),S=T.match(WG);S&&(M.push(S[1]),P.unshift(S[2])),P.length&&(a="/"+P.join(".")+a),this.hostname=M.join(".");break}}}this.hostname.length>VG?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=kG.toASCII(this.hostname));var w=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+w,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),a[0]!=="/"&&(a="/"+a))}if(!zG[c])for(var f=0,b=fg.length;f<b;f++){var F=fg[f];if(a.indexOf(F)!==-1){var W=encodeURIComponent(F);W===F&&(W=escape(F)),a=a.split(F).join(W)}}var z=a.indexOf("#");z!==-1&&(this.hash=a.substr(z),a=a.slice(0,z));var k=a.indexOf("?");if(k!==-1?(this.search=a.substr(k),this.query=a.substr(k+1),t&&(this.query=mg.parse(this.query)),a=a.slice(0,k)):t&&(this.search="",this.query={}),a&&(this.pathname=a),Go[c]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var w=this.pathname||"",G=this.search||"";this.path=w+G}return this.href=this.format(),this};function $G(i){return typeof i=="string"&&(i=uh(i)),i instanceof or?i.format():or.prototype.format.call(i)}or.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var t=this.protocol||"",e=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=mg.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var n=this.search||o&&"?"+o||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Go[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),n&&n.charAt(0)!=="?"&&(n="?"+n),e=e.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),n=n.replace("#","%23"),t+s+e+n+r};function XG(i,t){return uh(i,!1,!0).resolve(t)}or.prototype.resolve=function(i){return this.resolveObject(uh(i,!1,!0)).format()};function jG(i,t){return i?uh(i,!1,!0).resolveObject(t):t}or.prototype.resolveObject=function(i){if(typeof i=="string"){var t=new or;t.parse(i,!1,!0),i=t}for(var e=new or,r=Object.keys(this),s=0;s<r.length;s++){var o=r[s];e[o]=this[o]}if(e.hash=i.hash,i.href==="")return e.href=e.format(),e;if(i.slashes&&!i.protocol){for(var n=Object.keys(i),a=0;a<n.length;a++){var h=n[a];h!=="protocol"&&(e[h]=i[h])}return Go[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(i.protocol&&i.protocol!==e.protocol){if(!Go[i.protocol]){for(var l=Object.keys(i),c=0;c<l.length;c++){var u=l[c];e[u]=i[u]}return e.href=e.format(),e}if(e.protocol=i.protocol,!i.host&&!pg[i.protocol]){for(var b=(i.pathname||"").split("/");b.length&&!(i.host=b.shift()););i.host||(i.host=""),i.hostname||(i.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),e.pathname=b.join("/")}else e.pathname=i.pathname;if(e.search=i.search,e.query=i.query,e.host=i.host||"",e.auth=i.auth,e.hostname=i.hostname||i.host,e.port=i.port,e.pathname||e.search){var d=e.pathname||"",f=e.search||"";e.path=d+f}return e.slashes=e.slashes||i.slashes,e.href=e.format(),e}var p=e.pathname&&e.pathname.charAt(0)==="/",g=i.host||i.pathname&&i.pathname.charAt(0)==="/",x=g||p||e.host&&i.pathname,v=x,_=e.pathname&&e.pathname.split("/")||[],b=i.pathname&&i.pathname.split("/")||[],T=e.protocol&&!Go[e.protocol];if(T&&(e.hostname="",e.port=null,e.host&&(_[0]===""?_[0]=e.host:_.unshift(e.host)),e.host="",i.protocol&&(i.hostname=null,i.port=null,i.host&&(b[0]===""?b[0]=i.host:b.unshift(i.host)),i.host=null),x=x&&(b[0]===""||_[0]==="")),g)e.host=i.host||i.host===""?i.host:e.host,e.hostname=i.hostname||i.hostname===""?i.hostname:e.hostname,e.search=i.search,e.query=i.query,_=b;else if(b.length)_||(_=[]),_.pop(),_=_.concat(b),e.search=i.search,e.query=i.query;else if(i.search!=null){if(T){e.host=_.shift(),e.hostname=e.host;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return e.search=i.search,e.query=i.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!_.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var A=_.slice(-1)[0],C=(e.host||i.host||_.length>1)&&(A==="."||A==="..")||A==="",M=0,P=_.length;P>=0;P--)A=_[P],A==="."?_.splice(P,1):A===".."?(_.splice(P,1),M++):M&&(_.splice(P,1),M--);if(!x&&!v)for(;M--;M)_.unshift("..");x&&_[0]!==""&&(!_[0]||_[0].charAt(0)!=="/")&&_.unshift(""),C&&_.join("/").substr(-1)!=="/"&&_.push("");var S=_[0]===""||_[0]&&_[0].charAt(0)==="/";if(T){e.hostname=S?"":_.length?_.shift():"",e.host=e.hostname;var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.hostname=E.shift(),e.host=e.hostname)}return x=x||e.host&&_.length,x&&!S&&_.unshift(""),_.length>0?e.pathname=_.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e};or.prototype.parseHost=function(){var i=this.host,t=NG.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};Uo.parse=uh;Uo.resolve=XG;Uo.resolveObject=jG;Uo.format=$G;Uo.Url=or});R();var LT={extension:{type:y.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>(DT(),tB))}};R();var VT={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>(HT(),eB))}};R();R();vl();pl();R();wt();ea();var mc;function KT(i){return mc!==void 0||(mc=(()=>{let t={stencil:!0,failIfMajorPerformanceCaveat:i??Ti.defaultOptions.failIfMajorPerformanceCaveat};try{if(!j.get().getWebGLRenderingContext())return!1;let r=j.get().createCanvas().getContext("webgl",t),s=!!r?.getContextAttributes()?.stencil;if(r){let o=r.getExtension("WEBGL_lose_context");o&&o.loseContext()}return r=null,s}catch{return!1}})()),mc}wt();var gc;async function ZT(i={}){return gc!==void 0||(gc=await(async()=>{let t=j.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(i)).requestDevice(),!0}catch{return!1}})()),gc}ea();var cw=["webgl","webgpu","canvas"];async function uw(i){let t=[];i.preference?(t.push(i.preference),cw.forEach(o=>{o!==i.preference&&t.push(o)})):t=cw.slice();let e,r={};for(let o=0;o<t.length;o++){let n=t[o];if(n==="webgpu"&&await ZT()){let{WebGPURenderer:a}=await Promise.resolve().then(()=>(OA(),kA));e=a,r={...i,...i.webgpu};break}else if(n==="webgl"&&KT(i.failIfMajorPerformanceCaveat??Ti.defaultOptions.failIfMajorPerformanceCaveat)){let{WebGLRenderer:a}=await Promise.resolve().then(()=>(lw(),hw));e=a,r={...i,...i.webgl};break}else if(n==="canvas")throw r={...i},new Error("CanvasRenderer is not yet implemented")}if(delete r.webgpu,delete r.webgl,!e)throw new Error("No available renderer for the current environment");let s=new e;return await s.init(r),s}cr();Hp();Ft();var dw=class Rm{constructor(...t){this.stage=new Et,t[0]!==void 0&&X(tt,"Application constructor options are deprecated, please use Application.init() instead.")}async init(t){t={...t},this.renderer=await uw(t),Rm._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return X(tt,"Application.view is deprecated, please use Application.canvas instead."),this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){let r=Rm._plugins.slice(0);r.reverse(),r.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};dw._plugins=[];var Vc=dw;D.handleByList(y.Application,Vc._plugins);D.add(ua);R();$r();Hd();wt();R();Vi();Yt();xt();xp();Tp();var Ka=class extends so{constructor(t,e){super();let{textures:r,data:s}=t;Object.keys(s.pages).forEach(o=>{let n=s.pages[parseInt(o,10)],a=r[n.id];this.pages.push({texture:a})}),Object.keys(s.chars).forEach(o=>{let n=s.chars[o],{frame:a,source:h}=r[n.page],l=new rt(n.x+a.x,n.y+a.y,n.width,n.height),c=new I({source:h,frame:l});this.chars[o]={id:o.codePointAt(0),xOffset:n.xOffset,yOffset:n.yOffset,xAdvance:n.xAdvance,kerning:n.kerning??{},texture:c}}),this.baseRenderedFontSize=s.fontSize,this.baseMeasurementFontSize=s.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:s.fontSize},this.baseLineOffset=s.baseLineOffset,this.lineHeight=s.lineHeight,this.fontFamily=s.fontFamily,this.distanceField=s.distanceField??{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){let{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){jn.install(t)}static uninstall(t){jn.uninstall(t)}};var Wc={test(i){return typeof i=="string"&&i.startsWith("info face=")},parse(i){let t=i.match(/^[a-z]+\s+.+$/gm),e={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let u in t){let d=t[u].match(/^[a-z]+/gm)[0],f=t[u].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),p={};for(let g in f){let x=f[g].split("="),v=x[0],_=x[1].replace(/"/gm,""),b=parseFloat(_),T=isNaN(b)?_:b;p[v]=T}e[d].push(p)}let r={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[s]=e.info,[o]=e.common,[n]=e.distanceField??[];n&&(r.distanceField={range:parseInt(n.distanceRange,10),type:n.fieldType}),r.fontSize=parseInt(s.size,10),r.fontFamily=s.face,r.lineHeight=parseInt(o.lineHeight,10);let a=e.page;for(let u=0;u<a.length;u++)r.pages.push({id:parseInt(a[u].id,10)||0,file:a[u].file});let h={};r.baseLineOffset=r.lineHeight-parseInt(o.base,10);let l=e.char;for(let u=0;u<l.length;u++){let d=l[u],f=parseInt(d.id,10),p=d.letter??d.char??String.fromCharCode(f);p==="space"&&(p=" "),h[f]=p,r.chars[p]={id:f,page:parseInt(d.page,10)||0,x:parseInt(d.x,10),y:parseInt(d.y,10),width:parseInt(d.width,10),height:parseInt(d.height,10),xOffset:parseInt(d.xoffset,10),yOffset:parseInt(d.yoffset,10),xAdvance:parseInt(d.xadvance,10),kerning:{}}}let c=e.kerning||[];for(let u=0;u<c.length;u++){let d=parseInt(c[u].first,10),f=parseInt(c[u].second,10),p=parseInt(c[u].amount,10);r.chars[h[f]].kerning[h[d]]=p}return r}};wt();var Mm={test(i){let t=i;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(i){let t={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},e=i.getElementsByTagName("info")[0],r=i.getElementsByTagName("common")[0],s=i.getElementsByTagName("distanceField")[0];s&&(t.distanceField={type:s.getAttribute("fieldType"),range:parseInt(s.getAttribute("distanceRange"),10)});let o=i.getElementsByTagName("page"),n=i.getElementsByTagName("char"),a=i.getElementsByTagName("kerning");t.fontSize=parseInt(e.getAttribute("size"),10),t.fontFamily=e.getAttribute("face"),t.lineHeight=parseInt(r.getAttribute("lineHeight"),10);for(let l=0;l<o.length;l++)t.pages.push({id:parseInt(o[l].getAttribute("id"),10)||0,file:o[l].getAttribute("file")});let h={};t.baseLineOffset=t.lineHeight-parseInt(r.getAttribute("base"),10);for(let l=0;l<n.length;l++){let c=n[l],u=parseInt(c.getAttribute("id"),10),d=c.getAttribute("letter")??c.getAttribute("char")??String.fromCharCode(u);d==="space"&&(d=" "),h[u]=d,t.chars[d]={id:u,page:parseInt(c.getAttribute("page"),10)||0,x:parseInt(c.getAttribute("x"),10),y:parseInt(c.getAttribute("y"),10),width:parseInt(c.getAttribute("width"),10),height:parseInt(c.getAttribute("height"),10),xOffset:parseInt(c.getAttribute("xoffset"),10),yOffset:parseInt(c.getAttribute("yoffset"),10),xAdvance:parseInt(c.getAttribute("xadvance"),10),kerning:{}}}for(let l=0;l<a.length;l++){let c=parseInt(a[l].getAttribute("first"),10),u=parseInt(a[l].getAttribute("second"),10),d=parseInt(a[l].getAttribute("amount"),10);t.chars[h[u]].kerning[h[c]]=d}return t}};var Bm={test(i){return typeof i=="string"&&i.includes("<font>")?Mm.test(j.get().parseXML(i)):!1},parse(i){return Mm.parse(j.get().parseXML(i))}};var UB=[".xml",".fnt"],fw={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:i=>i instanceof Ka,getCacheableAssets(i,t){let e={};return i.forEach(r=>{e[r]=t,e[`${r}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},pw={extension:{type:y.LoadParser,priority:re.Normal},name:"loadBitmapFont",test(i){return UB.includes(qt.extname(i).toLowerCase())},async testParse(i){return Wc.test(i)||Bm.test(i)},async parse(i,t,e){let r=Wc.test(i)?Wc.parse(i):Bm.parse(i),{src:s}=t,{pages:o}=r,n=[],a=r.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let u=0;u<o.length;++u){let d=o[u].file,f=qt.join(qt.dirname(s),d);f=vn(f,s),n.push({src:f,data:a})}let h=await e.load(n),l=n.map(u=>h[u.src]);return new Ka({data:r,textures:l},s)},async load(i,t){return await(await j.get().fetch(i)).text()},async unload(i,t,e){await Promise.all(i.pages.map(r=>e.unload(r.texture.source._sourceOrigin))),i.destroy()}};vt();var zc=class{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;let t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let r=0;r<e;r++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}};pi();R();xt();var mw={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:i=>Array.isArray(i)&&i.every(t=>t instanceof I),getCacheableAssets:(i,t)=>{let e={};return i.forEach(r=>{t.forEach((s,o)=>{e[r+(o===0?"":o+1)]=s})}),e}};R();async function $c(i){if("Image"in globalThis)return new Promise(t=>{let e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{let t=await(await fetch(i)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var gw={extension:{type:y.DetectionParser,priority:1},test:async()=>$c("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};R();var xw=["png","jpg","jpeg"],_w={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...xw],remove:async i=>i.filter(t=>!xw.includes(t))};R();var kB="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function yo(i){return kB?!1:document.createElement("video").canPlayType(i)!==""}var yw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};R();var bw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};R();var vw={extension:{type:y.DetectionParser,priority:0},test:async()=>yo("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};R();var Tw={extension:{type:y.DetectionParser,priority:0},test:async()=>$c("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};vt();Vi();bn();fl();var Xc=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,r)=>(this._parsersValidated=!1,t[e]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){let r={promise:null,parser:null};return r.promise=(async()=>{let s=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser],o||H(`[Assets] specified load parser "${e.loadParser}" not found while loading ${t}`)),!o){for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];if(a.load&&a.test?.(t,e,this)){o=a;break}}if(!o)return H(`[Assets] ${t} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}s=await o.load(t,e,this),r.parser=o;for(let n=0;n<this.parsers.length;n++){let a=this.parsers[n];a.parse&&a.parse&&await a.testParse?.(s,e,this)&&(s=await a.parse(s,e,this)||s,r.parser=a)}return s})(),r}async load(t,e){this._parsersValidated||this._validateParsers();let r=0,s={},o=Wi(t),n=Se(t,l=>({alias:[l],src:l,data:{}})),a=n.length,h=n.map(async l=>{let c=qt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++r/a)}catch(u){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
1094
+ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let r=Se(t,s=>({alias:[s],src:s})).map(async s=>{let o=qt.toAbsolute(s.src),n=this.promiseCache[o];if(n){let a=await n.promise;delete this.promiseCache[o],await n.parser?.unload?.(a,s,this)}});await Promise.all(r)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name?t[e.name]&&H(`[Assets] loadParser name conflict "${e.name}"`):H("[Assets] loadParser should have a name"),{...t,[e.name]:e}),{})}};wt();R();function rr(i,t){if(Array.isArray(t)){for(let e of t)if(i.startsWith(`data:${e}`))return!0;return!1}return i.startsWith(`data:${t}`)}Vi();function ir(i,t){let e=i.split("?")[0],r=qt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}$r();var OB=".json",NB="application/json",Sw={extension:{type:y.LoadParser,priority:re.Low},name:"loadJson",test(i){return rr(i,NB)||ir(i,OB)},async load(i){return await(await j.get().fetch(i)).json()}};wt();R();$r();var DB=".txt",LB="text/plain",Aw={name:"loadTxt",extension:{type:y.LoadParser,priority:re.Low,name:"loadTxt"},test(i){return rr(i,LB)||ir(i,DB)},async load(i){return await(await j.get().fetch(i)).text()}};wt();R();vt();Vi();pi();$r();var HB=["normal","bold","100","200","300","400","500","600","700","800","900"],VB=[".ttf",".otf",".woff",".woff2"],WB=["font/ttf","font/otf","font/woff","font/woff2"],zB=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function $B(i){let t=qt.extname(i),s=qt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)),o=s.length>0;for(let a of s)if(!a.match(zB)){o=!1;break}let n=s.join(" ");return o||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}var XB=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function jB(i){return XB.test(i)?i:encodeURI(i)}var Ew={extension:{type:y.LoadParser,priority:re.Low},name:"loadWebFont",test(i){return rr(i,WB)||ir(i,VB)},async load(i,t){let e=j.get().getFontFaceSet();if(e){let r=[],s=t.data?.family??$B(i),o=t.data?.weights?.filter(a=>HB.includes(a))??["normal"],n=t.data??{};for(let a=0;a<o.length;a++){let h=o[a],l=new FontFace(s,`url(${jB(i)})`,{...n,weight:h});await l.load(),e.add(l),r.push(l)}return mt.set(`${s}-and-url`,{url:i,fontFaces:r}),r.length===1?r[0]:r}return H("[loadWebFont] FontFace API is not supported. Skipping loading font"),null},unload(i){(Array.isArray(i)?i:[i]).forEach(t=>{mt.remove(`${t.family}-and-url`),j.get().getFontFaceSet().delete(t)})}};wt();R();Gs();tc();Is();function bo(i,t=1){let e=Ve.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}$r();xt();vt();pi();function vo(i,t,e){i.label=e,i._sourceOrigin=e;let r=new I({source:i,label:e}),s=()=>{delete t.promiseCache[e],mt.has(e)&&mt.remove(e)};return r.source.once("destroy",()=>{t.promiseCache[e]&&(H("[Assets] A TextureSource managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the TextureSource."),s())}),r.once("destroy",()=>{i.destroyed||(H("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),s())}),r}var YB=".svg",qB="image/svg+xml",ww={extension:{type:y.LoadParser,priority:re.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(i){return rr(i,qB)||ir(i,YB)},async load(i,t,e){return t.data?.parseAsGraphicsContext??this.config.parseAsGraphicsContext?ZB(i):KB(i,t,e,this.config.crossOrigin)},unload(i){i.destroy(!0)}};async function KB(i,t,e,r){let o=await(await j.get().fetch(i)).blob(),n=URL.createObjectURL(o),a=new Image;a.src=n,a.crossOrigin=r,await a.decode(),URL.revokeObjectURL(n);let h=document.createElement("canvas"),l=h.getContext("2d"),c=t.data?.resolution||bo(i),u=t.data?.width??a.width,d=t.data?.height??a.height;h.width=u*c,h.height=d*c,l.drawImage(a,0,0,u*c,d*c);let{parseAsGraphicsContext:f,...p}=t.data??{},g=new Fe({resource:h,alphaMode:"premultiply-alpha-on-upload",resolution:c,...p});return vo(g,e,i)}async function ZB(i){let e=await(await j.get().fetch(i)).text(),r=new Ee;return r.svg(e),r}wt();R();Gs();var QB=`(function () {
1091
1095
  'use strict';
1092
1096
 
1093
1097
  const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
@@ -1108,7 +1112,7 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Ot(t
1108
1112
  });
1109
1113
 
1110
1114
  })();
1111
- `,Hi=null,Wi=class{constructor(){Hi||(Hi=URL.createObjectURL(new Blob([$E],{type:"application/javascript"}))),this.worker=new Worker(Hi)}};Wi.revokeObjectURL=function(){Hi&&(URL.revokeObjectURL(Hi),Hi=null)};var YE=`(function () {
1115
+ `,To=null,So=class{constructor(){To||(To=URL.createObjectURL(new Blob([QB],{type:"application/javascript"}))),this.worker=new Worker(To)}};So.revokeObjectURL=function(){To&&(URL.revokeObjectURL(To),To=null)};var JB=`(function () {
1112
1116
  'use strict';
1113
1117
 
1114
1118
  async function loadImageBitmap(url, alphaMode) {
@@ -1137,6 +1141,493 @@ ${u}`)}});return await Promise.all(c),o?s[n[0].src]:s}async unload(t){let r=Ot(t
1137
1141
  };
1138
1142
 
1139
1143
  })();
1140
- `,zi=null,Xo=class{constructor(){zi||(zi=URL.createObjectURL(new Blob([YE],{type:"application/javascript"}))),this.worker=new Worker(zi)}};Xo.revokeObjectURL=function(){zi&&(URL.revokeObjectURL(zi),zi=null)};var iT=0,ud,dd=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Wi;e.addEventListener("message",r=>{e.terminate(),Wi.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){ud===void 0&&(ud=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<ud&&(this._createdWorkers++,t=new Xo().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[iT]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:iT++,id:r})}},fd=new dd;ze();var KE=[".jpeg",".jpg",".png",".webp",".avif"],qE=["image/jpeg","image/png","image/webp","image/avif"];async function ZE(i,t){let e=await D.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var rc={name:"loadTextures",extension:{type:x.LoadParser,priority:Et.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ue(i,qE)||de(i,KE)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await fd.isImageBitmapSupported()?r=await fd.loadImageBitmap(i,t):r=await ZE(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new qt({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Li(i),...t.data});return Ni(s,e,i)},unload(i){i.destroy(!0)}};P();Al();Pl();var sT=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],QE=sT.map(i=>`video/${i.substring(1)}`);function JE(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=eP(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function tP(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function eP(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var oT={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(i){let t=ue(i,QE),e=de(i,sT);return t||e},async load(i,t,e){let r={...ei.defaultOptions,resolution:t.data?.resolution||Li(i),alphaMode:t.data?.alphaMode||await Mn(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(c=>{let l=o[c];l!==void 0&&s.setAttribute(c,l)}),r.muted===!0&&(s.muted=!0),JE(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let c=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=ei.MIME_TYPES[c]||`video/${c}`}return n.src=i,a&&(n.type=a),new Promise(c=>{let l=async()=>{let h=new ei({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await tP(s),c(Ni(h,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};P();Qr();P();Qr();var ic={extension:{type:x.ResolveParser,name:"resolveTexture"},test:rc.test,parse:i=>({resolution:parseFloat(se.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var nT={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:i=>se.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:ic.parse};Qr();ps();Sn();var sc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new se,this.loader=new ec,this.cache=Q,this._backgroundLoader=new Ja(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){k("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=Pr(t),s=Ot(t).map(a=>{if(typeof a!="string"){let c=this.resolver.getAlias(a);return c.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(c)?c[0]:c}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,c=0,l=()=>{e?.(++a/c)},h=n.map(u=>{let d=s[u];return c+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(h),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Q.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=Q.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],c=[n.src];n.alias&&c.push(...n.alias),c.forEach(l=>{o[l]=a}),Q.set(c,a)}),o}async unload(t){this._initialized||await this.init();let e=Ot(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Ot(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{Q.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},be=new sc;I.handleByList(x.LoadParser,be.loader.parsers).handleByList(x.ResolveParser,be.resolver.parsers).handleByList(x.CacheParser,be.cache.parsers).handleByList(x.DetectionParser,be.detections);I.add(j0,Y0,X0,Q0,K0,q0,Z0,J0,tT,eT,rT,rc,oT,V0,z0,ic,nT);var aT={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};I.handle(x.Asset,i=>{let t=i.ref;Object.entries(aT).filter(([e])=>!!t[e]).forEach(([e,r])=>I.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(aT).filter(e=>!!t[e]).forEach(e=>I.remove(t[e]))});rn();dt();Tn();var oc=class extends Je{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:c,roundPixels:l,...h}=t;super({...h}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new Bt({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),c!==void 0&&(this.height=c)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function cT(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(U(H,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}Ls();Fr();var ur=class extends oc{constructor(...t){let e=cT(t,"Text");super(e,St),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=At.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ze();vt();tt();Bl();me();$h();Pn();Ls();Fr();It();var rP=Jo(sh(),1);I.add(gy,_y);var Vt={Add:"add",Remove:"remove"},nc=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},dr=class{rendererName;rendererType;add=(t,e)=>{throw new Error("Method not implemented.")};remove=(t,e)=>{throw new Error("Method not implemented.")};update=(t,e)=>{throw new Error("Method not implemented.")}};var ac=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let c=n.find(l=>l.id===a.id&&l.type===a.type);c?r.push({prev:a,next:c}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let c=t.find(l=>l.id===a.id&&l.type===a.type);c&&c.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Or=new(window.AudioContext||window.webkitAudioContext),Vi=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Or.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},pd=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Or.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Or.destination)}play=()=>{let t=Vi.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Or.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Or.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Or.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Or.destination))}},cc=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new pd(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var md=function(i,t){return md=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},md(i,t)};function $o(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");md(i,t);function e(){this.constructor=i}i.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function lT(i,t,e,r){function s(o){return o instanceof e?o:new e(function(n){n(o)})}return new(e||(e=Promise))(function(o,n){function a(h){try{l(r.next(h))}catch(u){n(u)}}function c(h){try{l(r.throw(h))}catch(u){n(u)}}function l(h){h.done?o(h.value):s(h.value).then(a,c)}l((r=r.apply(i,t||[])).next())})}function lc(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,n=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return n.next=a(0),n.throw=a(1),n.return=a(2),typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(l){return function(h){return c([l,h])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;n&&(n=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(o=l[0]&2?s.return:l[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,l[1])).done)return o;switch(s=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){e.label=l[1];break}if(l[0]===6&&e.label<o[1]){e.label=o[1],o=l;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(l);break}o[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(i,e)}catch(h){l=[6,h],s=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Lr(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],r=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&r>=i.length&&(i=void 0),{value:i&&i[r++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ji(i,t){var e=typeof Symbol=="function"&&i[Symbol.iterator];if(!e)return i;var r=e.call(i),s,o=[],n;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){n={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}return o}function Xi(i,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,o;r<s;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return i.concat(o||Array.prototype.slice.call(t))}function Nr(i){return this instanceof Nr?(this.v=i,this):new Nr(i)}function hT(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(i,t||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",n),s[Symbol.asyncIterator]=function(){return this},s;function n(f){return function(m){return Promise.resolve(m).then(f,u)}}function a(f,m){r[f]&&(s[f]=function(g){return new Promise(function(_,b){o.push([f,g,_,b])>1||c(f,g)})},m&&(s[f]=m(s[f])))}function c(f,m){try{l(r[f](m))}catch(g){d(o[0][3],g)}}function l(f){f.value instanceof Nr?Promise.resolve(f.value.v).then(h,u):d(o[0][2],f)}function h(f){c("next",f)}function u(f){c("throw",f)}function d(f,m){f(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function uT(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof Lr=="function"?Lr(i):i[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(o){e[o]=i[o]&&function(n){return new Promise(function(a,c){n=i[o](n),s(a,c,n.done,n.value)})}}function s(o,n,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},n)}}function et(i){return typeof i=="function"}function dT(i){var t=function(r){Error.call(r),r.stack=new Error().stack},e=i(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var hc=dT(function(i){return function(e){i(this),this.message=e?e.length+` errors occurred during unsubscription:
1141
- `+e.map(function(r,s){return s+1+") "+r.toString()}).join(`
1142
- `):"",this.name="UnsubscriptionError",this.errors=e}});function gd(i,t){if(i){var e=i.indexOf(t);0<=e&&i.splice(e,1)}}var uc=function(){function i(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i.prototype.unsubscribe=function(){var t,e,r,s,o;if(!this.closed){this.closed=!0;var n=this._parentage;if(n)if(this._parentage=null,Array.isArray(n))try{for(var a=Lr(n),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(g){t={error:g}}finally{try{c&&!c.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else n.remove(this);var h=this.initialTeardown;if(et(h))try{h()}catch(g){o=g instanceof hc?g.errors:[g]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=Lr(u),f=d.next();!f.done;f=d.next()){var m=f.value;try{fT(m)}catch(g){o=o??[],g instanceof hc?o=Xi(Xi([],ji(o)),ji(g.errors)):o.push(g)}}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(o)throw new hc(o)}},i.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)fT(t);else{if(t instanceof i){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},i.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},i.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},i.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&gd(e,t)},i.prototype.remove=function(t){var e=this._finalizers;e&&gd(e,t),t instanceof i&&t._removeParent(this)},i.EMPTY=function(){var t=new i;return t.closed=!0,t}(),i}();var $Y=uc.EMPTY;function dc(i){return i instanceof uc||i&&"closed"in i&&et(i.remove)&&et(i.add)&&et(i.unsubscribe)}function fT(i){et(i)?i():i.unsubscribe()}var ve={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var $i={setTimeout:function(i,t){for(var e=[],r=2;r<arguments.length;r++)e[r-2]=arguments[r];var s=$i.delegate;return s?.setTimeout?s.setTimeout.apply(s,Xi([i,t],ji(e))):setTimeout.apply(void 0,Xi([i,t],ji(e)))},clearTimeout:function(i){var t=$i.delegate;return(t?.clearTimeout||clearTimeout)(i)},delegate:void 0};function fc(i){$i.setTimeout(function(){var t=ve.onUnhandledError;if(t)t(i);else throw i})}function xd(){}var pT=function(){return _d("C",void 0,void 0)}();function mT(i){return _d("E",void 0,i)}function gT(i){return _d("N",i,void 0)}function _d(i,t,e){return{kind:i,value:t,error:e}}var Hr=null;function xT(i){if(ve.useDeprecatedSynchronousErrorHandling){var t=!Hr;if(t&&(Hr={errorThrown:!1,error:null}),i(),t){var e=Hr,r=e.errorThrown,s=e.error;if(Hr=null,r)throw s}}else i()}function _T(i){ve.useDeprecatedSynchronousErrorHandling&&Hr&&(Hr.errorThrown=!0,Hr.error=i)}var Yo=function(i){$o(t,i);function t(e){var r=i.call(this)||this;return r.isStopped=!1,e?(r.destination=e,dc(e)&&e.add(r)):r.destination=nP,r}return t.create=function(e,r,s){return new mc(e,r,s)},t.prototype.next=function(e){this.isStopped?bd(gT(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?bd(mT(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?bd(pT,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,i.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(uc);var iP=Function.prototype.bind;function yd(i,t){return iP.call(i,t)}var sP=function(){function i(t){this.partialObserver=t}return i.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(r){pc(r)}},i.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(r){pc(r)}else pc(t)},i.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){pc(e)}},i}(),mc=function(i){$o(t,i);function t(e,r,s){var o=i.call(this)||this,n;if(et(e)||!e)n={next:e??void 0,error:r??void 0,complete:s??void 0};else{var a;o&&ve.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return o.unsubscribe()},n={next:e.next&&yd(e.next,a),error:e.error&&yd(e.error,a),complete:e.complete&&yd(e.complete,a)}):n=e}return o.destination=new sP(n),o}return t}(Yo);function pc(i){ve.useDeprecatedSynchronousErrorHandling?_T(i):fc(i)}function oP(i){throw i}function bd(i,t){var e=ve.onStoppedNotification;e&&$i.setTimeout(function(){return e(i,t)})}var nP={closed:!0,next:xd,error:oP,complete:xd};var Yi=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function yT(i){return i}function bT(i){return i.length===0?yT:i.length===1?i[0]:function(e){return i.reduce(function(r,s){return s(r)},e)}}var at=function(){function i(t){t&&(this._subscribe=t)}return i.prototype.lift=function(t){var e=new i;return e.source=this,e.operator=t,e},i.prototype.subscribe=function(t,e,r){var s=this,o=cP(t)?t:new mc(t,e,r);return xT(function(){var n=s,a=n.operator,c=n.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},i.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},i.prototype.forEach=function(t,e){var r=this;return e=vT(e),new e(function(s,o){var n=new mc({next:function(a){try{t(a)}catch(c){o(c),n.unsubscribe()}},error:o,complete:s});r.subscribe(n)})},i.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},i.prototype[Yi]=function(){return this},i.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return bT(t)(this)},i.prototype.toPromise=function(t){var e=this;return t=vT(t),new t(function(r,s){var o;e.subscribe(function(n){return o=n},function(n){return s(n)},function(){return r(o)})})},i.create=function(t){return new i(t)},i}();function vT(i){var t;return(t=i??ve.Promise)!==null&&t!==void 0?t:Promise}function aP(i){return i&&et(i.next)&&et(i.error)&&et(i.complete)}function cP(i){return i&&i instanceof Yo||aP(i)&&dc(i)}function lP(i){return et(i?.lift)}function Fe(i){return function(t){if(lP(t))return t.lift(function(e){try{return i(e,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Wr(i,t,e,r,s){return new hP(i,t,e,r,s)}var hP=function(i){$o(t,i);function t(e,r,s,o,n,a){var c=i.call(this,e)||this;return c.onFinalize=n,c.shouldUnsubscribe=a,c._next=r?function(l){try{r(l)}catch(h){e.error(h)}}:i.prototype._next,c._error=o?function(l){try{o(l)}catch(h){e.error(h)}finally{this.unsubscribe()}}:i.prototype._error,c._complete=s?function(){try{s()}catch(l){e.error(l)}finally{this.unsubscribe()}}:i.prototype._complete,c}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;i.prototype.unsubscribe.call(this),!r&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}(Yo);var gc=function(i){return i&&typeof i.length=="number"&&typeof i!="function"};function xc(i){return et(i?.then)}function _c(i){return et(i[Yi])}function yc(i){return Symbol.asyncIterator&&et(i?.[Symbol.asyncIterator])}function bc(i){return new TypeError("You provided "+(i!==null&&typeof i=="object"?"an invalid object":"'"+i+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function uP(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var vc=uP();function Tc(i){return et(i?.[vc])}function Sc(i){return hT(this,arguments,function(){var e,r,s,o;return lc(this,function(n){switch(n.label){case 0:e=i.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,Nr(e.read())];case 3:return r=n.sent(),s=r.value,o=r.done,o?[4,Nr(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,Nr(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function wc(i){return et(i?.getReader)}function Ue(i){if(i instanceof at)return i;if(i!=null){if(_c(i))return dP(i);if(gc(i))return fP(i);if(xc(i))return pP(i);if(yc(i))return TT(i);if(Tc(i))return mP(i);if(wc(i))return gP(i)}throw bc(i)}function dP(i){return new at(function(t){var e=i[Yi]();if(et(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fP(i){return new at(function(t){for(var e=0;e<i.length&&!t.closed;e++)t.next(i[e]);t.complete()})}function pP(i){return new at(function(t){i.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,fc)})}function mP(i){return new at(function(t){var e,r;try{for(var s=Lr(i),o=s.next();!o.done;o=s.next()){var n=o.value;if(t.next(n),t.closed)return}}catch(a){e={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}t.complete()})}function TT(i){return new at(function(t){xP(i,t).catch(function(e){return t.error(e)})})}function gP(i){return TT(Sc(i))}function xP(i,t){var e,r,s,o;return lT(this,void 0,void 0,function(){var n,a;return lc(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),e=uT(i),c.label=1;case 1:return[4,e.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(n=r.value,t.next(n),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=e.return)?[4,o.call(e)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function fe(i,t,e,r,s){r===void 0&&(r=0),s===void 0&&(s=!1);var o=t.schedule(function(){e(),s?i.add(this.schedule(null,r)):this.unsubscribe()},r);if(i.add(o),!s)return o}function Ec(i,t){return t===void 0&&(t=0),Fe(function(e,r){e.subscribe(Wr(r,function(s){return fe(r,i,function(){return r.next(s)},t)},function(){return fe(r,i,function(){return r.complete()},t)},function(s){return fe(r,i,function(){return r.error(s)},t)}))})}function Pc(i,t){return t===void 0&&(t=0),Fe(function(e,r){r.add(i.schedule(function(){return e.subscribe(r)},t))})}function ST(i,t){return Ue(i).pipe(Pc(t),Ec(t))}function wT(i,t){return Ue(i).pipe(Pc(t),Ec(t))}function ET(i,t){return new at(function(e){var r=0;return t.schedule(function(){r===i.length?e.complete():(e.next(i[r++]),e.closed||this.schedule())})})}function PT(i,t){return new at(function(e){var r;return fe(e,t,function(){r=i[vc](),fe(e,t,function(){var s,o,n;try{s=r.next(),o=s.value,n=s.done}catch(a){e.error(a);return}n?e.complete():e.next(o)},0,!0)}),function(){return et(r?.return)&&r.return()}})}function Ac(i,t){if(!i)throw new Error("Iterable cannot be null");return new at(function(e){fe(e,t,function(){var r=i[Symbol.asyncIterator]();fe(e,t,function(){r.next().then(function(s){s.done?e.complete():e.next(s.value)})},0,!0)})})}function AT(i,t){return Ac(Sc(i),t)}function CT(i,t){if(i!=null){if(_c(i))return ST(i,t);if(gc(i))return ET(i,t);if(xc(i))return wT(i,t);if(yc(i))return Ac(i,t);if(Tc(i))return PT(i,t);if(wc(i))return AT(i,t)}throw bc(i)}function te(i,t){return t?CT(i,t):Ue(i)}function MT(i,t){return Fe(function(e,r){var s=0;e.subscribe(Wr(r,function(o){r.next(i.call(t,o,s++))}))})}function BT(i,t,e,r,s,o,n,a){var c=[],l=0,h=0,u=!1,d=function(){u&&!c.length&&!l&&t.complete()},f=function(g){return l<r?m(g):c.push(g)},m=function(g){o&&t.next(g),l++;var _=!1;Ue(e(g,h++)).subscribe(Wr(t,function(b){s?.(b),o?f(b):t.next(b)},function(){_=!0},void 0,function(){if(_)try{l--;for(var b=function(){var y=c.shift();n?fe(t,n,function(){return m(y)}):m(y)};c.length&&l<r;)b();d()}catch(y){t.error(y)}}))};return i.subscribe(Wr(t,f,function(){u=!0,d()})),function(){a?.()}}function jt(i,t,e){return e===void 0&&(e=1/0),et(t)?jt(function(r,s){return MT(function(o,n){return t(r,o,s,n)})(Ue(i(r,s)))},e):(typeof t=="number"&&(e=t),Fe(function(r,s){return BT(r,s,i,e)}))}function Ko(i){return Fe(function(t,e){try{t.subscribe(e)}finally{e.add(i)}})}var _P=i=>i.split("/").pop(),vd=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:_P(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof M)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new M.from(r)}async unload(t){t.destroy(!0)}},Td=class i extends nc{static rendererName="pixi";_app;_audioStage=new cc;_state={elements:[]};_eventHandler;_plugins;_currentSubscription;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let c of r)if(c.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Za,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new Wt;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={},r={};for(let[o,n]of Object.entries(t))n.type&&n.type.startsWith("audio/")?r[o]=n:e[o]=n;await Promise.all(Object.entries(r).map(([o,n])=>Vi.load(o,n.buffer))),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e):(this._advancedLoader=new vd(e),be.loader.parsers.length=0,be.reset(),I.add({name:"advanced-buffer-loader",extension:x.Asset,priority:Et.High,loader:this._advancedLoader}),typeof be.registerPlugin=="function"&&be.registerPlugin(this._advancedLoader));let s=Object.keys(e);return Promise.all(s.map(o=>be.load(o)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return Vi.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_render=async(t,e,r,s,o)=>{let n=Date.now(),{toAddElements:a,toUpdateElements:c,toDeleteElements:l}=ac(r.elements,s.elements),h=[];for(let u of l){let d=this._getRendererByElement(u);h.push(d.remove(t,{parent:e,element:u,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of a){let d=this._getRendererByElement(u);h.push(d.add(t,{parent:e,element:u,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}for(let u of c){let d=this._getRendererByElement(u.next);h.push(d.update(t,{parent:e,prevElement:u.prev,nextElement:u.next,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o}))}t.stage.children.sort((u,d)=>{let f=s.elements.findIndex(g=>g.id===u.label),m=s.elements.findIndex(g=>g.id===d.label);return f-m}),this._currentSubscription&&(this._currentSubscription.closed||this._currentSubscription.unsubscribe()),this._currentSubscription=te(h).pipe(jt(u=>u),Ko(()=>{o&&o("completed",{id:s.id,diffTime:Date.now()-n}),this._currentSubscription=void 0})).subscribe({error:u=>{console.error("Error:",u)}})}},RT=Td;var Sd=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=M.from(o.url),h,u;o.hoverUrl&&(h=M.from(o.hoverUrl)),o.clickUrl&&(u=M.from(o.clickUrl));let d=new Lt(l);d.label=o.id,(o.eventName||o.hoverUrl||o.clickUrl)&&(d.cursor="pointer",d.eventMode="static"),o.anchorX!==void 0&&(d.pivot.x=d.width*o.anchorX,console.log("sprite.width",d.width)),o.anchorY!==void 0&&(d.pivot.y=d.height*o.anchorY,console.log("sprite.height",d.height)),o.scaleX!==void 0&&(d.scale.x=o.scaleX),o.scaleY!==void 0&&(d.scale.y=o.scaleY),o.rotation!==void 0&&(d.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(d.x=o.x),o.y!==void 0&&(d.y=o.y),o.width!==void 0&&(d.width=o.width),o.height!==void 0&&(d.height=o.height),o.zIndex!==void 0&&(d.zIndex=o.zIndex),o.alpha!==void 0&&(d.alpha=o.alpha),d.on("pointerup",()=>{d.texture=l}).on("pointerupoutside",()=>{d.texture=l}).on("pointerleave",()=>{d.texture=l}),u&&d.on("pointerdown",()=>{d.texture=u}),h&&d.on("pointerenter",()=>{d.texture=h}),d.on("pointerup",g=>{g.stopPropagation();let _=g.button;_===0?c&&c(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&c?c(o.rightClickEventName):t.stage.emit("rightclick",event))});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,d,g))}s.addChild(d);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u)},complete:()=>{r.complete(),c&&c.destroy()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>new at(c=>{let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);if(JSON.stringify(r)!==JSON.stringify(s)){let h=[this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a}),this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n})],u=te(h).pipe(jt(d=>d)).subscribe({error:d=>{console.error("Error:",d)},complete:()=>c.complete()});return()=>{u.unsubscribe()}}else s.x!==void 0&&(l.x=s.x),s.y!==void 0&&(l.y=s.y),s.width!==void 0&&s.width!==r.width&&(l.width=s.width),s.height!==void 0&&s.height!==r.height&&(l.height=s.height),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),c.complete();return()=>{}})};var Cc=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),wd=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e,l=Cc(o.style),h=new ur({text:o.text,style:l}),u;o.hoverStyle&&(u=Cc(o.hoverStyle));let d;if(o.clickedStyle&&(d=Cc(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(h.cursor="pointer",h.eventMode="static"),h.label=o.id,o.x!==void 0&&(h.x=o.x),o.y!==void 0&&(h.y=o.y),o.xa!==void 0&&(h.anchor.x=o.xa),o.ya!==void 0&&(h.anchor.y=o.ya),o.xa!==void 0||o.ya!==void 0){let g=h.getLocalBounds();h.hitArea=new z(-g.width*h.anchor.x,-g.height*h.anchor.y,g.width,g.height)}h.on("pointerupoutside",()=>{h.style=l}).on("pointerup",()=>{h.style=l}).on("pointerleave",()=>{h.style=l}),h.on("pointerup",g=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),g.stopPropagation(),c&&c(o.eventName,o.eventPayload)}),d&&h.on("pointerdown",()=>{h.style=d}),u&&h.on("pointerenter",()=>{h.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let g of n)if(g.elementId===o.id&&g.event===Vt.Add){let _=a(g.type);if(!_)throw new Error(`Transition class not found for type ${g.type}`);f.push(_.add(t,h,g))}s.addChild(h);let m=te(f).pipe(jt(g=>g)).subscribe({error:g=>{console.error("Error:",g),r.error(g)},complete:()=>r.complete()});return()=>{m.unsubscribe()}});remove=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`),r.complete();return}let l=[];for(let u of n)if(u.elementId===o.id&&u.event===Vt.Remove){let d=a(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);l.push(d.remove(t,c,u))}let h=te(l).pipe(jt(u=>u)).subscribe({error:u=>{console.error("Error:",u),r.error(u)},complete:()=>{c.destroy(),r.complete()}});return()=>{h.unsubscribe(),c&&c.destroy()}});update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:c,eventHandler:l}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`),r.complete();return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:c,eventHandler:l}),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:c})],d=te(u).pipe(jt(f=>f)).subscribe({error:f=>{console.error("Error:",f),r.error(f)},complete:()=>r.complete()});return()=>{d.unsubscribe()}}else o.text!==n.text&&(h.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(h.style=Cc(n?.style)),n.x!==void 0&&(h.x=n.x),n.y!==void 0&&(h.y=n.y),r.complete();return()=>{}})};var Ki=(i,t=!1)=>new St({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),Ed=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=Ki(r.style,r.text),o=new ur({text:"",style:s});o.label=r.id,o.text_id=r.text;let n=new nt;r.x!==void 0&&(n.x=r.x),r.y!==void 0&&(n.y=r.y),n.addChild(o),n.label=r.id,e.addChild(n);let a=r.style.wordWrapWidth||500,c=r.text?[{text:r.text,style:r.style}]:r.segments,l=[],h=[],u=0,d=0,f=0;for(;;){let T=c[0];if(!T){h.length>0&&l.push({lineParts:h,y:d});break}if(d>1e4)break;let w={...T.style,wordWrapWidth:a-u},A=At.measureText(T.text,Ki(w));A.lineHeight>f&&(f=A.lineHeight);let R=At.measureText("a",Ki(w)),G=At.measureText("a a",Ki(w)).width-R.width*2;if(A.lineWidths[0]+u>a){u=0,l.push({lineParts:h,y:d}),d+=f,f=0,h=[];continue}let L=A.lines[0],Y=A.lines.slice(1).join(" "),mt={text:L,style:w,x:u,y:0};if(h.push(mt),Y&&Y.length>0?T.text=Y:c.shift(),!(!L||L.length===0)){if(T.furigana){let Xt=At.measureText(T.furigana.text,Ki(T.furigana.style)),N={text:T.furigana.text,style:T.furigana.style,x:u+(A.width-Xt.width)/2,y:-10};h.push(N)}u+=A.lineWidths[0]+G}}l.forEach(T=>{let w=new nt;w.y=T.y,w.alpha=0,T.lineParts.forEach(A=>{let R=new ur({text:A.text,style:Ki(A.style),x:A.x,y:A.y});w.addChild(R)}),n.addChild(w)});let m=new Wt,g=1e3,_=a/2,b=a/2;m.fill({color:16777215,alpha:1}),m.rect(0,0,_,g);for(let T=0;T<b;T++)m.fill({color:16777215,alpha:1-T/b}),m.rect(_+T,0,_+1,g);let y=t.renderer.generateTexture(m),v=new Lt(y);v.x=-1.35*_-b,t.stage.addChild(v);let S=0,E=1;if(l.length!==0){if(r.displaySpeed===100||r.hasEnded){n.children.forEach(T=>{t.stage.removeChild(v),T.mask=null,T.alpha=1});return}await new Promise(T=>{let w=A=>{if(E>n.children.length){T();return}n.getChildAt(E).mask||(n.getChildAt(E).mask=v,n.getChildAt(E).alpha=1),S+=A.deltaMS;let C=(r.displaySpeed||50)/1e3;v.x+=C*S,v.x>=0&&(n.getChildAt(E).mask=null,v.x=-1.35*_-b,E=E+1,S=0,E>=n.children.length&&(n.getChildAt(E-1).mask=null,t.ticker.remove(w),T()))};t.ticker.add(w)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Vt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var Pd=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=(t,e)=>new at(r=>{let{parent:s,element:o,transitions:n=[],getTransitionByType:a,getRendererByElement:c,eventHandler:l}=e,h=structuredClone(o),u=new nt;u.label=h.id;let d={};h.x!==void 0&&(typeof h.x=="string"&&h.x.endsWith("%")?u.x=Number(h.x.replace("%",""))*t.screen.width/100:u.x=h.x),h.y!==void 0&&(typeof h.y=="string"&&h.y.endsWith("%")?u.y=Number(h.y.replace("%",""))*t.screen.height/100:u.y=h.y),h.scaleX!==void 0&&(u.scale.x=h.scaleX),h.scaleY!==void 0&&(u.scale.y=h.scaleY),h.zIndex!==void 0&&(u.zIndex=h.zIndex),h.rotation!==void 0&&(u.rotation=h.rotation*Math.PI/180),h.propagateEvents&&(u.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(E=>{u.on(E,T=>{T.stopPropagation();for(let w of u.children)w.emit(E)})}));let f=h.gap||0,m=new Wt().roundRect(0,0,h.width||0,h.height||0,1).fill(h.fill?h.fill.color:"transparent"),g=[0,.5,1],_=h.anchorX??0,b=h.anchorY??0;if(!g.includes(_))throw new Error(`Invalid anchorX value: ${_}. Must be 0, 0.5, or 1`);if(!g.includes(b))throw new Error(`Invalid anchorY value: ${b}. Must be 0, 0.5, or 1`);if(h.direction){let E,T;h.direction==="horizontal"?(E=h.children.reduce((A,R)=>A+R.width+f,0),T=h.children.reduce((A,R)=>Math.max(A,R.height||0),0)):h.direction==="vertical"&&(E=h.children.reduce((A,R)=>Math.max(A,R.width||0),0),T=h.children.reduce((A,R)=>A+R.height+f,0));let w={x:_,y:b};h.direction==="horizontal"?this.layoutChildren({element:h,anchor:w,totalWidth:E,totalHeight:T,gap:f,direction:"horizontal",scroll:h.scroll}):h.direction==="vertical"&&this.layoutChildren({element:h,anchor:w,totalWidth:E,totalHeight:T,gap:f,direction:"vertical",scroll:h.scroll}),this.setupScrolling({container:u,element:h,totalHeight:T,totalWidth:E,eventHandler:l,sliderRef:d}),m=this.createContainerGraphic(h,E,T,w)}m.label=`${h.id}-container-background`,u.addChild(m);let y=[];(h.children||[]).forEach(E=>{let T=c(E);y.push(T.add(t,{parent:u,element:{zIndex:h.zIndex,...E},transitions:n,getTransitionByType:a,getRendererByElement:c,eventHandler:l}))});let v=[];for(let E of n)if(E.elementId===h.id&&E.event===Vt.Add){let T=a(E.type);if(!T)throw new Error(`Transition class not found for type ${E.type}`);v.push(T.add(t,u,E))}s.addChild(u);let S=te(y).pipe(jt(E=>E)).subscribe({error:E=>{console.error("Error:",E)},complete:()=>{let{width:E,height:T}=this.getContainerDimensions(h,u),w=_*E,A=b*T;u.pivot.x=w,u.pivot.y=A,r.complete()}});return()=>{S.unsubscribe()}});remove=(t,e)=>(console.log("remove container 11111111111"),new at(r=>{let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}return n.destroy(),()=>{n.destroy()}}));update=(t,e)=>new at(r=>{let{parent:s,prevElement:o,nextElement:n,getRendererByElement:a,transitions:c=[],getTransitionByType:l,eventHandler:h}=e,u=structuredClone(o),d=structuredClone(n),f=s.getChildByName(u.id);if(!f){console.warn(`Container with id ${u.id} not found`);return}d.x!==void 0&&d.x!==u.x&&(f.x=d.x),d.y!==void 0&&d.y!==u.y&&(f.y=d.y),d.rotation!==void 0&&d.rotation!==u.rotation&&(f.rotation=d.rotation*Math.PI/180);let m=[0,.5,1],g=d.anchorX??0,_=d.anchorY??0;if(!m.includes(g))throw new Error(`Invalid anchorX value: ${g}. Must be 0, 0.5, or 1`);if(!m.includes(_))throw new Error(`Invalid anchorY value: ${_}. Must be 0, 0.5, or 1`);if(d.direction){let E=d.gap||0,T,w;d.direction==="horizontal"?(T=d.children.reduce((C,G)=>C+G.width+E,0),w=d.children.reduce((C,G)=>Math.max(C,G.height||0),0)):d.direction==="vertical"&&(T=d.children.reduce((C,G)=>Math.max(C,G.width||0),0),w=d.children.reduce((C,G)=>C+G.height+E,0));let A={x:g,y:_};d.direction==="horizontal"?this.layoutChildren({element:d,anchor:A,totalWidth:T,totalHeight:w,gap:E,direction:"horizontal",scroll:d.scroll}):d.direction==="vertical"&&this.layoutChildren({element:d,anchor:A,totalWidth:T,totalHeight:w,gap:E,direction:"vertical",scroll:d.scroll});let R=f.children.find(C=>C.label===`${d.id}-container-background`);if(R){R.destroy();let C=this.createContainerGraphic(d,T,w,A);C.label=`${d.id}-container-background`,f.addChildAt(C,0)}u.scroll!==d.scroll&&this.setupScrolling({container:f,element:d,totalHeight:w,totalWidth:T,eventHandler:h,sliderRef:{}})}let b=[],{toAddElements:y,toUpdateElements:v,toDeleteElements:S}=ac(u.children,d.children);for(let E of S){let T=a(E);b.push(T.remove(t,{parent:f,element:E,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let E of y){let T=a(E);b.push(T.add(t,{parent:f,element:E,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}for(let E of v){let T=a(E.next);b.push(T.update(t,{parent:f,prevElement:E.prev,nextElement:E.next,transitions:c,getTransitionByType:l,getRendererByElement:a,eventHandler:h}))}return f.children.sort((E,T)=>{let w=d.children?.findIndex(R=>R.id===E.label),A=d.children?.findIndex(R=>R.id===T.label);return w-A}),this._currentSubscription=te(b).pipe(jt(E=>E),Ko(()=>{let{width:E,height:T}=this.getContainerDimensions(d,f),w=g*E,A=_*T;f.pivot.x=w,f.pivot.y=A,r.complete()})).subscribe({error:E=>{r.error(E),console.error("Error:",E)}}),()=>{this._currentSubscription?.unsubscribe()}});layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let c=n==="horizontal",l=c?"x":"y",h=c?"y":"x",u=c?"width":"height",d=c?"height":"width",f=c?r:s,m=c?s:r,g=c?e.x:e.y,_=c?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let y=0,v=0,S=0,E=0;(t.children||[]).forEach((T,w)=>{y>0&&y+T[u]>t[u]&&(this.alignRowElements(t.children.slice(E,w),l,g,t[u]),y=0,v+=S+o,S=0,E=w),T[l]=y,T[h]=v,y+=T[u]+o,S=Math.max(S,T[d]||0)}),E<t.children.length&&this.alignRowElements(t.children.slice(E),l,g,t[u])}else{if(g===0){let y=0;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(g===1){let y=-f;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}else if(g===.5){let y=-f/2;(t.children||[]).forEach(v=>{v[l]=y,y+=v[u]+o})}_===0?(t.children||[]).forEach(y=>{y[h]=0}):_===.5?(t.children||[]).forEach(y=>{y[h]=-m/2}):_===1&&(t.children||[]).forEach(y=>{y[h]=-m})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,c)=>n+a[e==="x"?"width":"height"]+(c>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(c=>{c[e]=a,a+=c[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new Wt().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,c=-1/0;e.children.forEach(l=>{let h=l.x||0,u=l.y||0,d=l.width||0,f=l.height||0;o=Math.min(o,h),n=Math.max(n,h+d),a=Math.min(a,u),c=Math.max(c,u+f)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=c-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,c=e.scroll&&e.width&&s>e.width;if(a||c){let l=0,h=0,u=-r+e.height,d=-s+e.width,f=new Wt().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",m=>{if(a&&m.deltaY!==0&&(l-m.deltaY>0||l-m.deltaY<u||(l-=m.deltaY,t.y-=m.deltaY,f.y+=m.deltaY)),c&&(m.deltaX!==0||m.shiftKey&&m.deltaY!==0)){let g=m.deltaX!==0?m.deltaX:m.deltaY;if(h-g>0||h-g<d)return;h-=g,t.x-=g,f.x+=g}})}}};var yP={linear:i=>i},bP=(i,t,e,r)=>i+(t-i)*yP[r](e);function GT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function IT(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var vP=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:c,relative:l},h)=>{h===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&c!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:c}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:c,easing:l}=e[n],{time:h,value:u}=e[n+1];if(t>=a&&t<=h){let d=(t-a)/(h-a);o=bP(c,u,d,l);break}else t>h&&(o=u)}return o};function TP(i){return Math.max.apply(null,i)}var Ad=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=(t,e,r)=>(console.log("keyframe transition setup"),new at(s=>{console.log("keyframe transition start");let{animationProperties:o}=r,n=Array.isArray(o)?o:Object.entries(o).map(([d,f])=>({...f,property:d})),a=n.map(d=>d.keyframes.reduce((f,m)=>f+m.duration||0,0)),c=TP(a),l=0,h={};n.forEach(d=>{h[d.property]=GT(e,d.property)});let u=d=>{if(l+=d.deltaMS,l>=c){t.ticker.remove(u),s.complete();return}let f={};n.forEach(m=>{let g=[];m.initialValue!==void 0?g=[{value:m.initialValue,duration:0}]:g=[{value:h[m.property],duration:0}],g=g.concat(m.keyframes),IT(f,m.property,vP(g,l))}),n.forEach(m=>{let{property:g}=m;e&&!e.destroyed&&IT(e,g,GT(f,g))})};return t.ticker.add(u),()=>{t.ticker.remove(u),u({deltaMS:c-l})}}));add=(t,e,r)=>this._transition(t,e,r);remove=(t,e,r)=>this._transition(t,e,r)};var Cd=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n,eventHandler:a}=e,c=new Wt;c.label=s.id,s.x!==void 0&&(c.x=s.x),s.y!==void 0&&(c.y=s.y),s.alpha!==void 0&&(c.alpha=s.alpha),s.scaleX!==void 0&&(c.scale.x=s.scaleX),s.scaleY!==void 0&&(c.scale.y=s.scaleY),s.rotation!==void 0&&(c.rotation=s.rotation*Math.PI/180);let l=s.width,h=s.height;c.rect(0,0,l,h),c.fill(s.fill),s.anchorX!==void 0&&(c.pivot.x=l*s.anchorX),s.anchorY!==void 0&&(c.pivot.y=h*s.anchorY),(s.clickEventName||s.rightClickEventName)&&a&&(c.eventMode="static",c.on("pointerup",d=>{d.button===0?a(s.clickEventName):d.button===2&&a(s.rightClickEventName)})),s.wheelEventName&&a&&(c.eventMode="static",c.on("wheel",d=>{a(s.wheelEventName,{deltaY:d.deltaY})}));let u=[];for(let d of o)if(d.elementId===s.id&&d.event===Vt.Add){let f=n(d.type);if(!f)throw new Error(`Transition class not found for type ${d.type}`);u.push(f.add(t,c,d))}r.addChild(c),await Promise.all(u)};remove=async(t,e)=>{let{parent:r,element:s}=e,o=r.getChildByName(s.id);if(!o)throw new Error(`Sprite with id ${s.id} not found`);o.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o,transitions:n=[],getTransitionByType:a,eventHandler:c}=e;if(!r.getChildByName(s.id))throw new Error(`Container with id ${s.id} not found`);JSON.stringify(s)!==JSON.stringify(o)&&await Promise.all([this.remove(t,{parent:r,element:s,transitions:n,getTransitionByType:a,eventHandler:c}),this.add(t,{parent:r,element:o,transitions:n,getTransitionByType:a,eventHandler:c})])}};var Md=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:c,idleThumb:l,hoverThumb:h,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:m,dragEventPayload:g,initialValue:_}=r,b={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},y=b[c].axis,v=b[c].size,S=M.from(l),E=M.from(h),T=M.from(u),w=M.from(d),A=new Lt({texture:T,anchor:{x:0,y:0}});A.label=r.id;let R=A[v];A.x=r.x||0,A.y=r.y||0;let C=new Lt({texture:S,anchor:{x:.5,y:.5}});if(C.y=A.height/2,C.x=A.width/2,C.eventMode="static",C.cursor="pointer",A.eventMode="static",A.cursor="pointer",C.on("pointerdown",Y).on("pointerup",mt).on("pointerupoutside",mt),A.on("pointerdown",G).on("pointerup",L).on("pointerupoutside",L),A.addChild(C),_!==void 0){let F=C[v]/2;C[y]=_/100*(R-C[v])+F}function G(F){C.texture=E,A.texture=w,Xt(F),t.stage.eventMode="static",t.stage.addEventListener("pointermove",Xt)}function L(F){C.texture=S,A.texture=T,Xt(F),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",Xt)}function Y(F){F.stopPropagation(),C.texture=E,A.texture=w,t.stage.eventMode="static",t.stage.addEventListener("pointermove",Xt)}function mt(F){if(C.texture=S,A.texture=T,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",Xt),f){let Te=A.toLocal(F.global)[y],q=C[v]/2;C[y]=Math.max(0+q,Math.min(Te,R-q));let ee=Math.floor((C[y]-q)/(R-C[v])*100),De=JSON.stringify(g);n&&n(f,JSON.parse(De.replace('"{{ value }}"',String(ee))))}}function Xt(F){let Te=A.toLocal(F.global)[y],q=C[v]/2;C[y]=Math.max(0+q,Math.min(Te,R-q));let ee=Math.floor((C[y]-q)/(R-C[v])*100);if(m){let De=JSON.stringify(g);n&&n(m,JSON.parse(De.replace('"{{ value }}"',String(ee))))}return ee}a&&(a.current={updateValue:F=>{let Te=C[v]/2;C[y]=F/100*(R-C[v])+Te}});let N=[];for(let F of s)if(F.elementId===r.id&&F.event===Vt.Add){let Te=o(F.type);if(!Te)throw new Error(`Transition class not found for type ${F.type}`);N.push(Te.add(t,A,F))}e.addChild(A),await Promise.all(N)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let c=[];for(let l of o)if(l.elementId===s.id&&l.event===Vt.Remove){let h=n(l.type);if(!h)throw new Error(`Transition class not found for type ${l.type}`);c.push(h.remove(t,a,l))}await Promise.all(c),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var Bd=class extends dr{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var Rd=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},SP=()=>new Rd;var m7=RT;export{Bd as AudioPlugin,Pd as ContainerRendererPlugin,Ad as KeyframeTransitionPlugin,Cd as RectRendererPlugin,Md as SliderRendererPlugin,Sd as SpriteRendererPlugin,wd as TextRendererPlugin,Ed as TextRevealingRendererPlugin,SP as createAssetBufferManager,m7 as default};
1144
+ `,Ao=null,Za=class{constructor(){Ao||(Ao=URL.createObjectURL(new Blob([JB],{type:"application/javascript"}))),this.worker=new Worker(Ao)}};Za.revokeObjectURL=function(){Ao&&(URL.revokeObjectURL(Ao),Ao=null)};var Cw=0,Im,Fm=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new So;e.addEventListener("message",r=>{e.terminate(),So.revokeObjectURL(),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Im===void 0&&(Im=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Im&&(this._createdWorkers++,t=new Za().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let r=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),r}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),r=e.id;this._resolveHash[Cw]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Cw++,id:r})}},Gm=new Fm;$r();var tI=[".jpeg",".jpg",".png",".webp",".avif"],eI=["image/jpeg","image/png","image/webp","image/avif"];async function rI(i,t){let e=await j.get().fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);let r=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(r,{premultiplyAlpha:"none"}):createImageBitmap(r)}var jc={name:"loadTextures",extension:{type:y.LoadParser,priority:re.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return rr(i,eI)||ir(i,tI)},async load(i,t,e){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Gm.isImageBitmapSupported()?r=await Gm.loadImageBitmap(i,t):r=await rI(i,t):r=await new Promise((o,n)=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?o(r):(r.onload=()=>{o(r)},r.onerror=n)});let s=new Fe({resource:r,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||bo(i),...t.data});return vo(s,e,i)},unload(i){i.destroy(!0)}};R();Yd();jd();var Pw=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],iI=Pw.map(i=>`video/${i.substring(1)}`);function sI(i,t,e){e===void 0&&!t.startsWith("data:")?i.crossOrigin=nI(t):e!==!1&&(i.crossOrigin=typeof e=="string"?e:"anonymous")}function oI(i){return new Promise((t,e)=>{i.addEventListener("canplaythrough",r),i.addEventListener("error",s),i.load();function r(){o(),t()}function s(n){o(),e(n)}function o(){i.removeEventListener("canplaythrough",r),i.removeEventListener("error",s)}})}function nI(i,t=globalThis.location){if(i.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Rw={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(i){let t=rr(i,iI),e=ir(i,Pw);return t||e},async load(i,t,e){let r={...Us.defaultOptions,resolution:t.data?.resolution||bo(i),alphaMode:t.data?.alphaMode||await yl(),...t.data},s=document.createElement("video"),o={preload:r.autoLoad!==!1?"auto":void 0,"webkit-playsinline":r.playsinline!==!1?"":void 0,playsinline:r.playsinline!==!1?"":void 0,muted:r.muted===!0?"":void 0,loop:r.loop===!0?"":void 0,autoplay:r.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),r.muted===!0&&(s.muted=!0),sI(s,i,r.crossorigin);let n=document.createElement("source"),a;if(i.startsWith("data:"))a=i.slice(5,i.indexOf(";"));else if(!i.startsWith("blob:")){let h=i.split("?")[0].slice(i.lastIndexOf(".")+1).toLowerCase();a=Us.MIME_TYPES[h]||`video/${h}`}return n.src=i,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Us({...r,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await oI(s),h(vo(c,e,i))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(i){i.destroy(!0)}};R();Is();R();Is();var Yc={extension:{type:y.ResolveParser,name:"resolveTexture"},test:jc.test,parse:i=>({resolution:parseFloat(Ve.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};var Mw={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:i=>Ve.RETINA_PREFIX.test(i)&&i.endsWith(".json"),parse:Yc.parse};Is();bn();fl();var qc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ve,this.loader=new Xc,this.cache=mt,this._backgroundLoader=new zc(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){H("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,r=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:r}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let r=Wi(t),s=Se(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return r?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let r=!1;typeof t=="string"&&(r=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),r?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return mt.get(t);let e={};for(let r=0;r<t.length;r++)e[r]=mt.get(t[r]);return e}async _mapLoadToResolve(t,e){let r=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(r,e);this._backgroundLoader.active=!0;let o={};return r.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),mt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Se(t).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(e);await this._unloadFromResolved(r)}async unloadBundle(t){this._initialized||await this.init(),t=Se(t);let e=this.resolver.resolveBundle(t),r=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(r)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(r=>{mt.remove(r.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let r of t.detections)t.skipDetections||await r.test()?e=await r.add(e):t.skipDetections||(e=await r.remove(e));return e=e.filter((r,s)=>e.indexOf(r)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(r=>r in t).forEach(r=>{e.config[r]=t[r]})})}},mr=new qc;D.handleByList(y.LoadParser,mr.loader.parsers).handleByList(y.ResolveParser,mr.resolver.parsers).handleByList(y.CacheParser,mr.cache.parsers).handleByList(y.DetectionParser,mr.detections);D.add(mw,_w,gw,Tw,yw,bw,vw,Sw,Aw,Ew,ww,jc,Rw,pw,fw,Yc,Mw);var Bw={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};D.handle(y.Asset,i=>{let t=i.ref;Object.entries(Bw).filter(([e])=>!!t[e]).forEach(([e,r])=>D.add(Object.assign(t[e],{extension:t[e].extension??r})))},i=>{let t=i.ref;Object.keys(Bw).filter(e=>!!t[e]).forEach(e=>D.remove(t[e]))});jh();Ft();dl();var Kc=class extends fi{constructor(t,e){let{text:r,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=r??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new ce({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,r=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-r*this.anchor.y,t.y>=o&&t.y<=o+r)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function Iw(i,t){let e=i[0]??{};return(typeof e=="string"||i[1])&&(X(tt,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:i[1]}),e}$n();Qi();var Qr=class extends Kc{constructor(...t){let e=Iw(t,"Text");super(e,Kt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,r=_t.measureText(this._text,this._style),{width:s,height:o}=r;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};$r();Yt();xt();Zd();cr();pp();gl();$n();Qi();me();var aI=Fi(kl(),1);D.add(LT,VT);var We=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(We||{}),Um=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(Um||{}),Zc=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Zc||{}),J=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(J||{}),Eo=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Eo||{}),L=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(L||{}),Jr=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Jr||{}),st=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(st||{}),V=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(V||{}),sr=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(sr||{}),Qa=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Qa||{}),gr=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(gr||{}),ze=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(ze||{}),Ei=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ei||{}),Qc=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Qc||{}),Pe=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Pe||{}),$t=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))($t||{});var St=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(St||{}),Oe=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(Oe||{});var km={createCanvas:(i,t)=>{let e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};var K={ADAPTER:km,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Bd();var hI=ui.default??ui,xr=hI(globalThis.navigator);K.RETINA_PREFIX=/@([0-9\.]+)x/;K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var as=Fi(Gw(),1),JG=Fi(kl(),1);var gg=Fi(KC(),1);var ZC={};function ht(i,t,e=3){if(ZC[t])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
1145
+ Deprecated since v${i}`):(r=r.split(`
1146
+ `).splice(e).join(`
1147
+ `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
1148
+ Deprecated since v${i}`),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
1149
+ Deprecated since v${i}`),console.warn(r))),ZC[t]=!0}var xg;function _g(){return typeof xg>"u"&&(xg=function(){let i={stencil:!0,failIfMajorPerformanceCaveat:K.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!K.ADAPTER.getWebGLRenderingContext())return!1;let t=K.ADAPTER.createCanvas(),e=t.getContext("webgl",i)||t.getContext("experimental-webgl",i),r=!!e?.getContextAttributes()?.stencil;if(e){let s=e.getExtension("WEBGL_lose_context");s&&s.loseContext()}return e=null,r}catch{return!1}}()),xg}id();sd();$h([Xh]);var ko=class pu{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof pu)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?{...t}:t}isSourceEqual(t,e){let r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,o)=>s===e[o]);if(t!==null&&e!==null){let s=Object.keys(t),o=Object.keys(e);return s.length!==o.length?!1:s.every(n=>t[n]===e[n])}return t===e}toRgba(){let[t,e,r,s]=this._components;return{r:t,g:e,b:r,a:s}}toRgb(){let[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){let[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){let[e,r,s]=this._components;return t=t??[],t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(s*255),t}toRgbArray(t){t=t??[];let[e,r,s]=this._components;return t[0]=e,t[1]=r,t[2]=s,t}toNumber(){return this._int}toLittleEndianNumber(){let t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){let[e,r,s,o]=pu.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=s,this._components[3]*=o,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,s=this._int>>8&255,o=this._int&255;return e&&(r=r*t+.5|0,s=s*t+.5|0,o=o*t+.5|0),(t*255<<24)+(r<<16)+(s<<8)+o}toHex(){let t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){let t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){let[e,r,s]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(r*t)/t,this._components[2]=Math.round(s*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t??[];let[e,r,s,o]=this._components;return t[0]=e,t[1]=r,t[2]=s,t[3]=o,t}normalize(t){let e,r,s,o;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){let n=t;e=(n>>16&255)/255,r=(n>>8&255)/255,s=(n&255)/255,o=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,s,o=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,s,o=255]=t,e/=255,r/=255,s/=255,o/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){let a=pu.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}let n=De(t);n.isValid()&&({r:e,g:r,b:s,a:o}=n.rgba,e/=255,r/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=s,this._components[3]=o,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((s,o)=>{t[o]=Math.min(Math.max(s,e),r)}),t)}};ko.shared=new ko,ko.temp=new ko,ko.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var _r=ko;function YG(){let i=[],t=[];for(let r=0;r<32;r++)i[r]=r,t[r]=r;i[J.NORMAL_NPM]=J.NORMAL,i[J.ADD_NPM]=J.ADD,i[J.SCREEN_NPM]=J.SCREEN,t[J.NORMAL]=J.NORMAL_NPM,t[J.ADD]=J.ADD_NPM,t[J.SCREEN]=J.SCREEN_NPM;let e=[];return e.push(t),e.push(i),e}var yg=YG();function Oo(i){if(i.BYTES_PER_ELEMENT===4)return i instanceof Float32Array?"Float32Array":i instanceof Uint32Array?"Uint32Array":"Int32Array";if(i.BYTES_PER_ELEMENT===2){if(i instanceof Uint16Array)return"Uint16Array"}else if(i.BYTES_PER_ELEMENT===1&&i instanceof Uint8Array)return"Uint8Array";return null}function ns(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function mu(i){return!(i&i-1)&&!!i}function gu(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function bg(i,t,e){let r=i.length,s;if(t>=r||e===0)return;e=t+e>r?r-t:e;let o=r-e;for(s=t;s<o;++s)i[s]=i[s+e];i.length=o}var qG=0;function ei(){return++qG}var QC=class{constructor(i,t,e,r){this.left=i,this.top=t,this.right=e,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};QC.EMPTY=new QC(0,0,0,0);var xu={},$e=Object.create(null),Ur=Object.create(null);function vg(i,t=globalThis.location){if(i.startsWith("data:"))return"";t=t||globalThis.location;let e=new URL(i,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}function _u(i,t=1){let e=K.RETINA_PREFIX?.exec(i);return e?parseFloat(e[1]):t}var $=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))($||{}),Tg=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},tP=(i,t)=>Tg(i).priority??t,Z={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Tg).forEach(t=>{t.type.forEach(e=>this._removeHandlers[e]?.(t))}),this},add(...i){return i.map(Tg).forEach(t=>{t.type.forEach(e=>{let r=this._addHandlers,s=this._queue;r[e]?r[e]?.(t):(s[e]=s[e]||[],s[e]?.push(t))})}),this},handle(i,t,e){let r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=t,s[i]=e;let o=this._queue;return o[i]&&(o[i]?.forEach(n=>t(n)),delete o[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((s,o)=>tP(o,e)-tP(s,e)))},r=>{let s=t.indexOf(r.ref);s!==-1&&t.splice(s,1)})}};var dh=class{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}};var t2=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
1150
+ `);function e2(i){let t="";for(let e=0;e<i;++e)e>0&&(t+=`
1151
+ else `),e<i-1&&(t+=`if(test == ${e}.0){}`);return t}function yu(i,t){if(i===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let e=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=t2.replace(/%forloop%/gi,e2(i));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))i=i/2|0;else break}return i}var Sg=0,Ag=1,Eg=2,wg=3,Cg=4,Pg=5,kr=class i{constructor(){this.data=0,this.blendMode=J.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<Sg)}set blend(t){!!(this.data&1<<Sg)!==t&&(this.data^=1<<Sg)}get offsets(){return!!(this.data&1<<Ag)}set offsets(t){!!(this.data&1<<Ag)!==t&&(this.data^=1<<Ag)}get culling(){return!!(this.data&1<<Eg)}set culling(t){!!(this.data&1<<Eg)!==t&&(this.data^=1<<Eg)}get depthTest(){return!!(this.data&1<<wg)}set depthTest(t){!!(this.data&1<<wg)!==t&&(this.data^=1<<wg)}get depthMask(){return!!(this.data&1<<Pg)}set depthMask(t){!!(this.data&1<<Pg)!==t&&(this.data^=1<<Pg)}get clockwiseFrontFace(){return!!(this.data&1<<Cg)}set clockwiseFrontFace(t){!!(this.data&1<<Cg)!==t&&(this.data^=1<<Cg)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!==J.NONE,this._blendMode=t}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){let t=new i;return t.depthTest=!1,t.blend=!0,t}};kr.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var fh=[];function No(i,t){if(!i)return null;let e="";if(typeof i=="string"){let r=/\.(\w{3,4})(?:$|\?|#)/i.exec(i);r&&(e=r[1].toLowerCase())}for(let r=fh.length-1;r>=0;--r){let s=fh[r];if(s.test&&s.test(i,e))return new s(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}var Ht=class{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,r,s,o,n,a,h){if(arguments.length>8)throw new Error("max arguments reached");let{name:l,items:c}=this;this._aliasCount++;for(let u=0,d=c.length;u<d;u++)c[u][l](t,e,r,s,o,n,a,h);return c===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){let e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(Ht.prototype,{dispatch:{value:Ht.prototype.emit},run:{value:Ht.prototype.emit}});var Xe=class{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Ht("setRealSize"),this.onUpdate=new Ht("update"),this.onError=new Ht("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,r){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}};var hs=class extends Xe{constructor(t,e){let{width:r,height:s}=e||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=t,this.unpackAlignment=e.unpackAlignment??4}upload(t,e,r){let s=t.gl;s.pixelStorei(s.UNPACK_ALIGNMENT,this.unpackAlignment),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===ze.UNPACK);let o=e.realWidth,n=e.realHeight;return r.width===o&&r.height===n?s.texSubImage2D(e.target,0,0,0,o,n,e.format,r.type,this.data):(r.width=o,r.height=n,s.texImage2D(e.target,0,r.internalFormat,o,n,0,e.format,r.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}};var r2={scaleMode:sr.NEAREST,alphaMode:ze.NPM},Rg=class Do extends as.default{constructor(t=null,e=null){super(),e=Object.assign({},Do.defaultOptions,e);let{alphaMode:r,mipmap:s,anisotropicLevel:o,scaleMode:n,width:a,height:h,wrapMode:l,format:c,type:u,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Xe)&&(t=No(t,p),t.internal=!0),this.resolution=f||K.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=s,this.anisotropicLevel=o,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=d,this.alphaMode=r,this.uid=ei(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let r;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this}setSize(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)}setRealSize(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=mu(this.realWidth)&&mu(this.realHeight)}setResolution(t){let e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Ur[this.cacheId],delete $e[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Do.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,r=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ei()}`}o=t._pixiId}let n=Ur[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in BaseTextureCache.`);return n||(n=new Do(t,e),n.cacheId=o,Do.addToCache(n,o)),n}static fromBuffer(t,e,r,s){t=t||new Float32Array(e*r*4);let o=new hs(t,{width:e,height:r,...s?.resourceOptions}),n,a;return t instanceof Float32Array?(n=L.RGBA,a=st.FLOAT):t instanceof Int32Array?(n=L.RGBA_INTEGER,a=st.INT):t instanceof Uint32Array?(n=L.RGBA_INTEGER,a=st.UNSIGNED_INT):t instanceof Int16Array?(n=L.RGBA_INTEGER,a=st.SHORT):t instanceof Uint16Array?(n=L.RGBA_INTEGER,a=st.UNSIGNED_SHORT):t instanceof Int8Array?(n=L.RGBA,a=st.BYTE):(n=L.RGBA,a=st.UNSIGNED_BYTE),o.internal=!0,new Do(o,Object.assign({},r2,{type:a,format:n},s))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Ur[e]&&Ur[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),Ur[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=Ur[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Ur[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)delete Ur[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}};Rg.defaultOptions={mipmap:gr.POW2,anisotropicLevel:0,scaleMode:sr.LINEAR,wrapMode:Qa.CLAMP,alphaMode:ze.UNPACK,target:Jr.TEXTURE_2D,format:L.RGBA,type:st.UNSIGNED_BYTE},Rg._globalBatch=0;var ut=Rg;var ph=class{constructor(){this.texArray=null,this.blend=0,this.type=Eo.TRIANGLES,this.start=0,this.size=0,this.data=null}};var i2=0,Xt=class i{constructor(t,e=!0,r=!1){this.data=t||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=r,this.static=e,this.id=i2++,this.disposeRunner=new Ht("disposeBuffer")}update(t){t instanceof Array&&(t=new Float32Array(t)),this.data=t||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(t){this.type=t?Oe.ELEMENT_ARRAY_BUFFER:Oe.ARRAY_BUFFER}get index(){return this.type===Oe.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new i(t)}};var Lo=class i{constructor(t,e=0,r=!1,s=st.FLOAT,o,n,a,h=1){this.buffer=t,this.size=e,this.normalized=r,this.type=s,this.stride=o,this.start=n,this.instance=a,this.divisor=h}destroy(){this.buffer=null}static from(t,e,r,s,o){return new i(t,e,r,s,o)}};var s2={Float32Array,Uint32Array,Int32Array,Uint8Array};function eP(i,t){let e=0,r=0,s={};for(let h=0;h<i.length;h++)r+=t[h],e+=i[h].length;let o=new ArrayBuffer(e*4),n=null,a=0;for(let h=0;h<i.length;h++){let l=t[h],c=i[h],u=Oo(c);s[u]||(s[u]=new s2[u](o)),n=s[u];for(let d=0;d<c.length;d++){let f=(d/l|0)*r+a,p=d%l;n[f+p]=c[d]}a+=l}return new Float32Array(o)}var rP={5126:4,5123:2,5121:1},o2=0,n2={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},ri=class i{constructor(t=[],e={}){this.buffers=t,this.indexBuffer=null,this.attributes=e,this.glVertexArrayObjects={},this.id=o2++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Ht("disposeGeometry"),this.refCount=0}addAttribute(t,e,r=0,s=!1,o,n,a,h=!1){if(!e)throw new Error("You must pass a buffer when creating an attribute");e instanceof Xt||(e instanceof Array&&(e=new Float32Array(e)),e=new Xt(e));let l=t.split("|");if(l.length>1){for(let u=0;u<l.length;u++)this.addAttribute(l[u],e,r,s,o);return this}let c=this.buffers.indexOf(e);return c===-1&&(this.buffers.push(e),c=this.buffers.length-1),this.attributes[t]=new Lo(c,r,s,o,n,a,h),this.instanced=this.instanced||h,this}getAttribute(t){return this.attributes[t]}getBuffer(t){return this.buffers[this.getAttribute(t).buffer]}addIndex(t){return t instanceof Xt||(t instanceof Array&&(t=new Uint16Array(t)),t=new Xt(t)),t.type=Oe.ELEMENT_ARRAY_BUFFER,this.indexBuffer=t,this.buffers.includes(t)||this.buffers.push(t),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let t=[],e=[],r=new Xt,s;for(s in this.attributes){let o=this.attributes[s],n=this.buffers[o.buffer];t.push(n.data),e.push(o.size*rP[o.type]/4),o.buffer=0}for(r.data=eP(t,e),s=0;s<this.buffers.length;s++)this.buffers[s]!==this.indexBuffer&&this.buffers[s].destroy();return this.buffers=[r],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let t in this.attributes){let e=this.attributes[t];return this.buffers[e.buffer].data.length/(e.stride/4||e.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new i;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new Xt(this.buffers[e].data.slice(0));for(let e in this.attributes){let r=this.attributes[e];t.attributes[e]=new Lo(r.buffer,r.size,r.normalized,r.type,r.stride,r.start,r.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=Oe.ELEMENT_ARRAY_BUFFER),t}static merge(t){let e=new i,r=[],s=[],o=[],n;for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)s[h]=s[h]||0,s[h]+=n.buffers[h].data.length,o[h]=0}for(let a=0;a<n.buffers.length;a++)r[a]=new n2[Oo(n.buffers[a].data)](s[a]),e.buffers[a]=new Xt(r[a]);for(let a=0;a<t.length;a++){n=t[a];for(let h=0;h<n.buffers.length;h++)r[h].set(n.buffers[h].data,o[h]),o[h]+=n.buffers[h].data.length}if(e.attributes=n.attributes,n.indexBuffer){e.indexBuffer=e.buffers[n.buffers.indexOf(n.indexBuffer)],e.indexBuffer.type=Oe.ELEMENT_ARRAY_BUFFER;let a=0,h=0,l=0,c=0;for(let u=0;u<n.buffers.length;u++)if(n.buffers[u]!==n.indexBuffer){c=u;break}for(let u in n.attributes){let d=n.attributes[u];(d.buffer|0)===c&&(h+=d.size*rP[d.type]/4)}for(let u=0;u<t.length;u++){let d=t[u].indexBuffer.data;for(let f=0;f<d.length;f++)e.indexBuffer.data[f+l]+=a;a+=t[u].buffers[c].data.length/h,l+=d.length}}return e}};var mh=class extends ri{constructor(t=!1){super(),this._buffer=new Xt(null,t,!1),this._indexBuffer=new Xt(null,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,st.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,st.FLOAT).addAttribute("aColor",this._buffer,4,!0,st.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,st.FLOAT).addIndex(this._indexBuffer)}};var Mg=Math.PI*2,a2=180/Math.PI,h2=Math.PI/180,nr=(i=>(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(nr||{});var jt=class i{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new i(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}};jt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var bu=[new jt,new jt,new jt,new jt],pt=class i{constructor(t=0,e=0,r=0,s=0){this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(s),this.type=nr.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new i(0,0,0,0)}clone(){return new i(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}intersects(t,e){if(!e){let M=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=M)return!1;let P=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>P}let r=this.left,s=this.right,o=this.top,n=this.bottom;if(s<=r||n<=o)return!1;let a=bu[0].set(t.left,t.top),h=bu[1].set(t.left,t.bottom),l=bu[2].set(t.right,t.top),c=bu[3].set(t.right,t.bottom);if(l.x<=a.x||h.y<=a.y)return!1;let u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(a,a),e.apply(h,h),e.apply(l,l),e.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=r||Math.min(a.x,h.x,l.x,c.x)>=s||Math.max(a.y,h.y,l.y,c.y)<=o||Math.min(a.y,h.y,l.y,c.y)>=n))return!1;let d=u*(h.y-a.y),f=u*(a.x-h.x),p=d*r+f*o,g=d*s+f*o,x=d*r+f*n,v=d*s+f*n;if(Math.max(p,g,x,v)<=d*a.x+f*a.y||Math.min(p,g,x,v)>=d*c.x+f*c.y)return!1;let _=u*(a.y-l.y),b=u*(l.x-a.x),T=_*r+b*o,E=_*s+b*o,A=_*r+b*n,C=_*s+b*n;return!(Math.max(T,E,A,C)<=_*a.x+b*a.y||Math.min(T,E,A,C)>=_*c.x+b*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){let e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),o=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=s,this.height=Math.max(o-s,0),this}ceil(t=1,e=.001){let r=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=s-this.y,this}enlarge(t){let e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),o=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=s,this.height=o-s,this}};pt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var vu=class i{constructor(t=0,e=0,r=0){this.x=t,this.y=e,this.radius=r,this.type=nr.CIRC}clone(){return new i(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;let r=this.radius*this.radius,s=this.x-t,o=this.y-e;return s*=s,o*=o,s+o<=r}getBounds(){return new pt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};vu.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var Tu=class i{constructor(t=0,e=0,r=0,s=0){this.x=t,this.y=e,this.width=r,this.height=s,this.type=nr.ELIP}clone(){return new i(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let r=(t-this.x)/this.width,s=(e-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new pt(this.x-this.width,this.y-this.height,this.width,this.height)}};Tu.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var Su=class i{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){let r=[];for(let s=0,o=e.length;s<o;s++)r.push(e[s].x,e[s].y);e=r}this.points=e,this.type=nr.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),e=new i(t);return e.closeStroke=this.closeStroke,e}contains(t,e){let r=!1,s=this.points.length/2;for(let o=0,n=s-1;o<s;n=o++){let a=this.points[o*2],h=this.points[o*2+1],l=this.points[n*2],c=this.points[n*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(r=!r)}return r}};Su.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,t)=>`${i}, ${t}`,"")}]`};var Au=class i{constructor(t=0,e=0,r=0,s=0,o=20){this.x=t,this.y=e,this.width=r,this.height=s,this.radius=o,this.type=nr.RREC}clone(){return new i(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){let r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let s=t-(this.x+r),o=e-(this.y+r),n=r*r;if(s*s+o*o<=n||(s=t-(this.x+this.width-r),s*s+o*o<=n)||(o=e-(this.y+this.height-r),s*s+o*o<=n)||(s=t-(this.x+r),s*s+o*o<=n))return!0}return!1}};Au.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var Ct=class i{constructor(t=1,e=0,r=0,s=1,o=0,n=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,r,s,o,n){return this.a=t,this.b=e,this.c=r,this.d=s,this.tx=o,this.ty=n,this}toArray(t,e){this.array||(this.array=new Float32Array(9));let r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new jt;let r=t.x,s=t.y;return e.x=this.a*r+this.c*s+this.tx,e.y=this.b*r+this.d*s+this.ty,e}applyInverse(t,e){e=e||new jt;let r=1/(this.a*this.d+this.c*-this.b),s=t.x,o=t.y;return e.x=this.d*r*s+-this.c*r*o+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*o+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){let e=Math.cos(t),r=Math.sin(t),s=this.a,o=this.c,n=this.tx;return this.a=s*e-this.b*r,this.b=s*r+this.b*e,this.c=o*e-this.d*r,this.d=o*r+this.d*e,this.tx=n*e-this.ty*r,this.ty=n*r+this.ty*e,this}append(t){let e=this.a,r=this.b,s=this.c,o=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*r+t.b*o,this.c=t.c*e+t.d*s,this.d=t.c*r+t.d*o,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*r+t.ty*o+this.ty,this}setTransform(t,e,r,s,o,n,a,h,l){return this.a=Math.cos(a+l)*o,this.b=Math.sin(a+l)*o,this.c=-Math.sin(a-h)*n,this.d=Math.cos(a-h)*n,this.tx=t-(r*this.a+s*this.c),this.ty=e-(r*this.b+s*this.d),this}prepend(t){let e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){let r=this.a,s=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){let e=this.a,r=this.b,s=this.c,o=this.d,n=t.pivot,a=-Math.atan2(-s,o),h=Math.atan2(r,e),l=Math.abs(a+h);return l<1e-5||Math.abs(Mg-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=h),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(s*s+o*o),t.position.x=this.tx+(n.x*e+n.y*s),t.position.y=this.ty+(n.x*r+n.y*o),t}invert(){let t=this.a,e=this.b,r=this.c,s=this.d,o=this.tx,n=t*s-e*r;return this.a=s/n,this.b=-e/n,this.c=-r/n,this.d=t/n,this.tx=(r*this.ty-s*o)/n,this.ty=-(t*this.ty-e*o)/n,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new i;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new i}static get TEMP_MATRIX(){return new i}};Ct.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var ls=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],cs=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],us=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ds=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Bg=[],iP=[],Eu=Math.sign;function l2(){for(let i=0;i<16;i++){let t=[];Bg.push(t);for(let e=0;e<16;e++){let r=Eu(ls[i]*ls[e]+us[i]*cs[e]),s=Eu(cs[i]*ls[e]+ds[i]*cs[e]),o=Eu(ls[i]*us[e]+us[i]*ds[e]),n=Eu(cs[i]*us[e]+ds[i]*ds[e]);for(let a=0;a<16;a++)if(ls[a]===r&&cs[a]===s&&us[a]===o&&ds[a]===n){t.push(a);break}}}for(let i=0;i<16;i++){let t=new Ct;t.set(ls[i],cs[i],us[i],ds[i],0,0),iP.push(t)}}l2();var Rt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>ls[i],uY:i=>cs[i],vX:i=>us[i],vY:i=>ds[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Bg[i][t],sub:(i,t)=>Bg[i][Rt.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?Rt.S:Rt.N:Math.abs(t)*2<=Math.abs(i)?i>0?Rt.E:Rt.W:t>0?i>0?Rt.SE:Rt.SW:i>0?Rt.NE:Rt.NW,matrixAppendRotationInv:(i,t,e=0,r=0)=>{let s=iP[Rt.inv(t)];s.tx=e,s.ty=r,i.append(s)}};var ii=class i{constructor(t,e,r=0,s=0){this._x=r,this._y=s,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new i(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}};ii.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var Ig=class{constructor(){this.worldTransform=new Ct,this.localTransform=new Ct,this.position=new ii(this.onChange,this,0,0),this.scale=new ii(this.onChange,this,1,1),this.pivot=new ii(this.onChange,this,0,0),this.skew=new ii(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){let i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){let t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){let e=i.worldTransform,r=this.worldTransform;r.a=t.a*e.a+t.b*e.c,r.b=t.a*e.b+t.b*e.d,r.c=t.c*e.a+t.d*e.c,r.d=t.c*e.b+t.d*e.d,r.tx=t.tx*e.a+t.ty*e.c+e.tx,r.ty=t.tx*e.b+t.ty*e.d+e.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Ig.IDENTITY=new Ig;var wu=Ig;wu.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var sP=`varying vec2 vTextureCoord;
1152
+
1153
+ uniform sampler2D uSampler;
1154
+
1155
+ void main(void){
1156
+ gl_FragColor *= texture2D(uSampler, vTextureCoord);
1157
+ }`;var oP=`attribute vec2 aVertexPosition;
1158
+ attribute vec2 aTextureCoord;
1159
+
1160
+ uniform mat3 projectionMatrix;
1161
+
1162
+ varying vec2 vTextureCoord;
1163
+
1164
+ void main(void){
1165
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1166
+ vTextureCoord = aTextureCoord;
1167
+ }
1168
+ `;function Cu(i,t,e){let r=i.createShader(t);return i.shaderSource(r,e),i.compileShader(r),r}function Fg(i){let t=new Array(i);for(let e=0;e<t.length;e++)t[e]=!1;return t}function gh(i,t){switch(i){case"float":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"int":case"uint":case"sampler2D":case"sampler2DArray":return 0;case"ivec2":return new Int32Array(2*t);case"ivec3":return new Int32Array(3*t);case"ivec4":return new Int32Array(4*t);case"uvec2":return new Uint32Array(2*t);case"uvec3":return new Uint32Array(3*t);case"uvec4":return new Uint32Array(4*t);case"bool":return!1;case"bvec2":return Fg(2*t);case"bvec3":return Fg(3*t);case"bvec4":return Fg(4*t);case"mat2":return new Float32Array([1,0,0,1]);case"mat3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Or=[{test:i=>i.type==="float"&&i.size===1&&!i.isArray,code:i=>`
1169
+ if(uv["${i}"] !== ud["${i}"].value)
1170
+ {
1171
+ ud["${i}"].value = uv["${i}"]
1172
+ gl.uniform1f(ud["${i}"].location, uv["${i}"])
1173
+ }
1174
+ `},{test:(i,t)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++;
1175
+
1176
+ renderer.texture.bind(uv["${i}"], t);
1177
+
1178
+ if(ud["${i}"].value !== t)
1179
+ {
1180
+ ud["${i}"].value = t;
1181
+ gl.uniform1i(ud["${i}"].location, t);
1182
+ ; // eslint-disable-line max-len
1183
+ }`},{test:(i,t)=>i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0,code:i=>`
1184
+ gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true));
1185
+ `,codeUbo:i=>`
1186
+ var ${i}_matrix = uv.${i}.toArray(true);
1187
+
1188
+ data[offset] = ${i}_matrix[0];
1189
+ data[offset+1] = ${i}_matrix[1];
1190
+ data[offset+2] = ${i}_matrix[2];
1191
+
1192
+ data[offset + 4] = ${i}_matrix[3];
1193
+ data[offset + 5] = ${i}_matrix[4];
1194
+ data[offset + 6] = ${i}_matrix[5];
1195
+
1196
+ data[offset + 8] = ${i}_matrix[6];
1197
+ data[offset + 9] = ${i}_matrix[7];
1198
+ data[offset + 10] = ${i}_matrix[8];
1199
+ `},{test:(i,t)=>i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0,code:i=>`
1200
+ cv = ud["${i}"].value;
1201
+ v = uv["${i}"];
1202
+
1203
+ if(cv[0] !== v.x || cv[1] !== v.y)
1204
+ {
1205
+ cv[0] = v.x;
1206
+ cv[1] = v.y;
1207
+ gl.uniform2f(ud["${i}"].location, v.x, v.y);
1208
+ }`,codeUbo:i=>`
1209
+ v = uv.${i};
1210
+
1211
+ data[offset] = v.x;
1212
+ data[offset+1] = v.y;
1213
+ `},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>`
1214
+ cv = ud["${i}"].value;
1215
+ v = uv["${i}"];
1216
+
1217
+ if(cv[0] !== v[0] || cv[1] !== v[1])
1218
+ {
1219
+ cv[0] = v[0];
1220
+ cv[1] = v[1];
1221
+ gl.uniform2f(ud["${i}"].location, v[0], v[1]);
1222
+ }
1223
+ `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0,code:i=>`
1224
+ cv = ud["${i}"].value;
1225
+ v = uv["${i}"];
1226
+
1227
+ if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
1228
+ {
1229
+ cv[0] = v.x;
1230
+ cv[1] = v.y;
1231
+ cv[2] = v.width;
1232
+ cv[3] = v.height;
1233
+ gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height)
1234
+ }`,codeUbo:i=>`
1235
+ v = uv.${i};
1236
+
1237
+ data[offset] = v.x;
1238
+ data[offset+1] = v.y;
1239
+ data[offset+2] = v.width;
1240
+ data[offset+3] = v.height;
1241
+ `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>`
1242
+ cv = ud["${i}"].value;
1243
+ v = uv["${i}"];
1244
+
1245
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
1246
+ {
1247
+ cv[0] = v.red;
1248
+ cv[1] = v.green;
1249
+ cv[2] = v.blue;
1250
+ cv[3] = v.alpha;
1251
+ gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha)
1252
+ }`,codeUbo:i=>`
1253
+ v = uv.${i};
1254
+
1255
+ data[offset] = v.red;
1256
+ data[offset+1] = v.green;
1257
+ data[offset+2] = v.blue;
1258
+ data[offset+3] = v.alpha;
1259
+ `},{test:(i,t)=>i.type==="vec3"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>`
1260
+ cv = ud["${i}"].value;
1261
+ v = uv["${i}"];
1262
+
1263
+ if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
1264
+ {
1265
+ cv[0] = v.red;
1266
+ cv[1] = v.green;
1267
+ cv[2] = v.blue;
1268
+
1269
+ gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue)
1270
+ }`,codeUbo:i=>`
1271
+ v = uv.${i};
1272
+
1273
+ data[offset] = v.red;
1274
+ data[offset+1] = v.green;
1275
+ data[offset+2] = v.blue;
1276
+ `},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>`
1277
+ cv = ud["${i}"].value;
1278
+ v = uv["${i}"];
1279
+
1280
+ if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
1281
+ {
1282
+ cv[0] = v[0];
1283
+ cv[1] = v[1];
1284
+ cv[2] = v[2];
1285
+ cv[3] = v[3];
1286
+
1287
+ gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3])
1288
+ }`}];var c2={float:`
1289
+ if (cv !== v)
1290
+ {
1291
+ cu.value = v;
1292
+ gl.uniform1f(location, v);
1293
+ }`,vec2:`
1294
+ if (cv[0] !== v[0] || cv[1] !== v[1])
1295
+ {
1296
+ cv[0] = v[0];
1297
+ cv[1] = v[1];
1298
+
1299
+ gl.uniform2f(location, v[0], v[1])
1300
+ }`,vec3:`
1301
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
1302
+ {
1303
+ cv[0] = v[0];
1304
+ cv[1] = v[1];
1305
+ cv[2] = v[2];
1306
+
1307
+ gl.uniform3f(location, v[0], v[1], v[2])
1308
+ }`,vec4:`
1309
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
1310
+ {
1311
+ cv[0] = v[0];
1312
+ cv[1] = v[1];
1313
+ cv[2] = v[2];
1314
+ cv[3] = v[3];
1315
+
1316
+ gl.uniform4f(location, v[0], v[1], v[2], v[3]);
1317
+ }`,int:`
1318
+ if (cv !== v)
1319
+ {
1320
+ cu.value = v;
1321
+
1322
+ gl.uniform1i(location, v);
1323
+ }`,ivec2:`
1324
+ if (cv[0] !== v[0] || cv[1] !== v[1])
1325
+ {
1326
+ cv[0] = v[0];
1327
+ cv[1] = v[1];
1328
+
1329
+ gl.uniform2i(location, v[0], v[1]);
1330
+ }`,ivec3:`
1331
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
1332
+ {
1333
+ cv[0] = v[0];
1334
+ cv[1] = v[1];
1335
+ cv[2] = v[2];
1336
+
1337
+ gl.uniform3i(location, v[0], v[1], v[2]);
1338
+ }`,ivec4:`
1339
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
1340
+ {
1341
+ cv[0] = v[0];
1342
+ cv[1] = v[1];
1343
+ cv[2] = v[2];
1344
+ cv[3] = v[3];
1345
+
1346
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1347
+ }`,uint:`
1348
+ if (cv !== v)
1349
+ {
1350
+ cu.value = v;
1351
+
1352
+ gl.uniform1ui(location, v);
1353
+ }`,uvec2:`
1354
+ if (cv[0] !== v[0] || cv[1] !== v[1])
1355
+ {
1356
+ cv[0] = v[0];
1357
+ cv[1] = v[1];
1358
+
1359
+ gl.uniform2ui(location, v[0], v[1]);
1360
+ }`,uvec3:`
1361
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
1362
+ {
1363
+ cv[0] = v[0];
1364
+ cv[1] = v[1];
1365
+ cv[2] = v[2];
1366
+
1367
+ gl.uniform3ui(location, v[0], v[1], v[2]);
1368
+ }`,uvec4:`
1369
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
1370
+ {
1371
+ cv[0] = v[0];
1372
+ cv[1] = v[1];
1373
+ cv[2] = v[2];
1374
+ cv[3] = v[3];
1375
+
1376
+ gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
1377
+ }`,bool:`
1378
+ if (cv !== v)
1379
+ {
1380
+ cu.value = v;
1381
+ gl.uniform1i(location, v);
1382
+ }`,bvec2:`
1383
+ if (cv[0] != v[0] || cv[1] != v[1])
1384
+ {
1385
+ cv[0] = v[0];
1386
+ cv[1] = v[1];
1387
+
1388
+ gl.uniform2i(location, v[0], v[1]);
1389
+ }`,bvec3:`
1390
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
1391
+ {
1392
+ cv[0] = v[0];
1393
+ cv[1] = v[1];
1394
+ cv[2] = v[2];
1395
+
1396
+ gl.uniform3i(location, v[0], v[1], v[2]);
1397
+ }`,bvec4:`
1398
+ if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
1399
+ {
1400
+ cv[0] = v[0];
1401
+ cv[1] = v[1];
1402
+ cv[2] = v[2];
1403
+ cv[3] = v[3];
1404
+
1405
+ gl.uniform4i(location, v[0], v[1], v[2], v[3]);
1406
+ }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:`
1407
+ if (cv !== v)
1408
+ {
1409
+ cu.value = v;
1410
+
1411
+ gl.uniform1i(location, v);
1412
+ }`,samplerCube:`
1413
+ if (cv !== v)
1414
+ {
1415
+ cu.value = v;
1416
+
1417
+ gl.uniform1i(location, v);
1418
+ }`,sampler2DArray:`
1419
+ if (cv !== v)
1420
+ {
1421
+ cu.value = v;
1422
+
1423
+ gl.uniform1i(location, v);
1424
+ }`},u2={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Gg(i,t){let e=[`
1425
+ var v = null;
1426
+ var cv = null;
1427
+ var cu = null;
1428
+ var t = 0;
1429
+ var gl = renderer.gl;
1430
+ `];for(let r in i.uniforms){let s=t[r];if(!s){i.uniforms[r]?.group===!0&&(i.uniforms[r].ubo?e.push(`
1431
+ renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
1432
+ `):e.push(`
1433
+ renderer.shader.syncUniformGroup(uv.${r}, syncData);
1434
+ `));continue}let o=i.uniforms[r],n=!1;for(let a=0;a<Or.length;a++)if(Or[a].test(s,o)){e.push(Or[a].code(r,o)),n=!0;break}if(!n){let a=(s.size===1&&!s.isArray?c2:u2)[s.type].replace("location",`ud["${r}"].location`);e.push(`
1435
+ cu = ud["${r}"];
1436
+ cv = cu.value;
1437
+ v = uv["${r}"];
1438
+ ${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
1439
+ `))}var nP={},Pu=nP;function Ru(){if(Pu===nP||Pu?.isContextLost()){let i=K.ADAPTER.createCanvas(),t;K.PREFER_ENV>=We.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Pu=t}return Pu}var Mu;function Ug(){if(!Mu){Mu=Pe.MEDIUM;let i=Ru();if(i&&i.getShaderPrecisionFormat){let t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(Mu=t.precision?Pe.HIGH:Pe.MEDIUM)}}return Mu}function aP(i,t){let e=i.getShaderSource(t).split(`
1440
+ `).map((l,c)=>`${c}: ${l}`),r=i.getShaderInfoLog(t),s=r.split(`
1441
+ `),o={},n=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!o[l]?(o[l]=!0,!0):!1),a=[""];n.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});let h=e.join(`
1442
+ `);a[0]=h,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function kg(i,t,e,r){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||aP(i,e),i.getShaderParameter(r,i.COMPILE_STATUS)||aP(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}var d2={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function xh(i){return d2[i]}var Bu=null,hP={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function _h(i,t){if(!Bu){let e=Object.keys(hP);Bu={};for(let r=0;r<e.length;++r){let s=e[r];Bu[i[s]]=hP[s]}}return Bu[t]}function Iu(i,t,e){if(i.substring(0,9)!=="precision"){let r=t;return t===Pe.HIGH&&e!==Pe.HIGH&&(r=Pe.MEDIUM),`precision ${r} float;
1443
+ ${i}`}else if(e!==Pe.HIGH&&i.substring(0,15)==="precision highp")return i.replace("precision highp","precision mediump");return i}var yh;function Fu(){if(typeof yh=="boolean")return yh;try{yh=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch{yh=!1}return yh}var f2=0,Gu={},Og=class Ho{constructor(t,e,r="pixi-shader",s={}){this.extra={},this.id=f2++,this.vertexSrc=t||Ho.defaultVertexSrc,this.fragmentSrc=e||Ho.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=s,this.vertexSrc.substring(0,8)!=="#version"&&(r=r.replace(/\s+/g,"-"),Gu[r]?(Gu[r]++,r+=`-${Gu[r]}`):Gu[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}
1444
+ ${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}
1445
+ ${this.fragmentSrc}`,this.vertexSrc=Iu(this.vertexSrc,Ho.defaultVertexPrecision,Pe.HIGH),this.fragmentSrc=Iu(this.fragmentSrc,Ho.defaultFragmentPrecision,Ug())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return oP}static get defaultFragmentSrc(){return sP}static from(t,e,r){let s=t+e,o=xu[s];return o||(xu[s]=o=new Ho(t,e,r)),o}};Og.defaultVertexPrecision=Pe.HIGH,Og.defaultFragmentPrecision=xr.apple.device?Pe.HIGH:Pe.MEDIUM;var ar=Og;var p2=0,je=class i{constructor(t,e,r){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=p2++,this.static=!!e,this.ubo=!!r,t instanceof Xt?(this.buffer=t,this.buffer.type=Oe.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=t,this.ubo&&(this.buffer=new Xt(new Float32Array(1)),this.buffer.type=Oe.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,e,r){if(!this.ubo)this.uniforms[t]=new i(e,r);else throw new Error("[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them")}static from(t,e,r){return new i(t,e,r)}static uboFrom(t,e){return new i(t,e??!0,!0)}};var fs=class i{constructor(t,e){this.uniformBindCount=0,this.program=t,e?e instanceof je?this.uniformGroup=e:this.uniformGroup=new je(e):this.uniformGroup=new je({}),this.disposeRunner=new Ht("disposeShader")}checkUniformExists(t,e){if(e.uniforms[t])return!0;for(let r in e.uniforms){let s=e.uniforms[r];if(s.group===!0&&this.checkUniformExists(t,s))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,e,r){let s=ar.from(t,e);return new i(s,r)}};var bh=class{constructor(t,e){if(this.vertexSrc=t,this.fragTemplate=e,this.programCache={},this.defaultGroupCache={},!e.includes("%count%"))throw new Error('Fragment template must contain "%count%".');if(!e.includes("%forloop%"))throw new Error('Fragment template must contain "%forloop%".')}generateShader(t){if(!this.programCache[t]){let r=new Int32Array(t);for(let o=0;o<t;o++)r[o]=o;this.defaultGroupCache[t]=je.from({uSamplers:r},!0);let s=this.fragTemplate;s=s.replace(/%count%/gi,`${t}`),s=s.replace(/%forloop%/gi,this.generateSampleSrc(t)),this.programCache[t]=new ar(this.vertexSrc,s)}let e={tint:new Float32Array([1,1,1,1]),translationMatrix:new Ct,default:this.defaultGroupCache[t]};return new fs(this.programCache[t],e)}generateSampleSrc(t){let e="";e+=`
1446
+ `,e+=`
1447
+ `;for(let r=0;r<t;r++)r>0&&(e+=`
1448
+ else `),r<t-1&&(e+=`if(vTextureId < ${r}.5)`),e+=`
1449
+ {`,e+=`
1450
+ color = texture2D(uSamplers[${r}], vTextureCoord);`,e+=`
1451
+ }`;return e+=`
1452
+ `,e+=`
1453
+ `,e}};var vh=class{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let t=0;t<this.count;t++)this.elements[t]=null;this.count=0}};function lP(){return!xr.apple.device}function cP(i){let t=!0,e=K.ADAPTER.getNavigator();if(xr.tablet||xr.phone){if(xr.apple.device){let r=e.userAgent.match(/OS (\d+)_(\d+)?/);r&&parseInt(r[1],10)<11&&(t=!1)}if(xr.android.device){let r=e.userAgent.match(/Android\s([0-9.]*)/);r&&parseInt(r[1],10)<7&&(t=!1)}}return t?i:4}var ps=class{constructor(t){this.renderer=t}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(t){}};var uP=`varying vec2 vTextureCoord;
1454
+ varying vec4 vColor;
1455
+ varying float vTextureId;
1456
+ uniform sampler2D uSamplers[%count%];
1457
+
1458
+ void main(void){
1459
+ vec4 color;
1460
+ %forloop%
1461
+ gl_FragColor = color * vColor;
1462
+ }
1463
+ `;var dP=`precision highp float;
1464
+ attribute vec2 aVertexPosition;
1465
+ attribute vec2 aTextureCoord;
1466
+ attribute vec4 aColor;
1467
+ attribute float aTextureId;
1468
+
1469
+ uniform mat3 projectionMatrix;
1470
+ uniform mat3 translationMatrix;
1471
+ uniform vec4 tint;
1472
+
1473
+ varying vec2 vTextureCoord;
1474
+ varying vec4 vColor;
1475
+ varying float vTextureId;
1476
+
1477
+ void main(void){
1478
+ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1479
+
1480
+ vTextureCoord = aTextureCoord;
1481
+ vTextureId = aTextureId;
1482
+ vColor = aColor * tint;
1483
+ }
1484
+ `;var Th=class yr extends ps{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=mh,this.vertexSize=6,this.state=kr.for2d(),this.size=yr.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on("prerender",this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??cP(32),this._defaultMaxTextures}static set defaultMaxTextures(t){this._defaultMaxTextures=t}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??lP(),this._canUploadSameBuffer}static set canUploadSameBuffer(t){this._canUploadSameBuffer=t}get MAX_TEXTURES(){return ht("7.1.0","BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures"),this.maxTextures}static get defaultVertexSrc(){return dP}static get defaultFragmentTemplate(){return uP}setShaderGenerator({vertex:t=yr.defaultVertexSrc,fragment:e=yr.defaultFragmentTemplate}={}){this.shaderGenerator=new bh(t,e)}contextChange(){let t=this.renderer.gl;K.PREFER_ENV===We.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),yr.defaultMaxTextures),this.maxTextures=yu(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:e}=yr,r=this.size/4,s=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new ph);for(;e.length<s;)e.push(new vh);for(let o=0;o<this.maxTextures;o++)this._tempBoundTextures[o]=null}onPrerender(){this._flushId=0}render(t){t._texture.valid&&(this._vertexCount+t.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:e}=this,r=yr._textureArrayPool,s=this.renderer.batch,o=this._tempBoundTextures,n=this.renderer.textureGC.count,a=++ut._globalBatch,h=0,l=r[0],c=0;s.copyBoundTextures(o,e);for(let u=0;u<this._bufferSize;++u){let d=t[u];t[u]=null,d._batchEnabled!==a&&(l.count>=e&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,u),c=u,l=r[++h],++a),d._batchEnabled=a,d.touched=n,l.elements[l.count++]=d)}l.count>0&&(s.boundArray(l,o,a,e),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u<o.length;u++)o[u]=null;ut._globalBatch=a}buildDrawCalls(t,e,r){let{_bufferedElements:s,_attributeBuffer:o,_indexBuffer:n,vertexSize:a}=this,h=yr._drawCallPool,l=this._dcIndex,c=this._aIndex,u=this._iIndex,d=h[l];d.start=this._iIndex,d.texArray=t;for(let f=e;f<r;++f){let p=s[f],g=p._texture.baseTexture,x=yg[g.alphaMode?1:0][p.blendMode];s[f]=null,e<f&&d.blend!==x&&(d.size=u-d.start,e=f,d=h[++l],d.texArray=t,d.start=u),this.packInterleavedGeometry(p,o,n,c,u),c+=p.vertexData.length/2*a,u+=p.indices.length,d.blend=x}e<r&&(d.size=u-d.start,++l),this._dcIndex=l,this._aIndex=c,this._iIndex=u}bindAndClearTexArray(t){let e=this.renderer.texture;for(let r=0;r<t.count;r++)e.bind(t.elements[r],t.ids[r]),t.elements[r]=null;t.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:e,_indexBuffer:r}=this;yr.canUploadSameBuffer?(t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(e.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:e,state:r}=this.renderer,s=yr._drawCallPool,o=null;for(let n=0;n<t;n++){let{texArray:a,type:h,size:l,start:c,blend:u}=s[n];o!==a&&(o=a,this.bindAndClearTexArray(a)),this.state.blendMode=u,r.set(this.state),e.drawElements(h,l,e.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),yr.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let t=0;t<this._packedGeometryPoolSize;t++)this._packedGeometries[t]&&this._packedGeometries[t].destroy();this.renderer.off("prerender",this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&(this._shader.destroy(),this._shader=null),super.destroy()}getAttributeBuffer(t){let e=ns(Math.ceil(t/8)),r=gu(e),s=e*8;this._aBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._aBuffers[s];return o||(this._aBuffers[s]=o=new dh(s*this.vertexSize*4)),o}getIndexBuffer(t){let e=ns(Math.ceil(t/12)),r=gu(e),s=e*12;this._iBuffers.length<=r&&(this._iBuffers.length=r+1);let o=this._iBuffers[r];return o||(this._iBuffers[r]=o=new Uint16Array(s)),o}packInterleavedGeometry(t,e,r,s,o){let{uint32View:n,float32View:a}=e,h=s/this.vertexSize,l=t.uvs,c=t.indices,u=t.vertexData,d=t._texture.baseTexture._batchLocation,f=Math.min(t.worldAlpha,1),p=_r.shared.setValue(t._tintRGB).toPremultiplied(f,t._texture.baseTexture.alphaMode>0);for(let g=0;g<u.length;g+=2)a[s++]=u[g],a[s++]=u[g+1],a[s++]=l[g],a[s++]=l[g+1],n[s++]=p,a[s++]=d;for(let g=0;g<c.length;g++)r[o++]=h+c[g]}};Th.defaultBatchSize=4096,Th.extension={name:"batch",type:$.RendererPlugin},Th._drawCallPool=[],Th._textureArrayPool=[];var si=Th;Z.add(si);var fP=`varying vec2 vTextureCoord;
1485
+
1486
+ uniform sampler2D uSampler;
1487
+
1488
+ void main(void){
1489
+ gl_FragColor = texture2D(uSampler, vTextureCoord);
1490
+ }
1491
+ `;var pP=`attribute vec2 aVertexPosition;
1492
+
1493
+ uniform mat3 projectionMatrix;
1494
+
1495
+ varying vec2 vTextureCoord;
1496
+
1497
+ uniform vec4 inputSize;
1498
+ uniform vec4 outputFrame;
1499
+
1500
+ vec4 filterVertexPosition( void )
1501
+ {
1502
+ vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
1503
+
1504
+ return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
1505
+ }
1506
+
1507
+ vec2 filterTextureCoord( void )
1508
+ {
1509
+ return aVertexPosition * (outputFrame.zw * inputSize.zw);
1510
+ }
1511
+
1512
+ void main(void)
1513
+ {
1514
+ gl_Position = filterVertexPosition();
1515
+ vTextureCoord = filterTextureCoord();
1516
+ }
1517
+ `;var Ng=class Sh extends fs{constructor(t,e,r){let s=ar.from(t||Sh.defaultVertexSrc,e||Sh.defaultFragmentSrc);super(s,r),this.padding=0,this.resolution=Sh.defaultResolution,this.multisample=Sh.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new kr}apply(t,e,r,s,o){t.applyFilter(this,e,r,s)}get blendMode(){return this.state.blendMode}set blendMode(t){this.state.blendMode=t}get resolution(){return this._resolution}set resolution(t){this._resolution=t}static get defaultVertexSrc(){return pP}static get defaultFragmentSrc(){return fP}};Ng.defaultResolution=1,Ng.defaultMultisample=St.NONE;var Nr=Ng;var oi=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new _r(0),this.alpha=1}init(t){this.clearBeforeRender=t.clearBeforeRender;let{backgroundColor:e,background:r,backgroundAlpha:s}=t,o=r??e;o!==void 0&&(this.color=o),this.alpha=s}get color(){return this._backgroundColor.value}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get backgroundColor(){return this._backgroundColor}destroy(){}};oi.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},oi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"background"};Z.add(oi);var Vo=class{constructor(t){this.renderer=t,this.emptyRenderer=new ps(t),this.currentRenderer=this.emptyRenderer}setObjectRenderer(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(t,e){let{boundTextures:r}=this.renderer.texture;for(let s=e-1;s>=0;--s)t[s]=r[s]||null,t[s]&&(t[s]._batchLocation=s)}boundArray(t,e,r,s){let{elements:o,ids:n,count:a}=t,h=0;for(let l=0;l<a;l++){let c=o[l],u=c._batchLocation;if(u>=0&&u<s&&e[u]===c){n[l]=u;continue}for(;h<s;){let d=e[h];if(d&&d._batchEnabled===r&&d._batchLocation===h){h++;continue}n[l]=h,c._batchLocation=h,e[h]=c;break}}}destroy(){this.renderer=null}};Vo.extension={type:$.RendererSystem,name:"batch"};Z.add(Vo);var mP=0,ni=class{constructor(t){this.renderer=t,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this.renderer.gl=t,this.renderer.CONTEXT_UID=mP++}init(t){if(t.context)this.initFromContext(t.context);else{let e=this.renderer.background.alpha<1,r=t.premultipliedAlpha;this.preserveDrawingBuffer=t.preserveDrawingBuffer,this.useContextAlpha=t.useContextAlpha,this.powerPreference=t.powerPreference,this.initFromOptions({alpha:e,premultipliedAlpha:r,antialias:t.antialias,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:t.powerPreference})}}initFromContext(t){this.gl=t,this.validateContext(t),this.renderer.gl=t,this.renderer.CONTEXT_UID=mP++,this.renderer.runners.contextChange.emit(t);let e=this.renderer.view;e.addEventListener!==void 0&&(e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1))}initFromOptions(t){let e=this.createContext(this.renderer.view,t);this.initFromContext(e)}createContext(t,e){let r;if(K.PREFER_ENV>=We.WEBGL2&&(r=t.getContext("webgl2",e)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,this.getExtensions(),this.gl}getExtensions(){let{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){let e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");let s=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}};ni.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ni.extension={type:$.RendererSystem,name:"context"};Z.add(ni);var Pi=class{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Ht("disposeFramebuffer"),this.multisample=St.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new ut(null,{scaleMode:sr.NEAREST,resolution:1,mipmap:gr.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new ut(null,{scaleMode:sr.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:gr.OFF,format:L.DEPTH_COMPONENT,type:st.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let r=0;r<this.colorTextures.length;r++){let s=this.colorTextures[r],o=s.resolution;s.setSize(t/o,e/o)}if(this.depthTexture){let r=this.depthTexture.resolution;this.depthTexture.setSize(t/r,e/r)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}};var ms=class extends ut{constructor(t={}){if(typeof t=="number"){let e=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];t={width:e,height:r,scaleMode:s,resolution:o}}t.width=t.width??100,t.height=t.height??100,t.multisample??(t.multisample=St.NONE),super(null,t),this.mipmap=gr.OFF,this.valid=!0,this._clear=new _r([0,0,0,0]),this.framebuffer=new Pi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=t.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(t){this._clear.setValue(t)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e){this.framebuffer.resize(t*this.resolution,e*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}};var Qt=class extends Xe{constructor(t){let e=t,r=e.naturalWidth||e.videoWidth||e.displayWidth||e.width,s=e.naturalHeight||e.videoHeight||e.displayHeight||e.height;super(r,s),this.source=t,this.noSubImage=!1}static crossOrigin(t,e,r){r===void 0&&!e.startsWith("data:")?t.crossOrigin=vg(e):r!==!1&&(t.crossOrigin=typeof r=="string"?r:"anonymous")}upload(t,e,r,s){let o=t.gl,n=e.realWidth,a=e.realHeight;if(s=s||this.source,typeof HTMLImageElement<"u"&&s instanceof HTMLImageElement){if(!s.complete||s.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<"u"&&s instanceof HTMLVideoElement&&s.readyState<=1)return!1;return o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===ze.UNPACK),!this.noSubImage&&e.target===o.TEXTURE_2D&&r.width===n&&r.height===a?o.texSubImage2D(o.TEXTURE_2D,0,0,0,e.format,r.type,s):(r.width=n,r.height=a,o.texImage2D(e.target,0,r.internalFormat,e.format,r.type,s)),!0}update(){if(this.destroyed)return;let t=this.source,e=t.naturalWidth||t.videoWidth||t.width,r=t.naturalHeight||t.videoHeight||t.height;this.resize(e,r),super.update()}dispose(){this.source=null}};var gs=class extends Qt{constructor(t,e){if(e=e||{},typeof t=="string"){let r=new Image;Qt.crossOrigin(r,t,e.crossorigin),r.src=t,t=r}super(t),!t.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=t.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(e.createBitmap??K.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.bitmap=null,this._load=null,e.autoLoad!==!1&&this.load()}load(t){return this._load?this._load:(t!==void 0&&(this.createBitmap=t),this._load=new Promise((e,r)=>{let s=this.source;this.url=s.src;let o=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};s.complete&&s.src?o():(s.onload=o,s.onerror=n=>{r(n),this.onError.emit(n)})}),this._load)}process(){let t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let e=globalThis.createImageBitmap,r=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>e(s,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ze.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,r){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,r,this.bitmap),!this.preserveBitmap){let s=!0,o=e._glTextures;for(let n in o){let a=o[n];if(a!==r&&a.dirtyId!==e.dirtyId){s=!1;break}}s&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement<"u"&&(typeof t=="string"||t instanceof HTMLImageElement)}};var xs=class{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,r){let s=e.width,o=e.height;if(r){let n=t.width/2/s,a=t.height/2/o,h=t.x/s+n,l=t.y/o+a;r=Rt.add(r,Rt.NW),this.x0=h+n*Rt.uX(r),this.y0=l+a*Rt.uY(r),r=Rt.add(r,2),this.x1=h+n*Rt.uX(r),this.y1=l+a*Rt.uY(r),r=Rt.add(r,2),this.x2=h+n*Rt.uX(r),this.y2=l+a*Rt.uY(r),r=Rt.add(r,2),this.x3=h+n*Rt.uX(r),this.y3=l+a*Rt.uY(r)}else this.x0=t.x/s,this.y0=t.y/o,this.x1=(t.x+t.width)/s,this.y1=t.y/o,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/o,this.x3=t.x/s,this.y3=(t.y+t.height)/o;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}};xs.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var gP=new xs;function Uu(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}var Ah=class i extends as.default{constructor(t,e,r,s,o,n,a){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new pt(0,0,1,1)),t instanceof i&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=s,this.valid=!1,this.destroyed=!1,this._uvs=gP,this.uvMatrix=null,this.orig=r||e,this._rotate=Number(o||0),o===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=n?new jt(n.x,n.y):new jt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){let{resource:e}=this.baseTexture;e?.url&&$e[e.url]&&i.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,i.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){let t=this._frame.clone(),e=this._frame===this.orig?t:this.orig.clone(),r=new i(this.baseTexture,!this.noFrame&&t,e,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===gP&&(this._uvs=new xs),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},r=K.STRICT_TEXTURE_CACHE){let s=typeof t=="string",o=null;if(s)o=t;else if(t instanceof ut){if(!t.cacheId){let a=e?.pixiIdPrefix||"pixiid";t.cacheId=`${a}-${ei()}`,ut.addToCache(t,t.cacheId)}o=t.cacheId}else{if(!t._pixiId){let a=e?.pixiIdPrefix||"pixiid";t._pixiId=`${a}_${ei()}`}o=t._pixiId}let n=$e[o];if(s&&r&&!n)throw new Error(`The cacheId "${o}" does not exist in TextureCache.`);return!n&&!(t instanceof ut)?(e.resolution||(e.resolution=_u(t)),n=new i(new ut(t,e)),n.baseTexture.cacheId=o,ut.addToCache(n.baseTexture,o),i.addToCache(n,o)):!n&&t instanceof ut&&(n=new i(t),i.addToCache(n,o)),n}static fromURL(t,e){let r=Object.assign({autoLoad:!1},e?.resourceOptions),s=i.from(t,Object.assign({resourceOptions:r},e),!1),o=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):o.load().then(()=>Promise.resolve(s))}static fromBuffer(t,e,r,s){return new i(ut.fromBuffer(t,e,r,s))}static fromLoader(t,e,r,s){let o=new ut(t,Object.assign({scaleMode:ut.defaultOptions.scaleMode,resolution:_u(e)},s)),{resource:n}=o;n instanceof gs&&(n.url=e);let a=new i(o);return r||(r=e),ut.addToCache(a.baseTexture,r),i.addToCache(a,r),r!==e&&(ut.addToCache(a.baseTexture,e),i.addToCache(a,e)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),$e[e]&&$e[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),$e[e]=t)}static removeFromCache(t){if(typeof t=="string"){let e=$e[t];if(e){let r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete $e[t],e}}else if(t?.textureCacheIds){for(let e=0;e<t.textureCacheIds.length;++e)$e[t.textureCacheIds[e]]===t&&delete $e[t.textureCacheIds[e]];return t.textureCacheIds.length=0,t}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(t){this._frame=t,this.noFrame=!1;let{x:e,y:r,width:s,height:o}=t,n=e+s>this.baseTexture.width,a=r+o>this.baseTexture.height;if(n||a){let h=n&&a?"and":"or",l=`X: ${e} + ${s} = ${e+s} > ${this.baseTexture.width}`,c=`Y: ${r} + ${o} = ${r+o} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=s&&o&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return i._EMPTY||(i._EMPTY=new i(new ut),Uu(i._EMPTY),Uu(i._EMPTY.baseTexture)),i._EMPTY}static get WHITE(){if(!i._WHITE){let t=K.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),i._WHITE=new i(ut.from(t)),Uu(i._WHITE),Uu(i._WHITE.baseTexture)}return i._WHITE}};var _s=class i extends Ah{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,r=!0){let s=this.baseTexture.resolution,o=Math.round(t*s)/s,n=Math.round(e*s)/s;this.valid=o>0&&n>0,this._frame.width=this.orig.width=o,this._frame.height=this.orig.height=n,r&&this.baseTexture.resize(o,n),this.updateUvs()}setResolution(t){let{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new i(new ms(t))}};var Wo=class{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,r=St.NONE){let s=new ms(Object.assign({width:t,height:e,resolution:1,multisample:r},this.textureOptions));return new _s(s)}getOptimalTexture(t,e,r=1,s=St.NONE){let o;t=Math.max(Math.ceil(t*r-1e-6),1),e=Math.max(Math.ceil(e*r-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=ns(t),e=ns(e),o=((t&65535)<<16|e&65535)>>>0,s>1&&(o+=s*4294967296)):o=s>1?-s:-1,this.texturePool[o]||(this.texturePool[o]=[]);let n=this.texturePool[o].pop();return n||(n=this.createTexture(t,e,s)),n.filterPoolKey=o,n.setResolution(r),n}getFilterTexture(t,e,r){let s=this.getOptimalTexture(t.width,t.height,e||t.resolution,r||St.NONE);return s.filterFrame=t.filterFrame,s}returnTexture(t){let e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(let e in this.texturePool){let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0)}this.texturePool={}}setScreenSize(t){if(!(t.width===this._pixelsWidth&&t.height===this._pixelsHeight)){this.enableFullScreen=t.width>0&&t.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let r=this.texturePool[e];if(r)for(let s=0;s<r.length;s++)r[s].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=t.width,this._pixelsHeight=t.height}}};Wo.SCREEN_KEY=-1;var Eh=class extends ri{constructor(){super(),this.addAttribute("aVertexPosition",new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}};var wh=class extends ri{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new Xt(this.vertices),this.uvBuffer=new Xt(this.uvs),this.addAttribute("aVertexPosition",this.vertexBuffer).addAttribute("aTextureCoord",this.uvBuffer).addIndex([0,1,2,0,2,3])}map(t,e){let r=0,s=0;return this.uvs[0]=r,this.uvs[1]=s,this.uvs[2]=r+e.width/t.width,this.uvs[3]=s,this.uvs[4]=r+e.width/t.width,this.uvs[5]=s+e.height/t.height,this.uvs[6]=r,this.uvs[7]=s+e.height/t.height,r=e.x,s=e.y,this.vertices[0]=r,this.vertices[1]=s,this.vertices[2]=r+e.width,this.vertices[3]=s,this.vertices[4]=r+e.width,this.vertices[5]=s+e.height,this.vertices[6]=r,this.vertices[7]=s+e.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}};var Ch=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=St.NONE,this.sourceFrame=new pt,this.destinationFrame=new pt,this.bindingSourceFrame=new pt,this.bindingDestinationFrame=new pt,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}};var ku=[new jt,new jt,new jt,new jt],Dg=new Ct,zo=class{constructor(t){this.renderer=t,this.defaultFilterStack=[{}],this.texturePool=new Wo,this.statePool=[],this.quad=new Eh,this.quadUv=new wh,this.tempRect=new pt,this.activeState={},this.globalUniforms=new je({outputFrame:new pt,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(t,e){let r=this.renderer,s=this.defaultFilterStack,o=this.statePool.pop()||new Ch,n=r.renderTexture,a,h;if(n.current){let x=n.current;a=x.resolution,h=x.multisample}else a=r.resolution,h=r.multisample;let l=e[0].resolution||a,c=e[0].multisample??h,u=e[0].padding,d=e[0].autoFit,f=e[0].legacy??!0;for(let x=1;x<e.length;x++){let v=e[x];l=Math.min(l,v.resolution||a),c=Math.min(c,v.multisample??h),u=this.useMaxPadding?Math.max(u,v.padding):u+v.padding,d=d&&v.autoFit,f=f||(v.legacy??!0)}s.length===1&&(this.defaultFilterStack[0].renderTexture=n.current),s.push(o),o.resolution=l,o.multisample=c,o.legacy=f,o.target=t,o.sourceFrame.copyFrom(t.filterArea||t.getBounds(!0)),o.sourceFrame.pad(u);let p=this.tempRect.copyFrom(n.sourceFrame);r.projection.transform&&this.transformAABB(Dg.copyFrom(r.projection.transform).invert(),p),d?(o.sourceFrame.fit(p),(o.sourceFrame.width<=0||o.sourceFrame.height<=0)&&(o.sourceFrame.width=0,o.sourceFrame.height=0)):o.sourceFrame.intersects(p)||(o.sourceFrame.width=0,o.sourceFrame.height=0),this.roundFrame(o.sourceFrame,n.current?n.current.resolution:r.resolution,n.sourceFrame,n.destinationFrame,r.projection.transform),o.renderTexture=this.getOptimalFilterTexture(o.sourceFrame.width,o.sourceFrame.height,l,c),o.filters=e,o.destinationFrame.width=o.renderTexture.width,o.destinationFrame.height=o.renderTexture.height;let g=this.tempRect;g.x=0,g.y=0,g.width=o.sourceFrame.width,g.height=o.sourceFrame.height,o.renderTexture.filterFrame=o.sourceFrame,o.bindingSourceFrame.copyFrom(n.sourceFrame),o.bindingDestinationFrame.copyFrom(n.destinationFrame),o.transform=r.projection.transform,r.projection.transform=null,n.bind(o.renderTexture,o.sourceFrame,g),r.framebuffer.clear(0,0,0,0)}pop(){let t=this.defaultFilterStack,e=t.pop(),r=e.filters;this.activeState=e;let s=this.globalUniforms.uniforms;s.outputFrame=e.sourceFrame,s.resolution=e.resolution;let o=s.inputSize,n=s.inputPixel,a=s.inputClamp;if(o[0]=e.destinationFrame.width,o[1]=e.destinationFrame.height,o[2]=1/o[0],o[3]=1/o[1],n[0]=Math.round(o[0]*e.resolution),n[1]=Math.round(o[1]*e.resolution),n[2]=1/n[0],n[3]=1/n[1],a[0]=.5*n[2],a[1]=.5*n[3],a[2]=e.sourceFrame.width*o[2]-.5*n[2],a[3]=e.sourceFrame.height*o[3]-.5*n[3],e.legacy){let l=s.filterArea;l[0]=e.destinationFrame.width,l[1]=e.destinationFrame.height,l[2]=e.sourceFrame.x,l[3]=e.sourceFrame.y,s.filterClamp=s.inputClamp}this.globalUniforms.update();let h=t[t.length-1];if(this.renderer.framebuffer.blit(),r.length===1)r[0].apply(this,e.renderTexture,h.renderTexture,Ei.BLEND,e),this.returnFilterTexture(e.renderTexture);else{let l=e.renderTexture,c=this.getOptimalFilterTexture(l.width,l.height,e.resolution);c.filterFrame=l.filterFrame;let u=0;for(u=0;u<r.length-1;++u){u===1&&e.multisample>1&&(c=this.getOptimalFilterTexture(l.width,l.height,e.resolution),c.filterFrame=l.filterFrame),r[u].apply(this,l,c,Ei.CLEAR,e);let d=l;l=c,c=d}r[u].apply(this,l,h.renderTexture,Ei.BLEND,e),u>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Ei.CLEAR){let{renderTexture:r,state:s}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t?.filterFrame){let n=this.tempRect;n.x=0,n.y=0,n.width=t.filterFrame.width,n.height=t.filterFrame.height,r.bind(t,t.filterFrame,n)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);let o=s.stateId&1||this.forceClear;(e===Ei.CLEAR||e===Ei.BLIT&&o)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,r,s){let o=this.renderer;o.state.set(t.state),this.bindAndClear(r,s),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Eo.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Eo.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){let{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:o}=e._texture,n=t.set(s.width,0,0,s.height,r.x,r.y),a=e.worldTransform.copyTo(Ct.TEMP_MATRIX);return a.invert(),n.prepend(a),n.scale(1/o.width,1/o.height),n.translate(e.anchor.x,e.anchor.y),n}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,r=1,s=St.NONE){return this.texturePool.getOptimalTexture(t,e,r,s)}getFilterTexture(t,e,r){if(typeof t=="number"){let o=t;t=e,e=o}t=t||this.activeState.renderTexture;let s=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,r||St.NONE);return s.filterFrame=t.filterFrame,s}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){let r=ku[0],s=ku[1],o=ku[2],n=ku[3];r.set(e.left,e.top),s.set(e.left,e.bottom),o.set(e.right,e.top),n.set(e.right,e.bottom),t.apply(r,r),t.apply(s,s),t.apply(o,o),t.apply(n,n);let a=Math.min(r.x,s.x,o.x,n.x),h=Math.min(r.y,s.y,o.y,n.y),l=Math.max(r.x,s.x,o.x,n.x),c=Math.max(r.y,s.y,o.y,n.y);e.x=a,e.y=h,e.width=l-a,e.height=c-h}roundFrame(t,e,r,s,o){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(o){let{a:n,b:a,c:h,d:l}=o;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(l)>1e-4))return}o=o?Dg.copyFrom(o):Dg.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(o,t),t.ceil(e),this.transformAABB(o.invert(),t)}}};zo.extension={type:$.RendererSystem,name:"filter"};Z.add(zo);var Ph=class{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=St.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}};var m2=new pt,$o=class{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Pi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;K.PREFER_ENV===We.WEBGL_LEGACY&&(e=null,r=null),e?t.drawBuffers=s=>e.drawBuffersWEBGL(s):(this.hasMRT=!1,t.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,r=0){let{gl:s}=this;if(t){let o=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,s.bindFramebuffer(s.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,o.mipLevel=r),o.dirtyId!==t.dirtyId&&(o.dirtyId=t.dirtyId,o.dirtyFormat!==t.dirtyFormat?(o.dirtyFormat=t.dirtyFormat,o.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):o.dirtySize!==t.dirtySize&&(o.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let n=0;n<t.colorTextures.length;n++){let a=t.colorTextures[n];this.renderer.texture.unbind(a.parentTextureArray||a)}if(t.depthTexture&&this.renderer.texture.unbind(t.depthTexture),e){let n=e.width>>r,a=e.height>>r,h=n/e.width;this.setViewport(e.x*h,e.y*h,n,a)}else{let n=t.width>>r,a=t.height>>r;this.setViewport(0,0,n,a)}}else this.current&&(this.current=null,s.bindFramebuffer(s.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,r,s){let o=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),s=Math.round(s),(o.width!==r||o.height!==s||o.x!==t||o.y!==e)&&(o.x=t,o.y=e,o.width=r,o.height=s,this.gl.viewport(t,e,r,s))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,r,s,o=Zc.COLOR|Zc.DEPTH){let{gl:n}=this;n.clearColor(t,e,r,s),n.clear(o)}initFramebuffer(t){let{gl:e}=this,r=new Ph(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r}resizeFramebuffer(t){let{gl:e}=this,r=t.glFramebuffers[this.CONTEXT_UID];if(r.stencil){e.bindRenderbuffer(e.RENDERBUFFER,r.stencil);let n;this.renderer.context.webGLVersion===1?n=e.DEPTH_STENCIL:t.depth&&t.stencil?n=e.DEPTH24_STENCIL8:t.depth?n=e.DEPTH_COMPONENT24:n=e.STENCIL_INDEX8,r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,n,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,n,t.width,t.height)}let s=t.colorTextures,o=s.length;e.drawBuffers||(o=Math.min(o,1));for(let n=0;n<o;n++){let a=s[n],h=a.parentTextureArray||a;this.renderer.texture.bind(h,0),n===0&&r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,h._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height))}t.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(t.depthTexture,0)}updateFramebuffer(t,e){let{gl:r}=this,s=t.glFramebuffers[this.CONTEXT_UID],o=t.colorTextures,n=o.length;r.drawBuffers||(n=Math.min(n,1)),s.multisample>1&&this.canMultisampleFramebuffer(t)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));let a=[];for(let h=0;h<n;h++){let l=o[h],c=l.parentTextureArray||l;this.renderer.texture.bind(c,0),h===0&&s.msaaBuffer?(r.bindRenderbuffer(r.RENDERBUFFER,s.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,s.msaaBuffer)):(r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+h,l.target,c._glTextures[this.CONTEXT_UID].texture,e),a.push(r.COLOR_ATTACHMENT0+h))}if(a.length>1&&r.drawBuffers(a),t.depthTexture&&this.writeDepthTexture){let h=t.depthTexture;this.renderer.texture.bind(h,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){s.stencil=s.stencil||r.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH_STENCIL):t.depth&&t.stencil?(h=r.DEPTH_STENCIL_ATTACHMENT,l=r.DEPTH24_STENCIL8):t.depth?(h=r.DEPTH_ATTACHMENT,l=r.DEPTH_COMPONENT24):(h=r.STENCIL_ATTACHMENT,l=r.STENCIL_INDEX8),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,l,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,l,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,h,r.RENDERBUFFER,s.stencil)}else s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){let{msaaSamples:e}=this,r=St.NONE;if(t<=1||e===null)return r;for(let s=0;s<e.length;s++)if(e[s]<=t){r=e[s];break}return r===1&&(r=St.NONE),r}blit(t,e,r){let{current:s,renderer:o,gl:n,CONTEXT_UID:a}=this;if(o.context.webGLVersion!==2||!s)return;let h=s.glFramebuffers[a];if(!h)return;if(!t){if(!h.msaaBuffer)return;let c=s.colorTextures[0];if(!c)return;h.blitFramebuffer||(h.blitFramebuffer=new Pi(s.width,s.height),h.blitFramebuffer.addColorTexture(0,c)),t=h.blitFramebuffer,t.colorTextures[0]!==c&&(t.colorTextures[0]=c,t.dirtyId++,t.dirtyFormat++),(t.width!==s.width||t.height!==s.height)&&(t.width=s.width,t.height=s.height,t.dirtyId++,t.dirtySize++)}e||(e=m2,e.width=s.width,e.height=s.height),r||(r=e);let l=e.width===r.width&&e.height===r.height;this.bind(t),n.bindFramebuffer(n.READ_FRAMEBUFFER,h.framebuffer),n.blitFramebuffer(e.left,e.top,e.right,e.bottom,r.left,r.top,r.right,r.bottom,n.COLOR_BUFFER_BIT,l?n.NEAREST:n.LINEAR),n.bindFramebuffer(n.READ_FRAMEBUFFER,t.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(t,e){let r=t.glFramebuffers[this.CONTEXT_UID],s=this.gl;if(!r)return;delete t.glFramebuffers[this.CONTEXT_UID];let o=this.managedFramebuffers.indexOf(t);o>=0&&this.managedFramebuffers.splice(o,1),t.disposeRunner.remove(this),e||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,e)}disposeAll(t){let e=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;r<e.length;r++)this.disposeFramebuffer(e[r],t)}forceStencil(){let t=this.current;if(!t)return;let e=t.glFramebuffers[this.CONTEXT_UID];if(!e||e.stencil&&t.stencil)return;t.stencil=!0;let r=t.width,s=t.height,o=this.gl,n=e.stencil=o.createRenderbuffer();o.bindRenderbuffer(o.RENDERBUFFER,n);let a,h;this.renderer.context.webGLVersion===1?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH_STENCIL):t.depth?(a=o.DEPTH_STENCIL_ATTACHMENT,h=o.DEPTH24_STENCIL8):(a=o.STENCIL_ATTACHMENT,h=o.STENCIL_INDEX8),e.msaaBuffer?o.renderbufferStorageMultisample(o.RENDERBUFFER,e.multisample,h,r,s):o.renderbufferStorage(o.RENDERBUFFER,h,r,s),o.framebufferRenderbuffer(o.FRAMEBUFFER,a,o.RENDERBUFFER,n)}reset(){this.current=this.unknownFramebuffer,this.viewport=new pt}destroy(){this.renderer=null}};$o.extension={type:$.RendererSystem,name:"framebuffer"};Z.add($o);var Lg={5126:4,5123:2,5121:1},Xo=class{constructor(t){this.renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let t=this.gl=this.renderer.gl,e=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,e.webGLVersion!==2){let r=this.renderer.context.extensions.vertexArrayObject;K.PREFER_ENV===We.WEBGL_LEGACY&&(r=null),r?(t.createVertexArray=()=>r.createVertexArrayOES(),t.bindVertexArray=s=>r.bindVertexArrayOES(s),t.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){let r=t.getExtension("ANGLE_instanced_arrays");r?(t.vertexAttribDivisor=(s,o)=>r.vertexAttribDivisorANGLE(s,o),t.drawElementsInstanced=(s,o,n,a,h)=>r.drawElementsInstancedANGLE(s,o,n,a,h),t.drawArraysInstanced=(s,o,n,a)=>r.drawArraysInstancedANGLE(s,o,n,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;let{gl:r}=this,s=t.glVertexArrayObjects[this.CONTEXT_UID],o=!1;s||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=s={},o=!0);let n=s[e.program.id]||this.initGeometryVao(t,e,o);this._activeGeometry=t,this._activeVao!==n&&(this._activeVao=n,this.hasVao?r.bindVertexArray(n):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let t=this._activeGeometry,e=this.renderer.buffer;for(let r=0;r<t.buffers.length;r++){let s=t.buffers[r];e.update(s)}}checkCompatibility(t,e){let r=t.attributes,s=e.attributeData;for(let o in s)if(!r[o])throw new Error(`shader and geometry incompatible, geometry missing the "${o}" attribute`)}getSignature(t,e){let r=t.attributes,s=e.attributeData,o=["g",t.id];for(let n in r)s[n]&&o.push(n,s[n].location);return o.join("-")}initGeometryVao(t,e,r=!0){let s=this.gl,o=this.CONTEXT_UID,n=this.renderer.buffer,a=e.program;a.glPrograms[o]||this.renderer.shader.generateProgram(e),this.checkCompatibility(t,a);let h=this.getSignature(t,a),l=t.glVertexArrayObjects[this.CONTEXT_UID],c=l[h];if(c)return l[a.id]=c,c;let u=t.buffers,d=t.attributes,f={},p={};for(let g in u)f[g]=0,p[g]=0;for(let g in d)!d[g].size&&a.attributeData[g]?d[g].size=a.attributeData[g].size:d[g].size||console.warn(`PIXI Geometry attribute '${g}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[g].buffer]+=d[g].size*Lg[d[g].type];for(let g in d){let x=d[g],v=x.size;x.stride===void 0&&(f[x.buffer]===v*Lg[x.type]?x.stride=0:x.stride=f[x.buffer]),x.start===void 0&&(x.start=p[x.buffer],p[x.buffer]+=v*Lg[x.type])}c=s.createVertexArray(),s.bindVertexArray(c);for(let g=0;g<u.length;g++){let x=u[g];n.bind(x),r&&x._glBuffers[o].refCount++}return this.activateVao(t,a),l[a.id]=c,l[h]=c,s.bindVertexArray(null),n.unbind(Oe.ARRAY_BUFFER),c}disposeGeometry(t,e){if(!this.managedGeometries[t.id])return;delete this.managedGeometries[t.id];let r=t.glVertexArrayObjects[this.CONTEXT_UID],s=this.gl,o=t.buffers,n=this.renderer?.buffer;if(t.disposeRunner.remove(this),!!r){if(n)for(let a=0;a<o.length;a++){let h=o[a]._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&n.dispose(o[a],e))}if(!e){for(let a in r)if(a[0]==="g"){let h=r[a];this._activeVao===h&&this.unbind(),s.deleteVertexArray(h)}}delete t.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(t){let e=Object.keys(this.managedGeometries);for(let r=0;r<e.length;r++)this.disposeGeometry(this.managedGeometries[e[r]],t)}activateVao(t,e){let r=this.gl,s=this.CONTEXT_UID,o=this.renderer.buffer,n=t.buffers,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let h=null;for(let l in a){let c=a[l],u=n[c.buffer],d=u._glBuffers[s];if(e.attributeData[l]){h!==d&&(o.bind(u),h=d);let f=e.attributeData[l].location;if(r.enableVertexAttribArray(f),r.vertexAttribPointer(f,c.size,c.type||r.FLOAT,c.normalized,c.stride,c.start),c.instance)if(this.hasInstance)r.vertexAttribDivisor(f,c.divisor);else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,r,s){let{gl:o}=this,n=this._activeGeometry;if(n.indexBuffer){let a=n.indexBuffer.data.BYTES_PER_ELEMENT,h=a===2?o.UNSIGNED_SHORT:o.UNSIGNED_INT;a===2||a===4&&this.canUseUInt32ElementIndex?n.instanced?o.drawElementsInstanced(t,e||n.indexBuffer.data.length,h,(r||0)*a,s||1):o.drawElements(t,e||n.indexBuffer.data.length,h,(r||0)*a):console.warn("unsupported index buffer type: uint32")}else n.instanced?o.drawArraysInstanced(t,r,e||n.getSize(),s||1):o.drawArrays(t,r,e||n.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Xo.extension={type:$.RendererSystem,name:"geometry"};Z.add(Xo);var xP=new Ct,Rh=class{constructor(t,e){this._texture=t,this.mapCoord=new Ct,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof e>"u"?.5:e,this.isSimple=!1}get texture(){return this._texture}set texture(t){this._texture=t,this._textureID=-1}multiplyUvs(t,e){e===void 0&&(e=t);let r=this.mapCoord;for(let s=0;s<t.length;s+=2){let o=t[s],n=t[s+1];e[s]=o*r.a+n*r.c+r.tx,e[s+1]=o*r.b+n*r.d+r.ty}return e}update(t){let e=this._texture;if(!e||!e.valid||!t&&this._textureID===e._updateID)return!1;this._textureID=e._updateID,this._updateID++;let r=e._uvs;this.mapCoord.set(r.x1-r.x0,r.y1-r.y0,r.x3-r.x0,r.y3-r.y0,r.x0,r.y0);let s=e.orig,o=e.trim;o&&(xP.set(s.width/o.width,0,0,s.height/o.height,-o.x/o.width,-o.y/o.height),this.mapCoord.append(xP));let n=e.baseTexture,a=this.uClampFrame,h=this.clampMargin/n.resolution,l=this.clampOffset;return a[0]=(e._frame.x+h+l)/n.width,a[1]=(e._frame.y+h+l)/n.height,a[2]=(e._frame.x+e._frame.width-h+l)/n.width,a[3]=(e._frame.y+e._frame.height-h+l)/n.height,this.uClampOffset[0]=l/n.realWidth,this.uClampOffset[1]=l/n.realHeight,this.isSimple=e._frame.width===n.width&&e._frame.height===n.height&&e.rotate===0,!0}};var _P=`varying vec2 vMaskCoord;
1518
+ varying vec2 vTextureCoord;
1519
+
1520
+ uniform sampler2D uSampler;
1521
+ uniform sampler2D mask;
1522
+ uniform float alpha;
1523
+ uniform float npmAlpha;
1524
+ uniform vec4 maskClamp;
1525
+
1526
+ void main(void)
1527
+ {
1528
+ float clip = step(3.5,
1529
+ step(maskClamp.x, vMaskCoord.x) +
1530
+ step(maskClamp.y, vMaskCoord.y) +
1531
+ step(vMaskCoord.x, maskClamp.z) +
1532
+ step(vMaskCoord.y, maskClamp.w));
1533
+
1534
+ vec4 original = texture2D(uSampler, vTextureCoord);
1535
+ vec4 masky = texture2D(mask, vMaskCoord);
1536
+ float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
1537
+
1538
+ original *= (alphaMul * masky.r * alpha * clip);
1539
+
1540
+ gl_FragColor = original;
1541
+ }
1542
+ `;var yP=`attribute vec2 aVertexPosition;
1543
+ attribute vec2 aTextureCoord;
1544
+
1545
+ uniform mat3 projectionMatrix;
1546
+ uniform mat3 otherMatrix;
1547
+
1548
+ varying vec2 vMaskCoord;
1549
+ varying vec2 vTextureCoord;
1550
+
1551
+ void main(void)
1552
+ {
1553
+ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
1554
+
1555
+ vTextureCoord = aTextureCoord;
1556
+ vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
1557
+ }
1558
+ `;var Mh=class extends Nr{constructor(t,e,r){let s=null;typeof t!="string"&&e===void 0&&r===void 0&&(s=t,t=void 0,e=void 0,r=void 0),super(t||yP,e||_P,r),this.maskSprite=s,this.maskMatrix=new Ct}get maskSprite(){return this._maskSprite}set maskSprite(t){this._maskSprite=t,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(t,e,r,s){let o=this._maskSprite,n=o._texture;n.valid&&(n.uvMatrix||(n.uvMatrix=new Rh(n,0)),n.uvMatrix.update(),this.uniforms.npmAlpha=n.baseTexture.alphaMode?0:1,this.uniforms.mask=n,this.uniforms.otherMatrix=t.calculateSpriteMatrix(this.maskMatrix,o).prepend(n.uvMatrix.mapCoord),this.uniforms.alpha=o.worldAlpha,this.uniforms.maskClamp=n.uvMatrix.uClampFrame,t.applyFilter(this,e,r,s))}};var Bh=class{constructor(t=null){this.type=$t.NONE,this.autoDetect=!0,this.maskObject=t||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=Nr.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(t){t?this._filters?this._filters[0]=t:this._filters=[t]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=$t.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(t){t?(this._stencilCounter=t._stencilCounter,this._scissorCounter=t._scissorCounter,this._scissorRect=t._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}};var jo=class{constructor(t){this.renderer=t,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(t){this.maskStack=t,this.renderer.scissor.setMaskStack(t),this.renderer.stencil.setMaskStack(t)}push(t,e){let r=e;if(!r.isMaskData){let o=this.maskDataPool.pop()||new Bh;o.pooled=!0,o.maskObject=e,r=o}let s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null;if(r.copyCountersOrReset(s),r._colorMask=s?s._colorMask:15,r.autoDetect&&this.detect(r),r._target=t,r.type!==$t.SPRITE&&this.maskStack.push(r),r.enabled)switch(r.type){case $t.SCISSOR:this.renderer.scissor.push(r);break;case $t.STENCIL:this.renderer.stencil.push(r);break;case $t.SPRITE:r.copyCountersOrReset(null),this.pushSpriteMask(r);break;case $t.COLOR:this.pushColorMask(r);break;default:break}r.type===$t.SPRITE&&this.maskStack.push(r)}pop(t){let e=this.maskStack.pop();if(!(!e||e._target!==t)){if(e.enabled)switch(e.type){case $t.SCISSOR:this.renderer.scissor.pop(e);break;case $t.STENCIL:this.renderer.stencil.pop(e.maskObject);break;case $t.SPRITE:this.popSpriteMask(e);break;case $t.COLOR:this.popColorMask(e);break;default:break}if(e.reset(),e.pooled&&this.maskDataPool.push(e),this.maskStack.length!==0){let r=this.maskStack[this.maskStack.length-1];r.type===$t.SPRITE&&r._filters&&(r._filters[0].maskSprite=r.maskObject)}}}detect(t){let e=t.maskObject;e?e.isSprite?t.type=$t.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(t)?t.type=$t.SCISSOR:t.type=$t.STENCIL:t.type=$t.COLOR}pushSpriteMask(t){let{maskObject:e}=t,r=t._target,s=t._filters;s||(s=this.alphaMaskPool[this.alphaMaskIndex],s||(s=this.alphaMaskPool[this.alphaMaskIndex]=[new Mh])),s[0].resolution=t.resolution,s[0].multisample=t.multisample,s[0].maskSprite=e;let o=r.filterArea;r.filterArea=e.getBounds(!0),this.renderer.filter.push(r,s),r.filterArea=o,t._filters||this.alphaMaskIndex++}popSpriteMask(t){this.renderer.filter.pop(),t._filters?t._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(t){let e=t._colorMask,r=t._colorMask=e&t.colorMask;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}popColorMask(t){let e=t._colorMask,r=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}};jo.extension={type:$.RendererSystem,name:"mask"};Z.add(jo);var Yo=class{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){let{gl:e}=this.renderer,r=this.getStackLength();this.maskStack=t;let s=this.getStackLength();s!==r&&(s===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}};var bP=new Ct,vP=[],TP=class Ou extends Yo{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){if(t._scissorRectLocal)return;let e=t._scissorRect,{maskObject:r}=t,{renderer:s}=this,o=s.renderTexture,n=r.getBounds(!0,vP.pop()??new pt);this.roundFrameToPixels(n,o.current?o.current.resolution:s.resolution,o.sourceFrame,o.destinationFrame,s.projection.transform),e&&n.fit(e),t._scissorRectLocal=n}static isMatrixRotated(t){if(!t)return!1;let{a:e,b:r,c:s,d:o}=t;return(Math.abs(r)>1e-4||Math.abs(s)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(o)>1e-4)}testScissor(t){let{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||Ou.isMatrixRotated(e.worldTransform)||Ou.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,e,r,s,o){Ou.isMatrixRotated(o)||(o=o?bP.copyFrom(o):bP.identity(),o.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.renderer.filter.transformAABB(o,t),t.fit(s),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);let{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){let{gl:e}=this.renderer;t&&vP.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){let t=this.maskStack[this.maskStack.length-1]._scissorRect,e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};TP.extension={type:$.RendererSystem,name:"scissor"};var Hg=TP;Z.add(Hg);var qo=class extends Yo{constructor(t){super(t),this.glConst=K.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){let e=t.maskObject,{gl:r}=this.renderer,s=t._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;let o=t._colorMask;o!==0&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,o!==0&&(t._colorMask=o,r.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}pop(t){let e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{let r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,s!==0&&(r._colorMask=s,e.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()}}_useCurrent(){let t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}};qo.extension={type:$.RendererSystem,name:"stencil"};Z.add(qo);var Ko=class{constructor(t){this.renderer=t,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.extract has moved to renderer.extract"),t.extract}},prepare:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),t.prepare}},interaction:{enumerable:!1,get(){return ht("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),t.events}}})}init(){let t=this.rendererPlugins;for(let e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(let t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}};Ko.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_plugin"};Z.add(Ko);var Zo=class{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ct,this.transform=null}update(t,e,r,s){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,s),this.transform&&this.projectionMatrix.append(this.transform);let o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)}calculateProjection(t,e,r,s){let o=this.projectionMatrix,n=s?-1:1;o.identity(),o.a=1/e.width*2,o.d=n*(1/e.height*2),o.tx=-1-e.x*o.a,o.ty=-n-e.y*o.d}setTransform(t){}destroy(){this.renderer=null}};Zo.extension={type:$.RendererSystem,name:"projection"};Z.add(Zo);var g2=new wu,SP=new pt,Qo=class{constructor(t){this.renderer=t,this._tempMatrix=new Ct}generateTexture(t,e){let{region:r,...s}=e||{},o=r?.copyTo(SP)||t.getLocalBounds(SP,!0),n=s.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/n),o.height=Math.max(o.height,1/n),s.width=o.width,s.height=o.height,s.resolution=n,s.multisample??(s.multisample=this.renderer.multisample);let a=_s.create(s);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;let h=t.transform;return t.transform=g2,this.renderer.render(t,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=h,a}destroy(){}};Qo.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"textureGenerator"};Z.add(Qo);var ys=new pt,Ih=new pt,Jo=class{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}contextChange(){let t=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(t&&t.alpha&&t.premultipliedAlpha)}bind(t=null,e,r){let s=this.renderer;this.current=t;let o,n,a;t?(o=t.baseTexture,a=o.resolution,e||(ys.width=t.frame.width,ys.height=t.frame.height,e=ys),r||(Ih.x=t.frame.x,Ih.y=t.frame.y,Ih.width=e.width,Ih.height=e.height,r=Ih),n=o.framebuffer):(a=s.resolution,e||(ys.width=s._view.screen.width,ys.height=s._view.screen.height,e=ys),r||(r=ys,r.width=e.width,r.height=e.height));let h=this.viewportFrame;h.x=r.x*a,h.y=r.y*a,h.width=r.width*a,h.height=r.height*a,t||(h.y=s.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(n,h),this.renderer.projection.update(r,e,a,!n),t?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)}clear(t,e){let r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=_r.shared.setValue(t||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);let o=this.destinationFrame,n=this.current?this.current.baseTexture:this.renderer._view.screen,a=o.width!==n.width||o.height!==n.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,e),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};Jo.extension={type:$.RendererSystem,name:"renderTexture"};Z.add(Jo);var Fh=class{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function AP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let s=0;s<r;s++){let o=t.getActiveAttrib(i,s);if(o.name.startsWith("gl_"))continue;let n=_h(t,o.type),a={type:n,name:o.name,size:xh(n),location:t.getAttribLocation(i,o.name)};e[o.name]=a}return e}function EP(i,t){let e={},r=t.getProgramParameter(i,t.ACTIVE_UNIFORMS);for(let s=0;s<r;s++){let o=t.getActiveUniform(i,s),n=o.name.replace(/\[.*?\]$/,""),a=!!o.name.match(/\[.*?\]$/),h=_h(t,o.type);e[n]={name:n,index:s,type:h,size:o.size,isArray:a,value:gh(h,o.size)}}return e}function Vg(i,t){let e=Cu(i,i.VERTEX_SHADER,t.vertexSrc),r=Cu(i,i.FRAGMENT_SHADER,t.fragmentSrc),s=i.createProgram();i.attachShader(s,e),i.attachShader(s,r);let o=t.extra?.transformFeedbackVaryings;if(o&&(typeof i.transformFeedbackVaryings!="function"?console.warn("TransformFeedback is not supported but TransformFeedbackVaryings are given."):i.transformFeedbackVaryings(s,o.names,o.bufferMode==="separate"?i.SEPARATE_ATTRIBS:i.INTERLEAVED_ATTRIBS)),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS)||kg(i,s,e,r),t.attributeData=AP(s,i),t.uniformData=EP(s,i),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let a=Object.keys(t.attributeData);a.sort((h,l)=>h>l?1:-1);for(let h=0;h<a.length;h++)t.attributeData[a[h]].location=h,i.bindAttribLocation(s,h,a[h]);i.linkProgram(s)}i.deleteShader(e),i.deleteShader(r);let n={};for(let a in t.uniformData){let h=t.uniformData[a];n[a]={location:i.getUniformLocation(s,a),value:gh(h.type,h.size)}}return new Fh(s,n)}function x2(i,t,e,r,s){e.buffer.update(s)}var _2={float:`
1559
+ data[offset] = v;
1560
+ `,vec2:`
1561
+ data[offset] = v[0];
1562
+ data[offset+1] = v[1];
1563
+ `,vec3:`
1564
+ data[offset] = v[0];
1565
+ data[offset+1] = v[1];
1566
+ data[offset+2] = v[2];
1567
+
1568
+ `,vec4:`
1569
+ data[offset] = v[0];
1570
+ data[offset+1] = v[1];
1571
+ data[offset+2] = v[2];
1572
+ data[offset+3] = v[3];
1573
+ `,mat2:`
1574
+ data[offset] = v[0];
1575
+ data[offset+1] = v[1];
1576
+
1577
+ data[offset+4] = v[2];
1578
+ data[offset+5] = v[3];
1579
+ `,mat3:`
1580
+ data[offset] = v[0];
1581
+ data[offset+1] = v[1];
1582
+ data[offset+2] = v[2];
1583
+
1584
+ data[offset + 4] = v[3];
1585
+ data[offset + 5] = v[4];
1586
+ data[offset + 6] = v[5];
1587
+
1588
+ data[offset + 8] = v[6];
1589
+ data[offset + 9] = v[7];
1590
+ data[offset + 10] = v[8];
1591
+ `,mat4:`
1592
+ for(var i = 0; i < 16; i++)
1593
+ {
1594
+ data[offset + i] = v[i];
1595
+ }
1596
+ `},wP={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function CP(i){let t=i.map(o=>({data:o,offset:0,dataLen:0,dirty:0})),e=0,r=0,s=0;for(let o=0;o<t.length;o++){let n=t[o];if(e=wP[n.data.type],n.data.size>1&&(e=Math.max(e,16)*n.data.size),n.dataLen=e,r%e!==0&&r<16){let a=r%e%16;r+=a,s+=a}r+e>16?(s=Math.ceil(s/16)*16,n.offset=s,s+=e,r=e):(n.offset=s,r+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}function PP(i,t){let e=[];for(let r in i)t[r]&&e.push(t[r]);return e.sort((r,s)=>r.index-s.index),e}function Wg(i,t){if(!i.autoManage)return{size:0,syncFunc:x2};let e=PP(i.uniforms,t),{uboElements:r,size:s}=CP(e),o=[`
1597
+ var v = null;
1598
+ var v2 = null;
1599
+ var cv = null;
1600
+ var t = 0;
1601
+ var gl = renderer.gl
1602
+ var index = 0;
1603
+ var data = buffer.data;
1604
+ `];for(let n=0;n<r.length;n++){let a=r[n],h=i.uniforms[a.data.name],l=a.data.name,c=!1;for(let u=0;u<Or.length;u++){let d=Or[u];if(d.codeUbo&&d.test(a.data,h)){o.push(`offset = ${a.offset/4};`,Or[u].codeUbo(a.data.name,h)),c=!0;break}}if(!c)if(a.data.size>1){let u=xh(a.data.type),d=Math.max(wP[a.data.type]/16,1),f=u/d,p=(4-f%4)%4;o.push(`
1605
+ cv = ud.${l}.value;
1606
+ v = uv.${l};
1607
+ offset = ${a.offset/4};
1608
+
1609
+ t = 0;
1610
+
1611
+ for(var i=0; i < ${a.data.size*d}; i++)
1612
+ {
1613
+ for(var j = 0; j < ${f}; j++)
1614
+ {
1615
+ data[offset++] = v[t++];
1616
+ }
1617
+ offset += ${p};
1618
+ }
1619
+
1620
+ `)}else{let u=_2[a.data.type];o.push(`
1621
+ cv = ud.${l}.value;
1622
+ v = uv.${l};
1623
+ offset = ${a.offset/4};
1624
+ ${u};
1625
+ `)}}return o.push(`
1626
+ renderer.buffer.update(buffer);
1627
+ `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join(`
1628
+ `))}}var y2=0,Nu={textureCount:0,uboCount:0},Ri=class{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=y2++}systemCheck(){if(!Fu())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;let r=t.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),e||(Nu.textureCount=0,Nu.uboCount=0,this.syncUniformGroup(t.uniformGroup,Nu)),s}setUniforms(t){let e=this.shader.program,r=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(r.uniformData,t,this.renderer)}syncUniformGroup(t,e){let r=this.getGlProgram();(!t.static||t.dirtyId!==r.uniformDirtyGroups[t.id])&&(r.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,r,e))}syncUniforms(t,e,r){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,r)}createSyncGroups(t){let e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Gg(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){let r=this.getGlProgram();if(!t.static||t.dirtyId!==0||!r.uniformGroups[t.id]){t.dirtyId=0;let s=r.uniformGroups[t.id]||this.createSyncBufferGroup(t,r,e);t.buffer.update(),s(r.uniformData,t.uniforms,this.renderer,Nu,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,r.uniformBufferBindings[e])}createSyncBufferGroup(t,e,r){let{gl:s}=this.renderer;this.renderer.buffer.bind(t.buffer);let o=this.gl.getUniformBlockIndex(e.program,r);e.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(e.program,o,this.shader.uniformBindCount),this.shader.uniformBindCount++;let n=this.getSignature(t,this.shader.program.uniformData,"ubo"),a=this._uboCache[n];if(a||(a=this._uboCache[n]=Wg(t,this.shader.program.uniformData)),t.autoManage){let h=new Float32Array(a.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=a.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,r){let s=t.uniforms,o=[`${r}-`];for(let n in s)o.push(n),e[n]&&o.push(e[n].type);return o.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){let e=this.gl,r=t.program,s=Vg(e,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};Ri.extension={type:$.RendererSystem,name:"shader"};Z.add(Ri);var ai=class{constructor(t){this.renderer=t}run(t){let{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.3 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}};ai.defaultOptions={hello:!1},ai.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"startup"};Z.add(ai);function RP(i,t=[]){return t[J.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.ADD]=[i.ONE,i.ONE],t[J.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.NONE]=[0,0],t[J.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[J.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[J.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[J.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[J.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[J.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[J.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[J.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[J.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[J.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[J.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}var b2=0,v2=1,T2=2,S2=3,A2=4,E2=5,MP=class zg{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=J.NONE,this._blendEq=!1,this.map=[],this.map[b2]=this.setBlend,this.map[v2]=this.setOffset,this.map[T2]=this.setCullFace,this.map[S2]=this.setDepthTest,this.map[A2]=this.setFrontFace,this.map[E2]=this.setDepthMask,this.checks=[],this.defaultState=new kr,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=RP(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,r=0;for(;e;)e&1&&this.map[r].call(this,!!(t.data&1<<r)),e=e>>1,r++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this.updateCheck(zg.checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this.updateCheck(zg.checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(t===this.blendMode)return;this.blendMode=t;let e=this.blendModes[t],r=this.gl;e.length===2?r.blendFunc(e[0],e[1]):r.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,r.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,r.blendEquationSeparate(r.FUNC_ADD,r.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(t,e){let r=this.checks.indexOf(t);e&&r===-1?this.checks.push(t):!e&&r!==-1&&this.checks.splice(r,1)}static checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null}};MP.extension={type:$.RendererSystem,name:"state"};var $g=MP;Z.add($g);var tn=class extends as.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(t){this.addRunners(...t.runners);let e=(t.priority??[]).filter(s=>t.systems[s]),r=[...e,...Object.keys(t.systems).filter(s=>!e.includes(s))];for(let s of r)this.addSystem(t.systems[s],s)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Ht(e)})}addSystem(t,e){let r=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=r,this._systemsHash[e]=r;for(let s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(t,e){let r=Object.keys(this._systemsHash);t.items.forEach(s=>{let o=r.find(n=>this._systemsHash[n]===s);s[t.name](e[o])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}};var Gh=class Du{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=Du.defaultMaxIdle,this.checkCountMax=Du.defaultCheckCountMax,this.mode=Du.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Qc.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let t=this.renderer.texture,e=t.managedTextures,r=!1;for(let s=0;s<e.length;s++){let o=e[s];o.resource&&this.count-o.touched>this.maxIdle&&(t.destroyTexture(o,!0),e[s]=null,r=!0)}if(r){let s=0;for(let o=0;o<e.length;o++)e[o]!==null&&(e[s++]=e[o]);e.length=s}}unload(t){let e=this.renderer.texture,r=t._texture;r&&!r.framebuffer&&e.destroyTexture(r);for(let s=t.children.length-1;s>=0;s--)this.unload(t.children[s])}destroy(){this.renderer=null}};Gh.defaultMode=Qc.AUTO,Gh.defaultMaxIdle=60*60,Gh.defaultCheckCountMax=60*10,Gh.extension={type:$.RendererSystem,name:"textureGC"};var Dr=Gh;Z.add(Dr);var bs=class{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=st.UNSIGNED_BYTE,this.internalFormat=L.RGBA,this.samplerType=0}};function BP(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:V.FLOAT,[i.RGBA]:V.FLOAT,[i.ALPHA]:V.FLOAT,[i.LUMINANCE]:V.FLOAT,[i.LUMINANCE_ALPHA]:V.FLOAT,[i.R8]:V.FLOAT,[i.R8_SNORM]:V.FLOAT,[i.RG8]:V.FLOAT,[i.RG8_SNORM]:V.FLOAT,[i.RGB8]:V.FLOAT,[i.RGB8_SNORM]:V.FLOAT,[i.RGB565]:V.FLOAT,[i.RGBA4]:V.FLOAT,[i.RGB5_A1]:V.FLOAT,[i.RGBA8]:V.FLOAT,[i.RGBA8_SNORM]:V.FLOAT,[i.RGB10_A2]:V.FLOAT,[i.RGB10_A2UI]:V.FLOAT,[i.SRGB8]:V.FLOAT,[i.SRGB8_ALPHA8]:V.FLOAT,[i.R16F]:V.FLOAT,[i.RG16F]:V.FLOAT,[i.RGB16F]:V.FLOAT,[i.RGBA16F]:V.FLOAT,[i.R32F]:V.FLOAT,[i.RG32F]:V.FLOAT,[i.RGB32F]:V.FLOAT,[i.RGBA32F]:V.FLOAT,[i.R11F_G11F_B10F]:V.FLOAT,[i.RGB9_E5]:V.FLOAT,[i.R8I]:V.INT,[i.R8UI]:V.UINT,[i.R16I]:V.INT,[i.R16UI]:V.UINT,[i.R32I]:V.INT,[i.R32UI]:V.UINT,[i.RG8I]:V.INT,[i.RG8UI]:V.UINT,[i.RG16I]:V.INT,[i.RG16UI]:V.UINT,[i.RG32I]:V.INT,[i.RG32UI]:V.UINT,[i.RGB8I]:V.INT,[i.RGB8UI]:V.UINT,[i.RGB16I]:V.INT,[i.RGB16UI]:V.UINT,[i.RGB32I]:V.INT,[i.RGB32UI]:V.UINT,[i.RGBA8I]:V.INT,[i.RGBA8UI]:V.UINT,[i.RGBA16I]:V.INT,[i.RGBA16UI]:V.UINT,[i.RGBA32I]:V.INT,[i.RGBA32UI]:V.UINT,[i.DEPTH_COMPONENT16]:V.FLOAT,[i.DEPTH_COMPONENT24]:V.FLOAT,[i.DEPTH_COMPONENT32F]:V.FLOAT,[i.DEPTH_STENCIL]:V.FLOAT,[i.DEPTH24_STENCIL8]:V.FLOAT,[i.DEPTH32F_STENCIL8]:V.FLOAT}:t={[i.RGB]:V.FLOAT,[i.RGBA]:V.FLOAT,[i.ALPHA]:V.FLOAT,[i.LUMINANCE]:V.FLOAT,[i.LUMINANCE_ALPHA]:V.FLOAT,[i.DEPTH_STENCIL]:V.FLOAT},t}function IP(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[st.UNSIGNED_BYTE]:{[L.RGBA]:i.RGBA8,[L.RGB]:i.RGB8,[L.RG]:i.RG8,[L.RED]:i.R8,[L.RGBA_INTEGER]:i.RGBA8UI,[L.RGB_INTEGER]:i.RGB8UI,[L.RG_INTEGER]:i.RG8UI,[L.RED_INTEGER]:i.R8UI,[L.ALPHA]:i.ALPHA,[L.LUMINANCE]:i.LUMINANCE,[L.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[st.BYTE]:{[L.RGBA]:i.RGBA8_SNORM,[L.RGB]:i.RGB8_SNORM,[L.RG]:i.RG8_SNORM,[L.RED]:i.R8_SNORM,[L.RGBA_INTEGER]:i.RGBA8I,[L.RGB_INTEGER]:i.RGB8I,[L.RG_INTEGER]:i.RG8I,[L.RED_INTEGER]:i.R8I},[st.UNSIGNED_SHORT]:{[L.RGBA_INTEGER]:i.RGBA16UI,[L.RGB_INTEGER]:i.RGB16UI,[L.RG_INTEGER]:i.RG16UI,[L.RED_INTEGER]:i.R16UI,[L.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[st.SHORT]:{[L.RGBA_INTEGER]:i.RGBA16I,[L.RGB_INTEGER]:i.RGB16I,[L.RG_INTEGER]:i.RG16I,[L.RED_INTEGER]:i.R16I},[st.UNSIGNED_INT]:{[L.RGBA_INTEGER]:i.RGBA32UI,[L.RGB_INTEGER]:i.RGB32UI,[L.RG_INTEGER]:i.RG32UI,[L.RED_INTEGER]:i.R32UI,[L.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[st.INT]:{[L.RGBA_INTEGER]:i.RGBA32I,[L.RGB_INTEGER]:i.RGB32I,[L.RG_INTEGER]:i.RG32I,[L.RED_INTEGER]:i.R32I},[st.FLOAT]:{[L.RGBA]:i.RGBA32F,[L.RGB]:i.RGB32F,[L.RG]:i.RG32F,[L.RED]:i.R32F,[L.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[st.HALF_FLOAT]:{[L.RGBA]:i.RGBA16F,[L.RGB]:i.RGB16F,[L.RG]:i.RG16F,[L.RED]:i.R16F},[st.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:i.RGB565},[st.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:i.RGBA4},[st.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:i.RGB5_A1},[st.UNSIGNED_INT_2_10_10_10_REV]:{[L.RGBA]:i.RGB10_A2,[L.RGBA_INTEGER]:i.RGB10_A2UI},[st.UNSIGNED_INT_10F_11F_11F_REV]:{[L.RGB]:i.R11F_G11F_B10F},[st.UNSIGNED_INT_5_9_9_9_REV]:{[L.RGB]:i.RGB9_E5},[st.UNSIGNED_INT_24_8]:{[L.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[st.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[L.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[st.UNSIGNED_BYTE]:{[L.RGBA]:i.RGBA,[L.RGB]:i.RGB,[L.ALPHA]:i.ALPHA,[L.LUMINANCE]:i.LUMINANCE,[L.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[st.UNSIGNED_SHORT_5_6_5]:{[L.RGB]:i.RGB},[st.UNSIGNED_SHORT_4_4_4_4]:{[L.RGBA]:i.RGBA},[st.UNSIGNED_SHORT_5_5_5_1]:{[L.RGBA]:i.RGBA}},t}var en=class{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ut,this.hasIntegerTextures=!1}contextChange(){let t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=IP(t),this.samplerTypes=BP(t);let e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let s=0;s<e;s++)this.boundTextures[s]=null;this.emptyTextures={};let r=new bs(t.createTexture());t.bindTexture(t.TEXTURE_2D,r.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[t.TEXTURE_2D]=r,this.emptyTextures[t.TEXTURE_CUBE_MAP]=new bs(t.createTexture()),t.bindTexture(t.TEXTURE_CUBE_MAP,this.emptyTextures[t.TEXTURE_CUBE_MAP].texture);for(let s=0;s<6;s++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,null);t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,t.LINEAR);for(let s=0;s<this.boundTextures.length;s++)this.bind(null,s)}bind(t,e=0){let{gl:r}=this;if(t=t?.castToBaseTexture(),t?.valid&&!t.parentTextureArray){t.touched=this.renderer.textureGC.count;let s=t._glTextures[this.CONTEXT_UID]||this.initTexture(t);this.boundTextures[e]!==t&&(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(t.target,s.texture)),s.dirtyId!==t.dirtyId?(this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),this.updateTexture(t)):s.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(t),this.boundTextures[e]=t}else this.currentLocation!==e&&(this.currentLocation=e,r.activeTexture(r.TEXTURE0+e)),r.bindTexture(r.TEXTURE_2D,this.emptyTextures[r.TEXTURE_2D].texture),this.boundTextures[e]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let t=0;t<this.boundTextures.length;t++)this.boundTextures[t]=this.unknownTexture}unbind(t){let{gl:e,boundTextures:r}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let s=0;s<r.length;s++)r[s]===this.unknownTexture&&this.bind(null,s)}for(let s=0;s<r.length;s++)r[s]===t&&(this.currentLocation!==s&&(e.activeTexture(e.TEXTURE0+s),this.currentLocation=s),e.bindTexture(t.target,this.emptyTextures[t.target].texture),r[s]=null)}ensureSamplerType(t){let{boundTextures:e,hasIntegerTextures:r,CONTEXT_UID:s}=this;if(r)for(let o=t-1;o>=0;--o){let n=e[o];n&&n._glTextures[s].samplerType!==V.FLOAT&&this.renderer.texture.unbind(n)}}initTexture(t){let e=new bs(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){e.internalFormat=this.internalFormats[t.type]?.[t.format]??t.format,e.samplerType=this.samplerTypes[e.internalFormat]??V.FLOAT,this.webGLVersion===2&&t.type===st.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){let e=t._glTextures[this.CONTEXT_UID];if(!e)return;let r=this.renderer;if(this.initTextureType(t,e),t.resource?.upload(r,t,e))e.samplerType!==V.FLOAT&&(this.hasIntegerTextures=!0);else{let s=t.realWidth,o=t.realHeight,n=r.gl;(e.width!==s||e.height!==o||e.dirtyId<0)&&(e.width=s,e.height=o,n.texImage2D(t.target,0,e.internalFormat,s,o,0,t.format,e.type,null))}t.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(t),e.dirtyId=t.dirtyId}destroyTexture(t,e){let{gl:r}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){let s=this.managedTextures.indexOf(t);s!==-1&&bg(this.managedTextures,s,1)}}updateTextureStyle(t){let e=t._glTextures[this.CONTEXT_UID];e&&((t.mipmap===gr.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?e.mipmap=!1:e.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?e.wrapMode=Qa.CLAMP:e.wrapMode=t.wrapMode,t.resource?.style(this.renderer,t,e)||this.setStyle(t,e),e.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){let r=this.gl;if(e.mipmap&&t.mipmap!==gr.ON_MANUAL&&r.generateMipmap(t.target),r.texParameteri(t.target,r.TEXTURE_WRAP_S,e.wrapMode),r.texParameteri(t.target,r.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===sr.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);let s=this.renderer.context.extensions.anisotropicFiltering;if(s&&t.anisotropicLevel>0&&t.scaleMode===sr.LINEAR){let o=Math.min(t.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(t.target,s.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else r.texParameteri(t.target,r.TEXTURE_MIN_FILTER,t.scaleMode===sr.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(t.target,r.TEXTURE_MAG_FILTER,t.scaleMode===sr.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}};en.extension={type:$.RendererSystem,name:"texture"};Z.add(en);var rn=class{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glTransformFeedbacks[r]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,s)}unbind(){let{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){let{gl:r,renderer:s}=this;e&&s.shader.bind(e),r.beginTransformFeedback(t)}endTransformFeedback(){let{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){let{gl:e,renderer:r,CONTEXT_UID:s}=this,o=e.createTransformFeedback();t._glTransformFeedbacks[s]=o,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,o);for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];a&&(r.buffer.update(a),a._glBuffers[s].refCount++,e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,n,a._glBuffers[s].buffer||null))}return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),t.disposeRunner.add(this),o}disposeTransformFeedback(t,e){let r=t._glTransformFeedbacks[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this);let o=this.renderer.buffer;if(o)for(let n=0;n<t.buffers.length;n++){let a=t.buffers[n];if(!a)continue;let h=a._glBuffers[this.CONTEXT_UID];h&&(h.refCount--,h.refCount===0&&!e&&o.dispose(a,e))}r&&(e||s.deleteTransformFeedback(r),delete t._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};rn.extension={type:$.RendererSystem,name:"transformFeedback"};Z.add(rn);var hi=class{constructor(t){this.renderer=t}init(t){this.screen=new pt(0,0,t.width,t.height),this.element=t.view||K.ADAPTER.createCanvas(),this.resolution=t.resolution||K.RESOLUTION,this.autoDensity=!!t.autoDensity}resizeView(t,e){this.element.width=Math.round(t*this.resolution),this.element.height=Math.round(e*this.resolution);let r=this.element.width/this.resolution,s=this.element.height/this.resolution;this.screen.width=r,this.screen.height=s,this.autoDensity&&(this.element.style.width=`${r}px`,this.element.style.height=`${s}px`),this.renderer.emit("resize",r,s),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(t){t&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};hi.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},hi.extension={type:[$.RendererSystem,$.CanvasRendererSystem],name:"_view"};Z.add(hi);K.PREFER_ENV=We.WEBGL2;K.STRICT_TEXTURE_CACHE=!1;K.RENDER_OPTIONS={...ni.defaultOptions,...oi.defaultOptions,...hi.defaultOptions,...ai.defaultOptions};Object.defineProperties(K,{WRAP_MODE:{get(){return ut.defaultOptions.wrapMode},set(i){ht("7.1.0","settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode"),ut.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return ut.defaultOptions.scaleMode},set(i){ht("7.1.0","settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode"),ut.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return ut.defaultOptions.mipmap},set(i){ht("7.1.0","settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap"),ut.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return ut.defaultOptions.anisotropicLevel},set(i){ht("7.1.0","settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel"),ut.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return ht("7.1.0","settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution"),Nr.defaultResolution},set(i){Nr.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return ht("7.1.0","settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample"),Nr.defaultMultisample},set(i){Nr.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return si.defaultMaxTextures},set(i){ht("7.1.0","settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures"),si.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return si.defaultBatchSize},set(i){ht("7.1.0","settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize"),si.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return si.canUploadSameBuffer},set(i){ht("7.1.0","settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer"),si.canUploadSameBuffer=i}},GC_MODE:{get(){return Dr.defaultMode},set(i){ht("7.1.0","settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode"),Dr.defaultMode=i}},GC_MAX_IDLE:{get(){return Dr.defaultMaxIdle},set(i){ht("7.1.0","settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle"),Dr.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Dr.defaultCheckCountMax},set(i){ht("7.1.0","settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax"),Dr.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return ar.defaultVertexPrecision},set(i){ht("7.1.0","settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision"),ar.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return ar.defaultFragmentPrecision},set(i){ht("7.1.0","settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision"),ar.defaultFragmentPrecision=i}}});var vs=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(vs||{});var sn=class{constructor(t,e=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=s}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));let e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let e=this.next;return this.next=t?null:e,this.previous=null,e}};var FP=class Ye{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 sn(null,null,1/0),this.deltaMS=1/Ye.targetFPMS,this.elapsedMS=1/Ye.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,r=vs.NORMAL){return this._addListener(new sn(t,e,r))}addOnce(t,e,r=vs.NORMAL){return this._addListener(new sn(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){let o=t-this._lastFrame|0;if(o<this._minElapsedMS)return;this._lastFrame=t-o%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Ye.targetFPMS;let r=this._head,s=r.next;for(;s;)s=s.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let e=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,e)/1e3,Ye.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{let e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Ye._shared){let t=Ye._shared=new Ye;t.autoStart=!0,t._protected=!0}return Ye._shared}static get system(){if(!Ye._system){let t=Ye._system=new Ye;t.autoStart=!0,t._protected=!0}return Ye._system}};FP.targetFPMS=.06;var hr=FP;Object.defineProperties(K,{TARGET_FPMS:{get(){return hr.targetFPMS},set(i){ht("7.1.0","settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS"),hr.targetFPMS=i}}});var Uh=class{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,vs.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?hr.shared:new hr,t.autoStart&&this.start()}static destroy(){if(this._ticker){let t=this._ticker;this.ticker=null,t.destroy()}}};Uh.extension=$.Application;Z.add(Uh);var w2=[];Z.handleByList($.Renderer,w2);var kh=class{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){let r=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,r)}else{let r=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,r)}e>=St.HIGH?this.multisample=St.HIGH:e>=St.MEDIUM?this.multisample=St.MEDIUM:e>=St.LOW?this.multisample=St.LOW:this.multisample=St.NONE}destroy(){}};kh.extension={type:$.RendererSystem,name:"_multisample"};Z.add(kh);var Lu=class{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}};var Oh=class{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);e.bindBuffer(t.type,s.buffer)}unbind(t){let{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){let{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[e]!==t){let o=t._glBuffers[s]||this.createGLBuffer(t);this.boundBufferBases[e]=t,r.bindBufferBase(r.UNIFORM_BUFFER,e,o.buffer)}}bindBufferRange(t,e,r){let{gl:s,CONTEXT_UID:o}=this;r=r||0;let n=t._glBuffers[o]||this.createGLBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,r*256,256)}update(t){let{gl:e,CONTEXT_UID:r}=this,s=t._glBuffers[r]||this.createGLBuffer(t);if(t._updateID!==s.updateID)if(s.updateID=t._updateID,e.bindBuffer(t.type,s.buffer),s.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{let o=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,o)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];let r=t._glBuffers[this.CONTEXT_UID],s=this.gl;t.disposeRunner.remove(this),r&&(e||s.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){let e=Object.keys(this.managedBuffers);for(let r=0;r<e.length;r++)this.dispose(this.managedBuffers[e[r]],t)}createGLBuffer(t){let{CONTEXT_UID:e,gl:r}=this;return t._glBuffers[e]=new Lu(r.createBuffer()),this.managedBuffers[t.id]=t,t.disposeRunner.add(this),t._glBuffers[e]}};Oh.extension={type:$.RendererSystem,name:"buffer"};Z.add(Oh);var Nh=class{constructor(t){this.renderer=t}render(t,e){let r=this.renderer,s,o,n,a;if(e&&(s=e.renderTexture,o=e.clear,n=e.transform,a=e.skipUpdateTransform),this.renderingToScreen=!s,r.runners.prerender.emit(),r.emit("prerender"),r.projection.transform=n,!r.context.isLost){if(s||(this.lastObjectRendered=t),!a){let h=t.enableTempParent();t.updateTransform(),t.disableTempParent(h)}r.renderTexture.bind(s),r.batch.currentRenderer.start(),(o??r.background.clearBeforeRender)&&r.renderTexture.clear(),t.render(r),r.batch.currentRenderer.flush(),s&&(e.blit&&r.framebuffer.blit(),s.baseTexture.update()),r.runners.postrender.emit(),r.projection.transform=null,r.emit("postrender")}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Nh.extension={type:$.RendererSystem,name:"objectRenderer"};Z.add(Nh);var Hu=class Xg extends tn{constructor(t){super(),this.type=Um.WEBGL,t=Object.assign({},K.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new je({projectionMatrix:new Ct},!0);let e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:Xg.__systems,priority:["_view","textureGenerator","background","_plugin","startup","context","state","texture","buffer","geometry","framebuffer","transformFeedback","mask","scissor","stencil","projection","textureGC","filter","renderTexture","batch","objectRenderer","_multisample"]};this.setup(e),"useContextAlpha"in t&&(ht("7.0.0","options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead"),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!=="notMultiplied",t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=Xg.__plugins,this.options=t,this.startup.run(this.options)}static test(t){return t?.forceCanvas?!1:_g()}render(t,e){this.objectRenderer.render(t,e)}resize(t,e){this._view.resizeView(t,e)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(t=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return ht("7.0.0","renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead."),this.background.clearBeforeRender}get useContextAlpha(){return ht("7.0.0","renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead."),this.context.useContextAlpha}get preserveDrawingBuffer(){return ht("7.0.0","renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context"),this.context.preserveDrawingBuffer}get backgroundColor(){return ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color}set backgroundColor(t){ht("7.0.0","renderer.backgroundColor has been deprecated, use renderer.background.color instead."),this.background.color=t}get backgroundAlpha(){return ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha}set backgroundAlpha(t){ht("7.0.0","renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead."),this.background.alpha=t}get powerPreference(){return ht("7.0.0","renderer.powerPreference has been deprecated, we can only know this if pixi creates the context"),this.context.powerPreference}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}};Hu.extension={type:$.Renderer,priority:1},Hu.__plugins={},Hu.__systems={};var Vu=Hu;Z.handleByMap($.RendererPlugin,Vu.__plugins);Z.handleByMap($.RendererSystem,Vu.__systems);Z.add(Vu);var Mi=class extends Xe{constructor(t,e){let{width:r,height:s}=e||{};super(r,s),this.items=[],this.itemDirtyIds=[];for(let o=0;o<t;o++){let n=new ut;this.items.push(n),this.itemDirtyIds.push(-2)}this.length=t,this._load=null,this.baseTexture=null}initFromArray(t,e){for(let r=0;r<this.length;r++)t[r]&&(t[r].castToBaseTexture?this.addBaseTextureAt(t[r].castToBaseTexture(),r):t[r]instanceof Xe?this.addResourceAt(t[r],r):this.addResourceAt(No(t[r],e),r))}dispose(){for(let t=0,e=this.length;t<e;t++)this.items[t].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(t,e){if(!this.items[e])throw new Error(`Index ${e} is out of bounds`);return t.valid&&!this.valid&&this.resize(t.width,t.height),this.items[e].setResource(t),this}bind(t){if(this.baseTexture!==null)throw new Error("Only one base texture per TextureArray is allowed");super.bind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=t,this.items[e].on("update",t.update,t)}unbind(t){super.unbind(t);for(let e=0;e<this.length;e++)this.items[e].parentTextureArray=null,this.items[e].off("update",t.update,t)}load(){if(this._load)return this._load;let t=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{let{realWidth:e,realHeight:r}=this.items[0];return this.resize(e,r),this.update(),Promise.resolve(this)}),this._load}};var Dh=class extends Mi{constructor(t,e){let{width:r,height:s}=e||{},o,n;Array.isArray(t)?(o=t,n=t.length):n=t,super(n,{width:r,height:s}),o&&this.initFromArray(o,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Jr.TEXTURE_2D_ARRAY}upload(t,e,r){let{length:s,itemDirtyIds:o,items:n}=this,{gl:a}=t;r.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,e.format,r.type,null);for(let h=0;h<s;h++){let l=n[h];o[h]<l.dirtyId&&(o[h]=l.dirtyId,l.valid&&a.texSubImage3D(a.TEXTURE_2D_ARRAY,0,0,0,h,l.resource.width,l.resource.height,1,e.format,r.type,l.resource.source))}return!0}};var Lh=class extends Qt{constructor(t){super(t)}static test(t){let{OffscreenCanvas:e}=globalThis;return e&&t instanceof e?!0:globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement}};var GP=class Hh extends Mi{constructor(t,e){let{width:r,height:s,autoLoad:o,linkBaseTexture:n}=e||{};if(t&&t.length!==Hh.SIDES)throw new Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:s});for(let a=0;a<Hh.SIDES;a++)this.items[a].target=Jr.TEXTURE_CUBE_MAP_POSITIVE_X+a;this.linkBaseTexture=n!==!1,t&&this.initFromArray(t,e),o!==!1&&this.load()}bind(t){super.bind(t),t.target=Jr.TEXTURE_CUBE_MAP}addBaseTextureAt(t,e,r){if(r===void 0&&(r=this.linkBaseTexture),!this.items[e])throw new Error(`Index ${e} is out of bounds`);if(!this.linkBaseTexture||t.parentTextureArray||Object.keys(t._glTextures).length>0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Jr.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,r){let s=this.itemDirtyIds;for(let o=0;o<Hh.SIDES;o++){let n=this.items[o];(s[o]<n.dirtyId||r.dirtyId<e.dirtyId)&&(n.valid&&n.resource?(n.resource.upload(t,n,r),s[o]=n.dirtyId):s[o]<-1&&(t.gl.texImage2D(n.target,0,r.internalFormat,e.realWidth,e.realHeight,0,e.format,r.type,null),s[o]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===Hh.SIDES}};GP.SIDES=6;var jg=GP;var Vh=class i extends Qt{constructor(t,e){e=e||{};let r,s,o;typeof t=="string"?(r=i.EMPTY,s=t,o=!0):(r=t,s=null,o=!1),super(r),this.url=s,this.crossOrigin=e.crossOrigin??!0,this.alphaMode=typeof e.alphaMode=="number"?e.alphaMode:null,this.ownsImageBitmap=e.ownsImageBitmap??o,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(async(t,e)=>{if(this.url===null){t(this);return}try{let r=await K.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;let s=await r.blob();if(this.destroyed)return;let o=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ze.UNPACK?"premultiply":"none"});if(this.destroyed){o.close();return}this.source=o,this.update(),t(this)}catch(r){if(this.destroyed)return;e(r),this.onError.emit(r)}}),this._load)}upload(t,e,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,r)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){return i._EMPTY=i._EMPTY??K.ADAPTER.createCanvas(0,0),i._EMPTY}};var Yg=class Wu extends Qt{constructor(t,e){e=e||{},super(K.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Wu.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){let t=new Image;Qt.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;let e=t.width,r=t.height;if(!e||!r)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let s=e*this.scale,o=r*this.scale;(this._overrideWidth||this._overrideHeight)&&(s=this._overrideWidth||this._overrideHeight/r*e,o=this._overrideHeight||this._overrideWidth/e*r),s=Math.round(s),o=Math.round(o);let n=this.source;n.width=s,n.height=o,n._pixiId=`canvas_${ei()}`,n.getContext("2d").drawImage(t,0,0,e,r,0,0,s,o),this._resolve(),this._resolve=null}}static getSize(t){let e=Wu.SVG_SIZE.exec(t),r={};return e&&(r[e[1]]=Math.round(parseFloat(e[3])),r[e[5]]=Math.round(parseFloat(e[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Wu.SVG_XML.test(t)}};Yg.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,Yg.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var qg=Yg;var zu=class extends Qt{constructor(t){super(t)}static test(t){return!!globalThis.VideoFrame&&t instanceof globalThis.VideoFrame}};var Kg=class Zg extends Qt{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){let r=document.createElement("video");e.autoLoad!==!1&&r.setAttribute("preload","auto"),e.playsinline!==!1&&(r.setAttribute("webkit-playsinline",""),r.setAttribute("playsinline","")),e.muted===!0&&(r.setAttribute("muted",""),r.muted=!0),e.loop===!0&&r.setAttribute("loop",""),e.autoPlay!==!1&&r.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);let s=t[0].src||t[0];Qt.crossOrigin(r,s,e.crossorigin);for(let o=0;o<t.length;++o){let n=document.createElement("source"),{src:a,mime:h}=t[o];if(a=a||t[o],a.startsWith("data:"))h=a.slice(5,a.indexOf(";"));else if(!a.startsWith("blob:")){let l=a.split("?").shift().toLowerCase(),c=l.slice(l.lastIndexOf(".")+1);h=h||Zg.MIME_TYPES[c]||`video/${c}`}n.src=a,h&&(n.type=h),r.appendChild(n)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}update(t=0){if(!this.destroyed){if(this._updateFPS){let e=hr.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let t=this.source;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._onCanPlay():(t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlay),t.addEventListener("error",this._onError,!0)),this._load=new Promise((e,r)=>{this.valid?e(this):(this._resolve=e,this._reject=r,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){let t=this.source;return!t.paused&&!t.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);let e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();let t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(hr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(hr.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(hr.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Zg.TYPES.includes(e)}};Kg.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Kg.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};var Qg=Kg;fh.push(Vh,gs,Lh,Qg,zu,qg,hs,jg,Dh);var C2={vec3(i,t,e,r){(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2])&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],i.uniform3f(t,r[0],r[1],r[2]))},int(i,t,e,r){i.uniform1i(t,r)},ivec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},ivec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},ivec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},uint(i,t,e,r){i.uniform1ui(t,r)},uvec2(i,t,e,r){i.uniform2ui(t,r[0],r[1])},uvec3(i,t,e,r){i.uniform3ui(t,r[0],r[1],r[2])},uvec4(i,t,e,r){i.uniform4ui(t,r[0],r[1],r[2],r[3])},bvec2(i,t,e,r){i.uniform2i(t,r[0],r[1])},bvec3(i,t,e,r){i.uniform3i(t,r[0],r[1],r[2])},bvec4(i,t,e,r){i.uniform4i(t,r[0],r[1],r[2],r[3])},mat2(i,t,e,r){i.uniformMatrix2fv(t,!1,r)},mat4(i,t,e,r){i.uniformMatrix4fv(t,!1,r)}},P2={float(i,t,e,r){i.uniform1fv(t,r)},vec2(i,t,e,r){i.uniform2fv(t,r)},vec3(i,t,e,r){i.uniform3fv(t,r)},vec4(i,t,e,r){i.uniform4fv(t,r)},int(i,t,e,r){i.uniform1iv(t,r)},ivec2(i,t,e,r){i.uniform2iv(t,r)},ivec3(i,t,e,r){i.uniform3iv(t,r)},ivec4(i,t,e,r){i.uniform4iv(t,r)},uint(i,t,e,r){i.uniform1uiv(t,r)},uvec2(i,t,e,r){i.uniform2uiv(t,r)},uvec3(i,t,e,r){i.uniform3uiv(t,r)},uvec4(i,t,e,r){i.uniform4uiv(t,r)},bool(i,t,e,r){i.uniform1iv(t,r)},bvec2(i,t,e,r){i.uniform2iv(t,r)},bvec3(i,t,e,r){i.uniform3iv(t,r)},bvec4(i,t,e,r){i.uniform4iv(t,r)},sampler2D(i,t,e,r){i.uniform1iv(t,r)},samplerCube(i,t,e,r){i.uniform1iv(t,r)},sampler2DArray(i,t,e,r){i.uniform1iv(t,r)}};function UP(i,t,e,r,s){let o=0,n=null,a=null,h=s.gl;for(let l in i.uniforms){let c=t[l],u=r[l],d=e[l],f=i.uniforms[l];if(!c){f.group===!0&&s.shader.syncUniformGroup(u);continue}c.type==="float"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1f(d.location,u)):c.type==="bool"&&c.size===1&&!c.isArray?u!==d.value&&(d.value=u,h.uniform1i(d.location,Number(u))):(c.type==="sampler2D"||c.type==="samplerCube"||c.type==="sampler2DArray")&&c.size===1&&!c.isArray?(s.texture.bind(u,o),d.value!==o&&(d.value=o,h.uniform1i(d.location,o)),o++):c.type==="mat3"&&c.size===1&&!c.isArray?f.a!==void 0?h.uniformMatrix3fv(d.location,!1,u.toArray(!0)):h.uniformMatrix3fv(d.location,!1,u):c.type==="vec2"&&c.size===1&&!c.isArray?f.x!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y)&&(a[0]=n.x,a[1]=n.y,h.uniform2f(d.location,n.x,n.y))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1])&&(a[0]=n[0],a[1]=n[1],h.uniform2f(d.location,n[0],n[1]))):c.type==="vec4"&&c.size===1&&!c.isArray?f.width!==void 0?(a=d.value,n=u,(a[0]!==n.x||a[1]!==n.y||a[2]!==n.width||a[3]!==n.height)&&(a[0]=n.x,a[1]=n.y,a[2]=n.width,a[3]=n.height,h.uniform4f(d.location,n.x,n.y,n.width,n.height))):(a=d.value,n=u,(a[0]!==n[0]||a[1]!==n[1]||a[2]!==n[2]||a[3]!==n[3])&&(a[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],h.uniform4f(d.location,n[0],n[1],n[2],n[3]))):(c.size===1&&!c.isArray?C2:P2)[c.type].call(null,h,d.location,d.value,u)}}function R2(){Object.assign(Ri.prototype,{systemCheck(){},syncUniforms(i,t){let{shader:e,renderer:r}=this;UP(i,e.program.uniformData,t.uniformData,i.uniforms,r)}})}R2();var ne={Add:"add",Remove:"remove",Update:"update"},$u=class{init(t){throw new Error("Method not implemented.")}render(t){throw new Error("Method not implemented.")}},Bi=class{rendererName;rendererType;add=async(t,e,r)=>{throw new Error("Method not implemented.")};remove=async(t,e,r)=>{throw new Error("Method not implemented.")};update=async(t,e,r)=>{throw new Error("Method not implemented.")}};var Xu=(i=[],t=[])=>{let e=[],r=[],s=[],o=i.filter(a=>!a.hidden),n=t.filter(a=>!a.hidden);for(let a of o){let h=n.find(l=>l.id===a.id&&l.type===a.type);h?r.push({prev:a,next:h}):e.push(a)}for(let a of n)o.find(l=>l.id===a.id&&l.type===a.type)||s.push(a);for(let a of i){let h=t.find(l=>l.id===a.id&&l.type===a.type);h&&h.hidden&&!a.hidden&&e.push(a)}return{toDeleteElements:e,toUpdateElements:r,toAddElements:s}};var Ts=new(window.AudioContext||window.webkitAudioContext),on=class i{static loadedAssets={};static load=async(t,e)=>{if(!i.loadedAssets[t]&&e.byteLength!==0)try{let r=await Ts.decodeAudioData(e);i.loadedAssets[t]=r}catch(r){console.error(`AudioAsset.load: Failed to decode ${t}:`,r)}};static getAsset=t=>i.loadedAssets[t]},Jg=class{_audioSource;_gainNode;volume=1;id;url;loop=!1;constructor(t,e){this.id=t,this.url=e.url,this.loop=e.loop||!1,this.volume=e.volume??1,this._gainNode=Ts.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Ts.destination)}play=()=>{let t=on.getAsset(this.url);if(!t){console.warn("AudioPlayer.play: Asset not found",this.url);return}this._audioSource=Ts.createBufferSource(),this._audioSource.buffer=t,this._audioSource.loop=this.loop,this._gainNode.gain.setValueAtTime(this.volume,Ts.currentTime),this._audioSource.connect(this._gainNode),this._audioSource.start(0)};stop=()=>{this._audioSource&&(this._audioSource.stop(),this._audioSource.disconnect(),this._gainNode.disconnect(),this._gainNode=Ts.createGain(),this._gainNode.gain.value=this.volume,this._gainNode.connect(Ts.destination))}},ju=class{audioPlayers=[];stageAudios=[];add=t=>{this.stageAudios.push(t)};remove=t=>{this.stageAudios=this.stageAudios.filter(e=>e.id!==t)};getById=t=>this.stageAudios.find(e=>e.id===t);tick=()=>{for(let e of this.stageAudios){let r=this.audioPlayers.find(s=>s.id===e.id);if(!r){let s=new Jg(e.id,{url:e.url,loop:e.loop,volume:e.volume??1});this.audioPlayers.push(s),s.play();return}(r.url!==e.url||r.loop!==e.loop)&&(r.stop(),r.url=e.url,r.loop=e.loop??!1,r.play()),r.volume!==(e.volume??1)&&(r.volume=e.volume??1,r._gainNode.gain.value=r.volume)}let t=[];for(let e of this.audioPlayers)this.stageAudios.find(r=>r.id===e.id)||(e.stop(),t.push(e.id));this.audioPlayers=this.audioPlayers.filter(e=>!t.includes(e.id))};destroy=()=>{for(let t of this.audioPlayers)t.stop();this.audioPlayers=[],this.stageAudios=[]}};var M2=i=>i.split("/").pop(),tx=class{name="advancedBufferLoader";priority=2;constructor(t){this.bufferMap=t}test(t){return!0}async load(t){let e=t.startsWith("file:")?t:M2(t),r=this.bufferMap[e];if(!r)throw new Error(`Buffer not found for key: ${e}`);return{data:r.buffer,type:r.type,metadata:null}}async testParse(t){return!0}async parse(t){if(t instanceof I)return t;let e=new Blob([t.data],{type:t.type}),r=await createImageBitmap(e);return new I.from(r)}async unload(t){t.destroy(!0)}},ex=class i extends $u{static rendererName="pixi";_app;_audioStage=new ju;_state={elements:[],transitions:[]};_eventHandler;_plugins;_currentAbortController;_advancedLoader;get canvas(){return this._app.canvas}init=async t=>{let{eventHandler:e,plugins:r,width:s,height:o,backgroundColor:n}=t;for(let h of r)if(h.rendererName!==i.rendererName)throw new Error("Plugin does not match renderer name");this._plugins=r,this._eventHandler=e,this._app=new Vc,this._app.audioStage=this._audioStage,await this._app.init({width:s,height:o,backgroundColor:n});let a=new we;return a.rect(0,0,s,o),a.fill(n||0),this._app.stage.addChild(a),this._app.stage.width=s,this._app.stage.height=o,this._app.ticker.add(this._app.audioStage.tick),this};destroy=()=>{this._app.audioStage.destroy(),this._app.destroy()};_classifyAsset=t=>t?t.startsWith("audio/")?"audio":t.startsWith("font/")||["application/font-woff","application/font-woff2","application/x-font-ttf","application/x-font-otf"].includes(t)?"font":"texture":"texture";loadAssets=async t=>{if(!t)throw new Error("assetBufferMap is required");let e={audio:{},font:{},texture:{}};for(let[s,o]of Object.entries(t)){let n=this._classifyAsset(o.type);e[n][s]=o}await Promise.all(Object.entries(e.audio).map(([s,o])=>on.load(s,o.buffer))),await Promise.all(Object.entries(e.font).map(async([s,o])=>{let n=new Blob([o.buffer],{type:o.type}),a=URL.createObjectURL(n),h=new FontFace(s,`url(${a})`);try{await h.load(),document.fonts.add(h),console.log(`Font loaded successfully: ${s}`)}catch(l){console.error(`Failed to load font ${s}:`,l)}finally{URL.revokeObjectURL(a)}})),this._advancedLoader?Object.assign(this._advancedLoader.bufferMap,e.texture):(this._advancedLoader=new tx(e.texture),mr.loader.parsers.length=0,mr.reset(),D.add({name:"advanced-buffer-loader",extension:y.Asset,priority:re.High,loader:this._advancedLoader}),typeof mr.registerPlugin=="function"&&mr.registerPlugin(this._advancedLoader));let r=Object.keys(e.texture);return Promise.all(r.map(s=>mr.load(s)))};loadAudioAssets=async t=>Promise.all(t.map(async e=>{let s=await(await fetch(e)).arrayBuffer();return on.load(e,s)}));updatedBackgroundColor=t=>{this._app.renderer.background.color=t};getStageElementBounds=()=>{let t={},e=r=>{if(!(!r||r.length===0))for(let s of r)t[s.label]={x:s.groupTransform.tx,y:s.groupTransform.ty,width:s.width,height:s.height},e(s.children)};return e(this._app.stage.children),t};render=t=>{this._render(this._app,this._app.stage,this._state,t,this._eventHandler),this._state=t};_getRendererByElement=t=>{for(let e of this._plugins)if(e.rendererType===t.type)return e;throw new Error(`No renderer found for element type: ${t.type}`)};_getTransitionByType=t=>{for(let e of this._plugins)if(e.transitionType===t)return e;throw new Error(`No transition found for transition type: ${t}`)};_applyGlobalCursorStyles=(t,e,r)=>{t.renderer.events.cursorStyles||(t.renderer.events.cursorStyles={}),t.renderer.events.cursorStyles.default||(t.renderer.events.cursorStyles.default="default"),t.renderer.events.cursorStyles.hover||(t.renderer.events.cursorStyles.hover="pointer");let s=e?.cursorStyles,o=r?.cursorStyles;JSON.stringify(s)!==JSON.stringify(o)&&(o?(o.default&&(t.renderer.events.cursorStyles.default=o.default,t.canvas.style.cursor=o.default),o.hover&&(t.renderer.events.cursorStyles.hover=o.hover)):s&&(t.renderer.events.cursorStyles.default="default",t.renderer.events.cursorStyles.hover="pointer"))};_render=async(t,e,r,s,o)=>{let n=Date.now();this._applyGlobalCursorStyles(t,r.global,s.global);let{toAddElements:a,toUpdateElements:h,toDeleteElements:l}=Xu(r.elements,s.elements);this._currentAbortController&&this._currentAbortController.abort(),this._currentAbortController=new AbortController;let c=this._currentAbortController.signal,u=[];for(let d of l){let f=this._getRendererByElement(d);u.push(()=>f.remove(t,{parent:e,element:d,elements:s.elements,transitions:s.transitions,getRendererByElement:this._getRendererByElement,getTransitionByType:this._getTransitionByType,eventHandler:o},c))}for(let d of a){let f=this._getRendererByElement(d);u.push(()=>f.add(t,{parent:e,element:d,elements:s.elements,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},c))}for(let d of h){let f=this._getRendererByElement(d.next);u.push(()=>f.update(t,{parent:e,prevElement:d.prev,nextElement:d.next,elements:s.elements,getRendererByElement:this._getRendererByElement,transitions:s.transitions,getTransitionByType:this._getTransitionByType,eventHandler:o},c))}try{await Promise.all(u.map(d=>d())),t.stage.children.sort((d,f)=>{let p=s.elements.find(x=>x.id===d.label),g=s.elements.find(x=>x.id===f.label);if(p&&g){let x=p.zIndex??0,v=g.zIndex??0;if(x!==v)return x-v;let _=s.elements.findIndex(T=>T.id===d.label),b=s.elements.findIndex(T=>T.id===f.label);return _-b}if(!p&&!g)return 0;if(!p)return-1;if(!g)return 1}),o&&o("completed",{id:s.id,diffTime:Date.now()-n})}catch(d){if(d.name==="AbortError")return;throw console.error("Error:",d),d}finally{this._currentAbortController=void 0}}},kP=ex;var rx=class extends Bi{static rendererName="pixi";rendererName="pixi";rendererType="sprite";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:h,elements:l=[]}=e,c=o.url?I.from(o.url):I.EMPTY,u,d,f=o.scaleX??1,p=o.scaleY??1;o.hoverUrl&&(u=I.from(o.hoverUrl)),o.clickUrl&&(d=I.from(o.clickUrl));let g=new de(c);g.label=o.id,g.interactiveChildren=!1,(o.eventName||o.hoverUrl||o.clickUrl)&&(g.cursor="hover",g.eventMode="static"),o.width!==void 0?g.width=o.width*f:g.width*=f,o.height!==void 0?g.height=o.height*p:g.height*=p,o.anchorX!==void 0&&(g.pivot.x=g.width*o.anchorX),o.anchorY!==void 0&&(g.pivot.y=g.height*o.anchorY),o.rotation!==void 0&&(g.rotation=o.rotation*Math.PI/180),o.x!==void 0&&(g.x=o.x),o.y!==void 0&&(g.y=o.y),o.zIndex!==void 0&&(g.zIndex=o.zIndex),o.alpha!==void 0&&(g.alpha=o.alpha),(u||d)&&g.on("pointerup",()=>{g.texture=c}).on("pointerupoutside",()=>{g.texture=c}).on("pointerleave",()=>{g.texture=c}),d&&g.on("pointerdown",()=>{g.texture=d}),u&&g.on("pointerenter",()=>{g.texture=u}),g.on("pointerup",v=>{v.stopPropagation();let _=v.button;_===0?h&&h(o.eventName,o.eventPayload):_===2&&(o.rightClickEventName&&h?h(o.rightClickEventName):t.stage.emit("rightclick",event))});let x=[];for(let v of n)if(v.elementId===o.id&&v.event===ne.Add){let _=a(v.type);if(!_)throw new Error(`Transition class not found for type ${v.type}`);x.push(_.add(t,g,v,r))}s.addChild(g),Array.isArray(l)&&l.length>0&&s.children.sort((v,_)=>{let b=l.find(E=>E.id===v.label),T=l.find(E=>E.id===_.label);if(b&&T){let E=b.zIndex??0,A=T.zIndex??0;if(E!==A)return E-A;let C=l.findIndex(P=>P.id===v.label),M=l.findIndex(P=>P.id===_.label);return C-M}if(!b&&!T)return 0;if(!b)return-1;if(!T)return 1}),await Promise.all(x)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,h=s.getChildByName(o.id);if(!h)throw new Error(`Sprite with id ${o.id} not found`);let l=[];for(let c of n)if(c.elementId===o.id&&c.event===ne.Remove){let u=a(c.type);if(!u)throw new Error(`Transition class not found for type ${c.type}`);l.push(u.remove(t,h,c,r))}await Promise.all(l),h&&h.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},h)=>{if(h?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Sprite with id ${r.id} not found`);let c=[];for(let f of o)if(f.elementId===r.id&&f.event===ne.Update){let p=n(f.type);if(!p)throw new Error(`Transition class not found for type ${f.type}`);c.push(p.add(t,l,f,h))}c.length>0?(await Promise.all(c),u()):d();function u(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let x=I.from(s.url);if(l.texture=x,!r.url&&s.url)if(x.baseTexture.valid){let v=s.scaleX??1,_=s.scaleY??1;l.width=(s.width??x.width)*v,l.height=(s.height??x.height)*_}else x.baseTexture.once("loaded",()=>{let v=s.scaleX??1,_=s.scaleY??1;l.width=(s.width??x.width)*v,l.height=(s.height??x.height)*_})}let p=r.hoverUrl||r.clickUrl,g=s.hoverUrl||s.clickUrl;if(!p&&g){let x=l.texture;l.on("pointerup",()=>{l.texture=x}).on("pointerupoutside",()=>{l.texture=x}).on("pointerleave",()=>{l.texture=x})}if(s.hoverUrl){let x=I.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=x})}if(s.clickUrl){let x=I.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=x})}}(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="hover",l.eventMode="static")}function d(){if(r.url!==s.url||r.hoverUrl!==s.hoverUrl||r.clickUrl!==s.clickUrl){if(s.url){let _=I.from(s.url);if(l.texture=_,!r.url&&s.url)if(_.baseTexture.valid){let b=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??_.width)*b,l.height=(s.height??_.height)*T}else _.baseTexture.once("loaded",()=>{let b=s.scaleX??1,T=s.scaleY??1;l.width=(s.width??_.width)*b,l.height=(s.height??_.height)*T})}let x=r.hoverUrl||r.clickUrl,v=s.hoverUrl||s.clickUrl;if(!x&&v){let _=l.texture;l.on("pointerup",()=>{l.texture=_}).on("pointerupoutside",()=>{l.texture=_}).on("pointerleave",()=>{l.texture=_})}if(s.hoverUrl){let _=I.from(s.hoverUrl);l.off("pointerenter"),l.on("pointerenter",()=>{l.texture=_})}if(s.clickUrl){let _=I.from(s.clickUrl);l.off("pointerdown"),l.on("pointerdown",()=>{l.texture=_})}}s.x!==void 0&&s.x!==r.x&&(l.x=s.x),s.y!==void 0&&s.y!==r.y&&(l.y=s.y),s.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let p=s.scaleX??1,g=s.scaleY??1;s.width!==void 0&&(s.width!==r.width||p!==(r.scaleX??1))&&(l.width=s.width*p),s.height!==void 0&&(s.height!==r.height||g!==(r.scaleY??1))&&(l.height=s.height*g),s.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=l.width*s.anchorX/p),s.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=l.height*s.anchorY/g),s.zIndex!==void 0&&s.zIndex!==r.zIndex&&(l.zIndex=s.zIndex),s.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),(s.eventName||s.hoverUrl||s.clickUrl)&&(l.cursor="hover",l.eventMode="static")}}};var Yu=i=>new Kt({wordWrap:i.wordWrap||!0,breakWords:i.breakWords||!1,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),ix=class{static rendererName="pixi";rendererName="pixi";rendererType="text";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:h}=e,l=Yu(o.style),c=new Qr({text:o.text,style:l}),u;o.hoverStyle&&(u=Yu(o.hoverStyle));let d;if(o.clickedStyle&&(d=Yu(o.clickedStyle)),(o.eventName||o.clickedStyle||o.hoverStyle)&&(c.cursor="hover",c.eventMode="static"),c.label=o.id,o.x!==void 0&&(c.x=o.x),o.y!==void 0&&(c.y=o.y),o.anchorX!==void 0&&(c.anchor.x=o.anchorX),o.anchorY!==void 0&&(c.anchor.y=o.anchorY),o.anchorX!==void 0||o.anchorY!==void 0){let p=c.getLocalBounds();c.hitArea=new rt(-p.width*c.anchor.x,-p.height*c.anchor.y,p.width,p.height)}c.on("pointerout",()=>{c.isOver=!1}).on("pointerupoutside",()=>{c.style=l}).on("pointerup",()=>{c.style=l}).on("pointerleave",()=>{c.style=l}),c.on("pointerup",p=>{o.clickSoundUrl&&t.soundStage&&t.soundStage.add({id:`${o.id}-click-${Math.random()}`,url:o.clickSoundUrl,loop:!1,volume:o.clickSoundVolume??50/100}),p.stopPropagation(),h&&h(o.eventName,o.eventPayload)}),d&&c.on("pointerdown",()=>{c.style=d}),u&&c.on("pointerenter",()=>{c.style=u,o.hoverSoundUrl&&t.soundStage&&o.hoverSoundVolume!==void 0&&t.soundStage.add({id:`${o.id}-hover-${Math.random()}`,url:o.hoverSoundUrl,loop:!1,volume:o.hoverSoundVolume/100})});let f=[];for(let p of n)if(p.elementId===o.id&&p.event===ne.Add){let g=a(p.type);if(!g)throw new Error(`Transition class not found for type ${p.type}`);f.push(g.add(t,c,p,r))}s.addChild(c),await Promise.all(f)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,h=s.getChildByName(o.id);if(!h){console.warn(`Text with id ${o.id} not found`);return}let l=[];for(let c of n)if(c.elementId===o.id&&c.event===ne.Remove){let u=a(c.type);if(!u)throw new Error(`Transition class not found for type ${c.type}`);l.push(u.remove(t,h,c,r))}await Promise.all(l),h&&h.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,transitions:a,getTransitionByType:h,eventHandler:l}=e,c=s.getChildByName(o.id);if(!c){console.warn(`Text with id ${o.id} not found`);return}if(JSON.stringify(o)!==JSON.stringify(n)){let u=[this.add(t,{parent:s,element:n,transitions:a,getTransitionByType:h,eventHandler:l},r),this.remove(t,{parent:s,element:o,transitions:a,getTransitionByType:h},r)];await Promise.all(u)}else o.text!==n.text&&(c.text=n.text),JSON.stringify(o.style)!==JSON.stringify(n.style)&&(c.style=Yu(n?.style)),n.x!==void 0&&(c.x=n.x),n.y!==void 0&&(c.y=n.y)}};var Jt=(i,t=!1)=>new Kt({wordWrap:i.wordWrap||!0,breakWords:t,align:i.align,fill:i.fill,fontSize:i.fontSize,lineHeight:i.lineHeight,wordWrapWidth:i.wordWrapWidth,fontFamily:i.fontFamily||"Roboto",whiteSpace:"pre",trim:!1,stroke:i.strokeColor?{color:i.strokeColor,width:i.strokeWidth}:void 0}),sx=class{static rendererName="pixi";rendererName="pixi";rendererType="text-revealing";add=async(t,{parent:e,element:r})=>{let s=r.content?.[0]?.text||"",o=Jt(r.style,s),n=new Qr({text:"",style:o});n.label=r.id,n.text_id=s;let a=new Et;r.x!==void 0&&(a.x=r.x),r.y!==void 0&&(a.y=r.y),a.addChild(n),a.label=r.id,e.addChild(a);let h=r.style.wordWrapWidth||500,l=r.content&&r.content.length>0?r.content.map(E=>({text:E.text.replace(/ +$/,A=>"\xA0".repeat(A.length)),style:E.style?{...r.style,...E.style}:r.style,align:E.align||r.align||"top",furigana:E.furigana})):r.segments,c=[];if(l.length===1){let E=[],A=0,C=0,M=0,P=[...l];for(;;){let S=P[0];if(!S){E.length>0&&c.push({lineParts:E,y:C});break}if(C>1e4)break;let w={...S.style,wordWrapWidth:h-A},B=_t.measureText(S.text,Jt(w));B.lineHeight>M&&(M=B.lineHeight);let F=_t.measureText("a",Jt(w)),z=_t.measureText("a a",Jt(w)).width-F.width*2;if(B.lineWidths[0]+A>h){A=0,c.push({lineParts:E,y:C}),C+=M,M=0,E=[];continue}let k=B.lines[0];B.lines.length===1&&S.text.endsWith(" ")&&!k.endsWith(" ")&&(k+=" ");let G=B.lines.slice(1).join(" "),N={text:k,style:w,x:A,y:0,align:S.align};if(E.push(N),G&&G.length>0?S.text=G:P.shift(),!(!k||k.length===0)){if(S.furigana){let O=_t.measureText(S.furigana.text,Jt(S.furigana.style)),Y={text:S.furigana.text,style:S.furigana.style,x:A+(B.width-O.width)/2,y:-10};E.push(Y)}A+=B.lineWidths[0]+z}}}else{let E=[],A=0,C=0,M=0,P=[...l],S=new WeakSet;for(;;){let w=P[0];if(!w){E.length>0&&c.push({lineParts:E,y:C});break}if(C>1e4)break;let B={...w.style,wordWrapWidth:h-A},F=_t.measureText(w.text,Jt(B));F.lineHeight>M&&(M=F.lineHeight);let W=_t.measureText("a",Jt(B)),k=_t.measureText("a a",Jt(B)).width-W.width*2;if(F.lineWidths[0]+A>h){A=0,c.push({lineParts:E,y:C}),C+=M,M=0,E=[];continue}let G=F.lines[0];F.lines.length===1&&w.text.endsWith(" ")&&!G.endsWith(" ")&&(G+=" ");let N=F.lines.slice(1).join(" "),O={text:G,style:B,x:A,y:0,align:w.align};if(E.push(O),N&&N.length>0?w.text=N:P.shift(),!(!G||G.length===0)){if(w.furigana&&!S.has(w)){S.add(w);let Y=_t.measureText(w.furigana.text,Jt(w.furigana.style)),lt={text:w.furigana.text,style:w.furigana.style,x:A+(F.lineWidths[0]-Y.width)/2,y:0,isFurigana:!0,parentAlign:w.align,parentX:A,parentWidth:F.lineWidths[0]};E.push(lt)}A+=F.lineWidths[0]}}}c.forEach(E=>{let A=new Et;A.y=E.y,A.alpha=0;let C=0;E.lineParts.forEach(P=>{let S=_t.measureText(P.text,Jt(P.style));S.height>C&&(C=S.height)});let M=new Map;E.lineParts.forEach(P=>{if(!P.isFurigana){let S=_t.measureText(P.text,Jt(P.style)),w=P.y,B=P.align||"top";B==="center"?w+=(C-S.height)/2:B==="bottom"&&(w+=C-S.height);let F=new Qr({text:P.text,style:Jt(P.style),x:P.x,y:w});A.addChild(F),M.set(P.x,{yOffset:w,height:S.height})}}),E.lineParts.forEach(P=>{if(P.isFurigana){let S=_t.measureText(P.text,Jt(P.style)),w=M.get(P.parentX),B=-S.height-5;w&&(B=w.yOffset-S.height+2);let F=new Qr({text:P.text,style:Jt(P.style),x:P.x,y:B});A.addChild(F)}}),a.addChild(A)});let u=new we,d=1e3,f=h/2,p=h/2;u.fill({color:16777215,alpha:1}),u.rect(0,0,f,d);for(let E=0;E<p;E++)u.fill({color:16777215,alpha:1-E/p}),u.rect(f+E,0,f+1,d);let g=t.renderer.generateTexture(u),x=new de(g);x.x=-1.35*f-p,t.stage.addChild(x);let v=null,_=null;if(r.indicator?.revealing?.url){let E=I.from(r.indicator.revealing.url);v=new de(E),v.anchor.set(0,.5),v.visible=!1,r.indicator.revealing.width!==void 0&&(v.width=r.indicator.revealing.width),r.indicator.revealing.height!==void 0&&(v.height=r.indicator.revealing.height),a.addChild(v)}if(r.indicator?.complete?.url){let E=I.from(r.indicator.complete.url);_=new de(E),_.anchor.set(0,.5),_.visible=!1,r.indicator.complete.width!==void 0&&(_.width=r.indicator.complete.width),r.indicator.complete.height!==void 0&&(_.height=r.indicator.complete.height),a.addChild(_)}let b=0,T=1;if(c.length!==0){if(r.displaySpeed===100||r.hasEnded){if(a.children.forEach(E=>{t.stage.removeChild(x),E.mask=null,E.alpha=1}),_&&(_.visible=!0,c.length>0)){let E=c[c.length-1],A=0,C=E.y;E.lineParts.forEach(M=>{if(!M.isFurigana){let P=_t.measureText(M.text,Jt(M.style)),S=M.x+P.width;S>A&&(A=S)}}),_.x=A+10,_.y=C+20}return}await new Promise(E=>{let A=C=>{if(T>a.children.length){if(v&&(v.visible=!1),_&&(_.visible=!0,c.length>0)){let S=c[c.length-1],w=0,B=S.y;S.lineParts.forEach(F=>{if(!F.isFurigana){let W=_t.measureText(F.text,Jt(F.style)),z=F.x+W.width;z>w&&(w=z)}}),_.x=w+10,_.y=B+20}E();return}a.getChildAt(T).mask||(a.getChildAt(T).mask=x,a.getChildAt(T).alpha=1),b+=C.deltaMS;let P=(r.displaySpeed||50)/1e3;if(x.x+=P*b,v&&T<=c.length){let S=c[T-1];if(S&&(a.getChildAt(T).mask===x||T===c.length)){v.visible=!0;let B=x.x+f+p+150,F=0,W=!1,z=!0,k=0;for(let G of S.lineParts)if(!G.isFurigana){let N=_t.measureText(G.text,Jt(G.style));k=Math.max(k,G.x+N.width)}for(let G of S.lineParts)if(!G.isFurigana){let N=_t.measureText(G.text,Jt(G.style)),O=G.x,Y=G.x+N.width;if(Y<=B)F=Y,W=!0;else if(O<B){F=Math.max(O,B),W=!0,z=!1;break}else z=!1}B>=k&&(z=!0),W&&F>0?(v.x=F,v.y=S.y+20):T===c.length&&k>0?(v.x=k,v.y=S.y+20):v.visible=!1,_&&(_.visible=!1)}else v.visible=!1}if(x.x>=0&&(a.getChildAt(T).mask=null,x.x=-1.35*f-p,T=T+1,b=0,T===a.children.length)){if(v&&(v.visible=!1),_&&(_.visible=!0,c.length>0)){let S=c[c.length-1],w=0,B=S.y;S.lineParts.forEach(F=>{if(!F.isFurigana){let W=_t.measureText(F.text,Jt(F.style)),z=F.x+W.width;z>w&&(w=z)}}),_.x=w+10,_.y=B+20}t.ticker.remove(A),E()}};t.ticker.add(A)})}};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Text with id ${s.id} not found`,{parent:r});return}let h=[];for(let l of o)if(l.elementId===s.id&&l.event===ne.Remove){let c=n(l.type);if(!c)throw new Error(`Transition class not found for type ${l.type}`);h.push(c.remove(t,a,l))}await Promise.all(h),a.destroy()};update=async(t,e)=>{let{parent:r,prevElement:s,nextElement:o}=e;if(!r.getChildByName(s.id)){console.warn(`Text with id ${s.id} not found`,{parent:r});return}await this.remove(t,{parent:r,element:s}),await this.add(t,{parent:r,element:o})}};var ox=class{static rendererName="pixi";rendererName="pixi";rendererType="container";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,elements:n=[],transitions:a=[],getTransitionByType:h,getRendererByElement:l,eventHandler:c}=e,u=structuredClone(o),d=new Et;d.label=u.id;let f={};u.x!==void 0&&(typeof u.x=="string"&&u.x.endsWith("%")?d.x=Number(u.x.replace("%",""))*t.screen.width/100:d.x=u.x),u.y!==void 0&&(typeof u.y=="string"&&u.y.endsWith("%")?d.y=Number(u.y.replace("%",""))*t.screen.height/100:d.y=u.y),u.scaleX!==void 0&&(d.scale.x=u.scaleX),u.scaleY!==void 0&&(d.scale.y=u.scaleY),u.zIndex!==void 0&&(d.zIndex=u.zIndex),u.rotation!==void 0&&(d.rotation=u.rotation*Math.PI/180),u.propagateEvents&&(d.eventMode="static",["pointerup","pointerupoutside","pointerleave","pointerdown","pointerenter"].forEach(P=>{d.on(P,S=>{S.stopPropagation();for(let w of d.children)w.emit(P)})}));let p=u.gap||0,g=new we().roundRect(0,0,u.width||0,u.height||0,1).fill(u.fill?u.fill.color:"transparent"),x=[0,.5,1],v=u.anchorX??0,_=u.anchorY??0;if(!x.includes(v))throw new Error(`Invalid anchorX value: ${v}. Must be 0, 0.5, or 1`);if(!x.includes(_))throw new Error(`Invalid anchorY value: ${_}. Must be 0, 0.5, or 1`);if(u.direction){let P,S;u.direction==="horizontal"?(P=u.children.reduce((B,F,W)=>B+F.width+(W>0?p:0),0),S=u.children.reduce((B,F)=>Math.max(B,F.height||0),0)):u.direction==="vertical"&&(P=u.children.reduce((B,F)=>Math.max(B,F.width||0),0),S=u.children.reduce((B,F,W)=>B+F.height+(W>0?p:0),0));let w={x:v,y:_};u.direction==="horizontal"?this.layoutChildren({element:u,anchor:w,totalWidth:P,totalHeight:S,gap:p,direction:"horizontal",scroll:u.scroll}):u.direction==="vertical"&&this.layoutChildren({element:u,anchor:w,totalWidth:P,totalHeight:S,gap:p,direction:"vertical",scroll:u.scroll}),this.setupScrolling({container:d,element:u,totalHeight:S,totalWidth:P,eventHandler:c,sliderRef:f}),g=this.createContainerGraphic(u,P,S,w)}g.label=`${u.id}-container-background`,d.addChild(g);let b=[];(u.children||[]).forEach(P=>{let S=l(P),w=u.width||0,B=u.height||0,F=v*w,W=_*B,z={zIndex:u.zIndex,...P,x:(P.x||0)+F,y:(P.y||0)+W};b.push(S.add(t,{parent:d,element:z,elements:u.children||[],transitions:a,getTransitionByType:h,getRendererByElement:l,eventHandler:c},r))});let T=[];for(let P of a)if(P.elementId===u.id&&P.event===ne.Add){let S=h(P.type);if(!S)throw new Error(`Transition class not found for type ${P.type}`);T.push(S.add(t,d,P,r))}s.addChild(d),await Promise.all([...b,...T]);let{width:E,height:A}=this.getContainerDimensions(u,d),C=v*E,M=_*A;d.pivot.x=C,d.pivot.y=M};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");console.log("remove container 11111111111");let{parent:s,element:o}=e,n=s.getChildByName(o.id);if(!n){console.warn(`Container with id ${o.id} not found`);return}n.destroy()};update=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,prevElement:o,nextElement:n,elements:a=[],getRendererByElement:h,transitions:l=[],getTransitionByType:c,eventHandler:u}=e,d=structuredClone(o),f=structuredClone(n),p=s.getChildByName(d.id);if(!p){console.warn(`Container with id ${d.id} not found`);return}f.x!==void 0&&(p.x=f.x),f.y!==void 0&&(p.y=f.y),f.rotation!==void 0&&f.rotation!==d.rotation&&(p.rotation=f.rotation*Math.PI/180);let g=[0,.5,1],x=f.anchorX??0,v=f.anchorY??0;if(!g.includes(x))throw new Error(`Invalid anchorX value: ${x}. Must be 0, 0.5, or 1`);if(!g.includes(v))throw new Error(`Invalid anchorY value: ${v}. Must be 0, 0.5, or 1`);if(f.direction){let S=f.gap||0,w,B;f.direction==="horizontal"?(w=f.children.reduce((z,k,G)=>z+k.width+(G>0?S:0),0),B=f.children.reduce((z,k)=>Math.max(z,k.height||0),0)):f.direction==="vertical"&&(w=f.children.reduce((z,k)=>Math.max(z,k.width||0),0),B=f.children.reduce((z,k,G)=>z+k.height+(G>0?S:0),0));let F={x,y:v};f.direction==="horizontal"?this.layoutChildren({element:f,anchor:F,totalWidth:w,totalHeight:B,gap:S,direction:"horizontal",scroll:f.scroll}):f.direction==="vertical"&&this.layoutChildren({element:f,anchor:F,totalWidth:w,totalHeight:B,gap:S,direction:"vertical",scroll:f.scroll});let W=p.children.find(z=>z.label===`${f.id}-container-background`);if(W){W.destroy();let z=this.createContainerGraphic(f,w,B,F);z.label=`${f.id}-container-background`,p.addChildAt(z,0)}d.scroll!==f.scroll&&this.setupScrolling({container:p,element:f,totalHeight:B,totalWidth:w,eventHandler:u,sliderRef:{}})}let _=[],{toAddElements:b,toUpdateElements:T,toDeleteElements:E}=Xu(d.children,f.children);if(f.direction&&f.children){let S=new Map;f.children.forEach(w=>{S.set(w.id,{x:w.x,y:w.y})}),T.forEach(w=>{let B=S.get(w.next.id);B&&(w.next.x=B.x,w.next.y=B.y)}),b.forEach(w=>{let B=S.get(w.id);B&&(w.x=B.x,w.y=B.y)})}for(let S of E){let w=h(S);_.push(w.remove(t,{parent:p,element:S,elements:f.children||[],transitions:l,getTransitionByType:c,getRendererByElement:h,eventHandler:u},r))}for(let S of b){let w=h(S),B=f.width||0,F=f.height||0,W=x*B,z=v*F,k={...S,x:(S.x||0)+W,y:(S.y||0)+z};_.push(w.add(t,{parent:p,element:k,elements:f.children||[],transitions:l,getTransitionByType:c,getRendererByElement:h,eventHandler:u},r))}for(let S of T){let w=h(S.next),B=f.width||0,F=f.height||0,W=x*B,z=v*F,k=d.anchorX??0,G=d.anchorY??0,N=d.width||0,O=d.height||0,Y=k*N,lt=G*O,yt={...S.prev,x:(S.prev.x||0)+Y,y:(S.prev.y||0)+lt},It={...S.next,x:(S.next.x||0)+W,y:(S.next.y||0)+z};_.push(w.update(t,{parent:p,prevElement:yt,nextElement:It,elements:f.children||[],transitions:l,getTransitionByType:c,getRendererByElement:h,eventHandler:u},r))}f.children&&f.children.length>0&&p.children.sort((S,w)=>{let B=f.children.find(W=>W.id===S.label),F=f.children.find(W=>W.id===w.label);if(B&&F){let W=B.zIndex??0,z=F.zIndex??0;if(W!==z)return W-z;let k=f.children.indexOf(B),G=f.children.indexOf(F);return k-G}if(!B&&!F)return 0;if(!B)return-1;if(!F)return 1}),await Promise.all(_);let{width:A,height:C}=this.getContainerDimensions(f,p),M=x*A,P=v*C;p.pivot.x=M,p.pivot.y=P};layoutChildren({element:t,anchor:e,totalWidth:r,totalHeight:s,gap:o,direction:n,scroll:a}){let h=n==="horizontal",l=h?"x":"y",c=h?"y":"x",u=h?"width":"height",d=h?"height":"width",f=h?r:s,p=h?s:r,g=h?e.x:e.y,x=h?e.y:e.x;if(!a&&t[u]!==void 0&&t[u]<f){let _=0,b=0,T=0,E=0;(t.children||[]).forEach((A,C)=>{_>0&&_+A[u]>t[u]&&(this.alignRowElements(t.children.slice(E,C),l,g,t[u]),_=0,b+=T+o,T=0,E=C),A[l]=_,A[c]=b,_+=A[u],C<t.children.length-1&&(_+=o),T=Math.max(T,A[d]||0)}),E<t.children.length&&this.alignRowElements(t.children.slice(E),l,g,t[u])}else{if(g===0){let _=0;(t.children||[]).forEach((b,T)=>{let E=b[u]||0,A=h?b.anchorX||0:b.anchorY||0;b[l]=_+E*A,_+=E,T<t.children.length-1&&(_+=o)})}else if(g===1){let _=-f;(t.children||[]).forEach((b,T)=>{let E=b[u]||0,A=h?b.anchorX||0:b.anchorY||0;b[l]=_+E*A,_+=E,T<t.children.length-1&&(_+=o)})}else if(g===.5){let _=-f/2;(t.children||[]).forEach((b,T)=>{let E=b[u]||0,A=h?b.anchorX||0:b.anchorY||0;b[l]=_+E*A,_+=E,T<t.children.length-1&&(_+=o)})}x===0?(t.children||[]).forEach(_=>{let b=_[d]||0,T=h?_.anchorY||0:_.anchorX||0;_[c]=b*T}):x===.5?(t.children||[]).forEach(_=>{let b=_[d]||0,T=h?_.anchorY||0:_.anchorX||0;_[c]=-b/2+b*T}):x===1&&(t.children||[]).forEach(_=>{let b=_[d]||0,T=h?_.anchorY||0:_.anchorX||0;_[c]=-b+b*T})}}alignRowElements(t,e,r,s){if(!t.length)return;let o=t.reduce((n,a,h)=>n+a[e==="x"?"width":"height"]+(h>0,0),0);if(r===.5){let a=(s-o)/2;t.forEach(h=>{h[e]=a,a+=h[e==="x"?"width":"height"]+0})}else if(r===1){let a=s-o;t.forEach(h=>{h[e]=a,a+=h[e==="x"?"width":"height"]+0})}}createContainerGraphic(t,e,r,s){let o=new we().roundRect(0,0,e,r,1).fill(t.fill?t.fill.color:"transparent");return s.x===1&&(o.x-=t.width),s.x===.5&&(o.x-=t.width/2),s.y===1&&(o.y-=t.height),s.y===.5&&(o.y-=t.height/2),o}getContainerDimensions(t,e){let r=t.width||0,s=t.height||0;if(!t.direction&&(!t.width||!t.height)&&e.children&&e.children.length>0){let o=1/0,n=-1/0,a=1/0,h=-1/0;e.children.forEach(l=>{let c=l.x||0,u=l.y||0,d=l.width||0,f=l.height||0;o=Math.min(o,c),n=Math.max(n,c+d),a=Math.min(a,u),h=Math.max(h,u+f)}),t.width||(r=n-o,(isNaN(r)||!isFinite(r))&&(r=0)),t.height||(s=h-a,(isNaN(s)||!isFinite(s))&&(s=0))}return{width:r,height:s}}setupScrolling({container:t,element:e,totalHeight:r,totalWidth:s,eventHandler:o,sliderRef:n}){let a=e.scroll&&e.height&&r>e.height,h=e.scroll&&e.width&&s>e.width;if(a||h){let l=0,c=0,u=-r+e.height,d=-s+e.width,f=new we().rect(0,0,e.width||s,e.height||r).fill("red");t.mask=f,t.eventMode="static",t.addChild(f),t.on("wheel",p=>{if(a&&p.deltaY!==0&&(l-p.deltaY>0||l-p.deltaY<u||(l-=p.deltaY,t.y-=p.deltaY,f.y+=p.deltaY)),h&&(p.deltaX!==0||p.shiftKey&&p.deltaY!==0)){let g=p.deltaX!==0?p.deltaX:p.deltaY;if(c-g>0||c-g<d)return;c-=g,t.x-=g,f.x+=g}})}}};var B2={linear:i=>i},I2=(i,t,e,r)=>i+(t-i)*B2[r](e);function OP(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s of t){if(r==null)return e;r=r[s]}return r===void 0?e:r}function NP(i,t,e){typeof t=="string"&&(t=t.split("."));let r=i;for(let s=0;s<t.length-1;s++){let o=t[s];o in r||(r[o]={}),r=r[o]}return r[t[t.length-1]]=e,i}var F2=(i,t)=>{let e=[],r=0,s;i.forEach(({value:n,duration:a,easing:h,relative:l},c)=>{c===0?(s=n,e.push({time:r,value:n,easing:"linear"})):a!==void 0&&h!==void 0&&(r+=a,l?s=s+n:s=n,e.push({time:r,value:s,easing:h}))});let o=0;for(let n=0;n<e.length-1;n++){let{time:a,value:h,easing:l}=e[n],{time:c,value:u}=e[n+1];if(t>=a&&t<=c){let d=(t-a)/(c-a);o=I2(h,u,d,l);break}else t>c&&(o=u)}return o};function G2(i){return Math.max.apply(null,i)}var nx=class{static rendererName="pixi";rendererName="pixi";transitionType="keyframes";_transition=async(t,e,r,s)=>new Promise((o,n)=>{if(s?.aborted){n(new DOMException("Operation aborted","AbortError"));return}let{properties:a}=r,h=Array.isArray(a)?a:Object.entries(a).map(([x,v])=>({...v,property:x})),l=h.map(x=>x.keyframes.reduce((v,_)=>v+_.duration||0,0)),c=G2(l),u=0,d={};h.forEach(x=>{d[x.property]=OP(e,x.property)});let f=x=>{let v={};h.forEach(_=>{let b=[];_.initialValue!==void 0?b=[{value:_.initialValue,duration:0}]:b=[{value:d[_.property],duration:0}],b=b.concat(_.keyframes),NP(v,_.property,F2(b,x))}),h.forEach(_=>{let{property:b}=_;e&&!e.destroyed&&NP(e,b,OP(v,b))})},p=()=>{t.ticker.remove(g),f(c)};s&&s.addEventListener("abort",()=>{p(),n(new DOMException("Operation aborted","AbortError"))});let g=x=>{if(u+=x.deltaMS,u>=c){t.ticker.remove(g),o();return}f(u)};if(s?.aborted){p(),n(new DOMException("Operation aborted","AbortError"));return}t.ticker.add(g)});add=async(t,e,r,s)=>this._transition(t,e,r,s);remove=async(t,e,r,s)=>this._transition(t,e,r,s)};var ax=class{static rendererName="pixi";rendererName="pixi";rendererType="rect";add=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a,eventHandler:h}=e,l=new we;l.label=o.id,l.interactiveChildren=!1,l.eventMode="none",o.x!==void 0&&(l.x=o.x),o.y!==void 0&&(l.y=o.y),o.alpha!==void 0&&(l.alpha=o.alpha),o.scaleX!==void 0&&(l.scale.x=o.scaleX),o.scaleY!==void 0&&(l.scale.y=o.scaleY),o.rotation!==void 0&&(l.rotation=o.rotation*Math.PI/180),o.cursor&&(l.cursor=o.cursor),o.pointerDown&&l.on("pointerdown",f=>{f.stopPropagation(),h&&h(o.pointerDown,{x:f.global.x,y:f.global.y})}),o.pointerUp&&l.on("pointerup",f=>{f.stopPropagation(),h&&h(o.pointerUp,{x:f.global.x,y:f.global.y})}),o.pointerMove&&l.on("pointermove",f=>{f.stopPropagation(),h&&h(o.pointerMove,{x:f.global.x,y:f.global.y})}),(o.cursor||o.pointerDown||o.pointerUp||o.pointerMove)&&(l.eventMode="static");let c=o.width,u=o.height;l.roundRect(0,0,c,u,o.radius??0),o.fill&&l.fill(o.fill),o.border&&l.stroke({width:o.border.width,color:o.border.color,alpha:o.border.alpha??1,alignment:o.border.alignment??1}),o.anchorX!==void 0&&(l.pivot.x=c*o.anchorX),o.anchorY!==void 0&&(l.pivot.y=u*o.anchorY),(o.clickEventName||o.rightClickEventName)&&h&&(l.eventMode="static",l.on("pointerup",f=>{f.stopPropagation(),f.button===0?h(o.clickEventName,o.clickEventPayload):f.button===2&&h(o.rightClickEventName,o.rightClickEventPayload)})),o.wheelEventName&&h&&(l.eventMode="static",l.on("wheel",f=>{f.stopPropagation(),h(o.wheelEventName,{deltaY:f.deltaY})}));let d=[];for(let f of n)if(f.elementId===o.id&&f.event===ne.Add){let p=a(f.type);if(!p)throw new Error(`Transition class not found for type ${f.type}`);d.push(p.add(t,l,f,r))}s.addChild(l),await Promise.all(d)};remove=async(t,e,r)=>{if(r?.aborted)throw new DOMException("Operation aborted","AbortError");let{parent:s,element:o,transitions:n=[],getTransitionByType:a}=e,h=s.getChildByName(o.id);if(!h)throw new Error(`Rect with id ${o.id} not found`);let l=[];for(let c of n)if(c.elementId===o.id&&c.event===ne.Remove){let u=a(c.type);if(!u)throw new Error(`Transition class not found for type ${c.type}`);l.push(u.remove(t,h,c,r))}await Promise.all(l),h&&h.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o=[],getTransitionByType:n,eventHandler:a},h)=>{if(h?.aborted)throw new DOMException("Operation aborted","AbortError");let l=e.getChildByName(r.id);if(!l)throw new Error(`Rect with id ${r.id} not found`);let c=[];for(let u of o)if(u.elementId===r.id&&u.event===ne.Update){let d=n(u.type);if(!d)throw new Error(`Transition class not found for type ${u.type}`);c.push(d.add(t,l,u,h))}if(c.length>0)await Promise.all(c),(r.width!==s.width||r.height!==s.height||r.fill!==s.fill)&&(l.clear(),l.rect(0,0,s.width,s.height),l.fill(s.fill)),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY);else{r.x!==void 0&&s.x!==r.x&&(l.x=s.x),r.y!==void 0&&s.y!==r.y&&(l.y=s.y),r.alpha!==void 0&&s.alpha!==r.alpha&&(l.alpha=s.alpha),r.scaleX!==void 0&&s.scaleX!==r.scaleX&&(l.scale.x=s.scaleX),r.scaleY!==void 0&&s.scaleY!==r.scaleY&&(l.scale.y=s.scaleY),r.rotation!==void 0&&s.rotation!==r.rotation&&(l.rotation=s.rotation*Math.PI/180);let u=JSON.stringify(r.border)!==JSON.stringify(s.border);(r.width!==s.width||r.height!==s.height||r.radius!==s.radius||r.fill!==s.fill||u)&&(l.clear(),l.roundRect(0,0,s.width,s.height,s.radius??0),s.fill&&l.fill(s.fill),s.border&&l.stroke({width:s.border.width,color:s.border.color,alpha:s.border.alpha??1,alignment:s.border.alignment??1})),r.anchorX!==void 0&&s.anchorX!==r.anchorX&&(l.pivot.x=s.width*s.anchorX),r.anchorY!==void 0&&s.anchorY!==r.anchorY&&(l.pivot.y=s.height*s.anchorY)}}};var hx=class extends Bi{static rendererName="pixi";rendererName="pixi";rendererType="slider";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o,eventHandler:n,ref:a})=>{let{direction:h,idleThumb:l,hoverThumb:c,idleBar:u,hoverBar:d,dragEndEventName:f,dragEventName:p,dragEventPayload:g,initialValue:x}=r,v={horizontal:{axis:"x",size:"width"},vertical:{axis:"y",size:"height"}},_=v[h].axis,b=v[h].size,T=I.from(l),E=I.from(c),A=I.from(u),C=I.from(d),M=new de({texture:A,anchor:{x:0,y:0}});M.label=r.id;let P=M[b];M.x=r.x||0,M.y=r.y||0;let S=new de({texture:T,anchor:{x:.5,y:.5}});if(S.y=M.height/2,S.x=M.width/2,S.eventMode="static",S.cursor="hover",M.eventMode="static",M.cursor="hover",S.on("pointerdown",F).on("pointerup",W).on("pointerupoutside",W),M.on("pointerdown",w).on("pointerup",B).on("pointerupoutside",B),M.addChild(S),x!==void 0){let G=S[b]/2;S[_]=x/100*(P-S[b])+G}function w(G){S.texture=E,M.texture=C,z(G),t.stage.eventMode="static",t.stage.addEventListener("pointermove",z)}function B(G){S.texture=T,M.texture=A,z(G),t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",z)}function F(G){G.stopPropagation(),S.texture=E,M.texture=C,t.stage.eventMode="static",t.stage.addEventListener("pointermove",z)}function W(G){if(S.texture=T,M.texture=A,t.stage.eventMode="auto",t.stage.removeEventListener("pointermove",z),f){let N=M.toLocal(G.global)[_],O=S[b]/2;S[_]=Math.max(0+O,Math.min(N,P-O));let Y=Math.floor((S[_]-O)/(P-S[b])*100),lt=JSON.stringify(g);n&&n(f,JSON.parse(lt.replace('"{{ value }}"',String(Y))))}}function z(G){let N=M.toLocal(G.global)[_],O=S[b]/2;S[_]=Math.max(0+O,Math.min(N,P-O));let Y=Math.floor((S[_]-O)/(P-S[b])*100);if(p){let lt=JSON.stringify(g);n&&n(p,JSON.parse(lt.replace('"{{ value }}"',String(Y))))}return Y}a&&(a.current={updateValue:G=>{let N=S[b]/2;S[_]=G/100*(P-S[b])+N}});let k=[];for(let G of s)if(G.elementId===r.id&&G.event===ne.Add){let N=o(G.type);if(!N)throw new Error(`Transition class not found for type ${G.type}`);k.push(N.add(t,M,G))}e.addChild(M),await Promise.all(k)};remove=async(t,e)=>{let{parent:r,element:s,transitions:o=[],getTransitionByType:n}=e,a=r.getChildByName(s.id);if(!a){console.warn(`Sprite with id ${s.id} not found`);return}let h=[];for(let l of o)if(l.elementId===s.id&&l.event===ne.Remove){let c=n(l.type);if(!c)throw new Error(`Transition class not found for type ${l.type}`);h.push(c.remove(t,a,l))}await Promise.all(h),a.destroy()};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n,eventHandler:a})=>{if(!e.getChildByName(r.id)){console.warn(`Slider with id ${r.id} not found`,{parent:e});return}JSON.stringify(r)!==JSON.stringify(s)&&await Promise.all([this.remove(t,{parent:e,element:r,transitions:o,getTransitionByType:n,eventHandler:a}),this.add(t,{parent:e,element:s,transitions:o,getTransitionByType:n,eventHandler:a})])}};var lx=class extends Bi{static rendererName="pixi";rendererName="pixi";rendererType="audio";add=async(t,{parent:e,element:r,transitions:s=[],getTransitionByType:o})=>{r.delay?setTimeout(()=>{t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})},r.delay):t.audioStage.add({id:r.id,url:r.url,loop:r.loop??!1,volume:r.volume??1})};remove=async(t,e)=>{let{element:r}=e;t.audioStage.remove(r.id)};update=async(t,{parent:e,prevElement:r,nextElement:s,transitions:o,getTransitionByType:n})=>{if(r.url!==s.url||r.volume!==s.volume){let a=t.audioStage.getById(r.id);a&&(a.url=s.url,a.volume=s.volume??1)}}};var cx=class{constructor(){this.cache=new Map}async load(t){let e=[];for(let[r,s]of Object.entries(t))this.cache.has(r)||e.push([r,s]);e.length>0&&await Promise.all(e.map(async([r,s])=>{let a={buffer:await(await fetch(s.url)).arrayBuffer(),type:s.type};this.cache.set(r,a)}))}getBufferMap(){let t={};for(let[e,r]of this.cache.entries())t[e]=r;return t}clear(){this.cache.clear()}size(){return this.cache.size}has(t){return this.cache.has(t)}},U2=()=>new cx;var axt=kP;export{lx as AudioPlugin,ox as ContainerRendererPlugin,nx as KeyframeTransitionPlugin,ax as RectRendererPlugin,hx as SliderRendererPlugin,rx as SpriteRendererPlugin,ix as TextRendererPlugin,sx as TextRevealingRendererPlugin,U2 as createAssetBufferManager,axt as default};
1629
+ /*! Bundled license information:
1630
+
1631
+ punycode/punycode.js:
1632
+ (*! https://mths.be/punycode v1.4.1 by @mathias *)
1633
+ */